File cleanup and some fixes.

This commit is contained in:
John Cote 2015-05-11 15:05:59 -04:00
parent 85406a5a52
commit 267310adc7
22 changed files with 160 additions and 180 deletions

View file

@ -17,7 +17,7 @@ def doSOSs(calls):
def callerFunc(toon, handle): def callerFunc(toon, handle):
toon.setChatAbsolute(TTLocalizer.MovieSOSCallHelp % handle.getName(), CFSpeech | CFTimeout) toon.setChatAbsolute(TTLocalizer.MovieSOSCallHelp % handle.getName(), CFSpeech | CFTimeout)
handle.d_battleSOS(base.localAvatar.doId) handle.d_battleSOS(handle.doId)
def calleeFunc(toon, handle): def calleeFunc(toon, handle):
toon.setChatAbsolute(TTLocalizer.MovieSOSCallHelp % handle.getName(), CFSpeech | CFTimeout) toon.setChatAbsolute(TTLocalizer.MovieSOSCallHelp % handle.getName(), CFSpeech | CFTimeout)

View file

@ -29,27 +29,27 @@ WhisperColors = {
((0.0, 0.0, 0.0, 1.0), (0.2, 0.7, 0.8, 0.6)) # Disabled ((0.0, 0.0, 0.0, 1.0), (0.2, 0.7, 0.8, 0.6)) # Disabled
), ),
WTSystem: ( WTSystem: (
((0.0, 0.0, 0.0, 1.0), (0.8, 0.1, 0.1, 0.6)), # Normal ((0.0, 0.0, 0.0, 1.0), (0.8, 0.3, 0.6, 0.6)), # Normal
((1.0, 0.5, 0.5, 1.0), (0.8, 0.1, 0.1, 0.8)), # Click ((1.0, 0.5, 0.5, 1.0), (1.0, 1.0, 1.0, 0.8)), # Click
((0.0, 0.0, 0.0, 1.0), (0.9, 0.05, 0.05, 0.6)), # Rollover ((0.0, 0.0, 0.0, 1.0), (0.8, 0.4, 1.0, 0.6)), # Rollover
((0.0, 0.0, 0.0, 1.0), (0.2, 0.7, 0.8, 0.6)) # Disabled ((0.0, 0.0, 0.0, 1.0), (0.8, 0.3, 0.6, 0.6)) # Disabled
), ),
WTBattleSOS: ( WTBattleSOS: (
((0.0, 0.0, 0.0, 1.0), (0.8, 0.1, 0.1, 0.6)), # Normal ((0.0, 0.0, 0.0, 1.0), (0.2, 0.6, 0.8, 0.6)), # Normal
((1.0, 0.5, 0.5, 1.0), (0.8, 0.1, 0.1, 0.8)), # Click ((1.0, 0.5, 0.5, 1.0), (1.0, 1.0, 1.0, 0.8)), # Click
((0.0, 0.0, 0.0, 1.0), (0.9, 0.05, 0.05, 0.6)), # Rollover ((0.0, 0.0, 0.0, 1.0), (0.2, 0.7, 0.9, 0.6)), # Rollover
((0.0, 0.0, 0.0, 1.0), (0.2, 0.7, 0.8, 0.6)) # Disabled ((0.0, 0.0, 0.0, 1.0), (0.2, 0.7, 0.8, 0.6)) # Disabled
), ),
WTEmote: ( WTEmote: (
((0.0, 0.0, 0.0, 1.0), (0.8, 0.1, 0.1, 0.6)), # Normal ((0.0, 0.0, 0.0, 1.0), (0.1, 0.7, 0.41, 0.6)), # Normal
((1.0, 0.5, 0.5, 1.0), (0.8, 0.1, 0.1, 0.8)), # Click ((1.0, 0.5, 0.5, 1.0), (0.2, 0.7, 0.41, 0.8)), # Click
((0.0, 0.0, 0.0, 1.0), (0.9, 0.05, 0.05, 0.6)), # Rollover ((0.0, 0.0, 0.0, 1.0), (0.1, 0.6, 0.51, 0.6)), # Rollover
((0.0, 0.0, 0.0, 1.0), (0.2, 0.7, 0.8, 0.6)) # Disabled ((0.0, 0.0, 0.0, 1.0), (0.1, 0.6, 0.41, 0.6)) # Disabled
), ),
WTToontownBoardingGroup: ( WTToontownBoardingGroup: (
((0.0, 0.0, 0.0, 1.0), (0.9, 0.4, 0.05, 0.6)), # Normal ((0.0, 0.0, 0.0, 1.0), (0.9, 0.5, 0.1, 0.6)), # Normal
((1.0, 0.5, 0.5, 1.0), (1.0, 0.5, 0.2, 0.8)), # Click ((1.0, 0.5, 0.5, 1.0), (1.0, 1.0, 1.0, 0.8)), # Click
((0.0, 0.0, 0.0, 1.0), (1.0, 0.4, 0.0, 0.6)), # Rollover ((0.0, 0.0, 0.0, 1.0), (0.9, 0.6, 0.2, 0.6)), # Rollover
((0.0, 0.0, 0.0, 1.0), (0.9, 0.6, 0.1, 0.6)) # Disabled ((0.0, 0.0, 0.0, 1.0), (0.9, 0.6, 0.1, 0.6)) # Disabled
), ),
} }

View file

@ -104,7 +104,7 @@ class FireworkShowMixin:
else: else:
FireworkShowMixin.notify.warning('Invalid fireworks event ID: %d' % eventId) FireworkShowMixin.notify.warning('Invalid fireworks event ID: %d' % eventId)
return None return None
self.showMusic = loader.loadMusic(musicFile) self.showMusic = loader.loadMusic(musicFile)
self.showMusic.setVolume(1) self.showMusic.setVolume(1)
@ -157,7 +157,7 @@ class FireworkShowMixin:
else: else:
FireworkShowMixin.notify.warning('Invalid fireworks event ID: %d' % eventId) FireworkShowMixin.notify.warning('Invalid fireworks event ID: %d' % eventId)
return None return None
if self.__checkHoodValidity() and hasattr(base.cr.playGame.hood, 'sky') and base.cr.playGame.hood.sky: if self.__checkHoodValidity() and hasattr(base.cr.playGame.hood, 'sky') and base.cr.playGame.hood.sky:
postShow = Sequence(Func(base.cr.playGame.hood.sky.show), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.sky, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.localAvatar, 2.5, Vec4(1, 1, 1, 1))), Func(self.__restoreDDFog), Func(self.restoreCameraLens), Func(base.setBackgroundColor, DefaultBackgroundColor), Func(self.showMusic.stop), Func(base.localAvatar.setSystemMessage, 0, endMessage)) postShow = Sequence(Func(base.cr.playGame.hood.sky.show), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.sky, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.localAvatar, 2.5, Vec4(1, 1, 1, 1))), Func(self.__restoreDDFog), Func(self.restoreCameraLens), Func(base.setBackgroundColor, DefaultBackgroundColor), Func(self.showMusic.stop), Func(base.localAvatar.setSystemMessage, 0, endMessage))
if self.restorePlaygroundMusic: if self.restorePlaygroundMusic:

