toontown: initial work on python 3.x support

This commit is contained in:
John Cote 2019-12-30 01:07:56 -05:00
parent cd932aa66e
commit 3c14c14623
927 changed files with 3703 additions and 3700 deletions

View file

@ -1,10 +1,10 @@
import __builtin__ import builtins
class game: class game:
name = 'toontown' name = 'toontown'
process = 'server' process = 'server'
__builtin__.game = game builtins.game = game
from panda3d.core import * from panda3d.core import *
@ -38,5 +38,5 @@ except SystemExit:
raise raise
except Exception: except Exception:
from otp.otpbase import PythonUtil from otp.otpbase import PythonUtil
print PythonUtil.describeException() print(PythonUtil.describeException())
raise raise

View file

@ -1,7 +1,7 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
import HolidayDecorator from . import HolidayDecorator
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from pandac.PandaModules import Vec4, CSDefault, TransformState, NodePath, TransparencyAttrib from pandac.PandaModules import Vec4, CSDefault, TransformState, NodePath, TransparencyAttrib
from libtoontown import loadDNAFile from libtoontown import loadDNAFile

View file

@ -1,5 +1,5 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from ToontownAIMsgTypes import * from .ToontownAIMsgTypes import *
from direct.directnotify.DirectNotifyGlobal import * from direct.directnotify.DirectNotifyGlobal import *
from toontown.toon import DistributedToonAI from toontown.toon import DistributedToonAI
from direct.distributed.PyDatagram import PyDatagram from direct.distributed.PyDatagram import PyDatagram
@ -61,7 +61,7 @@ class DatabaseObject:
if fields != None: if fields != None:
values = {} values = {}
for field in fields: for field in fields:
if self.values.has_key(field): if field in self.values:
values[field] = self.values[field] values[field] = self.values[field]
else: else:
self.notify.warning('Field %s not defined.' % field) self.notify.warning('Field %s not defined.' % field)
@ -128,7 +128,7 @@ class DatabaseObject:
dg.addServerHeader(DBSERVER_ID, self.air.ourChannel, DBSERVER_SET_STORED_VALUES) dg.addServerHeader(DBSERVER_ID, self.air.ourChannel, DBSERVER_SET_STORED_VALUES)
dg.addUint32(self.doId) dg.addUint32(self.doId)
dg.addUint16(len(values)) dg.addUint16(len(values))
items = values.items() items = list(values.items())
for field, value in items: for field, value in items:
dg.addString(field) dg.addString(field)
@ -150,7 +150,7 @@ class DatabaseObject:
def fillin(self, do, dclass): def fillin(self, do, dclass):
do.doId = self.doId do.doId = self.doId
for field, value in self.values.items(): for field, value in list(self.values.items()):
if field == 'setZonesVisited' and value.getLength() == 1: if field == 'setZonesVisited' and value.getLength() == 1:
self.notify.warning('Ignoring broken setZonesVisited') self.notify.warning('Ignoring broken setZonesVisited')
else: else:
@ -172,7 +172,7 @@ class DatabaseObject:
def createObject(self, objectType): def createObject(self, objectType):
values = {} values = {}
for key, value in values.items(): for key, value in list(values.items()):
values[key] = PyDatagram(str(value)) values[key] = PyDatagram(str(value))
context = self.air.dbObjContext context = self.air.dbObjContext
@ -185,10 +185,10 @@ class DatabaseObject:
dg.addString('') dg.addString('')
dg.addUint16(objectType) dg.addUint16(objectType)
dg.addUint16(len(values)) dg.addUint16(len(values))
for field in values.keys(): for field in list(values.keys()):
dg.addString(field) dg.addString(field)
for value in values.values(): for value in list(values.values()):
dg.addString(value.getMessage()) dg.addString(value.getMessage())
self.air.send(dg) self.air.send(dg)
@ -209,5 +209,5 @@ class DatabaseObject:
dg = PyDatagram() dg = PyDatagram()
dg.addServerHeader(DBSERVER_ID, self.air.ourChannel, DBSERVER_DELETE_STORED_OBJECT) dg.addServerHeader(DBSERVER_ID, self.air.ourChannel, DBSERVER_DELETE_STORED_OBJECT)
dg.addUint32(self.doId) dg.addUint32(self.doId)
dg.addUint32(3735928559L) dg.addUint32(3735928559)
self.air.send(dg) self.air.send(dg)

View file

@ -1,7 +1,7 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.distributed import DistributedObject from direct.distributed import DistributedObject
from otp.speedchat import SpeedChatGlobals from otp.speedchat import SpeedChatGlobals
import DistributedScavengerHuntTarget from . import DistributedScavengerHuntTarget
class DistributedTrickOrTreatTarget(DistributedScavengerHuntTarget.DistributedScavengerHuntTarget): class DistributedTrickOrTreatTarget(DistributedScavengerHuntTarget.DistributedScavengerHuntTarget):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedTrickOrTreatTarget') notify = DirectNotifyGlobal.directNotify.newCategory('DistributedTrickOrTreatTarget')

View file

@ -1,7 +1,7 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.distributed import DistributedObject from direct.distributed import DistributedObject
from toontown.speedchat.TTSCIndexedTerminal import TTSCIndexedMsgEvent from toontown.speedchat.TTSCIndexedTerminal import TTSCIndexedMsgEvent
import DistributedScavengerHuntTarget from . import DistributedScavengerHuntTarget
class DistributedWinterCarolingTarget(DistributedScavengerHuntTarget.DistributedScavengerHuntTarget): class DistributedWinterCarolingTarget(DistributedScavengerHuntTarget.DistributedScavengerHuntTarget):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedWinterCarolingTarget') notify = DirectNotifyGlobal.directNotify.newCategory('DistributedWinterCarolingTarget')

View file

@ -1,7 +1,7 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
import HolidayDecorator from . import HolidayDecorator
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.safezone import Playground from toontown.safezone import Playground
from toontown.town import Street from toontown.town import Street

View file

@ -62,7 +62,7 @@ class HolidayDecorator:
index = int(np.getTag('transformIndex')) index = int(np.getTag('transformIndex'))
transform = loader.holidayPropTransforms.get(index, TransformState.makeIdentity()) transform = loader.holidayPropTransforms.get(index, TransformState.makeIdentity())
newNP.setTransform(NodePath(), transform) newNP.setTransform(NodePath(), transform)
newNP.setTag('transformIndex', `index`) newNP.setTag('transformIndex', repr(index))
s = Sequence(Wait(wait), np.colorScaleInterval(tFadeOut, Vec4(1, 1, 1, 0), startColorScale=Vec4(1, 1, 1, 1), blendType='easeInOut'), Func(np.detachNode), Func(np.clearTransparency), newNP.colorScaleInterval(tFadeOut, Vec4(1, 1, 1, 1), startColorScale=Vec4(1, 1, 1, 0), blendType='easeInOut'), Func(newNP.clearTransparency), Func(newNP.clearColorScale)) s = Sequence(Wait(wait), np.colorScaleInterval(tFadeOut, Vec4(1, 1, 1, 0), startColorScale=Vec4(1, 1, 1, 1), blendType='easeInOut'), Func(np.detachNode), Func(np.clearTransparency), newNP.colorScaleInterval(tFadeOut, Vec4(1, 1, 1, 1), startColorScale=Vec4(1, 1, 1, 0), blendType='easeInOut'), Func(newNP.clearTransparency), Func(newNP.clearColorScale))
p.append(s) p.append(s)

View file

@ -5,9 +5,9 @@ from toontown.toonbase import ToontownGlobals
from toontown.toonbase import ToontownBattleGlobals from toontown.toonbase import ToontownBattleGlobals
from toontown.battle import SuitBattleGlobals from toontown.battle import SuitBattleGlobals
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
import HolidayDecorator from . import HolidayDecorator
import HalloweenHolidayDecorator from . import HalloweenHolidayDecorator
import CrashedLeaderBoardDecorator from . import CrashedLeaderBoardDecorator
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
import calendar import calendar
from copy import deepcopy from copy import deepcopy
@ -323,11 +323,11 @@ class NewsManager(DistributedObject.DistributedObject):
def isStarting(id): def isStarting(id):
return id not in self.holidayIdList return id not in self.holidayIdList
toEnd = filter(isEnding, self.holidayIdList) toEnd = list(filter(isEnding, self.holidayIdList))
for endingHolidayId in toEnd: for endingHolidayId in toEnd:
self.endHoliday(endingHolidayId) self.endHoliday(endingHolidayId)
toStart = filter(isStarting, holidayIdList) toStart = list(filter(isStarting, holidayIdList))
for startingHolidayId in toStart: for startingHolidayId in toStart:
self.startHoliday(startingHolidayId) self.startHoliday(startingHolidayId)
@ -461,11 +461,11 @@ class NewsManager(DistributedObject.DistributedObject):
def setSpookyBlackCatHolidayStart(self): def setSpookyBlackCatHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.SpookyBlackCatHolidayStart) base.localAvatar.setSystemMessage(0, TTLocalizer.SpookyBlackCatHolidayStart)
for currToon in base.cr.toons.values(): for currToon in list(base.cr.toons.values()):
currToon.setDNA(currToon.style.clone()) currToon.setDNA(currToon.style.clone())
def setSpookyBlackCatHolidayEnd(self): def setSpookyBlackCatHolidayEnd(self):
for currToon in base.cr.toons.values(): for currToon in list(base.cr.toons.values()):
currToon.setDNA(currToon.style.clone()) currToon.setDNA(currToon.style.clone())
def setTopToonsMarathonStart(self): def setTopToonsMarathonStart(self):

View file

@ -59,7 +59,7 @@ class ServerEventMultiAccumulator(ServerEventBuffer):
if not len(self.events): if not len(self.events):
return return
msg = '' msg = ''
eventNames = self.events.keys() eventNames = list(self.events.keys())
eventNames.sort() eventNames.sort()
for eventName in eventNames: for eventName in eventNames:
msg += '%s:%s' % (eventName, self.events[eventName]) msg += '%s:%s' % (eventName, self.events[eventName])

View file

@ -6,10 +6,10 @@ TTAIMsgName2Id = {'DBSERVER_GET_ESTATE': 1040,
'WHITELIST_MANAGER_UD_TO_ALL_AI': 1044} 'WHITELIST_MANAGER_UD_TO_ALL_AI': 1044}
TTAIMsgId2Names = invertDictLossless(TTAIMsgName2Id) TTAIMsgId2Names = invertDictLossless(TTAIMsgName2Id)
if not isClient(): if not isClient():
print 'EXECWARNING ToontownAIMsgTypes: %s' % TTAIMsgName2Id print('EXECWARNING ToontownAIMsgTypes: %s' % TTAIMsgName2Id)
printStack() printStack()
for name, value in TTAIMsgName2Id.items(): for name, value in list(TTAIMsgName2Id.items()):
exec '%s = %s' % (name, value) exec('%s = %s' % (name, value))
del name del name
del value del value

View file

@ -226,7 +226,7 @@ class ToontownAIRepository(ToontownInternalRepository):
self.welcomeValleyManager.createWelcomeValleyZones() self.welcomeValleyManager.createWelcomeValleyZones()
# Assign the initial suit buildings. # Assign the initial suit buildings.
for suitPlanner in self.suitPlanners.values(): for suitPlanner in list(self.suitPlanners.values()):
suitPlanner.assignInitialSuitBuildings() suitPlanner.assignInitialSuitBuildings()
def genDNAFileName(self, zoneId): def genDNAFileName(self, zoneId):
@ -258,7 +258,7 @@ class ToontownAIRepository(ToontownInternalRepository):
found = vfs.resolveFilename(filename, searchPath) found = vfs.resolveFilename(filename, searchPath)
if not found: if not found:
self.notify.warning('lookupDNAFileName - %s not found on:' % dnaFileName) self.notify.warning('lookupDNAFileName - %s not found on:' % dnaFileName)
print searchPath print(searchPath)
else: else:
return filename.getFullpath() return filename.getFullpath()
@ -287,7 +287,7 @@ class ToontownAIRepository(ToontownInternalRepository):
kartPads.append(viewPad) kartPads.append(viewPad)
kartPadGroups.append(dnaData) kartPadGroups.append(dnaData)
for i in xrange(dnaData.getNumChildren()): for i in range(dnaData.getNumChildren()):
foundKartPads, foundKartPadGroups = self.findRacingPads(dnaData.at(i), zoneId, area, type, overrideDNAZone) foundKartPads, foundKartPadGroups = self.findRacingPads(dnaData.at(i), zoneId, area, type, overrideDNAZone)
kartPads.extend(foundKartPads) kartPads.extend(foundKartPads)
kartPadGroups.extend(foundKartPadGroups) kartPadGroups.extend(foundKartPadGroups)
@ -306,7 +306,7 @@ class ToontownAIRepository(ToontownInternalRepository):
leaderBoard.generateWithRequired(zoneId) leaderBoard.generateWithRequired(zoneId)
leaderBoards.append(leaderBoard) leaderBoards.append(leaderBoard)
for i in xrange(dnaData.getNumChildren()): for i in range(dnaData.getNumChildren()):
foundLeaderBoards = self.findLeaderBoards(dnaData.at(i), zoneId) foundLeaderBoards = self.findLeaderBoards(dnaData.at(i), zoneId)
leaderBoards.extend(foundLeaderBoards) leaderBoards.extend(foundLeaderBoards)

View file

@ -104,10 +104,10 @@ class ToontownMagicWordManager(MagicWordManager.MagicWordManager):
go = Fanfare.makeFanfareWithMessageImage(0, base.localAvatar, 1, "You just did a ~fanfare. Here's a rake.", Vec2(0, 0.2), 0.08, base.localAvatar.inventory.buttonLookup(1, 1), Vec3(0, 0, 0), 4) go = Fanfare.makeFanfareWithMessageImage(0, base.localAvatar, 1, "You just did a ~fanfare. Here's a rake.", Vec2(0, 0.2), 0.08, base.localAvatar.inventory.buttonLookup(1, 1), Vec3(0, 0, 0), 4)
Sequence(go[0], Func(go[1].show), LerpColorScaleInterval(go[1], duration=0.5, startColorScale=Vec4(1, 1, 1, 0), colorScale=Vec4(1, 1, 1, 1)), Wait(2), LerpColorScaleInterval(go[1], duration=0.5, startColorScale=Vec4(1, 1, 1, 1), colorScale=Vec4(1, 1, 1, 0)), Func(go[1].remove)).start() Sequence(go[0], Func(go[1].show), LerpColorScaleInterval(go[1], duration=0.5, startColorScale=Vec4(1, 1, 1, 0), colorScale=Vec4(1, 1, 1, 1)), Wait(2), LerpColorScaleInterval(go[1], duration=0.5, startColorScale=Vec4(1, 1, 1, 1), colorScale=Vec4(1, 1, 1, 0)), Func(go[1].remove)).start()
elif wordIs('~endgame'): elif wordIs('~endgame'):
print 'Requesting minigame abort...' print('Requesting minigame abort...')
messenger.send('minigameAbort') messenger.send('minigameAbort')
elif wordIs('~wingame'): elif wordIs('~wingame'):
print 'Requesting minigame victory...' print('Requesting minigame victory...')
messenger.send('minigameVictory') messenger.send('minigameVictory')
elif wordIs('~walk'): elif wordIs('~walk'):
try: try:
@ -139,7 +139,7 @@ class ToontownMagicWordManager(MagicWordManager.MagicWordManager):
self.rogues.animate() self.rogues.animate()
self.acceptOnce('mouse1', self.exit_rogues) self.acceptOnce('mouse1', self.exit_rogues)
elif wordIs('~showPaths'): elif wordIs('~showPaths'):
for obj in self.cr.doId2do.values(): for obj in list(self.cr.doId2do.values()):
if isinstance(obj, DistributedSuitPlanner.DistributedSuitPlanner): if isinstance(obj, DistributedSuitPlanner.DistributedSuitPlanner):
obj.showPaths() obj.showPaths()
@ -147,7 +147,7 @@ class ToontownMagicWordManager(MagicWordManager.MagicWordManager):
if hasattr(place, 'showPaths'): if hasattr(place, 'showPaths'):
place.showPaths() place.showPaths()
elif wordIs('~hidePaths'): elif wordIs('~hidePaths'):
for obj in self.cr.doId2do.values(): for obj in list(self.cr.doId2do.values()):
if isinstance(obj, DistributedSuitPlanner.DistributedSuitPlanner): if isinstance(obj, DistributedSuitPlanner.DistributedSuitPlanner):
obj.hidePaths() obj.hidePaths()
@ -221,7 +221,7 @@ class ToontownMagicWordManager(MagicWordManager.MagicWordManager):
if not camParent.isEmpty(): if not camParent.isEmpty():
myCam.wrtReparentTo(camParent) myCam.wrtReparentTo(camParent)
self.setMagicWordResponse(response) self.setMagicWordResponse(response)
print response print(response)
elif wordIs('~sync'): elif wordIs('~sync'):
tm = base.cr.timeManager tm = base.cr.timeManager
if tm == None: if tm == None:
@ -581,7 +581,7 @@ class ToontownMagicWordManager(MagicWordManager.MagicWordManager):
hoodId = ToontownGlobals.PartyHood hoodId = ToontownGlobals.PartyHood
ToontownDistrictStats.refresh('shardInfoUpdated') ToontownDistrictStats.refresh('shardInfoUpdated')
curShardTuples = base.cr.listActiveShards() curShardTuples = base.cr.listActiveShards()
lowestPop = 100000000000000000L lowestPop = 100000000000000000
shardId = None shardId = None
for shardInfo in curShardTuples: for shardInfo in curShardTuples:
pop = shardInfo[2] pop = shardInfo[2]
@ -680,7 +680,7 @@ class ToontownMagicWordManager(MagicWordManager.MagicWordManager):
def identifyDistributedObjects(self, name): def identifyDistributedObjects(self, name):
result = [] result = []
lowerName = string.lower(name) lowerName = string.lower(name)
for obj in base.cr.doId2do.values(): for obj in list(base.cr.doId2do.values()):
className = obj.__class__.__name__ className = obj.__class__.__name__
try: try:
name = obj.getName() name = obj.getName()
@ -741,7 +741,7 @@ class ToontownMagicWordManager(MagicWordManager.MagicWordManager):
def doBossBattle(self, word): def doBossBattle(self, word):
args = word.split() args = word.split()
bossCog = None bossCog = None
for distObj in self.cr.doId2do.values(): for distObj in list(self.cr.doId2do.values()):
if isinstance(distObj, DistributedBossCog.DistributedBossCog): if isinstance(distObj, DistributedBossCog.DistributedBossCog):
bossCog = distObj bossCog = distObj
break break

View file

@ -133,7 +133,7 @@ def getDefaultSuitAttack():
def findToonAttack(toons, attacks, track): def findToonAttack(toons, attacks, track):
foundAttacks = [] foundAttacks = []
for t in toons: for t in toons:
if attacks.has_key(t): if t in attacks:
attack = attacks[t] attack = attacks[t]
local_track = attack[TOON_TRACK_COL] local_track = attack[TOON_TRACK_COL]
if track != NPCSOS and attack[TOON_TRACK_COL] == NPCSOS: if track != NPCSOS and attack[TOON_TRACK_COL] == NPCSOS:

View file

