Dumm dumm dumm.. the Bank Update

This commit is contained in:
DenialMC 2015-04-08 14:51:59 +03:00
parent d36f957694
commit 4ef9b360bd
36 changed files with 266 additions and 1078 deletions

View file

@ -41,7 +41,6 @@ dclass Account {
string LAST_LOGIN db;
string ACCOUNT_ID db;
uint16 ACCESS_LEVEL db;
uint32 MONEY db;
};
struct BarrierData {
@ -498,8 +497,6 @@ from toontown.building import DistributedHQInterior/AI
from toontown.building import DistributedGagshopInterior/AI
from toontown.building import DistributedPetshopInterior/AI
from toontown.building import DistributedKartShopInterior/AI
from toontown.building import DistributedBankInterior/AI
from toontown.building import DistributedBankCollectable/AI
from toontown.building import DistributedLibraryInterior/AI
from toontown.building import DistributedDoor/AI
from toontown.building import DistributedAnimDoor/AI
@ -538,12 +535,10 @@ from toontown.building import DistributedCJElevator/AI
from toontown.building import DistributedBBElevator/AI
from toontown.building import DistributedBoardingParty/AI
from toontown.building import DistributedTutorialInterior/AI
from toontown.estate import DistributedBankMgr/AI
from toontown.estate import DistributedMailbox/AI
from toontown.estate import DistributedFurnitureManager/AI
from toontown.estate import DistributedFurnitureItem/AI
from toontown.estate import DistributedBank/AI
from toontown.toon import DistributedNPCBanker/AI
from toontown.estate import DistributedCloset/AI
from toontown.estate import DistributedTrunk/AI
from toontown.estate import DistributedPhone/AI
@ -844,6 +839,8 @@ dclass DistributedToon : DistributedPlayer {
setGM(uint16 = 0) required broadcast ownrecv db;
setMoney(int16 = 0) required ownrecv db;
setBankMoney(int32 = 0) required ownrecv;
setMaxMoney(int16 = 40) required broadcast ownrecv db;
setBankMaxMoney(int32 = 10000) required broadcast ownrecv db;
setMaxHp(int16 = 15) required broadcast ownrecv db;
setHp(int16 = 15) required broadcast ownrecv db;
toonUp(uint16) broadcast ownrecv;
@ -2065,11 +2062,6 @@ dclass DistributedKartShopInterior : DistributedObject {
setZoneIdAndBlock(uint32, uint16) required broadcast ram;
};
dclass DistributedBankInterior : DistributedObject {
setZoneIdAndBlock(uint32, uint16) required broadcast ram;
setState(string, int16) broadcast ram;
};
dclass DistributedLibraryInterior : DistributedObject {
setZoneIdAndBlock(uint32, uint16) required broadcast ram;
};
@ -2130,12 +2122,6 @@ dclass DistributedSmartNPC : DistributedNPCToonBase {
dismiss(uint32, uint16) broadcast ram;
};
dclass DistributedNPCBanker : DistributedNPCToonBase {
setMovie(uint8, uint32, int16) broadcast ram;
setMovieDone() airecv clsend;
transferMoney(int16) airecv clsend;
};
dclass DistributedNPCSpecialQuestGiver : DistributedNPCToonBase {
setMovie(uint8, uint32, uint32, uint16[], int16) broadcast ram;
setMovieDone() airecv clsend;
@ -2357,10 +2343,6 @@ dclass DistributedTutorialInterior : DistributedObject {
setTutorialNpcId(uint32) required broadcast ram;
};
dclass DistributedBankMgr : DistributedObject {
transferMoney(int16) airecv clsend;
};
dclass DistributedMailbox : DistributedObject {
setHouseId(uint32) required broadcast ram;
setHousePos(uint8) required broadcast ram;
@ -2428,11 +2410,6 @@ dclass DistributedBank : DistributedFurnitureItem {
transferMoney(int16) airecv clsend;
};
dclass DistributedBankCollectable : DistributedObject {
requestGrab() airecv clsend;
grab(uint32) broadcast ram;
};
dclass DistributedCloset : DistributedFurnitureItem {
setOwnerId(uint32) required broadcast ram;
enterAvatar() airecv clsend;

View file

@ -2,12 +2,12 @@
from pandac.PandaModules import *
hashVal = 2950658935L
hashVal = 348192052
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
from toontown.golf import DistributedPhysicsWorld, DistributedGolfHole, DistributedGolfCourse
from toontown.building import DistributedAnimatedProp, DistributedTrophyMgr, DistributedBuilding, DistributedAnimBuilding, DistributedBuildingQueryMgr, DistributedToonInterior, DistributedToonHallInterior, DistributedSuitInterior, DistributedHQInterior, DistributedGagshopInterior, DistributedPetshopInterior, DistributedKartShopInterior, DistributedBankInterior, DistributedBankCollectable, DistributedLibraryInterior, DistributedDoor, DistributedAnimDoor, DistributedKnockKnockDoor, DistributedElevator, DistributedElevatorFSM, DistributedElevatorExt, DistributedElevatorInt, DistributedElevatorFloor, DistributedBossElevator, DistributedVPElevator, DistributedCFOElevator, DistributedCJElevator, DistributedBBElevator, DistributedBoardingParty, DistributedTutorialInterior, DistributedClubElevator
from toontown.building import DistributedAnimatedProp, DistributedTrophyMgr, DistributedBuilding, DistributedAnimBuilding, DistributedBuildingQueryMgr, DistributedToonInterior, DistributedToonHallInterior, DistributedSuitInterior, DistributedHQInterior, DistributedGagshopInterior, DistributedPetshopInterior, DistributedKartShopInterior, DistributedLibraryInterior, DistributedDoor, DistributedAnimDoor, DistributedKnockKnockDoor, DistributedElevator, DistributedElevatorFSM, DistributedElevatorExt, DistributedElevatorInt, DistributedElevatorFloor, DistributedBossElevator, DistributedVPElevator, DistributedCFOElevator, DistributedCJElevator, DistributedBBElevator, DistributedBoardingParty, DistributedTutorialInterior, DistributedClubElevator
from toontown.uberdog.DistributedPartyManager import DistributedPartyManager
from otp.friends import FriendManager, PlayerFriendsManager, GuildManager, FriendInfo, AvatarFriendInfo
from otp.level import DistributedLevel, DistributedEntity, DistributedInteractiveEntity
@ -34,8 +34,8 @@ from toontown.coghq.InGameEditorDCImports import *
from toontown.friends import TTPlayerFriendsManager, TTUFriendsManager
from toontown.cogdominium import DistributedCogdoInterior, DistributedCogdoBattleBldg, DistributedCogdoElevatorExt, DistributedCogdoElevatorInt, DistributedCogdoBarrel, DistCogdoGame, DistCogdoLevelGame, DistCogdoBoardroomGame, DistCogdoCraneGame, DistCogdoMazeGame, DistCogdoFlyingGame, DistCogdoCrane, DistCogdoCraneMoneyBag, DistCogdoCraneCog
from otp.distributed import Account, ObjectServer, DistributedDistrict, DistributedDirectory, DistributedTestObject, CentralLogger
from toontown.estate import DistributedCannon, DistributedTarget, EstateManager, DistributedEstate, DistributedHouse, DistributedHouseInterior, DistributedGarden, DistributedHouseDoor, DistributedBankMgr, 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, DistributedSmartNPC, DistributedNPCSpecialQuestGiver, DistributedNPCFlippyInToonHall, DistributedNPCScientist, DistributedNPCClerk, DistributedNPCTailor, DistributedNPCBlocker, DistributedNPCFisherman, DistributedNPCPartyPerson, DistributedNPCPetclerk, DistributedNPCKartClerk, DistributedNPCGlove, DistributedNPCBanker
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, DistributedSmartNPC, DistributedNPCSpecialQuestGiver, DistributedNPCFlippyInToonHall, DistributedNPCScientist, DistributedNPCClerk, DistributedNPCTailor, DistributedNPCBlocker, DistributedNPCFisherman, DistributedNPCPartyPerson, DistributedNPCPetclerk, DistributedNPCKartClerk, DistributedNPCGlove
from toontown.tutorial import DistributedBattleTutorial, TutorialManager
from toontown.pets import DistributedPetProxy
from toontown.coderedemption.TTCodeRedemptionMgr import TTCodeRedemptionMgr

View file

@ -13,6 +13,7 @@
# when that fails, the next aux-display line, and so on.
load-display pandagl
no-singular-invert 1
#load-display pandadx9
#load-display pandadx8
#load-display pandagles

View file

@ -1,90 +0,0 @@
from direct.fsm.FSM import FSM
from toontown.toonbase import ToontownGlobals
class OperationFSM(FSM):
def __init__(self, air, bankMgr):
FSM.__init__(self, 'OperationFSM')
self.air = air
self.bankMgr = bankMgr
def enterOff(self):
if self.target:
del self.bankMgr.avId2fsm[self.target]
class BankRetrieveFSM(OperationFSM):
def enterStart(self, avId, DISLid):
self.target = avId
self.DISLid = DISLid
self.air.dbInterface.queryObject(
self.air.dbId, self.DISLid, self.__handleRetrieve)
def __handleRetrieve(self, dclass, fields):
if dclass == self.air.dclassesByName['AccountAI']:
money = fields['MONEY']
av = self.air.doId2do.get(self.target)
if not av:
self.demand('Off')
return
av.b_setBankMoney(money)
self.demand('Off')
def enterOff(self):
messenger.send('bankDone-%s' % self.target)
OperationFSM.enterOff(self)
class BankUpdateFSM(OperationFSM):
def enterStart(self, avId, DISLid, money):
self.target = avId
money = min(money, ToontownGlobals.MaxBankMoney)
if money < 0:
self.demand('Off')
return
self.air.dbInterface.updateObject(
self.air.dbId,
DISLid,
self.air.dclassesByName['AccountAI'],
{'MONEY': money})
av = self.air.doId2do.get(self.target)
if not av:
self.demand('Off')
return
av.b_setBankMoney(money)
self.demand('Off')
class BankManagerAI:
def __init__(self, air):
self.air = air
self.avId2fsm = {}
def performFSM(self, target, fsmClass, *args):
self.avId2fsm[target] = fsmClass(self.air, self)
self.avId2fsm[target].request('Start', *args)
def setMoney(self, avId, money):
av = self.air.doId2do.get(avId)
if not av:
return
DISLid = av.getDISLid()
self.performFSM(avId, BankUpdateFSM, avId, DISLid, money)
def getMoney(self, avId):
av = self.air.doId2do.get(avId)
if not av:
return
DISLid = av.getDISLid()
self.performFSM(avId, BankRetrieveFSM, avId, DISLid)
return 'bankDone-%s' % avId

View file

@ -250,9 +250,6 @@ class NewsManager(DistributedObject.DistributedObject):
elif holidayId == ToontownGlobals.JELLYBEAN_PARTIES_HOLIDAY_MONTH:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setJellybeanMonthHolidayStart()
elif holidayId == ToontownGlobals.BANK_UPGRADE_HOLIDAY:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setBankUpgradeHolidayStart()
elif holidayId == ToontownGlobals.BLACK_CAT_DAY:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setBlackCatHolidayStart()
@ -500,9 +497,6 @@ class NewsManager(DistributedObject.DistributedObject):
def setJellybeanPartiesHolidayEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanPartiesHolidayEnd)
def setBankUpgradeHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.BankUpgradeHolidayStart)
def setHalloweenPropsHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.HalloweenPropsHolidayStart)

View file

@ -16,7 +16,6 @@ from toontown.ai.HolidayManagerAI import HolidayManagerAI
from toontown.ai.NewsManagerAI import NewsManagerAI
from toontown.ai.QuestManagerAI import QuestManagerAI
from toontown.ai.DistributedBlackCatMgrAI import DistributedBlackCatMgrAI
from toontown.ai import BankManagerAI
from toontown.catalog.AccountDateAI import AccountDateAI
from toontown.building.DistributedBuildingQueryMgrAI import DistributedBuildingQueryMgrAI
from toontown.building.DistributedTrophyMgrAI import DistributedTrophyMgrAI
@ -121,7 +120,6 @@ class ToontownAIRepository(ToontownInternalRepository):
self.cogSuitMgr = CogSuitManagerAI.CogSuitManagerAI(self)
self.promotionMgr = PromotionManagerAI.PromotionManagerAI(self)
self.cogPageManager = CogPageManagerAI.CogPageManagerAI()
self.bankManager = BankManagerAI.BankManagerAI(self)
self.holidayManager = HolidayManagerAI(self)
self.codeRedemptionMgr = TTCodeRedemptionMgrAI(self)
self.codeRedemptionMgr.generateWithRequired(2)

View file

@ -1,45 +0,0 @@
from pandac.PandaModules import *
from toontown.building import DistributedBankInteriorAI
from toontown.building import DistributedDoorAI
from toontown.building import DoorTypes
from toontown.toon import NPCToons
class BankBuildingAI:
def __init__(self, air, exteriorZone, interiorZone, blockNumber):
self.air = air
self.exteriorZone = exteriorZone
self.interiorZone = interiorZone
self.setup(blockNumber)
def cleanup(self):
for npc in self.npcs:
npc.requestDelete()
del self.npcs
self.door.requestDelete()
del self.door
self.insideDoor.requestDelete()
del self.insideDoor
self.interior.requestDelete()
del self.interior
def setup(self, blockNumber):
self.interior = DistributedBankInteriorAI.DistributedBankInteriorAI(
blockNumber, self.air, self.interiorZone)
self.interior.generateWithRequired(self.interiorZone)
self.npcs = NPCToons.createNpcsInZone(self.air, self.interiorZone)
door = DistributedDoorAI.DistributedDoorAI(
self.air, blockNumber, DoorTypes.EXT_STANDARD)
insideDoor = DistributedDoorAI.DistributedDoorAI(
self.air, blockNumber, DoorTypes.INT_STANDARD)
door.setOtherDoor(insideDoor)
insideDoor.setOtherDoor(door)
door.zoneId = self.exteriorZone
insideDoor.zoneId = self.interiorZone
door.generateWithRequired(self.exteriorZone)
insideDoor.generateWithRequired(self.interiorZone)
self.door = door
self.insideDoor = insideDoor

View file

@ -1,143 +0,0 @@
from direct.distributed.DistributedObject import DistributedObject
from direct.interval.IntervalGlobal import *
from pandac.PandaModules import *
from otp.otpbase import OTPGlobals
from toontown.effects import DustCloud
class DistributedBankCollectable(DistributedObject):
def __init__(self, cr):
DistributedObject.__init__(self, cr)
self.grabbed = False
self.nodePath = None
self.bankCollectable = None
self.collNodePath = None
self.grabSound = None
self.rotateIval = None
self.floatIval = None
self.flyTrack = None
def announceGenerate(self):
DistributedObject.announceGenerate(self)
self.nodePath = NodePath(self.uniqueName('bankCollectable'))
self.nodePath.setScale(0.9)
self.bankCollectable = self.nodePath.attachNewNode('bankCollectable')
collSphere = CollisionSphere(0, 0, 0, 2)
collSphere.setTangible(0)
collNode = CollisionNode(self.uniqueName('bankCollectableSphere'))
collNode.setIntoCollideMask(OTPGlobals.WallBitmask)
collNode.addSolid(collSphere)
self.collNodePath = self.nodePath.attachNewNode(collNode)
model = loader.loadModel('phase_5.5/models/estate/jellybeanJar.bam')
model.setTransparency(TransparencyAttrib.MDual, 1)
model.find('**/jellybeansinbowl').setColorScale(1, 1, 1, 0.5)
model.reparentTo(self.bankCollectable)
self.grabSound = loader.loadSfx('phase_4/audio/sfx/SZ_DD_treasure.ogg')
self.nodePath.wrtReparentTo(render)
jellybeanjar = self.bankCollectable.find('**/jellybeanjar')
self.rotateTrack = LerpHprInterval(jellybeanjar, 5, Vec3(360, 0, 0))
self.rotateTrack.loop()
self.floatTrack = Sequence()
self.floatTrack.append(LerpPosInterval(self.nodePath, 2, Point3(-22, 27.5, 2), startPos=Point3(-22, 27.5, 1.5)))
self.floatTrack.append(LerpPosInterval(self.nodePath, 2, Point3(-22, 27.5, 1.5), startPos=Point3(-22, 27.5, 2)))
self.floatTrack.loop()
glow = jellybeanjar.copyTo(self.bankCollectable)
glow.setScale(1.1)
glowTrack = Sequence()
glowTrack.append(LerpColorScaleInterval(glow, 2.5, Vec4(0.6, 0.6, 0, 0.6), startColorScale=Vec4(0.4, 0.4, 0, 0.6)))
glowTrack.append(LerpColorScaleInterval(glow, 2.5, Vec4(0.4, 0.4, 0, 0.6), startColorScale=Vec4(0.6, 0.6, 0, 0.6)))
glowTrack.loop()
self.accept(self.uniqueName('enterbankCollectableSphere'), self.__handleEnterSphere)
def disable(self):
self.ignoreAll()
DistributedObject.disable(self)
def delete(self):
# When the bank collectable is deleted, and has not been grabbed, do a
# poof effect:
if not self.grabbed:
dustCloud = DustCloud.DustCloud(fBillboard=0)
dustCloud.setBillboardAxis(2.0)
dustCloud.setZ(4)
dustCloud.setScale(0.4)
dustCloud.createTrack()
dustCloud.reparentTo(render)
dustCloud.setPos(self.nodePath.getPos())
Sequence(dustCloud.track, Func(dustCloud.destroy)).start()
if self.flyTrack is not None:
self.flyTrack.finish()
self.flyTrack = None
if self.floatTrack is not None:
self.floatTrack.finish()
self.floatTrack = None
if self.rotateTrack is not None:
self.rotateTrack.finish()
self.rotateTrack = None
if self.nodePath is not None:
self.nodePath.removeNode()
self.nodePath = None
DistributedObject.delete(self)
def grab(self, avId):
self.__handleGrab(avId)
def d_requestGrab(self):
self.sendUpdate('requestGrab', [])
def __handleUnexpectedExit(self):
if self.flyTrack:
self.flyTrack.finish()
self.flyTrack = None
def __handleEnterSphere(self, collEntry=None):
self.d_requestGrab()
def __handleGrab(self, avId):
self.collNodePath.stash()
self.grabbed = True
av = self.cr.doId2do.get(avId)
if not av:
self.nodePath.removeNode()
self.nodePath = None
return
base.playSfx(self.grabSound, node=self.nodePath)
self.nodePath.wrtReparentTo(av)
if self.flyTrack:
self.flyTrack.finish()
self.flyTrack = None
unexpectedExitEvent = av.uniqueName('disable')
self.accept(unexpectedExitEvent, self.__handleUnexpectedExit)
track = Sequence(
LerpPosInterval(
self.nodePath, 1, pos=Point3(0, 0, 3),
startPos=self.nodePath.getPos(), blendType='easeInOut'),
Func(self.nodePath.detachNode),
Func(self.ignore, unexpectedExitEvent))
self.flyTrack = Sequence(track, name=self.uniqueName('flyTrack'))
self.flyTrack.start()

View file

@ -1,20 +0,0 @@
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from direct.task.Task import Task
class DistributedBankCollectableAI(DistributedObjectAI):
def requestGrab(self):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if not av:
return
self.sendUpdate('grab', [avId])
av.addMoney(100)
taskName = self.uniqueName('deleteBankCollectable')
taskMgr.doMethodLater(5, self.__handleDeleteBankCollectable, taskName)
def __handleDeleteBankCollectable(self, task):
self.requestDelete()
return Task.done

View file

@ -1,239 +0,0 @@
from direct.distributed.ClockDelta import *
from direct.distributed.DistributedObject import DistributedObject
from direct.fsm import ClassicFSM, State
from direct.interval.IntervalGlobal import *
from pandac.PandaModules import *
import random
import ToonInteriorColors
from toontown.dna.DNAParser import *
from toontown.hood import ZoneUtil
from toontown.toon.DistributedNPCToonBase import DistributedNPCToonBase
from toontown.toonbase.ToonBaseGlobal import *
from toontown.toonbase.ToontownGlobals import *
class DistributedBankInterior(DistributedObject):
def __init__(self, cr):
DistributedObject.__init__(self, cr)
self.dnaStore = cr.playGame.dnaStore
self.inVault = False
self.vaultCollNodePath = None
self.fsm = ClassicFSM.ClassicFSM(
'DistributedBankInterior',
[
State.State('off', self.enterOff, self.exitOff,
['vaultClosed', 'vaultOpening', 'vaultOpen', 'vaultClosing']),
State.State('vaultClosed', self.enterVaultClosed, self.exitVaultClosed,
['vaultOpening']),
State.State('vaultOpening', self.enterVaultOpening, self.exitVaultOpening,
['vaultOpen']),
State.State('vaultOpen', self.enterVaultOpen, self.exitVaultOpen,
['vaultClosing']),
State.State('vaultClosing', self.enterVaultClosing, self.exitVaultClosing,
['vaultClosed'])
], 'off', 'off')
self.fsm.enterInitialState()
def announceGenerate(self):
DistributedObject.announceGenerate(self)
self.setup()
def disable(self):
self.ignoreAll()
self.interior.removeNode()
del self.interior
if self.collNodePath is not None:
self.collNodePath.removeNode()
self.collNodePath = None
del self.vaultOpenSfx
del self.vaultCloseSfx
DistributedObject.disable(self)
def setZoneIdAndBlock(self, zoneId, block):
self.zoneId = zoneId
self.block = block
def setState(self, name, timestamp):
self.fsm.request(name, [globalClockDelta.localElapsedTime(timestamp)])
def enterOff(self):
pass
def exitOff(self):
pass
def enterVaultClosed(self, timestamp):
vaultDoor = render.find('**/vault_door')
vaultDoor.setH(0)
if self.inVault:
self.clearVault()
def exitVaultClosed(self):
pass
def enterVaultOpening(self, timestamp):
vaultDoor = render.find('**/vault_door')
doorTrack = Sequence()
# First, spin the vault lock dial:
dial = vaultDoor.find('**/vault_door_front_dial')
doorTrack.append(LerpHprInterval(dial, 2, Vec3(0, 0, -2160), startHpr=(0, 0, 0), blendType='easeOut', fluid=1))
# Then, open the vault door:
doorTrack.append(LerpHprInterval(vaultDoor, 3, Vec3(-120, 0, 0), startHpr=Vec3(0, 0, 0), blendType='easeOut'))
# We need the sound effect to play in parallel:
track = Parallel(SoundInterval(self.vaultOpenSfx, node=vaultDoor), doorTrack)
track.start(timestamp)
def exitVaultOpening(self):
pass
def enterVaultOpen(self, timestamp):
vaultDoor = render.find('**/vault_door')
vaultDoor.setH(-120)
def exitVaultOpen(self):
pass
def enterVaultClosing(self, timestamp):
vaultDoor = render.find('**/vault_door')
doorTrack = Sequence()
# First, close the vault door:
doorTrack.append(LerpHprInterval(vaultDoor, 3, Vec3(0, 0, 0), startHpr=Vec3(-120, 0, 0), blendType='easeOut'))
# Then, spin the vault lock dial:
dial = vaultDoor.find('**/vault_door_front_dial')
doorTrack.append(LerpHprInterval(dial, 2, Vec3(0, 0, 2160), startHpr=(0, 0, 0), blendType='easeOut', fluid=1))
# We need the sound effect to play in parallel:
track = Parallel(SoundInterval(self.vaultCloseSfx, node=vaultDoor), doorTrack)
track.start(timestamp)
def exitVaultClosing(self):
pass
def __handleEnterVaultBox(self, collEntry=None):
self.inVault = True
if self.fsm.getCurrentState().getName() == 'vaultClosed':
self.clearVault()
def __handleExitVaultBox(self, collEntry=None):
self.inVault = False
def clearVault(self):
place = base.cr.playGame.getPlace()
place.setState('stopped')
self.teleportTrack = Sequence()
self.teleportTrack.append(Func(base.localAvatar.b_setAnimState, 'TeleportOut'))
self.teleportTrack.append(Wait(3.5))
self.teleportTrack.append(Func(base.localAvatar.setPos, Point3(0, 0, 0)))
self.teleportTrack.append(Func(base.localAvatar.b_setAnimState, 'TeleportIn'))
self.teleportTrack.append(Wait(2.25))
self.teleportTrack.append(Func(place.setState, 'walk'))
self.teleportTrack.start()
def randomDNAItem(self, category, findFunc):
codeCount = self.dnaStore.getNumCatalogCodes(category)
index = self.randomGenerator.randint(0, codeCount - 1)
code = self.dnaStore.getCatalogCode(category, index)
return findFunc(code)
def replaceRandomInModel(self, model):
baseTag = 'random_'
npc = model.findAllMatches('**/' + baseTag + '???_*')
for i in xrange(npc.getNumPaths()):
np = npc.getPath(i)
name = np.getName()
b = len(baseTag)
category = name[b + 4:]
key1 = name[b]
key2 = name[b + 1]
if key1 == 'm':
model = self.randomDNAItem(category, self.dnaStore.findNode)
newNP = model.copyTo(np)
if key2 == 'r':
self.replaceRandomInModel(newNP)
elif key1 == 't':
texture = self.randomDNAItem(category, self.dnaStore.findTexture)
np.setTexture(texture, 100)
newNP = np
if key2 == 'c':
if category == 'TI_wallpaper' or category == 'TI_wallpaper_border':
self.randomGenerator.seed(self.zoneId)
newNP.setColorScale(self.randomGenerator.choice(self.colors[category]))
else:
newNP.setColorScale(self.randomGenerator.choice(self.colors[category]))
def chooseDoor(self):
doorModelName = 'door_double_round_ul'
if doorModelName[-1:] == 'r':
doorModelName = doorModelName[:-1] + 'l'
else:
doorModelName = doorModelName[:-1] + 'r'
door = self.dnaStore.findNode(doorModelName)
return door
def setup(self):
self.dnaStore = base.cr.playGame.dnaStore
self.randomGenerator = random.Random()
self.randomGenerator.seed(self.zoneId)
self.interior = loader.loadModel('phase_4/models/modules/ttc_bank_interior.bam')
self.interior.reparentTo(render)
self.vaultOpenSfx = loader.loadSfx('phase_4/audio/sfx/vault_door_open.ogg')
self.vaultCloseSfx = loader.loadSfx('phase_4/audio/sfx/vault_door_close.ogg')
hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId)
self.colors = ToonInteriorColors.colors[hoodId]
self.replaceRandomInModel(self.interior)
door = self.chooseDoor()
doorOrigin = render.find('**/door_origin;+s')
doorNP = door.copyTo(doorOrigin)
doorOrigin.setScale(0.8, 0.8, 0.8)
doorOrigin.setPos(doorOrigin, 0, -0.025, 0)
doorColor = self.randomGenerator.choice(self.colors['TI_door'])
setupDoor(doorNP, self.interior, doorOrigin, self.dnaStore, str(self.block), doorColor)
doorFrame = doorNP.find('door_*_flat')
doorFrame.wrtReparentTo(self.interior)
doorFrame.setColor(doorColor)
del self.colors
del self.dnaStore
del self.randomGenerator
room = render.find('**/vault_walls')
minPoint, maxPoint = room.getTightBounds()
offset = 1 # We want a slight offset
maxPoint -= offset
collBox = CollisionBox(minPoint, maxPoint)
collBox.setTangible(0)
collNode = CollisionNode(self.uniqueName('vaultBox'))
collNode.setIntoCollideMask(BitMask32(1))
collNode.addSolid(collBox)
self.collNodePath = render.attachNewNode(collNode)
radius = ((maxPoint-minPoint) / 2).getZ()
self.collNodePath.setPos(-11.2 + (offset/2), 14 + radius + offset, 0)
for npcToon in self.cr.doFindAllInstances(DistributedNPCToonBase):
npcToon.initToonState()
self.accept(self.uniqueName('entervaultBox'), self.__handleEnterVaultBox)
self.accept(self.uniqueName('exitvaultBox'), self.__handleExitVaultBox)

View file

@ -1,59 +0,0 @@
from direct.distributed.ClockDelta import *
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from direct.task.Task import Task
import time
from otp.ai.MagicWordGlobal import *
from toontown.building.DistributedBankCollectableAI import DistributedBankCollectableAI
class DistributedBankInteriorAI(DistributedObjectAI):
def __init__(self, block, air, zoneId):
DistributedObjectAI.__init__(self, air)
self.block = block
self.zoneId = zoneId
self.bankCollectable = None
def announceGenerate(self):
DistributedObjectAI.announceGenerate(self)
self.sendUpdate('setState', ['vaultClosed', 0])
delay = 3600 - (int(time.time()) % 3600) # Time until the next hour.
taskMgr.doMethodLater(delay, self.createBankCollectable, 'createBankCollectable')
def getZoneIdAndBlock(self):
return [self.zoneId, self.block]
def __handleDeleteBankCollectable(self, task):
if self.bankCollectable is not None:
self.bankCollectable.requestDelete()
self.bankCollectable = None
self.sendUpdate('setState', ['vaultClosing', globalClockDelta.getRealNetworkTime()])
taskMgr.doMethodLater(5, self.closedTask, self.uniqueName('closedTask'))
return Task.done
def createBankCollectable(self, task=None):
self.bankCollectable = DistributedBankCollectableAI(self.air)
self.bankCollectable.generateWithRequired(self.zoneId)
self.sendUpdate('setState', ['vaultOpening', globalClockDelta.getRealNetworkTime()])
taskMgr.doMethodLater(5, self.openedTask, self.uniqueName('openedTask'))
taskMgr.doMethodLater(3600, self.createBankCollectable, 'createBankCollectable')
taskMgr.doMethodLater(60, self.__handleDeleteBankCollectable, 'deleteBankCollectable')
if task is not None:
return Task.done
def closedTask(self, task):
self.sendUpdate('setState', ['vaultClosed', 0])
return Task.done
def openedTask(self, task):
self.sendUpdate('setState', ['vaultOpen', 0])
return Task.done

View file

@ -6,7 +6,6 @@ from toontown.building import GagshopBuildingAI
from toontown.building import HQBuildingAI
from toontown.building import KartShopBuildingAI
from toontown.building import PetshopBuildingAI
from toontown.building import BankBuildingAI
from toontown.building import LibraryBuildingAI
from toontown.hood import ZoneUtil
# from toontown.building import DistributedAnimBuildingAI
@ -62,8 +61,6 @@ class DistributedBuildingMgrAI:
continue
if isinstance(building, KartShopBuildingAI.KartShopBuildingAI):
continue
if isinstance(building, BankBuildingAI.BankBuildingAI):
continue
if isinstance(building, LibraryBuildingAI.LibraryBuildingAI):
continue
if not building.isSuitBlock():
@ -95,7 +92,6 @@ class DistributedBuildingMgrAI:
gagshopBlocks = []
petshopBlocks = []
kartshopBlocks = []
bankBlocks = []
libraryBlocks = []
animBldgBlocks = []
for i in xrange(self.dnaStore.getNumBlockNumbers()):
@ -110,21 +106,17 @@ class DistributedBuildingMgrAI:
petshopBlocks.append(blockNumber)
elif buildingType == 'kartshop':
kartshopBlocks.append(blockNumber)
elif buildingType == 'bank':
bankBlocks.append(blockNumber)
elif buildingType == 'library':
libraryBlocks.append(blockNumber)
elif buildingType == 'animbldg':
animBldgBlocks.append(blockNumber)
else:
blocks.append(blockNumber)
return (blocks, hqBlocks, gagshopBlocks, petshopBlocks, kartshopBlocks,
bankBlocks, libraryBlocks, animBldgBlocks)
return (blocks, hqBlocks, gagshopBlocks, petshopBlocks, kartshopBlocks, libraryBlocks, animBldgBlocks)
def findAllLandmarkBuildings(self):
backups = simbase.backups.load('block-info', (self.air.districtId, self.branchId), default={})
(blocks, hqBlocks, gagshopBlocks, petshopBlocks, kartshopBlocks,
bankBlocks, libraryBlocks, animBldgBlocks) = self.getDNABlockLists()
(blocks, hqBlocks, gagshopBlocks, petshopBlocks, kartshopBlocks, libraryBlocks, animBldgBlocks) = self.getDNABlockLists()
for blockNumber in blocks:
self.newBuilding(blockNumber, backup=backups.get(blockNumber, None))
for blockNumber in animBldgBlocks:
@ -137,8 +129,6 @@ class DistributedBuildingMgrAI:
self.newPetshopBuilding(block)
for block in kartshopBlocks:
self.newKartShopBuilding(block)
for block in bankBlocks:
self.newBankBuilding(block)
for block in libraryBlocks:
self.newLibraryBuilding(block)
@ -211,16 +201,6 @@ class DistributedBuildingMgrAI:
self.__buildings[blockNumber] = building
return building
def newBankBuilding(self, blockNumber):
dnaStore = self.air.dnaStoreMap[self.canonicalBranchId]
exteriorZoneId = dnaStore.getZoneFromBlockNumber(blockNumber)
exteriorZoneId = ZoneUtil.getTrueZoneId(exteriorZoneId, self.branchId)
interiorZoneId = (self.branchId - (self.branchId%100)) + 500 + blockNumber
building = BankBuildingAI.BankBuildingAI(
self.air, exteriorZoneId, interiorZoneId, blockNumber)
self.__buildings[blockNumber] = building
return building
def newLibraryBuilding(self, blockNumber):
dnaStore = self.air.dnaStoreMap[self.canonicalBranchId]
exteriorZoneId = dnaStore.getZoneFromBlockNumber(blockNumber)

View file

@ -37,18 +37,17 @@ woodColors = [
(0.5451, 0.4118, 0.4118, 1.0)
]
BankToMoney = {
1300: 15000,
1300: 10000,
1310: 15000,
1320: 15000,
1330: 15000,
1340: 15000,
1350: 15000
1320: 20000,
1330: 25000,
1340: 30000
}
MoneyToBank = {}
for bankId, maxMoney in BankToMoney.items():
MoneyToBank[maxMoney] = bankId
MaxBankId = 1350
MaxBankId = 1340
ClosetToClothes = {
500: 10,
502: 15,
@ -634,12 +633,6 @@ FurnitureTypes = {
0,
FLBank,
1.0),
1350: ('phase_5.5/models/estate/jellybeanBank',
None,
None,
0,
FLBank,
1.0),
1399: ('phase_5.5/models/estate/prop_phone-mod',
None,
None,
@ -1134,6 +1127,16 @@ def nextAvailableCloset(avatar, duplicateItems):
return item
def nextAvailableBank(avatar, duplicateItems):
if not avatar.getMaxBankMoney() in MoneyToBank:
return CatalogFurnitureItem(1300)
currentBank = MoneyToBank[avatar.getMaxBankMoney()]
if currentBank == MaxBankId:
return
return CatalogFurnitureItem(currentBank + 10)
def get50ItemCloset(avatar, duplicateItems):
if avatar.getStyle().getGender() == 'm':
@ -1162,6 +1165,13 @@ def getAllClosets():
return list
def getAllBanks():
list = []
for bankId in BankToMoney.keys():
list.append(CatalogFurnitureItem(bankId))
return list
def get50ItemTrunk(avatar, duplicateItems):
if config.GetBool('want-accessories', 1):

View file

@ -1,7 +1,7 @@
from direct.directnotify import DirectNotifyGlobal
import CatalogItem
import CatalogItemList
from CatalogFurnitureItem import CatalogFurnitureItem, nextAvailableCloset, getAllClosets, get50ItemCloset, getMaxClosets, get50ItemTrunk
from CatalogFurnitureItem import CatalogFurnitureItem, nextAvailableCloset, nextAvailableBank, getAllClosets, get50ItemCloset, getMaxClosets, get50ItemTrunk
from CatalogAnimatedFurnitureItem import CatalogAnimatedFurnitureItem
from CatalogClothingItem import CatalogClothingItem, getAllClothes
from CatalogChatItem import CatalogChatItem, getChatRange
@ -846,7 +846,8 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(110),
CatalogFurnitureItem(100),
nextAvailablePole,
nextAvailableCloset),
nextAvailableCloset,
nextAvailableBank),
(100,
(5, 2000),
CatalogFurnitureItem(1420),
@ -868,7 +869,8 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(1000),
CatalogClothingItem(117, 0),
CatalogClothingItem(217, 0),
nextAvailableCloset),
nextAvailableCloset,
nextAvailableBank),
(100,
(5, 2000),
CatalogFurnitureItem(1430),
@ -890,7 +892,8 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(1210),
CatalogClothingItem(409, 0),
nextAvailablePole,
nextAvailableCloset),
nextAvailableCloset,
nextAvailableBank),
(300,
(5, 2000),
CatalogEmoteItem(13),
@ -910,7 +913,8 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(1600),
CatalogClothingItem(118, 0),
CatalogClothingItem(218, 0),
nextAvailableCloset),
nextAvailableCloset,
nextAvailableBank),
(100,
(5, 2000),
3000,
@ -929,7 +933,8 @@ WeeklySchedule = ((100,
4500,
CatalogFurnitureItem(620),
nextAvailablePole,
nextAvailableCloset),
nextAvailableCloset,
nextAvailableBank),
(300,
(5, 2000),
3000,
@ -950,7 +955,8 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(1630),
CatalogEmoteItem(11),
CatalogNametagItem(11),
nextAvailableCloset),
nextAvailableCloset,
nextAvailableBank),
(100,
(2, 2000),
(3, 2010),
@ -975,7 +981,8 @@ WeeklySchedule = ((100,
CatalogClothingItem(220, 0),
nextAvailablePole,
5000,
nextAvailableCloset),
nextAvailableCloset,
nextAvailableBank),
(100,
(2, 2000),
(3, 2010),
@ -997,7 +1004,8 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(930),
CatalogFurnitureItem(1500),
CatalogEmoteItem(6),
nextAvailableCloset),
nextAvailableCloset,
nextAvailableBank),
(300,
(2, 2000),
(3, 2010),
@ -1539,6 +1547,10 @@ class CatalogGenerator:
if nextAvailableCloset not in schedule:
weeklyCatalog += self.__selectItem(avatar, nextAvailableCloset, monthlyCatalog, saleItem=0)
if nextAvailableBank not in schedule:
weeklyCatalog += self.__selectItem(avatar, nextAvailableBank, monthlyCatalog, saleItem=0)
weeklyCatalog += self.__selectItem(avatar, get50ItemTrunk, monthlyCatalog, saleItem=0)
if time.time() < 1096617600.0:
@ -1774,6 +1786,8 @@ class CatalogGenerator:
item = getAllPoles()
elif item == nextAvailableCloset:
item = getAllClosets()
elif item == nextAvailableBank:
item = getAllBanks()
elif item == get50ItemCloset:
item = getMaxClosets()
elif item == get50ItemTrunk:

View file

@ -602,18 +602,27 @@ class CatalogScreen(DirectFrame):
itemList.sort(lambda a, b: priceSort(a, b, CatalogItem.CatalogTypeWeekly))
itemList.reverse()
allClosetItems = CatalogFurnitureItem.getAllClosets()
allBankItems = CatalogFurnitureItem.getAllBanks()
isMaxClosetOfferred = False
isMaxBankOffered = False
for item in itemList:
if item in allClosetItems and item.furnitureType in CatalogFurnitureItem.MaxClosetIds:
isMaxClosetOfferred = True
break
for item in itemList:
if item.furnitureType == CatalogFurnitureItem.MaxBankId:
isMaxBankOffered = True
break
for item in itemList:
if isinstance(item, CatalogInvalidItem.CatalogInvalidItem):
self.notify.warning('skipping catalog invalid item %s' % item)
continue
if isMaxClosetOfferred and item in allClosetItems and item.furnitureType not in CatalogFurnitureItem.MaxClosetIds:
continue
if isMaxBankOffered and item in allBankItems and item.furnitureType != CatalogFurnitureItem.MaxBankId:
continue
if item.loyaltyRequirement() != 0:
self.loyaltyPanelList.append(CatalogItemPanel.CatalogItemPanel(parent=hidden, item=item, type=CatalogItem.CatalogTypeLoyalty, parentCatalogScreen=self))
elif item.getEmblemPrices():
@ -630,6 +639,8 @@ class CatalogScreen(DirectFrame):
continue
if isMaxClosetOfferred and item in allClosetItems and item.furnitureType not in CatalogFurnitureItem.MaxClosetIds:
continue
if isMaxBankOffered and item in allBankItems and item.furnitureType != CatalogFurnitureItem.MaxBankId:
continue
if item.loyaltyRequirement() != 0:
self.loyaltyPanelList.append(CatalogItemPanel.CatalogItemPanel(parent=hidden, item=item, type=CatalogItem.CatalogTypeLoyalty, parentCatalogScreen=self))
elif item.getEmblemPrices():

View file

@ -72,7 +72,6 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
self.__forbidCheesyEffects = 0
self.friendManager = None
self.trophyManager = None
self.bankManager = None
self.catalogManager = None
self.tutorialManager = None
self.welcomeValleyManager = None

View file

@ -1,45 +1,36 @@
from direct.directnotify import DirectNotifyGlobal
from direct.gui.DirectGui import *
from direct.task.Task import Task
from pandac.PandaModules import *
from toontown.toonbase import TTLocalizer
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
from direct.task.Task import Task
class BankGUI(DirectFrame):
notify = DirectNotifyGlobal.directNotify.newCategory('BankGUI')
class BankGui(DirectFrame):
notify = DirectNotifyGlobal.directNotify.newCategory('BankGui')
def __init__(self, doneEvent, allowWithdraw = 1):
backGeom = loader.loadModel('phase_3/models/gui/tt_m_gui_ups_panelBg')
DirectFrame.__init__(self, relief=None, geom=backGeom, geom_color=ToontownGlobals.GlobalDialogColor, geom_scale=(1.66, 1, 1.4), pos=(0, 0, 0))
self.initialiseoptions(BankGUI)
DirectFrame.__init__(self, relief=None, geom=DGG.getDefaultDialogGeom(), geom_color=ToontownGlobals.GlobalDialogColor, geom_scale=(1.33, 1, 1.1), pos=(0, 0, 0))
self.initialiseoptions(BankGui)
self.doneEvent = doneEvent
self.__transactionAmount = 0
bankGuiModel = loader.loadModel('phase_3/models/gui/bank_GUI')
jarGui = bankGuiModel.find('**/jar')
buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
jarGui = loader.loadModel('phase_3.5/models/gui/jar_gui')
arrowGui = loader.loadModel('phase_3/models/gui/create_a_toon_gui')
bankModel = bankGuiModel.find('**/vault')
okImageList = (
bankGuiModel.find('**/Ok_UP'),
bankGuiModel.find('**/Ok_DN'),
bankGuiModel.find('**/Ok_RLVR')
)
cancelImageList = (
bankGuiModel.find('**/Cancel_UP'),
bankGuiModel.find('**/Cancel_DN'),
bankGuiModel.find('**/Cancel_RLVR')
)
arrowImageList = (
arrowGui.find('**/CrtATn_R_Arrow_UP'),
arrowGui.find('**/CrtATn_R_Arrow_DN'),
arrowGui.find('**/CrtATn_R_Arrow_RLVR'),
arrowGui.find('**/CrtATn_R_Arrow_UP')
)
self.cancelButton = DirectButton(parent=self, relief=None, image=cancelImageList, pos=(-0.2, 0, -0.4), text=TTLocalizer.BankGuiCancel, text_scale=0.06, text_pos=(0, -0.1), image_scale=0.6, command=self.__cancel)
self.okButton = DirectButton(parent=self, relief=None, image=okImageList, pos=(0.2, 0, -0.4), text=TTLocalizer.BankGuiOk, text_scale=0.06, text_pos=(0, -0.1), image_scale=0.6, command=self.__requestTransaction)
self.jarDisplay = DirectLabel(parent=self, relief=None, pos=(-0.4, 0, 0), scale=0.7, text=str(base.localAvatar.getMoney()), text_scale=0.2, text_fg=(0.95, 0.95, 0, 1), text_shadow=(0, 0, 0, 1), text_pos=(0, -0.1, 0), image=jarGui, text_font=ToontownGlobals.getSignFont())
self.bankDisplay = DirectLabel(parent=self, relief=None, pos=(0.4, 0, 0), scale=0.9, text=str(base.localAvatar.getBankMoney()), text_scale=0.2, text_fg=(0.95, 0.95, 0, 1), text_shadow=(0, 0, 0, 1), text_pos=(0, -0.1, 0), image=bankModel, image_pos=(0.025, 0, 0),image_scale=0.8, text_font=ToontownGlobals.getSignFont())
bankModel = loader.loadModel('phase_5.5/models/estate/jellybeanBank')
bankModel.setDepthWrite(1)
bankModel.setDepthTest(1)
bankModel.find('**/jellybeans').setDepthWrite(0)
bankModel.find('**/jellybeans').setDepthTest(0)
okImageList = (buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr'))
cancelImageList = (buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr'))
arrowImageList = (arrowGui.find('**/CrtATn_R_Arrow_UP'),
arrowGui.find('**/CrtATn_R_Arrow_DN'),
arrowGui.find('**/CrtATn_R_Arrow_RLVR'),
arrowGui.find('**/CrtATn_R_Arrow_UP'))
self.cancelButton = DirectButton(parent=self, relief=None, image=cancelImageList, pos=(-0.2, 0, -0.4), text=TTLocalizer.BankGuiCancel, text_scale=0.06, text_pos=(0, -0.1), command=self.__cancel)
self.okButton = DirectButton(parent=self, relief=None, image=okImageList, pos=(0.2, 0, -0.4), text=TTLocalizer.BankGuiOk, text_scale=0.06, text_pos=(0, -0.1), command=self.__requestTransaction)
self.jarDisplay = DirectLabel(parent=self, relief=None, pos=(-0.4, 0, 0), scale=0.7, text=str(base.localAvatar.getMoney()), text_scale=0.2, text_fg=(0.95, 0.95, 0, 1), text_shadow=(0, 0, 0, 1), text_pos=(0, -0.1, 0), image=jarGui.find('**/Jar'), text_font=ToontownGlobals.getSignFont())
self.bankDisplay = DirectLabel(parent=self, relief=None, pos=(0.4, 0, 0), scale=0.9, text=str(base.localAvatar.getBankMoney()), text_scale=0.2, text_fg=(0.95, 0.95, 0, 1), text_shadow=(0, 0, 0, 1), text_pos=(0, -0.1, 0), geom=bankModel, geom_scale=0.08, geom_pos=(0, 10, -0.26), geom_hpr=(0, 0, 0), text_font=ToontownGlobals.getSignFont())
self.depositArrow = DirectButton(parent=self, relief=None, image=arrowImageList, image_scale=(1, 1, 1), image3_color=Vec4(0.6, 0.6, 0.6, 0.25), pos=(0.01, 0, 0.15))
self.withdrawArrow = DirectButton(parent=self, relief=None, image=arrowImageList, image_scale=(-1, 1, 1), image3_color=Vec4(0.6, 0.6, 0.6, 0.25), pos=(-0.01, 0, -0.15))
self.depositArrow.bind(DGG.B1PRESS, self.__depositButtonDown)
@ -55,24 +46,22 @@ class BankGUI(DirectFrame):
else:
self.depositArrow.setPos(0, 0, 0)
self.withdrawArrow.hide()
buttons.removeNode()
jarGui.removeNode()
arrowGui.removeNode()
bankGuiModel.removeNode()
self.__updateTransaction(0)
return
def destroy(self):
taskMgr.remove(self.taskName('runCounter'))
self.ignore(localAvatar.uniqueName('moneyChange'))
self.ignore(localAvatar.uniqueName('bankMoneyChange'))
DirectFrame.destroy(self)
def __cancel(self):
messenger.send(self.doneEvent, [0])
def __requestTransaction(self):
self.ignore(localAvatar.uniqueName('moneyChange'))
self.ignore(localAvatar.uniqueName('bankMoneyChange'))
messenger.send(self.doneEvent, [self.__transactionAmount])
def __updateTransaction(self, amount):
@ -81,7 +70,7 @@ class BankGUI(DirectFrame):
jarMoney = base.localAvatar.getMoney()
maxJarMoney = base.localAvatar.getMaxMoney()
bankMoney = base.localAvatar.getBankMoney()
maxBankMoney = ToontownGlobals.MaxBankMoney
maxBankMoney = base.localAvatar.getMaxBankMoney()
self.__transactionAmount = min(self.__transactionAmount, jarMoney)
self.__transactionAmount = min(self.__transactionAmount, maxBankMoney - bankMoney)
self.__transactionAmount = -min(-self.__transactionAmount, maxJarMoney - jarMoney)
@ -100,21 +89,22 @@ class BankGUI(DirectFrame):
self.withdrawArrow['state'] = DGG.NORMAL
self.jarDisplay['text'] = str(newJarMoney)
self.bankDisplay['text'] = str(newBankMoney)
return (hitLimit, newJarMoney, newBankMoney, self.__transactionAmount)
return (hitLimit,
newJarMoney,
newBankMoney,
self.__transactionAmount)
def __runCounter(self, task):
if task.time - task.prevTime < task.delayTime:
return Task.cont
task.delayTime /= 2
task.prevTime = task.time
if task.delayTime < 0.005:
task.amount *= 1.1
hitLimit = self.__updateTransaction(int(task.amount))[0]
if hitLimit:
return Task.done
return Task.cont
else:
task.delayTime = max(0.05, task.delayTime * 0.75)
task.prevTime = task.time
hitLimit, jar, bank, trans = self.__updateTransaction(task.delta)
if hitLimit:
return Task.done
else:
return Task.cont
def __depositButtonUp(self, event):
messenger.send('wakeup')
@ -122,12 +112,11 @@ class BankGUI(DirectFrame):
def __depositButtonDown(self, event):
messenger.send('wakeup')
task = Task(self.__runCounter)
task.delayTime = 0.2
task.delayTime = 0.4
task.prevTime = 0.0
task.amount = 1.0
hitLimit = self.__updateTransaction(int(task.amount))[0]
task.delta = 1
hitLimit, jar, bank, trans = self.__updateTransaction(task.delta)
if not hitLimit:
taskMgr.add(task, self.taskName('runCounter'))
@ -137,12 +126,11 @@ class BankGUI(DirectFrame):
def __withdrawButtonDown(self, event):
messenger.send('wakeup')
task = Task(self.__runCounter)
task.delayTime = 0.2
task.delayTime = 0.4
task.prevTime = 0.0
task.amount = -1.0
hitLimit = self.__updateTransaction(int(task.amount))[0]
task.delta = -1
hitLimit, jar, bank, trans = self.__updateTransaction(task.delta)
if not hitLimit:
taskMgr.add(task, self.taskName('runCounter'))

View file

@ -1,6 +1,7 @@
BANK_MOVIE_CLEAR = 1
BANK_MOVIE_TIMEOUT = 2
BANK_MOVIE_GUI = 3
BANK_MOVIE_DEPOSIT = 4
BANK_MOVIE_WITHDRAW = 5
BANK_MOVIE_REJECT = 6
BANK_MOVIE_GUI = 2
BANK_MOVIE_DEPOSIT = 3
BANK_MOVIE_WITHDRAW = 4
BANK_MOVIE_NO_OP = 5
BANK_MOVIE_NOT_OWNER = 6
BANK_MOVIE_NO_OWNER = 7

View file

@ -27,8 +27,7 @@ DNA2Furniture = {
'bookcase': 1120,
'bookcase_low': 1130,
'ending_table': 1200,
'jellybeanBank': 1300,
'jellybeanBank': 1300
}

View file

@ -117,7 +117,7 @@ class DistributedBank(DistributedFurnitureItem.DistributedFurnitureItem):
def showBankGui(self):
if self.bankGui:
self.bankGui.destroy()
self.bankGui = BankGUI.BankGUI(self.bankGuiDoneEvent)
self.bankGui = BankGUI.BankGui(self.bankGuiDoneEvent)
self.accept(self.bankGuiDoneEvent, self.__handleBankDone)
def setMovie(self, mode, avId, timestamp):

View file

@ -1,58 +1,76 @@
from direct.directnotify import DirectNotifyGlobal
from toontown.estate.DistributedFurnitureItemAI import DistributedFurnitureItemAI
from direct.distributed import ClockDelta
from BankGlobals import *
from direct.distributed.ClockDelta import *
import BankGlobals
class DistributedBankAI(DistributedFurnitureItemAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedBankAI")
def __init__(self, air, furnitureMgr, catalogItem, ownerId):
DistributedFurnitureItemAI.__init__(self, air, furnitureMgr, catalogItem)
self.ownerId = ownerId
self.busy = 0
def __init__(self, air, furnitureMgr, item):
DistributedFurnitureItemAI.__init__(self, air, furnitureMgr, item)
self.avId = None
self.movie = BankGlobals.BANK_MOVIE_CLEAR
def avatarEnter(self):
avId = self.air.getAvatarIdFromSender()
if not self.busy:
if avId == self.ownerId:
self.sendBankMovie(avId)
if not self.avId:
if not self.furnitureMgr.ownerId:
self.b_setMovie(BankGlobals.BANK_MOVIE_NO_OWNER, avId, globalClockDelta.getRealNetworkTime())
return
elif self.furnitureMgr.ownerId != avId:
self.b_setMovie(BankGlobals.BANK_MOVIE_NOT_OWNER, avId, globalClockDelta.getRealNetworkTime())
return
else:
self.sendNotOwnerMovie(avId)
self.acceptOnce(self.air.getAvatarExitEvent(avId),
self.__handleUnexpectedExit)
self.avId = avId
self.b_setMovie(BankGlobals.BANK_MOVIE_GUI, avId, globalClockDelta.getRealNetworkTime())
return
else:
if avId == self.avId:
self.air.writeServerEvent('suspicious', avId=avId, issue='Tried to use bank while already using it!')
self.sendUpdateToAvatarId(avId, 'freeAvatar', [])
def freeAvatar(self):
self.sendExitMovie()
self.sendClearMovie()
pass
def setMovie(self, mode, avId):
self.sendUpdate('setMovie', args=[mode,
avId, ClockDelta.globalClockDelta.getRealNetworkTime()])
def setMovie(self, mode, avId, time):
self.movie = mode
if self.movie != BankGlobals.BANK_MOVIE_CLEAR:
taskMgr.doMethodLater(2.0, self.clearMovie, 'clear-movie-%d' % self.getDoId())
def sendBankMovie(self, avId):
self.setMovie(BANK_MOVIE_GUI, avId)
self.busy = avId
def clearMovie(self, task):
self.b_setMovie(BankGlobals.BANK_MOVIE_CLEAR, 0, globalClockDelta.getRealNetworkTime())
def sendNotOwnerMovie(self, avId):
self.setMovie(BANK_MOVIE_NOT_OWNER, avId)
def b_setMovie(self, mode, avId, time):
self.setMovie(mode, avId, time)
self.d_setMovie(mode, avId, time)
def sendExitMovie(self):
self.setMovie(BANK_MOVIE_WITHDRAW, self.busy)
def sendClearMovie(self):
self.setMovie(BANK_MOVIE_CLEAR, self.busy)
self.busy = 0
def d_setMovie(self, mode, avId, time):
self.sendUpdate('setMovie', [mode, avId, time])
def transferMoney(self, amount):
av = self.air.doId2do.get(self.busy)
if not av:
avId = self.air.getAvatarIdFromSender()
if avId != self.avId:
self.air.writeServerEvent('suspicious', avId=avId, issue='Tried to transfer money while not using a bank!')
return
av = self.air.doId2do.get(avId)
if not av:
self.air.writeServerEvent('suspicious', avId=avId, issue='Tried to transfer money while not on the AI!')
return
if amount == 0: # No transfer needed.
self.b_setMovie(BankGlobals.BANK_MOVIE_NO_OP, avId, globalClockDelta.getRealNetworkTime())
elif amount > 0:
self.b_setMovie(BankGlobals.BANK_MOVIE_DEPOSIT, avId, globalClockDelta.getRealNetworkTime())
if av.money < amount:
self.air.writeServerEvent('suspicious', avId=avId, issue='Toon tried to deposit more money than they have!')
else:
av.b_setMoney(av.money - amount)
av.b_setBankMoney(av.bankMoney + amount)
else:
self.b_setMovie(BankGlobals.BANK_MOVIE_WITHDRAW, avId, globalClockDelta.getRealNetworkTime())
if av.bankMoney + amount < 0:
self.air.writeServerEvent('suspicious', avId=avId, issue='Toon tried to withdraw more money than they have!')
else:
av.b_setMoney(av.money - amount)
av.b_setBankMoney(av.bankMoney + amount)
av.b_setBankMoney(min(av.getBankMoney() + amount, av.getMaxBankMoney()))
av.b_setMoney(max(av.getMoney() - amount, 0))
self.freeAvatar()
def __handleUnexpectedExit(self):
self.busy = 0
self.avId = None

View file

@ -1,30 +0,0 @@
from direct.distributed import DistributedObject
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import TTLocalizer
class DistributedBankMgr(DistributedObject.DistributedObject):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedBankMgr')
neverDisable = 1
def __init__(self, cr):
DistributedObject.DistributedObject.__init__(self, cr)
def generate(self):
if base.cr.bankManager != None:
base.cr.bankManager.delete()
base.cr.bankManager = self
DistributedObject.DistributedObject.generate(self)
return
def disable(self):
base.cr.bankManager = None
DistributedObject.DistributedObject.disable(self)
return
def delete(self):
base.cr.bankManager = None
DistributedObject.DistributedObject.delete(self)
return
def d_transferMoney(self, amount):
self.sendUpdate('transferMoney', [amount])

View file

@ -1,8 +0,0 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedBankMgrAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedBankMgrAI")
def transferMoney(self, todo0):
pass

View file

@ -11,6 +11,7 @@ from DistributedFurnitureItemAI import DistributedFurnitureItemAI
from DistributedPhoneAI import DistributedPhoneAI
from DistributedClosetAI import DistributedClosetAI
from DistributedTrunkAI import DistributedTrunkAI
from DistributedBankAI import DistributedBankAI
from otp.ai.MagicWordGlobal import *
class FurnitureError(Exception):
@ -130,7 +131,7 @@ class DistributedFurnitureManagerAI(DistributedObjectAI):
item.furnitureType -= 10
do = DistributedClosetAI(self.air, self, item)
elif item.getFlags() & FLBank:
continue # We dont want banks in the estates.
do = DistributedBankAI(self.air, self, item)
elif item.getFlags() & FLPhone:
do = DistributedPhoneAI(self.air, self, item)
else:
@ -304,7 +305,7 @@ class DistributedFurnitureManagerAI(DistributedObjectAI):
item.furnitureType -= 10
do = DistributedClosetAI(self.air, self, item)
elif item.getFlags() & FLBank:
pass # We don't want banks in the estates
do = DistributedBankAI(self.air, self, item)
elif item.getFlags() & FLPhone:
do = DistributedPhoneAI(self.air, self, item)
else:

View file

@ -123,6 +123,7 @@ class QuestRewardCounter:
anyChanged = 1
if self.maxMoney != av.maxMoney:
self.notify.info('Changed avatar %d to have maxMoney %d instead of %d' % (av.doId, self.maxMoney, av.maxMoney))
av.b_setMaxMoney(self.maxMoney)
anyChanged = 1
if self.questCarryLimit != av.questCarryLimit:
self.notify.info('Changed avatar %d to have questCarryLimit %d instead of %d' % (av.doId, self.questCarryLimit, av.questCarryLimit))

View file

@ -3957,7 +3957,7 @@ class MaxMoneyReward(Reward):
return self.reward[0]
def sendRewardAI(self, av):
return
av.b_setMaxMoney(self.getAmount())
def countReward(self, qrc):
qrc.maxMoney = self.getAmount()
@ -4672,22 +4672,22 @@ def getRewardIdFromTrackId(trackId):
RequiredRewardTrackDict = {
TT_TIER: (100,),
TT_TIER + 1: (400,),
TT_TIER + 2: (100, 801, 200, 802, 803, 101, 804, 805, 102, 806, 807, 100, 808, 809, 101, 810, 811, 500, 812, 813, 814, 815, 300),
TT_TIER + 2: (100, 801, 200, 802, 803, 101, 804, 805, 102, 806, 807, 100, 808, 809, 101, 810, 811, 500, 812, 813, 700, 814, 815, 300),
TT_TIER + 3: (900,),
DD_TIER: (400,),
DD_TIER + 1: (100, 801, 802, 201, 803, 804, 101, 805, 806, 102, 807, 808, 100, 809, 810, 101, 811, 812, 813, 814, 815, 301),
DD_TIER + 1: (100, 801, 802, 201, 803, 804, 101, 805, 806, 102, 807, 808, 100, 809, 810, 101, 811, 812, 701, 813, 814, 815, 301),
DD_TIER + 2: (900,),
DG_TIER: (100, 202, 101, 102, 100, 101, 501, 302),
DG_TIER: (100, 202, 101, 102, 100, 101, 501, 702, 302),
MM_TIER: (400,),
MM_TIER + 1: (100, 801, 802, 203, 803, 804, 101, 805, 806, 102, 807, 808, 100, 809, 810, 101, 811, 812, 813, 814, 815, 303),
MM_TIER + 1: (100, 801, 802, 203, 803, 804, 101, 805, 806, 102, 807, 808, 100, 809, 810, 101, 811, 812, 703, 813, 814, 815, 303),
MM_TIER + 2: (900,),
BR_TIER: (400,),
BR_TIER + 1: (100, 801, 802, 803, 804, 101, 805, 806, 502, 807, 808, 102, 809, 810, 204, 811, 812, 100, 813, 814, 101, 815, 304),
BR_TIER + 1: (100, 801, 802, 704, 803, 804, 101, 805, 806, 502, 807, 808, 102, 809, 810, 204, 811, 812, 100, 813, 814, 101, 815, 304),
BR_TIER + 2: (900,),
DL_TIER: (100, 205, 101, 102, 103, 305),
DL_TIER + 1: (100, 206, 101, 102, 103),
DL_TIER: (100, 205, 101, 102, 705, 103, 305),
DL_TIER + 1: (100, 206, 101, 102, 706, 103),
DL_TIER + 2: (100, 101, 102, 103),
DL_TIER + 3: (100, 101, 102, 102, 207),
DL_TIER + 3: (100, 101, 102, 102, 707, 207),
ELDER_TIER: () }
OptionalRewardTrackDict = {

View file

@ -97,7 +97,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan
self.notify.debug('Creating a building manager AI in zone' + str(self.zoneId))
self.buildingMgr = self.air.buildingManagers.get(self.zoneId)
if self.buildingMgr:
(blocks, hqBlocks, gagshopBlocks, petshopBlocks, kartshopBlocks, bankBlocks, libraryBlocks, animBldgBlocks) = self.buildingMgr.getDNABlockLists()
(blocks, hqBlocks, gagshopBlocks, petshopBlocks, kartshopBlocks, libraryBlocks, animBldgBlocks) = self.buildingMgr.getDNABlockLists()
for currBlock in blocks:
bldg = self.buildingMgr.getBuilding(currBlock)
bldg.setSuitPlannerExt(self)

View file

@ -1,106 +0,0 @@
from direct.distributed.ClockDelta import *
from direct.interval.IntervalGlobal import *
from pandac.PandaModules import *
from DistributedNPCToonBase import *
from toontown.chat.ChatGlobals import *
from toontown.estate import BankGUI, BankGlobals
from toontown.nametag.NametagGlobals import *
from toontown.toonbase import TTLocalizer
class DistributedNPCBanker(DistributedNPCToonBase):
def __init__(self, cr):
DistributedNPCToonBase.__init__(self, cr)
self.jellybeanJar = None
self.bankGUI = None
def disable(self):
self.ignoreAll()
taskMgr.remove(self.uniqueName('popupBankingGUI'))
taskMgr.remove(self.uniqueName('lerpCamera'))
if self.bankGUI:
self.bankGUI.destroy()
self.av = None
base.localAvatar.posCamera(0, 0)
DistributedNPCToonBase.disable(self)
def resetClerk(self):
self.ignoreAll()
taskMgr.remove(self.uniqueName('popupBankingGUI'))
taskMgr.remove(self.uniqueName('lerpCamera'))
if self.bankGUI:
self.bankGUI.destroy()
self.clearMat()
self.startLookAround()
self.detectAvatars()
def handleCollisionSphereEnter(self, collEntry):
self.sendAvatarEnter()
self.nametag3d.setDepthTest(0)
base.cr.playGame.getPlace().setState('purchase')
self.nametag3d.setBin('fixed', 0)
def sendAvatarEnter(self):
self.sendUpdate('avatarEnter')
def setMovie(self, mode, avId, timestamp):
isLocalToon = avId == base.localAvatar.doId
timeStamp = globalClockDelta.localElapsedTime(timestamp)
self.remain = 60 - timeStamp
self.resetClerk()
if mode == BankGlobals.BANK_MOVIE_CLEAR:
if not avId:
self.setChatAbsolute('', CFSpeech | CFTimeout)
if isLocalToon:
self.freeAvatar()
elif mode == BankGlobals.BANK_MOVIE_TIMEOUT:
if isLocalToon:
self.cleanupBankingGUI()
self.freeAvatar()
self.setChatAbsolute(TTLocalizer.STOREOWNER_TOOKTOOLONG,
CFSpeech | CFTimeout)
elif mode == BankGlobals.BANK_MOVIE_DEPOSIT:
if isLocalToon:
self.cleanupBankingGUI()
self.freeAvatar()
self.setChatAbsolute(TTLocalizer.STOREOWNER_GOODBYE,
CFSpeech | CFTimeout)
elif mode == BankGlobals.BANK_MOVIE_GUI:
av = base.cr.doId2do.get(avId)
if av:
self.setupAvatars(av)
if isLocalToon:
self.hideNametag2d()
camera.wrtReparentTo(render)
seq = Sequence((camera.posQuatInterval(1, Vec3(-5, 9, self.getHeight() - 0.5),
Vec3(-150, -2, 0), other=self, blendType='easeOut',
name=self.uniqueName('lerpCamera'))))
seq.start()
taskMgr.doMethodLater(2.0, self.popupBankingGUI,
self.uniqueName('popupBankingGUI'))
self.setChatAbsolute(TTLocalizer.STOREOWNER_BANKING,
CFSpeech | CFTimeout)
def __handleBankingDone(self, transactionAmount):
self.sendUpdate('transferMoney', [transactionAmount])
def popupBankingGUI(self, task):
self.accept('bankDone', self.__handleBankingDone)
self.bankGUI = BankGUI.BankGUI('bankDone')
return task.done
def cleanupBankingGUI(self):
if self.bankGUI:
self.bankGUI.destroy()
self.bankGUI = None
def freeAvatar(self):
base.localAvatar.posCamera(0, 0)
if base.cr.playGame.getPlace():
base.cr.playGame.getPlace().setState('walk')
self.showNametag2d()

View file

@ -1,106 +0,0 @@
from otp.ai.AIBaseGlobal import *
from direct.task.Task import Task
from pandac.PandaModules import *
from DistributedNPCToonBaseAI import *
from toontown.estate import BankGlobals
class DistributedNPCBankerAI(DistributedNPCToonBaseAI):
def __init__(self, air, npcId, questCallback = None, hq = 0):
DistributedNPCToonBaseAI.__init__(self, air, npcId, questCallback)
self.hq = hq
self.tutorial = 0
self.pendingAvId = None
self.task = ''
def avatarEnter(self):
avId = self.air.getAvatarIdFromSender()
if self.busy:
self.sendClearMovie(av=avId)
return
self.busy = avId
self.sendGUIMovie()
self.acceptOnce(self.air.getAvatarExitEvent(avId),
self.__handleUnexpectedExit, extraArgs=[avId])
DistributedNPCToonBaseAI.avatarEnter(self)
def transferMoney(self, transactionAmount):
av = self.air.doId2do.get(self.busy)
if not av:
return
money = min(av.getMoney() - transactionAmount, 10000)
av.b_setMoney(money)
if transactionAmount != 0:
self.air.bankManager.setMoney(self.busy,
av.getBankMoney() + transactionAmount)
self.clearTasks()
self.sendDoneMovie()
def sendGUIMovie(self):
if self.task:
taskMgr.remove(self.task)
self.task = self.uniqueName('timeoutMovie')
taskMgr.doMethodLater(60, self.sendTimeoutMovie,
self.task)
self.sendUpdate('setMovie', [BankGlobals.BANK_MOVIE_GUI,
self.busy,
ClockDelta.globalClockDelta.getRealNetworkTime()])
def sendTimeoutMovie(self, task=None):
self.pendingAvId = None
self.sendUpdate('setMovie', [BankGlobals.BANK_MOVIE_TIMEOUT,
self.busy,
ClockDelta.globalClockDelta.getRealNetworkTime()])
self.busy = 0
if self.task:
taskMgr.remove(self.task)
self.task = self.uniqueName('clearMovie')
taskMgr.doMethodLater(5.5, self.sendClearMovie,
self.task)
if task is not None:
return task.done
def sendClearMovie(self, task=None, av=0):
self.sendUpdate('setMovie', [BankGlobals.BANK_MOVIE_CLEAR,
av,
ClockDelta.globalClockDelta.getRealNetworkTime()])
if task is not None:
return task.done
def sendDoneMovie(self):
self.sendUpdate('setMovie', [BankGlobals.BANK_MOVIE_DEPOSIT,
self.busy,
ClockDelta.globalClockDelta.getRealNetworkTime()])
self.busy = 0
if self.task:
taskMgr.remove(self.task)
self.task = self.uniqueName('clearMovie')
taskMgr.doMethodLater(5.5, self.sendClearMovie, self.task)
def rejectAvatar(self, avId):
self.busy = avId
self.sendUpdate('setMovie', [BankGlobals.BANK_MOVIE_REJECT,
avId,
ClockDelta.globalClockDelta.getRealNetworkTime()])
def __handleUnexpectedExit(self, avId):
self.notify.warning('avatar:' + str(avId) + ' has exited unexpectedly')
self.clearTasks()
self.sendTimeoutMovie()
def clearTasks(self):
if self.task:
taskMgr.remove(self.task)
self.task = None

View file

@ -149,7 +149,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
self.houseId = 0
self.money = 0
self.bankMoney = 0
self.maxMoney = 10000
self.maxMoney = 0
self.maxBankMoney = 0
self.emblems = [0, 0]
self.maxNPCFriends = 16
@ -1337,8 +1337,11 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
def getSpeedChatStyleIndex(self):
return self.speedChatStyleIndex
def setMaxMoney(self, maxMoney):
self.maxMoney = maxMoney
def getMaxMoney(self):
return 10000
return self.maxMoney
def setMoney(self, money):
if money != self.money:

View file

@ -125,8 +125,8 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
self.fishingTrophies = []
self.trackArray = []
self.emoteAccess = [0] * 26
self.maxMoney = 10000
self.maxBankMoney = ToontownGlobals.MaxBankMoney
self.maxMoney = 0
self.maxBankMoney = 0
self.gardenSpecials = []
self.houseId = 0
self.posIndex = 0
@ -2355,8 +2355,38 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
def getSpeedChatStyleIndex(self):
return self.speedChatStyleIndex
def b_setMaxMoney(self, maxMoney):
self.d_setMaxMoney(maxMoney)
self.setMaxMoney(maxMoney)
if self.getMoney() > maxMoney:
self.b_setBankMoney(self.bankMoney + (self.getMoney() - maxMoney))
self.b_setMoney(maxMoney)
def d_setMaxMoney(self, maxMoney):
self.sendUpdate('setMaxMoney', [maxMoney])
def setMaxMoney(self, maxMoney):
self.maxMoney = maxMoney
def getMaxMoney(self):
return 10000
return self.maxMoney
def b_setBankMaxMoney(self, bankMaxMoney):
self.d_setBankMaxMoney(bankMaxMoney)
self.setBankMaxMoney(bankMaxMoney)
if self.getBankMoney() > bankMaxMoney:
self.b_setBankMoney(bankMaxMoney)
def d_setBankMaxMoney(self, bankMaxMoney):
self.sendUpdate('setBankMaxMoney', [bankMaxMoney])
def setBankMaxMoney(self, bankMaxMoney):
self.bankMaxMoney = bankMaxMoney
def getBankMaxMoney(self):
return self.bankMaxMoney
def addMoney(self, deltaMoney):
money = deltaMoney + self.money
@ -2365,7 +2395,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
overflowMoney = money - self.maxMoney
if overflowMoney > 0:
bankMoney = self.bankMoney + overflowMoney
self.air.bankManager.setMoney(self.doId, bankMoney)
self.b_setBankMoney(bankMoney)
def takeMoney(self, deltaMoney, bUseBank = True):
totalMoney = self.money
@ -2375,7 +2405,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
self.notify.warning('Not enough money! AvId: %s Has:%s Charged:%s' % (self.doId, totalMoney, deltaMoney))
return False
if bUseBank and deltaMoney > self.money:
self.air.bankManager.setMoney(self.doId, self.bankMoney - (deltaMoney - self.money))
self.b_setBankMoney(self.bankMoney - (deltaMoney - self.money))
self.b_setMoney(0)
else:
self.b_setMoney(self.money - deltaMoney)
@ -4420,8 +4450,10 @@ def maxToon(missingTrack=None):
invoker.b_setRewardHistory(Quests.ELDER_TIER, [])
# Max their money:
invoker.b_setMaxMoney(250)
invoker.b_setMaxBankMoney(30000)
invoker.b_setMoney(invoker.getMaxMoney())
invoker.b_setBankMoney(10000)
invoker.b_setBankMoney(invoker.getMaxBankMoney())
# Finally, unlock all of their pet phrases:
if simbase.wantPets:
@ -4502,13 +4534,24 @@ def fires(count):
invoker.b_setPinkSlips(count)
return 'You were given %d fires.' % count
@magicWord(category=CATEGORY_PROGRAMMER, types=[int])
def maxMoney(maxMoney):
"""
Modifies the target's max money value.
"""
if not 40 <= maxMoney <= 250:
return 'Max money value must be in xrange (40-250).'
target = spellbook.getTarget()
spellbook.getTarget().b_setMaxMoney(maxMoney)
return "Set {0}'s max money value to {1}!".format(target.getName(), maxMoney)
@magicWord(category=CATEGORY_PROGRAMMER, types=[int])
def money(money):
"""
Modifies the target's current money value.
"""
target = spellbook.getTarget()
maxMoney = 10000
maxMoney = target.getMaxMoney()
if not 0 <= money <= maxMoney:
return 'Money value must be in xrange (0-%d).' % maxMoney
target.b_setMoney(money)
@ -4525,7 +4568,7 @@ def bank(command, value):
if value == 0:
return 'Invalid bank transfer.'
bankMoney = target.getBankMoney()
maxBankMoney = ToontownGlobals.MaxBankMoney
maxBankMoney = target.getMaxBankMoney()
money = target.getMoney()
maxMoney = target.getMaxMoney()
if value > 0:

View file

@ -15,6 +15,12 @@ class DistributedToonUD(DistributedObjectUD):
def setBankMoney(self, todo0):
pass
def setMaxMoney(self, todo0):
pass
def setBankMaxMoney(self, todo0):
pass
def setMoney(self, todo0):
pass

View file

@ -68,8 +68,7 @@ NPC_SPECIALQUESTGIVER = 9
NPC_FLIPPYTOONHALL = 10
NPC_SCIENTIST = 11
NPC_SMART = 13
NPC_BANKER = 14
NPC_GLOVE = 15
NPC_GLOVE = 14
CLERK_COUNTDOWN_TIME = 120
TAILOR_COUNTDOWN_TIME = 300
RTDNAFile = '/RTDNAFile.txt'
@ -94,7 +93,6 @@ def createNPC(air, npcId, desc, zoneId, posIndex = 0, questCallback = None):
import DistributedNPCFlippyInToonHallAI
import DistributedNPCScientistAI
import DistributedSmartNPCAI
import DistributedNPCBankerAI
import DistributedNPCGloveAI
canonicalZoneId, name, dnaType, gender, protected, type = desc
if type == NPC_REGULAR:
@ -123,8 +121,6 @@ def createNPC(air, npcId, desc, zoneId, posIndex = 0, questCallback = None):
npc = DistributedNPCScientistAI.DistributedNPCScientistAI(air, npcId)
elif type == NPC_SMART:
npc = DistributedSmartNPCAI.DistributedSmartNPCAI(air, npcId)
elif type == NPC_BANKER:
npc = DistributedNPCBankerAI.DistributedNPCBankerAI(air, npcId)
elif type == NPC_GLOVE and simbase.air.wantGloveNpc:
npc = DistributedNPCGloveAI.DistributedNPCGloveAI(air, npcId)
else:
@ -327,7 +323,7 @@ NPCToonDict = {20000: (-1,
18),
'm',
1,
NPC_BANKER),
NPC_REGULAR),
2003: (2516,
lnames[2003],
('cll',

View file

@ -4675,7 +4675,6 @@ STOREOWNER_CONFIRM_LOSS = 'Your closet is full. You will lose the clothes you w
STOREOWNER_OK = lOK
STOREOWNER_CANCEL = lCancel
STOREOWNER_TROPHY = 'Wow! You collected %s of %s fish. That deserves a trophy and a Laff boost!'
STOREOWNER_BANKING = 'Welcome to The Toontown Bank! How may I help you?'
SuitInvasionBegin1 = lToonHQ + ': A Cog invasion has begun!!!'
SuitInvasionBegin2 = lToonHQ + ': %s have taken over Toontown!!!'
SuitInvasionEnd1 = lToonHQ + ': The %s invasion has ended!!!'
@ -5508,12 +5507,11 @@ FurnitureNames = {100: 'Armchair',
1240: "Snorkeler's Table",
1250: 'Cookie Table',
1260: 'Bedroom Table',
1300: '1000 Bean Bank',
1310: '2500 Bean Bank',
1320: '5000 Bean Bank',
1330: '7500 Bean Bank',
1340: '10000 Bean Bank',
1350: '12000 Bean Bank',
1300: '10000 Bean Bank',
1310: '15000 Bean Bank',
1320: '20000 Bean Bank',
1330: '25000 Bean Bank',
1340: '30000 Bean Bank',
1399: 'Telephone',
1400: 'Cezanne Toon',
1410: 'Flowers',
@ -5653,12 +5651,11 @@ AwardManagerFurnitureNames = {100: 'Armchair A - Series 1',
1240: "Snorkeler's Table",
1250: 'Cookie Table',
1260: 'Bedroom Table',
1300: '1000 Bean Bank',
1310: '2500 Bean Bank',
1320: '5000 Bean Bank',
1330: '7500 Bean Bank',
1340: '10000 Bean Bank',
1350: '12000 Bean Bank',
1300: '10000 Bean Bank',
1310: '15000 Bean Bank',
1320: '20000 Bean Bank',
1330: '25000 Bean Bank',
1340: '30000 Bean Bank',
1399: 'Telephone',
1400: 'Cezanne Toon',
1410: 'Flowers',

View file

@ -939,7 +939,6 @@ SELLBOT_NERF_HOLIDAY = 96
JELLYBEAN_TROLLEY_HOLIDAY = 97
JELLYBEAN_FISHING_HOLIDAY = 98
JELLYBEAN_PARTIES_HOLIDAY = 99
BANK_UPGRADE_HOLIDAY = 100
TOP_TOONS_MARATHON = 101
SELLBOT_INVASION = 102
SELLBOT_FIELD_OFFICE = 103
@ -1602,8 +1601,8 @@ AnimPropTypes = Enum(('Unknown',
'Trashcan'), start=-1)
EmblemTypes = Enum(('Silver', 'Gold'))
NumEmblemTypes = 2
MaxBankMoney = 50000
DefaultBankItemId = 1350
MaxBankMoney = 25000
DefaultBankItemId = 1300
ToonAnimStates = set(['off',
'neutral',
'victory',

View file

@ -265,8 +265,7 @@ class LoginAccountFSM(OperationFSM):
'CREATED': time.ctime(),
'LAST_LOGIN': time.ctime(),
'ACCOUNT_ID': str(self.userId),
'ACCESS_LEVEL': self.accessLevel,
'MONEY': 0
'ACCESS_LEVEL': self.accessLevel
}
self.csm.air.dbInterface.createObject(
self.csm.air.dbId,
@ -862,8 +861,7 @@ class LoadAvatarFSM(AvatarOperationFSM):
# Activate the avatar on the DBSS:
self.csm.air.sendActivate(
self.avId, 0, 0, self.csm.air.dclassesByName['DistributedToonUD'],
{'setAdminAccess': [self.account.get('ACCESS_LEVEL', 100)],
'setBankMoney': [self.account.get('MONEY', 0)]})
{'setAdminAccess': [self.account.get('ACCESS_LEVEL', 100)]})
# Next, add them to the avatar channel:
datagram = PyDatagram()