finished GroupManager client, AIs, and ShardPage

This commit is contained in:
Zach 2015-03-08 05:22:51 -05:00
parent 8ba24f287e
commit 44fe794599
13 changed files with 317 additions and 170 deletions

View file

@ -70,7 +70,7 @@ from toontown.estate import DistributedHouse/AI
from toontown.estate import DistributedHouseInterior/AI
from toontown.estate import DistributedGarden/AI
from toontown.shtiker import DeleteManager/AI
from toontown.shtiker import GroupManager/AI
from toontown.groups import GroupManager/AI/UD
from toontown.ai import NewsManager/AI
from toontown.shtiker import PurchaseManager/AI
from toontown.shtiker import NewbiePurchaseManager/AI
@ -1418,13 +1418,20 @@ dclass DeleteManager : DistributedObject {
};
dclass GroupManager : DistributedObject {
createGroup(uint32, uint32, string) clsend airecv;
closeGroup(uint32, uint32) clsend airecv;
addPlayerId(uint32, uint32, uint32) clsend airecv;
removePlayerId(uint32, uint32, uint32) clsend airecv;
getInfo(uint32) clsend airecv;
setInfo(string) clsend airecv;
info(string);
setChildId() clsend airecv;
isPlayerGrouped(uint32);
isInGroup(uint32, uint32);
updateInfo() clsend airecv;
requestInfo() broadcast ram;
getTypeFromId(uint32);
setGroups(string) broadcast ram;
getGroups();
setGroupPlayers(string) broadcast ram;
getGroupPlayers(uint32);
createGroup(uint32, string) clsend airecv;
closeGroup(uint32) clsend airecv;
addPlayerToGroup(uint32, uint32) clsend airecv;
removePlayerFromGroup(uint32, uint32) clsend airecv;
};
struct weeklyCalendarHoliday {

View file

@ -2,7 +2,7 @@
from pandac.PandaModules import *
hashVal = 959103491
hashVal = 315047669
from toontown.coghq import DistributedCashbotBossSafe, DistributedCashbotBossCrane, DistributedBattleFactory, DistributedCashbotBossTreasure, DistributedCogHQDoor, DistributedSellbotHQDoor, DistributedFactoryElevatorExt, DistributedMintElevatorExt, DistributedLawOfficeElevatorExt, DistributedLawOfficeElevatorInt, LobbyManager, DistributedMegaCorp, DistributedFactory, DistributedLawOffice, DistributedLawOfficeFloor, DistributedLift, DistributedDoorEntity, DistributedSwitch, DistributedButton, DistributedTrigger, DistributedCrushableEntity, DistributedCrusherEntity, DistributedStomper, DistributedStomperPair, DistributedLaserField, DistributedGolfGreenGame, DistributedSecurityCamera, DistributedMover, DistributedElevatorMarker, DistributedBarrelBase, DistributedGagBarrel, DistributedBeanBarrel, DistributedHealBarrel, DistributedGrid, ActiveCell, DirectionalCell, CrusherCell, DistributedCrate, DistributedSinkingPlatform, BattleBlocker, DistributedMint, DistributedMintRoom, DistributedMintBattle, DistributedStage, DistributedStageRoom, DistributedStageBattle, DistributedLawbotBossGavel, DistributedLawbotCannon, DistributedLawbotChair, DistributedCogKart, DistributedCountryClub, DistributedCountryClubRoom, DistributedMoleField, DistributedCountryClubBattle, DistributedMaze, DistributedFoodBelt, DistributedBanquetTable, DistributedGolfSpot
@ -11,8 +11,8 @@ from toontown.building import DistributedAnimatedProp, DistributedTrophyMgr, Dis
from toontown.uberdog.DistributedPartyManager import DistributedPartyManager
from otp.friends import FriendManager, AvatarFriendsManager, PlayerFriendsManager, GuildManager, FriendInfo, AvatarFriendInfo
from otp.level import DistributedLevel, DistributedEntity, DistributedInteractiveEntity
from toontown.shtiker import DeleteManager, GroupManager, PurchaseManager, NewbiePurchaseManager
from toontown.pets import DistributedPetProxy
from toontown.shtiker import DeleteManager, PurchaseManager, NewbiePurchaseManager
from toontown.groups import GroupManager
from toontown.uberdog.ClientServicesManager import ClientServicesManager
from toontown.ai import WelcomeValleyManager, NewsManager, DistributedAprilToonsMgr, DistributedBlackCatMgr, DistributedPolarBearMgr, DistributedPolarPlaceEffectMgr, DistributedGreenToonEffectMgr, DistributedResistanceEmoteMgr, DistributedScavengerHuntTarget, DistributedTrickOrTreatTarget, DistributedWinterCarolingTarget, DistributedSillyMeterMgr
from toontown.ai.DistributedTrashcanZeroMgr import DistributedTrashcanZeroMgr
@ -45,6 +45,7 @@ from otp.distributed import Account, ObjectServer, DistributedDistrict, Distribu
from toontown.estate import DistributedCannon, DistributedTarget, EstateManager, DistributedEstate, DistributedHouse, DistributedHouseInterior, DistributedGarden, DistributedHouseDoor, DistributedBankMgr, DistributedMailbox, DistributedFurnitureManager, DistributedFurnitureItem, DistributedBank, DistributedCloset, DistributedTrunk, DistributedPhone, DistributedFireworksCannon, DistributedLawnDecor, DistributedGardenPlot, DistributedGardenBox, DistributedFlower, DistributedGagTree, DistributedStatuary, DistributedToonStatuary, DistributedChangingStatuary, DistributedAnimatedStatuary, DistributedPlantBase, DistributedLawnDecor
from toontown.toon import DistributedToon, DistributedNPCToonBase, DistributedNPCToon, DistributedSmartNPC, DistributedSmartNPC, DistributedNPCSpecialQuestGiver, DistributedNPCFlippyInToonHall, DistributedNPCScientist, DistributedNPCClerk, DistributedNPCTailor, DistributedNPCBlocker, DistributedNPCFisherman, DistributedNPCPartyPerson, DistributedNPCPetclerk, DistributedNPCKartClerk, DistributedNPCGlove, DistributedNPCBanker
from toontown.tutorial import DistributedBattleTutorial, TutorialManager
from toontown.pets import DistributedPetProxy
from toontown.coderedemption.TTCodeRedemptionMgr import TTCodeRedemptionMgr
from toontown.distributed.NonRepeatableRandomSourceAI import NonRepeatableRandomSourceAI
from toontown.ai.DistributedMailboxZeroMgr import DistributedMailboxZeroMgr

View file

@ -22,6 +22,7 @@ OTP_DO_ID_GUILDS = 4650
OTP_DO_ID_ESCROW = 4660
OTP_DO_ID_CLIENT_SERVICES_MANAGER = 4665
OTP_DO_ID_TTU_FRIENDS_MANAGER = 4666
OPT_DO_ID_GROUP_MANAGER = 4667
OTP_DO_ID_GLOBAL_PARTY_MANAGER = 4477
OTP_DO_ID_PIRATES_AVATAR_MANAGER = 4674
OTP_DO_ID_PIRATES_CREW_MANAGER = 4675

View file

@ -47,7 +47,7 @@ from toontown.hood import ZoneUtil
from toontown.pets.PetManagerAI import PetManagerAI
from toontown.safezone.SafeZoneManagerAI import SafeZoneManagerAI
from toontown.suit.SuitInvasionManagerAI import SuitInvasionManagerAI
from toontown.shtiker.GroupManagerAI import GroupManagerAI
from toontown.groups.GroupManagerAI import GroupManagerAI
from toontown.toon import NPCToons
from toontown.toonbase import ToontownGlobals
from toontown.tutorial.TutorialManagerAI import TutorialManagerAI

View file

@ -0,0 +1,20 @@
class GlobalGroup:
def __init__(self, groupType, groupId):
self.activePlayers = []
self.groupType = groupType
self.groupId = groupId
def getGroupPlayers(self):
return self.activePlayers
def isInGroup(self, avId):
if avId in self.activePlayers:
return True
return False
def addPlayerToGroup(self, avId):
self.activePlayers.append(avId)
def removePlayerFromGroup(self, avId):
self.activePlayers.remove(avId)

View file

@ -0,0 +1,78 @@
from pandac.PandaModules import *
from direct.distributed import DistributedObject
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase.ToontownGlobals import *
class GroupManager(DistributedObject.DistributedObject):
notify = DirectNotifyGlobal.directNotify.newCategory('GroupManager')
neverDisable = 1
def __init__(self, cr):
DistributedObject.DistributedObject.__init__(self, cr)
self.shardGroups = {}
self.groupPlayers = {}
self.id2type = {
SellbotHQ: 'VP Group',
CashbotHQ: 'CFO Group',
LawbotHQ: 'CJ Group',
BossbotHQ: 'CEO Group',
}
def announceGenerate(self):
DistributedObject.DistributedObject.announceGenerate(self)
self.cr.groupManager = self
self.d_setChildId()
def delete(self):
DistributedObject.DistributedObject.delete(self)
self.cr.groupManager = None
def d_setChildId(self):
self.sendUpdate('setChildId', [])
def isPlayerGrouped(self, avId):
for group in self.groupPlayers.values():
if avId in group:
return True
return False
def isInGroup(self, avId, groupId):
group = self.groupPlayers.get(groupId)
if group is None:
return False
if avId in group:
return True
return False
def requestInfo(self):
self.sendUpdate('updateInfo', [])
def getTypeFromId(self, groupId):
return self.id2type.get(groupId)
def setGroups(self, shardGroups):
self.shardGroups = eval(shardGroups)
def getGroups(self):
return self.shardGroups
def setGroupPlayers(self, groupPlayers):
self.groupPlayers = eval(groupPlayers)
def getGroupPlayers(self, groupId):
group = self.groupPlayers.get(groupId)
if group is None:
return []
return group
def d_createGroup(self, groupId, groupType):
self.sendUpdate('createGroup', [groupId, groupType])
def d_closeGroup(self, groupId):
self.sendUpdate('closeGroup', [groupId])
def d_addPlayerToGroup(self, groupId, avId):
self.sendUpdate('addPlayerToGroup', [groupId, avId])
def d_removePlayerFromGroup(self, groupId, avId):
self.sendUpdate('removePlayerFromGroup', [groupId, avId])

View file

@ -0,0 +1,129 @@
from pandac.PandaModules import *
from direct.task import Task
from direct.distributed import DistributedObjectAI
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase.ToontownGlobals import *
from GlobalGroup import GlobalGroup
class GroupManagerAI(DistributedObjectAI.DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('GroupManagerAI')
def __init__(self, air):
DistributedObjectAI.DistributedObjectAI.__init__(self, air)
self.sellGroup = GlobalGroup('VP Group', SellbotHQ)
self.cashGroup = GlobalGroup('CFO Group', CashbotHQ)
self.lawGroup = GlobalGroup('CJ Group', LawbotHQ)
self.bossGroup = GlobalGroup('CEO Group', BossbotHQ)
self.shardGroups = {
SellbotHQ: self.sellGroup,
CashbotHQ: self.cashGroup,
LawbotHQ: self.lawGroup,
BossbotHQ: self.bossGroup,
}
self.groupPlayers = {
SellbotHQ: [],
CashbotHQ: [],
LawbotHQ: [],
BossbotHQ: [],
}
self.id2type = {
SellbotHQ: 'VP Group',
CashbotHQ: 'CFO Group',
LawbotHQ: 'CJ Group',
BossbotHQ: 'CEO Group',
}
self.childId = None
def announceGenerate(self):
DistributedObjectAI.DistributedObjectAI.announceGenerate(self)
self.air.groupManager = self
self.confirmActiveToons = taskMgr.doMethodLater(30, self.confirmToonsInGroup, 'confirmActiveToons')
def delete(self):
DistributedObjectAI.DistributedObjectAI.delete(self)
taskMgr.remove('confirmActiveToons')
self.air.groupManager = None
def setChildId(self):
doId = self.air.getAvatarIdFromSender()
self.childId = doId
self.sendUpdateToAvatarId(self.childId, 'requestInfo', [])
def isPlayerGrouped(self, avId):
for group in self.shardGroups.values():
if avId in group.getGroupPlayers():
return True
return False
def isInGroup(self, avId, groupId):
group = self.shardGroups.get(groupId)
if group is None:
return False
if avId in group.getGroupPlayers():
return True
return False
def confirmToonsInGroup(self, task):
for groupId, group in self.groupPlayers.items():
for player in group:
toon = base.cr.doId2do.get(player)
if toon.getZoneId() != groupId:
self.removePlayerFromGroup(groupId, player)
return task.again
def updateInfo(self):
self.d_setGroupPlayers(str(self.groupPlayers))
self.d_setGroups(str(self.id2type))
def getTypeFromId(self, groupId):
return self.id2type.get(groupId)
def d_setGroups(self, shardGroups):
self.sendUpdateToAvatarId(self.childId, 'setGroups', [shardGroups])
def getGroups(self):
return self.shardGroups
def d_setGroupPlayers(self, groupPlayers):
self.sendUpdateToAvatarId(self.childId, 'setGroupPlayers', [groupPlayers])
def getGroupPlayers(self, groupId):
group = self.shardGroups.get(groupId)
if group is None:
return []
players = group.getGroupPlayers()
return players
def createGroup(self, groupId, groupType):
group = self.shardGroups.get(groupId)
if group is not None:
newGroup = DistributedGlobalGroupAI(self.air, groupType, groupId)
self.shardGroups.update(groupId, newGroup)
players = {groupId: self.getGroupPlayers(groupId)}
self.groupPlayers.update(players)
self.updateInfo()
def closeGroup(self, groupId):
group = self.shardGroups.get(groupId)
if group is not None:
self.shardGroups.pop(groupId)
self.groupPlayers.pop(groupId)
self.updateInfo()
def addPlayerToGroup(self, groupId, avId):
group = self.shardGroups.get(groupId)
if group is not None:
if not group.isInGroup(avId):
group.addPlayerToGroup(avId)
players = {groupId: self.getGroupPlayers(groupId)}
self.groupPlayers.update(players)
self.updateInfo()
def removePlayerFromGroup(self, groupId, avId):
group = self.shardGroups.get(groupId)
if group is not None:
if group.isInGroup(avId):
group.removePlayerFromGroup(avId)
players = {groupId: self.getGroupPlayers(groupId)}
self.groupPlayers.update(players)
self.updateInfo()

View file

@ -0,0 +1,15 @@
from direct.distributed import DistributedObjectUD
from direct.directnotify import DirectNotifyGlobal
class GroupManagerUD(DistributedObjectUD.DistributedObjectUD):
notify = DirectNotifyGlobal.directNotify.newCategory('GroupManagerUD')
def __init__(self, air):
DistributedObjectUD.DistributedObjectUD.__init__(self, air)
self.air = air
def announceGenerate(self):
DistributedObjectUD.DistributedObjectUD.announceGenerate(self)
def delete(self):
DistributedObjectUD.DistributedObjectUD.delete(self)

View file

View file

@ -1,43 +0,0 @@
from pandac.PandaModules import *
from direct.distributed import DistributedObject
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import ToontownGlobals
class GroupManager(DistributedObject.DistributedObject):
notify = DirectNotifyGlobal.directNotify.newCategory('GroupManager')
neverDisable = 1
def __init__(self, cr):
DistributedObject.DistributedObject.__init__(self, cr)
self.cr = cr
self.groupStatus = {}
def announceGenerate(self):
DistributedObject.DistributedObject.announceGenerate(self)
self.cr.groupManager = self
self.d_getInfo(0)
def delete(self):
DistributedObject.DistributedObject.delete(self)
self.cr.groupManager = None
def d_createGroup(self, shardId, playerId, groupType):
self.sendUpdate('createGroup', [shardId, playerId, groupType])
def d_closeGroup(self, shardId, groupId):
self.sendUpdate('closeGroup', [shardId, groupId])
def d_addPlayerId(self, shardId, groupId, playerId):
self.sendUpdate('addPlayerId', [shardId, groupId, playerId])
def d_removePlayerId(self, shardId, groupId, playerId):
self.sendUpdate('removePlayerId', [shardId, groupId, playerId])
def d_getInfo(self, shardId):
self.sendUpdate('getInfo', [shardId])
def d_setInfo(self, shardInfo):
self.sendUpdate('setInfo', [shardInfo])
def info(self, groups):
self.groupStatus = eval(groups)

View file

@ -1,61 +0,0 @@
from pandac.PandaModules import *
from direct.distributed import DistributedObjectAI
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import ToontownGlobals
class GroupManagerAI(DistributedObjectAI.DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('GroupManagerAI')
def __init__(self, air):
DistributedObjectAI.DistributedObjectAI.__init__(self, air)
self.air = air
self.shardGroups = {}
def announceGenerate(self):
DistributedObjectAI.DistributedObjectAI.announceGenerate(self)
self.air.groupManager = self
def delete(self):
DistributedObjectAI.DistributedObjectAI.delete(self)
self.air.groupManager = None
def createGroup(self, shardId, playerId, groupType):
if len(self.shardGroups[shardId]) is 0:
groupId = 1
else:
groupId = sorted(self.shardGroups[shardId])[-1]+1
if groupId in self.shardGroups[shardId]:
return
self.shardGroups[shardId][groupId] = [groupType, [playerId]]
avId = self.air.getAvatarIdFromSender()
groups = str(self.shardGroups)
self.sendUpdateToAvatarId(avId, 'info', [groups])
def closeGroup(self, shardId, groupId):
if self.shardGroups[shardId].get(groupId):
del self.shardGroups[shardId][groupId]
avId = self.air.getAvatarIdFromSender()
groups = str(self.shardGroups)
self.sendUpdateToAvatarId(avId, 'info', [groups])
def addPlayerId(self, shardId, groupId, playerId):
if self.shardGroups[shardId].get(groupId) and playerId not in self.shardGroups[shardId].get(groupId):
self.shardGroups[shardId][groupId][1].append(playerId)
avId = self.air.getAvatarIdFromSender()
groups = str(self.shardGroups)
self.sendUpdateToAvatarId(avId, 'info', [groups])
def removePlayerId(self, shardId, groupId, playerId):
if self.shardGroups[shardId].get(groupId):
self.shardGroups[shardId][groupId][1].remove(playerId)
avId = self.air.getAvatarIdFromSender()
groups = str(self.shardGroups)
self.sendUpdateToAvatarId(avId, 'info', [groups])
def getInfo(self, shardId):
avId = self.air.getAvatarIdFromSender()
groups = str(self.shardGroups)
self.sendUpdateToAvatarId(avId, 'info', [groups])
def setInfo(self, shardInfo):
self.shardGroups = eval(shardInfo)

View file

@ -54,7 +54,7 @@ def setupInvasionMarker(node, invasionStatus):
icons.removeNode()
icon.setColor(ICON_COLORS[invasionStatus - 1])
icon.setPos(0.50, 0, 0.01225)
icon.setPos(0.50, 0, 0.0125)
icon.setScale(0.0535)
def removeInvasionMarker(node):
@ -72,8 +72,11 @@ class ShardPage(ShtikerPage.ShtikerPage):
self.shardButtonMap = {}
self.shardButtons = []
self.scrollList = None
self.currentBTP = None
self.currentBTL = None
self.currentBTR = None
self.currentBTI = None
self.currentO = None
self.textRolloverColor = Vec4(1, 1, 0, 1)
self.textDownColor = Vec4(0.5, 0.9, 1, 1)
self.textDisabledColor = Vec4(0.4, 0.8, 0.4, 1)
@ -84,7 +87,6 @@ class ShardPage(ShtikerPage.ShtikerPage):
self.showPop = config.GetBool('show-population', 0)
self.showTotalPop = config.GetBool('show-total-population', 0)
self.noTeleport = config.GetBool('shard-page-disable', 0)
self.groupTypes = ['VP Group', 'CFO Group', 'CJ Group', 'CEO Group']
self.shardGroups = None
self.currentGroupJoined = None
@ -119,12 +121,14 @@ class ShardPage(ShtikerPage.ShtikerPage):
curShardTuples = base.cr.listActiveShards()
curShardTuples.sort(compareShardTuples)
actualShardId = base.localAvatar.defaultShard
base.cr.groupManager.d_getInfo(1)
for i in xrange(len(curShardTuples)):
shardId, name, pop, WVPop, invasionStatus = curShardTuples[i]
if shardId == actualShardId:
self.currentBTP = buttonTuple[0]
self.currentBTL = buttonTuple[1]
self.currentBTR = buttonTuple[2]
self.currentBTI = buttonTuple[3]
self.currentO = [pop, name, shardId]
self.currentBTL['state'] = DGG.DISABLED
self.currentBTR['state'] = DGG.DISABLED
self.reloadRightBrain(pop, name, shardId, buttonTuple)
@ -183,8 +187,8 @@ class ShardPage(ShtikerPage.ShtikerPage):
pos=(0.58, 0, 0.0125),
text=popText,
text_scale=0.06,
text_align=TextNode.ACenter,
text_pos=(-0.215, -0.0165), text_fg=Vec4(0, 0, 0, 1), text3_fg=self.textDisabledColor, text1_bg=self.textRolloverColor, text2_bg=self.textRolloverColor, textMayChange=1, command=self.reloadRightBrain)
text_align=TextNode.ARight,
text_pos=(-0.14, -0.0165), text_fg=Vec4(0, 0, 0, 1), text3_fg=self.textDisabledColor, text1_bg=self.textRolloverColor, text2_bg=self.textRolloverColor, textMayChange=1, command=self.reloadRightBrain)
model.removeNode()
button.removeNode()
@ -197,9 +201,8 @@ class ShardPage(ShtikerPage.ShtikerPage):
return buttonTuple
def makeGroupButton(self, shardId, groupType, groupPop, groupId):
if not groupType in self.groupTypes:
return
def makeGroupButton(self, groupId, groupType):
groupPop = len(base.cr.groupManager.getGroupPlayers(groupId))
groupButtonParent = DirectFrame()
groupButtonL = DirectButton(parent=groupButtonParent, relief=None, text=groupType, text_pos=(0.0, -0.0225), text_scale=0.06, text_align=TextNode.ALeft, text_fg=Vec4(0, 0, 0, 1), text3_fg=self.textDisabledColor, text1_bg=self.textDownColor, text2_bg=self.textRolloverColor, textMayChange=0, command=self.joinGroup)
popText = str(groupPop)
@ -238,15 +241,14 @@ class ShardPage(ShtikerPage.ShtikerPage):
button.removeNode()
buttonTuple = (groupButtonParent, groupButtonR, groupButtonL, leaveButton)
groupButtonL['extraArgs'] = [shardId, groupId, buttonTuple]
leaveButton['extraArgs'] = [shardId, groupId, buttonTuple]
groupButtonL['extraArgs'] = [groupId, buttonTuple]
leaveButton['extraArgs'] = [groupId, buttonTuple]
return buttonTuple
def removeRightBrain(self):
self.districtInfo.find('**/*district-info').removeNode()
def reloadRightBrain(self, shardPop, shardName, shardId, buttonTuple):
base.cr.groupManager.d_getInfo(1)
self.currentRightBrain = (shardPop, shardName, shardId, buttonTuple)
if self.districtInfo.find('**/*district-info'):
self.removeRightBrain()
@ -264,8 +266,11 @@ class ShardPage(ShtikerPage.ShtikerPage):
tImage.setSz(1.35)
self.shardTeleportButton = DirectButton(parent=districtInfoNode, relief=None, pos=(0.4247, 0, 0.25), image=(tImage.find('**/PurchScrn_BTN_UP'), tImage.find('**/PurchScrn_BTN_DN'), tImage.find('**/PurchScrn_BTN_RLVR')), text=tText, text_scale=0.065, text_pos=(0.0, 0.015), text_fg=Vec4(0, 0, 0, 1), textMayChange=1, command=self.choseShard, extraArgs=[shardId])
self.currentBTP = buttonTuple[0]
self.currentBTL = buttonTuple[1]
self.currentBTR = buttonTuple[2]
self.currentBTI = buttonTuple[3]
self.currentO = [shardPop, shardName, shardId]
self.currentBTL['state'] = DGG.DISABLED
self.currentBTR['state'] = DGG.DISABLED
@ -278,11 +283,9 @@ class ShardPage(ShtikerPage.ShtikerPage):
self.shardGroups = []
base.cr.groupManager.d_getInfo(1)
shardId = base.localAvatar.defaultShard - (base.localAvatar.defaultShard % 100000000 % 1000000)
for gid, ginfo in base.cr.groupManager.groupStatus[shardId].items():
btuple = self.makeGroupButton(shardId, ginfo[0], len(ginfo[1]), gid)
if base.localAvatar.doId in ginfo[1]:
for gid, gtype in base.cr.groupManager.id2type.items():
btuple = self.makeGroupButton(gid, gtype)
if base.cr.groupManager.isInGroup(base.localAvatar.doId, gid):
btuple[1]['state'] = DGG.DISABLED
btuple[2]['state'] = DGG.DISABLED
btuple[3].show()
@ -323,8 +326,8 @@ class ShardPage(ShtikerPage.ShtikerPage):
forceHeight=0.065,
items=self.shardGroups)
def joinGroup(self, shardId, groupId, buttonTuple):
self.acceptOnce('confJoin', self.confirmJoinGroup, extraArgs=[shardId, groupId, buttonTuple])
def joinGroup(self, groupId, buttonTuple):
self.acceptOnce('confJoin', self.confirmJoinGroup, extraArgs=[groupId, buttonTuple])
self.joinDialog = TTDialog.TTGlobalDialog(message='Would you like to join this group?', doneEvent='confJoin', style=4)
def rejectGroup(self, reason, suitType=0):
@ -340,7 +343,6 @@ class ShardPage(ShtikerPage.ShtikerPage):
meritType = 'Cogbucks'
elif suitType == 3:
meritType = 'Notices'
print(meritType, suitType, meritType[suitType])
self.rejectDialog = TTDialog.TTGlobalDialog(message='You need more %s!'%meritType, doneEvent='remRjD', style=1)
elif reason == 3:
self.rejectDialog = TTDialog.TTGlobalDialog(message='That group is full!', doneEvent='remRjD', style=1)
@ -353,17 +355,17 @@ class ShardPage(ShtikerPage.ShtikerPage):
self.rejectDialog.cleanup()
del self.rejectDialog
def confirmJoinGroup(self, shardId, groupId, buttonTuple):
def confirmJoinGroup(self, groupId, buttonTuple):
doneStatus = self.joinDialog.doneStatus
self.joinDialog.cleanup()
del self.joinDialog
if doneStatus is not 'ok':
return
for gid in base.cr.groupManager.groupStatus[shardId].keys():
if base.localAvatar.doId in base.cr.groupManager.groupStatus[shardId][gid][1]:
for gid in base.cr.groupManager.id2type.keys():
if base.cr.groupManager.isInGroup(base.localAvatar.doId, gid):
self.rejectGroup(4)
return
if len(base.cr.groupManager.groupStatus[shardId][groupId][1]) >= 8:
if len(base.cr.groupManager.getGroupPlayers(groupId)) >= 8:
self.rejectGroup(3)
return
suitIdx = -1
@ -383,8 +385,8 @@ class ShardPage(ShtikerPage.ShtikerPage):
if not CogDisguiseGlobals.isSuitComplete(parts, suitIdx):
self.rejectGroup(1)
return
base.cr.groupManager.d_addPlayerId(shardId, groupId, base.localAvatar.doId)
base.cr.groupManager.d_getInfo(1)
base.cr.groupManager.d_addPlayerToGroup(groupId, base.localAvatar.doId)
self.currentGroupJoined = groupId
try:
place = base.cr.playGame.getPlace()
except:
@ -392,27 +394,27 @@ class ShardPage(ShtikerPage.ShtikerPage):
place = base.cr.playGame.hood.loader.place
except:
place = base.cr.playGame.hood.place
self.currentGroupJoined = [shardId, groupId]
if ZoneUtil.getCanonicalHoodId(self.getCurrentZoneId()) == groupId:
return
base.cr.groupManager.d_getInfo(1)
place.requestTeleport(groupId, groupId, shardId, -1)
if ZoneUtil.getCanonicalHoodId(self.getCurrentZoneId()) != groupId:
place.requestTeleport(groupId, groupId, base.localAvatar.defaultShard, -1)
else:
btpl = (self.currentBTP, self.currentBTL, self.currentBTR, self.currentBTI)
args = self.currentO.append(btpl)
self.reloadRightBrain(*args)
def leaveGroup(self, shardId, groupId, buttonTuple):
self.acceptOnce('confLeave', self.confirmLeaveGroup, extraArgs=[shardId, groupId, buttonTuple])
def leaveGroup(self, groupId, buttonTuple):
self.acceptOnce('confLeave', self.confirmLeaveGroup, extraArgs=[groupId, buttonTuple])
self.joinDialog = TTDialog.TTGlobalDialog(message='Are you sure you want to leave this group?', doneEvent='confLeave', style=4)
def confirmLeaveGroup(self, shardId, groupId, buttonTuple):
def confirmLeaveGroup(self, groupId, buttonTuple):
doneStatus = self.joinDialog.doneStatus
self.joinDialog.cleanup()
del self.joinDialog
if doneStatus is not 'ok':
return
self.currentGroupJoined = None
if not base.localAvatar.doId in base.cr.groupManager.groupStatus[shardId][groupId][1]:
if not base.cr.groupManager.isInGroup(base.localAvatar.doId, groupId):
return
base.cr.groupManager.d_removePlayerId(shardId, groupId, base.localAvatar.doId)
base.cr.groupManager.d_getInfo(1)
base.cr.groupManager.d_removePlayerFromGroup(groupId, base.localAvatar.doId)
self.currentGroupJoined = None
try:
place = base.cr.playGame.getPlace()
except:
@ -429,8 +431,12 @@ class ShardPage(ShtikerPage.ShtikerPage):
hoodId = 9000
elif groupId == 13000:
hoodId = 3000
base.cr.groupManager.d_getInfo(1)
place.requestTeleport(hoodId, hoodId, shardId, -1)
if ZoneUtil.getCanonicalHoodId(self.getCurrentZoneId()) != hoodId:
place.requestTeleport(hoodId, hoodId, base.localAvatar.defaultShard, -1)
else:
btpl = (self.currentBTP, self.currentBTL, self.currentBTR, self.currentBTI)
args = self.currentO.append(btpl)
self.reloadRightBrain(*args)
def getPopColor(self, pop):
if pop <= self.lowPop:
@ -535,10 +541,11 @@ class ShardPage(ShtikerPage.ShtikerPage):
self.shardButtons.append(buttonTuple[0])
if invasionStatus:
setupInvasionMarker(buttonTuple[3], invasionStatus)
else:
removeInvasionMarker(buttonTuple[3])
setupInvasionMarker(buttonTuple[3], 1)
## if invasionStatus:
## setupInvasionMarker(buttonTuple[3], invasionStatus)
## else:
## removeInvasionMarker(buttonTuple[3])
for shardId, buttonTuple in self.shardButtonMap.items():
@ -561,7 +568,6 @@ class ShardPage(ShtikerPage.ShtikerPage):
helpText += TTLocalizer.ShardPageHelpMove
def enter(self):
base.cr.groupManager.d_getInfo(1)
self.askForShardInfoUpdate()
self.updateScrollList()
currentShardId = self.getCurrentShardId()