@ -1,9 +1,9 @@
from BattleBase import * from .BattleBase import *
from DistributedBattleAI import * from .DistributedBattleAI import *
from toontown.toonbase.ToontownBattleGlobals import * from toontown.toonbase.ToontownBattleGlobals import *
import random import random
from toontown.suit import DistributedSuitBaseAI from toontown.suit import DistributedSuitBaseAI
import SuitBattleGlobals, BattleExperienceAI from . import SuitBattleGlobals, BattleExperienceAI
from toontown.toon import NPCToons from toontown.toon import NPCToons
from toontown.pets import PetTricks, DistributedPetProxyAI from toontown.pets import PetTricks, DistributedPetProxyAI
from direct.showbase.PythonUtil import lerp from direct.showbase.PythonUtil import lerp
@ -166,7 +166,7 @@ class BattleCalculatorAI:
prevAttack = self.battle.toonAttacks[prevAtkId] prevAttack = self.battle.toonAttacks[prevAtkId]
prevAtkTrack = self.__getActualTrack(prevAttack) prevAtkTrack = self.__getActualTrack(prevAttack)
lure = atkTrack == LURE and (not attackAffectsGroup(atkTrack, atkLevel, lure = atkTrack == LURE and (not attackAffectsGroup(atkTrack, atkLevel,
attack[TOON_TRACK_COL]) and self.successfulLures.has_key(attack[TOON_TGT_COL]) or attackAffectsGroup(atkTrack, atkLevel, attack[TOON_TRACK_COL])) attack[TOON_TRACK_COL]) and attack[TOON_TGT_COL] in self.successfulLures or attackAffectsGroup(atkTrack, atkLevel, attack[TOON_TRACK_COL]))
if atkTrack == prevAtkTrack and (attack[TOON_TGT_COL] == prevAttack[TOON_TGT_COL] or lure): if atkTrack == prevAtkTrack and (attack[TOON_TGT_COL] == prevAttack[TOON_TGT_COL] or lure):
if prevAttack[TOON_ACCBONUS_COL] == 1: if prevAttack[TOON_ACCBONUS_COL] == 1:
if debug: if debug:
@ -280,7 +280,7 @@ class BattleCalculatorAI:
return NO_ATTACK return NO_ATTACK
def getSuitTrapType(self, suitId): def getSuitTrapType(self, suitId):
if self.traps.has_key(suitId): if suitId in self.traps:
if self.traps[suitId][0] == self.TRAP_CONFLICT: if self.traps[suitId][0] == self.TRAP_CONFLICT:
return NO_TRAP return NO_TRAP
else: else:
@ -289,7 +289,7 @@ class BattleCalculatorAI:
return NO_TRAP return NO_TRAP
def __suitTrapDamage(self, suitId): def __suitTrapDamage(self, suitId):
if self.traps.has_key(suitId): if suitId in self.traps:
return self.traps[suitId][2] return self.traps[suitId][2]
else: else:
return 0 return 0
@ -297,7 +297,7 @@ class BattleCalculatorAI:
def addTrainTrapForJoiningSuit(self, suitId): def addTrainTrapForJoiningSuit(self, suitId):
self.notify.debug('addTrainTrapForJoiningSuit suit=%d self.traps=%s' % (suitId, self.traps)) self.notify.debug('addTrainTrapForJoiningSuit suit=%d self.traps=%s' % (suitId, self.traps))
trapInfoToUse = None trapInfoToUse = None
for trapInfo in self.traps.values(): for trapInfo in list(self.traps.values()):
if trapInfo[0] == UBER_GAG_LEVEL_INDEX: if trapInfo[0] == UBER_GAG_LEVEL_INDEX:
trapInfoToUse = trapInfo trapInfoToUse = trapInfo
break break
@ -310,14 +310,14 @@ class BattleCalculatorAI:
def __addSuitGroupTrap(self, suitId, trapLvl, attackerId, allSuits, npcDamage=0): def __addSuitGroupTrap(self, suitId, trapLvl, attackerId, allSuits, npcDamage=0):
if npcDamage == 0: if npcDamage == 0:
if self.traps.has_key(suitId): if suitId in self.traps:
if self.traps[suitId][0] == self.TRAP_CONFLICT: if self.traps[suitId][0] == self.TRAP_CONFLICT:
pass pass
else: else:
self.traps[suitId][0] = self.TRAP_CONFLICT self.traps[suitId][0] = self.TRAP_CONFLICT
for suit in allSuits: for suit in allSuits:
id = suit.doId id = suit.doId
if self.traps.has_key(id): if id in self.traps:
self.traps[id][0] = self.TRAP_CONFLICT self.traps[id][0] = self.TRAP_CONFLICT
else: else:
self.traps[id] = [ self.traps[id] = [
@ -336,7 +336,7 @@ class BattleCalculatorAI:
self.notify.debug('calling __addLuredSuitsDelayed') self.notify.debug('calling __addLuredSuitsDelayed')
self.__addLuredSuitsDelayed(attackerId, targetId=-1, ignoreDamageCheck=True) self.__addLuredSuitsDelayed(attackerId, targetId=-1, ignoreDamageCheck=True)
else: else:
if self.traps.has_key(suitId): if suitId in self.traps:
if self.traps[suitId][0] == self.TRAP_CONFLICT: if self.traps[suitId][0] == self.TRAP_CONFLICT:
self.traps[suitId] = [ self.traps[suitId] = [
trapLvl, 0, npcDamage] trapLvl, 0, npcDamage]
@ -347,7 +347,7 @@ class BattleCalculatorAI:
def __addSuitTrap(self, suitId, trapLvl, attackerId, npcDamage=0): def __addSuitTrap(self, suitId, trapLvl, attackerId, npcDamage=0):
if npcDamage == 0: if npcDamage == 0:
if self.traps.has_key(suitId): if suitId in self.traps:
if self.traps[suitId][0] == self.TRAP_CONFLICT: if self.traps[suitId][0] == self.TRAP_CONFLICT:
pass pass
else: else:
@ -363,7 +363,7 @@ class BattleCalculatorAI:
else: else:
self.traps[suitId] = [trapLvl, 0, damage] self.traps[suitId] = [trapLvl, 0, damage]
else: else:
if self.traps.has_key(suitId): if suitId in self.traps:
if self.traps[suitId][0] == self.TRAP_CONFLICT: if self.traps[suitId][0] == self.TRAP_CONFLICT:
self.traps[suitId] = [ self.traps[suitId] = [
trapLvl, 0, npcDamage] trapLvl, 0, npcDamage]
@ -373,28 +373,28 @@ class BattleCalculatorAI:
trapLvl, 0, npcDamage] trapLvl, 0, npcDamage]
def __removeSuitTrap(self, suitId): def __removeSuitTrap(self, suitId):
if self.traps.has_key(suitId): if suitId in self.traps:
del self.traps[suitId] del self.traps[suitId]
def __clearTrapCreator(self, creatorId, suitId=None): def __clearTrapCreator(self, creatorId, suitId=None):
if suitId == None: if suitId == None:
for currTrap in self.traps.keys(): for currTrap in list(self.traps.keys()):
if creatorId == self.traps[currTrap][1]: if creatorId == self.traps[currTrap][1]:
self.traps[currTrap][1] = 0 self.traps[currTrap][1] = 0
elif self.traps.has_key(suitId): elif suitId in self.traps:
self.traps[suitId][1] = 0 self.traps[suitId][1] = 0
return return
def __trapCreator(self, suitId): def __trapCreator(self, suitId):
if self.traps.has_key(suitId): if suitId in self.traps:
return self.traps[suitId][1] return self.traps[suitId][1]
else: else:
return 0 return 0
def __initTraps(self): def __initTraps(self):
self.trainTrapTriggered = False self.trainTrapTriggered = False
keysList = self.traps.keys() keysList = list(self.traps.keys())
for currTrap in keysList: for currTrap in keysList:
if self.traps[currTrap][0] == self.TRAP_CONFLICT: if self.traps[currTrap][0] == self.TRAP_CONFLICT:
del self.traps[currTrap] del self.traps[currTrap]
@ -437,7 +437,7 @@ class BattleCalculatorAI:
targetLured = 1 targetLured = 1
else: else:
attackTrack = TRAP attackTrack = TRAP
if self.traps.has_key(targetId): if targetId in self.traps:
trapInfo = self.traps[targetId] trapInfo = self.traps[targetId]
attackLevel = trapInfo[0] attackLevel = trapInfo[0]
else: else:
@ -467,7 +467,7 @@ class BattleCalculatorAI:
targetLured = 1 targetLured = 1
if attackLevel != -1: if attackLevel != -1:
self.__addLuredSuitsDelayed(toonId, targetId) self.__addLuredSuitsDelayed(toonId, targetId)
if targetLured and (not self.successfulLures.has_key(targetId) or self.successfulLures.has_key(targetId) and self.successfulLures[targetId][1] < atkLevel): if targetLured and (targetId not in self.successfulLures or targetId in self.successfulLures and self.successfulLures[targetId][1] < atkLevel):
self.notify.debug('Adding target ' + str(targetId) + ' to successfulLures list') self.notify.debug('Adding target ' + str(targetId) + ' to successfulLures list')
self.successfulLures[targetId] = [toonId, self.successfulLures[targetId] = [toonId,
atkLevel, atkLevel,
@ -510,7 +510,7 @@ class BattleCalculatorAI:
simbase.air.writeServerEvent('suspicious', toonId, commentStr) simbase.air.writeServerEvent('suspicious', toonId, commentStr)
dislId = toon.DISLid dislId = toon.DISLid
simbase.air.banManager.ban(toonId, dislId, commentStr) simbase.air.banManager.ban(toonId, dislId, commentStr)
print 'Not enough PinkSlips to fire cog - print a warning here' print('Not enough PinkSlips to fire cog - print a warning here')
else: else:
suit.skeleRevives = 0 suit.skeleRevives = 0
attackDamage = suit.getHP() attackDamage = suit.getHP()
@ -554,7 +554,7 @@ class BattleCalculatorAI:
result = result / len(targetList) result = result / len(targetList)
if self.notify.getDebug(): if self.notify.getDebug():
self.notify.debug('Splitting heal among ' + str(len(targetList)) + ' targets') self.notify.debug('Splitting heal among ' + str(len(targetList)) + ' targets')
if self.successfulLures.has_key(targetId) and atkTrack == LURE: if targetId in self.successfulLures and atkTrack == LURE:
self.notify.debug('Updating lure damage to ' + str(result)) self.notify.debug('Updating lure damage to ' + str(result))
self.successfulLures[targetId][3] = result self.successfulLures[targetId][3] = result
else: else:
@ -756,14 +756,14 @@ class BattleCalculatorAI:
attack = self.battle.toonAttacks[attackerId] attack = self.battle.toonAttacks[attackerId]
track = self.__getActualTrack(attack) track = self.__getActualTrack(attack)
if hp: if hp:
if self.hpBonuses[tgtPos].has_key(track): if track in self.hpBonuses[tgtPos]:
self.hpBonuses[tgtPos][track].append([attackIndex, dmg]) self.hpBonuses[tgtPos][track].append([attackIndex, dmg])
else: else:
self.hpBonuses[tgtPos][track] = [ self.hpBonuses[tgtPos][track] = [
[ [
attackIndex, dmg]] attackIndex, dmg]]
elif self.__suitIsLured(currTgt.getDoId()): elif self.__suitIsLured(currTgt.getDoId()):
if self.kbBonuses[tgtPos].has_key(track): if track in self.kbBonuses[tgtPos]:
self.kbBonuses[tgtPos][track].append([attackIndex, dmg]) self.kbBonuses[tgtPos][track].append([attackIndex, dmg])
else: else:
self.kbBonuses[tgtPos][track] = [ self.kbBonuses[tgtPos][track] = [
@ -795,7 +795,7 @@ class BattleCalculatorAI:
self.notify.debug('Processing kbBonuses: ' + repr(self.kbBonuses)) self.notify.debug('Processing kbBonuses: ' + repr(self.kbBonuses))
tgtPos = 0 tgtPos = 0
for currTgt in bonusList: for currTgt in bonusList:
for currAtkType in currTgt.keys(): for currAtkType in list(currTgt.keys()):
if len(currTgt[currAtkType]) > 1 or not hp and len(currTgt[currAtkType]) > 0: if len(currTgt[currAtkType]) > 1 or not hp and len(currTgt[currAtkType]) > 0:
totalDmgs = 0 totalDmgs = 0
for currDmg in currTgt[currAtkType]: for currDmg in currTgt[currAtkType]:
@ -855,10 +855,10 @@ class BattleCalculatorAI:
self.notify.warning('__clearAttack not implemented for suits!') self.notify.warning('__clearAttack not implemented for suits!')
def __rememberToonAttack(self, suitId, toonId, damage): def __rememberToonAttack(self, suitId, toonId, damage):
if not self.SuitAttackers.has_key(suitId): if suitId not in self.SuitAttackers:
self.SuitAttackers[suitId] = {toonId: damage} self.SuitAttackers[suitId] = {toonId: damage}
else: else:
if not self.SuitAttackers[suitId].has_key(toonId): if toonId not in self.SuitAttackers[suitId]:
self.SuitAttackers[suitId][toonId] = damage self.SuitAttackers[suitId][toonId] = damage
else: else:
if self.SuitAttackers[suitId][toonId] <= damage: if self.SuitAttackers[suitId][toonId] <= damage:
@ -882,7 +882,7 @@ class BattleCalculatorAI:
if damageDone > 0: if damageDone > 0:
self.__rememberToonAttack(currTgt.getDoId(), attack[TOON_ID_COL], damageDone) self.__rememberToonAttack(currTgt.getDoId(), attack[TOON_ID_COL], damageDone)
if atkTrack == TRAP: if atkTrack == TRAP:
if self.traps.has_key(currTgt.doId): if currTgt.doId in self.traps:
trapInfo = self.traps[currTgt.doId] trapInfo = self.traps[currTgt.doId]
currTgt.battleTrap = trapInfo[0] currTgt.battleTrap = trapInfo[0]
targetDead = 0 targetDead = 0
@ -895,13 +895,13 @@ class BattleCalculatorAI:
self.__clearTgtDied(currTgt, currLastAtk, attack) self.__clearTgtDied(currTgt, currLastAtk, attack)
tgtId = currTgt.getDoId() tgtId = currTgt.getDoId()
if self.successfulLures.has_key(tgtId) and atkTrack == LURE: if tgtId in self.successfulLures and atkTrack == LURE:
lureInfo = self.successfulLures[tgtId] lureInfo = self.successfulLures[tgtId]
self.notify.debug('applying lure data: ' + repr(lureInfo)) self.notify.debug('applying lure data: ' + repr(lureInfo))
toonId = lureInfo[0] toonId = lureInfo[0]
lureAtk = self.battle.toonAttacks[toonId] lureAtk = self.battle.toonAttacks[toonId]
tgtPos = self.battle.activeSuits.index(currTgt) tgtPos = self.battle.activeSuits.index(currTgt)
if self.traps.has_key(currTgt.doId): if currTgt.doId in self.traps:
trapInfo = self.traps[currTgt.doId] trapInfo = self.traps[currTgt.doId]
if trapInfo[0] == UBER_GAG_LEVEL_INDEX: if trapInfo[0] == UBER_GAG_LEVEL_INDEX:
self.notify.debug('train trap triggered for %d' % currTgt.doId) self.notify.debug('train trap triggered for %d' % currTgt.doId)
@ -1073,20 +1073,20 @@ class BattleCalculatorAI:
def __calcSuitTarget(self, attackIndex): def __calcSuitTarget(self, attackIndex):
attack = self.battle.suitAttacks[attackIndex] attack = self.battle.suitAttacks[attackIndex]
suitId = attack[SUIT_ID_COL] suitId = attack[SUIT_ID_COL]
if self.SuitAttackers.has_key(suitId) and random.randint(0, 99) < 75: if suitId in self.SuitAttackers and random.randint(0, 99) < 75:
totalDamage = 0 totalDamage = 0
for currToon in self.SuitAttackers[suitId].keys(): for currToon in list(self.SuitAttackers[suitId].keys()):
totalDamage += self.SuitAttackers[suitId][currToon] totalDamage += self.SuitAttackers[suitId][currToon]
dmgs = [] dmgs = []
for currToon in self.SuitAttackers[suitId].keys(): for currToon in list(self.SuitAttackers[suitId].keys()):
dmgs.append(self.SuitAttackers[suitId][currToon] / totalDamage * 100) dmgs.append(self.SuitAttackers[suitId][currToon] / totalDamage * 100)
dmgIdx = SuitBattleGlobals.pickFromFreqList(dmgs) dmgIdx = SuitBattleGlobals.pickFromFreqList(dmgs)
if dmgIdx == None: if dmgIdx == None:
toonId = self.__pickRandomToon(suitId) toonId = self.__pickRandomToon(suitId)
else: else:
toonId = self.SuitAttackers[suitId].keys()[dmgIdx] toonId = list(self.SuitAttackers[suitId].keys())[dmgIdx]
if toonId == -1 or toonId not in self.battle.activeToons: if toonId == -1 or toonId not in self.battle.activeToons:
return -1 return -1
self.notify.debug('Suit attacking back at toon ' + str(toonId)) self.notify.debug('Suit attacking back at toon ' + str(toonId))
@ -1177,7 +1177,7 @@ class BattleCalculatorAI:
def __getToonHp(self, toonDoId): def __getToonHp(self, toonDoId):
handle = self.battle.getToon(toonDoId) handle = self.battle.getToon(toonDoId)
if handle != None and self.toonHPAdjusts.has_key(toonDoId): if handle != None and toonDoId in self.toonHPAdjusts:
return handle.hp + self.toonHPAdjusts[toonDoId] return handle.hp + self.toonHPAdjusts[toonDoId]
else: else:
return 0 return 0
@ -1215,14 +1215,14 @@ class BattleCalculatorAI:
return 1 return 1
def __updateSuitAtkStat(self, toonId): def __updateSuitAtkStat(self, toonId):
if self.suitAtkStats.has_key(toonId): if toonId in self.suitAtkStats:
self.suitAtkStats[toonId] += 1 self.suitAtkStats[toonId] += 1
else: else:
self.suitAtkStats[toonId] = 1 self.suitAtkStats[toonId] = 1
def __printSuitAtkStats(self): def __printSuitAtkStats(self):
self.notify.debug('Suit Atk Stats:') self.notify.debug('Suit Atk Stats:')
for currTgt in self.suitAtkStats.keys(): for currTgt in list(self.suitAtkStats.keys()):
if currTgt not in self.battle.activeToons: if currTgt not in self.battle.activeToons:
continue continue
tgtPos = self.battle.activeToons.index(currTgt) tgtPos = self.battle.activeToons.index(currTgt)
@ -1283,7 +1283,7 @@ class BattleCalculatorAI:
self.notify.debug('__updateLureTimeouts()') self.notify.debug('__updateLureTimeouts()')
self.notify.debug('Lured suits: ' + str(self.currentlyLuredSuits)) self.notify.debug('Lured suits: ' + str(self.currentlyLuredSuits))
noLongerLured = [] noLongerLured = []
for currLuredSuit in self.currentlyLuredSuits.keys(): for currLuredSuit in list(self.currentlyLuredSuits.keys()):
self.__incLuredCurrRound(currLuredSuit) self.__incLuredCurrRound(currLuredSuit)
if self.__luredMaxRoundsReached(currLuredSuit) or self.__luredWakeupTime(currLuredSuit): if self.__luredMaxRoundsReached(currLuredSuit) or self.__luredWakeupTime(currLuredSuit):
noLongerLured.append(currLuredSuit) noLongerLured.append(currLuredSuit)
@ -1392,14 +1392,14 @@ class BattleCalculatorAI:
def toonLeftBattle(self, toonId): def toonLeftBattle(self, toonId):
if self.notify.getDebug(): if self.notify.getDebug():
self.notify.debug('toonLeftBattle()' + str(toonId)) self.notify.debug('toonLeftBattle()' + str(toonId))
if self.toonSkillPtsGained.has_key(toonId): if toonId in self.toonSkillPtsGained:
del self.toonSkillPtsGained[toonId] del self.toonSkillPtsGained[toonId]
if self.suitAtkStats.has_key(toonId): if toonId in self.suitAtkStats:
del self.suitAtkStats[toonId] del self.suitAtkStats[toonId]
if not self.CLEAR_SUIT_ATTACKERS: if not self.CLEAR_SUIT_ATTACKERS:
oldSuitIds = [] oldSuitIds = []
for s in self.SuitAttackers.keys(): for s in list(self.SuitAttackers.keys()):
if self.SuitAttackers[s].has_key(toonId): if toonId in self.SuitAttackers[s]:
del self.SuitAttackers[s][toonId] del self.SuitAttackers[s][toonId]
if len(self.SuitAttackers[s]) == 0: if len(self.SuitAttackers[s]) == 0:
oldSuitIds.append(s) oldSuitIds.append(s)
@ -1414,7 +1414,7 @@ class BattleCalculatorAI:
if self.notify.getDebug(): if self.notify.getDebug():
self.notify.debug('suitLeftBattle(): ' + str(suitId)) self.notify.debug('suitLeftBattle(): ' + str(suitId))
self.__removeLured(suitId) self.__removeLured(suitId)
if self.SuitAttackers.has_key(suitId): if suitId in self.SuitAttackers:
del self.SuitAttackers[suitId] del self.SuitAttackers[suitId]
self.__removeSuitTrap(suitId) self.__removeSuitTrap(suitId)
@ -1423,8 +1423,8 @@ class BattleCalculatorAI:
self.notify.debug('updateActiveToons()') self.notify.debug('updateActiveToons()')
if not self.CLEAR_SUIT_ATTACKERS: if not self.CLEAR_SUIT_ATTACKERS:
oldSuitIds = [] oldSuitIds = []
for s in self.SuitAttackers.keys(): for s in list(self.SuitAttackers.keys()):
for t in self.SuitAttackers[s].keys(): for t in list(self.SuitAttackers[s].keys()):
if t not in self.battle.activeToons: if t not in self.battle.activeToons:
del self.SuitAttackers[s][t] del self.SuitAttackers[s][t]
if len(self.SuitAttackers[s]) == 0: if len(self.SuitAttackers[s]) == 0:
@ -1433,7 +1433,7 @@ class BattleCalculatorAI:
for oldSuitId in oldSuitIds: for oldSuitId in oldSuitIds:
del self.SuitAttackers[oldSuitId] del self.SuitAttackers[oldSuitId]
for trap in self.traps.keys(): for trap in list(self.traps.keys()):
if self.traps[trap][1] not in self.battle.activeToons: if self.traps[trap][1] not in self.battle.activeToons:
self.notify.debug('Trap for toon ' + str(self.traps[trap][1]) + ' will no longer give exp') self.notify.debug('Trap for toon ' + str(self.traps[trap][1]) + ' will no longer give exp')
self.traps[trap][1] = 0 self.traps[trap][1] = 0
@ -1442,22 +1442,22 @@ class BattleCalculatorAI:
return BattleExperienceAI.getSkillGained(self.toonSkillPtsGained, toonId, track) return BattleExperienceAI.getSkillGained(self.toonSkillPtsGained, toonId, track)
def getLuredSuits(self): def getLuredSuits(self):
luredSuits = self.currentlyLuredSuits.keys() luredSuits = list(self.currentlyLuredSuits.keys())
self.notify.debug('Lured suits reported to battle: ' + repr(luredSuits)) self.notify.debug('Lured suits reported to battle: ' + repr(luredSuits))
return luredSuits return luredSuits
def __suitIsLured(self, suitId, prevRound=0): def __suitIsLured(self, suitId, prevRound=0):
inList = self.currentlyLuredSuits.has_key(suitId) inList = suitId in self.currentlyLuredSuits
if prevRound: if prevRound:
return inList and self.currentlyLuredSuits[suitId][0] != -1 return inList and self.currentlyLuredSuits[suitId][0] != -1
return inList return inList
def __findAvailLureId(self, lurerId): def __findAvailLureId(self, lurerId):
luredSuits = self.currentlyLuredSuits.keys() luredSuits = list(self.currentlyLuredSuits.keys())
lureIds = [] lureIds = []
for currLured in luredSuits: for currLured in luredSuits:
lurerInfo = self.currentlyLuredSuits[currLured][3] lurerInfo = self.currentlyLuredSuits[currLured][3]
lurers = lurerInfo.keys() lurers = list(lurerInfo.keys())
for currLurer in lurers: for currLurer in lurers:
currId = lurerInfo[currLurer][1] currId = lurerInfo[currLurer][1]
if currLurer == lurerId and currId not in lureIds: if currLurer == lurerId and currId not in lureIds:
@ -1481,9 +1481,9 @@ class BattleCalculatorAI:
credit = 0 credit = 0
else: else:
credit = self.itemIsCredit(LURE, lureLvl) credit = self.itemIsCredit(LURE, lureLvl)
if self.currentlyLuredSuits.has_key(suitId): if suitId in self.currentlyLuredSuits:
lureInfo = self.currentlyLuredSuits[suitId] lureInfo = self.currentlyLuredSuits[suitId]
if not lureInfo[3].has_key(lurer): if lurer not in lureInfo[3]:
lureInfo[1] += maxRounds lureInfo[1] += maxRounds
if wakeChance < lureInfo[2]: if wakeChance < lureInfo[2]:
lureInfo[2] = wakeChance lureInfo[2] = wakeChance
@ -1498,7 +1498,7 @@ class BattleCalculatorAI:
def __getLurers(self, suitId): def __getLurers(self, suitId):
if self.__suitIsLured(suitId): if self.__suitIsLured(suitId):
return self.currentlyLuredSuits[suitId][3].keys() return list(self.currentlyLuredSuits[suitId][3].keys())
return [] return []
def __getLuredExpInfo(self, suitId): def __getLuredExpInfo(self, suitId):
@ -1513,10 +1513,10 @@ class BattleCalculatorAI:
return returnInfo return returnInfo
def __clearLurer(self, lurerId, lureId=-1): def __clearLurer(self, lurerId, lureId=-1):
luredSuits = self.currentlyLuredSuits.keys() luredSuits = list(self.currentlyLuredSuits.keys())
for currLured in luredSuits: for currLured in luredSuits:
lurerInfo = self.currentlyLuredSuits[currLured][3] lurerInfo = self.currentlyLuredSuits[currLured][3]
lurers = lurerInfo.keys() lurers = list(lurerInfo.keys())
for currLurer in lurers: for currLurer in lurers:
if currLurer == lurerId and (lureId == -1 or lureId == lurerInfo[currLurer][1]): if currLurer == lurerId and (lureId == -1 or lureId == lurerInfo[currLurer][1]):
del lurerInfo[currLurer] del lurerInfo[currLurer]
@ -1581,7 +1581,7 @@ class BattleCalculatorAI:
trickId = toonAttack[TOON_LVL_COL] trickId = toonAttack[TOON_LVL_COL]
healRange = PetTricks.TrickHeals[trickId] healRange = PetTricks.TrickHeals[trickId]
hp = 0 hp = 0
if simbase.air.doId2do.has_key(petProxyId): if petProxyId in simbase.air.doId2do:
petProxy = simbase.air.doId2do[petProxyId] petProxy = simbase.air.doId2do[petProxyId]
if trickId < len(petProxy.trickAptitudes): if trickId < len(petProxy.trickAptitudes):
aptitude = petProxy.trickAptitudes[trickId] aptitude = petProxy.trickAptitudes[trickId]
@ -1594,7 +1594,7 @@ class BattleCalculatorAI:
def __calculatePetTrickSuccess(self, toonAttack): def __calculatePetTrickSuccess(self, toonAttack):
petProxyId = toonAttack[TOON_TGT_COL] petProxyId = toonAttack[TOON_TGT_COL]
if not simbase.air.doId2do.has_key(petProxyId): if petProxyId not in simbase.air.doId2do:
self.notify.warning('pet proxy %d not in doId2do!' % petProxyId) self.notify.warning('pet proxy %d not in doId2do!' % petProxyId)
toonAttack[TOON_ACCBONUS_COL] = 1 toonAttack[TOON_ACCBONUS_COL] = 1
return (0, 0) return (0, 0)

View file

@ -1,4 +1,4 @@
import DistributedBattleAI from . import DistributedBattleAI
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
class BattleManagerAI: class BattleManagerAI:
@ -10,15 +10,15 @@ class BattleManagerAI:
self.battleConstructor = DistributedBattleAI.DistributedBattleAI self.battleConstructor = DistributedBattleAI.DistributedBattleAI
def cellHasBattle(self, cellId): def cellHasBattle(self, cellId):
return self.cellId2battle.has_key(cellId) return cellId in self.cellId2battle
def getBattle(self, cellId): def getBattle(self, cellId):
if self.cellId2battle.has_key(cellId): if cellId in self.cellId2battle:
return self.cellId2battle[cellId] return self.cellId2battle[cellId]
return None return None
def newBattle(self, cellId, zoneId, pos, suit, toonId, finishCallback=None, maxSuits=4, interactivePropTrackBonus=-1): def newBattle(self, cellId, zoneId, pos, suit, toonId, finishCallback=None, maxSuits=4, interactivePropTrackBonus=-1):
if self.cellId2battle.has_key(cellId): if cellId in self.cellId2battle:
self.notify.info("A battle is already present in the suit's zone!") self.notify.info("A battle is already present in the suit's zone!")
if not self.requestBattleAddSuit(cellId, suit): if not self.requestBattleAddSuit(cellId, suit):
suit.flyAwayNow() suit.flyAwayNow()

View file

@ -263,7 +263,7 @@ class PropPool:
self.propStrings[propName] = (self.getPath(5, 'half-windsor'),) self.propStrings[propName] = (self.getPath(5, 'half-windsor'),)
self.propTypes[propName] = 'model' self.propTypes[propName] = 'model'
splatAnimFileName = self.getPath(3.5, 'splat-chan') splatAnimFileName = self.getPath(3.5, 'splat-chan')
for splat in Splats.keys(): for splat in list(Splats.keys()):
propName = 'splat-' + splat propName = 'splat-' + splat
self.propStrings[propName] = (self.getPath(3.5, 'splat-mod'), splatAnimFileName) self.propStrings[propName] = (self.getPath(3.5, 'splat-mod'), splatAnimFileName)
self.propTypes[propName] = 'actor' self.propTypes[propName] = 'actor'
@ -376,7 +376,7 @@ class PropPool:
self.props[name] = self.props[name].find('**/trolley_car') self.props[name] = self.props[name].find('**/trolley_car')
def unloadProps(self): def unloadProps(self):
for p in self.props.values(): for p in list(self.props.values()):
if type(p) != type(()): if type(p) != type(()):
self.__delProp(p) self.__delProp(p)
@ -388,7 +388,7 @@ class PropPool:
def __getPropCopy(self, name): def __getPropCopy(self, name):
if self.propTypes[name] == 'actor': if self.propTypes[name] == 'actor':
if not self.props.has_key(name): if name not in self.props:
prop = Actor.Actor() prop = Actor.Actor()
prop.loadModel(self.propStrings[name][0]) prop.loadModel(self.propStrings[name][0])
animDict = {} animDict = {}
@ -400,7 +400,7 @@ class PropPool:
self.makeVariant(name) self.makeVariant(name)
return Actor.Actor(other=self.props[name]) return Actor.Actor(other=self.props[name])
else: else:
if not self.props.has_key(name): if name not in self.props:
prop = loader.loadModel(self.propStrings[name][0]) prop = loader.loadModel(self.propStrings[name][0])
prop.setName(name) prop.setName(name)
self.storeProp(name, prop) self.storeProp(name, prop)

View file

@ -47,7 +47,7 @@ class BattleSounds:
found = vfs.resolveFilename(filename, self.sfxSearchPath) found = vfs.resolveFilename(filename, self.sfxSearchPath)
if not found: if not found:
self.notify.warning('%s not found on:' % name) self.notify.warning('%s not found on:' % name)
print self.sfxSearchPath print(self.sfxSearchPath)
else: else:
return self.mgr.getSound(filename.getFullpath()) return self.mgr.getSound(filename.getFullpath())
return self.mgr.getNullSound() return self.mgr.getNullSound()

View file

@ -1,17 +1,17 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from libotp import * from libotp import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleBase import * from .BattleBase import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.toonbase import ToontownBattleGlobals from toontown.toonbase import ToontownBattleGlobals
import DistributedBattleBase from . import DistributedBattleBase
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import MovieUtil from . import MovieUtil
from toontown.suit import Suit from toontown.suit import Suit
from direct.actor import Actor from direct.actor import Actor
from toontown.toon import TTEmote from toontown.toon import TTEmote
from otp.avatar import Emote from otp.avatar import Emote
import SuitBattleGlobals from . import SuitBattleGlobals
from toontown.distributed import DelayDelete from toontown.distributed import DelayDelete
import random import random

View file

@ -1,9 +1,9 @@
from otp.ai.AIBase import * from otp.ai.AIBase import *
from BattleBase import * from .BattleBase import *
from BattleCalculatorAI import * from .BattleCalculatorAI import *
from toontown.toonbase.ToontownBattleGlobals import * from toontown.toonbase.ToontownBattleGlobals import *
from SuitBattleGlobals import * from .SuitBattleGlobals import *
import DistributedBattleBaseAI from . import DistributedBattleBaseAI
from direct.task import Task from direct.task import Task
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import random import random

View file

@ -1,7 +1,7 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from toontown.toonbase.ToonBaseGlobal import * from toontown.toonbase.ToonBaseGlobal import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleBase import * from .BattleBase import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from toontown.toonbase import ToontownBattleGlobals from toontown.toonbase import ToontownBattleGlobals
from direct.distributed import DistributedNode from direct.distributed import DistributedNode
@ -9,13 +9,13 @@ from direct.fsm import ClassicFSM, State
from direct.fsm import State from direct.fsm import State
from direct.task.Task import Task from direct.task.Task import Task
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import Movie from . import Movie
import MovieUtil from . import MovieUtil
from toontown.suit import Suit from toontown.suit import Suit
from direct.actor import Actor from direct.actor import Actor
import BattleProps from . import BattleProps
from direct.particles import ParticleEffect from direct.particles import ParticleEffect
import BattleParticles from . import BattleParticles
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
from toontown.distributed import DelayDelete from toontown.distributed import DelayDelete
from toontown.toon import TTEmote from toontown.toon import TTEmote
@ -99,28 +99,28 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase):
self.activeIntervals[name] = interval self.activeIntervals[name] = interval
def __cleanupIntervals(self): def __cleanupIntervals(self):
for interval in self.activeIntervals.values(): for interval in list(self.activeIntervals.values()):
interval.finish() interval.finish()
DelayDelete.cleanupDelayDeletes(interval) DelayDelete.cleanupDelayDeletes(interval)
self.activeIntervals = {} self.activeIntervals = {}
def clearInterval(self, name, finish = 0): def clearInterval(self, name, finish = 0):
if self.activeIntervals.has_key(name): if name in self.activeIntervals:
ival = self.activeIntervals[name] ival = self.activeIntervals[name]
if finish: if finish:
ival.finish() ival.finish()
else: else:
ival.pause() ival.pause()
if self.activeIntervals.has_key(name): if name in self.activeIntervals:
DelayDelete.cleanupDelayDeletes(ival) DelayDelete.cleanupDelayDeletes(ival)
if self.activeIntervals.has_key(name): if name in self.activeIntervals:
del self.activeIntervals[name] del self.activeIntervals[name]
else: else:
self.notify.debug('interval: %s already cleared' % name) self.notify.debug('interval: %s already cleared' % name)
def finishInterval(self, name): def finishInterval(self, name):
if self.activeIntervals.has_key(name): if name in self.activeIntervals:
interval = self.activeIntervals[name] interval = self.activeIntervals[name]
interval.finish() interval.finish()
@ -361,7 +361,7 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase):
self.suits = [] self.suits = []
suitGone = 0 suitGone = 0
for s in suits: for s in suits:
if self.cr.doId2do.has_key(s): if s in self.cr.doId2do:
suit = self.cr.doId2do[s] suit = self.cr.doId2do[s]
suit.setState('Battle') suit.setState('Battle')
self.suits.append(suit) self.suits.append(suit)
@ -940,7 +940,7 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase):
self.storeInterval(runMTrack, runName) self.storeInterval(runMTrack, runName)
def getToon(self, toonId): def getToon(self, toonId):
if self.cr.doId2do.has_key(toonId): if toonId in self.cr.doId2do:
return self.cr.doId2do[toonId] return self.cr.doId2do[toonId]
else: else:
self.notify.warning('getToon() - toon: %d not in repository!' % toonId) self.notify.warning('getToon() - toon: %d not in repository!' % toonId)
@ -1135,7 +1135,7 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase):
elif mode == 'PETSOSINFO': elif mode == 'PETSOSINFO':
petProxyId = response['id'] petProxyId = response['id']
self.notify.debug('got a PETSOSINFO for pet: %d' % petProxyId) self.notify.debug('got a PETSOSINFO for pet: %d' % petProxyId)
if base.cr.doId2do.has_key(petProxyId): if petProxyId in base.cr.doId2do:
self.notify.debug('pet: %d was already in the repository' % petProxyId) self.notify.debug('pet: %d was already in the repository' % petProxyId)
proxyGenerateMessage = 'petProxy-%d-generated' % petProxyId proxyGenerateMessage = 'petProxy-%d-generated' % petProxyId
messenger.send(proxyGenerateMessage) messenger.send(proxyGenerateMessage)