View file

@ -17,7 +17,7 @@ class Rental:
def __init__(self, estate): def __init__(self, estate):
self.estate = estate self.estate = estate
self.objects = set() self.objects = set()
def destroy(self): def destroy(self):
del self.estate del self.estate
for object in self.objects: for object in self.objects:
@ -25,12 +25,12 @@ class Rental:
object.requestDelete() object.requestDelete()
taskMgr.remove(object.uniqueName('delete')) taskMgr.remove(object.uniqueName('delete'))
self.objects = set() self.objects = set()
class CannonRental(Rental): class CannonRental(Rental):
def generateObjects(self): def generateObjects(self):
target = DistributedTargetAI(self.estate.air) target = DistributedTargetAI(self.estate.air)
target.generateWithRequired(self.estate.zoneId) target.generateWithRequired(self.estate.zoneId)
for drop in CannonGlobals.cannonDrops: for drop in CannonGlobals.cannonDrops:
cannon = DistributedCannonAI(self.estate.air) cannon = DistributedCannonAI(self.estate.air)
cannon.setEstateId(self.estate.doId) cannon.setEstateId(self.estate.doId)
@ -38,18 +38,18 @@ class CannonRental(Rental):
cannon.setPosHpr(*drop) cannon.setPosHpr(*drop)
cannon.generateWithRequired(self.estate.zoneId) cannon.generateWithRequired(self.estate.zoneId)
self.objects.add(cannon) self.objects.add(cannon)
self.generateTreasures() self.generateTreasures()
self.estate.b_setClouds(1) self.estate.b_setClouds(1)
def destroy(self): def destroy(self):
self.estate.b_setClouds(0) self.estate.b_setClouds(0)
Rental.destroy(self) Rental.destroy(self)
def generateTreasures(self): def generateTreasures(self):
doIds = [] doIds = []
z = 35 z = 35
for i in xrange(20): for i in xrange(20):
x = random.randint(100, 300) - 200 x = random.randint(100, 300) - 200
y = random.randint(100, 300) - 200 y = random.randint(100, 300) - 200
@ -57,21 +57,20 @@ class CannonRental(Rental):
treasure.generateWithRequired(self.estate.zoneId) treasure.generateWithRequired(self.estate.zoneId)
self.objects.add(treasure) self.objects.add(treasure)
doIds.append(treasure.doId) doIds.append(treasure.doId)
self.estate.sendUpdate("setTreasureIds", [doIds]) self.estate.sendUpdate("setTreasureIds", [doIds])
def grabAttempt(self, avId, treasureId): def grabAttempt(self, avId, treasureId):
av = self.estate.air.doId2do.get(avId) av = self.estate.air.doId2do.get(avId)
if av == None: if av == None:
self.estate.air.writeServerEvent('suspicious', avId, 'TreasurePlannerAI.grabAttempt unknown avatar') self.estate.air.writeServerEvent('suspicious', avId, 'TreasurePlannerAI.grabAttempt unknown avatar')
self.estate.notify.warning('avid: %s does not exist' % avId) self.estate.notify.warning('avid: %s does not exist' % avId)
return return
treasure = self.estate.air.doId2do.get(treasureId) treasure = self.estate.air.doId2do.get(treasureId)
if self.validAvatar(av): if self.validAvatar(av):
treasure.d_setGrab(avId) treasure.d_setGrab(avId)
self.deleteTreasureSoon(treasure) self.deleteTreasureSoon(treasure)
else: else:
treasure.d_setReject() treasure.d_setReject()
@ -81,11 +80,11 @@ class CannonRental(Rental):
def __deleteTreasureNow(self, treasure, taskName): def __deleteTreasureNow(self, treasure, taskName):
treasure.requestDelete() treasure.requestDelete()
def validAvatar(self, av): def validAvatar(self, av):
if av.getMaxHp() == av.getHp(): if av.getMaxHp() == av.getHp():
return 0 return 0
av.toonUp(3) av.toonUp(3)
return 1 return 1
@ -116,28 +115,25 @@ class DistributedEstateAI(DistributedObjectAI):
self.rentalHandle = None self.rentalHandle = None
self.rentalTimestamp = 0 self.rentalTimestamp = 0
self.houses = [None] * 6 self.houses = [None] * 6
self.pond = None self.pond = None
self.spots = [] self.spots = []
self.targets = [] self.targets = []
self.owner = None self.owner = None
def generate(self): def generate(self):
DistributedObjectAI.generate(self) DistributedObjectAI.generate(self)
self.pond = DistributedFishingPondAI(simbase.air) self.pond = DistributedFishingPondAI(simbase.air)
self.pond.setArea(ToontownGlobals.MyEstate) self.pond.setArea(ToontownGlobals.MyEstate)
self.pond.generateWithRequired(self.zoneId) self.pond.generateWithRequired(self.zoneId)
for i in xrange(FishingTargetGlobals.getNumTargets(ToontownGlobals.MyEstate)): for i in xrange(FishingTargetGlobals.getNumTargets(ToontownGlobals.MyEstate)):
target = DistributedFishingTargetAI(self.air) target = DistributedFishingTargetAI(self.air)
target.setPondDoId(self.pond.getDoId()) target.setPondDoId(self.pond.getDoId())
target.generateWithRequired(self.zoneId) target.generateWithRequired(self.zoneId)
self.targets.append(target) self.targets.append(target)
spot = DistributedFishingSpotAI(self.air) spot = DistributedFishingSpotAI(self.air)
spot.setPondDoId(self.pond.getDoId()) spot.setPondDoId(self.pond.getDoId())
spot.setPosHpr(49.1029, -124.805, 0.344704, 90, 0, 0) spot.setPosHpr(49.1029, -124.805, 0.344704, 90, 0, 0)
@ -164,9 +160,8 @@ class DistributedEstateAI(DistributedObjectAI):
self.treasureChest = DistributedTreasureChestAI.DistributedTreasureChestAI(self.air) self.treasureChest = DistributedTreasureChestAI.DistributedTreasureChestAI(self.air)
self.treasureChest.generateWithRequired(self.zoneId) self.treasureChest.generateWithRequired(self.zoneId)
self.createTreasurePlanner()
self.createTreasurePlanner()
def destroy(self): def destroy(self):
for house in self.houses: for house in self.houses:
@ -186,7 +181,7 @@ class DistributedEstateAI(DistributedObjectAI):
if self.rentalHandle: if self.rentalHandle:
self.rentalHandle.destroy() self.rentalHandle.destroy()
self.rentalHandle = None self.rentalHandle = None
if self.treasureChest: if self.treasureChest:
self.treasureChest.requestDelete() self.treasureChest.requestDelete()
@ -197,13 +192,13 @@ class DistributedEstateAI(DistributedObjectAI):
def setClientReady(self): def setClientReady(self):
self.sendUpdate('setEstateReady', []) self.sendUpdate('setEstateReady', [])
def setClosestHouse(self, todo0): def setClosestHouse(self, todo0):
pass pass
def setTreasureIds(self, todo0): def setTreasureIds(self, todo0):
pass pass
def createTreasurePlanner(self): def createTreasurePlanner(self):
treasureType, healAmount, spawnPoints, spawnRate, maxTreasures = TreasureGlobals.SafeZoneTreasureSpawns[ToontownGlobals.MyEstate] treasureType, healAmount, spawnPoints, spawnRate, maxTreasures = TreasureGlobals.SafeZoneTreasureSpawns[ToontownGlobals.MyEstate]
self.treasurePlanner = SZTreasurePlannerAI(self.zoneId, treasureType, healAmount, spawnPoints, spawnRate, maxTreasures) self.treasurePlanner = SZTreasurePlannerAI(self.zoneId, treasureType, healAmount, spawnPoints, spawnRate, maxTreasures)
@ -218,14 +213,14 @@ class DistributedEstateAI(DistributedObjectAI):
def setDawnTime(self, dawnTime): def setDawnTime(self, dawnTime):
self.dawnTime = dawnTime self.dawnTime = dawnTime
def d_setDawnTime(self, dawnTime): def d_setDawnTime(self, dawnTime):
self.sendUpdate('setDawnTime', [dawnTime]) self.sendUpdate('setDawnTime', [dawnTime])
def b_setDawnTime(self, dawnTime): def b_setDawnTime(self, dawnTime):
self.setDawnTime(dawnTime) self.setDawnTime(dawnTime)
self.d_setDawnTime(dawnTime) self.d_setDawnTime(dawnTime)
def getDawnTime(self): def getDawnTime(self):
return self.dawnTime return self.dawnTime
@ -234,86 +229,83 @@ class DistributedEstateAI(DistributedObjectAI):
def setDecorData(self, decorData): def setDecorData(self, decorData):
self.decorData = decorData self.decorData = decorData
def d_setDecorData(self, decorData): def d_setDecorData(self, decorData):
self.sendUpdate('setDecorData', [decorData]) self.sendUpdate('setDecorData', [decorData])
def b_setDecorData(self, decorData): def b_setDecorData(self, decorData):
self.setDecorData(decorData) self.setDecorData(decorData)
self.d_setDecorData(decorData) self.d_setDecorData(decorData)
def getDecorData(self): def getDecorData(self):
return self.decorData return self.decorData
def setLastEpochTimeStamp(self, last): #how do I do this def setLastEpochTimeStamp(self, last):
self.lastEpochTimestamp = last self.lastEpochTimestamp = last
def d_setLastEpochTimeStamp(self, last): def d_setLastEpochTimeStamp(self, last):
self.sendUpdate('setLastEpochTimeStamp', [last]) self.sendUpdate('setLastEpochTimeStamp', [last])
def b_setLastEpochTimeStamp(self, last): def b_setLastEpochTimeStamp(self, last):
self.setLastEpochTimeStamp(last) self.setLastEpochTimeStamp(last)
self.d_setLastEpochTimeStamp(last) self.d_setLastEpochTimeStamp(last)
def getLastEpochTimeStamp(self): def getLastEpochTimeStamp(self):
return self.lastEpochTimestamp return self.lastEpochTimestamp
def setRentalTimeStamp(self, rental): def setRentalTimeStamp(self, rental):
self.rentalTimestamp = rental self.rentalTimestamp = rental
def d_setRentalTimeStamp(self, rental): def d_setRentalTimeStamp(self, rental):
self.sendUpdate('setRentalTimeStamp', [rental]) self.sendUpdate('setRentalTimeStamp', [rental])
def b_setRentalTimeStamp(self, rental): def b_setRentalTimeStamp(self, rental):
self.setRentalTimeStamp(rental) self.setRentalTimeStamp(rental)
self.d_setRentalTimeStamp(rental) self.d_setRentalTimeStamp(rental)
def getRentalTimeStamp(self): def getRentalTimeStamp(self):
return self.rentalTimestamp return self.rentalTimestamp
def b_setRentalType(self, type): def b_setRentalType(self, type):
self.d_setRentalType(type) self.d_setRentalType(type)
self.setRentalType(type) self.setRentalType(type)
def d_setRentalType(self, type): def d_setRentalType(self, type):
self.sendUpdate("setRentalType", [type]) self.sendUpdate("setRentalType", [type])
def setRentalType(self, type): def setRentalType(self, type):
expirestamp = self.getRentalTimeStamp() expirestamp = self.getRentalTimeStamp()
if expirestamp == 0: if expirestamp == 0:
expire = 0 expire = 0
else: else:
expire = int(expirestamp - time.time()) expire = int(expirestamp - time.time())
if expire < 0: if expire < 0:
self.rentalType = 0 self.rentalType = 0
self.d_setRentalType(0) self.d_setRentalType(0)
self.b_setRentalTimeStamp(0) self.b_setRentalTimeStamp(0)
else: else:
if self.rentalType == type: if self.rentalType == type:
return return
self.rentalType = type self.rentalType = type
if self.rentalHandle: if self.rentalHandle:
self.rentalHandle.destroy() self.rentalHandle.destroy()
self.rentalHandle = None self.rentalHandle = None
if self.rentalType == ToontownGlobals.RentalCannon: if self.rentalType == ToontownGlobals.RentalCannon:
self.rentalHandle = CannonRental(self) self.rentalHandle = CannonRental(self)
elif self.rentalType == ToontownGlobals.RentalGameTable: elif self.rentalType == ToontownGlobals.RentalGameTable:
self.rentalHandle = TableRental(self) self.rentalHandle = TableRental(self)
else: else:
self.notify.warning('Unknown rental %s' % self.rentalType) self.notify.warning('Unknown rental %s' % self.rentalType)
return return
self.rentalHandle.generateObjects() self.rentalHandle.generateObjects()
def getRentalType(self): def getRentalType(self):
return self.rentalType return self.rentalType
def rentItem(self, rentType, duration): def rentItem(self, rentType, duration):
self.rentalType = rentType self.rentalType = rentType
self.b_setRentalTimeStamp(time.time() + duration * 60) self.b_setRentalTimeStamp(time.time() + duration * 60)
@ -321,14 +313,14 @@ class DistributedEstateAI(DistributedObjectAI):
def setSlot0ToonId(self, id): def setSlot0ToonId(self, id):
self.toons[0] = id self.toons[0] = id
def d_setSlot0ToonId(self, id): def d_setSlot0ToonId(self, id):
self.sendUpdate('setSlot0ToonId', [id]) self.sendUpdate('setSlot0ToonId', [id])
def b_setSlot0ToonId(self, id): def b_setSlot0ToonId(self, id):
self.setSlot0ToonId(id) self.setSlot0ToonId(id)
self.d_setSlot0ToonId(id) self.d_setSlot0ToonId(id)
def getSlot0ToonId(self): def getSlot0ToonId(self):
return self.toons[0] return self.toons[0]
@ -337,37 +329,37 @@ class DistributedEstateAI(DistributedObjectAI):
def d_setSlot0Items(self, items): def d_setSlot0Items(self, items):
self.sendUpdate('setSlot5Items', [items]) self.sendUpdate('setSlot5Items', [items])
def b_setSlot0Items(self, items): def b_setSlot0Items(self, items):
self.setSlot0Items(items) self.setSlot0Items(items)
self.d_setSlot0Items(items) self.d_setSlot0Items(items)
def getSlot0Items(self): def getSlot0Items(self):
return self.items[0] return self.items[0]
def setSlot1ToonId(self, id): def setSlot1ToonId(self, id):
self.toons[1] = id self.toons[1] = id
def d_setSlot1ToonId(self, id): def d_setSlot1ToonId(self, id):
self.sendUpdate('setSlot1ToonId', [id]) self.sendUpdate('setSlot1ToonId', [id])
def b_setSlot1ToonId(self, id): def b_setSlot1ToonId(self, id):
self.setSlot1ToonId(id) self.setSlot1ToonId(id)
self.d_setSlot1ToonId(id) self.d_setSlot1ToonId(id)
def getSlot1ToonId(self): def getSlot1ToonId(self):
return self.toons[1] return self.toons[1]
def setSlot1Items(self, items): def setSlot1Items(self, items):
self.items[1] = items self.items[1] = items
def d_setSlot1Items(self, items): def d_setSlot1Items(self, items):
self.sendUpdate('setSlot2Items', [items]) self.sendUpdate('setSlot2Items', [items])
def b_setSlot1Items(self, items): def b_setSlot1Items(self, items):
self.setSlot2Items(items) self.setSlot2Items(items)
self.d_setSlot2Items(items) self.d_setSlot2Items(items)
def getSlot1Items(self): def getSlot1Items(self):
return self.items[1] return self.items[1]
@ -376,11 +368,11 @@ class DistributedEstateAI(DistributedObjectAI):
def d_setSlot2ToonId(self, id): def d_setSlot2ToonId(self, id):
self.sendUpdate('setSlot2ToonId', [id]) self.sendUpdate('setSlot2ToonId', [id])
def b_setSlot2ToonId(self, id): def b_setSlot2ToonId(self, id):
self.setSlot2ToonId(id) self.setSlot2ToonId(id)
self.d_setSlot2ToonId(id) self.d_setSlot2ToonId(id)
def getSlot2ToonId(self): def getSlot2ToonId(self):
return self.toons[2] return self.toons[2]
@ -389,90 +381,89 @@ class DistributedEstateAI(DistributedObjectAI):
def d_setSlot2Items(self, items): def d_setSlot2Items(self, items):
self.sendUpdate('setSlot2Items', [items]) self.sendUpdate('setSlot2Items', [items])
def b_setSlot2Items(self, items): def b_setSlot2Items(self, items):
self.setSlot2Items(items) self.setSlot2Items(items)
self.d_setSlot2Items(items) self.d_setSlot2Items(items)
def getSlot2Items(self): def getSlot2Items(self):
return self.items[2] return self.items[2]
def setSlot3ToonId(self, id): def setSlot3ToonId(self, id):
self.toons[3] = id self.toons[3] = id
def d_setSlot3ToonId(self, id): def d_setSlot3ToonId(self, id):
self.sendUpdate('setSlot3ToonId', [id]) self.sendUpdate('setSlot3ToonId', [id])
def b_setSlot3ToonId(self, id): def b_setSlot3ToonId(self, id):
self.setSlot3ToonId(id) self.setSlot3ToonId(id)
self.d_setSlot3ToonId(id) self.d_setSlot3ToonId(id)
def getSlot3ToonId(self): def getSlot3ToonId(self):
return self.toons[3] return self.toons[3]
def setSlot3Items(self, items): def setSlot3Items(self, items):
self.items[3] = items self.items[3] = items
def d_setSlot3Items(self, items): def d_setSlot3Items(self, items):
self.sendUpdate('setSlot3Items', [items]) self.sendUpdate('setSlot3Items', [items])
def b_setSlot3Items(self, items): def b_setSlot3Items(self, items):
self.setSlot3Items(items) self.setSlot3Items(items)
self.d_setSlot3Items(items) self.d_setSlot3Items(items)
def getSlot3Items(self): def getSlot3Items(self):
return self.items[3] return self.items[3]
def setSlot4ToonId(self, id): def setSlot4ToonId(self, id):
self.toons[4] = id self.toons[4] = id
def d_setSlot4ToonId(self, id): def d_setSlot4ToonId(self, id):
self.sendUpdate('setSlot4ToonId', [id]) self.sendUpdate('setSlot4ToonId', [id])
def b_setSlot5ToonId(self, id): def b_setSlot5ToonId(self, id):
self.setSlot4ToonId(id) self.setSlot4ToonId(id)
self.d_setSlot4ToonId(id) self.d_setSlot4ToonId(id)
def getSlot4ToonId(self): def getSlot4ToonId(self):
return self.toons[4] return self.toons[4]
def setSlot4Items(self, items): def setSlot4Items(self, items):
self.items[4] = items self.items[4] = items
def d_setSlot4Items(self, items): def d_setSlot4Items(self, items):
self.sendUpdate('setSlot4Items', [items]) self.sendUpdate('setSlot4Items', [items])
def b_setSlot4Items(self, items): def b_setSlot4Items(self, items):
self.setSlot4Items(items) self.setSlot4Items(items)
self.d_setSlot4Items(items) self.d_setSlot4Items(items)
def getSlot4Items(self): def getSlot4Items(self):
return self.items[4] return self.items[4]
def setSlot5ToonId(self, id): def setSlot5ToonId(self, id):
self.toons[5] = id self.toons[5] = id
def d_setSlot5ToonId(self, id): def d_setSlot5ToonId(self, id):
self.sendUpdate('setSlot5ToonId', [id]) self.sendUpdate('setSlot5ToonId', [id])
def b_setSlot5ToonId(self, id): def b_setSlot5ToonId(self, id):
self.setSlot5ToonId(id) self.setSlot5ToonId(id)
self.d_setSlot5ToonId(id) self.d_setSlot5ToonId(id)
def getSlot5ToonId(self): def getSlot5ToonId(self):
return self.toons[5] return self.toons[5]
def setSlot5Items(self, items): def setSlot5Items(self, items):
self.items[5] = items self.items[5] = items
def d_setSlot5Items(self, items): def d_setSlot5Items(self, items):
self.sendUpdate('setSlot5Items', [items]) self.sendUpdate('setSlot5Items', [items])
def b_setSlot5Items(self, items): def b_setSlot5Items(self, items):
self.setSlot5Items(items) self.setSlot5Items(items)
self.d_setSlot5Items(items) self.d_setSlot5Items(items)
def getSlot5Items(self): def getSlot5Items(self):
return self.items[5] return self.items[5]
@ -481,14 +472,14 @@ class DistributedEstateAI(DistributedObjectAI):
if i >= 6: if i >= 6:
return return
self.toons[i] = idList[i] self.toons[i] = idList[i]
def d_setIdList(self, idList): def d_setIdList(self, idList):
self.sendUpdate('setIdList', [idList]) self.sendUpdate('setIdList', [idList])
def b_setIdList(self, idList): def b_setIdList(self, idList):
self.setIdList(idList) self.setIdList(idList)
self.d_setIdLst(idList) self.d_setIdLst(idList)
def completeFlowerSale(self, todo0): def completeFlowerSale(self, todo0):
pass pass
@ -497,14 +488,14 @@ class DistributedEstateAI(DistributedObjectAI):
def setClouds(self, clouds): def setClouds(self, clouds):
self.cloudType = clouds self.cloudType = clouds
def d_setClouds(self, clouds): def d_setClouds(self, clouds):
self.sendUpdate('setClouds', [clouds]) self.sendUpdate('setClouds', [clouds])
def b_setClouds(self, clouds): def b_setClouds(self, clouds):
self.setClouds(clouds) self.setClouds(clouds)
self.d_setClouds(clouds) self.d_setClouds(clouds)
def getClouds(self): def getClouds(self):
return self.cloudType return self.cloudType

