From 8374e30b740806b1be6b6b5365c125fd8ff898fc Mon Sep 17 00:00:00 2001 From: Loudrob Date: Fri, 27 Mar 2015 19:25:31 -0400 Subject: [PATCH] Great progress indeed. --- astron/dclass/united.dc | 1 + otp/distributed/DCClassImports.py | 2 +- toontown/ai/ToontownAIRepository.py | 1 + toontown/building/DistributedBuildingAI.py | 31 +++++--- toontown/building/ElevatorConstants.py | 10 ++- toontown/catalog/CatalogHouseItem.py | 69 ++++++++++++++++++ toontown/catalog/CatalogItemPanel.py | 2 + toontown/catalog/CatalogItemTypes.py | 8 +- toontown/catalog/CatalogScreen.py | 8 +- toontown/cogdominium/CogdoBarrelRoomMovies.py | 6 +- toontown/cogdominium/CogdoElevatorMovie.py | 4 +- .../cogdominium/CogdoExecutiveSuiteMovies.py | 4 +- .../cogdominium/SuitPlannerCogdoInteriorAI.py | 24 ++++-- toontown/toon/DistributedToonAI.py | 4 +- toontown/toon/Documents - Shortcut.lnk | Bin 0 -> 922 bytes toontown/toonbase/TTLocalizerEnglish.py | 27 ++++--- 16 files changed, 159 insertions(+), 42 deletions(-) create mode 100644 toontown/catalog/CatalogHouseItem.py create mode 100644 toontown/toon/Documents - Shortcut.lnk diff --git a/astron/dclass/united.dc b/astron/dclass/united.dc index c9a94df2..e03601f7 100644 --- a/astron/dclass/united.dc +++ b/astron/dclass/united.dc @@ -1067,6 +1067,7 @@ dclass DistributedToon : DistributedPlayer { setAnimalSound(uint8 index) ram broadcast ownrecv; setBuffs(uint32[] = []) required ownrecv db; setRedeemedCodes(string [] = []) required ownrecv db; + setEmblems(uint32[] = [0, 0]) required ownrecv db; }; dclass DistributedCCharBase : DistributedObject { diff --git a/otp/distributed/DCClassImports.py b/otp/distributed/DCClassImports.py index 666f16d8..f0e371ae 100644 --- a/otp/distributed/DCClassImports.py +++ b/otp/distributed/DCClassImports.py @@ -2,7 +2,7 @@ from pandac.PandaModules import * -hashVal = 930195805 +hashVal = 3216321797L 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 diff --git a/toontown/ai/ToontownAIRepository.py b/toontown/ai/ToontownAIRepository.py index 35c96eff..e4d77978 100644 --- a/toontown/ai/ToontownAIRepository.py +++ b/toontown/ai/ToontownAIRepository.py @@ -82,6 +82,7 @@ class ToontownAIRepository(ToontownInternalRepository): self.wantHousing = self.config.GetBool('want-housing', True) self.wantPets = self.config.GetBool('want-pets', True) self.wantParties = self.config.GetBool('want-parties', True) + self.wantEmblems = self.config.GetBool('want-emblems', True) self.wantCogbuildings = self.config.GetBool('want-cogbuildings', True) self.wantCogdominiums = self.config.GetBool('want-cogdominiums', True) self.doLiveUpdates = self.config.GetBool('want-live-updates', False) diff --git a/toontown/building/DistributedBuildingAI.py b/toontown/building/DistributedBuildingAI.py index 7b93ee34..3a75b4e9 100644 --- a/toontown/building/DistributedBuildingAI.py +++ b/toontown/building/DistributedBuildingAI.py @@ -150,7 +150,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): self.track = track self.realTrack = track self.difficulty = difficulty - self.numFloors = numFloors + self.numFloors = 0 self.becameSuitTime = time.time() self.fsm.request('clearOutToonInteriorForCogdo') @@ -321,25 +321,38 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): toon = None if t: toon = self.getToon(t) - if toon is not None: + + if toon != None: activeToons.append(toon) + continue + for t in victorList: toon = None if t: toon = self.getToon(t) self.air.writeServerEvent('buildingDefeated', t, '%s|%s|%s|%s' % (self.track, self.numFloors, self.zoneId, victorList)) - if toon is not None: - self.air.questManager.toonKilledCogdo(toon, self.difficulty, self.numFloors, self.zoneId, activeToons) - for i in xrange(0, 4): + + if toon != None: + #self.air.questManager.toonKilledCogdo(toon, self.track, self.difficulty, self.numFloors, self.zoneId, activeToons) + continue + + victorList.extend([None, None, None, None]) + for i in range(0, 4): victor = victorList[i] - if (victor is None) or (victor not in self.air.doId2do): + if victor == None or not self.air.doId2do.has_key(victor): victorList[i] = 0 continue event = self.air.getAvatarExitEvent(victor) - self.accept(event, self.setVictorExited, extraArgs = [victor]) - self.b_setVictorList(victorList) + self.accept(event, self.setVictorExited, extraArgs = [ + victor]) + + self.b_setVictorList(victorList[:4]) self.updateSavedBy(savedBy) - self.victorResponses = [0, 0, 0, 0] + self.victorResponses = [ + 0, + 0, + 0, + 0] self.d_setState('waitForVictorsFromCogdo') def exitWaitForVictorsFromCogdo(self): diff --git a/toontown/building/ElevatorConstants.py b/toontown/building/ElevatorConstants.py index a8bbcb26..37119887 100644 --- a/toontown/building/ElevatorConstants.py +++ b/toontown/building/ElevatorConstants.py @@ -8,6 +8,7 @@ ELEVATOR_OFFICE = 5 ELEVATOR_STAGE = 6 ELEVATOR_BB = 7 ELEVATOR_COUNTRY_CLUB = 8 +ELEVATOR_FIELD = 9 REJECT_NOREASON = 0 REJECT_SHUFFLE = 1 REJECT_MINLAFF = 2 @@ -80,7 +81,14 @@ ElevatorData = {ELEVATOR_NORMAL: {'openTime': 2.0, 'width': 5.875, 'countdown': bboard.get('elevatorCountdown', 15.0), 'sfxVolume': 1.0, - 'collRadius': 4}} + 'collRadius': 4}, + ELEVATOR_FIELD: {'openTime': 2.0, + 'closeTime': 2.0, + 'width': 3.5, + 'countdown': bboard.get('elevatorCountdown', 15.0), + 'sfxVolume': 1.0, + 'collRadius': 5.6}} + TOON_BOARD_ELEVATOR_TIME = 1.0 TOON_EXIT_ELEVATOR_TIME = 1.0 TOON_VICTORY_EXIT_TIME = 1.0 diff --git a/toontown/catalog/CatalogHouseItem.py b/toontown/catalog/CatalogHouseItem.py new file mode 100644 index 00000000..2dbd8bb6 --- /dev/null +++ b/toontown/catalog/CatalogHouseItem.py @@ -0,0 +1,69 @@ +import CatalogItem +from toontown.toonbase import TTLocalizer +from direct.showbase import PythonUtil +from direct.gui.DirectGui import * +from toontown.toonbase import ToontownGlobals +from toontown.estate import HouseGlobals + +class CatalogHouseItem(CatalogItem.CatalogItem): + def makeNewItem(self, houseId): + self.houseId = houseId + CatalogItem.CatalogItem.makeNewItem(self) + + def notOfferedTo(self, avatar): + return 1 + + def requestPurchase(self, phone, callback): + from toontown.toontowngui import TTDialog + avatar = base.localAvatar + + self.requestPurchaseCleanup() + buttonCallback = PythonUtil.Functor(self.__handleFullPurchaseDialog, phone, callback) + self.dialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.CatalogPurchaseHouseType, text_wordwrap=15, command=buttonCallback) + self.dialog.show() + + def requestPurchaseCleanup(self): + if hasattr(self, 'dialog'): + self.dialog.cleanup() + del self.dialog + + def __handleFullPurchaseDialog(self, phone, callback, buttonValue): + from toontown.toontowngui import TTDialog + self.requestPurchaseCleanup() + if buttonValue == DGG.DIALOG_OK: + CatalogItem.CatalogItem.requestPurchase(self, phone, callback) + else: + callback(ToontownGlobals.P_UserCancelled, self) + + def getTypeName(self): + return "House Type" + + def getName(self): + return TTLocalizer.HouseNames[self.houseId] + + def getEmblemPrices(self): + return HouseGlobals.HouseEmblemPrices[self.houseId] + + def getPicture(self, avatar): + model = loader.loadModel(HouseGlobals.houseModels[self.houseId]) + model.setBin('unsorted', 0, 1) + self.hasPicture = True + return self.makeFrameModel(model) + + def decodeDatagram(self, di, versionNumber, store): + CatalogItem.CatalogItem.decodeDatagram(self, di, versionNumber, store) + self.houseId = di.getUint8() + + def encodeDatagram(self, dg, store): + CatalogItem.CatalogItem.encodeDatagram(self, dg, store) + dg.addUint8(self.houseId) + + def recordPurchase(self, av, optional): + house = simbase.air.doId2do.get(av.getHouseId()) + if house: + house.b_setHouseType(self.houseId) + return ToontownGlobals.P_ItemAvailable + +def getAllHouses(): + return [CatalogHouseItem(i) for i in xrange(6)] + \ No newline at end of file diff --git a/toontown/catalog/CatalogItemPanel.py b/toontown/catalog/CatalogItemPanel.py index 9a08d5d3..93031eca 100644 --- a/toontown/catalog/CatalogItemPanel.py +++ b/toontown/catalog/CatalogItemPanel.py @@ -323,6 +323,8 @@ class CatalogItemPanel(DirectFrame): self.buyButton['state'] = DGG.DISABLED elif self['item'].getEmblemPrices() and not base.localAvatar.isEnoughMoneyAndEmblemsToBuy(self['item'].getPrice(self['type']), self['item'].getEmblemPrices()): self.buyButton['state'] = DGG.DISABLED + elif self['item'].__class__.__name__ == "CatalogHouseItem" and self['item'].houseId == localAvatar.houseType: + auxText = TTLocalizer.CatalogPurchasedMaxText elif self['item'].getPrice(self['type']) <= base.localAvatar.getMoney() + base.localAvatar.getBankMoney(): self.buyButton['state'] = DGG.NORMAL self.buyButton.show() diff --git a/toontown/catalog/CatalogItemTypes.py b/toontown/catalog/CatalogItemTypes.py index 8162ba12..88bbde83 100644 --- a/toontown/catalog/CatalogItemTypes.py +++ b/toontown/catalog/CatalogItemTypes.py @@ -18,6 +18,7 @@ import CatalogNametagItem import CatalogToonStatueItem import CatalogAnimatedFurnitureItem import CatalogAccessoryItem +import CatalogHouseItem INVALID_ITEM = 0 FURNITURE_ITEM = 1 CHAT_ITEM = 2 @@ -38,6 +39,7 @@ NAMETAG_ITEM = 16 TOON_STATUE_ITEM = 17 ANIMATED_FURNITURE_ITEM = 18 ACCESSORY_ITEM = 19 +HOUSE_ITEM = 20 NonPermanentItemTypes = (RENTAL_ITEM,) CatalogItemTypes = {CatalogInvalidItem.CatalogInvalidItem: INVALID_ITEM, CatalogFurnitureItem.CatalogFurnitureItem: FURNITURE_ITEM, @@ -58,7 +60,8 @@ CatalogItemTypes = {CatalogInvalidItem.CatalogInvalidItem: INVALID_ITEM, CatalogNametagItem.CatalogNametagItem: NAMETAG_ITEM, CatalogToonStatueItem.CatalogToonStatueItem: TOON_STATUE_ITEM, CatalogAnimatedFurnitureItem.CatalogAnimatedFurnitureItem: ANIMATED_FURNITURE_ITEM, - CatalogAccessoryItem.CatalogAccessoryItem: ACCESSORY_ITEM} + CatalogAccessoryItem.CatalogAccessoryItem: ACCESSORY_ITEM, + CatalogHouseItem.CatalogHouseItem: HOUSE_ITEM} CatalogItemType2multipleAllowed = {INVALID_ITEM: False, FURNITURE_ITEM: True, CHAT_ITEM: False, @@ -78,7 +81,8 @@ CatalogItemType2multipleAllowed = {INVALID_ITEM: False, NAMETAG_ITEM: False, TOON_STATUE_ITEM: False, ANIMATED_FURNITURE_ITEM: True, - ACCESSORY_ITEM: False} + ACCESSORY_ITEM: False, + HOUSE_ITEM: False} SingleCodeRedemption = (BEAN_ITEM,) CatalogItemTypeMask = 31 CatalogItemSaleFlag = 128 diff --git a/toontown/catalog/CatalogScreen.py b/toontown/catalog/CatalogScreen.py index 5e5a5fa7..9a3fc8a4 100644 --- a/toontown/catalog/CatalogScreen.py +++ b/toontown/catalog/CatalogScreen.py @@ -929,6 +929,12 @@ class CatalogScreen(DirectFrame): if retCode == ToontownGlobals.P_UserCancelled: self.update() return + + if item.__class__.__name__ == "CatalogHouseItem": + if retCode == ToontownGlobals.P_ItemAvailable: + localAvatar.houseType = item.houseId + self.update() + self.setClarabelleChat(item.getRequestPurchaseErrorText(retCode), item.getRequestPurchaseErrorTextTimeout()) def __handleGiftPurchaseResponse(self, retCode, item): @@ -1090,4 +1096,4 @@ class CatalogScreen(DirectFrame): self.scrollList.hide() self.showEmblems() self.giftToggle['text'] = TTLocalizer.CatalogGiftToggleOff - self.update() \ No newline at end of file + self.update() diff --git a/toontown/cogdominium/CogdoBarrelRoomMovies.py b/toontown/cogdominium/CogdoBarrelRoomMovies.py index 3b709c16..fc69a8d0 100644 --- a/toontown/cogdominium/CogdoBarrelRoomMovies.py +++ b/toontown/cogdominium/CogdoBarrelRoomMovies.py @@ -86,13 +86,13 @@ class CogdoBarrelRoomIntro(CogdoGameMovie): def start(): self.frame.show() - base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 0) + base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 0) def end(): self._dialogueLabel.reparentTo(hidden) self.toonHead.reparentTo(hidden) self.frame.hide() - base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 1) + base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 1) self._stopUpdateTask() self._ival = Sequence(Func(start), Func(self.displayLine, dialogue), Wait(CogdoBarrelRoomConsts.BarrelRoomIntroTimeout), Func(end)) @@ -115,4 +115,4 @@ class CogdoBarrelRoomIntro(CogdoGameMovie): self.toonHead.removeNode() self.toonHead.delete() del self.toonHead - CogdoGameMovie.unload(self) \ No newline at end of file + CogdoGameMovie.unload(self) diff --git a/toontown/cogdominium/CogdoElevatorMovie.py b/toontown/cogdominium/CogdoElevatorMovie.py index 67fb0256..30fff177 100644 --- a/toontown/cogdominium/CogdoElevatorMovie.py +++ b/toontown/cogdominium/CogdoElevatorMovie.py @@ -87,13 +87,13 @@ class CogdoElevatorMovie(CogdoGameMovie): def start(): self.frame.show() - base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 0) + base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 0) def end(): self._dialogueLabel.reparentTo(hidden) self.toonHead.reparentTo(hidden) self.frame.hide() - base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 1) + base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 1) self._stopUpdateTask() self._ival = Sequence(Func(start), Func(self.displayLine, dialogue), Wait(self.elevatorDuration), Func(end)) diff --git a/toontown/cogdominium/CogdoExecutiveSuiteMovies.py b/toontown/cogdominium/CogdoExecutiveSuiteMovies.py index 96709977..4ed95df8 100644 --- a/toontown/cogdominium/CogdoExecutiveSuiteMovies.py +++ b/toontown/cogdominium/CogdoExecutiveSuiteMovies.py @@ -91,7 +91,7 @@ class CogdoExecutiveSuiteIntro(CogdoGameMovie): def start(): self.frame.show() - base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 0) + base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 0) def showShopOwner(): self._setCamTarget(self._shopOwner, -10, offset=Point3(0, 0, 5)) @@ -100,7 +100,7 @@ class CogdoExecutiveSuiteIntro(CogdoGameMovie): self._dialogueLabel.reparentTo(hidden) self.toonHead.reparentTo(hidden) self.frame.hide() - base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 1) + base.setCellsActive(base.bottomCells + base.leftCells + base.rightCells, 1) self._stopUpdateTask() self._ival = Sequence(Func(start), Func(self.displayLine, dialogue), Func(showShopOwner), ParallelEndTogether(camera.posInterval(self.cameraMoveDuration, Point3(8, 0, 13), blendType='easeInOut'), camera.hprInterval(0.5, self._camHelperNode.getHpr(), blendType='easeInOut')), Wait(self.introDuration), Func(end)) diff --git a/toontown/cogdominium/SuitPlannerCogdoInteriorAI.py b/toontown/cogdominium/SuitPlannerCogdoInteriorAI.py index d2a604fd..b333df41 100644 --- a/toontown/cogdominium/SuitPlannerCogdoInteriorAI.py +++ b/toontown/cogdominium/SuitPlannerCogdoInteriorAI.py @@ -3,6 +3,7 @@ from toontown.suit import SuitDNA from direct.directnotify import DirectNotifyGlobal from toontown.suit import DistributedSuitAI from toontown.building import SuitBuildingGlobals +from toontown.suit.SuitInvasionGlobals import IFSkelecog, IFWaiter, IFV2 import types, math, random BASE_RESERVE = 10 @@ -137,25 +138,32 @@ class SuitPlannerCogdoInteriorAI: return lvlList def __setupSuitInfo(self, suit, bldgTrack, suitLevel, suitType): - suitName, skeleton = simbase.air.suitInvasionManager.getInvadingCog() - if suitName and self.respectInvasions: - suitType = SuitDNA.getSuitType(suitName) - bldgTrack = SuitDNA.getSuitDept(suitName) - suitLevel = min(max(suitLevel, suitType), suitType + 4) + suitDeptIndex, suitTypeIndex, flags = simbase.air.suitInvasionManager.getInvadingCog() + if self.respectInvasions: + if suitDeptIndex is not None: + bldgTrack = SuitDNA.suitDepts[suitDeptIndex] + if suitTypeIndex is not None: + suitName = SuitDNA.getSuitName(suitDeptIndex, suitTypeIndex) + suitType = SuitDNA.getSuitType(suitName) + suitLevel = min(max(suitLevel, suitType), suitType + 4) dna = SuitDNA.SuitDNA() dna.newSuitRandom(suitType, bldgTrack) suit.dna = dna self.notify.debug('Creating suit type ' + suit.dna.name + ' of level ' + str(suitLevel) + ' from type ' + str(suitType) + ' and track ' + str(bldgTrack)) suit.setLevel(suitLevel) - return skeleton + return flags def __genSuitObject(self, suitZone, suitType, bldgTrack, suitLevel, revives = 0): newSuit = DistributedSuitAI.DistributedSuitAI(simbase.air, None) - skel = self.__setupSuitInfo(newSuit, bldgTrack, suitLevel, suitType) - if skel: + flags = self.__setupSuitInfo(newSuit, bldgTrack, suitLevel, suitType) + if flags & IFSkelecog: newSuit.setSkelecog(1) newSuit.setSkeleRevives(revives) newSuit.generateWithRequired(suitZone) + if flags & IFWaiter: + newSuit.b_setWaiter(1) + if flags & IFV2: + newSuit.b_setSkeleRevives(1) newSuit.node().setName('suit-%s' % newSuit.doId) return newSuit diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index 4f976ffa..e35bbc1e 100644 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -2389,7 +2389,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def getBankMoney(self): return self.bankMoney - + def b_setEmblems(self, emblems): self.setEmblems(emblems) self.d_setEmblems(emblems) @@ -2427,6 +2427,8 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo return True + + def tossPie(self, x, y, z, h, p, r, sequence, power, timestamp32): if not self.validate(self.doId, self.numPies > 0, 'tossPie with no pies available'): return diff --git a/toontown/toon/Documents - Shortcut.lnk b/toontown/toon/Documents - Shortcut.lnk new file mode 100644 index 0000000000000000000000000000000000000000..1abdc0623c2f1e861cc91e1571e505e91b6d3516 GIT binary patch literal 922 zcmah{Ur1A76#qFZv_WpnB5dR+mPTydZI*KoWOvL3mZLQ=xzJ>;G;}NP2HH~uL1ocH z3@j*CRQ6B=k@R4R^wLv03Ze`mqNgOpH=(3{=U&@`34NE}`G3xLzH?7IfQniRDKKSF zL`F~rJLOEzx=n?jGZoXHhCH*$Qkg?B11n5crcuycxgm}&;1t2@=(Jvgj|v#I<*I+N33g_oc950wkn0!0E5 zLYlHtFWr2%bZz^S$m3`I7owGYuf;dVc~sMvpzMps;y;v^vnnpNjV+cO_w*CnT4?Vf zP)|6BE_5S>UeZAf!-Ynu2(gI-bfjt1u~Wj0bCpzze!biodC?wJCw@7u?-(7JmPxIV z2r0Uoh{FRPv4`**k`FB$UJ!c?1gMEGK(9hufV7D;NV{Yk?dv5%nh_z4EMJ(%0N;~AjxPc>5;X+&3;BH5STXs* z