View file

@ -1,11 +1,11 @@
from otp.ai.AIBase import * from otp.ai.AIBase import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from BattleBase import * from .BattleBase import *
import BattleCalculatorAI from . import BattleCalculatorAI
from toontown.toonbase.ToontownBattleGlobals import * from toontown.toonbase.ToontownBattleGlobals import *
from SuitBattleGlobals import * from .SuitBattleGlobals import *
from pandac.PandaModules import * from pandac.PandaModules import *
import BattleExperienceAI from . import BattleExperienceAI
from direct.distributed import DistributedObjectAI from direct.distributed import DistributedObjectAI
from direct.fsm import ClassicFSM, State from direct.fsm import ClassicFSM, State
from direct.fsm import State from direct.fsm import State
@ -144,7 +144,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
del suit.battleTrap del suit.battleTrap
del self.finishCallback del self.finishCallback
for petProxy in self.pets.values(): for petProxy in list(self.pets.values()):
petProxy.requestDelete() petProxy.requestDelete()
DistributedObjectAI.DistributedObjectAI.delete(self) DistributedObjectAI.DistributedObjectAI.delete(self)
@ -319,7 +319,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
p.append(self.activeToons) p.append(self.activeToons)
p.append(suitIds) p.append(suitIds)
for t in self.activeToons: for t in self.activeToons:
if self.toonAttacks.has_key(t): if t in self.toonAttacks:
ta = self.toonAttacks[t] ta = self.toonAttacks[t]
index = -1 index = -1
id = ta[TOON_ID_COL] id = ta[TOON_ID_COL]
@ -387,7 +387,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
levels = [] levels = []
targets = [] targets = []
for t in self.activeToons: for t in self.activeToons:
if self.toonAttacks.has_key(t): if t in self.toonAttacks:
ta = self.toonAttacks[t] ta = self.toonAttacks[t]
else: else:
ta = getToonAttack(t) ta = getToonAttack(t)
@ -481,7 +481,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
return 0 return 0
def addToon(self, avId): def addToon(self, avId):
print 'DBB-addToon %s' % avId print('DBB-addToon %s' % avId)
self.notify.debug('addToon(%d)' % avId) self.notify.debug('addToon(%d)' % avId)
toon = self.getToon(avId) toon = self.getToon(avId)
if toon == None: if toon == None:
@ -682,7 +682,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
self.notify.warning('removeToon() - toon: %d was adjusting!' % toonId) self.notify.warning('removeToon() - toon: %d was adjusting!' % toonId)
self.adjustingToons.remove(toonId) self.adjustingToons.remove(toonId)
self.toonGone = 1 self.toonGone = 1
if self.pets.has_key(toonId): if toonId in self.pets:
self.pets[toonId].requestDelete() self.pets[toonId].requestDelete()
del self.pets[toonId] del self.pets[toonId]
self.__removeResponse(toonId) self.__removeResponse(toonId)
@ -721,7 +721,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
return return
def getToon(self, toonId): def getToon(self, toonId):
if self.air.doId2do.has_key(toonId): if toonId in self.air.doId2do:
return self.air.doId2do[toonId] return self.air.doId2do[toonId]
else: else:
self.notify.warning('getToon() - toon: %d not in repository!' % toonId) self.notify.warning('getToon() - toon: %d not in repository!' % toonId)
@ -741,7 +741,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
self.notify.warning('toon tried to run, but not found in activeToons: %d' % toonId) self.notify.warning('toon tried to run, but not found in activeToons: %d' % toonId)
return return
for toon in self.activeToons: for toon in self.activeToons:
if self.toonAttacks.has_key(toon): if toon in self.toonAttacks:
ta = self.toonAttacks[toon] ta = self.toonAttacks[toon]
track = ta[TOON_TRACK_COL] track = ta[TOON_TRACK_COL]
level = ta[TOON_LVL_COL] level = ta[TOON_LVL_COL]
@ -851,7 +851,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
return 1 return 1
def __removeAdjustingResponse(self, toonId): def __removeAdjustingResponse(self, toonId):
if self.adjustingResponses.has_key(toonId): if toonId in self.adjustingResponses:
del self.adjustingResponses[toonId] del self.adjustingResponses[toonId]
if self.ignoreAdjustingResponses == 0 and len(self.toons) > 0: if self.ignoreAdjustingResponses == 0 and len(self.toons) > 0:
if self.__allAdjustingToonsResponded(): if self.__allAdjustingToonsResponded():
@ -859,7 +859,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
def __addJoinResponse(self, avId, taskName, toon=0): def __addJoinResponse(self, avId, taskName, toon=0):
if toon == 1: if toon == 1:
for jr in self.joinResponses.values(): for jr in list(self.joinResponses.values()):
jr[avId] = 0 jr[avId] = 0
self.joinResponses[avId] = {} self.joinResponses[avId] = {}
@ -871,8 +871,8 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
def __removeJoinResponses(self, avId): def __removeJoinResponses(self, avId):
self.__removeJoinResponse(avId) self.__removeJoinResponse(avId)
removedOne = 0 removedOne = 0
for j in self.joinResponses.values(): for j in list(self.joinResponses.values()):
if j.has_key(avId): if avId in j:
del j[avId] del j[avId]
removedOne = 1 removedOne = 1
@ -882,7 +882,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
self.__makeAvPending(t) self.__makeAvPending(t)
def __removeJoinResponse(self, avId): def __removeJoinResponse(self, avId):
if self.joinResponses.has_key(avId): if avId in self.joinResponses:
taskMgr.remove(self.joinResponses[avId]['taskName']) taskMgr.remove(self.joinResponses[avId]['taskName'])
del self.joinResponses[avId] del self.joinResponses[avId]
@ -895,7 +895,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
return 1 return 1
def __cleanupJoinResponses(self): def __cleanupJoinResponses(self):
for jr in self.joinResponses.values(): for jr in list(self.joinResponses.values()):
taskMgr.remove(jr['taskName']) taskMgr.remove(jr['taskName'])
del jr del jr
@ -993,11 +993,11 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
if self.toons.count(toonId) == 0: if self.toons.count(toonId) == 0:
self.notify.warning('joinDone() - toon: %d not in toon list' % toonId) self.notify.warning('joinDone() - toon: %d not in toon list' % toonId)
return return
if not self.joinResponses.has_key(avId): if avId not in self.joinResponses:
self.notify.debug('joinDone() - no entry for: %d - ignoring: %d' % (avId, toonId)) self.notify.debug('joinDone() - no entry for: %d - ignoring: %d' % (avId, toonId))
return return
jr = self.joinResponses[avId] jr = self.joinResponses[avId]
if jr.has_key(toonId): if toonId in jr:
jr[toonId] += 1 jr[toonId] += 1
self.notify.debug('client with localToon: %d done joining av: %d' % (toonId, avId)) self.notify.debug('client with localToon: %d done joining av: %d' % (toonId, avId))
if self.__allToonsRespondedJoin(avId): if self.__allToonsRespondedJoin(avId):
@ -1037,9 +1037,9 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
toon = self.getToon(toonId) toon = self.getToon(toonId)
if toon == None: if toon == None:
return return
if toon.NPCFriendsDict.has_key(av): if av in toon.NPCFriendsDict:
npcCollision = 0 npcCollision = 0
if self.npcAttacks.has_key(av): if av in self.npcAttacks:
callingToon = self.npcAttacks[av] callingToon = self.npcAttacks[av]
if self.activeToons.count(callingToon) == 1: if self.activeToons.count(callingToon) == 1:
self.toonAttacks[toonId] = getToonAttack(toonId, track=PASS) self.toonAttacks[toonId] = getToonAttack(toonId, track=PASS)
@ -1060,7 +1060,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
elif track == UN_ATTACK: elif track == UN_ATTACK:
self.notify.debug('toon: %d changed its mind' % toonId) self.notify.debug('toon: %d changed its mind' % toonId)
self.toonAttacks[toonId] = getToonAttack(toonId, track=UN_ATTACK) self.toonAttacks[toonId] = getToonAttack(toonId, track=UN_ATTACK)
if self.responses.has_key(toonId): if toonId in self.responses:
self.responses[toonId] = 0 self.responses[toonId] = 0
validResponse = 0 validResponse = 0
elif track == PASS: elif track == PASS:
@ -1115,7 +1115,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
petId = toon.getPetId() petId = toon.getPetId()
zoneId = self.zoneId zoneId = self.zoneId
if petId == av: if petId == av:
if not self.pets.has_key(toonId): if toonId not in self.pets:
def handleGetPetProxy(success, petProxy, petId=petId, zoneId=zoneId, toonId=toonId): def handleGetPetProxy(success, petProxy, petId=petId, zoneId=zoneId, toonId=toonId):
if success: if success:
@ -1178,7 +1178,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
self.movieHasPlayed = 0 self.movieHasPlayed = 0
self.rewardHasPlayed = 0 self.rewardHasPlayed = 0
for t in self.activeToons: for t in self.activeToons:
if not self.toonAttacks.has_key(t): if t not in self.toonAttacks:
self.toonAttacks[t] = getToonAttack(t) self.toonAttacks[t] = getToonAttack(t)
attack = self.toonAttacks[t] attack = self.toonAttacks[t]
if attack[TOON_TRACK_COL] == PASS or attack[TOON_TRACK_COL] == UN_ATTACK: if attack[TOON_TRACK_COL] == PASS or attack[TOON_TRACK_COL] == UN_ATTACK:
@ -1322,7 +1322,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
suitsLuredOntoTraps = [] suitsLuredOntoTraps = []
npcTrapAttacks = [] npcTrapAttacks = []
for activeToon in self.activeToons + self.exitedToons: for activeToon in self.activeToons + self.exitedToons:
if self.toonAttacks.has_key(activeToon): if activeToon in self.toonAttacks:
attack = self.toonAttacks[activeToon] attack = self.toonAttacks[activeToon]
track = attack[TOON_TRACK_COL] track = attack[TOON_TRACK_COL]
npc_level = None npc_level = None
@ -1428,13 +1428,13 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
pass pass
suit.battleTrap = NO_TRAP suit.battleTrap = NO_TRAP
needUpdate = 1 needUpdate = 1
if trapDict.has_key(suit.doId): if suit.doId in trapDict:
del trapDict[suit.doId] del trapDict[suit.doId]
if suitsLuredOntoTraps.count(suit) == 0: if suitsLuredOntoTraps.count(suit) == 0:
suitsLuredOntoTraps.append(suit) suitsLuredOntoTraps.append(suit)
if track == TRAP: if track == TRAP:
targetId = suit.doId targetId = suit.doId
if trapDict.has_key(targetId): if targetId in trapDict:
trapDict[targetId].append(attack) trapDict[targetId].append(attack)
else: else:
trapDict[targetId] = [attack] trapDict[targetId] = [attack]
@ -1458,7 +1458,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
else: else:
hp = hps[targetIndex] hp = hps[targetIndex]
if track == TRAP: if track == TRAP:
if trapDict.has_key(targetId): if targetId in trapDict:
trapDict[targetId].append(attack) trapDict[targetId].append(attack)
else: else:
trapDict[targetId] = [attack] trapDict[targetId] = [attack]
@ -1468,7 +1468,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
pass pass
target.battleTrap = NO_TRAP target.battleTrap = NO_TRAP
needUpdate = 1 needUpdate = 1
if trapDict.has_key(target.doId): if target.doId in trapDict:
del trapDict[target.doId] del trapDict[target.doId]
if suitsLuredOntoTraps.count(target) == 0: if suitsLuredOntoTraps.count(target) == 0:
suitsLuredOntoTraps.append(target) suitsLuredOntoTraps.append(target)
@ -1476,7 +1476,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
for otherSuit in self.activeSuits: for otherSuit in self.activeSuits:
if not otherSuit == target: if not otherSuit == target:
otherSuit.battleTrap = NO_TRAP otherSuit.battleTrap = NO_TRAP
if trapDict.has_key(otherSuit.doId): if otherSuit.doId in trapDict:
del trapDict[otherSuit.doId] del trapDict[otherSuit.doId]
died = attack[SUIT_DIED_COL] & 1 << targetIndex died = attack[SUIT_DIED_COL] & 1 << targetIndex
@ -1485,7 +1485,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
deadSuits.append(target) deadSuits.append(target)
self.exitedToons = [] self.exitedToons = []
for suitKey in trapDict.keys(): for suitKey in list(trapDict.keys()):
attackList = trapDict[suitKey] attackList = trapDict[suitKey]
attack = attackList[0] attack = attackList[0]
target = self.findSuit(attack[TOON_TGT_COL]) target = self.findSuit(attack[TOON_TGT_COL])
@ -1674,13 +1674,13 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
msgName = '%s%s' % (cog, level) msgName = '%s%s' % (cog, level)
if encounter['isSkelecog']: if encounter['isSkelecog']:
msgName += '+' msgName += '+'
if eventMsg.has_key(msgName): if msgName in eventMsg:
eventMsg[msgName] += 1 eventMsg[msgName] += 1
else: else:
eventMsg[msgName] = 1 eventMsg[msgName] = 1
msgText = '' msgText = ''
for msgName, count in eventMsg.items(): for msgName, count in list(eventMsg.items()):
if msgText != '': if msgText != '':
msgText += ',' msgText += ','
msgText += '%s%s' % (count, msgName) msgText += '%s%s' % (count, msgName)

View file

@ -1,18 +1,18 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from libotp import * from libotp import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleBase import * from .BattleBase import *
from direct.actor import Actor from direct.actor import Actor
from toontown.suit import SuitDNA from toontown.suit import SuitDNA
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import DistributedBattleBase from . import DistributedBattleBase
from toontown.toon import TTEmote from toontown.toon import TTEmote
from otp.avatar import Emote from otp.avatar import Emote
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
import MovieUtil from . import MovieUtil
from direct.fsm import State from direct.fsm import State
from toontown.suit import Suit from toontown.suit import Suit
import SuitBattleGlobals from . import SuitBattleGlobals
import random import random
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals

View file

@ -1,11 +1,11 @@
from otp.ai.AIBase import * from otp.ai.AIBase import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from BattleBase import * from .BattleBase import *
from BattleCalculatorAI import * from .BattleCalculatorAI import *
from toontown.toonbase.ToontownBattleGlobals import * from toontown.toonbase.ToontownBattleGlobals import *
from SuitBattleGlobals import * from .SuitBattleGlobals import *
from direct.showbase.PythonUtil import addListsByValue from direct.showbase.PythonUtil import addListsByValue
import DistributedBattleBaseAI from . import DistributedBattleBaseAI
from direct.task import Task from direct.task import Task
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import random import random

View file

@ -40,7 +40,7 @@ class DistributedBattleDiners(DistributedBattleFinal.DistributedBattleFinal):
def moveSuitsToInitialPos(self): def moveSuitsToInitialPos(self):
battlePts = self.suitPoints[len(self.suitPendingPoints) - 1] battlePts = self.suitPoints[len(self.suitPendingPoints) - 1]
for i in xrange(len(self.suits)): for i in range(len(self.suits)):
suit = self.suits[i] suit = self.suits[i]
suit.reparentTo(self) suit.reparentTo(self)
destPos, destHpr = self.getActorPosHpr(suit, self.suits) destPos, destHpr = self.getActorPosHpr(suit, self.suits)

View file

@ -1,13 +1,13 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleBase import * from .BattleBase import *
from direct.actor import Actor from direct.actor import Actor
from toontown.distributed import DelayDelete from toontown.distributed import DelayDelete
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import DistributedBattleBase from . import DistributedBattleBase
import MovieUtil from . import MovieUtil
from toontown.suit import Suit from toontown.suit import Suit
import SuitBattleGlobals from . import SuitBattleGlobals
from toontown.toonbase import ToontownBattleGlobals from toontown.toonbase import ToontownBattleGlobals
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from direct.fsm import State from direct.fsm import State
@ -49,7 +49,7 @@ class DistributedBattleFinal(DistributedBattleBase.DistributedBattleBase):
def setBossCogId(self, bossCogId): def setBossCogId(self, bossCogId):
self.bossCogId = bossCogId self.bossCogId = bossCogId
if base.cr.doId2do.has_key(bossCogId): if bossCogId in base.cr.doId2do:
tempBossCog = base.cr.doId2do[bossCogId] tempBossCog = base.cr.doId2do[bossCogId]
self.__gotBossCog([tempBossCog]) self.__gotBossCog([tempBossCog])
else: else:

View file

@ -1,9 +1,9 @@
from otp.ai.AIBase import * from otp.ai.AIBase import *
from BattleBase import * from .BattleBase import *
from BattleCalculatorAI import * from .BattleCalculatorAI import *
from toontown.toonbase.ToontownBattleGlobals import * from toontown.toonbase.ToontownBattleGlobals import *
from SuitBattleGlobals import * from .SuitBattleGlobals import *
import DistributedBattleBaseAI from . import DistributedBattleBaseAI
from direct.task import Task from direct.task import Task
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.fsm import State from direct.fsm import State

View file

@ -43,7 +43,7 @@ class DistributedBattleWaiters(DistributedBattleFinal.DistributedBattleFinal):
def moveSuitsToInitialPos(self): def moveSuitsToInitialPos(self):
battlePts = self.suitPoints[len(self.suitPendingPoints) - 1] battlePts = self.suitPoints[len(self.suitPendingPoints) - 1]
for i in xrange(len(self.suits)): for i in range(len(self.suits)):
suit = self.suits[i] suit = self.suits[i]
suit.reparentTo(self) suit.reparentTo(self)
destPos, destHpr = self.getActorPosHpr(suit, self.suits) destPos, destHpr = self.getActorPosHpr(suit, self.suits)

View file

@ -1,18 +1,18 @@
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleBase import * from .BattleBase import *
from BattleProps import * from .BattleProps import *
from BattleSounds import * from .BattleSounds import *
from toontown.toon.ToonDNA import * from toontown.toon.ToonDNA import *
from toontown.suit.SuitDNA import * from toontown.suit.SuitDNA import *
from direct.particles.ParticleEffect import * from direct.particles.ParticleEffect import *
from direct.gui.DirectGui import * from direct.gui.DirectGui import *
from pandac.PandaModules import * from pandac.PandaModules import *
import MovieUtil from . import MovieUtil
import MovieCamera from . import MovieCamera
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import BattleParticles from . import BattleParticles
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
import RewardPanel from . import RewardPanel
notify = DirectNotifyGlobal.directNotify.newCategory('Fanfare') notify = DirectNotifyGlobal.directNotify.newCategory('Fanfare')
def makePanel(toon, showToonName): def makePanel(toon, showToonName):

View file

@ -1,29 +1,29 @@
from toontown.toonbase.ToontownBattleGlobals import * from toontown.toonbase.ToontownBattleGlobals import *
from BattleBase import * from .BattleBase import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from direct.showbase import DirectObject from direct.showbase import DirectObject
import MovieFire from . import MovieFire
import MovieSOS from . import MovieSOS
import MovieNPCSOS from . import MovieNPCSOS
import MoviePetSOS from . import MoviePetSOS
import MovieHeal from . import MovieHeal
import MovieTrap from . import MovieTrap
import MovieLure from . import MovieLure
import MovieSound from . import MovieSound
import MovieThrow from . import MovieThrow
import MovieSquirt from . import MovieSquirt
import MovieDrop from . import MovieDrop
import MovieSuitAttacks from . import MovieSuitAttacks
import MovieToonVictory from . import MovieToonVictory
import PlayByPlayText from . import PlayByPlayText
import BattleParticles from . import BattleParticles
from toontown.distributed import DelayDelete from toontown.distributed import DelayDelete
import BattleExperience from . import BattleExperience
from SuitBattleGlobals import * from .SuitBattleGlobals import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import RewardPanel from . import RewardPanel
import random import random
import MovieUtil from . import MovieUtil
from toontown.toon import Toon from toontown.toon import Toon
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.toontowngui import TTDialog from toontown.toontowngui import TTDialog
@ -760,7 +760,7 @@ class Movie(DirectObject.DirectObject):
adict['target'] = sdict adict['target'] = sdict
adict['hpbonus'] = ta[TOON_HPBONUS_COL] adict['hpbonus'] = ta[TOON_HPBONUS_COL]
adict['sidestep'] = ta[TOON_ACCBONUS_COL] adict['sidestep'] = ta[TOON_ACCBONUS_COL]
if adict.has_key('npcId'): if 'npcId' in adict:
adict['sidestep'] = 0 adict['sidestep'] = 0
adict['battle'] = self.battle adict['battle'] = self.battle
adict['playByPlayText'] = self.playByPlayText adict['playByPlayText'] = self.playByPlayText
@ -785,7 +785,7 @@ class Movie(DirectObject.DirectObject):
setCapture = 0 setCapture = 0
tp = [] tp = []
for ta in self.toonAttackDicts: for ta in self.toonAttackDicts:
if ta['track'] == track or track == NPCSOS and ta.has_key('special'): if ta['track'] == track or track == NPCSOS and 'special' in ta:
tp.append(ta) tp.append(ta)
if track == SQUIRT: if track == SQUIRT:
setCapture = 1 setCapture = 1
@ -793,11 +793,11 @@ class Movie(DirectObject.DirectObject):
if track == TRAP: if track == TRAP:
sortedTraps = [] sortedTraps = []
for attack in tp: for attack in tp:
if not attack.has_key('npcId'): if 'npcId' not in attack:
sortedTraps.append(attack) sortedTraps.append(attack)
for attack in tp: for attack in tp:
if attack.has_key('npcId'): if 'npcId' in attack:
sortedTraps.append(attack) sortedTraps.append(attack)
tp = sortedTraps tp = sortedTraps

View file

