diff --git a/astron/dclass/united.dc b/astron/dclass/united.dc index a1f1c1c3..ddf124ef 100644 --- a/astron/dclass/united.dc +++ b/astron/dclass/united.dc @@ -359,7 +359,6 @@ from toontown.estate import DistributedBank/AI from toontown.estate import DistributedCloset/AI from toontown.estate import DistributedTrunk/AI from toontown.estate import DistributedPhone/AI -from toontown.estate import DistributedTreasureChest/AI from toontown.effects import DistributedFireworkShow/AI from toontown.estate import DistributedFireworksCannon/AI from toontown.coghq import LobbyManager/AI @@ -1334,6 +1333,8 @@ dclass DistributedEstate : DistributedObject { setSlot5Items(lawnItem items[] = []) required airecv db; setIdList(uint32 []) broadcast ram; completeFlowerSale(uint8) airecv clsend; + completeFishSale(uint8) airecv clsend; + thankSeller(int8, int8, int8); awardedTrophy(uint32) broadcast; setClouds(uint8) required broadcast ram; cannonsOver() broadcast; @@ -2222,11 +2223,6 @@ dclass DistributedPhone : DistributedFurnitureItem { purchaseItemComplete(); }; -dclass DistributedTreasureChest : DistributedObject { - completeSale(bool) airecv clsend; - completeSaleResult(int8, int8, int8); -}; - dclass DistributedFireworkShow : DistributedObject { startShow(uint8, uint8, uint8, int16) broadcast ram; requestFirework(int16/10, int16/10, int16/100, uint8, uint8, uint8) airecv clsend; diff --git a/otp/distributed/DCClassImports.py b/otp/distributed/DCClassImports.py index e4c83560..bde65a54 100644 --- a/otp/distributed/DCClassImports.py +++ b/otp/distributed/DCClassImports.py @@ -2,11 +2,7 @@ from pandac.PandaModules import * -<<<<<<< HEAD hashVal = 2005027427 -======= -hashVal = 2180409862L ->>>>>>> parent of 37fad88... fixed the fish sale at estate from toontown.coghq import DistributedCashbotBossSafe, DistributedCashbotBossCrane, DistributedBattleFactory, DistributedCashbotBossTreasure, DistributedCogHQDoor, DistributedSellbotHQDoor, DistributedFactoryElevatorExt, DistributedMintElevatorExt, DistributedLawOfficeElevatorExt, DistributedLawOfficeElevatorInt, LobbyManager, DistributedMegaCorp, DistributedFactory, DistributedLawOffice, DistributedLawOfficeFloor, DistributedLift, DistributedDoorEntity, DistributedSwitch, DistributedButton, DistributedTrigger, DistributedCrushableEntity, DistributedCrusherEntity, DistributedStomper, DistributedStomperPair, DistributedLaserField, DistributedGolfGreenGame, DistributedSecurityCamera, DistributedMover, DistributedElevatorMarker, DistributedBarrelBase, DistributedGagBarrel, DistributedBeanBarrel, DistributedHealBarrel, DistributedGrid, ActiveCell, DirectionalCell, CrusherCell, DistributedCrate, DistributedSinkingPlatform, BattleBlocker, DistributedMint, DistributedMintRoom, DistributedMintBattle, DistributedStage, DistributedStageRoom, DistributedStageBattle, DistributedLawbotBossGavel, DistributedLawbotCannon, DistributedLawbotChair, DistributedCogKart, DistributedCountryClub, DistributedCountryClubRoom, DistributedMoleField, DistributedCountryClubBattle, DistributedMaze, DistributedFoodBelt, DistributedBanquetTable, DistributedGolfSpot @@ -36,7 +32,7 @@ from toontown.friends import TTUFriendsManager from toontown.cogdominium import DistributedCogdoInterior, DistributedCogdoBattleBldg, DistributedCogdoElevatorExt, DistributedCogdoElevatorInt, DistributedCogdoBarrel, DistCogdoGame, DistCogdoLevelGame, DistCogdoBoardroomGame, DistCogdoCraneGame, DistCogdoMazeGame, DistCogdoFlyingGame, DistCogdoCrane, DistCogdoCraneMoneyBag, DistCogdoCraneCog from toontown.uberdog.ARGManager import ARGManager from otp.distributed import Account, DistributedDistrict, DistributedDirectory -from toontown.estate import DistributedCannon, DistributedTarget, EstateManager, DistributedEstate, DistributedHouse, DistributedHouseInterior, DistributedGarden, DistributedHouseDoor, DistributedMailbox, DistributedFurnitureManager, DistributedFurnitureItem, DistributedBank, DistributedCloset, DistributedTrunk, DistributedPhone, DistributedTreasureChest, DistributedFireworksCannon, DistributedLawnDecor, DistributedGardenPlot, DistributedGardenBox, DistributedFlower, DistributedGagTree, DistributedStatuary, DistributedToonStatuary, DistributedChangingStatuary, DistributedAnimatedStatuary, DistributedPlantBase, DistributedLawnDecor +from toontown.estate import DistributedCannon, DistributedTarget, EstateManager, DistributedEstate, DistributedHouse, DistributedHouseInterior, DistributedGarden, DistributedHouseDoor, DistributedMailbox, DistributedFurnitureManager, DistributedFurnitureItem, DistributedBank, DistributedCloset, DistributedTrunk, DistributedPhone, DistributedFireworksCannon, DistributedLawnDecor, DistributedGardenPlot, DistributedGardenBox, DistributedFlower, DistributedGagTree, DistributedStatuary, DistributedToonStatuary, DistributedChangingStatuary, DistributedAnimatedStatuary, DistributedPlantBase, DistributedLawnDecor from toontown.toon import DistributedToon, DistributedNPCToonBase, DistributedNPCToon, DistributedSmartNPC, DistributedNPCSpecialQuestGiver, DistributedNPCFlippyInToonHall, DistributedNPCScientist, DistributedNPCClerk, DistributedNPCTailor, DistributedNPCBlocker, DistributedNPCFisherman, DistributedNPCPartyPerson, DistributedNPCPetclerk, DistributedNPCKartClerk, DistributedNPCGlove, DistributedNPCLaffRestock from toontown.tutorial import DistributedBattleTutorial, TutorialManager from toontown.pets import DistributedPetProxy diff --git a/toontown/estate/DistributedEstate.py b/toontown/estate/DistributedEstate.py index 90a1d899..02cb8e82 100644 --- a/toontown/estate/DistributedEstate.py +++ b/toontown/estate/DistributedEstate.py @@ -28,6 +28,7 @@ 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,6 +49,7 @@ class DistributedEstate(DistributedObject.DistributedObject): self.idList = [] base.estate = self self.flowerGuiDoneEvent = 'flowerGuiDone' + self.fishGuiDoneEvent = 'fishGuiDone' return def disable(self): @@ -56,6 +58,7 @@ class DistributedEstate(DistributedObject.DistributedObject): self.__stopCrickets() DistributedObject.DistributedObject.disable(self) self.ignore('enterFlowerSellBox') + self.ignore('enterFishSellBox') def delete(self): self.notify.debug('delete') @@ -72,6 +75,7 @@ class DistributedEstate(DistributedObject.DistributedObject): else: self.loadAirplane() self.loadFlowerSellBox() + self.loadFishSellBox() self.oldClear = base.win.getClearColor() base.win.setClearColor(Vec4(0.09, 0.55, 0.21, 1.0)) self.startGame() @@ -365,19 +369,57 @@ class DistributedEstate(DistributedObject.DistributedObject): if len(base.localAvatar.flowerBasket.flowerList): self.popupFlowerGUI() - def __handleSaleDone(self, sell = 0): + def __handleFlowerSaleDone(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.__handleSaleDone) + self.acceptOnce(self.flowerGuiDoneEvent, self.__handleFlowerSaleDone) 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): + self.ignore(self.fishGuiDoneEvent) + self.sendUpdate('completeFishSale', [sell]) + self.ignore('stoppedAsleep') + self.fishGui.destroy() + self.fishGui = None + + def popupFishGUI(self): + 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/estate/DistributedEstateAI.py b/toontown/estate/DistributedEstateAI.py index 82f8f558..12c88f70 100644 --- a/toontown/estate/DistributedEstateAI.py +++ b/toontown/estate/DistributedEstateAI.py @@ -11,7 +11,12 @@ from toontown.safezone import DistributedTreasureAI from toontown.safezone import TreasureGlobals from DistributedCannonAI import * from DistributedTargetAI import * -import DistributedTreasureChestAI, CannonGlobals, TableGlobals, HouseGlobals, time, random +import CannonGlobals +import TableGlobals +import HouseGlobals +import time +import random +from toontown.fishing import FishGlobals class Rental: def __init__(self, estate): @@ -158,9 +163,6 @@ class DistributedEstateAI(DistributedObjectAI): spot.generateWithRequired(self.zoneId) self.spots.append(spot) - self.treasureChest = DistributedTreasureChestAI.DistributedTreasureChestAI(self.air) - self.treasureChest.generateWithRequired(self.zoneId) - self.createTreasurePlanner() def destroy(self): @@ -182,9 +184,6 @@ class DistributedEstateAI(DistributedObjectAI): self.rentalHandle.destroy() self.rentalHandle = None - if self.treasureChest: - self.treasureChest.requestDelete() - self.requestDelete() def setEstateReady(self): @@ -483,6 +482,19 @@ class DistributedEstateAI(DistributedObjectAI): def completeFlowerSale(self, todo0): pass + def completeFishSale(self, sell): + avId = self.air.getAvatarIdFromSender() + av = self.air.doId2do.get(avId) + if av: + if sell: + trophyResult = self.air.fishManager.creditFishTank(av) + if trophyResult: + self.sendUpdateToAvatarId(avId, 'thankSeller', [ToontownGlobals.FISHSALE_TROPHY, len(av.fishCollection), FishGlobals.getTotalNumFish()]) + else: + self.sendUpdateToAvatarId(avId, 'thankSeller', [ToontownGlobals.FISHSALE_COMPLETE, 0, 0]) + else: + self.sendUpdateToAvatarId(avId, 'thankSeller', [ToontownGlobals.FISHSALE_NONE, 0, 0]) + def awardedTrophy(self, todo0): pass diff --git a/toontown/estate/DistributedTreasureChest.py b/toontown/estate/DistributedTreasureChest.py deleted file mode 100644 index 22585152..00000000 --- a/toontown/estate/DistributedTreasureChest.py +++ /dev/null @@ -1,72 +0,0 @@ -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): - - def __init__(self, cr): - DistributedObject.__init__(self, cr) - self.cr = cr - self.createModel(45, -165.75, 0.025, 210) - self.initCollisions() - - def delete(self): - self.ignore('enter' + self.cSphereNode.getName()) - self.cSphereNodePath.removeNode() - self.model.removeNode() - self.destroyFishGui() - del self.cSphere - del self.cSphereNode - del self.cSphereNodePath - del self.model - DistributedObject.delete(self) - - def destroyFishGui(self): - self.ignore('treasureChestSell') - - if hasattr(self, 'fishGui'): - self.fishGui.destroy() - del self.fishGui - - def createModel(self, x, y, z, h): - self.model = loader.loadModel('phase_4/models/minigames/treasure_chest.bam') - self.model.reparentTo(render) - self.model.setScale(1.5) - self.model.setPos(x, y, z) - self.model.setH(h) - - def initCollisions(self): - self.cSphere = CollisionTube(0.0, 0.0, 0.0, 0.0, 0.0, 5.0, ToontownGlobals.TreasureChestSphereRadius) - self.cSphere.setTangible(0) - self.cSphereNode = CollisionNode('cSphereNode') - self.cSphereNode.addSolid(self.cSphere) - self.cSphereNodePath = self.model.attachNewNode(self.cSphereNode) - 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) - return - - base.setCellsActive(base.bottomCells, 0) - 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) diff --git a/toontown/estate/DistributedTreasureChestAI.py b/toontown/estate/DistributedTreasureChestAI.py deleted file mode 100644 index 13ec4743..00000000 --- a/toontown/estate/DistributedTreasureChestAI.py +++ /dev/null @@ -1,22 +0,0 @@ -from direct.distributed.DistributedObjectAI import DistributedObjectAI -from toontown.fishing import FishGlobals -import TreasureChestGlobals - -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]) diff --git a/toontown/estate/TreasureChestGlobals.py b/toontown/estate/TreasureChestGlobals.py deleted file mode 100644 index 5beb4a22..00000000 --- a/toontown/estate/TreasureChestGlobals.py +++ /dev/null @@ -1,3 +0,0 @@ -TROPHY = 0 -COMPLETE = 1 -NONE = 2 diff --git a/toontown/toonbase/ToontownGlobals.py b/toontown/toonbase/ToontownGlobals.py index 8f3c1ac1..7cba83ed 100644 --- a/toontown/toonbase/ToontownGlobals.py +++ b/toontown/toonbase/ToontownGlobals.py @@ -1639,5 +1639,7 @@ PropIdToColor = [ ] BugReportSite = 'https://bugs.launchpad.net/toontown-united/+filebug' -TreasureChestSphereRadius = 1.0 CostPerLaffRestock = 3 +FISHSALE_NONE = 0 +FISHSALE_COMPLETE = 1 +FISHSALE_TROPHY = 2