View file

@ -44,7 +44,8 @@ class DistributedTarget(DistributedObject.DistributedObject):
def load(self): def load(self):
self.timer = ToontownTimer.ToontownTimer() self.timer = ToontownTimer.ToontownTimer()
self.timer.setPos(1.1, 0, -0.15) self.timer.reparentTo(base.a2dBottomRight)
self.timer.setPos(-0.233, 0, 0.85)
self.timer.hide() self.timer.hide()
self.geom = loader.loadModel('phase_5.5/models/estate/target') self.geom = loader.loadModel('phase_5.5/models/estate/target')
self.geom.reparentTo(base.cr.playGame.hood.loader.geom) self.geom.reparentTo(base.cr.playGame.hood.loader.geom)

View file

@ -1,13 +1,13 @@
from direct.distributed import DistributedObject from direct.distributed.DistributedObject import DistributedObject
from pandac.PandaModules import * from pandac.PandaModules import *
from toontown.fishing import FishSellGUI from toontown.fishing import FishSellGUI
from toontown.toonbase import ToontownGlobals, TTLocalizer from toontown.toonbase import ToontownGlobals, TTLocalizer
import TreasureChestGlobals import TreasureChestGlobals
class DistributedTreasureChest(DistributedObject.DistributedObject): class DistributedTreasureChest(DistributedObject):
def __init__(self, cr): def __init__(self, cr):
DistributedObject.DistributedObject.__init__(self, cr) DistributedObject.__init__(self, cr)
self.cr = cr self.cr = cr
self.createModel(45, -165.75, 0.025, 30) self.createModel(45, -165.75, 0.025, 30)
self.initCollisions() self.initCollisions()
@ -21,7 +21,7 @@ class DistributedTreasureChest(DistributedObject.DistributedObject):
del self.cSphereNode del self.cSphereNode
del self.cSphereNodePath del self.cSphereNodePath
del self.model del self.model
DistributedObject.DistributedObject.delete(self) DistributedObject.delete(self)
def destroyFishGui(self): def destroyFishGui(self):
self.ignore('treasureChestSell') self.ignore('treasureChestSell')
@ -46,7 +46,7 @@ class DistributedTreasureChest(DistributedObject.DistributedObject):
self.cSphereNodePath.hide() self.cSphereNodePath.hide()
self.cSphereNode.setCollideMask(ToontownGlobals.WallBitmask) self.cSphereNode.setCollideMask(ToontownGlobals.WallBitmask)
self.accept('enter' + self.cSphereNode.getName(), self.handleCollisionSphereEnter) self.accept('enter' + self.cSphereNode.getName(), self.handleCollisionSphereEnter)
def handleCollisionSphereEnter(self, collEntry): def handleCollisionSphereEnter(self, collEntry):
if not base.localAvatar.fishTank.getFish(): if not base.localAvatar.fishTank.getFish():
base.localAvatar.setSystemMessage(0, TTLocalizer.STOREOWNER_NOFISH) base.localAvatar.setSystemMessage(0, TTLocalizer.STOREOWNER_NOFISH)
@ -56,17 +56,17 @@ class DistributedTreasureChest(DistributedObject.DistributedObject):
base.cr.playGame.getPlace().setState('stopped') base.cr.playGame.getPlace().setState('stopped')
self.acceptOnce('treasureChestSell', self.handleSaleDone) self.acceptOnce('treasureChestSell', self.handleSaleDone)
self.fishGui = FishSellGUI.FishSellGUI('treasureChestSell') self.fishGui = FishSellGUI.FishSellGUI('treasureChestSell')
def handleSaleDone(self, sell): def handleSaleDone(self, sell):
self.destroyFishGui() self.destroyFishGui()
base.setCellsActive(base.bottomCells, 1) base.setCellsActive(base.bottomCells, 1)
base.cr.playGame.getPlace().setState('walk') base.cr.playGame.getPlace().setState('walk')
self.sendUpdate('completeSale', [sell]) self.sendUpdate('completeSale', [sell])
def completeSaleResult(self, state, numFish, maxFish): def completeSaleResult(self, state, numFish, maxFish):
if state == TreasureChestGlobals.TROPHY: if state == TreasureChestGlobals.TROPHY:
base.localAvatar.setSystemMessage(0, TTLocalizer.STOREOWNER_TROPHY % (numFish, maxFish)) base.localAvatar.setSystemMessage(0, TTLocalizer.STOREOWNER_TROPHY % (numFish, maxFish))
elif state == TreasureChestGlobals.COMPLETE: elif state == TreasureChestGlobals.COMPLETE:
base.localAvatar.setSystemMessage(0, TTLocalizer.STOREOWNER_THANKSFISH) base.localAvatar.setSystemMessage(0, TTLocalizer.STOREOWNER_THANKSFISH)
elif state == TreasureChestGlobals.NONE: elif state == TreasureChestGlobals.NONE:
base.localAvatar.setSystemMessage(0, TTLocalizer.STOREOWNER_NOFISH) base.localAvatar.setSystemMessage(0, TTLocalizer.STOREOWNER_NOFISH)

