Revert "Spring cleaning"

This reverts commit 1e4bad8c6b.
This commit is contained in:
John 2015-06-16 20:26:44 +03:00
parent 1e4bad8c6b
commit 35b646c4e6
279 changed files with 1050 additions and 967 deletions

View file

@ -32,3 +32,7 @@ print 'Encrypted string:', encoded
# decode the encoded string
decoded = DecodeAES(cipher, encoded)
print 'Decrypted string:', decoded

View file

@ -29,50 +29,50 @@ def generate_token(accessLevel):
random.seed()
while True:
try:
res = client.ping(generate_token(700), 12345)
if res != 12345:
print "Is the server accessable?\n"
exit
# How many times a day is this script going to be called?
ChecksPerDay = 60.0*24.0 # Once a minute
InvasionsPerDay = 72.0 # How many invasions a day per district
BaseInvasionChance = InvasionsPerDay/ChecksPerDay
safeHarbor = {'Wacky Falls'}
superDistricts = {'Nuttyboro'}
while True:
shards = client.listShards(generate_token(700))
print shards
count = 0
for skey in shards:
shard = shards[skey]
if shard['invasion'] != None:
count = count + 1
for skey in shards:
shard = shards[skey]
if shard['invasion'] == None:
if shard['name'] in superDistricts:
typ = int(float(random.random()) * 4.0)
suit = int(float(random.random()) * 4.0) + 4 # Bias the cogs to be big
client.startInvasion(generate_token(700), int(skey), typ, suit, 0, 0)
count = count + 1
print 'Calling invasion for %s with %d,%d'%(shard['name'],typ,suit)
if count < 3:
for skey in shards:
shard = shards[skey]
if shard['invasion'] == None and not shard['name'] in safeHarbor:
r = random.random()
if r < BaseInvasionChance and not shard['name'] in superDistricts:
typ = int(float(random.random()) * 4.0)
suit = int(float(random.random()) * 8.0)
client.startInvasion(generate_token(700), int(skey), typ, suit, 0, 0)
print 'Calling invasion for %s with %d,%d'%(shard['name'],typ,suit)
print "tick..(was %d)\n"%(count)
time.sleep(60)
except Exception, e:
print e
time.sleep(300)
try:
res = client.ping(generate_token(700), 12345)
if res != 12345:
print "Is the server accessable?\n"
exit
# How many times a day is this script going to be called?
ChecksPerDay = 60.0*24.0 # Once a minute
InvasionsPerDay = 72.0 # How many invasions a day per district
BaseInvasionChance = InvasionsPerDay/ChecksPerDay
safeHarbor = {'Wacky Falls'}
superDistricts = {'Nuttyboro'}
while True:
shards = client.listShards(generate_token(700))
print shards
count = 0
for skey in shards:
shard = shards[skey]
if shard['invasion'] != None:
count = count + 1
for skey in shards:
shard = shards[skey]
if shard['invasion'] == None:
if shard['name'] in superDistricts:
typ = int(float(random.random()) * 4.0)
suit = int(float(random.random()) * 4.0) + 4 # Bias the cogs to be big
client.startInvasion(generate_token(700), int(skey), typ, suit, 0, 0)
count = count + 1
print 'Calling invasion for %s with %d,%d'%(shard['name'],typ,suit)
if count < 3:
for skey in shards:
shard = shards[skey]
if shard['invasion'] == None and not shard['name'] in safeHarbor:
r = random.random()
if r < BaseInvasionChance and not shard['name'] in superDistricts:
typ = int(float(random.random()) * 4.0)
suit = int(float(random.random()) * 8.0)
client.startInvasion(generate_token(700), int(skey), typ, suit, 0, 0)
print 'Calling invasion for %s with %d,%d'%(shard['name'],typ,suit)
print "tick..(was %d)\n"%(count)
time.sleep(60)
except Exception, e:
print e
time.sleep(300)

View file

@ -14,7 +14,7 @@ class MagicWordManagerAI(DistributedObjectAI):
if not 'DistributedToonAI' in str(self.air.doId2do.get(targetId)):
self.sendUpdateToAvatarId(invokerId, 'sendMagicWordResponse', ['Target is not a toon object!'])
return
if not invoker:
self.sendUpdateToAvatarId(invokerId, 'sendMagicWordResponse', ['missing invoker'])
return
@ -56,20 +56,21 @@ def help(wordName=None):
return 'Did you mean %s' % (spellbook.words.get(key).name)
return 'I have no clue what %s is referring to' % (wordName)
return word.doc
@magicWord(category=CATEGORY_COMMUNITY_MANAGER, types=[])
def words():
accessLevel = spellbook.getInvoker().getAdminAccess()
wordString = None
for key in spellbook.words:
word = spellbook.words.get(key)
if word.access <= accessLevel:
if wordString is None:
wordString = key
else:
wordString += ", ";
wordString += key;
word = spellbook.words.get(key)
if word.access <= accessLevel:
if wordString is None:
wordString = key
else:
wordString += ", ";
wordString += key;
if wordString is None:
return "You are chopped liver"
else:
return wordString

View file

@ -125,4 +125,4 @@ class TimeManager(DistributedObject.DistributedObject):
info = PythonUtil.describeException()
self.notify.info('Client exception: %s' % info)
self.sendUpdate('setExceptionInfo', [info])
self.cr.flush()
self.cr.flush()

View file

@ -10,13 +10,13 @@ class TimeManagerAI(DistributedObjectAI):
def __init__(self, air):
DistributedObjectAI.__init__(self, air)
self.avId2DcReason = {}
def requestServerTime(self, context):
self.sendUpdateToAvatarId(self.air.getAvatarIdFromSender(), 'serverTime', [context, globalClockDelta.getRealNetworkTime(bits=32), int(time.time())])
def setDisconnectReason(self, reason):
avId = self.air.getAvatarIdFromSender()
if reason == OTPGlobals.DisconnectNone and avId in self.avId2DcReason:
del self.avId2DcReason[avId]
else:
@ -25,6 +25,6 @@ class TimeManagerAI(DistributedObjectAI):
def setExceptionInfo(self, exception):
avId = self.air.getAvatarIdFromSender()
self.air.writeServerEvent('client-exception', avId, exception)
def getDisconnectReason(self, avId):
return self.avId2DcReason.get(avId, 0)
return self.avId2DcReason.get(avId, 0)

