From a06c6a7543a9706cfc80abc8aef49a1d9f037fb9 Mon Sep 17 00:00:00 2001 From: Loudrob Date: Tue, 21 Jul 2015 10:34:55 -0400 Subject: [PATCH] Flower sell fix --- toontown/estate/DistributedEstate.py | 113 +++++++----------------- toontown/toonbase/TTLocalizerEnglish.py | 2 + 2 files changed, 32 insertions(+), 83 deletions(-) diff --git a/toontown/estate/DistributedEstate.py b/toontown/estate/DistributedEstate.py index e3e9cf69..47e551b7 100755 --- a/toontown/estate/DistributedEstate.py +++ b/toontown/estate/DistributedEstate.py @@ -24,10 +24,8 @@ from toontown.estate import GardenGlobals from toontown.estate import DistributedFlower from toontown.estate import DistributedGagTree from toontown.estate import DistributedStatuary -import GardenDropGame import GardenProgressMeter from toontown.estate import FlowerSellGUI -from toontown.fishing import FishSellGUI from toontown.toontowngui import TTDialog class DistributedEstate(DistributedObject.DistributedObject): @@ -48,7 +46,6 @@ class DistributedEstate(DistributedObject.DistributedObject): self.idList = [] base.estate = self self.flowerGuiDoneEvent = 'flowerGuiDone' - self.fishGuiDoneEvent = 'fishGuiDone' return def disable(self): @@ -57,7 +54,6 @@ class DistributedEstate(DistributedObject.DistributedObject): self.__stopCrickets() DistributedObject.DistributedObject.disable(self) self.ignore('enterFlowerSellBox') - self.ignore('enterFishSellBox') def delete(self): self.notify.debug('delete') @@ -65,19 +61,14 @@ class DistributedEstate(DistributedObject.DistributedObject): DistributedObject.DistributedObject.delete(self) def load(self): - self.defaultSignModel = loader.loadModel('phase_13/models/parties/eventSign') - self.activityIconsModel = loader.loadModel('phase_4/models/parties/eventSignIcons') self.lt = base.localAvatar 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)) - if config.GetBool('want-garden-game', False): - self.startGame() def unload(self): self.ignoreAll() @@ -104,23 +95,10 @@ class DistributedEstate(DistributedObject.DistributedObject): self.flowerSellBox.removeNode() del self.flowerSellBox self.flowerSellBox = None - if self.fishSellBox: - self.fishSellBox.removeNode() - del self.fishSellBox - self.fishSellBox = None - if config.GetBool('want-garden-game', False): - GardenDropGame.GardenDropGame().endGame() return def announceGenerate(self): DistributedObject.DistributedObject.announceGenerate(self) - self.accept('gardenGame', self.startGame) - - def startGame(self): - if config.GetBool('want-garden-game', False): - self.game = GardenDropGame.GardenDropGame().playGardenDrop() - else: - self.game = GardenDropGame.GardenDropGame() def loadAirplane(self): self.airplane = loader.loadModel('phase_4/models/props/airplane.bam') @@ -131,12 +109,14 @@ class DistributedEstate(DistributedObject.DistributedObject): bannerText.setTextColor(1, 0, 0, 1) bannerText.setAlign(bannerText.ACenter) bannerText.setFont(ToontownGlobals.getSignFont()) - bannerText.setText('Cog invasion!!!') + bannerText.setText(TTLocalizer.EstatePlaneReturn) self.bn = self.banner.attachNewNode(bannerText.generate()) self.bn.setHpr(180, 0, 0) - self.bn.setPos(-1.8, 0.1, 0) - self.bn.setScale(0.35) - self.banner.hide() + self.bn.setPos(-5.8, 0.1, -0.25) + self.bn.setScale(0.95) + self.bn.setDepthTest(1) + self.bn.setDepthWrite(1) + self.bn.setDepthOffset(500) def loadWitch(self): if not self.airplane: @@ -148,15 +128,19 @@ class DistributedEstate(DistributedObject.DistributedObject): self.airplane = loader.loadModel('phase_4/models/props/tt_m_prp_ext_flyingWitch.bam') self.airplane.setScale(2) self.airplane.setPos(0, 0, 1) + self.airplane.find('**/').setH(180) bannerText = TextNode('bannerText') bannerText.setTextColor(1, 0, 0, 1) bannerText.setAlign(bannerText.ACenter) bannerText.setFont(ToontownGlobals.getSignFont()) - bannerText.setText('Happy halloween!!!') + bannerText.setText(TTLocalizer.EstatePlaneHoliday) self.bn = self.airplane.attachNewNode(bannerText.generate()) - self.bn.setHpr(0, 0, 0) - self.bn.setPos(20.0, -.1, 0) + self.bn.setPos(-20.0, -.1, 0) + self.bn.setH(180) self.bn.setScale(2.35) + self.bn.setDepthTest(1) + self.bn.setDepthWrite(1) + self.bn.setDepthOffset(500) replacement = Sequence(LerpColorScaleInterval(self.airplane, 0.1, Vec4(1, 1, 1, 0)), Func(__replaceAirplane__), LerpColorScaleInterval(self.airplane, 0.1, Vec4(1, 1, 1, 1))) replacement.start() @@ -175,12 +159,14 @@ class DistributedEstate(DistributedObject.DistributedObject): bannerText.setTextColor(1, 0, 0, 1) bannerText.setAlign(bannerText.ACenter) bannerText.setFont(ToontownGlobals.getSignFont()) - bannerText.setText('Happy halloween!!!') + bannerText.setText(TTLocalizer.EstatePlaneReturn) self.bn = self.banner.attachNewNode(bannerText.generate()) self.bn.setHpr(180, 0, 0) - self.bn.setPos(-1.8, 0.1, 0) - self.bn.setScale(0.35) - self.banner.hide() + self.bn.setPos(-5.8, 0.1, -0.25) + self.bn.setScale(0.95) + self.bn.setDepthTest(1) + self.bn.setDepthWrite(1) + self.bn.setDepthOffset(500) replacement = Sequence(LerpColorScaleInterval(self.airplane, 0.1, Vec4(1, 1, 1, 0)), Func(__replaceWitch__), LerpColorScaleInterval(self.airplane, 0.1, Vec4(1, 1, 1, 1))) replacement.start() @@ -189,6 +175,9 @@ class DistributedEstate(DistributedObject.DistributedObject): initCamPos = VBase3(0, -10, 5) initCamHpr = VBase3(0, -10, 0) + def setEstateType(self, index): + self.estateType = index + def setHouseInfo(self, houseInfo): self.notify.debug('setHouseInfo') houseType, housePos = cPickle.loads(houseInfo) @@ -211,7 +200,7 @@ class DistributedEstate(DistributedObject.DistributedObject): def __pauseAirplaneTask(self): pause = 45 self.phi = 0 - self.airplane.hide() + self.airplane.reparentTo(hidden) self.theta = (self.theta + 10) % 360 taskMgr.remove(self.taskName('estate-airplane')) taskMgr.doMethodLater(pause, self.airplaneFlyTask, self.taskName('estate-airplane')) @@ -232,7 +221,7 @@ class DistributedEstate(DistributedObject.DistributedObject): y = rad * math.sin(angle) z = amp * sinPhi self.airplane.reparentTo(render) - self.airplane.setH(90 + self.theta + 180) + self.airplane.setH(90 + self.theta) self.airplane.setPos(x, y, z) return Task.cont @@ -280,7 +269,7 @@ class DistributedEstate(DistributedObject.DistributedObject): def __dayTimeTask(self, task): taskName = self.taskName('daytime') - track = Sequence(Parallel(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, HouseGlobals.HALF_DAY_PERIOD, Vec4(1, 0.6, 0.6, 1)), LerpColorScaleInterval(base.cr.playGame.hood.sky, HouseGlobals.HALF_DAY_PERIOD, Vec4(1, 0.8, 0.8, 1))), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, HouseGlobals.HALF_NIGHT_PERIOD, Vec4(0.2, 0.2, 0.5, 1)), LerpColorScaleInterval(base.cr.playGame.hood.sky, HouseGlobals.HALF_NIGHT_PERIOD, Vec4(0.4, 0.4, 0.6, 1))), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, HouseGlobals.HALF_NIGHT_PERIOD, Vec4(0.6, 0.6, 0.8, 1)), LerpColorScaleInterval(base.cr.playGame.hood.sky, HouseGlobals.HALF_NIGHT_PERIOD, Vec4(0.7, 0.7, 0.8, 1))), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, HouseGlobals.HALF_DAY_PERIOD, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.cr.playGame.hood.sky, HouseGlobals.HALF_DAY_PERIOD, Vec4(1, 1, 1, 1))), Func(base.cr.playGame.hood.loader.geom.clearColorScale), Func(base.cr.playGame.hood.sky.clearColorScale)) + track = Sequence(Parallel(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, HouseGlobals.HALF_DAY_PERIOD, Vec4(1, 0.6, 0.6, 1)), LerpColorScaleInterval(base.cr.playGame.hood.sky, HouseGlobals.HALF_DAY_PERIOD, Vec4(1, 0.8, 0.8, 1))), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, HouseGlobals.HALF_NIGHT_PERIOD, Vec4(0.2, 0.2, 0.5, 1)), LerpColorScaleInterval(base.cr.playGame.hood.sky, HouseGlobals.HALF_NIGHT_PERIOD, Vec4(0.2, 0.2, 0.4, 1))), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, HouseGlobals.HALF_NIGHT_PERIOD, Vec4(0.6, 0.6, 0.8, 1)), LerpColorScaleInterval(base.cr.playGame.hood.sky, HouseGlobals.HALF_NIGHT_PERIOD, Vec4(0.5, 0.5, 0.6, 1))), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, HouseGlobals.HALF_DAY_PERIOD, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.cr.playGame.hood.sky, HouseGlobals.HALF_DAY_PERIOD, Vec4(1, 1, 1, 1))), Func(base.cr.playGame.hood.loader.geom.clearColorScale), Func(base.cr.playGame.hood.sky.clearColorScale)) if self.dayTrack: self.dayTrack.finish() self.dayTrack = track @@ -344,8 +333,8 @@ class DistributedEstate(DistributedObject.DistributedObject): taskMgr.doMethodLater(1, self.__crickets, 'estate-crickets') def __crickets(self, task): - sfx = random.choice(base.cr.playGame.hood.loader.cricketSound) - track = Sequence(Func(base.playSfx, sfx), Wait(1)) + sfx = base.cr.playGame.hood.loader.cricketSound + track = Sequence(Func(base.playSfx, random.choice(sfx)), Wait(1)) track.start() t = random.random() * 20.0 + 1 taskMgr.doMethodLater(t, self.__crickets, 'estate-crickets') @@ -376,61 +365,19 @@ class DistributedEstate(DistributedObject.DistributedObject): if len(base.localAvatar.flowerBasket.flowerList): self.popupFlowerGUI() - def __handleFlowerSaleDone(self, sell = 0): + def __handleSaleDone(self, sell = 0): self.ignore(self.flowerGuiDoneEvent) self.sendUpdate('completeFlowerSale', [sell]) self.ignore('stoppedAsleep') self.flowerGui.destroy() self.flowerGui = None + return def popupFlowerGUI(self): - self.acceptOnce(self.flowerGuiDoneEvent, self.__handleFlowerSaleDone) + 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): - base.setCellsAvailable(base.bottomCells, 1) - base.cr.playGame.getPlace().setState('walk') - self.ignore(self.fishGuiDoneEvent) - self.sendUpdate('completeFishSale', [sell]) - 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) - elif mode == ToontownGlobals.FISHSALE_NONE: - base.localAvatar.setSystemMessage(0, TTLocalizer.STOREOWNER_NOFISH) - def closedAwardDialog(self, value): self.awardDialog.destroy() base.cr.playGame.getPlace().detectedGardenPlotDone() diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index c13e2d7a..a101d7d0 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -4279,6 +4279,8 @@ GardenTutorialPage2 = 'Flowers are finicky and require unique Jellybean recipes. GardenTutorialPage3 = 'Use a gag from your inventory to plant a tree. After a few days, that gag will do more damage! Remember to keep it healthy or the damage boost will go away.' GardenTutorialPage4 = 'Walk up to these spots to plant, water, dig up or harvest your garden.' GardenTutorialPage5 = "Statues can be purchased in Clarabelle's Cattlelog. Increase your skill to unlock the more extravagant statues!" +EstatePlaneReturn = "Cog invasion!!!" +EstatePlaneHoliday = "Happy halloween!!!" PlaygroundDeathAckMessage = TheCogs + ' took all your gags!\n\nYou are sad. You may not leave the playground until you are happy.' ForcedLeaveFactoryAckMsg = 'The ' + Foreman + ' was defeated before you could reach him. You did not recover any Cog parts.' ForcedLeaveMintAckMsg = 'The Mint Floor Supervisor was defeated before you could reach him. You did not recover any Cogbucks.'