View file

@ -1,22 +1,22 @@
from direct.distributed import DistributedObjectAI from direct.distributed.DistributedObjectAI import DistributedObjectAI
from toontown.fishing import FishGlobals from toontown.fishing import FishGlobals
import TreasureChestGlobals import TreasureChestGlobals
class DistributedTreasureChestAI(DistributedObjectAI.DistributedObjectAI): class DistributedTreasureChestAI(DistributedObjectAI):
def completeSale(self, sell): def completeSale(self, sell):
avId = self.air.getAvatarIdFromSender() avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId) av = self.air.doId2do.get(avId)
if not av: if not av:
return return
if sell: if sell:
trophyResult = self.air.fishManager.creditFishTank(av) trophyResult = self.air.fishManager.creditFishTank(av)
if trophyResult: if trophyResult:
self.sendUpdateToAvatarId(avId, 'completeSaleResult', [TreasureChestGlobals.TROPHY, len(av.fishCollection), FishGlobals.getTotalNumFish()]) self.sendUpdateToAvatarId(avId, 'completeSaleResult', [TreasureChestGlobals.TROPHY, len(av.fishCollection), FishGlobals.getTotalNumFish()])
else: else:
self.sendUpdateToAvatarId(avId, 'completeSaleResult', [TreasureChestGlobals.COMPLETE, 0, 0]) self.sendUpdateToAvatarId(avId, 'completeSaleResult', [TreasureChestGlobals.COMPLETE, 0, 0])
else: else:
self.sendUpdateToAvatarId(avId, 'completeSaleResult', [TreasureChestGlobals.NONE, 0, 0]) self.sendUpdateToAvatarId(avId, 'completeSaleResult', [TreasureChestGlobals.NONE, 0, 0])