View file

@ -12,4 +12,4 @@ class AvatarHandle:
def setTalkWhisper(self, fromAV, fromAC, avatarName, chat, mods, flags):
newText, scrubbed = localAvatar.scrubTalk(chat, mods)
base.talkAssistant.receiveWhisperTalk(fromAV, avatarName, fromAC, None, self.avatarId, self.getName(), newText, scrubbed)
base.talkAssistant.receiveWhisperTalk(fromAV, avatarName, fromAC, None, self.avatarId, self.getName(), newText, scrubbed)

View file

@ -15,3 +15,4 @@ class DistributedAvatarUD(DistributedObjectUD):
def confirmAvOnShard(self, todo0, todo1):
pass

View file

@ -306,7 +306,7 @@ class DistributedPlayer(DistributedAvatar.DistributedAvatar, PlayerBase.PlayerBa
def teleportQuery(self, requesterId):
avatar = base.cr.identifyFriend(requesterId)
if avatar is None:
self.d_teleportResponse(self.doId, 0, 0, 0, 0, sendToId=requesterId)
elif base.localAvatar.isIgnored(requesterId):
@ -319,7 +319,7 @@ class DistributedPlayer(DistributedAvatar.DistributedAvatar, PlayerBase.PlayerBa
else:
if self.failedTeleportMessageOk(requesterId):
self.setSystemMessage(requesterId, OTPLocalizer.WhisperFailedVisit % avatar.getName())
self.d_teleportResponse(self.doId, 0, 0, 0, 0, sendToId=requesterId)
def failedTeleportMessageOk(self, fromId):

View file

@ -1150,7 +1150,7 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
def clickedWhisper(self, doId):
friend = base.cr.identifyFriend(doId)
if friend != None:
messenger.send('clickedNametag', [friend])
self.chatMgr.whisperTo(friend.getName(), doId)

View file

@ -125,4 +125,4 @@ class ShadowCaster:
def __globalDropShadowGrayLevelChanged(self):
if self.dropShadow != None:
self.dropShadow.setColor(0.0, 0.0, 0.0, globalDropShadowGrayLevel, 1)
self.dropShadow.setColor(0.0, 0.0, 0.0, globalDropShadowGrayLevel, 1)

View file

@ -52,3 +52,4 @@ def chatmode(mode=-1):
return "Chat mode 1 is reserved for moderators."
base.cr.chatAgent.chatMode = mode
return "You are now talking in the %s chat mode." % mode2name.get(mode, "N/A")

View file

@ -12,4 +12,4 @@ class ChatAgentAI:
pass
def setWhiteList(self, todo0):
pass
pass

View file

@ -134,3 +134,6 @@ class ChatAgentUD(DistributedObjectGlobalUD):
offset += len(word) + 1
return modifications

View file

@ -296,4 +296,4 @@ class ChatManager(DirectObject.DirectObject):
pass
def exitOtherDialog(self):
pass
pass

View file

@ -275,7 +275,7 @@ pose:eh
pound:ed,ing,me,myself,her,herself,him,himself,of,off,ourselves,they,themselves,us,you,yourself
pounds:ed,ing,me,myself,her,herself,him,himself,of,off,ourselves,they,themselves,us,you,yourself
pour:on,no
pro:st i tut,stick tut
pro:st i tut,stick tut
purr:cee,say,says,sea,seas,see,sees,she,shes,she's,si
push:y,ye,cee,say,says,sea,seas,see,sees,she,shes,she's,si
put:cee,say,says,sea,seas,see,sees,she,shes,she's,si

View file

@ -147,7 +147,7 @@ class TalkAssistant(DirectObject.DirectObject):
def findAvatarName(self, id):
info = base.cr.identifyAvatar(id)
return info.getName() if info else ''
def whiteListFilterMessage(self, text):
@ -457,4 +457,4 @@ class TalkAssistant(DirectObject.DirectObject):
self.historyComplete.append(newMessage)
self.addToHistoryDoId(newMessage, localAvatar.doId)
messenger.send('NewOpenMessage', [newMessage])
return error
return error

View file

@ -37,4 +37,4 @@ class WhiteList:
while j < self.numWords and self.words[j].startswith(text):
j += 1
return self.words[i:j]
return self.words[i:j]

View file

@ -3,3 +3,4 @@ from direct.distributed.DistributedObjectAI import DistributedObjectAI
class AccountAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("AccountAI")

View file

@ -3,3 +3,4 @@ from direct.distributed.DistributedObjectUD import DistributedObjectUD
class AccountUD(DistributedObjectUD):
notify = DirectNotifyGlobal.directNotify.newCategory("AccountUD")

View file

@ -2,4 +2,4 @@ from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedDirectoryAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedDirectoryAI")
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedDirectoryAI")

View file

@ -9,3 +9,4 @@ class DistributedDistrictUD(DistributedObjectUD):
def setAvailable(self, todo0):
pass

View file

@ -110,4 +110,4 @@ class FriendManagerAI(DistributedObjectAI):
pass
def inviteeCancelFriendQuery(self, todo0):
pass
pass

View file

@ -30,4 +30,4 @@ class AmbientSound(BasicEntities.NodePathEntity):
self.soundIval.pause()
del self.soundIval
if hasattr(self, 'sound'):
del self.sound
del self.sound

View file

@ -31,4 +31,4 @@ class CollisionSolidEntity(BasicEntities.NodePathEntity):
if self.collNodePath is not None:
self.collNodePath.removeNode()
self.collNodePath = None
return
return

View file

@ -34,4 +34,4 @@ class DistributedEntityAI(DistributedObjectAI.DistributedObjectAI, Entity.Entity
return self.levelDoId
def getEntId(self):
return self.entId
return self.entId

View file

@ -21,3 +21,4 @@ class DistributedInteractiveEntityAI(DistributedEntityAI):
def setState(self, todo0, todo1):
pass

View file

@ -95,4 +95,4 @@ class DistributedLevelAI(DistributedObjectAI.DistributedObjectAI, Level.Level):
av.takeDamage(penalty)
if av.getHp() <= 0:
av.inventory.zeroInv()
av.d_setInventory(av.inventory.makeNetString())
av.d_setInventory(av.inventory.makeNetString())

View file

@ -84,4 +84,4 @@ class Entity(DirectObject):
return
def setAttribInit(self, attrib, value):
self.__dict__[attrib] = value
self.__dict__[attrib] = value

View file

@ -30,4 +30,4 @@ class EntrancePoint(BasicEntities.NodePathEntity):
def destroyEntrancePoint(self):
if self.entranceId >= 0:
if self.entranceId in self.level.entranceId2entity:
del self.level.entranceId2entity[self.entranceId]
del self.level.entranceId2entity[self.entranceId]

View file

@ -216,4 +216,4 @@ class Level:
self.createdEntIds.remove(entId)
def handleVisChange(self):
pass
pass

View file

@ -1,4 +1,4 @@
MinZoneNum = 0
MaxZoneNum = 999
UberZoneEntId = 0
LevelMgrEntId = 1000
LevelMgrEntId = 1000

View file

@ -30,4 +30,4 @@ class LevelMgrAI(LevelMgrBase.LevelMgrBase):
zoneNums.sort()
self.level.zoneIds = []
for zoneNum in zoneNums:
self.level.zoneIds.append(self.level.zoneNum2zoneId[zoneNum])
self.level.zoneIds.append(self.level.zoneNum2zoneId[zoneNum])

View file

@ -25,4 +25,4 @@ class LocatorEntity(Entity.Entity, NodePath):
LocatorEntity.notify.warning("could not find '%s'" % self.searchPath)
self.reparentTo(hidden)
else:
self.reparentTo(parent)
self.reparentTo(parent)

View file

@ -42,4 +42,4 @@ class PathEntity(BasicEntities.NodePathEntity):
duration = distance / velocity
track.append(LerpPosInterval(node, duration=duration, pos=endPoint, startPos=startPoint))
return track
return track

View file

@ -49,4 +49,4 @@ class PropSpinner(Entity):
def destroyProps(self):
if hasattr(self, 'spinTracks'):
self.spinTracks.pause()
del self.spinTracks
del self.spinTracks

View file

@ -41,4 +41,4 @@ class VisibilityExtender(Entity.Entity):
def destroy(self):
self.destroyVisExt()
Entity.Entity.destroy(self)
Entity.Entity.destroy(self)

View file

@ -31,4 +31,4 @@ class ZoneEntity(ZoneEntityBase.ZoneEntityBase, BasicEntities.NodePathAttribs):
for zoneNum in zoneNumList:
self.visibleZoneNums[zoneNum] -= 1
if self.visibleZoneNums[zoneNum] == 0:
del self.visibleZoneNums[zoneNum]
del self.visibleZoneNums[zoneNum]

View file

@ -1,8 +1,9 @@
from pandac.PandaModules import *
class CMover:
def __init__(self, objNodePath, fwdSpeed=1, rotSpeed=1):
self.objNodePath = objNodePath
self.fwdSpeed = fwdSpeed
self.rotSpeed = rotSpeed

View file

@ -276,4 +276,4 @@ def backgroundColor(r=None, g=1, b=1, a=1):
if r is None:
r, g, b, a = OTPGlobals.DefaultBackgroundColor
base.setBackgroundColor(Vec4(r, g, b, a))
return 'The background color has been changed.'
return 'The background color has been changed.'

View file

@ -306,4 +306,4 @@ ChatFeedback_Whitelist = 64
ChatFeedback_OpenChat = 128
AvatarPendingCreate = -1
AvatarSlotUnavailable = -2
AvatarSlotAvailable = -3
AvatarSlotAvailable = -3

View file

@ -37,7 +37,7 @@ class HalloweenHolidayDecorator(HolidayDecorator.HolidayDecorator):
base.cr.playGame.getPlace().loader.hood.loader and
hasattr(base.cr.playGame.getPlace().loader.hood.loader, 'geom') and
base.cr.playGame.getPlace().loader.hood.loader.geom):
return True
return True
else:
if hasattr(base.cr.playGame, 'getPlace') and base.cr.playGame.getPlace():
self.notify.debug('Failed Hood Check %s' % base.cr.playGame.getPlace())

View file

@ -515,11 +515,11 @@ class NewsManager(DistributedObject.DistributedObject):
base.localAvatar.setSystemMessage(0, TTLocalizer.LaughingManHolidayStart)
for currToon in base.cr.toons.values():
currToon.generateLaughingMan()
def setLaughingManHolidayEnd(self):
for currToon in base.cr.toons.values():
currToon.swapToonHead(laughingMan=currToon.getWantLaughingMan())
def setTopToonsMarathonStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.TopToonsMarathonStart)
@ -714,7 +714,7 @@ def getHoliday(id):
return int(id)
elif hasattr(ToontownGlobals, id):
return getattr(ToontownGlobals, id)
return -1
@magicWord(category=CATEGORY_PROGRAMMER, types=[str])

View file

@ -98,7 +98,7 @@ class BattleCalculatorAI:
debug = self.notify.getDebug()
attack = self.battle.toonAttacks[attackIndex]
atkTrack, atkLevel = self.__getActualTrackLevel(attack)
hasAccuracyBuff = False
toon = simbase.air.doId2do.get(attack[TOON_ID_COL])
if toon:
@ -106,7 +106,7 @@ class BattleCalculatorAI:
if not ZoneUtil.isDynamicZone(toon.zoneId):
if ZoneUtil.getWhereName(toon.zoneId, True) in ('street', 'factoryExterior', 'cogHQExterior'):
hasAccuracyBuff = True
if atkTrack == NPCSOS:
return (1, 95)
if atkTrack == FIRE:
@ -519,7 +519,7 @@ class BattleCalculatorAI:
suit = self.battle.findSuit(targetId)
if suit:
slips = toon.getPinkSlips()
if slips < 1:
simbase.air.writeServerEvent('suspicious', toonId, 'Toon attempting to fire a cog without any pinkslips')
else:

View file

@ -38,4 +38,4 @@ class BattleManagerAI:
cellId = battle.battleCellId
self.notify.debug('BattleManager - destroying battle %d' % cellId)
del self.cellId2battle[cellId]
battle.requestDelete()
battle.requestDelete()

View file

@ -146,4 +146,4 @@ def __makeShiftLift():
particles.emitter.setRadius(0.01)
effect.setHpr(0, 180, 0)
effect.setPos(0, 0, 0)
return effect
return effect

View file

@ -43,4 +43,4 @@ class BattleSounds:
return self.mgr.getSound(filename.getFullpath())
return self.mgr.getNullSound()
globalBattleSoundCache = BattleSounds()
globalBattleSoundCache = BattleSounds()

View file

@ -124,4 +124,4 @@ class DistributedBattleAI(DistributedBattleBaseAI.DistributedBattleBaseAI):
DistributedBattleBaseAI.DistributedBattleBaseAI.enterResume(self)
if self.finishCallback:
self.finishCallback(self.zoneId)
self.battleMgr.destroy(self)
self.battleMgr.destroy(self)

View file

@ -311,9 +311,9 @@ class Movie(DirectObject.DirectObject):
elif tutTrack >= len(earnedXp):
self.playTutorialReward_2()
return
xp = earnedXp[tutTrack]
if xp > 0:
self.tutRewardDialog = TTDialog.TTDialog(text=TTLocalizer.MovieTutorialReward1 % (xp, TTLocalizer.BattleGlobalTracks[tutTrack].capitalize()), command=self.playTutorialReward_1, extraArgs=[earnedXp, tutTrack + 1], style=TTDialog.Acknowledge, fadeScreen=None, pos=(0.65, 0, 0.5), scale=0.8)
sequence = Sequence()
@ -321,7 +321,7 @@ class Movie(DirectObject.DirectObject):
sequence.start()
else:
self.playTutorialReward_1(None, earnedXp, tutTrack + 1)
def playTutorialReward_2(self, value=None):
from toontown.toon import Toon
from toontown.toon import ToonDNA

View file

@ -342,4 +342,4 @@ ActorInterval(kapow, 'kapow'), Func(kapow.hide)), LerpPosInterval(suit, 3.0, Poi
return [toonTrack,
soundTrack,
buttonTrack,
suitResponseTrack]
suitResponseTrack]

