From d7279b777800282e12453c6159e5bdc4a03d72d7 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 10 Mar 2015 00:11:27 +0200 Subject: [PATCH] Revert "Removed AccountDate and velvet rope" This reverts commit d3a352f3951452542ea7648bfb69aba5c91cc18b. --- astron/dclass/toon.dc | 6 ++++ otp/distributed/DCClassImports.py | 4 +-- otp/distributed/OTPClientRepository.py | 2 ++ otp/otpbase/OTPGlobals.py | 1 + toontown/ai/ToontownAIRepository.py | 3 ++ toontown/catalog/AccountDate.py | 39 ++++++++++++++++++++++ toontown/catalog/AccountDateAI.py | 23 +++++++++++++ toontown/toon/DistributedNPCBankerAI.py | 1 + toontown/toon/DistributedNPCToonAI.py | 1 + toontown/toon/DistributedToonAI.py | 12 ++++--- toontown/toon/InventoryBase.py | 11 +++--- toontown/toon/LocalToon.py | 2 +- toontown/toonbase/ToontownBattleGlobals.py | 13 ++++++++ 13 files changed, 107 insertions(+), 11 deletions(-) create mode 100644 toontown/catalog/AccountDate.py create mode 100644 toontown/catalog/AccountDateAI.py diff --git a/astron/dclass/toon.dc b/astron/dclass/toon.dc index 17f5e793..9f3ba334 100644 --- a/astron/dclass/toon.dc +++ b/astron/dclass/toon.dc @@ -77,6 +77,7 @@ from toontown.shtiker import NewbiePurchaseManager/AI from toontown.safezone import SafeZoneManager/AI from toontown.tutorial import TutorialManager/AI from toontown.catalog import CatalogManager/AI +from toontown.catalog import AccountDate/AI from toontown.safezone import DistributedTreasure/AI from toontown.coghq import DistributedCashbotBossTreasure/AI from toontown.building import DistributedTrophyMgr/AI @@ -1535,6 +1536,11 @@ dclass CatalogManager : DistributedObject { startCatalog() airecv clsend; }; +dclass AccountDate : DistributedObject { + requestDate() airecv clsend; + requestDateResult(string); +}; + dclass DistributedMyTest : DistributedObject { setMyTest(uint16) broadcast; }; diff --git a/otp/distributed/DCClassImports.py b/otp/distributed/DCClassImports.py index 45bc24c7..4b26b95b 100644 --- a/otp/distributed/DCClassImports.py +++ b/otp/distributed/DCClassImports.py @@ -2,7 +2,7 @@ from pandac.PandaModules import * -hashVal = 3328589302L +hashVal = 2798365763L 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.fishing import DistributedFishingPond, DistributedFishingTarget, D from toontown.minigame import DistributedMinigame, DistributedMinigameTemplate, DistributedRaceGame, DistributedCannonGame, DistributedPhotoGame, DistributedPatternGame, DistributedRingGame, DistributedTagGame, DistributedMazeGame, DistributedTugOfWarGame, DistributedCatchGame, DistributedDivingGame, DistributedTargetGame, DistributedTravelGame, DistributedPairingGame, DistributedVineGame, DistributedIceGame, DistributedCogThiefGame, DistributedTwoDGame from toontown.racing import DistributedVehicle, DistributedStartingBlock, DistributedRace, DistributedKartPad, DistributedRacePad, DistributedViewPad, DistributedStartingBlock, DistributedLeaderBoard, DistributedGag, DistributedProjectile from toontown.distributed.NonRepeatableRandomSourceUD import NonRepeatableRandomSourceUD -from toontown.catalog import CatalogManager +from toontown.catalog import CatalogManager, AccountDate from toontown.ai.DistributedHydrantZeroMgr import DistributedHydrantZeroMgr from toontown.rpc.AwardManager import AwardManager from toontown.parties import DistributedParty, DistributedPartyActivity, DistributedPartyTeamActivity, DistributedPartyCannon, DistributedPartyCannonActivity, DistributedPartyCatchActivity, DistributedPartyWinterCatchActivity, DistributedPartyCogActivity, DistributedPartyWinterCogActivity, DistributedPartyFireworksActivity, DistributedPartyDanceActivityBase, DistributedPartyDanceActivity, DistributedPartyDance20Activity, DistributedPartyValentineDanceActivity, DistributedPartyValentineDance20Activity, DistributedPartyTrampolineActivity, DistributedPartyValentineTrampolineActivity, DistributedPartyVictoryTrampolineActivity, DistributedPartyWinterTrampolineActivity, DistributedPartyTugOfWarActivity, DistributedPartyJukeboxActivityBase, DistributedPartyJukeboxActivity, DistributedPartyJukebox40Activity, DistributedPartyValentineJukeboxActivity, DistributedPartyValentineJukebox40Activity diff --git a/otp/distributed/OTPClientRepository.py b/otp/distributed/OTPClientRepository.py index 9e9a17d8..c960dc0e 100644 --- a/otp/distributed/OTPClientRepository.py +++ b/otp/distributed/OTPClientRepository.py @@ -1605,6 +1605,8 @@ class OTPClientRepository(ClientRepositoryBase): return 0 elif paidStatus == 'FULL': return OTPGlobals.AccessFull + elif paidStatus == 'VELVET': + return OTPGlobals.AccessVelvetRope else: return 0 diff --git a/otp/otpbase/OTPGlobals.py b/otp/otpbase/OTPGlobals.py index 88becfe3..723b818e 100644 --- a/otp/otpbase/OTPGlobals.py +++ b/otp/otpbase/OTPGlobals.py @@ -376,6 +376,7 @@ ChatFeedback_PassedBlacklist = 32 ChatFeedback_Whitelist = 64 ChatFeedback_OpenChat = 128 AccessUnknown = 0 +AccessVelvetRope = 1 AccessFull = 2 AccessInvalid = 3 AvatarPendingCreate = -1 diff --git a/toontown/ai/ToontownAIRepository.py b/toontown/ai/ToontownAIRepository.py index b06bf018..35c96eff 100644 --- a/toontown/ai/ToontownAIRepository.py +++ b/toontown/ai/ToontownAIRepository.py @@ -16,6 +16,7 @@ from toontown.ai.HolidayManagerAI import HolidayManagerAI from toontown.ai.NewsManagerAI import NewsManagerAI from toontown.ai.QuestManagerAI import QuestManagerAI from toontown.ai import BankManagerAI +from toontown.catalog.AccountDateAI import AccountDateAI from toontown.building.DistributedBuildingQueryMgrAI import DistributedBuildingQueryMgrAI from toontown.building.DistributedTrophyMgrAI import DistributedTrophyMgrAI from toontown.catalog.CatalogManagerAI import CatalogManagerAI @@ -119,6 +120,8 @@ class ToontownAIRepository(ToontownInternalRepository): self.holidayManager = HolidayManagerAI(self) self.codeRedemptionMgr = TTCodeRedemptionMgrAI(self) self.codeRedemptionMgr.generateWithRequired(2) + self.accountDateMgr = AccountDateAI(self) + self.accountDateMgr.generateWithRequired(2) self.buildingQueryMgr = DistributedBuildingQueryMgrAI(self) self.buildingQueryMgr.generateWithRequired(2) self.groupManager.generateWithRequired(2) diff --git a/toontown/catalog/AccountDate.py b/toontown/catalog/AccountDate.py new file mode 100644 index 00000000..610227e1 --- /dev/null +++ b/toontown/catalog/AccountDate.py @@ -0,0 +1,39 @@ +from direct.distributed.DistributedObject import DistributedObject +from direct.directnotify.DirectNotifyGlobal import directNotify +from datetime import datetime + +class AccountDate(DistributedObject): + neverDisable = 1 + notify = directNotify.newCategory('AccountDate') + + def __init__(self, cr): + DistributedObject.__init__(self, cr) + self.accountDays = 0 + + def announceGenerate(self): + DistributedObject.announceGenerate(self) + base.cr.accountDateMgr = self + taskMgr.doMethodLater(10, self.requestDate, 'request-task') + + def delete(self): + if hasattr(base.cr, 'accountDateMgr'): + if base.cr.accountDateMgr is self: + del base.cr.accountDateMgr + DistributedObject.delete(self) + + def getAccountDays(self): + return self.accountDays + + def requestDate(self, task=None): + self.sendUpdate('requestDate') + + if task is not None: + return task.done + + def requestDateResult(self, result): + if result is None: + notify.warning('Invalid response from server.') + self.accountDays = 0 + else: + date = datetime.strptime(result, "%a %b %d %H:%M:%S %Y") + self.accountDays = (datetime.now() - date).days \ No newline at end of file diff --git a/toontown/catalog/AccountDateAI.py b/toontown/catalog/AccountDateAI.py new file mode 100644 index 00000000..654048ea --- /dev/null +++ b/toontown/catalog/AccountDateAI.py @@ -0,0 +1,23 @@ +from direct.directnotify import DirectNotifyGlobal +from direct.distributed.DistributedObjectAI import DistributedObjectAI + +class AccountDateAI(DistributedObjectAI): + notify = DirectNotifyGlobal.directNotify.newCategory("AccountDateAI") + + def announceGenerate(self): + DistributedObjectAI.announceGenerate(self) + + def requestDate(self): + avId = self.air.getAvatarIdFromSender() + av = self.air.doId2do.get(avId) + + if not av: + return + + def callback(dclass, fields): + if dclass is not None and dclass == self.air.dclassesByName['AccountAI'] and fields.has_key('CREATED'): + self.sendUpdateToAvatarId(avId, 'requestDateResult', [fields.get('CREATED')]) + else: + self.sendUpdateToAvatarId(avId, 'requestDateResult', [None]) + + self.air.dbInterface.queryObject(self.air.dbId, av.DISLid, callback) \ No newline at end of file diff --git a/toontown/toon/DistributedNPCBankerAI.py b/toontown/toon/DistributedNPCBankerAI.py index 59947f3b..87b8092c 100644 --- a/toontown/toon/DistributedNPCBankerAI.py +++ b/toontown/toon/DistributedNPCBankerAI.py @@ -5,6 +5,7 @@ from DistributedNPCToonBaseAI import * from toontown.estate import BankGlobals class DistributedNPCBankerAI(DistributedNPCToonBaseAI): + FourthGagVelvetRopeBan = config.GetBool('want-ban-fourth-gag-velvet-rope', 0) def __init__(self, air, npcId, questCallback = None, hq = 0): DistributedNPCToonBaseAI.__init__(self, air, npcId, questCallback) diff --git a/toontown/toon/DistributedNPCToonAI.py b/toontown/toon/DistributedNPCToonAI.py index 5e975fee..a903eaa1 100644 --- a/toontown/toon/DistributedNPCToonAI.py +++ b/toontown/toon/DistributedNPCToonAI.py @@ -5,6 +5,7 @@ from DistributedNPCToonBaseAI import * from toontown.quest import Quests class DistributedNPCToonAI(DistributedNPCToonBaseAI): + FourthGagVelvetRopeBan = config.GetBool('want-ban-fourth-gag-velvet-rope', 0) def __init__(self, air, npcId, questCallback = None, hq = 0): DistributedNPCToonBaseAI.__init__(self, air, npcId, questCallback) diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index 8919853d..21f191ef 100644 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -474,7 +474,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo if oldTracks == 0 and oldLevels == 0: self.notify.warning('reseting invalid inventory to MAX on toon: %s' % self.doId) self.inventory.zeroInv() - self.inventory.maxOutInv(1) + self.inventory.maxOutInv(1, 1) else: newInventory = InventoryBase.InventoryBase(self) oldList = emptyInv.makeFromNetStringForceSize(inventoryNetString, oldTracks, oldLevels) @@ -488,9 +488,9 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def getInventory(self): return self.inventory.makeNetString() - def doRestock(self, noUber = 1): + def doRestock(self, noUber = 1, noPaid = 1): self.inventory.zeroInv() - self.inventory.maxOutInv(noUber) + self.inventory.maxOutInv(noUber, noPaid) self.d_setInventory(self.inventory.makeNetString()) def setDefaultShard(self, shard): @@ -3703,7 +3703,11 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo if paidStatus == 'unpaid': access = 1 if access == OTPGlobals.AccessInvalid: - access = OTPGlobals.AccessFull + if not __dev__: + self.air.writeServerEvent('Setting Access', self.doId, 'setAccess not being sent by the OTP Server, changing access to unpaid') + access = OTPGlobals.AccessVelvetRope + elif __dev__: + access = OTPGlobals.AccessFull self.setGameAccess(access) def setGameAccess(self, access): diff --git a/toontown/toon/InventoryBase.py b/toontown/toon/InventoryBase.py index f076671e..0fb70f07 100644 --- a/toontown/toon/InventoryBase.py +++ b/toontown/toon/InventoryBase.py @@ -241,13 +241,14 @@ class InventoryBase(DirectObject.DirectObject): self.updateInventory(newInventory) return 1 - def maxOutInv(self, filterUberGags = 0): + def maxOutInv(self, filterUberGags = 0, filterPaidGags = 0): unpaid = self.toon.getGameAccess() != ToontownGlobals.AccessFull for track in xrange(len(Tracks)): if self.toon.hasTrackAccess(track): for level in xrange(len(Levels[track])): if level <= LAST_REGULAR_GAG_LEVEL or not filterUberGags: - self.addItem(track, level) + if not filterPaidGags or not (unpaid and gagIsPaidOnly(track, level)): + self.addItem(track, level) addedAnything = 1 while addedAnything: @@ -258,10 +259,12 @@ class InventoryBase(DirectObject.DirectObject): level = len(Levels[track]) - 1 if level > LAST_REGULAR_GAG_LEVEL and filterUberGags: level = LAST_REGULAR_GAG_LEVEL - result = self.addItem(track, level) + if not filterPaidGags or not (unpaid and gagIsPaidOnly(track, level)): + result = self.addItem(track, level) level -= 1 while result <= 0 and level >= 0: - result = self.addItem(track, level) + if not filterPaidGags or not (unpaid and gagIsPaidOnly(track, level)): + result = self.addItem(track, level) level -= 1 if result > 0: diff --git a/toontown/toon/LocalToon.py b/toontown/toon/LocalToon.py index 32c1d889..980b8797 100644 --- a/toontown/toon/LocalToon.py +++ b/toontown/toon/LocalToon.py @@ -1852,7 +1852,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): self.inventory.updateTotalPropsText() def getAccountDays(self): - return 0 + return base.cr.accountDateMgr.getAccountDays() def hasActiveBoardingGroup(self): if hasattr(localAvatar, 'boardingParty') and localAvatar.boardingParty: diff --git a/toontown/toonbase/ToontownBattleGlobals.py b/toontown/toonbase/ToontownBattleGlobals.py index b5db2cf8..d1a79dcb 100644 --- a/toontown/toonbase/ToontownBattleGlobals.py +++ b/toontown/toonbase/ToontownBattleGlobals.py @@ -102,6 +102,19 @@ UnpaidMaxSkills = [Levels[0][1] - 1, Levels[6][1] - 1] ExperienceCap = 300 +def gagIsPaidOnly(track, level): + return Levels[track][level] > UnpaidMaxSkills[track] + + +def gagIsVelvetRoped(track, level): + if level > 0: + if track in [4, 5]: + if level > 3: + return True + else: + return True + return False + MaxToonAcc = 95 StartingLevel = 0