Flower sell fix

This commit is contained in:
Loudrob 2015-07-21 10:34:55 -04:00
parent 3d8d023af9
commit a06c6a7543
2 changed files with 32 additions and 83 deletions

View file

@ -24,10 +24,8 @@ from toontown.estate import GardenGlobals
from toontown.estate import DistributedFlower from toontown.estate import DistributedFlower
from toontown.estate import DistributedGagTree from toontown.estate import DistributedGagTree
from toontown.estate import DistributedStatuary from toontown.estate import DistributedStatuary
import GardenDropGame
import GardenProgressMeter import GardenProgressMeter
from toontown.estate import FlowerSellGUI from toontown.estate import FlowerSellGUI
from toontown.fishing import FishSellGUI
from toontown.toontowngui import TTDialog from toontown.toontowngui import TTDialog
class DistributedEstate(DistributedObject.DistributedObject): class DistributedEstate(DistributedObject.DistributedObject):
@ -48,7 +46,6 @@ class DistributedEstate(DistributedObject.DistributedObject):
self.idList = [] self.idList = []
base.estate = self base.estate = self
self.flowerGuiDoneEvent = 'flowerGuiDone' self.flowerGuiDoneEvent = 'flowerGuiDone'
self.fishGuiDoneEvent = 'fishGuiDone'
return return
def disable(self): def disable(self):
@ -57,7 +54,6 @@ class DistributedEstate(DistributedObject.DistributedObject):
self.__stopCrickets() self.__stopCrickets()
DistributedObject.DistributedObject.disable(self) DistributedObject.DistributedObject.disable(self)
self.ignore('enterFlowerSellBox') self.ignore('enterFlowerSellBox')
self.ignore('enterFishSellBox')
def delete(self): def delete(self):
self.notify.debug('delete') self.notify.debug('delete')
@ -65,19 +61,14 @@ class DistributedEstate(DistributedObject.DistributedObject):
DistributedObject.DistributedObject.delete(self) DistributedObject.DistributedObject.delete(self)
def load(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 self.lt = base.localAvatar
if base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN): if base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN):
self.loadWitch() self.loadWitch()
else: else:
self.loadAirplane() self.loadAirplane()
self.loadFlowerSellBox() self.loadFlowerSellBox()
self.loadFishSellBox()
self.oldClear = base.win.getClearColor() self.oldClear = base.win.getClearColor()
base.win.setClearColor(Vec4(0.09, 0.55, 0.21, 1.0)) base.win.setClearColor(Vec4(0.09, 0.55, 0.21, 1.0))
if config.GetBool('want-garden-game', False):
self.startGame()
def unload(self): def unload(self):
self.ignoreAll() self.ignoreAll()
@ -104,23 +95,10 @@ class DistributedEstate(DistributedObject.DistributedObject):
self.flowerSellBox.removeNode() self.flowerSellBox.removeNode()
del self.flowerSellBox del self.flowerSellBox
self.flowerSellBox = None 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 return
def announceGenerate(self): def announceGenerate(self):
DistributedObject.DistributedObject.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): def loadAirplane(self):
self.airplane = loader.loadModel('phase_4/models/props/airplane.bam') 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.setTextColor(1, 0, 0, 1)
bannerText.setAlign(bannerText.ACenter) bannerText.setAlign(bannerText.ACenter)
bannerText.setFont(ToontownGlobals.getSignFont()) bannerText.setFont(ToontownGlobals.getSignFont())
bannerText.setText('Cog invasion!!!') bannerText.setText(TTLocalizer.EstatePlaneReturn)
self.bn = self.banner.attachNewNode(bannerText.generate()) self.bn = self.banner.attachNewNode(bannerText.generate())
self.bn.setHpr(180, 0, 0) self.bn.setHpr(180, 0, 0)
self.bn.setPos(-1.8, 0.1, 0) self.bn.setPos(-5.8, 0.1, -0.25)
self.bn.setScale(0.35) self.bn.setScale(0.95)
self.banner.hide() self.bn.setDepthTest(1)
self.bn.setDepthWrite(1)
self.bn.setDepthOffset(500)
def loadWitch(self): def loadWitch(self):
if not self.airplane: 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 = loader.loadModel('phase_4/models/props/tt_m_prp_ext_flyingWitch.bam')
self.airplane.setScale(2) self.airplane.setScale(2)
self.airplane.setPos(0, 0, 1) self.airplane.setPos(0, 0, 1)
self.airplane.find('**/').setH(180)
bannerText = TextNode('bannerText') bannerText = TextNode('bannerText')
bannerText.setTextColor(1, 0, 0, 1) bannerText.setTextColor(1, 0, 0, 1)
bannerText.setAlign(bannerText.ACenter) bannerText.setAlign(bannerText.ACenter)
bannerText.setFont(ToontownGlobals.getSignFont()) bannerText.setFont(ToontownGlobals.getSignFont())
bannerText.setText('Happy halloween!!!') bannerText.setText(TTLocalizer.EstatePlaneHoliday)
self.bn = self.airplane.attachNewNode(bannerText.generate()) 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.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 = 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() replacement.start()
@ -175,12 +159,14 @@ class DistributedEstate(DistributedObject.DistributedObject):
bannerText.setTextColor(1, 0, 0, 1) bannerText.setTextColor(1, 0, 0, 1)
bannerText.setAlign(bannerText.ACenter) bannerText.setAlign(bannerText.ACenter)
bannerText.setFont(ToontownGlobals.getSignFont()) bannerText.setFont(ToontownGlobals.getSignFont())
bannerText.setText('Happy halloween!!!') bannerText.setText(TTLocalizer.EstatePlaneReturn)
self.bn = self.banner.attachNewNode(bannerText.generate()) self.bn = self.banner.attachNewNode(bannerText.generate())
self.bn.setHpr(180, 0, 0) self.bn.setHpr(180, 0, 0)
self.bn.setPos(-1.8, 0.1, 0) self.bn.setPos(-5.8, 0.1, -0.25)
self.bn.setScale(0.35) self.bn.setScale(0.95)
self.banner.hide() 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 = 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() replacement.start()
@ -189,6 +175,9 @@ class DistributedEstate(DistributedObject.DistributedObject):
initCamPos = VBase3(0, -10, 5) initCamPos = VBase3(0, -10, 5)
initCamHpr = VBase3(0, -10, 0) initCamHpr = VBase3(0, -10, 0)
def setEstateType(self, index):
self.estateType = index
def setHouseInfo(self, houseInfo): def setHouseInfo(self, houseInfo):
self.notify.debug('setHouseInfo') self.notify.debug('setHouseInfo')
houseType, housePos = cPickle.loads(houseInfo) houseType, housePos = cPickle.loads(houseInfo)
@ -211,7 +200,7 @@ class DistributedEstate(DistributedObject.DistributedObject):
def __pauseAirplaneTask(self): def __pauseAirplaneTask(self):
pause = 45 pause = 45
self.phi = 0 self.phi = 0
self.airplane.hide() self.airplane.reparentTo(hidden)
self.theta = (self.theta + 10) % 360 self.theta = (self.theta + 10) % 360
taskMgr.remove(self.taskName('estate-airplane')) taskMgr.remove(self.taskName('estate-airplane'))
taskMgr.doMethodLater(pause, self.airplaneFlyTask, 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) y = rad * math.sin(angle)
z = amp * sinPhi z = amp * sinPhi
self.airplane.reparentTo(render) self.airplane.reparentTo(render)
self.airplane.setH(90 + self.theta + 180) self.airplane.setH(90 + self.theta)
self.airplane.setPos(x, y, z) self.airplane.setPos(x, y, z)
return Task.cont return Task.cont
@ -280,7 +269,7 @@ class DistributedEstate(DistributedObject.DistributedObject):
def __dayTimeTask(self, task): def __dayTimeTask(self, task):
taskName = self.taskName('daytime') 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: if self.dayTrack:
self.dayTrack.finish() self.dayTrack.finish()
self.dayTrack = track self.dayTrack = track
@ -344,8 +333,8 @@ class DistributedEstate(DistributedObject.DistributedObject):
taskMgr.doMethodLater(1, self.__crickets, 'estate-crickets') taskMgr.doMethodLater(1, self.__crickets, 'estate-crickets')
def __crickets(self, task): def __crickets(self, task):
sfx = random.choice(base.cr.playGame.hood.loader.cricketSound) sfx = base.cr.playGame.hood.loader.cricketSound
track = Sequence(Func(base.playSfx, sfx), Wait(1)) track = Sequence(Func(base.playSfx, random.choice(sfx)), Wait(1))
track.start() track.start()
t = random.random() * 20.0 + 1 t = random.random() * 20.0 + 1
taskMgr.doMethodLater(t, self.__crickets, 'estate-crickets') taskMgr.doMethodLater(t, self.__crickets, 'estate-crickets')
@ -376,61 +365,19 @@ class DistributedEstate(DistributedObject.DistributedObject):
if len(base.localAvatar.flowerBasket.flowerList): if len(base.localAvatar.flowerBasket.flowerList):
self.popupFlowerGUI() self.popupFlowerGUI()
def __handleFlowerSaleDone(self, sell = 0): def __handleSaleDone(self, sell = 0):
self.ignore(self.flowerGuiDoneEvent) self.ignore(self.flowerGuiDoneEvent)
self.sendUpdate('completeFlowerSale', [sell]) self.sendUpdate('completeFlowerSale', [sell])
self.ignore('stoppedAsleep') self.ignore('stoppedAsleep')
self.flowerGui.destroy() self.flowerGui.destroy()
self.flowerGui = None self.flowerGui = None
return
def popupFlowerGUI(self): def popupFlowerGUI(self):
self.acceptOnce(self.flowerGuiDoneEvent, self.__handleFlowerSaleDone) self.acceptOnce(self.flowerGuiDoneEvent, self.__handleSaleDone)
self.flowerGui = FlowerSellGUI.FlowerSellGUI(self.flowerGuiDoneEvent) self.flowerGui = FlowerSellGUI.FlowerSellGUI(self.flowerGuiDoneEvent)
self.accept('stoppedAsleep', self.__handleSaleDone) 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): def closedAwardDialog(self, value):
self.awardDialog.destroy() self.awardDialog.destroy()
base.cr.playGame.getPlace().detectedGardenPlotDone() base.cr.playGame.getPlace().detectedGardenPlotDone()

View file

@ -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.' 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.' 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!" 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.' 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.' 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.' ForcedLeaveMintAckMsg = 'The Mint Floor Supervisor was defeated before you could reach him. You did not recover any Cogbucks.'