mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 11:42:39 -06:00
File cleanup and some fixes.
This commit is contained in:
parent
85406a5a52
commit
267310adc7
22 changed files with 160 additions and 180 deletions
|
@ -17,7 +17,7 @@ def doSOSs(calls):
|
|||
|
||||
def callerFunc(toon, handle):
|
||||
toon.setChatAbsolute(TTLocalizer.MovieSOSCallHelp % handle.getName(), CFSpeech | CFTimeout)
|
||||
handle.d_battleSOS(base.localAvatar.doId)
|
||||
handle.d_battleSOS(handle.doId)
|
||||
|
||||
def calleeFunc(toon, handle):
|
||||
toon.setChatAbsolute(TTLocalizer.MovieSOSCallHelp % handle.getName(), CFSpeech | CFTimeout)
|
||||
|
|
|
@ -29,27 +29,27 @@ WhisperColors = {
|
|||
((0.0, 0.0, 0.0, 1.0), (0.2, 0.7, 0.8, 0.6)) # Disabled
|
||||
),
|
||||
WTSystem: (
|
||||
((0.0, 0.0, 0.0, 1.0), (0.8, 0.1, 0.1, 0.6)), # Normal
|
||||
((1.0, 0.5, 0.5, 1.0), (0.8, 0.1, 0.1, 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.8, 0.6)) # Disabled
|
||||
((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), (1.0, 1.0, 1.0, 0.8)), # Click
|
||||
((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.8, 0.3, 0.6, 0.6)) # Disabled
|
||||
),
|
||||
WTBattleSOS: (
|
||||
((0.0, 0.0, 0.0, 1.0), (0.8, 0.1, 0.1, 0.6)), # Normal
|
||||
((1.0, 0.5, 0.5, 1.0), (0.8, 0.1, 0.1, 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.6, 0.8, 0.6)), # Normal
|
||||
((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.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
|
||||
),
|
||||
WTEmote: (
|
||||
((0.0, 0.0, 0.0, 1.0), (0.8, 0.1, 0.1, 0.6)), # Normal
|
||||
((1.0, 0.5, 0.5, 1.0), (0.8, 0.1, 0.1, 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.8, 0.6)) # Disabled
|
||||
((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.2, 0.7, 0.41, 0.8)), # Click
|
||||
((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.1, 0.6, 0.41, 0.6)) # Disabled
|
||||
),
|
||||
WTToontownBoardingGroup: (
|
||||
((0.0, 0.0, 0.0, 1.0), (0.9, 0.4, 0.05, 0.6)), # Normal
|
||||
((1.0, 0.5, 0.5, 1.0), (1.0, 0.5, 0.2, 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.5, 0.1, 0.6)), # Normal
|
||||
((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.6, 0.2, 0.6)), # Rollover
|
||||
((0.0, 0.0, 0.0, 1.0), (0.9, 0.6, 0.1, 0.6)) # Disabled
|
||||
),
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ class FireworkShowMixin:
|
|||
else:
|
||||
FireworkShowMixin.notify.warning('Invalid fireworks event ID: %d' % eventId)
|
||||
return None
|
||||
|
||||
|
||||
self.showMusic = loader.loadMusic(musicFile)
|
||||
self.showMusic.setVolume(1)
|
||||
|
||||
|
@ -157,7 +157,7 @@ class FireworkShowMixin:
|
|||
else:
|
||||
FireworkShowMixin.notify.warning('Invalid fireworks event ID: %d' % eventId)
|
||||
return None
|
||||
|
||||
|
||||
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))
|
||||
if self.restorePlaygroundMusic:
|
||||
|
|
|
@ -17,7 +17,7 @@ class Rental:
|
|||
def __init__(self, estate):
|
||||
self.estate = estate
|
||||
self.objects = set()
|
||||
|
||||
|
||||
def destroy(self):
|
||||
del self.estate
|
||||
for object in self.objects:
|
||||
|
@ -25,12 +25,12 @@ class Rental:
|
|||
object.requestDelete()
|
||||
taskMgr.remove(object.uniqueName('delete'))
|
||||
self.objects = set()
|
||||
|
||||
|
||||
class CannonRental(Rental):
|
||||
def generateObjects(self):
|
||||
target = DistributedTargetAI(self.estate.air)
|
||||
target.generateWithRequired(self.estate.zoneId)
|
||||
|
||||
|
||||
for drop in CannonGlobals.cannonDrops:
|
||||
cannon = DistributedCannonAI(self.estate.air)
|
||||
cannon.setEstateId(self.estate.doId)
|
||||
|
@ -38,18 +38,18 @@ class CannonRental(Rental):
|
|||
cannon.setPosHpr(*drop)
|
||||
cannon.generateWithRequired(self.estate.zoneId)
|
||||
self.objects.add(cannon)
|
||||
|
||||
|
||||
self.generateTreasures()
|
||||
self.estate.b_setClouds(1)
|
||||
|
||||
|
||||
def destroy(self):
|
||||
self.estate.b_setClouds(0)
|
||||
Rental.destroy(self)
|
||||
|
||||
|
||||
def generateTreasures(self):
|
||||
doIds = []
|
||||
z = 35
|
||||
|
||||
|
||||
for i in xrange(20):
|
||||
x = random.randint(100, 300) - 200
|
||||
y = random.randint(100, 300) - 200
|
||||
|
@ -57,21 +57,20 @@ class CannonRental(Rental):
|
|||
treasure.generateWithRequired(self.estate.zoneId)
|
||||
self.objects.add(treasure)
|
||||
doIds.append(treasure.doId)
|
||||
|
||||
|
||||
self.estate.sendUpdate("setTreasureIds", [doIds])
|
||||
|
||||
|
||||
def grabAttempt(self, avId, treasureId):
|
||||
av = self.estate.air.doId2do.get(avId)
|
||||
if av == None:
|
||||
self.estate.air.writeServerEvent('suspicious', avId, 'TreasurePlannerAI.grabAttempt unknown avatar')
|
||||
self.estate.notify.warning('avid: %s does not exist' % avId)
|
||||
return
|
||||
|
||||
|
||||
treasure = self.estate.air.doId2do.get(treasureId)
|
||||
if self.validAvatar(av):
|
||||
treasure.d_setGrab(avId)
|
||||
self.deleteTreasureSoon(treasure)
|
||||
|
||||
else:
|
||||
treasure.d_setReject()
|
||||
|
||||
|
@ -81,11 +80,11 @@ class CannonRental(Rental):
|
|||
|
||||
def __deleteTreasureNow(self, treasure, taskName):
|
||||
treasure.requestDelete()
|
||||
|
||||
|
||||
def validAvatar(self, av):
|
||||
if av.getMaxHp() == av.getHp():
|
||||
return 0
|
||||
|
||||
|
||||
av.toonUp(3)
|
||||
return 1
|
||||
|
||||
|
@ -116,28 +115,25 @@ class DistributedEstateAI(DistributedObjectAI):
|
|||
self.rentalHandle = None
|
||||
self.rentalTimestamp = 0
|
||||
self.houses = [None] * 6
|
||||
|
||||
self.pond = None
|
||||
self.spots = []
|
||||
|
||||
self.targets = []
|
||||
|
||||
self.owner = None
|
||||
|
||||
|
||||
def generate(self):
|
||||
DistributedObjectAI.generate(self)
|
||||
|
||||
|
||||
self.pond = DistributedFishingPondAI(simbase.air)
|
||||
self.pond.setArea(ToontownGlobals.MyEstate)
|
||||
self.pond.generateWithRequired(self.zoneId)
|
||||
|
||||
|
||||
for i in xrange(FishingTargetGlobals.getNumTargets(ToontownGlobals.MyEstate)):
|
||||
target = DistributedFishingTargetAI(self.air)
|
||||
target.setPondDoId(self.pond.getDoId())
|
||||
target.generateWithRequired(self.zoneId)
|
||||
self.targets.append(target)
|
||||
|
||||
|
||||
spot = DistributedFishingSpotAI(self.air)
|
||||
spot.setPondDoId(self.pond.getDoId())
|
||||
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.generateWithRequired(self.zoneId)
|
||||
|
||||
self.createTreasurePlanner()
|
||||
|
||||
self.createTreasurePlanner()
|
||||
|
||||
def destroy(self):
|
||||
for house in self.houses:
|
||||
|
@ -186,7 +181,7 @@ class DistributedEstateAI(DistributedObjectAI):
|
|||
if self.rentalHandle:
|
||||
self.rentalHandle.destroy()
|
||||
self.rentalHandle = None
|
||||
|
||||
|
||||
if self.treasureChest:
|
||||
self.treasureChest.requestDelete()
|
||||
|
||||
|
@ -197,13 +192,13 @@ class DistributedEstateAI(DistributedObjectAI):
|
|||
|
||||
def setClientReady(self):
|
||||
self.sendUpdate('setEstateReady', [])
|
||||
|
||||
|
||||
def setClosestHouse(self, todo0):
|
||||
pass
|
||||
|
||||
def setTreasureIds(self, todo0):
|
||||
pass
|
||||
|
||||
|
||||
def createTreasurePlanner(self):
|
||||
treasureType, healAmount, spawnPoints, spawnRate, maxTreasures = TreasureGlobals.SafeZoneTreasureSpawns[ToontownGlobals.MyEstate]
|
||||
self.treasurePlanner = SZTreasurePlannerAI(self.zoneId, treasureType, healAmount, spawnPoints, spawnRate, maxTreasures)
|
||||
|
@ -218,14 +213,14 @@ class DistributedEstateAI(DistributedObjectAI):
|
|||
|
||||
def setDawnTime(self, dawnTime):
|
||||
self.dawnTime = dawnTime
|
||||
|
||||
|
||||
def d_setDawnTime(self, dawnTime):
|
||||
self.sendUpdate('setDawnTime', [dawnTime])
|
||||
|
||||
|
||||
def b_setDawnTime(self, dawnTime):
|
||||
self.setDawnTime(dawnTime)
|
||||
self.d_setDawnTime(dawnTime)
|
||||
|
||||
|
||||
def getDawnTime(self):
|
||||
return self.dawnTime
|
||||
|
||||
|
@ -234,86 +229,83 @@ class DistributedEstateAI(DistributedObjectAI):
|
|||
|
||||
def setDecorData(self, decorData):
|
||||
self.decorData = decorData
|
||||
|
||||
|
||||
def d_setDecorData(self, decorData):
|
||||
self.sendUpdate('setDecorData', [decorData])
|
||||
|
||||
|
||||
def b_setDecorData(self, decorData):
|
||||
self.setDecorData(decorData)
|
||||
self.d_setDecorData(decorData)
|
||||
|
||||
|
||||
def getDecorData(self):
|
||||
return self.decorData
|
||||
|
||||
def setLastEpochTimeStamp(self, last): #how do I do this
|
||||
def setLastEpochTimeStamp(self, last):
|
||||
self.lastEpochTimestamp = last
|
||||
|
||||
|
||||
def d_setLastEpochTimeStamp(self, last):
|
||||
self.sendUpdate('setLastEpochTimeStamp', [last])
|
||||
|
||||
|
||||
def b_setLastEpochTimeStamp(self, last):
|
||||
self.setLastEpochTimeStamp(last)
|
||||
self.d_setLastEpochTimeStamp(last)
|
||||
|
||||
|
||||
def getLastEpochTimeStamp(self):
|
||||
return self.lastEpochTimestamp
|
||||
|
||||
def setRentalTimeStamp(self, rental):
|
||||
self.rentalTimestamp = rental
|
||||
|
||||
|
||||
def d_setRentalTimeStamp(self, rental):
|
||||
self.sendUpdate('setRentalTimeStamp', [rental])
|
||||
|
||||
|
||||
def b_setRentalTimeStamp(self, rental):
|
||||
self.setRentalTimeStamp(rental)
|
||||
self.d_setRentalTimeStamp(rental)
|
||||
|
||||
|
||||
def getRentalTimeStamp(self):
|
||||
return self.rentalTimestamp
|
||||
|
||||
def b_setRentalType(self, type):
|
||||
self.d_setRentalType(type)
|
||||
self.setRentalType(type)
|
||||
|
||||
|
||||
def d_setRentalType(self, type):
|
||||
self.sendUpdate("setRentalType", [type])
|
||||
|
||||
|
||||
def setRentalType(self, type):
|
||||
expirestamp = self.getRentalTimeStamp()
|
||||
if expirestamp == 0:
|
||||
expire = 0
|
||||
|
||||
else:
|
||||
expire = int(expirestamp - time.time())
|
||||
|
||||
|
||||
if expire < 0:
|
||||
self.rentalType = 0
|
||||
self.d_setRentalType(0)
|
||||
self.b_setRentalTimeStamp(0)
|
||||
|
||||
else:
|
||||
if self.rentalType == type:
|
||||
return
|
||||
|
||||
|
||||
self.rentalType = type
|
||||
if self.rentalHandle:
|
||||
self.rentalHandle.destroy()
|
||||
self.rentalHandle = None
|
||||
|
||||
|
||||
if self.rentalType == ToontownGlobals.RentalCannon:
|
||||
self.rentalHandle = CannonRental(self)
|
||||
elif self.rentalType == ToontownGlobals.RentalGameTable:
|
||||
self.rentalHandle = TableRental(self)
|
||||
|
||||
else:
|
||||
self.notify.warning('Unknown rental %s' % self.rentalType)
|
||||
return
|
||||
|
||||
|
||||
self.rentalHandle.generateObjects()
|
||||
|
||||
|
||||
def getRentalType(self):
|
||||
return self.rentalType
|
||||
|
||||
|
||||
def rentItem(self, rentType, duration):
|
||||
self.rentalType = rentType
|
||||
self.b_setRentalTimeStamp(time.time() + duration * 60)
|
||||
|
@ -321,14 +313,14 @@ class DistributedEstateAI(DistributedObjectAI):
|
|||
|
||||
def setSlot0ToonId(self, id):
|
||||
self.toons[0] = id
|
||||
|
||||
|
||||
def d_setSlot0ToonId(self, id):
|
||||
self.sendUpdate('setSlot0ToonId', [id])
|
||||
|
||||
|
||||
def b_setSlot0ToonId(self, id):
|
||||
self.setSlot0ToonId(id)
|
||||
self.d_setSlot0ToonId(id)
|
||||
|
||||
|
||||
def getSlot0ToonId(self):
|
||||
return self.toons[0]
|
||||
|
||||
|
@ -337,37 +329,37 @@ class DistributedEstateAI(DistributedObjectAI):
|
|||
|
||||
def d_setSlot0Items(self, items):
|
||||
self.sendUpdate('setSlot5Items', [items])
|
||||
|
||||
|
||||
def b_setSlot0Items(self, items):
|
||||
self.setSlot0Items(items)
|
||||
self.d_setSlot0Items(items)
|
||||
|
||||
|
||||
def getSlot0Items(self):
|
||||
return self.items[0]
|
||||
|
||||
|
||||
def setSlot1ToonId(self, id):
|
||||
self.toons[1] = id
|
||||
|
||||
def d_setSlot1ToonId(self, id):
|
||||
self.sendUpdate('setSlot1ToonId', [id])
|
||||
|
||||
|
||||
def b_setSlot1ToonId(self, id):
|
||||
self.setSlot1ToonId(id)
|
||||
self.d_setSlot1ToonId(id)
|
||||
|
||||
|
||||
def getSlot1ToonId(self):
|
||||
return self.toons[1]
|
||||
|
||||
|
||||
def setSlot1Items(self, items):
|
||||
self.items[1] = items
|
||||
|
||||
|
||||
def d_setSlot1Items(self, items):
|
||||
self.sendUpdate('setSlot2Items', [items])
|
||||
|
||||
|
||||
def b_setSlot1Items(self, items):
|
||||
self.setSlot2Items(items)
|
||||
self.d_setSlot2Items(items)
|
||||
|
||||
|
||||
def getSlot1Items(self):
|
||||
return self.items[1]
|
||||
|
||||
|
@ -376,11 +368,11 @@ class DistributedEstateAI(DistributedObjectAI):
|
|||
|
||||
def d_setSlot2ToonId(self, id):
|
||||
self.sendUpdate('setSlot2ToonId', [id])
|
||||
|
||||
|
||||
def b_setSlot2ToonId(self, id):
|
||||
self.setSlot2ToonId(id)
|
||||
self.d_setSlot2ToonId(id)
|
||||
|
||||
|
||||
def getSlot2ToonId(self):
|
||||
return self.toons[2]
|
||||
|
||||
|
@ -389,90 +381,89 @@ class DistributedEstateAI(DistributedObjectAI):
|
|||
|
||||
def d_setSlot2Items(self, items):
|
||||
self.sendUpdate('setSlot2Items', [items])
|
||||
|
||||
|
||||
def b_setSlot2Items(self, items):
|
||||
self.setSlot2Items(items)
|
||||
self.d_setSlot2Items(items)
|
||||
|
||||
|
||||
def getSlot2Items(self):
|
||||
return self.items[2]
|
||||
|
||||
def setSlot3ToonId(self, id):
|
||||
self.toons[3] = id
|
||||
|
||||
|
||||
def d_setSlot3ToonId(self, id):
|
||||
self.sendUpdate('setSlot3ToonId', [id])
|
||||
|
||||
|
||||
def b_setSlot3ToonId(self, id):
|
||||
self.setSlot3ToonId(id)
|
||||
self.d_setSlot3ToonId(id)
|
||||
|
||||
|
||||
def getSlot3ToonId(self):
|
||||
return self.toons[3]
|
||||
|
||||
def setSlot3Items(self, items):
|
||||
self.items[3] = items
|
||||
|
||||
|
||||
def d_setSlot3Items(self, items):
|
||||
self.sendUpdate('setSlot3Items', [items])
|
||||
|
||||
|
||||
def b_setSlot3Items(self, items):
|
||||
self.setSlot3Items(items)
|
||||
self.d_setSlot3Items(items)
|
||||
|
||||
|
||||
def getSlot3Items(self):
|
||||
return self.items[3]
|
||||
|
||||
def setSlot4ToonId(self, id):
|
||||
self.toons[4] = id
|
||||
|
||||
|
||||
def d_setSlot4ToonId(self, id):
|
||||
self.sendUpdate('setSlot4ToonId', [id])
|
||||
|
||||
|
||||
def b_setSlot5ToonId(self, id):
|
||||
self.setSlot4ToonId(id)
|
||||
self.d_setSlot4ToonId(id)
|
||||
|
||||
|
||||
def getSlot4ToonId(self):
|
||||
return self.toons[4]
|
||||
|
||||
|
||||
def setSlot4Items(self, items):
|
||||
self.items[4] = items
|
||||
|
||||
|
||||
def d_setSlot4Items(self, items):
|
||||
self.sendUpdate('setSlot4Items', [items])
|
||||
|
||||
|
||||
def b_setSlot4Items(self, items):
|
||||
self.setSlot4Items(items)
|
||||
self.d_setSlot4Items(items)
|
||||
|
||||
|
||||
def getSlot4Items(self):
|
||||
return self.items[4]
|
||||
|
||||
def setSlot5ToonId(self, id):
|
||||
self.toons[5] = id
|
||||
|
||||
|
||||
def d_setSlot5ToonId(self, id):
|
||||
self.sendUpdate('setSlot5ToonId', [id])
|
||||
|
||||
|
||||
def b_setSlot5ToonId(self, id):
|
||||
self.setSlot5ToonId(id)
|
||||
self.d_setSlot5ToonId(id)
|
||||
|
||||
|
||||
def getSlot5ToonId(self):
|
||||
return self.toons[5]
|
||||
|
||||
def setSlot5Items(self, items):
|
||||
self.items[5] = items
|
||||
|
||||
|
||||
def d_setSlot5Items(self, items):
|
||||
self.sendUpdate('setSlot5Items', [items])
|
||||
|
||||
|
||||
def b_setSlot5Items(self, items):
|
||||
self.setSlot5Items(items)
|
||||
self.d_setSlot5Items(items)
|
||||
|
||||
|
||||
def getSlot5Items(self):
|
||||
return self.items[5]
|
||||
|
||||
|
@ -481,14 +472,14 @@ class DistributedEstateAI(DistributedObjectAI):
|
|||
if i >= 6:
|
||||
return
|
||||
self.toons[i] = idList[i]
|
||||
|
||||
|
||||
def d_setIdList(self, idList):
|
||||
self.sendUpdate('setIdList', [idList])
|
||||
|
||||
|
||||
def b_setIdList(self, idList):
|
||||
self.setIdList(idList)
|
||||
self.d_setIdLst(idList)
|
||||
|
||||
|
||||
def completeFlowerSale(self, todo0):
|
||||
pass
|
||||
|
||||
|
@ -497,14 +488,14 @@ class DistributedEstateAI(DistributedObjectAI):
|
|||
|
||||
def setClouds(self, clouds):
|
||||
self.cloudType = clouds
|
||||
|
||||
|
||||
def d_setClouds(self, clouds):
|
||||
self.sendUpdate('setClouds', [clouds])
|
||||
|
||||
|
||||
def b_setClouds(self, clouds):
|
||||
self.setClouds(clouds)
|
||||
self.d_setClouds(clouds)
|
||||
|
||||
|
||||
def getClouds(self):
|
||||
return self.cloudType
|
||||
|
||||
|
|
|
@ -44,7 +44,8 @@ class DistributedTarget(DistributedObject.DistributedObject):
|
|||
|
||||
def load(self):
|
||||
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.geom = loader.loadModel('phase_5.5/models/estate/target')
|
||||
self.geom.reparentTo(base.cr.playGame.hood.loader.geom)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
from direct.distributed import DistributedObject
|
||||
from direct.distributed.DistributedObject import DistributedObject
|
||||
from pandac.PandaModules import *
|
||||
from toontown.fishing import FishSellGUI
|
||||
from toontown.toonbase import ToontownGlobals, TTLocalizer
|
||||
import TreasureChestGlobals
|
||||
|
||||
class DistributedTreasureChest(DistributedObject.DistributedObject):
|
||||
class DistributedTreasureChest(DistributedObject):
|
||||
|
||||
def __init__(self, cr):
|
||||
DistributedObject.DistributedObject.__init__(self, cr)
|
||||
DistributedObject.__init__(self, cr)
|
||||
self.cr = cr
|
||||
self.createModel(45, -165.75, 0.025, 30)
|
||||
self.initCollisions()
|
||||
|
@ -21,7 +21,7 @@ class DistributedTreasureChest(DistributedObject.DistributedObject):
|
|||
del self.cSphereNode
|
||||
del self.cSphereNodePath
|
||||
del self.model
|
||||
DistributedObject.DistributedObject.delete(self)
|
||||
DistributedObject.delete(self)
|
||||
|
||||
def destroyFishGui(self):
|
||||
self.ignore('treasureChestSell')
|
||||
|
@ -46,7 +46,7 @@ class DistributedTreasureChest(DistributedObject.DistributedObject):
|
|||
self.cSphereNodePath.hide()
|
||||
self.cSphereNode.setCollideMask(ToontownGlobals.WallBitmask)
|
||||
self.accept('enter' + self.cSphereNode.getName(), self.handleCollisionSphereEnter)
|
||||
|
||||
|
||||
def handleCollisionSphereEnter(self, collEntry):
|
||||
if not base.localAvatar.fishTank.getFish():
|
||||
base.localAvatar.setSystemMessage(0, TTLocalizer.STOREOWNER_NOFISH)
|
||||
|
@ -56,17 +56,17 @@ class DistributedTreasureChest(DistributedObject.DistributedObject):
|
|||
base.cr.playGame.getPlace().setState('stopped')
|
||||
self.acceptOnce('treasureChestSell', self.handleSaleDone)
|
||||
self.fishGui = FishSellGUI.FishSellGUI('treasureChestSell')
|
||||
|
||||
|
||||
def handleSaleDone(self, sell):
|
||||
self.destroyFishGui()
|
||||
base.setCellsActive(base.bottomCells, 1)
|
||||
base.cr.playGame.getPlace().setState('walk')
|
||||
self.sendUpdate('completeSale', [sell])
|
||||
|
||||
|
||||
def completeSaleResult(self, state, numFish, maxFish):
|
||||
if state == TreasureChestGlobals.TROPHY:
|
||||
base.localAvatar.setSystemMessage(0, TTLocalizer.STOREOWNER_TROPHY % (numFish, maxFish))
|
||||
elif state == TreasureChestGlobals.COMPLETE:
|
||||
base.localAvatar.setSystemMessage(0, TTLocalizer.STOREOWNER_THANKSFISH)
|
||||
elif state == TreasureChestGlobals.NONE:
|
||||
base.localAvatar.setSystemMessage(0, TTLocalizer.STOREOWNER_NOFISH)
|
||||
base.localAvatar.setSystemMessage(0, TTLocalizer.STOREOWNER_NOFISH)
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
from direct.distributed import DistributedObjectAI
|
||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||
from toontown.fishing import FishGlobals
|
||||
import TreasureChestGlobals
|
||||
|
||||
class DistributedTreasureChestAI(DistributedObjectAI.DistributedObjectAI):
|
||||
class DistributedTreasureChestAI(DistributedObjectAI):
|
||||
|
||||
def completeSale(self, sell):
|
||||
avId = self.air.getAvatarIdFromSender()
|
||||
av = self.air.doId2do.get(avId)
|
||||
|
||||
|
||||
if not av:
|
||||
return
|
||||
|
||||
|
||||
if sell:
|
||||
trophyResult = self.air.fishManager.creditFishTank(av)
|
||||
|
||||
|
||||
if trophyResult:
|
||||
self.sendUpdateToAvatarId(avId, 'completeSaleResult', [TreasureChestGlobals.TROPHY, len(av.fishCollection), FishGlobals.getTotalNumFish()])
|
||||
else:
|
||||
self.sendUpdateToAvatarId(avId, 'completeSaleResult', [TreasureChestGlobals.COMPLETE, 0, 0])
|
||||
else:
|
||||
self.sendUpdateToAvatarId(avId, 'completeSaleResult', [TreasureChestGlobals.NONE, 0, 0])
|
||||
self.sendUpdateToAvatarId(avId, 'completeSaleResult', [TreasureChestGlobals.NONE, 0, 0])
|
||||
|
|
|
@ -128,7 +128,6 @@ class EstateLoader(SafeZoneLoader.SafeZoneLoader):
|
|||
self.sun.setScale(2)
|
||||
self.sun.setBillboardPointEye()
|
||||
if self.moon:
|
||||
self.moon.setP(180)
|
||||
self.moon.reparentTo(self.sunMoonNode)
|
||||
self.moon.setY(-270)
|
||||
self.moon.setScale(15)
|
||||
|
|
|
@ -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
|
||||
|
||||
class GameSprite:
|
||||
|
|
|
@ -33,4 +33,4 @@ newBallTime = 1.0
|
|||
newBallCountUp = 0.0
|
||||
cogX = 0
|
||||
cogZ = 0
|
||||
controlSprite = None
|
||||
controlSprite = None
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TROPHY = 0
|
||||
COMPLETE = 1
|
||||
NONE = 2
|
||||
NONE = 2
|
||||
|
|
|
@ -39,7 +39,7 @@ class FriendHandle:
|
|||
def uniqueName(self, idString):
|
||||
return idString + '-' + str(self.getDoId())
|
||||
|
||||
def d_battleSOS(self, requesterId):
|
||||
def d_battleSOS(self, sendToId):
|
||||
base.cr.ttuFriendsManager.d_battleSOS(self.doId)
|
||||
|
||||
def d_teleportQuery(self, requesterId):
|
||||
|
|
|
@ -40,7 +40,7 @@ class CogHQAI:
|
|||
if simbase.config.GetBool('want-boarding-groups', True):
|
||||
self.createBoardingParty()
|
||||
self.npcs = NPCToons.createNpcsInZone(self.air, self.zoneId)
|
||||
|
||||
|
||||
def shutdown(self):
|
||||
for npc in self.npcs:
|
||||
npc.requestDelete()
|
||||
|
|
|
@ -13,7 +13,7 @@ from toontown.toon.ToonDNA import allColorsList
|
|||
|
||||
def getDustCloud(toon):
|
||||
dustCloud = DustCloud.DustCloud(fBillboard=0)
|
||||
|
||||
|
||||
dustCloud.setBillboardAxis(2.0)
|
||||
dustCloud.setZ(3)
|
||||
dustCloud.setScale(0.4)
|
||||
|
@ -32,7 +32,7 @@ class DistributedNPCGlove(DistributedNPCToonBase):
|
|||
State.State('pickColor', self.enterPickColor, self.exitPickColor, ['off'])
|
||||
], 'off', 'off')
|
||||
self.fsm.enterInitialState()
|
||||
|
||||
|
||||
self.title = None
|
||||
self.notice = None
|
||||
self.color = None
|
||||
|
@ -41,7 +41,7 @@ class DistributedNPCGlove(DistributedNPCToonBase):
|
|||
self.leftButton = None
|
||||
self.rightButton = None
|
||||
self.index = 0
|
||||
|
||||
|
||||
self.gui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui')
|
||||
self.shuffleArrowUp = self.gui.find('**/tt_t_gui_mat_shuffleArrowUp')
|
||||
self.shuffleArrowDown = self.gui.find('**/tt_t_gui_mat_shuffleArrowDown')
|
||||
|
@ -53,60 +53,60 @@ class DistributedNPCGlove(DistributedNPCToonBase):
|
|||
self.destroyGui()
|
||||
self.nextCollision = 0
|
||||
DistributedNPCToonBase.disable(self)
|
||||
|
||||
|
||||
def destroyGui(self):
|
||||
for element in [self.title, self.notice, self.color, self.buyButton, self.cancelButton, self.leftButton, self.rightButton]:
|
||||
if element:
|
||||
element.destroy()
|
||||
element = None
|
||||
|
||||
|
||||
self.index = 0
|
||||
|
||||
|
||||
def createGui(self):
|
||||
self.title = DirectLabel(aspect2d, relief=None, text=TTLocalizer.GloveGuiTitle,
|
||||
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))
|
||||
|
||||
|
||||
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(),
|
||||
pos=(0, 0, -0.45), text_shadow=(1, 1, 1, 1))
|
||||
|
||||
|
||||
self.color = DirectLabel(aspect2d, relief=None, text='',
|
||||
text_scale=0.11, text_font=ToontownGlobals.getSignFont(),
|
||||
pos=(0, 0, -0.70), text_shadow=(1, 1, 1, 1))
|
||||
|
||||
|
||||
self.buyButton = DirectButton(aspect2d, relief=None, image=(self.shuffleUp, self.shuffleDown),
|
||||
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_shadow=(0, 0, 0, 1), command=self.handleBuy)
|
||||
|
||||
|
||||
self.cancelButton = DirectButton(aspect2d, relief=None, image=(self.shuffleUp, self.shuffleDown),
|
||||
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_shadow=(0, 0, 0, 1), command=self.leave)
|
||||
|
||||
|
||||
self.leftButton = DirectButton(aspect2d, relief=None, image=(self.shuffleArrowUp, self.shuffleArrowDown),
|
||||
pos=(-0.60, 0, -0.66), command=self.handleSetIndex, extraArgs=[-1])
|
||||
|
||||
self.rightButton = DirectButton(aspect2d, relief=None, image=(self.shuffleArrowUp, self.shuffleArrowDown),
|
||||
pos=(0.60, 0, -0.66), scale=-1, command=self.handleSetIndex, extraArgs=[1])
|
||||
|
||||
|
||||
self.updateGuiByIndex()
|
||||
|
||||
def handleSetIndex(self, offset):
|
||||
newIndex = self.index + offset
|
||||
|
||||
|
||||
if newIndex > -1 and newIndex < len(TTLocalizer.NumToColor):
|
||||
self.index = newIndex
|
||||
self.updateGuiByIndex()
|
||||
|
||||
|
||||
def updateGuiByIndex(self):
|
||||
self.color['text'] = TTLocalizer.NumToColor[self.index]
|
||||
self.color['text_fg'] = allColorsList[self.index]
|
||||
|
||||
|
||||
def handleBuy(self):
|
||||
self.d_requestTransformation(self.index)
|
||||
|
||||
|
||||
def initToonState(self):
|
||||
self.setAnimState('neutral', 1.05, None, None)
|
||||
self.setPosHpr(101, -14, 4, -305, 0, 0)
|
||||
|
@ -132,8 +132,8 @@ class DistributedNPCGlove(DistributedNPCToonBase):
|
|||
base.cr.playGame.getPlace().setState('stopped')
|
||||
taskMgr.doMethodLater(45, self.leave, 'npcSleepTask-%s' % self.doId)
|
||||
self.setChatAbsolute('', CFSpeech)
|
||||
|
||||
if base.localAvatar.getMoney() < ToontownGlobals.GloveCost:
|
||||
|
||||
if base.localAvatar.getTotalMoney() < ToontownGlobals.GloveCost:
|
||||
self.setChatAbsolute(self.getMessageById(2), CFSpeech|CFTimeout)
|
||||
self.reset()
|
||||
else:
|
||||
|
@ -142,7 +142,7 @@ class DistributedNPCGlove(DistributedNPCToonBase):
|
|||
def exitPickColor(self, task=None):
|
||||
taskMgr.remove('npcSleepTask-%s' % self.doId)
|
||||
taskMgr.doMethodLater(0.5, self.reset, 'avatarRecover-%s-%s' % (self.doId, base.localAvatar.doId))
|
||||
|
||||
|
||||
if task is not None:
|
||||
return task.done
|
||||
|
||||
|
@ -162,10 +162,10 @@ class DistributedNPCGlove(DistributedNPCToonBase):
|
|||
|
||||
def doTransformation(self, avId, response):
|
||||
av = self.cr.doId2do.get(avId)
|
||||
|
||||
|
||||
if not av:
|
||||
return
|
||||
|
||||
|
||||
if response == 3:
|
||||
getDustCloud(av).start()
|
||||
|
||||
|
@ -180,7 +180,7 @@ class DistributedNPCGlove(DistributedNPCToonBase):
|
|||
self.setChatAbsolute('', CFSpeech)
|
||||
self.setChatAbsolute(TTLocalizer.GloveByeMessage, CFSpeech|CFTimeout)
|
||||
self.reset(task)
|
||||
|
||||
|
||||
def reset(self, task=None):
|
||||
self.fsm.request('off')
|
||||
base.cr.playGame.getPlace().setState('walk')
|
||||
|
@ -188,4 +188,4 @@ class DistributedNPCGlove(DistributedNPCToonBase):
|
|||
self.destroyGui()
|
||||
|
||||
if task is not None:
|
||||
return task.done
|
||||
return task.done
|
||||
|
|
|
@ -7,15 +7,15 @@ class DistributedNPCGloveAI(DistributedNPCToonBaseAI):
|
|||
def requestTransformation(self, color):
|
||||
avId = self.air.getAvatarIdFromSender()
|
||||
av = self.air.doId2do.get(avId)
|
||||
|
||||
|
||||
if av is None or not hasattr(av, 'dna'):
|
||||
return
|
||||
|
||||
|
||||
if av.dna.gloveColor == color:
|
||||
self.sendUpdate('doTransformation', [avId, 1])
|
||||
return
|
||||
|
||||
if av.getMoney() < ToontownGlobals.GloveCost:
|
||||
|
||||
if av.getTotalMoney() < ToontownGlobals.GloveCost:
|
||||
self.sendUpdate('doTransformation', [avId, 2])
|
||||
return
|
||||
|
||||
|
@ -24,4 +24,4 @@ class DistributedNPCGloveAI(DistributedNPCToonBaseAI):
|
|||
newDNA.makeFromNetString(av.getDNAString())
|
||||
newDNA.gloveColor = color
|
||||
taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), 'transform-%d' % avId)
|
||||
self.sendUpdate('doTransformation', [avId, 3])
|
||||
self.sendUpdate('doTransformation', [avId, 3])
|
||||
|
|
|
@ -18,7 +18,7 @@ class DistributedNPCLaffRestock(DistributedNPCToonBase):
|
|||
if hasattr(self, 'dialog'):
|
||||
self.dialog.cleanup()
|
||||
del self.dialog
|
||||
|
||||
|
||||
def getCollSphereRadius(self):
|
||||
return 1.0
|
||||
|
||||
|
@ -51,7 +51,7 @@ class DistributedNPCLaffRestock(DistributedNPCToonBase):
|
|||
self.setChatAbsolute(TTLocalizer.RestockLaffCancelMessage, CFSpeech|CFTimeout)
|
||||
|
||||
self.destroyDialog()
|
||||
|
||||
|
||||
def restockResult(self, state, cost):
|
||||
if state == LaffRestockGlobals.NO_LAFF:
|
||||
message = TTLocalizer.RestockFullLaffMessage
|
||||
|
@ -60,4 +60,4 @@ class DistributedNPCLaffRestock(DistributedNPCToonBase):
|
|||
else:
|
||||
message = TTLocalizer.RestockLaffMessage
|
||||
|
||||
self.setChatAbsolute(message, CFSpeech|CFTimeout)
|
||||
self.setChatAbsolute(message, CFSpeech|CFTimeout)
|
||||
|
|
|
@ -6,22 +6,22 @@ class DistributedNPCLaffRestockAI(DistributedNPCToonBaseAI.DistributedNPCToonBas
|
|||
def restock(self):
|
||||
avId = self.air.getAvatarIdFromSender()
|
||||
av = self.air.doId2do.get(avId)
|
||||
|
||||
|
||||
if not av:
|
||||
return
|
||||
|
||||
|
||||
laff = av.getMaxHp() - av.getHp()
|
||||
|
||||
|
||||
if laff <= 0:
|
||||
self.sendUpdateToAvatarId(avId, 'restockResult', [LaffRestockGlobals.NO_LAFF, 0])
|
||||
return
|
||||
|
||||
|
||||
cost = laff * ToontownGlobals.CostPerLaffRestock
|
||||
|
||||
|
||||
if cost > av.getTotalMoney():
|
||||
self.sendUpdateToAvatarId(avId, 'restockResult', [LaffRestockGlobals.NO_MONEY, cost])
|
||||
return
|
||||
|
||||
|
||||
av.takeMoney(cost)
|
||||
av.b_setHp(av.getMaxHp())
|
||||
self.sendUpdateToAvatarId(avId, 'restockResult', [LaffRestockGlobals.SUCCESS, 0])
|
||||
self.sendUpdateToAvatarId(avId, 'restockResult', [LaffRestockGlobals.SUCCESS, 0])
|
||||
|
|
|
@ -372,7 +372,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
|
|||
self.setChatAbsolute(chatString, CFSpeech | CFTimeout)
|
||||
ResistanceChat.doEffect(msgIndex, self, nearbyToons)
|
||||
|
||||
def d_battleSOS(self, requesterId, sendToId):
|
||||
def d_battleSOS(self, sendToId):
|
||||
self.cr.ttuFriendsManager.d_battleSOS(sendToId)
|
||||
|
||||
def battleSOS(self, requesterId):
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
NO_LAFF = 0
|
||||
NO_MONEY = 1
|
||||
SUCCESS = 2
|
||||
SUCCESS = 2
|
||||
|
|
|
@ -20,4 +20,4 @@ FurnitureTopBitmask = BitMask32(64)
|
|||
FurnitureDragBitmask = BitMask32(128)
|
||||
PetLookatPetBitmask = BitMask32(256)
|
||||
PetLookatNonPetBitmask = BitMask32(512)
|
||||
BanquetTableBitmask = BitMask32(1024)
|
||||
BanquetTableBitmask = BitMask32(1024)
|
||||
|
|
|
@ -8444,4 +8444,4 @@ RestockFullLaffMessage = "Sorry, but you're already happy!"
|
|||
RestockNoMoneyMessage = "Sorry, but you need %s jellybeans to restock your laff!"
|
||||
RestockAskMessage = "Would you like to restock %s laff for %s jellybeans?"
|
||||
RestockLaffMessage = "Enjoy your happiness!"
|
||||
RestockLaffCancelMessage = "Alright. Come back here if you change your mind."
|
||||
RestockLaffCancelMessage = "Alright. Come back here if you change your mind."
|
||||
|
|
|
@ -1638,4 +1638,4 @@ PropIdToColor = [
|
|||
|
||||
BugReportSite = 'https://bugs.launchpad.net/toontown-united/+filebug'
|
||||
TreasureChestSphereRadius = 1.0
|
||||
CostPerLaffRestock = 3
|
||||
CostPerLaffRestock = 3
|
||||
|
|
Loading…
Reference in a new issue