@ -1,12 +1,12 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleBase import * from .BattleBase import *
from BattleProps import * from .BattleProps import *
from toontown.toonbase.ToontownBattleGlobals import * from toontown.toonbase.ToontownBattleGlobals import *
from SuitBattleGlobals import * from .SuitBattleGlobals import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import random import random
import MovieUtil from . import MovieUtil
notify = DirectNotifyGlobal.directNotify.newCategory('MovieCamera') notify = DirectNotifyGlobal.directNotify.newCategory('MovieCamera')
def chooseHealShot(heals, attackDuration): def chooseHealShot(heals, attackDuration):
@ -16,7 +16,7 @@ def chooseHealShot(heals, attackDuration):
isUber = 1 isUber = 1
if isUber: if isUber:
print 'is uber' print('is uber')
openShot = chooseHealOpenShot(heals, attackDuration, isUber) openShot = chooseHealOpenShot(heals, attackDuration, isUber)
openDuration = openShot.getDuration() openDuration = openShot.getDuration()
openName = openShot.getName() openName = openShot.getName()
@ -38,7 +38,7 @@ def chooseHealOpenShot(heals, attackDuration, isUber = 0):
if isUber: if isUber:
duration = 5.0 duration = 5.0
shotChoices = [toonGroupShot] shotChoices = [toonGroupShot]
track = apply(random.choice(shotChoices), [av, duration]) track = random.choice(shotChoices)(*[av, duration])
return track return track
@ -49,7 +49,7 @@ def chooseHealMidShot(heals, attackDuration, isUber = 0):
if isUber: if isUber:
duration = 2.1 duration = 2.1
shotChoices = [toonGroupHighShot] shotChoices = [toonGroupHighShot]
track = apply(random.choice(shotChoices), [av, duration]) track = random.choice(shotChoices)(*[av, duration])
return track return track
@ -59,7 +59,7 @@ def chooseHealCloseShot(heals, openDuration, openName, attackDuration, isUber =
shotChoices = [toonGroupShot] shotChoices = [toonGroupShot]
if isUber: if isUber:
shotChoices = [allGroupLowShot] shotChoices = [allGroupLowShot]
track = apply(random.choice(shotChoices), [av, duration]) track = random.choice(shotChoices)(*[av, duration])
return track return track
@ -79,7 +79,7 @@ def chooseTrapOpenShot(traps, attackDuration):
av = None av = None
duration = 3.0 duration = 3.0
shotChoices = [allGroupLowShot] shotChoices = [allGroupLowShot]
track = apply(random.choice(shotChoices), [av, duration]) track = random.choice(shotChoices)(*[av, duration])
return track return track
@ -87,7 +87,7 @@ def chooseTrapCloseShot(traps, openDuration, openName, attackDuration):
av = None av = None
duration = attackDuration - openDuration duration = attackDuration - openDuration
shotChoices = [allGroupLowShot] shotChoices = [allGroupLowShot]
track = apply(random.choice(shotChoices), [av, duration]) track = random.choice(shotChoices)(*[av, duration])
return track return track
@ -107,7 +107,7 @@ def chooseLureOpenShot(lures, attackDuration):
av = None av = None
duration = 3.0 duration = 3.0
shotChoices = [allGroupLowShot] shotChoices = [allGroupLowShot]
track = apply(random.choice(shotChoices), [av, duration]) track = random.choice(shotChoices)(*[av, duration])
return track return track
@ -125,7 +125,7 @@ def chooseLureCloseShot(lures, openDuration, openName, attackDuration):
av = lures[0]['toon'] av = lures[0]['toon']
else: else:
shotChoices = [allGroupLowShot] shotChoices = [allGroupLowShot]
track = apply(random.choice(shotChoices), [av, duration]) track = random.choice(shotChoices)(*[av, duration])
return track return track
@ -160,7 +160,7 @@ def chooseSoundOpenShot(sounds, targets, attackDuration):
shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot] shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot]
else: else:
notify.error('Bad number of sounds: %s' % numSounds) notify.error('Bad number of sounds: %s' % numSounds)
track = apply(random.choice(shotChoices), [av, duration]) track = random.choice(shotChoices)(*[av, duration])
return track return track
@ -178,7 +178,7 @@ def chooseSoundCloseShot(sounds, targets, openDuration, openName, attackDuration
shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot] shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot]
else: else:
notify.error('Bad number of suits: %s' % numSuits) notify.error('Bad number of suits: %s' % numSuits)
track = apply(random.choice(shotChoices), [av, duration]) track = random.choice(shotChoices)(*[av, duration])
return track return track
@ -206,7 +206,7 @@ def chooseThrowOpenShot(throws, suitThrowsDict, attackDuration):
shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot] shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot]
else: else:
notify.error('Bad number of throws: %s' % numThrows) notify.error('Bad number of throws: %s' % numThrows)
track = apply(random.choice(shotChoices), [av, duration]) track = random.choice(shotChoices)(*[av, duration])
return track return track
@ -215,7 +215,7 @@ def chooseThrowCloseShot(throws, suitThrowsDict, openDuration, openName, attackD
av = None av = None
duration = attackDuration - openDuration duration = attackDuration - openDuration
if numSuits == 1: if numSuits == 1:
av = base.cr.doId2do[suitThrowsDict.keys()[0]] av = base.cr.doId2do[list(suitThrowsDict.keys())[0]]
shotChoices = [avatarCloseUpThrowShot, shotChoices = [avatarCloseUpThrowShot,
avatarCloseUpThreeQuarterLeftShot, avatarCloseUpThreeQuarterLeftShot,
allGroupLowShot, allGroupLowShot,
@ -224,7 +224,7 @@ def chooseThrowCloseShot(throws, suitThrowsDict, openDuration, openName, attackD
shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot] shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot]
else: else:
notify.error('Bad number of suits: %s' % numSuits) notify.error('Bad number of suits: %s' % numSuits)
track = apply(random.choice(shotChoices), [av, duration]) track = random.choice(shotChoices)(*[av, duration])
return track return track
@ -252,7 +252,7 @@ def chooseSquirtOpenShot(squirts, suitSquirtsDict, attackDuration):
shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot] shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot]
else: else:
notify.error('Bad number of squirts: %s' % numSquirts) notify.error('Bad number of squirts: %s' % numSquirts)
track = apply(random.choice(shotChoices), [av, duration]) track = random.choice(shotChoices)(*[av, duration])
return track return track
@ -261,7 +261,7 @@ def chooseSquirtCloseShot(squirts, suitSquirtsDict, openDuration, openName, atta
av = None av = None
duration = attackDuration - openDuration duration = attackDuration - openDuration
if numSuits == 1: if numSuits == 1:
av = base.cr.doId2do[suitSquirtsDict.keys()[0]] av = base.cr.doId2do[list(suitSquirtsDict.keys())[0]]
shotChoices = [avatarCloseUpThrowShot, shotChoices = [avatarCloseUpThrowShot,
avatarCloseUpThreeQuarterLeftShot, avatarCloseUpThreeQuarterLeftShot,
allGroupLowShot, allGroupLowShot,
@ -270,7 +270,7 @@ def chooseSquirtCloseShot(squirts, suitSquirtsDict, openDuration, openName, atta
shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot] shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot]
else: else:
notify.error('Bad number of suits: %s' % numSuits) notify.error('Bad number of suits: %s' % numSuits)
track = apply(random.choice(shotChoices), [av, duration]) track = random.choice(shotChoices)(*[av, duration])
return track return track
@ -300,7 +300,7 @@ def chooseDropOpenShot(drops, suitDropsDict, attackDuration):
shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot] shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot]
else: else:
notify.error('Bad number of drops: %s' % numDrops) notify.error('Bad number of drops: %s' % numDrops)
track = apply(random.choice(shotChoices), [av, duration]) track = random.choice(shotChoices)(*[av, duration])
return track return track
@ -309,7 +309,7 @@ def chooseDropCloseShot(drops, suitDropsDict, openDuration, openName, attackDura
av = None av = None
duration = attackDuration - openDuration duration = attackDuration - openDuration
if numSuits == 1: if numSuits == 1:
av = base.cr.doId2do[suitDropsDict.keys()[0]] av = base.cr.doId2do[list(suitDropsDict.keys())[0]]
shotChoices = [avatarCloseUpThrowShot, shotChoices = [avatarCloseUpThrowShot,
avatarCloseUpThreeQuarterLeftShot, avatarCloseUpThreeQuarterLeftShot,
allGroupLowShot, allGroupLowShot,
@ -327,7 +327,7 @@ def chooseNPCEnterShot(enters, entersDuration):
av = None av = None
duration = entersDuration duration = entersDuration
shotChoices = [toonGroupShot] shotChoices = [toonGroupShot]
track = apply(random.choice(shotChoices), [av, duration]) track = random.choice(shotChoices)(*[av, duration])
return track return track
@ -335,7 +335,7 @@ def chooseNPCExitShot(exits, exitsDuration):
av = None av = None
duration = exitsDuration duration = exitsDuration
shotChoices = [toonGroupShot] shotChoices = [toonGroupShot]
track = apply(random.choice(shotChoices), [av, duration]) track = random.choice(shotChoices)(*[av, duration])
return track return track
@ -522,7 +522,7 @@ def chooseSuitCloseShot(attack, openDuration, openName, attackDuration):
diedTrack = pbpText.getToonsDiedInterval(diedTextList, duration) diedTrack = pbpText.getToonsDiedInterval(diedTextList, duration)
else: else:
notify.error('Bad groupStatus: %s' % groupStatus) notify.error('Bad groupStatus: %s' % groupStatus)
track = apply(random.choice(shotChoices), [av, duration]) track = random.choice(shotChoices)(*[av, duration])
if diedTrack == None: if diedTrack == None:
return track return track
else: else:
@ -568,7 +568,7 @@ def chooseSOSShot(av, duration):
avatarBehindShot, avatarBehindShot,
avatarBehindHighShot, avatarBehindHighShot,
suitGroupThreeQuarterLeftBehindShot] suitGroupThreeQuarterLeftBehindShot]
track = apply(random.choice(shotChoices), [av, duration]) track = random.choice(shotChoices)(*[av, duration])
return track return track
@ -894,7 +894,7 @@ def randomCameraSelection(suit, attack, attackDuration, openShotDuration):
if openShotDuration > attackDuration: if openShotDuration > attackDuration:
openShotDuration = attackDuration openShotDuration = attackDuration
closeShotDuration = attackDuration - openShotDuration closeShotDuration = attackDuration - openShotDuration
openShot = apply(random.choice(shotChoices), [suit, openShotDuration]) openShot = random.choice(shotChoices)(*[suit, openShotDuration])
closeShot = chooseSuitCloseShot(attack, closeShotDuration, openShot.getName(), attackDuration) closeShot = chooseSuitCloseShot(attack, closeShotDuration, openShot.getName(), attackDuration)
return Sequence(openShot, closeShot) return Sequence(openShot, closeShot)
@ -946,8 +946,8 @@ def chooseFireOpenShot(throws, suitThrowsDict, attackDuration):
else: else:
notify.error('Bad number of throws: %s' % numThrows) notify.error('Bad number of throws: %s' % numThrows)
shotChoice = random.choice(shotChoices) shotChoice = random.choice(shotChoices)
track = apply(shotChoice, [av, duration]) track = shotChoice(*[av, duration])
print 'chooseFireOpenShot %s' % shotChoice print('chooseFireOpenShot %s' % shotChoice)
return track return track
@ -956,7 +956,7 @@ def chooseFireCloseShot(throws, suitThrowsDict, openDuration, openName, attackDu
av = None av = None
duration = attackDuration - openDuration duration = attackDuration - openDuration
if numSuits == 1: if numSuits == 1:
av = base.cr.doId2do[suitThrowsDict.keys()[0]] av = base.cr.doId2do[list(suitThrowsDict.keys())[0]]
shotChoices = [avatarCloseUpFireShot, shotChoices = [avatarCloseUpFireShot,
avatarCloseUpThreeQuarterLeftFireShot, avatarCloseUpThreeQuarterLeftFireShot,
allGroupLowShot, allGroupLowShot,
@ -966,8 +966,8 @@ def chooseFireCloseShot(throws, suitThrowsDict, openDuration, openName, attackDu
else: else:
notify.error('Bad number of suits: %s' % numSuits) notify.error('Bad number of suits: %s' % numSuits)
shotChoice = random.choice(shotChoices) shotChoice = random.choice(shotChoices)
track = apply(shotChoice, [av, duration]) track = shotChoice(*[av, duration])
print 'chooseFireOpenShot %s' % shotChoice print('chooseFireOpenShot %s' % shotChoice)
return track return track

View file

@ -1,12 +1,12 @@
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleBase import * from .BattleBase import *
from BattleProps import * from .BattleProps import *
from BattleSounds import * from .BattleSounds import *
import MovieCamera from . import MovieCamera
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import MovieUtil from . import MovieUtil
import MovieNPCSOS from . import MovieNPCSOS
from MovieUtil import calcAvgSuitPos from .MovieUtil import calcAvgSuitPos
from direct.showutil import Effects from direct.showutil import Effects
notify = DirectNotifyGlobal.directNotify.newCategory('MovieDrop') notify = DirectNotifyGlobal.directNotify.newCategory('MovieDrop')
hitSoundFiles = ('AA_drop_flowerpot.mp3', 'AA_drop_sandbag.mp3', 'AA_drop_anvil.mp3', 'AA_drop_bigweight.mp3', 'AA_drop_safe.mp3', 'AA_drop_piano.mp3', 'AA_drop_boat.mp3') hitSoundFiles = ('AA_drop_flowerpot.mp3', 'AA_drop_sandbag.mp3', 'AA_drop_anvil.mp3', 'AA_drop_bigweight.mp3', 'AA_drop_safe.mp3', 'AA_drop_piano.mp3', 'AA_drop_boat.mp3')
@ -38,7 +38,7 @@ def doDrops(drops):
targets = drop['target'] targets = drop['target']
if len(targets) == 1: if len(targets) == 1:
suitId = targets[0]['suit'].doId suitId = targets[0]['suit'].doId
if suitDropsDict.has_key(suitId): if suitId in suitDropsDict:
suitDropsDict[suitId].append((drop, targets[0])) suitDropsDict[suitId].append((drop, targets[0]))
else: else:
suitDropsDict[suitId] = [(drop, targets[0])] suitDropsDict[suitId] = [(drop, targets[0])]
@ -47,7 +47,7 @@ def doDrops(drops):
else: else:
for target in targets: for target in targets:
suitId = target['suit'].doId suitId = target['suit'].doId
if suitDropsDict.has_key(suitId): if suitId in suitDropsDict:
otherDrops = suitDropsDict[suitId] otherDrops = suitDropsDict[suitId]
alreadyInList = 0 alreadyInList = 0
for oDrop in otherDrops: for oDrop in otherDrops:
@ -59,7 +59,7 @@ def doDrops(drops):
else: else:
suitDropsDict[suitId] = [(drop, target)] suitDropsDict[suitId] = [(drop, target)]
suitDrops = suitDropsDict.values() suitDrops = list(suitDropsDict.values())
def compFunc(a, b): def compFunc(a, b):
if len(a) > len(b): if len(a) > len(b):
@ -217,9 +217,9 @@ def __dropObject(drop, delay, objName, level, alreadyDodged, alreadyTeased, npcs
toon = drop['toon'] toon = drop['toon']
repeatNPC = 0 repeatNPC = 0
battle = drop['battle'] battle = drop['battle']
if drop.has_key('npc'): if 'npc' in drop:
toon = drop['npc'] toon = drop['npc']
if npcDrops.has_key(toon): if toon in npcDrops:
repeatNPC = 1 repeatNPC = 1
else: else:
npcDrops[toon] = 1 npcDrops[toon] = 1
@ -379,7 +379,7 @@ def __dropObject(drop, delay, objName, level, alreadyDodged, alreadyTeased, npcs
def __createSuitTrack(drop, delay, level, alreadyDodged, alreadyTeased, target, npcs): def __createSuitTrack(drop, delay, level, alreadyDodged, alreadyTeased, target, npcs):
toon = drop['toon'] toon = drop['toon']
if drop.has_key('npc'): if 'npc' in drop:
toon = drop['npc'] toon = drop['npc']
battle = drop['battle'] battle = drop['battle']
majorObject = level >= 3 majorObject = level >= 3

View file

@ -1,15 +1,15 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleBase import * from .BattleBase import *
from BattleProps import * from .BattleProps import *
from BattleSounds import * from .BattleSounds import *
from toontown.toon.ToonDNA import * from toontown.toon.ToonDNA import *
from toontown.suit.SuitDNA import * from toontown.suit.SuitDNA import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import random import random
import MovieCamera from . import MovieCamera
import MovieUtil from . import MovieUtil
from MovieUtil import calcAvgSuitPos from .MovieUtil import calcAvgSuitPos
notify = DirectNotifyGlobal.directNotify.newCategory('MovieThrow') notify = DirectNotifyGlobal.directNotify.newCategory('MovieThrow')
hitSoundFiles = ('AA_tart_only.mp3', 'AA_slice_only.mp3', 'AA_slice_only.mp3', 'AA_slice_only.mp3', 'AA_slice_only.mp3', 'AA_wholepie_only.mp3', 'AA_wholepie_only.mp3') hitSoundFiles = ('AA_tart_only.mp3', 'AA_slice_only.mp3', 'AA_slice_only.mp3', 'AA_slice_only.mp3', 'AA_slice_only.mp3', 'AA_wholepie_only.mp3', 'AA_wholepie_only.mp3')
tPieLeavesHand = 2.7 tPieLeavesHand = 2.7
@ -20,7 +20,7 @@ tPieShrink = 0.7
pieFlyTaskName = 'MovieThrow-pieFly' pieFlyTaskName = 'MovieThrow-pieFly'
def addHit(dict, suitId, hitCount): def addHit(dict, suitId, hitCount):
if dict.has_key(suitId): if suitId in dict:
dict[suitId] += hitCount dict[suitId] += hitCount
else: else:
dict[suitId] = hitCount dict[suitId] = hitCount
@ -33,12 +33,12 @@ def doFires(fires):
suitFiresDict = {} suitFiresDict = {}
for fire in fires: for fire in fires:
suitId = fire['target']['suit'].doId suitId = fire['target']['suit'].doId
if suitFiresDict.has_key(suitId): if suitId in suitFiresDict:
suitFiresDict[suitId].append(fire) suitFiresDict[suitId].append(fire)
else: else:
suitFiresDict[suitId] = [fire] suitFiresDict[suitId] = [fire]
suitFires = suitFiresDict.values() suitFires = list(suitFiresDict.values())
def compFunc(a, b): def compFunc(a, b):
if len(a) > len(b): if len(a) > len(b):
return 1 return 1

View file

@ -1,17 +1,17 @@
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleProps import * from .BattleProps import *
from BattleSounds import * from .BattleSounds import *
from BattleBase import * from .BattleBase import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import MovieCamera from . import MovieCamera
import random import random
import MovieUtil from . import MovieUtil
import BattleParticles from . import BattleParticles
import HealJokes from . import HealJokes
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from toontown.toonbase.ToontownBattleGlobals import AvPropDamage from toontown.toonbase.ToontownBattleGlobals import AvPropDamage
from toontown.toon import NPCToons from toontown.toon import NPCToons
import MovieNPCSOS from . import MovieNPCSOS
from toontown.effects import Splash from toontown.effects import Splash
from direct.task import Task from direct.task import Task
notify = DirectNotifyGlobal.directNotify.newCategory('MovieHeal') notify = DirectNotifyGlobal.directNotify.newCategory('MovieHeal')
@ -166,7 +166,7 @@ def __healTickle(heal, hasInteractivePropHealBonus):
def __healJoke(heal, hasInteractivePropHealBonus): def __healJoke(heal, hasInteractivePropHealBonus):
npcId = 0 npcId = 0
if heal.has_key('npcId'): if 'npcId' in heal:
npcId = heal['npcId'] npcId = heal['npcId']
toon = NPCToons.createLocalNPC(npcId) toon = NPCToons.createLocalNPC(npcId)
if toon == None: if toon == None:
@ -257,7 +257,7 @@ def __healSmooch(heal, hasInteractivePropHealBonus):
def __healDance(heal, hasInteractivePropHealBonus): def __healDance(heal, hasInteractivePropHealBonus):
npcId = 0 npcId = 0
if heal.has_key('npcId'): if 'npcId' in heal:
npcId = heal['npcId'] npcId = heal['npcId']
toon = NPCToons.createLocalNPC(npcId) toon = NPCToons.createLocalNPC(npcId)
if toon == None: if toon == None:
@ -340,7 +340,7 @@ def __healSprinkle(heal, hasInteractivePropHealBonus):
def __healJuggle(heal, hasInteractivePropHealBonus): def __healJuggle(heal, hasInteractivePropHealBonus):
npcId = 0 npcId = 0
if heal.has_key('npcId'): if 'npcId' in heal:
npcId = heal['npcId'] npcId = heal['npcId']
toon = NPCToons.createLocalNPC(npcId) toon = NPCToons.createLocalNPC(npcId)
if toon == None: if toon == None:
@ -388,7 +388,7 @@ def __healDive(heal, hasInteractivePropHealBonus):
splash = Splash.Splash(render) splash = Splash.Splash(render)
splash.reparentTo(render) splash.reparentTo(render)
npcId = 0 npcId = 0
if heal.has_key('npcId'): if 'npcId' in heal:
npcId = heal['npcId'] npcId = heal['npcId']
toon = NPCToons.createLocalNPC(npcId) toon = NPCToons.createLocalNPC(npcId)
if toon == None: if toon == None:

View file

@ -1,16 +1,16 @@
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleBase import * from .BattleBase import *
from BattleProps import * from .BattleProps import *
from toontown.suit.SuitBase import * from toontown.suit.SuitBase import *
from toontown.toon.ToonDNA import * from toontown.toon.ToonDNA import *
from BattleSounds import * from .BattleSounds import *
import MovieCamera from . import MovieCamera
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import MovieUtil from . import MovieUtil
from toontown.toonbase import ToontownBattleGlobals from toontown.toonbase import ToontownBattleGlobals
import BattleParticles from . import BattleParticles
import BattleProps from . import BattleProps
import MovieNPCSOS from . import MovieNPCSOS
notify = DirectNotifyGlobal.directNotify.newCategory('MovieLures') notify = DirectNotifyGlobal.directNotify.newCategory('MovieLures')
def safeWrtReparentTo(nodePath, parent): def safeWrtReparentTo(nodePath, parent):
@ -129,7 +129,7 @@ def __createFishingPoleMultiTrack(lure, dollar, dollarName):
def __createMagnetMultiTrack(lure, magnet, pos, hpr, scale, isSmallMagnet = 1, npcs = []): def __createMagnetMultiTrack(lure, magnet, pos, hpr, scale, isSmallMagnet = 1, npcs = []):
toon = lure['toon'] toon = lure['toon']
if lure.has_key('npc'): if 'npc' in lure:
toon = lure['npc'] toon = lure['npc']
battle = lure['battle'] battle = lure['battle']
sidestep = lure['sidestep'] sidestep = lure['sidestep']
@ -189,7 +189,7 @@ def __createMagnetMultiTrack(lure, magnet, pos, hpr, scale, isSmallMagnet = 1, n
def __createHypnoGogglesMultiTrack(lure, npcs = []): def __createHypnoGogglesMultiTrack(lure, npcs = []):
toon = lure['toon'] toon = lure['toon']
if lure.has_key('npc'): if 'npc' in lure:
toon = lure['npc'] toon = lure['npc']
targets = lure['target'] targets = lure['target']
battle = lure['battle'] battle = lure['battle']

View file

@ -1,12 +1,12 @@
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleProps import * from .BattleProps import *
from BattleSounds import * from .BattleSounds import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import MovieCamera from . import MovieCamera
import random import random
import MovieUtil from . import MovieUtil
import BattleParticles from . import BattleParticles
import HealJokes from . import HealJokes
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownBattleGlobals from toontown.toonbase import ToontownBattleGlobals
from toontown.toon import NPCToons from toontown.toon import NPCToons
@ -241,7 +241,7 @@ def doNPCTeleports(attacks):
arrivals = Sequence() arrivals = Sequence()
departures = Parallel() departures = Parallel()
for attack in attacks: for attack in attacks:
if attack.has_key('npcId'): if 'npcId' in attack:
npcId = attack['npcId'] npcId = attack['npcId']
npc = NPCToons.createLocalNPC(npcId) npc = NPCToons.createLocalNPC(npcId)
if npc != None: if npc != None:

View file

@ -1,12 +1,12 @@
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleProps import * from .BattleProps import *
from BattleSounds import * from .BattleSounds import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import MovieCamera from . import MovieCamera
import random import random
import MovieUtil from . import MovieUtil
import BattleParticles from . import BattleParticles
import HealJokes from . import HealJokes
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownBattleGlobals from toontown.toonbase import ToontownBattleGlobals
from toontown.pets import Pet, PetTricks from toontown.pets import Pet, PetTricks
@ -89,7 +89,7 @@ def __healJuggle(heal):
petProxyId = heal['petId'] petProxyId = heal['petId']
pet = Pet.Pet() pet = Pet.Pet()
gender = 0 gender = 0
if base.cr.doId2do.has_key(petProxyId): if petProxyId in base.cr.doId2do:
petProxy = base.cr.doId2do[petProxyId] petProxy = base.cr.doId2do[petProxyId]
if petProxy == None: if petProxy == None:
return return

View file

@ -1,5 +1,5 @@
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
import MovieCamera from . import MovieCamera
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from pandac.PandaModules import * from pandac.PandaModules import *

View file

@ -1,13 +1,13 @@
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleBase import * from .BattleBase import *
from BattleProps import * from .BattleProps import *
from BattleSounds import * from .BattleSounds import *
import BattleParticles from . import BattleParticles
from RewardPanel import * from .RewardPanel import *
import MovieCamera from . import MovieCamera
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import MovieUtil from . import MovieUtil
import MovieNPCSOS from . import MovieNPCSOS
from toontown.toonbase import ToontownBattleGlobals from toontown.toonbase import ToontownBattleGlobals
notify = DirectNotifyGlobal.directNotify.newCategory('MovieSound') notify = DirectNotifyGlobal.directNotify.newCategory('MovieSound')
soundFiles = ('AA_sound_bikehorn.mp3', 'AA_sound_whistle.mp3', 'AA_sound_bugle.mp3', 'AA_sound_aoogah.mp3', 'AA_sound_elephant.mp3', 'SZ_DD_foghorn.mp3', 'AA_sound_Opera_Singer.mp3') soundFiles = ('AA_sound_bikehorn.mp3', 'AA_sound_whistle.mp3', 'AA_sound_bugle.mp3', 'AA_sound_aoogah.mp3', 'AA_sound_elephant.mp3', 'SZ_DD_foghorn.mp3', 'AA_sound_Opera_Singer.mp3')
@ -129,7 +129,7 @@ def __doSoundsLevel(sounds, delay, hitCount, npcs):
deathTracks = Parallel() deathTracks = Parallel()
for sound in sounds: for sound in sounds:
toon = sound['toon'] toon = sound['toon']
if sound.has_key('npc'): if 'npc' in sound:
toon = sound['npc'] toon = sound['npc']
level = sound['level'] level = sound['level']
targets = sound['target'] targets = sound['target']

View file

@ -1,13 +1,13 @@
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleBase import * from .BattleBase import *
from BattleProps import * from .BattleProps import *
from BattleSounds import * from .BattleSounds import *
from toontown.toon.ToonDNA import * from toontown.toon.ToonDNA import *
from toontown.suit.SuitDNA import * from toontown.suit.SuitDNA import *
import MovieUtil from . import MovieUtil
import MovieCamera from . import MovieCamera
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import BattleParticles from . import BattleParticles
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.toonbase import ToontownBattleGlobals from toontown.toonbase import ToontownBattleGlobals
import random import random
@ -38,18 +38,18 @@ def doSquirts(squirts):
if 1: if 1:
target = squirt['target'][0] target = squirt['target'][0]
suitId = target['suit'].doId suitId = target['suit'].doId
if suitSquirtsDict.has_key(suitId): if suitId in suitSquirtsDict:
suitSquirtsDict[suitId].append(squirt) suitSquirtsDict[suitId].append(squirt)
else: else:
suitSquirtsDict[suitId] = [squirt] suitSquirtsDict[suitId] = [squirt]
else: else:
suitId = squirt['target']['suit'].doId suitId = squirt['target']['suit'].doId
if suitSquirtsDict.has_key(suitId): if suitId in suitSquirtsDict:
suitSquirtsDict[suitId].append(squirt) suitSquirtsDict[suitId].append(squirt)
else: else:
suitSquirtsDict[suitId] = [squirt] suitSquirtsDict[suitId] = [squirt]
suitSquirts = suitSquirtsDict.values() suitSquirts = list(suitSquirtsDict.values())
def compFunc(a, b): def compFunc(a, b):
if len(a) > len(b): if len(a) > len(b):
@ -221,7 +221,7 @@ def __getSuitTrack(suit, tContact, tDodge, hp, hpbonus, kbbonus, anim, died, lef
def say(statement): def say(statement):
print statement print(statement)
def __getSoundTrack(level, hitSuit, delay, node = None): def __getSoundTrack(level, hitSuit, delay, node = None):

View file

@ -1,17 +1,17 @@
from libotp import * from libotp import *
from toontown.toonbase.ToontownGlobals import * from toontown.toonbase.ToontownGlobals import *
from SuitBattleGlobals import * from .SuitBattleGlobals import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleBase import * from .BattleBase import *
from BattleProps import * from .BattleProps import *
from toontown.suit.SuitDNA import * from toontown.suit.SuitDNA import *
from BattleBase import * from .BattleBase import *
from BattleSounds import * from .BattleSounds import *
import MovieCamera from . import MovieCamera
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import MovieUtil from . import MovieUtil
from direct.particles import ParticleEffect from direct.particles import ParticleEffect
import BattleParticles from . import BattleParticles
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
notify = DirectNotifyGlobal.directNotify.newCategory('MovieSuitAttacks') notify = DirectNotifyGlobal.directNotify.newCategory('MovieSuitAttacks')
@ -1592,8 +1592,8 @@ def doReOrg(attack):
partTrack = getPartTrack(sprayEffect, 1.0, 1.9, [sprayEffect, suit, 0]) partTrack = getPartTrack(sprayEffect, 1.0, 1.9, [sprayEffect, suit, 0])
if dmg > 0: if dmg > 0:
headParts = toon.getHeadParts() headParts = toon.getHeadParts()
print '***********headParts pos=', headParts[0].getPos() print('***********headParts pos=', headParts[0].getPos())
print '***********headParts hpr=', headParts[0].getHpr() print('***********headParts hpr=', headParts[0].getHpr())
headTracks = Parallel() headTracks = Parallel()
for partNum in range(0, headParts.getNumPaths()): for partNum in range(0, headParts.getNumPaths()):
part = headParts.getPath(partNum) part = headParts.getPath(partNum)
@ -1613,7 +1613,7 @@ def doReOrg(attack):
arms = toon.findAllMatches('**/arms') arms = toon.findAllMatches('**/arms')
sleeves = toon.findAllMatches('**/sleeves') sleeves = toon.findAllMatches('**/sleeves')
hands = toon.findAllMatches('**/hands') hands = toon.findAllMatches('**/hands')
print '*************arms hpr=', arms[0].getHpr() print('*************arms hpr=', arms[0].getHpr())
for partNum in range(0, arms.getNumPaths()): for partNum in range(0, arms.getNumPaths()):
chestTracks.append(getChestTrack(arms.getPath(partNum))) chestTracks.append(getChestTrack(arms.getPath(partNum)))
chestTracks.append(getChestTrack(sleeves.getPath(partNum))) chestTracks.append(getChestTrack(sleeves.getPath(partNum)))

View file

@ -1,15 +1,15 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleBase import * from .BattleBase import *
from BattleProps import * from .BattleProps import *
from BattleSounds import * from .BattleSounds import *
from toontown.toon.ToonDNA import * from toontown.toon.ToonDNA import *
from toontown.suit.SuitDNA import * from toontown.suit.SuitDNA import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import random import random
import MovieCamera from . import MovieCamera
import MovieUtil from . import MovieUtil
from MovieUtil import calcAvgSuitPos from .MovieUtil import calcAvgSuitPos
notify = DirectNotifyGlobal.directNotify.newCategory('MovieThrow') notify = DirectNotifyGlobal.directNotify.newCategory('MovieThrow')
hitSoundFiles = ('AA_tart_only.mp3', 'AA_slice_only.mp3', 'AA_slice_only.mp3', 'AA_slice_only.mp3', 'AA_slice_only.mp3', 'AA_wholepie_only.mp3', 'AA_wholepie_only.mp3') hitSoundFiles = ('AA_tart_only.mp3', 'AA_slice_only.mp3', 'AA_slice_only.mp3', 'AA_slice_only.mp3', 'AA_slice_only.mp3', 'AA_wholepie_only.mp3', 'AA_wholepie_only.mp3')
tPieLeavesHand = 2.7 tPieLeavesHand = 2.7
@ -20,7 +20,7 @@ tPieShrink = 0.7
pieFlyTaskName = 'MovieThrow-pieFly' pieFlyTaskName = 'MovieThrow-pieFly'
def addHit(dict, suitId, hitCount): def addHit(dict, suitId, hitCount):
if dict.has_key(suitId): if suitId in dict:
dict[suitId] += hitCount dict[suitId] += hitCount
else: else:
dict[suitId] = hitCount dict[suitId] = hitCount
@ -35,12 +35,12 @@ def doThrows(throws):
pass pass
else: else:
suitId = throw['target']['suit'].doId suitId = throw['target']['suit'].doId
if suitThrowsDict.has_key(suitId): if suitId in suitThrowsDict:
suitThrowsDict[suitId].append(throw) suitThrowsDict[suitId].append(throw)
else: else:
suitThrowsDict[suitId] = [throw] suitThrowsDict[suitId] = [throw]
suitThrows = suitThrowsDict.values() suitThrows = list(suitThrowsDict.values())
def compFunc(a, b): def compFunc(a, b):
if len(a) > len(b): if len(a) > len(b):
@ -574,7 +574,7 @@ def __throwGroupPie(throw, delay, groupHitDict):
singleSuitResponseTrack.append(Func(suit.loop, 'neutral')) singleSuitResponseTrack.append(Func(suit.loop, 'neutral'))
singleSuitResponseTrack = Parallel(singleSuitResponseTrack, bonusTrack) singleSuitResponseTrack = Parallel(singleSuitResponseTrack, bonusTrack)
else: else:
groupHitValues = groupHitDict.values() groupHitValues = list(groupHitDict.values())
if groupHitValues.count(0) == len(groupHitValues): if groupHitValues.count(0) == len(groupHitValues):
singleSuitResponseTrack = MovieUtil.createSuitDodgeMultitrack(delay + tSuitDodges, suit, leftSuits, rightSuits) singleSuitResponseTrack = MovieUtil.createSuitDodgeMultitrack(delay + tSuitDodges, suit, leftSuits, rightSuits)
else: else:

View file

@ -1,9 +1,9 @@
from libotp import * from libotp import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from direct.showbase.DirectObject import DirectObject from direct.showbase.DirectObject import DirectObject
from RewardPanel import * from .RewardPanel import *
from BattleSounds import * from .BattleSounds import *
import MovieCamera from . import MovieCamera
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import types import types
notify = DirectNotifyGlobal.directNotify.newCategory('MovieToonVictory') notify = DirectNotifyGlobal.directNotify.newCategory('MovieToonVictory')
@ -84,7 +84,7 @@ def doToonVictory(localToonActive, toons, rewardToonIds, rewardDicts, deathList,
countToons = 0 countToons = 0
uberListNew = [] uberListNew = []
for t in toons: for t in toons:
if isinstance(t, types.IntType): if isinstance(t, int):
t = base.cr.doId2do.get(t) t = base.cr.doId2do.get(t)
if t: if t:
toonList.append(t) toonList.append(t)

View file

@ -1,17 +1,17 @@
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleBase import * from .BattleBase import *
from BattleProps import * from .BattleProps import *
from BattleSounds import * from .BattleSounds import *
import MovieUtil from . import MovieUtil
import MovieCamera from . import MovieCamera
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import ToontownBattleGlobals from toontown.toonbase import ToontownBattleGlobals
from direct.actor import Actor from direct.actor import Actor
from direct.particles import ParticleEffect from direct.particles import ParticleEffect
import BattleParticles from . import BattleParticles
import BattleProps from . import BattleProps
import MovieNPCSOS from . import MovieNPCSOS
from MovieSound import createSuitResetPosTrack from .MovieSound import createSuitResetPosTrack
notify = DirectNotifyGlobal.directNotify.newCategory('MovieTrap') notify = DirectNotifyGlobal.directNotify.newCategory('MovieTrap')
def doTraps(traps): def doTraps(traps):
@ -24,14 +24,14 @@ def doTraps(traps):
targets = trap['target'] targets = trap['target']
if len(targets) == 1: if len(targets) == 1:
suitId = targets[0]['suit'].doId suitId = targets[0]['suit'].doId
if suitTrapsDict.has_key(suitId): if suitId in suitTrapsDict:
suitTrapsDict[suitId].append(trap) suitTrapsDict[suitId].append(trap)
else: else:
suitTrapsDict[suitId] = [trap] suitTrapsDict[suitId] = [trap]
else: else:
for target in targets: for target in targets:
suitId = target['suit'].doId suitId = target['suit'].doId
if not suitTrapsDict.has_key(suitId): if suitId not in suitTrapsDict:
suitTrapsDict[suitId] = [trap] suitTrapsDict[suitId] = [trap]
break break
@ -43,7 +43,7 @@ def doTraps(traps):
if suit.battleTrap != NO_TRAP: if suit.battleTrap != NO_TRAP:
hasUberTrapConflict = True hasUberTrapConflict = True
suitTrapLists = suitTrapsDict.values() suitTrapLists = list(suitTrapsDict.values())
mtrack = Parallel() mtrack = Parallel()
for trapList in suitTrapLists: for trapList in suitTrapLists:
trapPropList = [] trapPropList = []
@ -280,7 +280,7 @@ def __createThrownTrapMultiTrack(trap, propList, propName, propPos = None, propH
def __createPlacedTrapMultiTrack(trap, prop, propName, propPos = None, propHpr = None, explode = 0, visibleOnlyForThisSuitId = None): def __createPlacedTrapMultiTrack(trap, prop, propName, propPos = None, propHpr = None, explode = 0, visibleOnlyForThisSuitId = None):
toon = trap['toon'] toon = trap['toon']
if trap.has_key('npc'): if 'npc' in trap:
toon = trap['npc'] toon = trap['npc']
level = trap['level'] level = trap['level']
battle = trap['battle'] battle = trap['battle']
@ -387,7 +387,7 @@ def __trapQuicksand(trap, trapProps, explode):
def __trapTrapdoor(trap, trapProps, explode): def __trapTrapdoor(trap, trapProps, explode):
toon = trap['toon'] toon = trap['toon']
if trap.has_key('npc'): if 'npc' in trap:
toon = trap['npc'] toon = trap['npc']
targets = trap['target'] targets = trap['target']
for target in targets: for target in targets:
@ -408,7 +408,7 @@ def __trapTNT(trap, trapProps, explode):
def __trapTrain(trap, trapProps, explode): def __trapTrain(trap, trapProps, explode):
toon = trap['toon'] toon = trap['toon']
if trap.has_key('npc'): if 'npc' in trap:
toon = trap['npc'] toon = trap['npc']
targets = trap['target'] targets = trap['target']
battle = trap['battle'] battle = trap['battle']
@ -477,7 +477,7 @@ def createCartoonExplosionTrack(parent, animName, explosionPoint = None):
def __createPlacedGroupTrapTrack(trap, prop, propName, centerSuit, propPos = None, propHpr = None, explode = 0): def __createPlacedGroupTrapTrack(trap, prop, propName, centerSuit, propPos = None, propHpr = None, explode = 0):
toon = trap['toon'] toon = trap['toon']
if trap.has_key('npc'): if 'npc' in trap:
toon = trap['npc'] toon = trap['npc']
level = trap['level'] level = trap['level']
battle = trap['battle'] battle = trap['battle']

View file

@ -1,11 +1,11 @@
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleBase import * from .BattleBase import *
from BattleProps import * from .BattleProps import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import random import random
from direct.particles import ParticleEffect from direct.particles import ParticleEffect
import BattleParticles from . import BattleParticles
import BattleProps from . import BattleProps
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
notify = DirectNotifyGlobal.directNotify.newCategory('MovieUtil') notify = DirectNotifyGlobal.directNotify.newCategory('MovieUtil')
SUIT_LOSE_DURATION = 6.0 SUIT_LOSE_DURATION = 6.0

View file

@ -2,12 +2,12 @@ from pandac.PandaModules import *
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from toontown.toonbase.ToontownBattleGlobals import * from toontown.toonbase.ToontownBattleGlobals import *
from toontown.toonbase.ToontownGlobals import * from toontown.toonbase.ToontownGlobals import *
from SuitBattleGlobals import * from .SuitBattleGlobals import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import string import string
from direct.gui import OnscreenText from direct.gui import OnscreenText
import BattleBase from . import BattleBase
class PlayByPlayText(OnscreenText.OnscreenText): class PlayByPlayText(OnscreenText.OnscreenText):
notify = DirectNotifyGlobal.directNotify.newCategory('PlayByPlayText') notify = DirectNotifyGlobal.directNotify.newCategory('PlayByPlayText')

View file

@ -3,7 +3,7 @@ from direct.gui.DirectGui import *
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from toontown.toonbase import ToontownBattleGlobals from toontown.toonbase import ToontownBattleGlobals
import BattleBase from . import BattleBase
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import random import random
import string import string
@ -16,7 +16,7 @@ from toontown.toon import NPCToons
import math import math
from toontown.coghq import CogDisguiseGlobals from toontown.coghq import CogDisguiseGlobals
from toontown.shtiker import DisguisePage from toontown.shtiker import DisguisePage
import Fanfare from . import Fanfare
from otp.otpbase import OTPGlobals from otp.otpbase import OTPGlobals
class RewardPanel(DirectFrame): class RewardPanel(DirectFrame):
@ -303,7 +303,7 @@ class RewardPanel(DirectFrame):
def getRandomCongratsPair(self, toon): def getRandomCongratsPair(self, toon):
congratsStrings = TTLocalizer.RewardPanelCongratsStrings congratsStrings = TTLocalizer.RewardPanelCongratsStrings
numStrings = len(congratsStrings) numStrings = len(congratsStrings)
indexList = range(numStrings) indexList = list(range(numStrings))
index1 = random.choice(indexList) index1 = random.choice(indexList)
indexList.remove(index1) indexList.remove(index1)
index2 = random.choice(indexList) index2 = random.choice(indexList)
@ -445,7 +445,7 @@ class RewardPanel(DirectFrame):
def getTrackIntervalList(self, toon, track, origSkill, earnedSkill, hasUber, guestWaste = 0): def getTrackIntervalList(self, toon, track, origSkill, earnedSkill, hasUber, guestWaste = 0):
if hasUber < 0: if hasUber < 0:
print (toon.doId, 'Reward Panel received an invalid hasUber from an uberList') print((toon.doId, 'Reward Panel received an invalid hasUber from an uberList'))
tickDelay = 1.0 / 60 tickDelay = 1.0 / 60
intervalList = [] intervalList = []
if origSkill + earnedSkill >= ToontownBattleGlobals.UnpaidMaxSkills[track] and toon.getGameAccess() != OTPGlobals.AccessFull: if origSkill + earnedSkill >= ToontownBattleGlobals.UnpaidMaxSkills[track] and toon.getGameAccess() != OTPGlobals.AccessFull:

View file

@ -1,4 +1,4 @@
from BattleBase import * from .BattleBase import *
import random import random
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from otp.otpbase import OTPLocalizer from otp.otpbase import OTPLocalizer
@ -77,7 +77,7 @@ def pickSuitAttack(attacks, suitLevel):
return attackNum return attackNum
elif configAttackName == 'sequence': elif configAttackName == 'sequence':
for i in range(len(attacks)): for i in range(len(attacks)):
if not debugAttackSequence.has_key(attacks[i]): if attacks[i] not in debugAttackSequence:
debugAttackSequence[attacks[i]] = 1 debugAttackSequence[attacks[i]] = 1
return i return i
@ -101,7 +101,7 @@ def getSuitAttack(suitName, suitLevel, attackNum = -1):
adict['suitName'] = suitName adict['suitName'] = suitName
name = attack[0] name = attack[0]
adict['name'] = name adict['name'] = name
adict['id'] = SuitAttacks.keys().index(name) adict['id'] = list(SuitAttacks.keys()).index(name)
adict['animName'] = SuitAttacks[name][0] adict['animName'] = SuitAttacks[name][0]
adict['hp'] = attack[1][suitLevel] adict['hp'] = attack[1][suitLevel]
adict['acc'] = attack[2][suitLevel] adict['acc'] = attack[2][suitLevel]
@ -2953,76 +2953,76 @@ SuitAttacks = {'Audit': ('phone', ATK_TGT_SINGLE),
'Watercooler': ('watercooler', ATK_TGT_SINGLE), 'Watercooler': ('watercooler', ATK_TGT_SINGLE),
'Withdrawal': ('magic1', ATK_TGT_SINGLE), 'Withdrawal': ('magic1', ATK_TGT_SINGLE),
'WriteOff': ('hold-pencil', ATK_TGT_SINGLE)} 'WriteOff': ('hold-pencil', ATK_TGT_SINGLE)}
AUDIT = SuitAttacks.keys().index('Audit') AUDIT = list(SuitAttacks.keys()).index('Audit')
BITE = SuitAttacks.keys().index('Bite') BITE = list(SuitAttacks.keys()).index('Bite')
BOUNCE_CHECK = SuitAttacks.keys().index('BounceCheck') BOUNCE_CHECK = list(SuitAttacks.keys()).index('BounceCheck')
BRAIN_STORM = SuitAttacks.keys().index('BrainStorm') BRAIN_STORM = list(SuitAttacks.keys()).index('BrainStorm')
BUZZ_WORD = SuitAttacks.keys().index('BuzzWord') BUZZ_WORD = list(SuitAttacks.keys()).index('BuzzWord')
CALCULATE = SuitAttacks.keys().index('Calculate') CALCULATE = list(SuitAttacks.keys()).index('Calculate')
CANNED = SuitAttacks.keys().index('Canned') CANNED = list(SuitAttacks.keys()).index('Canned')
CHOMP = SuitAttacks.keys().index('Chomp') CHOMP = list(SuitAttacks.keys()).index('Chomp')
CIGAR_SMOKE = SuitAttacks.keys().index('CigarSmoke') CIGAR_SMOKE = list(SuitAttacks.keys()).index('CigarSmoke')
CLIPON_TIE = SuitAttacks.keys().index('ClipOnTie') CLIPON_TIE = list(SuitAttacks.keys()).index('ClipOnTie')
CRUNCH = SuitAttacks.keys().index('Crunch') CRUNCH = list(SuitAttacks.keys()).index('Crunch')
DEMOTION = SuitAttacks.keys().index('Demotion') DEMOTION = list(SuitAttacks.keys()).index('Demotion')
DOWNSIZE = SuitAttacks.keys().index('Downsize') DOWNSIZE = list(SuitAttacks.keys()).index('Downsize')
DOUBLE_TALK = SuitAttacks.keys().index('DoubleTalk') DOUBLE_TALK = list(SuitAttacks.keys()).index('DoubleTalk')
EVICTION_NOTICE = SuitAttacks.keys().index('EvictionNotice') EVICTION_NOTICE = list(SuitAttacks.keys()).index('EvictionNotice')
EVIL_EYE = SuitAttacks.keys().index('EvilEye') EVIL_EYE = list(SuitAttacks.keys()).index('EvilEye')
FILIBUSTER = SuitAttacks.keys().index('Filibuster') FILIBUSTER = list(SuitAttacks.keys()).index('Filibuster')
FILL_WITH_LEAD = SuitAttacks.keys().index('FillWithLead') FILL_WITH_LEAD = list(SuitAttacks.keys()).index('FillWithLead')
FINGER_WAG = SuitAttacks.keys().index('FingerWag') FINGER_WAG = list(SuitAttacks.keys()).index('FingerWag')
FIRED = SuitAttacks.keys().index('Fired') FIRED = list(SuitAttacks.keys()).index('Fired')
FIVE_O_CLOCK_SHADOW = SuitAttacks.keys().index('FiveOClockShadow') FIVE_O_CLOCK_SHADOW = list(SuitAttacks.keys()).index('FiveOClockShadow')
FLOOD_THE_MARKET = SuitAttacks.keys().index('FloodTheMarket') FLOOD_THE_MARKET = list(SuitAttacks.keys()).index('FloodTheMarket')
FOUNTAIN_PEN = SuitAttacks.keys().index('FountainPen') FOUNTAIN_PEN = list(SuitAttacks.keys()).index('FountainPen')
FREEZE_ASSETS = SuitAttacks.keys().index('FreezeAssets') FREEZE_ASSETS = list(SuitAttacks.keys()).index('FreezeAssets')
GAVEL = SuitAttacks.keys().index('Gavel') GAVEL = list(SuitAttacks.keys()).index('Gavel')
GLOWER_POWER = SuitAttacks.keys().index('GlowerPower') GLOWER_POWER = list(SuitAttacks.keys()).index('GlowerPower')
GUILT_TRIP = SuitAttacks.keys().index('GuiltTrip') GUILT_TRIP = list(SuitAttacks.keys()).index('GuiltTrip')
HALF_WINDSOR = SuitAttacks.keys().index('HalfWindsor') HALF_WINDSOR = list(SuitAttacks.keys()).index('HalfWindsor')
HANG_UP = SuitAttacks.keys().index('HangUp') HANG_UP = list(SuitAttacks.keys()).index('HangUp')
HEAD_SHRINK = SuitAttacks.keys().index('HeadShrink') HEAD_SHRINK = list(SuitAttacks.keys()).index('HeadShrink')
HOT_AIR = SuitAttacks.keys().index('HotAir') HOT_AIR = list(SuitAttacks.keys()).index('HotAir')
JARGON = SuitAttacks.keys().index('Jargon') JARGON = list(SuitAttacks.keys()).index('Jargon')
LEGALESE = SuitAttacks.keys().index('Legalese') LEGALESE = list(SuitAttacks.keys()).index('Legalese')
LIQUIDATE = SuitAttacks.keys().index('Liquidate') LIQUIDATE = list(SuitAttacks.keys()).index('Liquidate')
MARKET_CRASH = SuitAttacks.keys().index('MarketCrash') MARKET_CRASH = list(SuitAttacks.keys()).index('MarketCrash')
MUMBO_JUMBO = SuitAttacks.keys().index('MumboJumbo') MUMBO_JUMBO = list(SuitAttacks.keys()).index('MumboJumbo')
PARADIGM_SHIFT = SuitAttacks.keys().index('ParadigmShift') PARADIGM_SHIFT = list(SuitAttacks.keys()).index('ParadigmShift')
PECKING_ORDER = SuitAttacks.keys().index('PeckingOrder') PECKING_ORDER = list(SuitAttacks.keys()).index('PeckingOrder')
PICK_POCKET = SuitAttacks.keys().index('PickPocket') PICK_POCKET = list(SuitAttacks.keys()).index('PickPocket')
PINK_SLIP = SuitAttacks.keys().index('PinkSlip') PINK_SLIP = list(SuitAttacks.keys()).index('PinkSlip')
PLAY_HARDBALL = SuitAttacks.keys().index('PlayHardball') PLAY_HARDBALL = list(SuitAttacks.keys()).index('PlayHardball')
POUND_KEY = SuitAttacks.keys().index('PoundKey') POUND_KEY = list(SuitAttacks.keys()).index('PoundKey')
POWER_TIE = SuitAttacks.keys().index('PowerTie') POWER_TIE = list(SuitAttacks.keys()).index('PowerTie')
POWER_TRIP = SuitAttacks.keys().index('PowerTrip') POWER_TRIP = list(SuitAttacks.keys()).index('PowerTrip')
QUAKE = SuitAttacks.keys().index('Quake') QUAKE = list(SuitAttacks.keys()).index('Quake')
RAZZLE_DAZZLE = SuitAttacks.keys().index('RazzleDazzle') RAZZLE_DAZZLE = list(SuitAttacks.keys()).index('RazzleDazzle')
RED_TAPE = SuitAttacks.keys().index('RedTape') RED_TAPE = list(SuitAttacks.keys()).index('RedTape')
RE_ORG = SuitAttacks.keys().index('ReOrg') RE_ORG = list(SuitAttacks.keys()).index('ReOrg')
RESTRAINING_ORDER = SuitAttacks.keys().index('RestrainingOrder') RESTRAINING_ORDER = list(SuitAttacks.keys()).index('RestrainingOrder')
ROLODEX = SuitAttacks.keys().index('Rolodex') ROLODEX = list(SuitAttacks.keys()).index('Rolodex')
RUBBER_STAMP = SuitAttacks.keys().index('RubberStamp') RUBBER_STAMP = list(SuitAttacks.keys()).index('RubberStamp')
RUB_OUT = SuitAttacks.keys().index('RubOut') RUB_OUT = list(SuitAttacks.keys()).index('RubOut')
SACKED = SuitAttacks.keys().index('Sacked') SACKED = list(SuitAttacks.keys()).index('Sacked')
SANDTRAP = SuitAttacks.keys().index('SandTrap') SANDTRAP = list(SuitAttacks.keys()).index('SandTrap')
SCHMOOZE = SuitAttacks.keys().index('Schmooze') SCHMOOZE = list(SuitAttacks.keys()).index('Schmooze')
SHAKE = SuitAttacks.keys().index('Shake') SHAKE = list(SuitAttacks.keys()).index('Shake')
SHRED = SuitAttacks.keys().index('Shred') SHRED = list(SuitAttacks.keys()).index('Shred')
SONG_AND_DANCE = SuitAttacks.keys().index('SongAndDance') SONG_AND_DANCE = list(SuitAttacks.keys()).index('SongAndDance')
SPIN = SuitAttacks.keys().index('Spin') SPIN = list(SuitAttacks.keys()).index('Spin')
SYNERGY = SuitAttacks.keys().index('Synergy') SYNERGY = list(SuitAttacks.keys()).index('Synergy')
TABULATE = SuitAttacks.keys().index('Tabulate') TABULATE = list(SuitAttacks.keys()).index('Tabulate')
TEE_OFF = SuitAttacks.keys().index('TeeOff') TEE_OFF = list(SuitAttacks.keys()).index('TeeOff')
THROW_BOOK = SuitAttacks.keys().index('ThrowBook') THROW_BOOK = list(SuitAttacks.keys()).index('ThrowBook')
TREMOR = SuitAttacks.keys().index('Tremor') TREMOR = list(SuitAttacks.keys()).index('Tremor')
WATERCOOLER = SuitAttacks.keys().index('Watercooler') WATERCOOLER = list(SuitAttacks.keys()).index('Watercooler')
WITHDRAWAL = SuitAttacks.keys().index('Withdrawal') WITHDRAWAL = list(SuitAttacks.keys()).index('Withdrawal')
WRITE_OFF = SuitAttacks.keys().index('WriteOff') WRITE_OFF = list(SuitAttacks.keys()).index('WriteOff')
def getFaceoffTaunt(suitName, doId): def getFaceoffTaunt(suitName, doId):
if SuitFaceoffTaunts.has_key(suitName): if suitName in SuitFaceoffTaunts:
taunts = SuitFaceoffTaunts[suitName] taunts = SuitFaceoffTaunts[suitName]
else: else:
taunts = TTLocalizer.SuitFaceoffDefaultTaunts taunts = TTLocalizer.SuitFaceoffDefaultTaunts
@ -3037,7 +3037,7 @@ def getAttackTauntIndexFromIndex(suit, attackIndex):
def getAttackTauntIndex(attackName): def getAttackTauntIndex(attackName):
if SuitAttackTaunts.has_key(attackName): if attackName in SuitAttackTaunts:
taunts = SuitAttackTaunts[attackName] taunts = SuitAttackTaunts[attackName]
return random.randint(0, len(taunts) - 1) return random.randint(0, len(taunts) - 1)
else: else:
@ -3045,7 +3045,7 @@ def getAttackTauntIndex(attackName):
def getAttackTaunt(attackName, index = None): def getAttackTaunt(attackName, index = None):
if SuitAttackTaunts.has_key(attackName): if attackName in SuitAttackTaunts:
taunts = SuitAttackTaunts[attackName] taunts = SuitAttackTaunts[attackName]
else: else:
taunts = TTLocalizer.SuitAttackDefaultTaunts taunts = TTLocalizer.SuitAttackDefaultTaunts

View file

@ -179,7 +179,7 @@ class BoardingGroupShow:
base.cTrav.traverse(render) base.cTrav.traverse(render)
queue.sortEntries() queue.sortEntries()
if queue.getNumEntries(): if queue.getNumEntries():
for entryNum in xrange(queue.getNumEntries()): for entryNum in range(queue.getNumEntries()):
entry = queue.getEntry(entryNum) entry = queue.getEntry(entryNum)
hitObject = entry.getIntoNodePath() hitObject = entry.getIntoNodePath()
if hitObject.getNetTag('pieCode') != '3': if hitObject.getNetTag('pieCode') != '3':

View file

@ -30,7 +30,7 @@ class BoardingPartyBase:
self.maxSize = groupSize self.maxSize = groupSize
def getGroupLeader(self, avatarId): def getGroupLeader(self, avatarId):
if self.avIdDict.has_key(avatarId): if avatarId in self.avIdDict:
leaderId = self.avIdDict[avatarId] leaderId = self.avIdDict[avatarId]
return leaderId return leaderId
else: else:
@ -45,7 +45,7 @@ class BoardingPartyBase:
return False return False
def getGroupMemberList(self, avatarId): def getGroupMemberList(self, avatarId):
if self.avIdDict.has_key(avatarId): if avatarId in self.avIdDict:
leaderId = self.avIdDict[avatarId] leaderId = self.avIdDict[avatarId]
group = self.groupListDict.get(leaderId) group = self.groupListDict.get(leaderId)
if group: if group:
@ -56,7 +56,7 @@ class BoardingPartyBase:
return [] return []
def getGroupInviteList(self, avatarId): def getGroupInviteList(self, avatarId):
if self.avIdDict.has_key(avatarId): if avatarId in self.avIdDict:
leaderId = self.avIdDict[avatarId] leaderId = self.avIdDict[avatarId]
group = self.groupListDict.get(leaderId) group = self.groupListDict.get(leaderId)
if group: if group:
@ -67,7 +67,7 @@ class BoardingPartyBase:
return [] return []
def getGroupKickList(self, avatarId): def getGroupKickList(self, avatarId):
if self.avIdDict.has_key(avatarId): if avatarId in self.avIdDict:
leaderId = self.avIdDict[avatarId] leaderId = self.avIdDict[avatarId]
group = self.groupListDict.get(leaderId) group = self.groupListDict.get(leaderId)
if group: if group:
@ -86,7 +86,7 @@ class BoardingPartyBase:
def hasPendingInvite(self, avatarId): def hasPendingInvite(self, avatarId):
pendingInvite = False pendingInvite = False
if self.avIdDict.has_key(avatarId): if avatarId in self.avIdDict:
leaderId = self.avIdDict[avatarId] leaderId = self.avIdDict[avatarId]
leaderInviteList = self.getGroupInviteList(leaderId) leaderInviteList = self.getGroupInviteList(leaderId)
if leaderId == avatarId: if leaderId == avatarId:

View file

@ -13,7 +13,7 @@ class DistributedAnimDoor(DistributedDoor.DistributedDoor):
base.animDoor = self base.animDoor = self
def getBuilding(self): def getBuilding(self):
if not self.__dict__.has_key('building'): if 'building' not in self.__dict__:
if self.doorType == DoorTypes.EXT_ANIM_STANDARD: if self.doorType == DoorTypes.EXT_ANIM_STANDARD:
searchStr = '**/??' + str(self.block) + ':animated_building_*_DNARoot;+s' searchStr = '**/??' + str(self.block) + ':animated_building_*_DNARoot;+s'
self.notify.debug('searchStr=%s' % searchStr) self.notify.debug('searchStr=%s' % searchStr)
@ -52,7 +52,7 @@ class DistributedAnimDoor(DistributedDoor.DistributedDoor):
self.notify.error('setTriggerName doorTYpe=%s' % self.doorType) self.notify.error('setTriggerName doorTYpe=%s' % self.doorType)
def getAnimBuilding(self): def getAnimBuilding(self):
if not self.__dict__.has_key('animBuilding'): if 'animBuilding' not in self.__dict__:
if self.doorType == DoorTypes.EXT_ANIM_STANDARD: if self.doorType == DoorTypes.EXT_ANIM_STANDARD:
bldg = self.getBuilding() bldg = self.getBuilding()
key = bldg.getParent().getParent() key = bldg.getParent().getParent()

View file

@ -1,6 +1,6 @@
import DistributedElevator from . import DistributedElevator
import DistributedBossElevator from . import DistributedBossElevator
from ElevatorConstants import * from .ElevatorConstants import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer

View file

@ -1,5 +1,5 @@
from ElevatorConstants import * from .ElevatorConstants import *
import DistributedBossElevatorAI from . import DistributedBossElevatorAI
class DistributedBBElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI): class DistributedBBElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI):

View file

@ -12,7 +12,7 @@ from toontown.toontowngui import TTDialog
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
from toontown.toontowngui import TeaserPanel from toontown.toontowngui import TeaserPanel
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
import BoardingGroupShow from . import BoardingGroupShow
class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPartyBase.BoardingPartyBase): class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPartyBase.BoardingPartyBase):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedBoardingParty') notify = DirectNotifyGlobal.directNotify.newCategory('DistributedBoardingParty')
@ -74,7 +74,7 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart
self.notify.debug('postgroupInfo') self.notify.debug('postgroupInfo')
isMyGroup = 0 isMyGroup = 0
removedMemberIdList = [] removedMemberIdList = []
if self.groupListDict.has_key(leaderId): if leaderId in self.groupListDict:
oldGroupEntry = self.groupListDict[leaderId] oldGroupEntry = self.groupListDict[leaderId]
else: else:
oldGroupEntry = [[], [], []] oldGroupEntry = [[], [], []]
@ -100,7 +100,7 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart
if newGroupEntry[0] == [0] or not newGroupEntry[0]: if newGroupEntry[0] == [0] or not newGroupEntry[0]:
dgroup = self.groupListDict.pop(leaderId) dgroup = self.groupListDict.pop(leaderId)
for memberId in dgroup[0]: for memberId in dgroup[0]:
if self.avIdDict.has_key(memberId): if memberId in self.avIdDict:
self.avIdDict.pop(memberId) self.avIdDict.pop(memberId)
if isMyGroup: if isMyGroup:
@ -335,16 +335,16 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart
isMyGroup = 0 isMyGroup = 0
if localAvatar.doId == quitterId or localAvatar.doId == leaderId: if localAvatar.doId == quitterId or localAvatar.doId == leaderId:
isMyGroup = 1 isMyGroup = 1
if self.groupListDict.has_key(leaderId): if leaderId in self.groupListDict:
if leaderId == localAvatar.doId: if leaderId == localAvatar.doId:
isMyGroup = 1 isMyGroup = 1
if self.avIdDict.has_key(leaderId): if leaderId in self.avIdDict:
self.avIdDict.pop(leaderId) self.avIdDict.pop(leaderId)
dgroup = self.groupListDict.pop(leaderId) dgroup = self.groupListDict.pop(leaderId)
for memberId in memberList: for memberId in memberList:
if memberId == localAvatar.doId: if memberId == localAvatar.doId:
isMyGroup = 1 isMyGroup = 1
if self.avIdDict.has_key(memberId): if memberId in self.avIdDict:
self.avIdDict.pop(memberId) self.avIdDict.pop(memberId)
if isMyGroup: if isMyGroup:
@ -427,7 +427,7 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart
place = base.cr.playGame.getPlace() place = base.cr.playGame.getPlace()
if place: if place:
if not place.getState() == 'elevator': if not place.getState() == 'elevator':
if self.avIdDict.has_key(localAvatar.doId): if localAvatar.doId in self.avIdDict:
leaderId = self.avIdDict[localAvatar.doId] leaderId = self.avIdDict[localAvatar.doId]
self.sendUpdate('requestLeave', [leaderId]) self.sendUpdate('requestLeave', [leaderId])

View file

@ -2,7 +2,7 @@ from otp.otpbase import OTPGlobals
from otp.ai.AIBase import * from otp.ai.AIBase import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from ElevatorConstants import * from .ElevatorConstants import *
from direct.distributed import DistributedObjectAI from direct.distributed import DistributedObjectAI
from direct.fsm import ClassicFSM, State from direct.fsm import ClassicFSM, State
from direct.fsm import State from direct.fsm import State
@ -142,7 +142,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
reason = BoardingPartyBase.BOARDCODE_PROMOTION reason = BoardingPartyBase.BOARDCODE_PROMOTION
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviterId, reason, self.elevatorIdList[0]]) self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviterId, reason, self.elevatorIdList[0]])
return return
if self.avIdDict.has_key(inviterId): if inviterId in self.avIdDict:
self.notify.debug('old group') self.notify.debug('old group')
leaderId = self.avIdDict[inviterId] leaderId = self.avIdDict[inviterId]
groupList = self.groupListDict.get(leaderId) groupList = self.groupListDict.get(leaderId)
@ -157,7 +157,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
if inviteeId not in groupList[1]: if inviteeId not in groupList[1]:
groupList[1].append(inviteeId) groupList[1].append(inviteeId)
self.groupListDict[leaderId] = groupList self.groupListDict[leaderId] = groupList
if self.avIdDict.has_key(inviteeId): if inviteeId in self.avIdDict:
self.notify.warning('inviter %s tried to invite %s who already exists in the avIdDict.' % (inviterId, inviteeId)) self.notify.warning('inviter %s tried to invite %s who already exists in the avIdDict.' % (inviterId, inviteeId))
self.air.writeServerEvent('suspicious: inviter', inviterId, ' tried to invite %s who already exists in the avIdDict.' % inviteeId) self.air.writeServerEvent('suspicious: inviter', inviterId, ' tried to invite %s who already exists in the avIdDict.' % inviteeId)
self.avIdDict[inviteeId] = leaderId self.avIdDict[inviteeId] = leaderId
@ -169,7 +169,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
elif inviterId in groupList[2]: elif inviterId in groupList[2]:
self.sendUpdate('postKickReject', [leaderId, inviterId, inviteeId]) self.sendUpdate('postKickReject', [leaderId, inviterId, inviteeId])
else: else:
if self.avIdDict.has_key(inviteeId): if inviteeId in self.avIdDict:
self.notify.warning('inviter %s tried to invite %s who already exists in avIdDict.' % (inviterId, inviteeId)) self.notify.warning('inviter %s tried to invite %s who already exists in avIdDict.' % (inviterId, inviteeId))
self.air.writeServerEvent('suspicious: inviter', inviterId, ' tried to invite %s who already exists in the avIdDict.' % inviteeId) self.air.writeServerEvent('suspicious: inviter', inviterId, ' tried to invite %s who already exists in the avIdDict.' % inviteeId)
self.notify.debug('new group') self.notify.debug('new group')
@ -182,7 +182,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
def requestCancelInvite(self, inviteeId): def requestCancelInvite(self, inviteeId):
inviterId = self.air.getAvatarIdFromSender() inviterId = self.air.getAvatarIdFromSender()
if self.avIdDict.has_key(inviterId): if inviterId in self.avIdDict:
leaderId = self.avIdDict[inviterId] leaderId = self.avIdDict[inviterId]
groupList = self.groupListDict.get(leaderId) groupList = self.groupListDict.get(leaderId)
if groupList: if groupList:
@ -192,11 +192,11 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
def requestAcceptInvite(self, leaderId, inviterId): def requestAcceptInvite(self, leaderId, inviterId):
inviteeId = self.air.getAvatarIdFromSender() inviteeId = self.air.getAvatarIdFromSender()
self.notify.debug('requestAcceptInvite leader%s inviter%s invitee%s' % (leaderId, inviterId, inviteeId)) self.notify.debug('requestAcceptInvite leader%s inviter%s invitee%s' % (leaderId, inviterId, inviteeId))
if self.avIdDict.has_key(inviteeId): if inviteeId in self.avIdDict:
if self.hasActiveGroup(inviteeId): if self.hasActiveGroup(inviteeId):
self.sendUpdateToAvatarId(inviteeId, 'postAlreadyInGroup', []) self.sendUpdateToAvatarId(inviteeId, 'postAlreadyInGroup', [])
return return
if not self.avIdDict.has_key(leaderId) or not self.isInGroup(inviteeId, leaderId): if leaderId not in self.avIdDict or not self.isInGroup(inviteeId, leaderId):
self.sendUpdateToAvatarId(inviteeId, 'postSomethingMissing', []) self.sendUpdateToAvatarId(inviteeId, 'postSomethingMissing', [])
return return
memberList = self.getGroupMemberList(leaderId) memberList = self.getGroupMemberList(leaderId)
@ -225,14 +225,14 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
def requestKick(self, kickId): def requestKick(self, kickId):
leaderId = self.air.getAvatarIdFromSender() leaderId = self.air.getAvatarIdFromSender()
if self.avIdDict.has_key(kickId): if kickId in self.avIdDict:
if self.avIdDict[kickId] == leaderId: if self.avIdDict[kickId] == leaderId:
self.removeFromGroup(leaderId, kickId, kick=1) self.removeFromGroup(leaderId, kickId, kick=1)
self.sendUpdateToAvatarId(kickId, 'postKick', [leaderId]) self.sendUpdateToAvatarId(kickId, 'postKick', [leaderId])
def requestLeave(self, leaderId): def requestLeave(self, leaderId):
memberId = self.air.getAvatarIdFromSender() memberId = self.air.getAvatarIdFromSender()
if self.avIdDict.has_key(memberId): if memberId in self.avIdDict:
if leaderId == self.avIdDict[memberId]: if leaderId == self.avIdDict[memberId]:
self.removeFromGroup(leaderId, memberId) self.removeFromGroup(leaderId, memberId)
@ -254,7 +254,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
if elevatorId in self.elevatorIdList: if elevatorId in self.elevatorIdList:
elevator = simbase.air.doId2do.get(elevatorId) elevator = simbase.air.doId2do.get(elevatorId)
if elevator: if elevator:
if self.avIdDict.has_key(leaderId): if leaderId in self.avIdDict:
if leaderId == self.avIdDict[leaderId]: if leaderId == self.avIdDict[leaderId]:
boardOkay = BoardingPartyBase.BOARDCODE_OKAY boardOkay = BoardingPartyBase.BOARDCODE_OKAY
for avId in self.getGroupMemberList(leaderId): for avId in self.getGroupMemberList(leaderId):
@ -294,7 +294,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
if elevatorId in self.elevatorIdList: if elevatorId in self.elevatorIdList:
elevator = simbase.air.doId2do.get(elevatorId) elevator = simbase.air.doId2do.get(elevatorId)
if elevator: if elevator:
if self.avIdDict.has_key(leaderId): if leaderId in self.avIdDict:
if leaderId == self.avIdDict[leaderId]: if leaderId == self.avIdDict[leaderId]:
group = self.groupListDict.get(leaderId) group = self.groupListDict.get(leaderId)
if group: if group:
@ -319,7 +319,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
return return
def testGoButtonRequirements(self, leaderId, elevatorId): def testGoButtonRequirements(self, leaderId, elevatorId):
if self.avIdDict.has_key(leaderId): if leaderId in self.avIdDict:
if leaderId == self.avIdDict[leaderId]: if leaderId == self.avIdDict[leaderId]:
if elevatorId in self.elevatorIdList: if elevatorId in self.elevatorIdList:
elevator = simbase.air.doId2do.get(elevatorId) elevator = simbase.air.doId2do.get(elevatorId)
@ -374,7 +374,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
def handleAvatarDisco(self, avId): def handleAvatarDisco(self, avId):
self.notify.debug('handleAvatarDisco %s' % avId) self.notify.debug('handleAvatarDisco %s' % avId)
if self.avIdDict.has_key(avId): if avId in self.avIdDict:
leaderId = self.avIdDict[avId] leaderId = self.avIdDict[avId]
self.removeFromGroup(leaderId, avId) self.removeFromGroup(leaderId, avId)
@ -383,12 +383,12 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
if zoneNew in self.visibleZones: if zoneNew in self.visibleZones:
self.toonInZone(avId) self.toonInZone(avId)
else: else:
if self.avIdDict.has_key(avId): if avId in self.avIdDict:
leaderId = self.avIdDict[avId] leaderId = self.avIdDict[avId]
self.removeFromGroup(leaderId, avId) self.removeFromGroup(leaderId, avId)
def toonInZone(self, avId): def toonInZone(self, avId):
if self.avIdDict.has_key(avId): if avId in self.avIdDict:
leaderId = self.avIdDict[avId] leaderId = self.avIdDict[avId]
group = self.groupListDict.get(leaderId) group = self.groupListDict.get(leaderId)
if leaderId and group: if leaderId and group:
@ -415,9 +415,9 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
self.notify.debug('removeFromGroup leaderId %s memberId %s' % (leaderId, memberId)) self.notify.debug('removeFromGroup leaderId %s memberId %s' % (leaderId, memberId))
self.notify.debug('Groups %s' % self.groupListDict) self.notify.debug('Groups %s' % self.groupListDict)
self.notify.debug('avDict %s' % self.avIdDict) self.notify.debug('avDict %s' % self.avIdDict)
if not self.avIdDict.has_key(leaderId): if leaderId not in self.avIdDict:
self.sendUpdate('postGroupDissolve', [memberId, leaderId, [], kick]) self.sendUpdate('postGroupDissolve', [memberId, leaderId, [], kick])
if self.avIdDict.has_key(memberId): if memberId in self.avIdDict:
self.avIdDict.pop(memberId) self.avIdDict.pop(memberId)
return return
self.removeWacthAvStatus(memberId) self.removeWacthAvStatus(memberId)
@ -434,16 +434,16 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
else: else:
return return
if memberId == leaderId or len(group[0]) < 2: if memberId == leaderId or len(group[0]) < 2:
if self.avIdDict.has_key(leaderId): if leaderId in self.avIdDict:
self.avIdDict.pop(leaderId) self.avIdDict.pop(leaderId)
for inviteeId in group[1]: for inviteeId in group[1]:
if self.avIdDict.has_key(inviteeId): if inviteeId in self.avIdDict:
self.avIdDict.pop(inviteeId) self.avIdDict.pop(inviteeId)
self.sendUpdateToAvatarId(inviteeId, 'postInviteCanceled', []) self.sendUpdateToAvatarId(inviteeId, 'postInviteCanceled', [])
dgroup = self.groupListDict.pop(leaderId) dgroup = self.groupListDict.pop(leaderId)
for dMemberId in dgroup[0]: for dMemberId in dgroup[0]:
if self.avIdDict.has_key(dMemberId): if dMemberId in self.avIdDict:
self.avIdDict.pop(dMemberId) self.avIdDict.pop(dMemberId)
self.notify.debug('postGroupDissolve') self.notify.debug('postGroupDissolve')
@ -454,7 +454,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
if post: if post:
self.notify.debug('Calling postGroupInfo from removeFromGroup') self.notify.debug('Calling postGroupInfo from removeFromGroup')
self.sendUpdate('postGroupInfo', [leaderId, group[0], group[1], group[2]]) self.sendUpdate('postGroupInfo', [leaderId, group[0], group[1], group[2]])
if self.avIdDict.has_key(memberId): if memberId in self.avIdDict:
self.avIdDict.pop(memberId) self.avIdDict.pop(memberId)
self.notify.debug('Remove from group END') self.notify.debug('Remove from group END')
self.notify.debug('Groups %s' % self.groupListDict) self.notify.debug('Groups %s' % self.groupListDict)

View file

@ -1,10 +1,10 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from ElevatorConstants import * from .ElevatorConstants import *
from ElevatorUtils import * from .ElevatorUtils import *
import DistributedElevator from . import DistributedElevator
import DistributedElevatorExt from . import DistributedElevatorExt
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM from direct.fsm import ClassicFSM

View file

@ -1,8 +1,8 @@
from otp.ai.AIBase import * from otp.ai.AIBase import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from ElevatorConstants import * from .ElevatorConstants import *
import DistributedElevatorAI, DistributedElevatorExtAI from . import DistributedElevatorAI, DistributedElevatorExtAI
from direct.fsm import ClassicFSM from direct.fsm import ClassicFSM
from direct.fsm import State from direct.fsm import State
from direct.task import Task from direct.task import Task

View file

@ -2,9 +2,9 @@ from pandac.PandaModules import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from direct.directtools.DirectGeometry import * from direct.directtools.DirectGeometry import *
from ElevatorConstants import * from .ElevatorConstants import *
from ElevatorUtils import * from .ElevatorUtils import *
from SuitBuildingGlobals import * from .SuitBuildingGlobals import *
from direct.gui.DirectGui import * from direct.gui.DirectGui import *
from pandac.PandaModules import * from pandac.PandaModules import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
@ -710,7 +710,7 @@ class DistributedBuilding(DistributedObject.DistributedObject):
def plantVictorsOutsideBldg(self): def plantVictorsOutsideBldg(self):
retVal = 0 retVal = 0
for victor in self.victorList: for victor in self.victorList:
if victor != 0 and self.cr.doId2do.has_key(victor): if victor != 0 and victor in self.cr.doId2do:
toon = self.cr.doId2do[victor] toon = self.cr.doId2do[victor]
toon.setPosHpr(self.elevatorModel, 0, -10, 0, 0, 0, 0) toon.setPosHpr(self.elevatorModel, 0, -10, 0, 0, 0, 0)
toon.startSmooth() toon.startSmooth()
@ -725,12 +725,12 @@ class DistributedBuilding(DistributedObject.DistributedObject):
delayDeletes = [] delayDeletes = []
i = 0 i = 0
for victor in self.victorList: for victor in self.victorList:
if victor != 0 and self.cr.doId2do.has_key(victor): if victor != 0 and victor in self.cr.doId2do:
toon = self.cr.doId2do[victor] toon = self.cr.doId2do[victor]
delayDeletes.append(DelayDelete.DelayDelete(toon, 'getVictoryRunTrack')) delayDeletes.append(DelayDelete.DelayDelete(toon, 'getVictoryRunTrack'))
toon.stopSmooth() toon.stopSmooth()
toon.setParent(ToontownGlobals.SPHidden) toon.setParent(ToontownGlobals.SPHidden)
origPosTrack.append(Func(toon.setPosHpr, self.elevatorNodePath, apply(Point3, ElevatorPoints[i]), Point3(180, 0, 0))) origPosTrack.append(Func(toon.setPosHpr, self.elevatorNodePath, Point3(*ElevatorPoints[i]), Point3(180, 0, 0)))
origPosTrack.append(Func(toon.setParent, ToontownGlobals.SPRender)) origPosTrack.append(Func(toon.setParent, ToontownGlobals.SPRender))
i += 1 i += 1
@ -740,7 +740,7 @@ class DistributedBuilding(DistributedObject.DistributedObject):
runOutAll = Parallel() runOutAll = Parallel()
i = 0 i = 0
for victor in self.victorList: for victor in self.victorList:
if victor != 0 and self.cr.doId2do.has_key(victor): if victor != 0 and victor in self.cr.doId2do:
toon = self.cr.doId2do[victor] toon = self.cr.doId2do[victor]
p0 = Point3(0, 0, 0) p0 = Point3(0, 0, 0)
p1 = Point3(ElevatorPoints[i][0], ElevatorPoints[i][1] - 5.0, ElevatorPoints[i][2]) p1 = Point3(ElevatorPoints[i][0], ElevatorPoints[i][1] - 5.0, ElevatorPoints[i][2])

View file

@ -7,7 +7,7 @@ from direct.distributed import DistributedObjectAI
from direct.fsm import State from direct.fsm import State
from direct.fsm import ClassicFSM, State from direct.fsm import ClassicFSM, State
from toontown.toonbase.ToontownGlobals import ToonHall from toontown.toonbase.ToontownGlobals import ToonHall
import DistributedToonInteriorAI, DistributedToonHallInteriorAI, DistributedSuitInteriorAI, DistributedDoorAI, DoorTypes, DistributedElevatorExtAI, DistributedKnockKnockDoorAI, SuitPlannerInteriorAI, SuitBuildingGlobals, FADoorCodes from . import DistributedToonInteriorAI, DistributedToonHallInteriorAI, DistributedSuitInteriorAI, DistributedDoorAI, DoorTypes, DistributedElevatorExtAI, DistributedKnockKnockDoorAI, SuitPlannerInteriorAI, SuitBuildingGlobals, FADoorCodes
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
import random, time import random, time
from toontown.cogdominium.DistributedCogdoInteriorAI import DistributedCogdoInteriorAI from toontown.cogdominium.DistributedCogdoInteriorAI import DistributedCogdoInteriorAI
@ -244,7 +244,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
return return
def setVictorExited(self, avId): def setVictorExited(self, avId):
print 'victor %d exited unexpectedly for bldg %d' % (avId, self.doId) print('victor %d exited unexpectedly for bldg %d' % (avId, self.doId))
self.recordVictorResponse(avId) self.recordVictorResponse(avId)
if self.allVictorsResponded(): if self.allVictorsResponded():
self.toonTakeOver() self.toonTakeOver()
@ -276,7 +276,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
pass pass
def getToon(self, toonId): def getToon(self, toonId):
if self.air.doId2do.has_key(toonId): if toonId in self.air.doId2do:
return self.air.doId2do[toonId] return self.air.doId2do[toonId]
else: else:
self.notify.warning('getToon() - toon: %d not in repository!' % toonId) self.notify.warning('getToon() - toon: %d not in repository!' % toonId)
@ -313,7 +313,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
for i in range(0, 4): for i in range(0, 4):
victor = victorList[i] victor = victorList[i]
if victor == None or not self.air.doId2do.has_key(victor): if victor == None or victor not in self.air.doId2do:
victorList[i] = 0 victorList[i] = 0
else: else:
event = self.air.getAvatarExitEvent(victor) event = self.air.getAvatarExitEvent(victor)
@ -355,7 +355,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
for i in range(0, 4): for i in range(0, 4):
victor = victorList[i] victor = victorList[i]
if victor == None or not self.air.doId2do.has_key(victor): if victor == None or victor not in self.air.doId2do:
victorList[i] = 0 victorList[i] = 0
else: else:
event = self.air.getAvatarExitEvent(victor) event = self.air.getAvatarExitEvent(victor)

View file

@ -1,8 +1,8 @@
import os import os
from direct.task.Task import Task from direct.task.Task import Task
import cPickle import pickle
from otp.ai.AIBaseGlobal import * from otp.ai.AIBaseGlobal import *
import DistributedBuildingAI, HQBuildingAI, GagshopBuildingAI, PetshopBuildingAI from . import DistributedBuildingAI, HQBuildingAI, GagshopBuildingAI, PetshopBuildingAI
from toontown.building.KartShopBuildingAI import KartShopBuildingAI from toontown.building.KartShopBuildingAI import KartShopBuildingAI
from toontown.building import DistributedAnimBuildingAI from toontown.building import DistributedAnimBuildingAI
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
@ -28,13 +28,13 @@ class DistributedBuildingMgrAI:
def cleanup(self): def cleanup(self):
taskMgr.remove(str(self.branchID) + '_delayed_save-timer') taskMgr.remove(str(self.branchID) + '_delayed_save-timer')
for building in self.__buildings.values(): for building in list(self.__buildings.values()):
building.cleanup() building.cleanup()
self.__buildings = {} self.__buildings = {}
def isValidBlockNumber(self, blockNumber): def isValidBlockNumber(self, blockNumber):
return self.__buildings.has_key(blockNumber) return blockNumber in self.__buildings
def delayedSaveTask(self, task): def delayedSaveTask(self, task):
self.save() self.save()
@ -46,7 +46,7 @@ class DistributedBuildingMgrAI:
def getSuitBlocks(self): def getSuitBlocks(self):
blocks = [] blocks = []
for i in self.__buildings.values(): for i in list(self.__buildings.values()):
if i.isSuitBlock(): if i.isSuitBlock():
blocks.append(i.getBlock()[0]) blocks.append(i.getBlock()[0])
@ -57,7 +57,7 @@ class DistributedBuildingMgrAI:
def getCogdoBlocks(self): def getCogdoBlocks(self):
blocks = [] blocks = []
for i in self.__buildings.values(): for i in list(self.__buildings.values()):
if i.isCogdo(): if i.isCogdo():
blocks.append(i.getBlock()[0]) blocks.append(i.getBlock()[0])
@ -65,7 +65,7 @@ class DistributedBuildingMgrAI:
def getEstablishedSuitBlocks(self): def getEstablishedSuitBlocks(self):
blocks = [] blocks = []
for i in self.__buildings.values(): for i in list(self.__buildings.values()):
if i.isEstablishedSuitBlock(): if i.isEstablishedSuitBlock():
blocks.append(i.getBlock()[0]) blocks.append(i.getBlock()[0])
@ -73,7 +73,7 @@ class DistributedBuildingMgrAI:
def getToonBlocks(self): def getToonBlocks(self):
blocks = [] blocks = []
for i in self.__buildings.values(): for i in list(self.__buildings.values()):
if isinstance(i, HQBuildingAI.HQBuildingAI): if isinstance(i, HQBuildingAI.HQBuildingAI):
continue continue
if not i.isSuitBlock(): if not i.isSuitBlock():
@ -82,7 +82,7 @@ class DistributedBuildingMgrAI:
return blocks return blocks
def getBuildings(self): def getBuildings(self):
return self.__buildings.values() return list(self.__buildings.values())
def getFrontDoorPoint(self, blockNumber): def getFrontDoorPoint(self, blockNumber):
return self.__buildings[blockNumber].getFrontDoorPoint() return self.__buildings[blockNumber].getFrontDoorPoint()
@ -237,13 +237,13 @@ class DistributedBuildingMgrAI:
def saveTo(self, file, block=None): def saveTo(self, file, block=None):
if block: if block:
pickleData = block.getPickleData() pickleData = block.getPickleData()
cPickle.dump(pickleData, file) pickle.dump(pickleData, file)
else: else:
for i in self.__buildings.values(): for i in list(self.__buildings.values()):
if isinstance(i, HQBuildingAI.HQBuildingAI): if isinstance(i, HQBuildingAI.HQBuildingAI):
continue continue
pickleData = i.getPickleData() pickleData = i.getPickleData()
cPickle.dump(pickleData, file) pickle.dump(pickleData, file)
def fastSave(self, block): def fastSave(self, block):
return return
@ -280,7 +280,7 @@ class DistributedBuildingMgrAI:
blocks = {} blocks = {}
try: try:
while 1: while 1:
pickleData = cPickle.load(file) pickleData = pickle.load(file)
blocks[int(pickleData['block'])] = pickleData blocks[int(pickleData['block'])] = pickleData
except EOFError: except EOFError:

View file

@ -1,6 +1,6 @@
import DistributedElevator from . import DistributedElevator
import DistributedBossElevator from . import DistributedBossElevator
from ElevatorConstants import * from .ElevatorConstants import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer

View file

@ -1,5 +1,5 @@
from ElevatorConstants import * from .ElevatorConstants import *
import DistributedBossElevatorAI from . import DistributedBossElevatorAI
class DistributedCFOElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI): class DistributedCFOElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI):

