mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2025-01-09 17:53:50 +00:00
Deprecate has_key and fix bugs
This commit is contained in:
parent
7508de0d79
commit
568a076266
20 changed files with 30 additions and 30 deletions
|
@ -334,7 +334,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
|
|||
victorList.extend([None, None, None, None])
|
||||
for i in xrange(0, 4):
|
||||
victor = victorList[i]
|
||||
if victor == None or not self.air.doId2do.has_key(victor):
|
||||
if victor == None or not victor in self.air.doId2do:
|
||||
victorList[i] = 0
|
||||
continue
|
||||
event = self.air.getAvatarExitEvent(victor)
|
||||
|
|
|
@ -15,7 +15,7 @@ class AccountDateAI(DistributedObjectAI):
|
|||
return
|
||||
|
||||
def callback(dclass, fields):
|
||||
if dclass is not None and dclass == self.air.dclassesByName['AccountAI'] and fields.has_key('CREATED'):
|
||||
if dclass is not None and dclass == self.air.dclassesByName['AccountAI'] and 'CREATED' in fields:
|
||||
self.sendUpdateToAvatarId(avId, 'requestDateResult', [fields.get('CREATED')])
|
||||
else:
|
||||
self.sendUpdateToAvatarId(avId, 'requestDateResult', [None])
|
||||
|
|
|
@ -63,7 +63,7 @@ ClosetToClothes = {
|
|||
}
|
||||
ClothesToCloset = {}
|
||||
for closetId, maxClothes in ClosetToClothes.items():
|
||||
if not ClothesToCloset.has_key(maxClothes):
|
||||
if not maxClothes in ClothesToCloset:
|
||||
ClothesToCloset[maxClothes] = (closetId,)
|
||||
else:
|
||||
ClothesToCloset[maxClothes] += (closetId,)
|
||||
|
|
|
@ -50,7 +50,7 @@ class CatalogGardenItem(CatalogItem.CatalogItem):
|
|||
|
||||
def getPicture(self, avatar):
|
||||
photoModel = GardenGlobals.Specials[self.gardenIndex]['photoModel']
|
||||
if GardenGlobals.Specials[self.gardenIndex].has_key('photoAnimation'):
|
||||
if 'photoAnimation' in GardenGlobals.Specials[self.gardenIndex]:
|
||||
modelPath = photoModel + GardenGlobals.Specials[self.gardenIndex]['photoAnimation'][0]
|
||||
animationName = GardenGlobals.Specials[self.gardenIndex]['photoAnimation'][1]
|
||||
animationPath = photoModel + animationName
|
||||
|
@ -161,7 +161,7 @@ class CatalogGardenItem(CatalogItem.CatalogItem):
|
|||
result = False
|
||||
if canPlant < numBeansRequired:
|
||||
result = True
|
||||
if not result and GardenGlobals.Specials.has_key(self.gardenIndex) and GardenGlobals.Specials[self.gardenIndex].has_key('minSkill'):
|
||||
if not result and self.gardenIndex in GardenGlobals.Specials and 'minSkill' in GardenGlobals.Specials[self.gardenIndex]:
|
||||
minSkill = GardenGlobals.Specials[self.gardenIndex]['minSkill']
|
||||
if avatar.shovelSkill < minSkill:
|
||||
result = True
|
||||
|
|
|
@ -1738,7 +1738,7 @@ class CatalogGenerator:
|
|||
return
|
||||
|
||||
def __recordScheduleItem(self, sched, weekCode, maybeWeekCode, item):
|
||||
if not sched.has_key(item):
|
||||
if not item in sched:
|
||||
sched[item] = [[], []]
|
||||
if weekCode != None:
|
||||
sched[item][0].append(weekCode)
|
||||
|
|
|
@ -67,7 +67,7 @@ class CogdoCraneGame(DirectObject):
|
|||
self.players.remove(cPlayer)
|
||||
break
|
||||
|
||||
if self.toonId2Player.has_key(player.toon.doId):
|
||||
if player.toon.doId in self.toonId2Player:
|
||||
del self.toonId2Player[player.toon.doId]
|
||||
|
||||
def handleToonLeft(self, toonId):
|
||||
|
|
|
@ -161,11 +161,11 @@ class CogdoFlyingCameraManager:
|
|||
name = entry.getIntoNode().getName()
|
||||
if name.find('col_') >= 0:
|
||||
np = entry.getIntoNodePath().getParent()
|
||||
if not nodesInBetween.has_key(np):
|
||||
if not np in nodesInBetween:
|
||||
nodesInBetween[np] = np.getParent()
|
||||
|
||||
for np in nodesInBetween.keys():
|
||||
if self._betweenCamAndToon.has_key(np):
|
||||
if np in self._betweenCamAndToon:
|
||||
del self._betweenCamAndToon[np]
|
||||
else:
|
||||
np.setTransparency(True)
|
||||
|
|
|
@ -168,7 +168,7 @@ class CogdoFlyingLevel(DirectObject):
|
|||
self.endPlatform.onstage()
|
||||
|
||||
self._currentQuadNum = quadNum
|
||||
for i in xrange(0, max(self._currentQuadNum - self.quadVisibiltyBehind, 0)) + range(min(self._currentQuadNum + self.quadVisibiltyAhead + 1, self._numQuads), self._numQuads):
|
||||
for i in range(0, max(self._currentQuadNum - self.quadVisibiltyBehind, 0)) + range(min(self._currentQuadNum + self.quadVisibiltyAhead + 1, self._numQuads), self._numQuads):
|
||||
self.quadrants[i].offstage()
|
||||
if i == 0:
|
||||
self.startPlatform.offstage()
|
||||
|
|
|
@ -271,7 +271,7 @@ class CogdoMazeGame(DirectObject):
|
|||
self.players.remove(cPlayer)
|
||||
break
|
||||
|
||||
if self.toonId2Player.has_key(player.toon.doId):
|
||||
if player.toon.doId in self.toonId2Player:
|
||||
del self.toonId2Player[player.toon.doId]
|
||||
self.guiMgr.mazeMapGui.removeToon(player.toon)
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ class CogdoMazeSuit(MazeSuit, FSM, CogdoMazeSplattable):
|
|||
MazeSuit.__init__(self, serialNum, maze, randomNumGen, data['cellWalkPeriod'], difficulty, data['dnaName'], startTile=startTile, walkSameDirectionProb=Globals.SuitWalkSameDirectionProb, walkTurnAroundProb=Globals.SuitWalkTurnAroundProb, uniqueRandomNumGen=False, walkAnimName=walkAnimName)
|
||||
FSM.__init__(self, 'CogdoMazeSuit')
|
||||
CogdoMazeSplattable.__init__(self, self.suit, '%s-%i' % (Globals.SuitCollisionName, self.serialNum), 1.5)
|
||||
if data.has_key('scale'):
|
||||
if 'scale' in data:
|
||||
self.suit.setScale(data['scale'])
|
||||
self.hp = data['hp']
|
||||
self.type = cogdoSuitType
|
||||
|
|
|
@ -72,7 +72,7 @@ class DistCogdoGame(DistCogdoGameBase, DistributedObject):
|
|||
return
|
||||
|
||||
def getToon(self, toonId):
|
||||
if self.cr.doId2do.has_key(toonId):
|
||||
if toonId in self.cr.doId2do:
|
||||
return self.cr.doId2do[toonId]
|
||||
else:
|
||||
return None
|
||||
|
|
|
@ -266,7 +266,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
|
|||
self.ignore(toon.uniqueName('disable'))
|
||||
|
||||
def __finishInterval(self, name):
|
||||
if self.activeIntervals.has_key(name):
|
||||
if name in self.activeIntervals:
|
||||
interval = self.activeIntervals[name]
|
||||
if interval.isPlaying():
|
||||
interval.finish()
|
||||
|
@ -315,7 +315,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
|
|||
self.toons = []
|
||||
for toonId in toonIds:
|
||||
if toonId != 0:
|
||||
if self.cr.doId2do.has_key(toonId):
|
||||
if toonId in self.cr.doId2do:
|
||||
toon = self.cr.doId2do[toonId]
|
||||
toon.stopSmooth()
|
||||
self.toons.append(toon)
|
||||
|
@ -333,7 +333,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
|
|||
self.suits = []
|
||||
self.joiningReserves = []
|
||||
for suitId in suitIds:
|
||||
if self.cr.doId2do.has_key(suitId):
|
||||
if suitId in self.cr.doId2do:
|
||||
suit = self.cr.doId2do[suitId]
|
||||
self.suits.append(suit)
|
||||
suit.fsm.request('Battle')
|
||||
|
@ -353,7 +353,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
|
|||
self.reserveSuits = []
|
||||
for index in xrange(len(reserveIds)):
|
||||
suitId = reserveIds[index]
|
||||
if self.cr.doId2do.has_key(suitId):
|
||||
if suitId in self.cr.doId2do:
|
||||
suit = self.cr.doId2do[suitId]
|
||||
self.reserveSuits.append((suit, values[index]))
|
||||
else:
|
||||
|
|
|
@ -198,7 +198,7 @@ class DistributedCogdoInteriorAI(DistributedObjectAI, FSM.FSM):
|
|||
if not avId in self.toons:
|
||||
self.toons.append(avId)
|
||||
|
||||
if self.air.doId2do.has_key(avId):
|
||||
if avId in self.air.doId2do:
|
||||
event = self.air.getAvatarExitEvent(avId)
|
||||
self.accept(event, self.__handleUnexpectedExit, [avId])
|
||||
|
||||
|
|
|
@ -403,19 +403,19 @@ class DistributedBanquetTable(DistributedObject.DistributedObject, FSM.FSM, Banq
|
|||
self.activeIntervals = {}
|
||||
|
||||
def clearInterval(self, name, finish = 1):
|
||||
if self.activeIntervals.has_key(name):
|
||||
if name in self.activeIntervals:
|
||||
ival = self.activeIntervals[name]
|
||||
if finish:
|
||||
ival.finish()
|
||||
else:
|
||||
ival.pause()
|
||||
if self.activeIntervals.has_key(name):
|
||||
if name in self.activeIntervals:
|
||||
del self.activeIntervals[name]
|
||||
else:
|
||||
self.notify.debug('interval: %s already cleared' % name)
|
||||
|
||||
def finishInterval(self, name):
|
||||
if self.activeIntervals.has_key(name):
|
||||
if name in self.activeIntervals:
|
||||
interval = self.activeIntervals[name]
|
||||
interval.finish()
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ class DistributedCannon(DistributedObject.DistributedObject):
|
|||
self.curPinballScore = 0
|
||||
self.curPinballMultiplier = 1
|
||||
self.incrementPinballInfo(0, 0)
|
||||
if self.cr.doId2do.has_key(self.avId):
|
||||
if self.avId in self.cr.doId2do:
|
||||
self.av = self.cr.doId2do[self.avId]
|
||||
self.acceptOnce(self.av.uniqueName('disable'), self.__avatarGone)
|
||||
self.av.stopSmooth()
|
||||
|
|
|
@ -241,7 +241,7 @@ def getBodyRarity(bodyIndex):
|
|||
for zoneId in PetRarities['body']:
|
||||
for body in PetRarities['body'][zoneId]:
|
||||
totalWeight += PetRarities['body'][zoneId][body]
|
||||
if weight.has_key(body):
|
||||
if body in weight:
|
||||
weight[body] += PetRarities['body'][zoneId][body]
|
||||
else:
|
||||
weight[body] = PetRarities['body'][zoneId][body]
|
||||
|
|
|
@ -258,7 +258,7 @@ class PhotoAlbumPage(ShtikerPage.ShtikerPage):
|
|||
del self.photos[photo]
|
||||
|
||||
for photo in newPhotos:
|
||||
if not self.photos.has_key(photo):
|
||||
if not photo in self.photos:
|
||||
photoButton = self.makePhotoButton(photo)
|
||||
self.scrollList.addItem(photoButton)
|
||||
self.photos[photo] = photoButton
|
||||
|
|
|
@ -563,7 +563,7 @@ class SuitPlannerBase:
|
|||
self.notify.warning('interactive prop %s at %s not associated with a a battle' % (childDnaGroup, zoneId))
|
||||
|
||||
elif battleCellId == 0:
|
||||
if self.cellToGagBonusDict.has_key(zoneId):
|
||||
if zoneId in self.cellToGagBonusDict:
|
||||
self.notify.error('FIXME battle cell at zone %s has two props %s %s linked to it' % (zoneId, self.cellToGagBonusDict[zoneId], childDnaGroup))
|
||||
else:
|
||||
name = childDnaGroup.getName()
|
||||
|
|
|
@ -21,7 +21,7 @@ class DistributedNPCPetclerkAI(DistributedNPCToonBaseAI):
|
|||
|
||||
def avatarEnter(self):
|
||||
avId = self.air.getAvatarIdFromSender()
|
||||
if not self.air.doId2do.has_key(avId):
|
||||
if not avId in self.air.doId2do:
|
||||
self.notify.warning('Avatar: %s not found' % avId)
|
||||
return
|
||||
if self.isBusy():
|
||||
|
|
|
@ -635,11 +635,11 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
|
|||
tossTrack = self.tossTrack
|
||||
self.tossTrack = None
|
||||
tossTrack.finish()
|
||||
if self.pieTracks.has_key(sequence):
|
||||
if sequence in self.pieTracks:
|
||||
pieTrack = self.pieTracks[sequence]
|
||||
del self.pieTracks[sequence]
|
||||
pieTrack.finish()
|
||||
if self.splatTracks.has_key(sequence):
|
||||
if sequence in self.splatTracks:
|
||||
splatTrack = self.splatTracks[sequence]
|
||||
del self.splatTracks[sequence]
|
||||
splatTrack.finish()
|
||||
|
@ -679,7 +679,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
|
|||
self.__piePowerMeter.hide()
|
||||
|
||||
def __finishPieTrack(self, sequence):
|
||||
if self.pieTracks.has_key(sequence):
|
||||
if sequence in self.pieTracks:
|
||||
pieTrack = self.pieTracks[sequence]
|
||||
del self.pieTracks[sequence]
|
||||
pieTrack.finish()
|
||||
|
@ -691,7 +691,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
|
|||
return
|
||||
sequence = int(entry.getFromNodePath().getNetTag('pieSequence'))
|
||||
self.__finishPieTrack(sequence)
|
||||
if self.splatTracks.has_key(sequence):
|
||||
if sequence in self.splatTracks:
|
||||
splatTrack = self.splatTracks[sequence]
|
||||
del self.splatTracks[sequence]
|
||||
splatTrack.finish()
|
||||
|
|
Loading…
Reference in a new issue