From 6ce7485ef4b021309d7634b59a6020f2eefb62f7 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 23 Jul 2015 12:59:17 +0300 Subject: [PATCH] Loudrob pls --- dependencies/astron/dclass/stride.dc | 3 +- toontown/catalog/CatalogGardenItem.py | 13 +--- toontown/estate/DistributedEstate.py | 74 +++++++++++++++----- toontown/estate/DistributedEstateAI.py | 43 ++++++++++-- toontown/estate/DistributedGarden.py | 2 - toontown/fishing/FishingTargetGlobals.py | 2 +- toontown/minigame/DistributedTugOfWarGame.py | 2 - toontown/toonbase/ToontownGlobals.py | 5 +- 8 files changed, 99 insertions(+), 45 deletions(-) diff --git a/dependencies/astron/dclass/stride.dc b/dependencies/astron/dclass/stride.dc index c8e2c8bd..ddf3b618 100644 --- a/dependencies/astron/dclass/stride.dc +++ b/dependencies/astron/dclass/stride.dc @@ -1217,7 +1217,6 @@ struct lawnItem { }; dclass DistributedEstate : DistributedObject { - string DcObjectType db; setEstateReady() broadcast; setClientReady() airecv clsend; setEstateType(uint8 type = 0) required broadcast db; @@ -1244,6 +1243,8 @@ dclass DistributedEstate : DistributedObject { setSlot5Garden(blob g) required airecv db; setIdList(uint32 []) broadcast ram; completeFlowerSale(uint8) airecv clsend; + completeFishSale() airecv clsend; + thankSeller(int8, int8, int8); awardedTrophy(uint32) broadcast; setClouds(uint8) required broadcast ram; cannonsOver() broadcast; diff --git a/toontown/catalog/CatalogGardenItem.py b/toontown/catalog/CatalogGardenItem.py index 799f32d7..fba420ad 100755 --- a/toontown/catalog/CatalogGardenItem.py +++ b/toontown/catalog/CatalogGardenItem.py @@ -22,11 +22,6 @@ class CatalogGardenItem(CatalogItem.CatalogItem): else: return 100 - def reachedPurchaseLimit(self, avatar): - if self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder or self in avatar.awardMailboxContents or self in avatar.onAwardOrder: - return 1 - return 0 - def getAcceptItemErrorText(self, retcode): if retcode == ToontownGlobals.P_ItemAvailable: return TTLocalizer.CatalogAcceptGarden @@ -39,17 +34,16 @@ class CatalogGardenItem(CatalogItem.CatalogItem): return TTLocalizer.GardenTypeName def getName(self): - name = GardenGlobals.Specials[self.gardenIndex]['photoName'] - return name + return GardenGlobals.Specials[self.gardenIndex]['photoName'] def recordPurchase(self, avatar, optional): if avatar: avatar.addGardenItem(self.gardenIndex, self.numItems) - if 1: - return ToontownGlobals.P_ItemAvailable + return ToontownGlobals.P_ItemAvailable def getPicture(self, avatar): photoModel = GardenGlobals.Specials[self.gardenIndex]['photoModel'] + if 'photoAnimation' in GardenGlobals.Specials[self.gardenIndex]: modelPath = photoModel + GardenGlobals.Specials[self.gardenIndex]['photoAnimation'][0] animationName = GardenGlobals.Specials[self.gardenIndex]['photoAnimation'][1] @@ -75,7 +69,6 @@ class CatalogGardenItem(CatalogItem.CatalogItem): self.model.setScale(photoScale) self.hasPicture = True return (frame, None) - return None def cleanupPicture(self): CatalogItem.CatalogItem.cleanupPicture(self) diff --git a/toontown/estate/DistributedEstate.py b/toontown/estate/DistributedEstate.py index 47e551b7..a14acdbf 100755 --- a/toontown/estate/DistributedEstate.py +++ b/toontown/estate/DistributedEstate.py @@ -6,27 +6,16 @@ from direct.interval.IntervalGlobal import * import math from toontown.toonbase import ToontownGlobals from direct.distributed import DistributedObject -from direct.directnotify import DirectNotifyGlobal -from direct.fsm import ClassicFSM -from direct.fsm import State -from toontown.toon import Toon -from direct.showbase import RandomNumGen from direct.task.Task import Task from toontown.toonbase import TTLocalizer import random import cPickle import time -from direct.showbase import PythonUtil -from toontown.hood import Place -import Estate import HouseGlobals from toontown.estate import GardenGlobals -from toontown.estate import DistributedFlower -from toontown.estate import DistributedGagTree -from toontown.estate import DistributedStatuary -import GardenProgressMeter from toontown.estate import FlowerSellGUI from toontown.toontowngui import TTDialog +from toontown.fishing import FishSellGUI class DistributedEstate(DistributedObject.DistributedObject): notify = directNotify.newCategory('DistributedEstate') @@ -44,16 +33,15 @@ class DistributedEstate(DistributedObject.DistributedObject): self.initCamera() self.plotTable = [] self.idList = [] - base.estate = self self.flowerGuiDoneEvent = 'flowerGuiDone' - return + self.fishGuiDoneEvent = 'fishGuiDone' def disable(self): self.notify.debug('disable') self.__stopBirds() self.__stopCrickets() DistributedObject.DistributedObject.disable(self) - self.ignore('enterFlowerSellBox') + self.ignoreAll() def delete(self): self.notify.debug('delete') @@ -61,12 +49,14 @@ class DistributedEstate(DistributedObject.DistributedObject): DistributedObject.DistributedObject.delete(self) def load(self): - self.lt = base.localAvatar + self.defaultSignModel = loader.loadModel('phase_13/models/parties/eventSign') + self.activityIconsModel = loader.loadModel('phase_4/models/parties/eventSignIcons') if base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN): self.loadWitch() else: self.loadAirplane() self.loadFlowerSellBox() + self.loadFishSellBox() self.oldClear = base.win.getClearColor() base.win.setClearColor(Vec4(0.09, 0.55, 0.21, 1.0)) @@ -95,7 +85,10 @@ class DistributedEstate(DistributedObject.DistributedObject): self.flowerSellBox.removeNode() del self.flowerSellBox self.flowerSellBox = None - return + if self.fishSellBox: + self.fishSellBox.removeNode() + del self.fishSellBox + self.fishSellBox = None def announceGenerate(self): DistributedObject.DistributedObject.announceGenerate(self) @@ -189,7 +182,6 @@ class DistributedEstate(DistributedObject.DistributedObject): self.housePos = posList self.numHouses = len(self.houseType) self.house = [None] * self.numHouses - return def __startAirplaneTask(self): self.theta = 0 @@ -371,12 +363,56 @@ class DistributedEstate(DistributedObject.DistributedObject): self.ignore('stoppedAsleep') self.flowerGui.destroy() self.flowerGui = None - return def popupFlowerGUI(self): self.acceptOnce(self.flowerGuiDoneEvent, self.__handleSaleDone) self.flowerGui = FlowerSellGUI.FlowerSellGUI(self.flowerGuiDoneEvent) self.accept('stoppedAsleep', self.__handleSaleDone) + + def loadFishSellBox(self): + self.fishSellBox = loader.loadModel('phase_4/models/minigames/treasure_chest.bam') + self.fishSellBox.setPos(45, -165.75, 0.025) + self.fishSellBox.setH(210) + self.fishSellBox.reparentTo(render) + cSphere = CollisionSphere(0.0, 0.0, 0.0, 2.25) + cSphere.setTangible(0) + colNode = CollisionNode('FishSellBox') + colNode.addSolid(cSphere) + cSpherePath = self.fishSellBox.attachNewNode(colNode) + cSpherePath.hide() + cSpherePath.setCollideMask(ToontownGlobals.WallBitmask) + self.accept('enterFishSellBox', self.__touchedFishSellBox) + + def __touchedFishSellBox(self, entry): + if base.localAvatar.doId in self.idList: + if base.localAvatar.fishTank.getFish(): + self.popupFishGUI() + + def __handleFishSaleDone(self, sell=0): + if sell: + self.sendUpdate('completeFishSale') + else: + base.localAvatar.setSystemMessage(0, TTLocalizer.STOREOWNER_NOFISH) + + base.setCellsAvailable(base.bottomCells, 1) + base.cr.playGame.getPlace().setState('walk') + self.ignore(self.fishGuiDoneEvent) + self.ignore('stoppedAsleep') + self.fishGui.destroy() + self.fishGui = None + + def popupFishGUI(self): + base.setCellsAvailable(base.bottomCells, 0) + base.cr.playGame.getPlace().setState('stopped') + self.acceptOnce(self.fishGuiDoneEvent, self.__handleFishSaleDone) + self.fishGui = FishSellGUI.FishSellGUI(self.fishGuiDoneEvent) + self.accept('stoppedAsleep', self.__handleFishSaleDone) + + def thankSeller(self, mode, fish, maxFish): + if mode == ToontownGlobals.FISHSALE_TROPHY: + base.localAvatar.setSystemMessage(0, TTLocalizer.STOREOWNER_TROPHY % (fish, maxFish)) + elif mode == ToontownGlobals.FISHSALE_COMPLETE: + base.localAvatar.setSystemMessage(0, TTLocalizer.STOREOWNER_THANKSFISH) def closedAwardDialog(self, value): self.awardDialog.destroy() diff --git a/toontown/estate/DistributedEstateAI.py b/toontown/estate/DistributedEstateAI.py index 75e00abc..a3cdcd50 100755 --- a/toontown/estate/DistributedEstateAI.py +++ b/toontown/estate/DistributedEstateAI.py @@ -7,13 +7,14 @@ import time, random from toontown.fishing.DistributedFishingPondAI import DistributedFishingPondAI from toontown.fishing.DistributedFishingTargetAI import DistributedFishingTargetAI from toontown.fishing.DistributedPondBingoManagerAI import DistributedPondBingoManagerAI -from toontown.fishing import FishingTargetGlobals +from toontown.fishing import FishingTargetGlobals, FishGlobals from toontown.safezone import TreasureGlobals from toontown.safezone.SZTreasurePlannerAI import SZTreasurePlannerAI from toontown.safezone import DistributedTreasureAI from toontown.safezone import ButterflyGlobals from toontown.safezone import DistributedButterflyAI from toontown.safezone.DistributedFishingSpotAI import DistributedFishingSpotAI +from toontown.parties.DistributedPartyJukeboxActivityAI import DistributedPartyJukeboxActivityAI from DistributedGardenBoxAI import * from DistributedGardenPlotAI import * @@ -486,17 +487,21 @@ class DistributedEstateAI(DistributedObjectAI): self.houses = [None] * 6 self.rentalType = 0 self.rentalHandle = None - self.doId2do = { } self.pond = None + self.jukebox = None self.spots = [] - + self.butterflies = [] self.targets = [] self.owner = None self.gardenManager = GardenManager(self) self.__pendingGardens = {} + + @property + def hostId(self): + return 1000000001 def generate(self): DistributedObjectAI.generate(self) @@ -544,19 +549,29 @@ class DistributedEstateAI(DistributedObjectAI): spot.setPosHpr(46.8254, -113.682, 0.46015, 135, 0, 0) spot.generateWithRequired(self.zoneId) self.spots.append(spot) + + self.jukebox = DistributedPartyJukeboxActivityAI(self.air, self.doId, (0, 0, 0, 0)) + self.jukebox.generateWithRequired(self.zoneId) + self.jukebox.sendUpdate('setX', [-21.8630]) + self.jukebox.sendUpdate('setY', [-154.669]) + self.jukebox.sendUpdate('setH', [148.7050]) + self.jukebox.sendUpdate('unloadSign') ButterflyGlobals.generateIndexes(self.zoneId, ButterflyGlobals.ESTATE) for i in xrange(0, ButterflyGlobals.NUM_BUTTERFLY_AREAS[ButterflyGlobals.ESTATE]): for j in xrange(0, ButterflyGlobals.NUM_BUTTERFLIES[ButterflyGlobals.ESTATE]): - bfly = DistributedButterflyAI.DistributedButterflyAI(self.air, ButterflyGlobals.ESTATE, i, self.zoneId) - bfly.generateWithRequired(self.zoneId) - bfly.start() - self.addDistObj(bfly) + butterfly = DistributedButterflyAI.DistributedButterflyAI(self.air, ButterflyGlobals.ESTATE, i, self.zoneId) + butterfly.generateWithRequired(self.zoneId) + butterfly.start() + self.butterflies.append(butterfly) def destroy(self): for house in self.houses: if house: house.requestDelete() + for butterfly in self.butterflies: + if butterfly: + butterfly.requestDelete() del self.houses[:] if self.pond: for spot in self.spots: @@ -567,6 +582,8 @@ class DistributedEstateAI(DistributedObjectAI): self.targets = [] self.pond.requestDelete() self.pond = None + if self.jukebox: + self.jukebox.requestDelete() if self.treasurePlanner: self.treasurePlanner.stop() @@ -889,6 +906,18 @@ class DistributedEstateAI(DistributedObjectAI): self.sendUpdate('awardedTrophy', [avId]) av.b_setGardenTrophies(range(len(collection) // 10)) + + def completeFishSale(self): + avId = self.air.getAvatarIdFromSender() + av = self.air.doId2do.get(avId) + + if not av: + return + + if self.air.fishManager.creditFishTank(av): + self.sendUpdateToAvatarId(avId, 'thankSeller', [ToontownGlobals.FISHSALE_TROPHY, len(av.fishCollection), FishGlobals.getTotalNumFish()]) + else: + self.sendUpdateToAvatarId(avId, 'thankSeller', [ToontownGlobals.FISHSALE_COMPLETE, 0, 0]) def setClouds(self, clouds): self.cloudType = clouds diff --git a/toontown/estate/DistributedGarden.py b/toontown/estate/DistributedGarden.py index 46ee2ea5..8a559e34 100755 --- a/toontown/estate/DistributedGarden.py +++ b/toontown/estate/DistributedGarden.py @@ -12,7 +12,6 @@ class DistributedGarden(DistributedObject.DistributedObject): def __init__(self, cr): self.notify.debug('init') DistributedObject.DistributedObject.__init__(self, cr) - self.lt = base.localAvatar self.props = [] self.pos = None self.radius = 0 @@ -23,7 +22,6 @@ class DistributedGarden(DistributedObject.DistributedObject): self.dx = 1.0 / self.gridCells self.occupied = [] - return def generate(self): DistributedObject.DistributedObject.generate(self) diff --git a/toontown/fishing/FishingTargetGlobals.py b/toontown/fishing/FishingTargetGlobals.py index 14112014..74c02f89 100755 --- a/toontown/fishing/FishingTargetGlobals.py +++ b/toontown/fishing/FishingTargetGlobals.py @@ -146,7 +146,7 @@ __targetInfoDict = {ToontownGlobals.ToontownCentral: (2, -2.1, 14, -2.1 - 0.378), - ToontownGlobals.MyEstate: (5, + ToontownGlobals.MyEstate: (3, 30, -126, -0.3, diff --git a/toontown/minigame/DistributedTugOfWarGame.py b/toontown/minigame/DistributedTugOfWarGame.py index 4f755987..bf2d8dd1 100755 --- a/toontown/minigame/DistributedTugOfWarGame.py +++ b/toontown/minigame/DistributedTugOfWarGame.py @@ -163,7 +163,6 @@ class DistributedTugOfWarGame(DistributedMinigame): def unload(self): self.notify.debug('unload') DistributedMinigame.unload(self) - del self.lt self.timer.destroy() del self.timer self.room.removeNode() @@ -250,7 +249,6 @@ class DistributedTugOfWarGame(DistributedMinigame): def onstage(self): self.notify.debug('onstage') DistributedMinigame.onstage(self) - self.lt = base.localAvatar NametagGlobals.setGlobalNametagScale(1) self.arrowKeys = ArrowKeys.ArrowKeys() self.room.reparentTo(render) diff --git a/toontown/toonbase/ToontownGlobals.py b/toontown/toonbase/ToontownGlobals.py index bcbc304d..39be7ac4 100755 --- a/toontown/toonbase/ToontownGlobals.py +++ b/toontown/toonbase/ToontownGlobals.py @@ -1622,9 +1622,8 @@ BMovementSpeedMultiplier = 1.3 BugReportSite = 'https://bugs.launchpad.net/toontown-united/+filebug' CostPerLaffRestock = 3 -FISHSALE_NONE = 0 -FISHSALE_COMPLETE = 1 -FISHSALE_TROPHY = 2 +FISHSALE_COMPLETE = 0 +FISHSALE_TROPHY = 1 NPCCollisionDelay = 2.5 KnockKnockHeal = 12 KnockKnockCooldown = 600