View file

@ -1,6 +1,6 @@
import DistributedElevator from . import DistributedElevator
import DistributedBossElevator from . import DistributedBossElevator
from ElevatorConstants import * from .ElevatorConstants import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer

View file

@ -1,5 +1,5 @@
from ElevatorConstants import * from .ElevatorConstants import *
import DistributedBossElevatorAI from . import DistributedBossElevatorAI
class DistributedCJElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI): class DistributedCJElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI):

View file

@ -307,7 +307,7 @@ class DistributedClubElevator(DistributedElevatorFSM.DistributedElevatorFSM):
def kickEveryoneOut(self): def kickEveryoneOut(self):
bailFlag = 0 bailFlag = 0
for avId, slot in self.boardedAvIds.items(): for avId, slot in list(self.boardedAvIds.items()):
self.emptySlot(slot, avId, bailFlag, globalClockDelta.getRealNetworkTime()) self.emptySlot(slot, avId, bailFlag, globalClockDelta.getRealNetworkTime())
if avId == base.localAvatar.doId: if avId == base.localAvatar.doId:
pass pass
@ -380,7 +380,7 @@ class DistributedClubElevator(DistributedElevatorFSM.DistributedElevatorFSM):
del self.toonRequests[index] del self.toonRequests[index]
if avId == 0: if avId == 0:
pass pass
elif not self.cr.doId2do.has_key(avId): elif avId not in self.cr.doId2do:
func = PythonUtil.Functor(self.gotToon, index, avId) func = PythonUtil.Functor(self.gotToon, index, avId)
self.toonRequests[index] = self.cr.relatedObjectMgr.requestObjects([avId], allCallback=func) self.toonRequests[index] = self.cr.relatedObjectMgr.requestObjects([avId], allCallback=func)
elif not self.isSetup: elif not self.isSetup:
@ -460,7 +460,7 @@ class DistributedClubElevator(DistributedElevatorFSM.DistributedElevatorFSM):
newSlots.append(slot) newSlots.append(slot)
self.deferredSlots = newSlots self.deferredSlots = newSlots
elif self.cr.doId2do.has_key(avId): elif avId in self.cr.doId2do:
if bailFlag == 1 and hasattr(self, 'clockNode'): if bailFlag == 1 and hasattr(self, 'clockNode'):
if timestamp < self.countdownTime and timestamp >= 0: if timestamp < self.countdownTime and timestamp >= 0:
self.countdown(self.countdownTime - timestamp) self.countdown(self.countdownTime - timestamp)
@ -527,5 +527,5 @@ class DistributedClubElevator(DistributedElevatorFSM.DistributedElevatorFSM):
keyList.append(key) keyList.append(key)
for key in keyList: for key in keyList:
if self.__toonTracks.has_key(key): if key in self.__toonTracks:
self.clearToonTrack(key) self.clearToonTrack(key)

