Zach stop breaking shit too k

This commit is contained in:
Master Voltage 2015-05-14 16:12:19 -04:00
parent 8d33330192
commit 7fa0bf6d73
8 changed files with 119 additions and 70 deletions

View file

@ -359,6 +359,7 @@ 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
@ -1333,8 +1334,6 @@ 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;
@ -2223,6 +2222,11 @@ 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;

View file

@ -2,7 +2,11 @@
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
@ -32,7 +36,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, 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, DistributedTreasureChest, 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

View file

@ -28,7 +28,6 @@ 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):
@ -49,7 +48,6 @@ class DistributedEstate(DistributedObject.DistributedObject):
self.idList = []
base.estate = self
self.flowerGuiDoneEvent = 'flowerGuiDone'
self.fishGuiDoneEvent = 'fishGuiDone'
return
def disable(self):
@ -58,7 +56,6 @@ class DistributedEstate(DistributedObject.DistributedObject):
self.__stopCrickets()
DistributedObject.DistributedObject.disable(self)
self.ignore('enterFlowerSellBox')
self.ignore('enterFishSellBox')
def delete(self):
self.notify.debug('delete')
@ -75,7 +72,6 @@ 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()
@ -369,57 +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):
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()

View file

@ -11,12 +11,7 @@ from toontown.safezone import DistributedTreasureAI
from toontown.safezone import TreasureGlobals
from DistributedCannonAI import *
from DistributedTargetAI import *
import CannonGlobals
import TableGlobals
import HouseGlobals
import time
import random
from toontown.fishing import FishGlobals
import DistributedTreasureChestAI, CannonGlobals, TableGlobals, HouseGlobals, time, random
class Rental:
def __init__(self, estate):
@ -163,6 +158,9 @@ 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):
@ -184,6 +182,9 @@ class DistributedEstateAI(DistributedObjectAI):
self.rentalHandle.destroy()
self.rentalHandle = None
if self.treasureChest:
self.treasureChest.requestDelete()
self.requestDelete()
def setEstateReady(self):
@ -482,19 +483,6 @@ 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

View file

@ -0,0 +1,72 @@
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)

View file

@ -0,0 +1,22 @@
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])

View file

@ -0,0 +1,3 @@
TROPHY = 0
COMPLETE = 1
NONE = 2

View file

@ -1639,7 +1639,5 @@ PropIdToColor = [
]
BugReportSite = 'https://bugs.launchpad.net/toontown-united/+filebug'
TreasureChestSphereRadius = 1.0
CostPerLaffRestock = 3
FISHSALE_NONE = 0
FISHSALE_COMPLETE = 1
FISHSALE_TROPHY = 2