View file

@ -745,4 +745,4 @@ squirtfn_array = (__doFlower,
__doSeltzerBottle,
__doFireHose,
__doStormCloud,
__doGeyser)
__doGeyser)

View file

@ -4902,3 +4902,5 @@ def bossCogFrontAttack(self):
force0.setActive(1)
f0.addForce(force0)
self.addForceGroup(f0)

View file

@ -96,7 +96,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
# to merge groups.
# mergeDict - This is a link that points back to the original
# invitee before we mapped it to the leader of the other group.
def requestInvite(self, inviteeId):
self.notify.debug('requestInvite %s' % inviteeId)
inviterId = self.air.getAvatarIdFromSender()
@ -167,7 +167,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
reason = BoardingPartyBase.BOARDCODE_PROMOTION
self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviterId, reason, self.elevatorIdList[0]])
return
# Is the inviter already in the avIdDict? It follows they either must be in a group or have a pending invite...
# Is the inviter already in the avIdDict? It follows they either must be in a group or have a pending invite...
if inviterId in self.avIdDict:
self.notify.debug('old group')
# Everything is indexed by the leaders
@ -184,7 +184,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
if len(self.getGroupMemberList(leaderId)) >= self.maxSize:
self.sendUpdate('postSizeReject', [leaderId, inviterId, inviteeId])
elif merger:
# We cannot muck with the avIdDict because they are pointing to their original groups.
# We cannot muck with the avIdDict because they are pointing to their original groups.
# We shall stash away the info into a different
# dictionary.. This way, if something goes wrong,
# the original groups with their original data
@ -195,12 +195,12 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
self.mergeDict[inviteeId] = originalInviteeId
self.sendUpdateToAvatarId(inviteeId, 'postInvite', [leaderId, inviterId, True])
# notify everybody in the inviters group of the
# invitation..
# invitation..
for memberId in groupList[0]:
if not memberId == inviterId:
self.sendUpdateToAvatarId(memberId, 'postMessageInvited', [inviteeId, inviterId])
elif inviterId not in groupList[1] and inviterId not in groupList[2]:
# If the invitee isn't already in the group, add them..
# If the invitee isn't already in the group, add them..
if inviteeId not in groupList[1]:
groupList[1].append(inviteeId)
self.groupListDict[leaderId] = groupList
@ -213,7 +213,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
for memberId in groupList[0]:
if not memberId == inviterId:
self.sendUpdateToAvatarId(memberId, 'postMessageInvited', [inviteeId, inviterId])
# The inviter was kicked.. so, we cannot let them back in since they are not the leader...
# The inviter was kicked.. so, we cannot let them back in since they are not the leader...
elif inviterId in groupList[2]:
self.sendUpdate('postKickReject', [leaderId, inviterId, inviteeId])
else:

View file

@ -144,9 +144,9 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
print 'Building %s (%s): cogdoTakeOver' % (self.doId, self.zoneId)
if not self.isToonBlock():
return None
self.updateSavedBy(None)
self.track = track
self.realTrack = track
self.difficulty = difficulty
@ -321,21 +321,21 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
toon = None
if t:
toon = self.getToon(t)
if toon != None:
activeToons.append(toon)
continue
for t in victorList:
toon = None
if t:
toon = self.getToon(t)
self.air.writeServerEvent('buildingDefeated', t, '%s|%s|%s|%s' % (self.track, self.numFloors, self.zoneId, victorList))
if toon != None:
self.air.questManager.toonKilledBuilding(toon, self.track, self.difficulty, self.numFloors, self.zoneId, activeToons, 1)
continue
victorList.extend([None, None, None, None])
for i in range(0, 4):
victor = victorList[i]
@ -345,7 +345,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
event = self.air.getAvatarExitEvent(victor)
self.accept(event, self.setVictorExited, extraArgs = [
victor])
self.b_setVictorList(victorList[:4])
self.updateSavedBy(savedBy)
self.victorResponses = [

View file

@ -7,3 +7,4 @@ class DistributedCJElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorA
DistributedBossElevatorAI.DistributedBossElevatorAI.__init__(self, air, bldg, zone, antiShuffle=antiShuffle, minLaff=minLaff)
self.type = ELEVATOR_CJ
self.countdownTime = ElevatorData[self.type]['countdown']

View file

@ -11,7 +11,7 @@ from direct.directnotify import DirectNotifyGlobal
from toontown.battle import BattleBase
class DistributedElevatorIntAI(DistributedElevatorAI.DistributedElevatorAI):
def __init__(self, air, bldg, avIds):
DistributedElevatorAI.DistributedElevatorAI.__init__(self, air, bldg)
self.countdownTime = simbase.config.GetFloat('int-elevator-timeout', INTERIOR_ELEVATOR_COUNTDOWN_TIME)
@ -35,7 +35,7 @@ class DistributedElevatorIntAI(DistributedElevatorAI.DistributedElevatorAI):
numFullSeats = self.countFullSeats()
if not numFullSeats <= len(self.avIds):
self.notify.warning('we are about to crash. self.seats=%s self.avIds=%s' % (self.seats, self.avIds))
if numFullSeats == len(self.avIds):
self.fsm.request('allAboard')
@ -133,4 +133,4 @@ class DistributedElevatorIntAI(DistributedElevatorAI.DistributedElevatorAI):
def enterClosed(self):
DistributedElevatorAI.DistributedElevatorAI.enterClosed(self)
self.__doorsClosed()
self.__doorsClosed()

View file

@ -40,7 +40,7 @@ class DistributedToonHallInterior(DistributedToonInterior):
self.interior.flattenMedium()
for npcToon in self.cr.doFindAllInstances(DistributedNPCToonBase.DistributedNPCToonBase):
npcToon.initToonState()
self.createSillyMeter()
def createSillyMeter(self):
@ -83,19 +83,19 @@ class DistributedToonHallInterior(DistributedToonInterior):
self.arrowSfx = self.audio3d.loadSfx('phase_4/audio/sfx/tt_s_prp_sillyMeterArrow.ogg')
self.arrowSfx.setLoop(False)
self.audio3d.setDropOffFactor(0.1)
self.startSillyMeter(config.GetInt('silly-meter-phase', 12))
def startSillyMeter(self, phase):
self.stopSillyMeter()
if hasattr(self, 'enterPhase%s' % phase):
getattr(self, 'enterPhase%s' % phase)()
self.phase = phase
def stopSillyMeter(self):
if hasattr(self, 'phase') and hasattr(self, 'exitPhase%s' % self.phase):
getattr(self, 'exitPhase%s' % self.phase)()
getattr(self, 'exitPhase%s' % self.phase)()
def enterPhase0(self):
self.animSeq = Parallel(ActorInterval(self.sillyMeter, 'arrowTube', partName='arrow', duration=604800, constrainedLoop=1, startFrame=1, endFrame=30), Sequence(Func(self.phase1Sfx.play), Func(self.audio3d.attachSoundToObject, self.phase1Sfx, self.sillyMeter)))
@ -421,9 +421,9 @@ def sillyPhase(phase):
"""
Set the silly meter phase.
"""
if phase < -1 or phase > 14:
return 'Phase number must be between 0 and 14!'
messenger.send('SillyMeterPhase', [phase])
return 'Successfully set the silly meter phase!'
return 'Successfully set the silly meter phase!'

View file

@ -7,4 +7,4 @@ INT_HOUSE = 6
EXT_COGHQ = 7
INT_COGHQ = 8
EXT_KS = 9
INT_KS = 10
INT_KS = 10

View file

@ -35,7 +35,7 @@ class PetshopBuildingAI:
self.interior.generateWithRequired(self.interiorZone)
self.npcs = NPCToons.createNpcsInZone(self.air, self.interiorZone)
door = DistributedDoorAI.DistributedDoorAI(
self.air, blockNumber, DoorTypes.EXT_STANDARD)
insideDoor = DistributedDoorAI.DistributedDoorAI(
@ -50,4 +50,4 @@ class PetshopBuildingAI:
self.insideDoor = insideDoor
def createPet(self, ownerId, seed):
return
return

View file

@ -201,7 +201,7 @@ buildingMinMax = {
ToontownGlobals.PajamaPlace: [config.GetInt('pajama-place-building-min', 6),
config.GetInt('pajama-place-building-max', 12)],
ToontownGlobals.RockAByeRoad: [config.GetInt('rock-a-bye-road-building-min', 6),
config.GetInt('rock-a-bye-road-building-max', 12)],
config.GetInt('rock-a-bye-road-building-max', 12)],
ToontownGlobals.SellbotHQ: [0, 0],
ToontownGlobals.SellbotFactoryExt: [0, 0],
ToontownGlobals.CashbotHQ: [0, 0],

View file

@ -5,7 +5,7 @@ from datetime import datetime
class AccountDate(DistributedObject):
neverDisable = 1
notify = directNotify.newCategory('AccountDate')
def __init__(self, cr):
DistributedObject.__init__(self, cr)
self.accountDays = 0
@ -20,20 +20,20 @@ class AccountDate(DistributedObject):
if base.cr.accountDateMgr is self:
del base.cr.accountDateMgr
DistributedObject.delete(self)
def getAccountDays(self):
return self.accountDays
def requestDate(self, task=None):
self.sendUpdate('requestDate')
if task is not None:
return task.done
def requestDateResult(self, result):
if result is None:
notify.warning('Invalid response from server.')
self.accountDays = 0
else:
date = datetime.strptime(result, "%a %b %d %H:%M:%S %Y")
self.accountDays = (datetime.now() - date).days
self.accountDays = (datetime.now() - date).days

View file

@ -3,21 +3,21 @@ from direct.distributed.DistributedObjectAI import DistributedObjectAI
class AccountDateAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("AccountDateAI")
def announceGenerate(self):
DistributedObjectAI.announceGenerate(self)
def requestDate(self):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if not av:
return
def callback(dclass, fields):
if dclass is not None and dclass == self.air.dclassesByName['AccountAI'] and fields.has_key('CREATED'):
self.sendUpdateToAvatarId(avId, 'requestDateResult', [fields.get('CREATED')])
else:
self.sendUpdateToAvatarId(avId, 'requestDateResult', [None])
self.air.dbInterface.queryObject(self.air.dbId, av.DISLid, callback)
self.air.dbInterface.queryObject(self.air.dbId, av.DISLid, callback)

View file

@ -408,4 +408,4 @@ def getAllAccessories(*accessoryTypes):
base = CatalogAccessoryItem(accessoryType)
list.append(base)
return list
return list

View file

@ -739,4 +739,4 @@ AccessoryTypes = {101: (AHat,
449: (AShoes,
'shw2',
APriceCool,
7)}
7)}

View file

@ -580,4 +580,4 @@ def getAllClothes(*clothingTypes):
for n in range(1, len(base.getColorChoices())):
list.append(CatalogClothingItem(clothingType, n))
return list
return list

View file

@ -124,4 +124,4 @@ class CatalogEmoteItem(CatalogItem.CatalogItem):
dg.addBool(self.isSpecial)
def isGift(self):
return not self.getEmblemPrices()
return not self.getEmblemPrices()

View file

@ -1131,12 +1131,12 @@ def nextAvailableCloset(avatar, duplicateItems):
def nextAvailableBank(avatar, duplicateItems):
if not avatar.getMaxBankMoney() in MoneyToBank:
return CatalogFurnitureItem(1300)
currentBank = MoneyToBank[avatar.getMaxBankMoney()]
if currentBank == MaxBankId:
return
return CatalogFurnitureItem(currentBank + 10)
def get50ItemCloset(avatar, duplicateItems):
@ -1168,10 +1168,10 @@ def getAllClosets():
def getAllBanks():
list = []
for bankId in BankToMoney.keys():
list.append(CatalogFurnitureItem(bankId))
return list
def get50ItemTrunk(avatar, duplicateItems):

View file

@ -1540,10 +1540,10 @@ class CatalogGenerator:
if nextAvailableCloset not in schedule:
weeklyCatalog += self.__selectItem(avatar, nextAvailableCloset, monthlyCatalog, saleItem=0)
if nextAvailableBank not in schedule:
weeklyCatalog += self.__selectItem(avatar, nextAvailableBank, monthlyCatalog, saleItem=0)
weeklyCatalog += self.__selectItem(avatar, get50ItemTrunk, monthlyCatalog, saleItem=0)
if time.time() < 1096617600.0:

View file

@ -9,10 +9,10 @@ class CatalogHouseItem(CatalogItem.CatalogItem):
def makeNewItem(self, houseId):
self.houseId = houseId
CatalogItem.CatalogItem.makeNewItem(self)
def notOfferedTo(self, avatar):
return 1
def requestPurchase(self, phone, callback):
from toontown.toontowngui import TTDialog
avatar = base.localAvatar
@ -43,16 +43,16 @@ class CatalogHouseItem(CatalogItem.CatalogItem):
def getDeliveryTime(self):
return 0
def getEmblemPrices(self):
return HouseGlobals.HouseEmblemPrices[self.houseId]
def getPicture(self, avatar):
model = loader.loadModel(HouseGlobals.houseModels[self.houseId])
model.setBin('unsorted', 0, 1)
self.hasPicture = True
return self.makeFrameModel(model)
def decodeDatagram(self, di, versionNumber, store):
CatalogItem.CatalogItem.decodeDatagram(self, di, versionNumber, store)
self.houseId = di.getUint8()
@ -60,12 +60,13 @@ class CatalogHouseItem(CatalogItem.CatalogItem):
def encodeDatagram(self, dg, store):
CatalogItem.CatalogItem.encodeDatagram(self, dg, store)
dg.addUint8(self.houseId)
def recordPurchase(self, av, optional):
house = simbase.air.doId2do.get(av.getHouseId())
if house:
house.b_setHouseType(self.houseId)
return ToontownGlobals.P_ItemAvailable
def getAllHouses():
return [CatalogHouseItem(i) for i in xrange(6)]

View file

@ -6,7 +6,7 @@ import time
class CatalogManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("CatalogManagerAI")
def __init__(self, air):
DistributedObjectAI.__init__(self, air)
self.catalogGenerator = CatalogGenerator()
@ -15,8 +15,8 @@ class CatalogManagerAI(DistributedObjectAI):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if av:
self.deliverCatalogFor(av)
self.deliverCatalogFor(av)
def deliverCatalogFor(self, av):
monthlyCatalog = self.catalogGenerator.generateMonthlyCatalog(av, time.time() / 60)
newWeek = (av.catalogScheduleCurrentWeek + 1) % ToontownGlobals.CatalogNumWeeks
@ -25,3 +25,4 @@ class CatalogManagerAI(DistributedObjectAI):
av.b_setCatalog(monthlyCatalog, weeklyCatalog, backCatalog)
av.b_setCatalogSchedule(newWeek, int((time.time() + 604800)/60))
av.b_setCatalogNotify(ToontownGlobals.NewItems, av.mailboxNotify)

View file

@ -614,7 +614,7 @@ class CatalogScreen(DirectFrame):
if item in allBankItems and item.furnitureType == CatalogFurnitureItem.MaxBankId:
isMaxBankOffered = True
break
for item in itemList:
if isinstance(item, CatalogInvalidItem.CatalogInvalidItem):
self.notify.warning('skipping catalog invalid item %s' % item)
@ -972,13 +972,13 @@ class CatalogScreen(DirectFrame):
if not self.clarabelleChatBalloon:
self.clarabelleChatBalloon = loader.loadModel('phase_3/models/props/chatbox')
self.clarabelleChat = CatalogChatBalloon.CatalogChatBalloon(self.clarabelleChatBalloon)
chatNode = self.clarabelleChat.generate(str, ToontownGlobals.getInterfaceFont())[0]
self.clarabelleChatNP = self.attachNewNode(chatNode.node(), 1000)
self.clarabelleChatNP.setScale(0.08)
self.clarabelleChatNP.setPos(0.7, 0, 0.6)
if timeout:
taskMgr.doMethodLater(timeout, self.clearClarabelleChat, 'clearClarabelleChat')

View file

@ -32,3 +32,4 @@ class CatalogSurfaceItem(CatalogAtticItem.CatalogAtticItem):
def getDeliveryTime(self):
return 1

View file

@ -512,5 +512,5 @@ class MailboxScreen(DirectObject.DirectObject):
def getSenderName(self, avId):
sender = base.cr.identifyFriend(avId)
return sender.getName() if sender else TTLocalizer.MailboxGiftTagAnonymous
return sender.getName() if sender else TTLocalizer.MailboxGiftTagAnonymous

View file

@ -31,4 +31,4 @@ class TTTalkAssistant(TalkAssistant):
toNpcId,
toonProgress,
msgIndex])
return error
return error