View file

@ -128,7 +128,6 @@ class EstateLoader(SafeZoneLoader.SafeZoneLoader):
self.sun.setScale(2) self.sun.setScale(2)
self.sun.setBillboardPointEye() self.sun.setBillboardPointEye()
if self.moon: if self.moon:
self.moon.setP(180)
self.moon.reparentTo(self.sunMoonNode) self.moon.reparentTo(self.sunMoonNode)
self.moon.setY(-270) self.moon.setY(-270)
self.moon.setScale(15) self.moon.setScale(15)

View file

@ -1,14 +1,3 @@
########################## TOONTOWN ADVENTURE ##########################
# Filename: GameSprite.py
# Created by: sillypeppymacspeed
# Date: March 28th, 2014
####
# Description:
#
# This codes the sprites for the Garden Drop estate game.
####
### DEFINITELY NOT COPIED FROM TOONTOWN HOUSE
import math import math
class GameSprite: class GameSprite:

View file

@ -33,4 +33,4 @@ newBallTime = 1.0
newBallCountUp = 0.0 newBallCountUp = 0.0
cogX = 0 cogX = 0
cogZ = 0 cogZ = 0
controlSprite = None controlSprite = None

View file

@ -1,3 +1,3 @@
TROPHY = 0 TROPHY = 0
COMPLETE = 1 COMPLETE = 1
NONE = 2 NONE = 2

