Base Treasure Chest (no rental yet)

This commit is contained in:
DenialMC 2015-05-11 17:54:45 +03:00
parent 17a352197b
commit ef2ccf2bfe
8 changed files with 113 additions and 10 deletions

View file

@ -362,6 +362,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
@ -2222,6 +2223,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,7 @@
from pandac.PandaModules import *
hashVal = 2946007471L
hashVal = 3970808174L
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
@ -33,7 +33,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
from toontown.tutorial import DistributedBattleTutorial, TutorialManager
from toontown.pets import DistributedPetProxy

View file

@ -1,9 +1,6 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from toontown.toonbase import ToontownGlobals
import HouseGlobals
import time, random
from toontown.fishing.DistributedFishingPondAI import DistributedFishingPondAI
from toontown.fishing.DistributedFishingTargetAI import DistributedFishingTargetAI
from toontown.fishing.DistributedPondBingoManagerAI import DistributedPondBingoManagerAI
@ -12,12 +9,9 @@ from toontown.safezone.DistributedFishingSpotAI import DistributedFishingSpotAI
from toontown.safezone.SZTreasurePlannerAI import SZTreasurePlannerAI
from toontown.safezone import DistributedTreasureAI
from toontown.safezone import TreasureGlobals
from DistributedCannonAI import *
from DistributedTargetAI import *
import CannonGlobals
import TableGlobals
import DistributedTreasureChestAI, CannonGlobals, TableGlobals, HouseGlobals, time, random
class Rental:
def __init__(self, estate):
@ -168,6 +162,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()
@ -189,6 +186,9 @@ class DistributedEstateAI(DistributedObjectAI):
if self.rentalHandle:
self.rentalHandle.destroy()
self.rentalHandle = None
if self.treasureChest:
self.treasureChest.requestDelete()
self.requestDelete()

View file

@ -0,0 +1,71 @@
from direct.distributed import DistributedObject
from pandac.PandaModules import *
from toontown.fishing import FishSellGUI
from toontown.toonbase import ToontownGlobals, TTLocalizer
import TreasureChestGlobals
class DistributedTreasureChest(DistributedObject.DistributedObject):
def __init__(self, cr):
DistributedObject.DistributedObject.__init__(self, cr)
self.cr = cr
self.createModel(53.5, -152.1, 0.025, -330)
self.initCollisions()
def destroy(self):
self.ignore('enter' + self.cSphereNode.getName())
self.cSphereNodePath.removeNode()
self.model.destroy()
self.destroyFishGui()
del self.cSphere
del self.cSphereNode
del self.cSphereNodePath
del self.model
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, 1.0, 0.0, 0.0, 1.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 import DistributedObjectAI
from toontown.fishing import FishGlobals
import TreasureChestGlobals
class DistributedTreasureChestAI(DistributedObjectAI.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

@ -3,7 +3,7 @@ from toontown.toonbase.ToontownGlobals import *
from direct.interval.IntervalGlobal import *
from direct.fsm import ClassicFSM, State
from toontown.safezone import SafeZoneLoader
import random, math, House, Estate, HouseGlobals
import random, math, House, Estate, HouseGlobals
from toontown.coghq import MovingPlatform
from direct.directnotify import DirectNotifyGlobal

View file

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

View file

@ -1637,3 +1637,4 @@ PropIdToColor = [
]
BugReportSite = 'https://bugs.launchpad.net/toontown-united/+filebug'
TreasureChestSphereRadius = 1.0