View file

@ -71,4 +71,4 @@ class CogdoCraneGame(DirectObject):
del self.toonId2Player[player.toon.doId]
def handleToonLeft(self, toonId):
self._removePlayer(self.toonId2Player[toonId])
self._removePlayer(self.toonId2Player[toonId])

View file

@ -59,7 +59,7 @@ class DistCogdoFlyingGameAI(DistCogdoGameAI):
damage = int(20 * self.getDifficulty())
self.__damage(av, damage)
else:
self.notify.warning('Client requested unknown action \'%s\'' %action)
self.notify.warning('Client requested unknown action \'%s\'' %action)
def requestPickUp(self, pickupNum, pickupType):
avId = self.air.getAvatarIdFromSender()
@ -74,7 +74,7 @@ class DistCogdoFlyingGameAI(DistCogdoGameAI):
if pickupType == Globals.Level.GatherableTypes.Memo:
self.totalMemos += 1
else:
self.notify.warning('Client requested unknown pickup \'%s\'' % pickupType)
self.notify.warning('Client requested unknown pickup \'%s\'' % pickupType)
def handleStart(self):
for toon in self.toons:

View file

@ -229,7 +229,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
def isBossFloor(self, floorNum):
if not self.layout.hasBossBattle():
return False
return (self.layout.getBossBattleFloor() + 0) == floorNum
def __cleanup(self):
@ -799,7 +799,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
if self.FOType == "l":
speech = TTLocalizer.CogdoExecutiveSuiteToonThankYouLawbot
else:
speech = TTLocalizer.CogdoExecutiveSuiteToonThankYou % self.SOSToonName