View file

@ -48,15 +48,9 @@ class ToontownUberRepository(ToontownInternalRepository):
Create "global" objects.
"""
self.csm = simbase.air.generateGlobalObject(OTP_DO_ID_CLIENT_SERVICES_MANAGER,
'ClientServicesManager')
self.chatAgent = simbase.air.generateGlobalObject(OTP_DO_ID_CHAT_MANAGER,
'ChatAgent')
self.friendsManager = simbase.air.generateGlobalObject(OTP_DO_ID_TTU_FRIENDS_MANAGER,
'TTUFriendsManager')
self.csm = simbase.air.generateGlobalObject(OTP_DO_ID_CLIENT_SERVICES_MANAGER, 'ClientServicesManager')
self.chatAgent = simbase.air.generateGlobalObject(OTP_DO_ID_CHAT_MANAGER, 'ChatAgent')
self.friendsManager = simbase.air.generateGlobalObject(OTP_DO_ID_TTU_FRIENDS_MANAGER, 'TTUFriendsManager')
self.globalPartyMgr = simbase.air.generateGlobalObject(OTP_DO_ID_GLOBAL_PARTY_MANAGER, 'GlobalPartyManager')
self.deliveryManager = simbase.air.generateGlobalObject(OTP_DO_ID_TOONTOWN_DELIVERY_MANAGER, 'DistributedDeliveryManager')
self.groupManager = simbase.air.generateGlobalObject(OPT_DO_ID_GROUP_MANAGER, 'GroupManager')