View file

@ -39,7 +39,7 @@ class FriendHandle:
def uniqueName(self, idString): def uniqueName(self, idString):
return idString + '-' + str(self.getDoId()) return idString + '-' + str(self.getDoId())
def d_battleSOS(self, requesterId): def d_battleSOS(self, sendToId):
base.cr.ttuFriendsManager.d_battleSOS(self.doId) base.cr.ttuFriendsManager.d_battleSOS(self.doId)
def d_teleportQuery(self, requesterId): def d_teleportQuery(self, requesterId):

View file

@ -40,7 +40,7 @@ class CogHQAI:
if simbase.config.GetBool('want-boarding-groups', True): if simbase.config.GetBool('want-boarding-groups', True):
self.createBoardingParty() self.createBoardingParty()
self.npcs = NPCToons.createNpcsInZone(self.air, self.zoneId) self.npcs = NPCToons.createNpcsInZone(self.air, self.zoneId)
def shutdown(self): def shutdown(self):
for npc in self.npcs: for npc in self.npcs:
npc.requestDelete() npc.requestDelete()

View file

@ -13,7 +13,7 @@ from toontown.toon.ToonDNA import allColorsList
def getDustCloud(toon): def getDustCloud(toon):
dustCloud = DustCloud.DustCloud(fBillboard=0) dustCloud = DustCloud.DustCloud(fBillboard=0)
dustCloud.setBillboardAxis(2.0) dustCloud.setBillboardAxis(2.0)
dustCloud.setZ(3) dustCloud.setZ(3)
dustCloud.setScale(0.4) dustCloud.setScale(0.4)
@ -32,7 +32,7 @@ class DistributedNPCGlove(DistributedNPCToonBase):
State.State('pickColor', self.enterPickColor, self.exitPickColor, ['off']) State.State('pickColor', self.enterPickColor, self.exitPickColor, ['off'])
], 'off', 'off') ], 'off', 'off')
self.fsm.enterInitialState() self.fsm.enterInitialState()
self.title = None self.title = None
self.notice = None self.notice = None
self.color = None self.color = None
@ -41,7 +41,7 @@ class DistributedNPCGlove(DistributedNPCToonBase):
self.leftButton = None self.leftButton = None
self.rightButton = None self.rightButton = None
self.index = 0 self.index = 0
self.gui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui') self.gui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui')
self.shuffleArrowUp = self.gui.find('**/tt_t_gui_mat_shuffleArrowUp') self.shuffleArrowUp = self.gui.find('**/tt_t_gui_mat_shuffleArrowUp')
self.shuffleArrowDown = self.gui.find('**/tt_t_gui_mat_shuffleArrowDown') self.shuffleArrowDown = self.gui.find('**/tt_t_gui_mat_shuffleArrowDown')
@ -53,60 +53,60 @@ class DistributedNPCGlove(DistributedNPCToonBase):
self.destroyGui() self.destroyGui()
self.nextCollision = 0 self.nextCollision = 0
DistributedNPCToonBase.disable(self) DistributedNPCToonBase.disable(self)
def destroyGui(self): def destroyGui(self):
for element in [self.title, self.notice, self.color, self.buyButton, self.cancelButton, self.leftButton, self.rightButton]: for element in [self.title, self.notice, self.color, self.buyButton, self.cancelButton, self.leftButton, self.rightButton]:
if element: if element:
element.destroy() element.destroy()
element = None element = None
self.index = 0 self.index = 0
def createGui(self): def createGui(self):
self.title = DirectLabel(aspect2d, relief=None, text=TTLocalizer.GloveGuiTitle, self.title = DirectLabel(aspect2d, relief=None, text=TTLocalizer.GloveGuiTitle,
text_fg=(0, 1, 0, 1), text_scale=0.15, text_font=ToontownGlobals.getSignFont(), text_fg=(0, 1, 0, 1), text_scale=0.15, text_font=ToontownGlobals.getSignFont(),
pos=(0, 0, -0.30), text_shadow=(1, 1, 1, 1)) pos=(0, 0, -0.30), text_shadow=(1, 1, 1, 1))
self.notice = DirectLabel(aspect2d, relief=None, text=TTLocalizer.GloveGuiNotice % ToontownGlobals.GloveCost, self.notice = DirectLabel(aspect2d, relief=None, text=TTLocalizer.GloveGuiNotice % ToontownGlobals.GloveCost,
text_fg=(1, 0, 0, 1), text_scale=0.11, text_font=ToontownGlobals.getSignFont(), text_fg=(1, 0, 0, 1), text_scale=0.11, text_font=ToontownGlobals.getSignFont(),
pos=(0, 0, -0.45), text_shadow=(1, 1, 1, 1)) pos=(0, 0, -0.45), text_shadow=(1, 1, 1, 1))
self.color = DirectLabel(aspect2d, relief=None, text='', self.color = DirectLabel(aspect2d, relief=None, text='',
text_scale=0.11, text_font=ToontownGlobals.getSignFont(), text_scale=0.11, text_font=ToontownGlobals.getSignFont(),
pos=(0, 0, -0.70), text_shadow=(1, 1, 1, 1)) pos=(0, 0, -0.70), text_shadow=(1, 1, 1, 1))
self.buyButton = DirectButton(aspect2d, relief=None, image=(self.shuffleUp, self.shuffleDown), self.buyButton = DirectButton(aspect2d, relief=None, image=(self.shuffleUp, self.shuffleDown),
text=TTLocalizer.GloveGuiBuy, text_font=ToontownGlobals.getInterfaceFont(), text=TTLocalizer.GloveGuiBuy, text_font=ToontownGlobals.getInterfaceFont(),
text_scale=0.11, text_pos=(0, -0.02), pos=(-0.60, 0, -0.90), text_fg=(1, 1, 1, 1), text_scale=0.11, text_pos=(0, -0.02), pos=(-0.60, 0, -0.90), text_fg=(1, 1, 1, 1),
text_shadow=(0, 0, 0, 1), command=self.handleBuy) text_shadow=(0, 0, 0, 1), command=self.handleBuy)
self.cancelButton = DirectButton(aspect2d, relief=None, image=(self.shuffleUp, self.shuffleDown), self.cancelButton = DirectButton(aspect2d, relief=None, image=(self.shuffleUp, self.shuffleDown),
text=TTLocalizer.GloveGuiCancel, text_font=ToontownGlobals.getInterfaceFont(), text=TTLocalizer.GloveGuiCancel, text_font=ToontownGlobals.getInterfaceFont(),
text_scale=0.11, text_pos=(0, -0.02), pos=(0.60, 0, -0.90), text_fg=(1, 1, 1, 1), text_scale=0.11, text_pos=(0, -0.02), pos=(0.60, 0, -0.90), text_fg=(1, 1, 1, 1),
text_shadow=(0, 0, 0, 1), command=self.leave) text_shadow=(0, 0, 0, 1), command=self.leave)
self.leftButton = DirectButton(aspect2d, relief=None, image=(self.shuffleArrowUp, self.shuffleArrowDown), self.leftButton = DirectButton(aspect2d, relief=None, image=(self.shuffleArrowUp, self.shuffleArrowDown),
pos=(-0.60, 0, -0.66), command=self.handleSetIndex, extraArgs=[-1]) pos=(-0.60, 0, -0.66), command=self.handleSetIndex, extraArgs=[-1])
self.rightButton = DirectButton(aspect2d, relief=None, image=(self.shuffleArrowUp, self.shuffleArrowDown), self.rightButton = DirectButton(aspect2d, relief=None, image=(self.shuffleArrowUp, self.shuffleArrowDown),
pos=(0.60, 0, -0.66), scale=-1, command=self.handleSetIndex, extraArgs=[1]) pos=(0.60, 0, -0.66), scale=-1, command=self.handleSetIndex, extraArgs=[1])
self.updateGuiByIndex() self.updateGuiByIndex()
def handleSetIndex(self, offset): def handleSetIndex(self, offset):
newIndex = self.index + offset newIndex = self.index + offset
if newIndex > -1 and newIndex < len(TTLocalizer.NumToColor): if newIndex > -1 and newIndex < len(TTLocalizer.NumToColor):
self.index = newIndex self.index = newIndex
self.updateGuiByIndex() self.updateGuiByIndex()
def updateGuiByIndex(self): def updateGuiByIndex(self):
self.color['text'] = TTLocalizer.NumToColor[self.index] self.color['text'] = TTLocalizer.NumToColor[self.index]
self.color['text_fg'] = allColorsList[self.index] self.color['text_fg'] = allColorsList[self.index]
def handleBuy(self): def handleBuy(self):
self.d_requestTransformation(self.index) self.d_requestTransformation(self.index)
def initToonState(self): def initToonState(self):
self.setAnimState('neutral', 1.05, None, None) self.setAnimState('neutral', 1.05, None, None)
self.setPosHpr(101, -14, 4, -305, 0, 0) self.setPosHpr(101, -14, 4, -305, 0, 0)
@ -132,8 +132,8 @@ class DistributedNPCGlove(DistributedNPCToonBase):
base.cr.playGame.getPlace().setState('stopped') base.cr.playGame.getPlace().setState('stopped')
taskMgr.doMethodLater(45, self.leave, 'npcSleepTask-%s' % self.doId) taskMgr.doMethodLater(45, self.leave, 'npcSleepTask-%s' % self.doId)
self.setChatAbsolute('', CFSpeech) self.setChatAbsolute('', CFSpeech)
if base.localAvatar.getMoney() < ToontownGlobals.GloveCost: if base.localAvatar.getTotalMoney() < ToontownGlobals.GloveCost:
self.setChatAbsolute(self.getMessageById(2), CFSpeech|CFTimeout) self.setChatAbsolute(self.getMessageById(2), CFSpeech|CFTimeout)
self.reset() self.reset()
else: else:
@ -142,7 +142,7 @@ class DistributedNPCGlove(DistributedNPCToonBase):
def exitPickColor(self, task=None): def exitPickColor(self, task=None):
taskMgr.remove('npcSleepTask-%s' % self.doId) taskMgr.remove('npcSleepTask-%s' % self.doId)
taskMgr.doMethodLater(0.5, self.reset, 'avatarRecover-%s-%s' % (self.doId, base.localAvatar.doId)) taskMgr.doMethodLater(0.5, self.reset, 'avatarRecover-%s-%s' % (self.doId, base.localAvatar.doId))
if task is not None: if task is not None:
return task.done return task.done
@ -162,10 +162,10 @@ class DistributedNPCGlove(DistributedNPCToonBase):
def doTransformation(self, avId, response): def doTransformation(self, avId, response):
av = self.cr.doId2do.get(avId) av = self.cr.doId2do.get(avId)
if not av: if not av:
return return
if response == 3: if response == 3:
getDustCloud(av).start() getDustCloud(av).start()
@ -180,7 +180,7 @@ class DistributedNPCGlove(DistributedNPCToonBase):
self.setChatAbsolute('', CFSpeech) self.setChatAbsolute('', CFSpeech)
self.setChatAbsolute(TTLocalizer.GloveByeMessage, CFSpeech|CFTimeout) self.setChatAbsolute(TTLocalizer.GloveByeMessage, CFSpeech|CFTimeout)
self.reset(task) self.reset(task)
def reset(self, task=None): def reset(self, task=None):
self.fsm.request('off') self.fsm.request('off')
base.cr.playGame.getPlace().setState('walk') base.cr.playGame.getPlace().setState('walk')
@ -188,4 +188,4 @@ class DistributedNPCGlove(DistributedNPCToonBase):
self.destroyGui() self.destroyGui()
if task is not None: if task is not None:
return task.done return task.done