View file

@ -31,4 +31,4 @@ class ActiveCell(BasicEntities.DistributedNodePathEntity):
def setState(self, state, objId):
self.state = state
self.occupantId = objId
self.occupantId = objId

View file

@ -28,4 +28,4 @@ class BarrelBase:
self._gagTrack = self.getRng().choice(tracks)
else:
self._gagTrack = self.gagTrack
return self._gagTrack
return self._gagTrack

View file

@ -86,4 +86,4 @@ class BattleBlocker(BasicEntities.DistributedNodePathEntity):
track = Sequence()
if callback:
track.append(Func(callback))
track.start()
track.start()

View file

@ -63,4 +63,4 @@ class BattleBlockerAI(DistributedEntityAI.DistributedEntityAI):
messenger.send(self.getOutputEventName(), [1])
def d_setBattleFinished(self):
self.sendUpdate('setBattleFinished', [])
self.sendUpdate('setBattleFinished', [])

View file

@ -132,4 +132,4 @@ class BossbotCogHQLoader(CogHQLoader.CogHQLoader):
self.exitPlace()
self.placeClass = None
del self.countryClubId
return
return

View file

@ -98,4 +98,4 @@ class ConveyorBelt(BasicEntities.NodePathEntity):
del self.tailClipPath
self.clearClipPlane()
for tread in self.treads:
tread.parentingNode.clearClipPlane()
tread.parentingNode.clearClipPlane()