View file

@ -129,7 +129,7 @@ class DistributedClubElevatorAI(DistributedElevatorFSMAI.DistributedElevatorFSMA
for i in range(len(self.seats)): for i in range(len(self.seats)):
self.seats[i] = None self.seats[i] = None
print self.seats print(self.seats)
if self.wantState == 'closed': if self.wantState == 'closed':
self.demand('Closing') self.demand('Closing')
else: else:

View file

@ -9,9 +9,9 @@ from direct.distributed import DistributedObject
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
from toontown.suit import Suit from toontown.suit import Suit
from toontown.distributed import DelayDelete from toontown.distributed import DelayDelete
import FADoorCodes from . import FADoorCodes
from direct.task.Task import Task from direct.task.Task import Task
import DoorTypes from . import DoorTypes
from toontown.toontowngui import TTDialog from toontown.toontowngui import TTDialog
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from toontown.toontowngui import TeaserPanel from toontown.toontowngui import TeaserPanel
@ -70,7 +70,7 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable):
self.ignore('clearOutToonInterior') self.ignore('clearOutToonInterior')
self.fsm.request('off') self.fsm.request('off')
self.exitDoorFSM.request('off') self.exitDoorFSM.request('off')
if self.__dict__.has_key('building'): if 'building' in self.__dict__:
del self.building del self.building
self.finishAllTracks() self.finishAllTracks()
self.avatarIDList = [] self.avatarIDList = []
@ -116,7 +116,7 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable):
return return
def getTriggerName(self): def getTriggerName(self):
if self.doorType == DoorTypes.INT_HQ or self.specialDoorTypes.has_key(self.doorType): if self.doorType == DoorTypes.INT_HQ or self.doorType in self.specialDoorTypes:
return 'door_trigger_' + str(self.block) + '_' + str(self.doorIndex) return 'door_trigger_' + str(self.block) + '_' + str(self.doorIndex)
else: else:
return 'door_trigger_' + str(self.block) return 'door_trigger_' + str(self.block)
@ -132,7 +132,7 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable):
return 'exit' + self.getTriggerName() return 'exit' + self.getTriggerName()
def hideDoorParts(self): def hideDoorParts(self):
if self.specialDoorTypes.has_key(self.doorType): if self.doorType in self.specialDoorTypes:
self.hideIfHasFlat(self.findDoorNode('rightDoor')) self.hideIfHasFlat(self.findDoorNode('rightDoor'))
self.hideIfHasFlat(self.findDoorNode('leftDoor')) self.hideIfHasFlat(self.findDoorNode('leftDoor'))
self.findDoorNode('doorFrameHoleRight').hide() self.findDoorNode('doorFrameHoleRight').hide()
@ -141,7 +141,7 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable):
return return
def setTriggerName(self): def setTriggerName(self):
if self.specialDoorTypes.has_key(self.doorType): if self.doorType in self.specialDoorTypes:
building = self.getBuilding() building = self.getBuilding()
doorTrigger = building.find('**/door_' + str(self.doorIndex) + '/**/door_trigger*') doorTrigger = building.find('**/door_' + str(self.doorIndex) + '/**/door_trigger*')
doorTrigger.node().setName(self.getTriggerName()) doorTrigger.node().setName(self.getTriggerName())
@ -200,7 +200,7 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable):
self.setupNametag() self.setupNametag()
def getBuilding(self): def getBuilding(self):
if not self.__dict__.has_key('building'): if 'building' not in self.__dict__:
if self.doorType == DoorTypes.INT_STANDARD: if self.doorType == DoorTypes.INT_STANDARD:
door = render.find('**/leftDoor;+s') door = render.find('**/leftDoor;+s')
self.building = door.getParent() self.building = door.getParent()
@ -220,12 +220,12 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable):
return self.building return self.building
def getBuilding_wip(self): def getBuilding_wip(self):
if not self.__dict__.has_key('building'): if 'building' not in self.__dict__:
if self.__dict__.has_key('block'): if 'block' in self.__dict__:
self.building = self.cr.playGame.hood.loader.geom.find('**/??' + str(self.block) + ':*_landmark_*_DNARoot;+s') self.building = self.cr.playGame.hood.loader.geom.find('**/??' + str(self.block) + ':*_landmark_*_DNARoot;+s')
else: else:
self.building = self.cr.playGame.hood.loader.geom self.building = self.cr.playGame.hood.loader.geom
print '---------------- door is interior -------' print('---------------- door is interior -------')
return self.building return self.building
def readyToExit(self): def readyToExit(self):
@ -400,7 +400,7 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable):
otherNP.setPos(posHpr.getPos()) otherNP.setPos(posHpr.getPos())
otherNP.setHpr(posHpr.getHpr()) otherNP.setHpr(posHpr.getHpr())
self.tempDoorNodePath = otherNP self.tempDoorNodePath = otherNP
elif self.specialDoorTypes.has_key(self.doorType): elif self.doorType in self.specialDoorTypes:
building = self.getBuilding() building = self.getBuilding()
otherNP = building.find('**/door_origin_' + str(self.doorIndex)) otherNP = building.find('**/door_origin_' + str(self.doorIndex))
elif self.doorType == DoorTypes.INT_HQ: elif self.doorType == DoorTypes.INT_HQ:

View file

@ -123,7 +123,7 @@ class DistributedDoorAI(DistributedObjectAI.DistributedObjectAI):
self.otherDoor.getZoneId(), self.otherDoor.getDoId()]) self.otherDoor.getZoneId(), self.otherDoor.getDoId()])
def enqueueAvatarIdEnter(self, avatarID): def enqueueAvatarIdEnter(self, avatarID):
if not self.avatarsWhoAreEntering.has_key(avatarID): if avatarID not in self.avatarsWhoAreEntering:
self.avatarsWhoAreEntering[avatarID] = 1 self.avatarsWhoAreEntering[avatarID] = 1
self.sendUpdate('avatarEnter', [avatarID]) self.sendUpdate('avatarEnter', [avatarID])
self.openDoor(self.fsm) self.openDoor(self.fsm)
@ -142,10 +142,10 @@ class DistributedDoorAI(DistributedObjectAI.DistributedObjectAI):
self.enqueueAvatarIdExit(avatarID) self.enqueueAvatarIdExit(avatarID)
def enqueueAvatarIdExit(self, avatarID): def enqueueAvatarIdExit(self, avatarID):
if self.avatarsWhoAreEntering.has_key(avatarID): if avatarID in self.avatarsWhoAreEntering:
del self.avatarsWhoAreEntering[avatarID] del self.avatarsWhoAreEntering[avatarID]
else: else:
if not self.avatarsWhoAreExiting.has_key(avatarID): if avatarID not in self.avatarsWhoAreExiting:
self.avatarsWhoAreExiting[avatarID] = 1 self.avatarsWhoAreExiting[avatarID] = 1
self.openDoor(self.exitDoorFSM) self.openDoor(self.exitDoorFSM)

View file

@ -1,8 +1,8 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from ElevatorConstants import * from .ElevatorConstants import *
from ElevatorUtils import * from .ElevatorUtils import *
from direct.showbase import PythonUtil from direct.showbase import PythonUtil
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM, State from direct.fsm import ClassicFSM, State
@ -88,7 +88,7 @@ class DistributedElevator(DistributedObject.DistributedObject):
if self.bldgRequest: if self.bldgRequest:
self.cr.relatedObjectMgr.abortRequest(self.bldgRequest) self.cr.relatedObjectMgr.abortRequest(self.bldgRequest)
self.bldgRequest = None self.bldgRequest = None
for request in self.toonRequests.values(): for request in list(self.toonRequests.values()):
self.cr.relatedObjectMgr.abortRequest(request) self.cr.relatedObjectMgr.abortRequest(request)
self.toonRequests = {} self.toonRequests = {}
@ -186,7 +186,7 @@ class DistributedElevator(DistributedObject.DistributedObject):
del self.toonRequests[index] del self.toonRequests[index]
if avId == 0: if avId == 0:
pass pass
elif not self.cr.doId2do.has_key(avId): elif avId not in self.cr.doId2do:
func = PythonUtil.Functor(self.gotToon, index, avId) func = PythonUtil.Functor(self.gotToon, index, avId)
self.toonRequests[index] = self.cr.relatedObjectMgr.requestObjects([avId], allCallback=func) self.toonRequests[index] = self.cr.relatedObjectMgr.requestObjects([avId], allCallback=func)
elif not self.isSetup: elif not self.isSetup:
@ -226,8 +226,8 @@ class DistributedElevator(DistributedObject.DistributedObject):
else: else:
animInFunc = Sequence(Func(toon.setAnimState, 'run', 1.0)) animInFunc = Sequence(Func(toon.setAnimState, 'run', 1.0))
animFunc = Func(toon.setAnimState, 'neutral', 1.0) animFunc = Func(toon.setAnimState, 'neutral', 1.0)
toon.headsUp(self.getElevatorModel(), apply(Point3, self.elevatorPoints[index])) toon.headsUp(self.getElevatorModel(), Point3(*self.elevatorPoints[index]))
track = Sequence(animInFunc, LerpPosInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.75, apply(Point3, self.elevatorPoints[index]), other=self.getElevatorModel()), LerpHprInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.25, Point3(180, 0, 0), other=self.getElevatorModel()), Func(self.clearToonTrack, avId), animFunc, name=toon.uniqueName('fillElevator'), autoPause=1) track = Sequence(animInFunc, LerpPosInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.75, Point3(*self.elevatorPoints[index]), other=self.getElevatorModel()), LerpHprInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.25, Point3(180, 0, 0), other=self.getElevatorModel()), Func(self.clearToonTrack, avId), animFunc, name=toon.uniqueName('fillElevator'), autoPause=1)
if wantBoardingShow: if wantBoardingShow:
boardingTrack, boardingTrackType = self.getBoardingTrack(toon, index, False) boardingTrack, boardingTrackType = self.getBoardingTrack(toon, index, False)
track = Sequence(boardingTrack, track) track = Sequence(boardingTrack, track)
@ -301,7 +301,7 @@ class DistributedElevator(DistributedObject.DistributedObject):
timeToSet = self.countdownTime timeToSet = self.countdownTime
if timeSent > 0: if timeSent > 0:
timeToSet = timeSent timeToSet = timeSent
if self.cr.doId2do.has_key(avId): if avId in self.cr.doId2do:
if bailFlag == 1 and hasattr(self, 'clockNode'): if bailFlag == 1 and hasattr(self, 'clockNode'):
if timestamp < timeToSet and timestamp >= 0: if timestamp < timeToSet and timestamp >= 0:
self.countdown(timeToSet - timestamp) self.countdown(timeToSet - timestamp)
@ -362,7 +362,7 @@ class DistributedElevator(DistributedObject.DistributedObject):
place.fsm.request('walk') place.fsm.request('walk')
def rejectBoard(self, avId, reason = 0): def rejectBoard(self, avId, reason = 0):
print 'rejectBoard %s' % reason print('rejectBoard %s' % reason)
if hasattr(base.localAvatar, 'elevatorNotifier'): if hasattr(base.localAvatar, 'elevatorNotifier'):
if reason == REJECT_SHUFFLE: if reason == REJECT_SHUFFLE:
base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorHoppedOff) base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorHoppedOff)
@ -423,7 +423,7 @@ class DistributedElevator(DistributedObject.DistributedObject):
pass pass
def onDoorCloseFinish(self): def onDoorCloseFinish(self):
for avId in self.boardedAvIds.keys(): for avId in list(self.boardedAvIds.keys()):
av = self.cr.doId2do.get(avId) av = self.cr.doId2do.get(avId)
if av is not None: if av is not None:
if av.getParent().compareTo(self.getElevatorModel()) == 0: if av.getParent().compareTo(self.getElevatorModel()) == 0:
@ -543,7 +543,7 @@ class DistributedElevator(DistributedObject.DistributedObject):
keyList.append(key) keyList.append(key)
for key in keyList: for key in keyList:
if self.__toonTracks.has_key(key): if key in self.__toonTracks:
self.clearToonTrack(key) self.clearToonTrack(key)
def getDestName(self): def getDestName(self):
@ -553,11 +553,11 @@ class DistributedElevator(DistributedObject.DistributedObject):
return self.JumpOutOffsets[seatIndex] return self.JumpOutOffsets[seatIndex]
def getOffsetPosWrtToonParent(self, toon, seatIndex = 0): def getOffsetPosWrtToonParent(self, toon, seatIndex = 0):
self.offsetNP.setPos(apply(Point3, self.getOffsetPos(seatIndex))) self.offsetNP.setPos(Point3(*self.getOffsetPos(seatIndex)))
return self.offsetNP.getPos(toon.getParent()) return self.offsetNP.getPos(toon.getParent())
def getOffsetPosWrtRender(self, seatIndex = 0): def getOffsetPosWrtRender(self, seatIndex = 0):
self.offsetNP.setPos(apply(Point3, self.getOffsetPos(seatIndex))) self.offsetNP.setPos(Point3(*self.getOffsetPos(seatIndex)))
return self.offsetNP.getPos(render) return self.offsetNP.getPos(render)
def canHideBoardingQuitBtn(self, avId): def canHideBoardingQuitBtn(self, avId):

View file

@ -1,7 +1,7 @@
from otp.ai.AIBase import * from otp.ai.AIBase import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from ElevatorConstants import * from .ElevatorConstants import *
from direct.distributed import DistributedObjectAI from direct.distributed import DistributedObjectAI
from direct.fsm import ClassicFSM, State from direct.fsm import ClassicFSM, State
from direct.fsm import State from direct.fsm import State
@ -258,7 +258,7 @@ class DistributedElevatorAI(DistributedObjectAI.DistributedObjectAI):
self.accepting = 1 self.accepting = 1
def exitWaitCountdown(self): def exitWaitCountdown(self):
print 'exit wait countdown' print('exit wait countdown')
self.accepting = 0 self.accepting = 0
taskMgr.remove(self.uniqueName('countdown-timer')) taskMgr.remove(self.uniqueName('countdown-timer'))
self.newTrip() self.newTrip()

View file

@ -2,9 +2,9 @@ from pandac.PandaModules import *
from libotp import * from libotp import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from ElevatorConstants import * from .ElevatorConstants import *
from ElevatorUtils import * from .ElevatorUtils import *
import DistributedElevator from . import DistributedElevator
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM from direct.fsm import ClassicFSM

View file

@ -1,8 +1,8 @@
from otp.ai.AIBase import * from otp.ai.AIBase import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from ElevatorConstants import * from .ElevatorConstants import *
import DistributedElevatorAI from . import DistributedElevatorAI
from direct.fsm import ClassicFSM from direct.fsm import ClassicFSM
from direct.fsm import State from direct.fsm import State
from direct.task import Task from direct.task import Task

View file