View file

@ -7,15 +7,15 @@ class DistributedNPCGloveAI(DistributedNPCToonBaseAI):
def requestTransformation(self, color): def requestTransformation(self, color):
avId = self.air.getAvatarIdFromSender() avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId) av = self.air.doId2do.get(avId)
if av is None or not hasattr(av, 'dna'): if av is None or not hasattr(av, 'dna'):
return return
if av.dna.gloveColor == color: if av.dna.gloveColor == color:
self.sendUpdate('doTransformation', [avId, 1]) self.sendUpdate('doTransformation', [avId, 1])
return return
if av.getMoney() < ToontownGlobals.GloveCost: if av.getTotalMoney() < ToontownGlobals.GloveCost:
self.sendUpdate('doTransformation', [avId, 2]) self.sendUpdate('doTransformation', [avId, 2])
return return
@ -24,4 +24,4 @@ class DistributedNPCGloveAI(DistributedNPCToonBaseAI):
newDNA.makeFromNetString(av.getDNAString()) newDNA.makeFromNetString(av.getDNAString())
newDNA.gloveColor = color newDNA.gloveColor = color
taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), 'transform-%d' % avId) taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), 'transform-%d' % avId)
self.sendUpdate('doTransformation', [avId, 3]) self.sendUpdate('doTransformation', [avId, 3])