View file

@ -13,4 +13,4 @@ class CountryClubRoomBase:
self.roomId = roomId
def getCogTrack(self):
return self.cogTrack
return self.cogTrack

View file

@ -27,4 +27,4 @@ class DistributedBarrelBaseAI(DistributedEntityAI.DistributedEntityAI, BarrelBas
self.sendUpdate('setReject')
def d_setGrab(self, avId):
self.sendUpdate('setGrab', [avId])
self.sendUpdate('setGrab', [avId])

View file

@ -372,4 +372,4 @@ class DistributedCogKart(DistributedElevatorExt.DistributedElevatorExt):
elif self.countryClubId == ToontownGlobals.BossbotCountryClubIntB:
return TTLocalizer.ElevatorBossBotCourse1
elif self.countryClubId == ToontownGlobals.BossbotCountryClubIntC:
return TTLocalizer.ElevatorBossBotCourse2
return TTLocalizer.ElevatorBossBotCourse2

View file

@ -5,33 +5,33 @@ from direct.directnotify import DirectNotifyGlobal
class DistributedCrusherEntityAI(DistributedEntityAI.DistributedEntityAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCrusherEntityAI')
def __init__(self, level, entId):
self.isCrusher = 0
self.crushCell = None
DistributedEntityAI.DistributedEntityAI.__init__(self, level, entId)
self.crushMsg = self.getUniqueName('crusherDoCrush')
def generate(self):
DistributedEntityAI.DistributedEntityAI.generate(self)
self.setActiveCrushCell()
def delete(self):
self.ignoreAll()
DistributedEntityAI.DistributedEntityAI.delete(self)
def destroy(self):
self.notify.info('destroy entity %s' % self.entId)
if self.crushCell != None:
self.crushCell.unregisterCrusher(self.entId)
self.crushCell = None
DistributedEntityAI.DistributedEntityAI.destroy(self)
def setActiveCrushCell(self):
self.notify.debug('setActiveCrushCell, entId: %d' % self.entId)
if self.crushCellId != None:
@ -41,17 +41,17 @@ class DistributedCrusherEntityAI(DistributedEntityAI.DistributedEntityAI):
else:
self.isCrusher = 1
self.crushCell.registerCrusher(self.entId)
def sendCrushMsg(self, axis = 0):
if self.isCrusher:
messenger.send(self.crushMsg, [
self.entId,
axis])
def getPosition(self):
if hasattr(self, 'pos'):
return self.pos

View file

@ -442,4 +442,4 @@ class DistributedDoorEntity(DistributedDoorEntityBase.DistributedDoorEntityBase,
self.doorLeft.unstash()
self.doorRight.unstash()
self.doorLeft.setPos(Vec3(0.0))
self.doorRight.setPos(Vec3(0.0))
self.doorRight.setPos(Vec3(0.0))

View file

@ -206,4 +206,4 @@ class DistributedDoorEntityAI(DistributedDoorEntityBase.DistributedDoorEntityBas
def requestOpen(self):
if self.isUnlocked():
if self.fsm.getCurrentState() is not self.states[2]:
self.fsm.request(self.states[1])
self.fsm.request(self.states[1])

View file

@ -124,4 +124,4 @@ class DistributedLawOfficeFloorAI(DistributedLevelAI.DistributedLevelAI, LawOffi
suitIds = []
for suit in self.reserveSuits:
suitIds.append(suit[0].doId)
return suitIds
return suitIds

View file

@ -199,4 +199,4 @@ class DistributedLift(BasicEntities.DistributedNodePathEntity):
self.notify.debug('enterWaiting')
def exitWaiting(self):
pass
pass

View file

@ -6,6 +6,6 @@ class DistributedMegaCorp(DistributedFactory.DistributedFactory):
def __init__(self, cr):
DistributedFactory.DistributedFactory.__init__(self, cr)
def getFloorOuchLevel(self):
return 8

View file

@ -128,4 +128,4 @@ class DistributedMintRoomAI(DistributedLevelAI.DistributedLevelAI, MintRoomBase.
mint.allToonsGone()
else:
self.notify.warning('no mint %s in allToonsGone' % self.mintDoId)
return
return

View file

@ -6,3 +6,4 @@ class DistributedSellbotHQDoorAI(DistributedCogHQDoorAI):
def informPlayer(self, todo0):
pass

View file

@ -344,4 +344,4 @@ class DistributedStomper(DistributedCrusherEntity.DistributedCrusherEntity):
yRange = 5
if tPos[2] < zRange and tPos[2] > -zRange and tPos[0] < xRange and tPos[0] > -xRange and tPos[1] < yRange / 10.0 and tPos[1] > -yRange:
self.level.b_setOuch(self.damage, 'Squish')
base.localAvatar.setZ(self.getZ(render) + 0.025)
base.localAvatar.setZ(self.getZ(render) + 0.025)

View file

@ -35,7 +35,7 @@ class DistributedStomperAI(DistributedCrusherEntityAI.DistributedCrusherEntityAI
for id in self.crushCell.occupantIds:
if id in self.crushCell.crushables:
crushedList.append(id)
self.sendCrushMsg()
self.sendUpdate('setMovie', [StomperGlobals.STOMPER_STOMP, ClockDelta.globalClockDelta.getRealNetworkTime(), crushedList])
else:

View file

@ -121,4 +121,4 @@ class DistributedSwitch(DistributedSwitchBase.DistributedSwitchBase, BasicEntiti
if self.track:
self.track.finish()
self.track = None
return
return

View file

@ -107,4 +107,4 @@ class DistributedSwitchAI(DistributedSwitchBase.DistributedSwitchBase, Distribut
if self.doLaterTask:
self.doLaterTask.remove()
self.doLaterTask = None
return
return

View file

@ -14,4 +14,4 @@ class FactoryBase:
return self.cogTrack
def getFactoryType(self):
return self.factoryType
return self.factoryType

View file

@ -33,4 +33,4 @@ class FactoryLevelMgr(LevelMgr.LevelMgr):
LevelMgr.LevelMgr.destroy(self)
def setFarPlaneDistance(self, farPlaneDistance):
base.camLens.setNearFar(ToontownGlobals.DefaultCameraNear, farPlaneDistance)
base.camLens.setNearFar(ToontownGlobals.DefaultCameraNear, farPlaneDistance)

View file

@ -21,7 +21,7 @@ class FactoryManagerAI(DirectObject.DirectObject):
factoryId = FactoryManagerAI.factoryId
if entranceId == 2:
factory = DistributedMegaCorpAI.DistributedMegaCorpAI(self.air, factoryId, factoryZone, entranceId, players)
else:
else:
factory = DistributedFactoryAI.DistributedFactoryAI(self.air, factoryId, factoryZone, entranceId, players)
factory.generateWithRequired(factoryZone)
return factoryZone

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