@ -1,8 +1,8 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from ElevatorConstants import * from .ElevatorConstants import *
from ElevatorUtils import * from .ElevatorUtils import *
from direct.showbase import PythonUtil from direct.showbase import PythonUtil
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM from direct.fsm import ClassicFSM
@ -102,7 +102,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM):
if self.bldgRequest: if self.bldgRequest:
self.cr.relatedObjectMgr.abortRequest(self.bldgRequest) self.cr.relatedObjectMgr.abortRequest(self.bldgRequest)
self.bldgRequest = None self.bldgRequest = None
for request in self.toonRequests.values(): for request in list(self.toonRequests.values()):
self.cr.relatedObjectMgr.abortRequest(request) self.cr.relatedObjectMgr.abortRequest(request)
self.toonRequests = {} self.toonRequests = {}
@ -197,7 +197,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM):
del self.toonRequests[index] del self.toonRequests[index]
if avId == 0: if avId == 0:
pass pass
elif not self.cr.doId2do.has_key(avId): elif avId not in self.cr.doId2do:
func = PythonUtil.Functor(self.gotToon, index, avId) func = PythonUtil.Functor(self.gotToon, index, avId)
self.toonRequests[index] = self.cr.relatedObjectMgr.requestObjects([avId], allCallback=func) self.toonRequests[index] = self.cr.relatedObjectMgr.requestObjects([avId], allCallback=func)
elif not self.isSetup: elif not self.isSetup:
@ -218,8 +218,8 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM):
else: else:
toon.setAnimState('run', 1.0) toon.setAnimState('run', 1.0)
animFunc = Func(toon.setAnimState, 'neutral', 1.0) animFunc = Func(toon.setAnimState, 'neutral', 1.0)
toon.headsUp(self.getElevatorModel(), apply(Point3, self.getScaledPoint(index))) toon.headsUp(self.getElevatorModel(), Point3(*self.getScaledPoint(index)))
track = Sequence(LerpPosInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.75, apply(Point3, self.getScaledPoint(index)), other=self.getElevatorModel()), LerpHprInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.25, Point3(180, 0, 0), other=self.getElevatorModel()), animFunc, name=toon.uniqueName('fillElevator'), autoPause=1) track = Sequence(LerpPosInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.75, Point3(*self.getScaledPoint(index)), other=self.getElevatorModel()), LerpHprInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.25, Point3(180, 0, 0), other=self.getElevatorModel()), animFunc, name=toon.uniqueName('fillElevator'), autoPause=1)
track.start() track.start()
self.boardedAvIds[avId] = index self.boardedAvIds[avId] = index
@ -251,7 +251,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM):
if self.cr: if self.cr:
toon.setAnimState('neutral', 1.0) toon.setAnimState('neutral', 1.0)
if toon == base.localAvatar: if toon == base.localAvatar:
print 'moving the local toon off the elevator' print('moving the local toon off the elevator')
doneStatus = {'where': 'exit'} doneStatus = {'where': 'exit'}
elevator = self.getPlaceElevator() elevator = self.getPlaceElevator()
elevator.signalDone(doneStatus) elevator.signalDone(doneStatus)
@ -261,7 +261,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM):
return return
def emptySlot(self, index, avId, bailFlag, timestamp): def emptySlot(self, index, avId, bailFlag, timestamp):
print 'Emptying slot: %d for %d' % (index, avId) print('Emptying slot: %d for %d' % (index, avId))
if avId == 0: if avId == 0:
pass pass
elif not self.isSetup: elif not self.isSetup:
@ -271,7 +271,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM):
newSlots.append(slot) newSlots.append(slot)
self.deferredSlots = newSlots self.deferredSlots = newSlots
elif self.cr.doId2do.has_key(avId): elif avId in self.cr.doId2do:
if bailFlag == 1 and hasattr(self, 'clockNode'): if bailFlag == 1 and hasattr(self, 'clockNode'):
if timestamp < self.countdownTime and timestamp >= 0: if timestamp < self.countdownTime and timestamp >= 0:
self.countdown(self.countdownTime - timestamp) self.countdown(self.countdownTime - timestamp)
@ -289,7 +289,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM):
if self.offTrack[index].isPlaying(): if self.offTrack[index].isPlaying():
self.offTrack[index].finish() self.offTrack[index].finish()
self.offTrack[index] = None self.offTrack[index] = None
self.offTrack[index] = Sequence(LerpPosInterval(toon, TOON_EXIT_ELEVATOR_TIME, Point3(0, -ElevatorData[self.type]['collRadius'], 0), startPos=apply(Point3, self.getScaledPoint(index)), other=self.getElevatorModel()), animFunc, Func(self.notifyToonOffElevator, toon), name=toon.uniqueName('emptyElevator'), autoPause=1) self.offTrack[index] = Sequence(LerpPosInterval(toon, TOON_EXIT_ELEVATOR_TIME, Point3(0, -ElevatorData[self.type]['collRadius'], 0), startPos=Point3(*self.getScaledPoint(index)), other=self.getElevatorModel()), animFunc, Func(self.notifyToonOffElevator, toon), name=toon.uniqueName('emptyElevator'), autoPause=1)
if avId == base.localAvatar.getDoId(): if avId == base.localAvatar.getDoId():
messenger.send('exitElevator') messenger.send('exitElevator')
scale = base.localAvatar.getScale() scale = base.localAvatar.getScale()
@ -303,7 +303,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM):
def handleEnterSphere(self, collEntry): def handleEnterSphere(self, collEntry):
self.notify.debug('Entering Elevator Sphere....') self.notify.debug('Entering Elevator Sphere....')
print 'FSMhandleEnterSphere elevator%s avatar%s' % (self.elevatorTripId, localAvatar.lastElevatorLeft) print('FSMhandleEnterSphere elevator%s avatar%s' % (self.elevatorTripId, localAvatar.lastElevatorLeft))
if self.elevatorTripId and localAvatar.lastElevatorLeft == self.elevatorTripId: if self.elevatorTripId and localAvatar.lastElevatorLeft == self.elevatorTripId:
self.rejectBoard(base.localAvatar.doId, REJECT_SHUFFLE) self.rejectBoard(base.localAvatar.doId, REJECT_SHUFFLE)
elif base.localAvatar.hp > 0: elif base.localAvatar.hp > 0:
@ -312,7 +312,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM):
self.sendUpdate('requestBoard', []) self.sendUpdate('requestBoard', [])
def rejectBoard(self, avId, reason = 0): def rejectBoard(self, avId, reason = 0):
print 'rejectBoard %s' % reason print('rejectBoard %s' % reason)
if hasattr(base.localAvatar, 'elevatorNotifier'): if hasattr(base.localAvatar, 'elevatorNotifier'):
if reason == REJECT_SHUFFLE: if reason == REJECT_SHUFFLE:
base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorHoppedOff) base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorHoppedOff)
@ -378,7 +378,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM):
pass pass
def onDoorCloseFinish(self): def onDoorCloseFinish(self):
for avId in self.boardedAvIds.keys(): for avId in list(self.boardedAvIds.keys()):
av = self.cr.doId2do.get(avId) av = self.cr.doId2do.get(avId)
if av is not None: if av is not None:
if av.getParent().compareTo(self.getElevatorModel()) == 0: if av.getParent().compareTo(self.getElevatorModel()) == 0:

View file

@ -1,7 +1,7 @@
from otp.ai.AIBase import * from otp.ai.AIBase import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from ElevatorConstants import * from .ElevatorConstants import *
from direct.distributed import DistributedObjectAI from direct.distributed import DistributedObjectAI
from direct.task import Task from direct.task import Task
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
@ -210,7 +210,7 @@ class DistributedElevatorFSMAI(DistributedObjectAI.DistributedObjectAI, FSM):
self.accepting = 1 self.accepting = 1
def exitWaitCountdown(self): def exitWaitCountdown(self):
print 'exit wait countdown' print('exit wait countdown')
self.accepting = 0 self.accepting = 0
taskMgr.remove(self.uniqueName('countdown-timer')) taskMgr.remove(self.uniqueName('countdown-timer'))
self.newTrip() self.newTrip()
@ -232,7 +232,7 @@ class DistributedElevatorFSMAI(DistributedObjectAI.DistributedObjectAI, FSM):
def enterClosed(self): def enterClosed(self):
if hasattr(self, 'doId'): if hasattr(self, 'doId'):
print self.doId print(self.doId)
self.d_setState('Closed') self.d_setState('Closed')
def exitClosed(self): def exitClosed(self):
@ -242,7 +242,7 @@ class DistributedElevatorFSMAI(DistributedObjectAI.DistributedObjectAI, FSM):
for i in range(len(self.seats)): for i in range(len(self.seats)):
self.seats[i] = None self.seats[i] = None
print self.seats print(self.seats)
self.d_setState('WaitEmpty') self.d_setState('WaitEmpty')
self.accepting = 1 self.accepting = 1
return return

View file

@ -1,9 +1,9 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from ElevatorConstants import * from .ElevatorConstants import *
from ElevatorUtils import * from .ElevatorUtils import *
import DistributedElevatorFSM from . import DistributedElevatorFSM
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM from direct.fsm import ClassicFSM
@ -265,7 +265,7 @@ class DistributedElevatorFloor(DistributedElevatorFSM.DistributedElevatorFSM):
def kickEveryoneOut(self): def kickEveryoneOut(self):
bailFlag = 0 bailFlag = 0
for avId, slot in self.boardedAvIds.items(): for avId, slot in list(self.boardedAvIds.items()):
self.emptySlot(slot, avId, bailFlag, globalClockDelta.getRealNetworkTime()) self.emptySlot(slot, avId, bailFlag, globalClockDelta.getRealNetworkTime())
if avId == base.localAvatar.doId: if avId == base.localAvatar.doId:
pass pass

View file

@ -1,8 +1,8 @@
from otp.ai.AIBase import * from otp.ai.AIBase import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from ElevatorConstants import * from .ElevatorConstants import *
import DistributedElevatorFSMAI from . import DistributedElevatorFSMAI
from direct.task import Task from direct.task import Task
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.fsm.FSM import FSM from direct.fsm.FSM import FSM
@ -128,7 +128,7 @@ class DistributedElevatorFloorAI(DistributedElevatorFSMAI.DistributedElevatorFSM
for i in range(len(self.seats)): for i in range(len(self.seats)):
self.seats[i] = None self.seats[i] = None
print self.seats print(self.seats)
if self.wantState == 'closed': if self.wantState == 'closed':
self.demand('Closing') self.demand('Closing')
else: else:

View file

@ -1,9 +1,9 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from ElevatorConstants import * from .ElevatorConstants import *
from ElevatorUtils import * from .ElevatorUtils import *
import DistributedElevator from . import DistributedElevator
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM from direct.fsm import ClassicFSM

View file

@ -1,7 +1,7 @@
from otp.ai.AIBase import * from otp.ai.AIBase import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from ElevatorConstants import * from .ElevatorConstants import *
import copy, DistributedElevatorAI import copy, DistributedElevatorAI
from direct.fsm import ClassicFSM from direct.fsm import ClassicFSM
from direct.fsm import State from direct.fsm import State

View file

@ -5,7 +5,7 @@ from toontown.toonbase.ToontownGlobals import *
import random import random
from direct.distributed import DistributedObject from direct.distributed import DistributedObject
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import ToonInteriorColors from . import ToonInteriorColors
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
class DistributedGagshopInterior(DistributedObject.DistributedObject): class DistributedGagshopInterior(DistributedObject.DistributedObject):

View file

@ -6,8 +6,8 @@ import random
from direct.task.Task import Task from direct.task.Task import Task
from direct.distributed import DistributedObject from direct.distributed import DistributedObject
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import ToonInteriorColors from . import ToonInteriorColors
import cPickle import pickle
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
class DistributedHQInterior(DistributedObject.DistributedObject): class DistributedHQInterior(DistributedObject.DistributedObject):
@ -122,7 +122,7 @@ class DistributedHQInterior(DistributedObject.DistributedObject):
trophyStar) trophyStar)
def setLeaderBoard(self, leaderData): def setLeaderBoard(self, leaderData):
avIds, names, scores = cPickle.loads(leaderData) avIds, names, scores = pickle.loads(leaderData)
self.notify.debug('setLeaderBoard: avIds: %s, names: %s, scores: %s' % (avIds, names, scores)) self.notify.debug('setLeaderBoard: avIds: %s, names: %s, scores: %s' % (avIds, names, scores))
self.leaderAvIds = avIds self.leaderAvIds = avIds
self.leaderNames = names self.leaderNames = names

View file

@ -1,6 +1,6 @@
from direct.distributed import DistributedObjectAI from direct.distributed import DistributedObjectAI
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import cPickle import pickle
class DistributedHQInteriorAI(DistributedObjectAI.DistributedObjectAI): class DistributedHQInteriorAI(DistributedObjectAI.DistributedObjectAI):
@ -35,10 +35,10 @@ class DistributedHQInteriorAI(DistributedObjectAI.DistributedObjectAI):
def sendNewLeaderBoard(self): def sendNewLeaderBoard(self):
if self.air: if self.air:
self.isDirty = False self.isDirty = False
self.sendUpdate('setLeaderBoard', [cPickle.dumps(self.air.trophyMgr.getLeaderInfo(), 1)]) self.sendUpdate('setLeaderBoard', [pickle.dumps(self.air.trophyMgr.getLeaderInfo(), 1)])
def getLeaderBoard(self): def getLeaderBoard(self):
return cPickle.dumps(self.air.trophyMgr.getLeaderInfo(), 1) return pickle.dumps(self.air.trophyMgr.getLeaderInfo(), 1)
def getTutorial(self): def getTutorial(self):
return self.tutorial return self.tutorial

View file

@ -2,11 +2,11 @@ from pandac.PandaModules import *
from libotp import * from libotp import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from KnockKnockJokes import * from .KnockKnockJokes import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM from direct.fsm import ClassicFSM
import DistributedAnimatedProp from . import DistributedAnimatedProp
from toontown.distributed import DelayDelete from toontown.distributed import DelayDelete
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
@ -71,13 +71,13 @@ class DistributedKnockKnockDoor(DistributedAnimatedProp.DistributedAnimatedProp)
if self.propId == 44: if self.propId == 44:
joke = KnockKnockContestJokes[ToontownGlobals.SillyStreet] joke = KnockKnockContestJokes[ToontownGlobals.SillyStreet]
elif branch == ToontownGlobals.LoopyLane: elif branch == ToontownGlobals.LoopyLane:
if self.propId in KnockKnockContestJokes[ToontownGlobals.LoopyLane].keys(): if self.propId in list(KnockKnockContestJokes[ToontownGlobals.LoopyLane].keys()):
joke = KnockKnockContestJokes[ToontownGlobals.LoopyLane][self.propId] joke = KnockKnockContestJokes[ToontownGlobals.LoopyLane][self.propId]
elif branch == ToontownGlobals.PunchlinePlace: elif branch == ToontownGlobals.PunchlinePlace:
if self.propId == 1: if self.propId == 1:
joke = KnockKnockContestJokes[ToontownGlobals.PunchlinePlace] joke = KnockKnockContestJokes[ToontownGlobals.PunchlinePlace]
elif branch == ToontownGlobals.PolarPlace: elif branch == ToontownGlobals.PolarPlace:
if self.propId in KnockKnockContestJokes[ToontownGlobals.PolarPlace].keys(): if self.propId in list(KnockKnockContestJokes[ToontownGlobals.PolarPlace].keys()):
joke = KnockKnockContestJokes[ToontownGlobals.PolarPlace][self.propId] joke = KnockKnockContestJokes[ToontownGlobals.PolarPlace][self.propId]
self.nametag = None self.nametag = None
self.nametagNP = None self.nametagNP = None

View file

@ -2,7 +2,7 @@ from otp.ai.AIBaseGlobal import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM from direct.fsm import ClassicFSM
import DistributedAnimatedPropAI from . import DistributedAnimatedPropAI
from direct.task.Task import Task from direct.task.Task import Task
from direct.fsm import State from direct.fsm import State

View file

@ -6,7 +6,7 @@ import random
from direct.distributed import DistributedObject from direct.distributed import DistributedObject
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.actor import Actor from direct.actor import Actor
import ToonInteriorColors from . import ToonInteriorColors
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
class DistributedPetshopInterior(DistributedObject.DistributedObject): class DistributedPetshopInterior(DistributedObject.DistributedObject):

View file

@ -1,7 +1,7 @@
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from ElevatorConstants import * from .ElevatorConstants import *
import ElevatorUtils from . import ElevatorUtils
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.toonbase import ToontownBattleGlobals from toontown.toonbase import ToontownBattleGlobals
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
@ -142,13 +142,13 @@ class DistributedSuitInterior(DistributedObject.DistributedObject):
self.ignore(toon.uniqueName('disable')) self.ignore(toon.uniqueName('disable'))
def __finishInterval(self, name): def __finishInterval(self, name):
if self.activeIntervals.has_key(name): if name in self.activeIntervals:
interval = self.activeIntervals[name] interval = self.activeIntervals[name]
if interval.isPlaying(): if interval.isPlaying():
interval.finish() interval.finish()
def __cleanupIntervals(self): def __cleanupIntervals(self):
for interval in self.activeIntervals.values(): for interval in list(self.activeIntervals.values()):
interval.finish() interval.finish()
self.activeIntervals = {} self.activeIntervals = {}
@ -184,7 +184,7 @@ class DistributedSuitInterior(DistributedObject.DistributedObject):
self.toons = [] self.toons = []
for toonId in toonIds: for toonId in toonIds:
if toonId != 0: if toonId != 0:
if self.cr.doId2do.has_key(toonId): if toonId in self.cr.doId2do:
toon = self.cr.doId2do[toonId] toon = self.cr.doId2do[toonId]
toon.stopSmooth() toon.stopSmooth()
self.toons.append(toon) self.toons.append(toon)
@ -202,7 +202,7 @@ class DistributedSuitInterior(DistributedObject.DistributedObject):
self.suits = [] self.suits = []
self.joiningReserves = [] self.joiningReserves = []
for suitId in suitIds: for suitId in suitIds:
if self.cr.doId2do.has_key(suitId): if suitId in self.cr.doId2do:
suit = self.cr.doId2do[suitId] suit = self.cr.doId2do[suitId]
self.suits.append(suit) self.suits.append(suit)
suit.fsm.request('Battle') suit.fsm.request('Battle')
@ -216,7 +216,7 @@ class DistributedSuitInterior(DistributedObject.DistributedObject):
self.reserveSuits = [] self.reserveSuits = []
for index in range(len(reserveIds)): for index in range(len(reserveIds)):
suitId = reserveIds[index] suitId = reserveIds[index]
if self.cr.doId2do.has_key(suitId): if suitId in self.cr.doId2do:
suit = self.cr.doId2do[suitId] suit = self.cr.doId2do[suitId]
self.reserveSuits.append((suit, values[index])) self.reserveSuits.append((suit, values[index]))
else: else:

View file

@ -1,7 +1,7 @@
from toontown.toonbase.ToontownBattleGlobals import * from toontown.toonbase.ToontownBattleGlobals import *
from otp.ai.AIBaseGlobal import * from otp.ai.AIBaseGlobal import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from ElevatorConstants import * from .ElevatorConstants import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM, State from direct.fsm import ClassicFSM, State
from direct.distributed import DistributedObjectAI from direct.distributed import DistributedObjectAI
@ -97,7 +97,7 @@ class DistributedSuitInteriorAI(DistributedObjectAI.DistributedObjectAI):
return return
def __addToon(self, toonId): def __addToon(self, toonId):
if not self.air.doId2do.has_key(toonId): if toonId not in self.air.doId2do:
self.notify.warning('addToon() - no toon for doId: %d' % toonId) self.notify.warning('addToon() - no toon for doId: %d' % toonId)
return return
event = self.air.getAvatarExitEvent(toonId) event = self.air.getAvatarExitEvent(toonId)
@ -111,7 +111,7 @@ class DistributedSuitInteriorAI(DistributedObjectAI.DistributedObjectAI):
self.toons.remove(toonId) self.toons.remove(toonId)
if self.toonIds.count(toonId): if self.toonIds.count(toonId):
self.toonIds[self.toonIds.index(toonId)] = None self.toonIds[self.toonIds.index(toonId)] = None
if self.responses.has_key(toonId): if toonId in self.responses:
del self.responses[toonId] del self.responses[toonId]
event = self.air.getAvatarExitEvent(toonId) event = self.air.getAvatarExitEvent(toonId)
if self.avatarExitEvents.count(event): if self.avatarExitEvents.count(event):

View file

@ -4,8 +4,8 @@ from direct.interval.IntervalGlobal import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from direct.showbase import Audio3DManager from direct.showbase import Audio3DManager
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
import cPickle import pickle
from DistributedToonInterior import DistributedToonInterior from .DistributedToonInterior import DistributedToonInterior
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM, State from direct.fsm import ClassicFSM, State
from direct.distributed import DistributedObject from direct.distributed import DistributedObject
@ -13,7 +13,7 @@ from direct.fsm import State
from direct.actor import Actor from direct.actor import Actor
import random import random
import time import time
import ToonInteriorColors from . import ToonInteriorColors
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
from toontown.toon import ToonDNA from toontown.toon import ToonDNA
from toontown.toon import ToonHead from toontown.toon import ToonHead

View file

@ -1,4 +1,4 @@
from DistributedToonInteriorAI import * from .DistributedToonInteriorAI import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
class DistributedToonHallInteriorAI(DistributedToonInteriorAI): class DistributedToonHallInteriorAI(DistributedToonInteriorAI):

View file

@ -4,14 +4,14 @@ from libtoontown import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
import cPickle import pickle
import ToonInterior from . import ToonInterior
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM, State from direct.fsm import ClassicFSM, State
from direct.distributed import DistributedObject from direct.distributed import DistributedObject
from direct.fsm import State from direct.fsm import State
import random import random
import ToonInteriorColors from . import ToonInteriorColors
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
from toontown.toon import ToonDNA from toontown.toon import ToonDNA
from toontown.toon import ToonHead from toontown.toon import ToonHead
@ -138,7 +138,7 @@ class DistributedToonInterior(DistributedObject.DistributedObject):
self.block = block self.block = block
def setToonData(self, toonData): def setToonData(self, toonData):
savedBy = cPickle.loads(toonData) savedBy = pickle.loads(toonData)
self.savedBy = savedBy self.savedBy = savedBy
def buildTrophy(self): def buildTrophy(self):
@ -158,7 +158,7 @@ class DistributedToonInterior(DistributedObject.DistributedObject):
def buildFrame(self, name, dnaTuple): def buildFrame(self, name, dnaTuple):
frame = loader.loadModel('phase_3.5/models/modules/trophy_frame') frame = loader.loadModel('phase_3.5/models/modules/trophy_frame')
dna = ToonDNA.ToonDNA() dna = ToonDNA.ToonDNA()
apply(dna.newToonFromProperties, dnaTuple) dna.newToonFromProperties(*dnaTuple)
head = ToonHead.ToonHead() head = ToonHead.ToonHead()
head.setupHead(dna) head.setupHead(dna)
head.setPosHprScale(0, -0.05, -0.05, 180, 0, 0, 0.55, 0.02, 0.55) head.setPosHprScale(0, -0.05, -0.05, 180, 0, 0, 0.55, 0.02, 0.55)

View file

@ -1,7 +1,7 @@
from toontown.toonbase.ToontownGlobals import * from toontown.toonbase.ToontownGlobals import *
from otp.ai.AIBaseGlobal import * from otp.ai.AIBaseGlobal import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
import cPickle import pickle
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM, State from direct.fsm import ClassicFSM, State
from direct.distributed import DistributedObjectAI from direct.distributed import DistributedObjectAI
@ -39,7 +39,7 @@ class DistributedToonInteriorAI(DistributedObjectAI.DistributedObjectAI):
return r return r
def getToonData(self): def getToonData(self):
return cPickle.dumps(self.building.savedBy, 1) return pickle.dumps(self.building.savedBy, 1)
def getState(self): def getState(self):
r = [ r = [

View file

@ -3,11 +3,11 @@ from pandac.PandaModules import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
import ToonInterior from . import ToonInterior
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.distributed import DistributedObject from direct.distributed import DistributedObject
import random import random
import ToonInteriorColors from . import ToonInteriorColors
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
from toontown.char import Char from toontown.char import Char
from toontown.suit import SuitDNA from toontown.suit import SuitDNA
@ -123,7 +123,7 @@ class DistributedTutorialInterior(DistributedObject.DistributedObject):
del self.dnaStore del self.dnaStore
del self.randomGenerator del self.randomGenerator
self.interior.flattenMedium() self.interior.flattenMedium()
npcOrigin = self.interior.find('**/npc_origin_' + `(self.npc.posIndex)`) npcOrigin = self.interior.find('**/npc_origin_' + repr((self.npc.posIndex)))
if not npcOrigin.isEmpty(): if not npcOrigin.isEmpty():
self.npc.reparentTo(npcOrigin) self.npc.reparentTo(npcOrigin)
self.npc.clearMat() self.npc.clearMat()

View file

@ -1,6 +1,6 @@
import DistributedElevator from . import DistributedElevator
import DistributedBossElevator from . import DistributedBossElevator
from ElevatorConstants import * from .ElevatorConstants import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer

View file

@ -1,5 +1,5 @@
from ElevatorConstants import * from .ElevatorConstants import *
import DistributedBossElevatorAI from . import DistributedBossElevatorAI
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals

View file

@ -1,6 +1,6 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from ElevatorConstants import * from .ElevatorConstants import *
def getLeftClosePoint(type): def getLeftClosePoint(type):
width = ElevatorData[type]['width'] width = ElevatorData[type]['width']

View file

@ -1,6 +1,6 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import DistributedDoorAI, DistributedGagshopInteriorAI, FADoorCodes, DoorTypes from . import DistributedDoorAI, DistributedGagshopInteriorAI, FADoorCodes, DoorTypes
from toontown.toon import NPCToons from toontown.toon import NPCToons
from toontown.quest import Quests from toontown.quest import Quests

View file

@ -1,6 +1,6 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import DistributedDoorAI, DistributedHQInteriorAI, FADoorCodes, DoorTypes from . import DistributedDoorAI, DistributedHQInteriorAI, FADoorCodes, DoorTypes
from toontown.toon import NPCToons from toontown.toon import NPCToons
from toontown.quest import Quests from toontown.quest import Quests

View file

@ -1,6 +1,6 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
import DistributedDoorAI, DistributedPetshopInteriorAI, FADoorCodes, DoorTypes from . import DistributedDoorAI, DistributedPetshopInteriorAI, FADoorCodes, DoorTypes
from toontown.toon import NPCToons from toontown.toon import NPCToons
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.quest import Quests from toontown.quest import Quests

View file

@ -1,4 +1,4 @@
from ElevatorConstants import * from .ElevatorConstants import *
SuitBuildingInfo = (((1, 1), SuitBuildingInfo = (((1, 1),
(1, 3), (1, 3),
(4, 4), (4, 4),

View file

@ -8,7 +8,7 @@ from direct.fsm import ClassicFSM, State
from direct.fsm import State from direct.fsm import State
from toontown.town import TownBattle from toontown.town import TownBattle
from toontown.suit import Suit from toontown.suit import Suit
import Elevator from . import Elevator
from direct.task.Task import Task from direct.task.Task import Task
from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals

View file

@ -20,7 +20,7 @@ class SuitPlannerInteriorAI:
self.dbg_defaultSuitType = None self.dbg_defaultSuitType = None
else: else:
self.dbg_defaultSuitType = SuitDNA.getSuitType(dbg_defaultSuitName) self.dbg_defaultSuitType = SuitDNA.getSuitType(dbg_defaultSuitName)
if isinstance(bldgLevel, types.StringType): if isinstance(bldgLevel, bytes):
self.notify.warning('bldgLevel is a string!') self.notify.warning('bldgLevel is a string!')
bldgLevel = int(bldgLevel) bldgLevel = int(bldgLevel)
self._genSuitInfos(numFloors, bldgLevel, bldgTrack) self._genSuitInfos(numFloors, bldgLevel, bldgTrack)

View file

@ -130,7 +130,7 @@ class ToonInterior(Place.Place):
elif ds == 'incomplete': elif ds == 'incomplete':
self.fsm.request('DFAReject') self.fsm.request('DFAReject')
else: else:
self.notify.error('Unknown done status for DownloadForceAcknowledge: ' + `doneStatus`) self.notify.error('Unknown done status for DownloadForceAcknowledge: ' + repr(doneStatus))
def enterNPCFA(self, requestStatus): def enterNPCFA(self, requestStatus):
self.acceptOnce(self.npcfaDoneEvent, self.enterNPCFACallback, [requestStatus]) self.acceptOnce(self.npcfaDoneEvent, self.enterNPCFACallback, [requestStatus])
@ -151,7 +151,7 @@ class ToonInterior(Place.Place):
elif doneStatus['mode'] == 'incomplete': elif doneStatus['mode'] == 'incomplete':
self.fsm.request('NPCFAReject') self.fsm.request('NPCFAReject')
else: else:
self.notify.error('Unknown done status for NPCForceAcknowledge: ' + `doneStatus`) self.notify.error('Unknown done status for NPCForceAcknowledge: ' + repr(doneStatus))
def enterNPCFAReject(self): def enterNPCFAReject(self):
self.fsm.request('walk') self.fsm.request('walk')
@ -178,7 +178,7 @@ class ToonInterior(Place.Place):
elif doneStatus['mode'] == 'incomplete': elif doneStatus['mode'] == 'incomplete':
self.fsm.request('HFAReject') self.fsm.request('HFAReject')
else: else:
self.notify.error('Unknown done status for HealthForceAcknowledge: ' + `doneStatus`) self.notify.error('Unknown done status for HealthForceAcknowledge: ' + repr(doneStatus))
def enterHFAReject(self): def enterHFAReject(self):
self.fsm.request('walk') self.fsm.request('walk')

Some files were not shown because too many files have changed in this diff Show more