View file

@ -18,7 +18,7 @@ class DistributedNPCLaffRestock(DistributedNPCToonBase):
if hasattr(self, 'dialog'): if hasattr(self, 'dialog'):
self.dialog.cleanup() self.dialog.cleanup()
del self.dialog del self.dialog
def getCollSphereRadius(self): def getCollSphereRadius(self):
return 1.0 return 1.0
@ -51,7 +51,7 @@ class DistributedNPCLaffRestock(DistributedNPCToonBase):
self.setChatAbsolute(TTLocalizer.RestockLaffCancelMessage, CFSpeech|CFTimeout) self.setChatAbsolute(TTLocalizer.RestockLaffCancelMessage, CFSpeech|CFTimeout)
self.destroyDialog() self.destroyDialog()
def restockResult(self, state, cost): def restockResult(self, state, cost):
if state == LaffRestockGlobals.NO_LAFF: if state == LaffRestockGlobals.NO_LAFF:
message = TTLocalizer.RestockFullLaffMessage message = TTLocalizer.RestockFullLaffMessage
@ -60,4 +60,4 @@ class DistributedNPCLaffRestock(DistributedNPCToonBase):
else: else:
message = TTLocalizer.RestockLaffMessage message = TTLocalizer.RestockLaffMessage
self.setChatAbsolute(message, CFSpeech|CFTimeout) self.setChatAbsolute(message, CFSpeech|CFTimeout)

View file

@ -6,22 +6,22 @@ class DistributedNPCLaffRestockAI(DistributedNPCToonBaseAI.DistributedNPCToonBas
def restock(self): def restock(self):
avId = self.air.getAvatarIdFromSender() avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId) av = self.air.doId2do.get(avId)
if not av: if not av:
return return
laff = av.getMaxHp() - av.getHp() laff = av.getMaxHp() - av.getHp()
if laff <= 0: if laff <= 0:
self.sendUpdateToAvatarId(avId, 'restockResult', [LaffRestockGlobals.NO_LAFF, 0]) self.sendUpdateToAvatarId(avId, 'restockResult', [LaffRestockGlobals.NO_LAFF, 0])
return return
cost = laff * ToontownGlobals.CostPerLaffRestock cost = laff * ToontownGlobals.CostPerLaffRestock
if cost > av.getTotalMoney(): if cost > av.getTotalMoney():
self.sendUpdateToAvatarId(avId, 'restockResult', [LaffRestockGlobals.NO_MONEY, cost]) self.sendUpdateToAvatarId(avId, 'restockResult', [LaffRestockGlobals.NO_MONEY, cost])
return return
av.takeMoney(cost) av.takeMoney(cost)
av.b_setHp(av.getMaxHp()) av.b_setHp(av.getMaxHp())
self.sendUpdateToAvatarId(avId, 'restockResult', [LaffRestockGlobals.SUCCESS, 0]) self.sendUpdateToAvatarId(avId, 'restockResult', [LaffRestockGlobals.SUCCESS, 0])

View file

@ -372,7 +372,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
self.setChatAbsolute(chatString, CFSpeech | CFTimeout) self.setChatAbsolute(chatString, CFSpeech | CFTimeout)
ResistanceChat.doEffect(msgIndex, self, nearbyToons) ResistanceChat.doEffect(msgIndex, self, nearbyToons)
def d_battleSOS(self, requesterId, sendToId): def d_battleSOS(self, sendToId):
self.cr.ttuFriendsManager.d_battleSOS(sendToId) self.cr.ttuFriendsManager.d_battleSOS(sendToId)
def battleSOS(self, requesterId): def battleSOS(self, requesterId):

View file

@ -1,3 +1,3 @@
NO_LAFF = 0 NO_LAFF = 0
NO_MONEY = 1 NO_MONEY = 1
SUCCESS = 2 SUCCESS = 2

View file

@ -20,4 +20,4 @@ FurnitureTopBitmask = BitMask32(64)
FurnitureDragBitmask = BitMask32(128) FurnitureDragBitmask = BitMask32(128)
PetLookatPetBitmask = BitMask32(256) PetLookatPetBitmask = BitMask32(256)
PetLookatNonPetBitmask = BitMask32(512) PetLookatNonPetBitmask = BitMask32(512)
BanquetTableBitmask = BitMask32(1024) BanquetTableBitmask = BitMask32(1024)

View file

@ -8444,4 +8444,4 @@ RestockFullLaffMessage = "Sorry, but you're already happy!"
RestockNoMoneyMessage = "Sorry, but you need %s jellybeans to restock your laff!" RestockNoMoneyMessage = "Sorry, but you need %s jellybeans to restock your laff!"
RestockAskMessage = "Would you like to restock %s laff for %s jellybeans?" RestockAskMessage = "Would you like to restock %s laff for %s jellybeans?"
RestockLaffMessage = "Enjoy your happiness!" RestockLaffMessage = "Enjoy your happiness!"
RestockLaffCancelMessage = "Alright. Come back here if you change your mind." RestockLaffCancelMessage = "Alright. Come back here if you change your mind."

View file

@ -1638,4 +1638,4 @@ PropIdToColor = [
BugReportSite = 'https://bugs.launchpad.net/toontown-united/+filebug' BugReportSite = 'https://bugs.launchpad.net/toontown-united/+filebug'
TreasureChestSphereRadius = 1.0 TreasureChestSphereRadius = 1.0
CostPerLaffRestock = 3 CostPerLaffRestock = 3