Get fucking fucked, Loyalty items!!

This commit is contained in:
Daniel 2015-03-09 21:23:28 +02:00
parent 7fe35ebb38
commit 26c85cdded
6 changed files with 75 additions and 10 deletions

View file

@ -77,6 +77,7 @@ from toontown.shtiker import NewbiePurchaseManager/AI
from toontown.safezone import SafeZoneManager/AI from toontown.safezone import SafeZoneManager/AI
from toontown.tutorial import TutorialManager/AI from toontown.tutorial import TutorialManager/AI
from toontown.catalog import CatalogManager/AI from toontown.catalog import CatalogManager/AI
from toontown.catalog import AccountDate/AI
from toontown.safezone import DistributedTreasure/AI from toontown.safezone import DistributedTreasure/AI
from toontown.coghq import DistributedCashbotBossTreasure/AI from toontown.coghq import DistributedCashbotBossTreasure/AI
from toontown.building import DistributedTrophyMgr/AI from toontown.building import DistributedTrophyMgr/AI
@ -1529,6 +1530,11 @@ dclass CatalogManager : DistributedObject {
startCatalog() airecv clsend; startCatalog() airecv clsend;
}; };
dclass AccountDate : DistributedObject {
requestDate() airecv clsend;
requestDateResult(string);
};
dclass DistributedMyTest : DistributedObject { dclass DistributedMyTest : DistributedObject {
setMyTest(uint16) broadcast; setMyTest(uint16) broadcast;
}; };

View file

@ -2,7 +2,7 @@
from pandac.PandaModules import * from pandac.PandaModules import *
hashVal = 2495436342L hashVal = 2127944587
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.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.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.racing import DistributedVehicle, DistributedStartingBlock, DistributedRace, DistributedKartPad, DistributedRacePad, DistributedViewPad, DistributedStartingBlock, DistributedLeaderBoard, DistributedGag, DistributedProjectile
from toontown.distributed.NonRepeatableRandomSourceUD import NonRepeatableRandomSourceUD 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.ai.DistributedHydrantZeroMgr import DistributedHydrantZeroMgr
from toontown.rpc.AwardManager import AwardManager 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 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

View file

@ -16,6 +16,7 @@ from toontown.ai.HolidayManagerAI import HolidayManagerAI
from toontown.ai.NewsManagerAI import NewsManagerAI from toontown.ai.NewsManagerAI import NewsManagerAI
from toontown.ai.QuestManagerAI import QuestManagerAI from toontown.ai.QuestManagerAI import QuestManagerAI
from toontown.ai import BankManagerAI from toontown.ai import BankManagerAI
from toontown.catalog.AccountDateAI import AccountDateAI
from toontown.building.DistributedBuildingQueryMgrAI import DistributedBuildingQueryMgrAI from toontown.building.DistributedBuildingQueryMgrAI import DistributedBuildingQueryMgrAI
from toontown.building.DistributedTrophyMgrAI import DistributedTrophyMgrAI from toontown.building.DistributedTrophyMgrAI import DistributedTrophyMgrAI
from toontown.catalog.CatalogManagerAI import CatalogManagerAI from toontown.catalog.CatalogManagerAI import CatalogManagerAI
@ -119,6 +120,8 @@ class ToontownAIRepository(ToontownInternalRepository):
self.holidayManager = HolidayManagerAI(self) self.holidayManager = HolidayManagerAI(self)
self.codeRedemptionMgr = TTCodeRedemptionMgrAI(self) self.codeRedemptionMgr = TTCodeRedemptionMgrAI(self)
self.codeRedemptionMgr.generateWithRequired(2) self.codeRedemptionMgr.generateWithRequired(2)
self.accountDateMgr = AccountDateAI(self)
self.accountDateMgr.generateWithRequired(2)
self.buildingQueryMgr = DistributedBuildingQueryMgrAI(self) self.buildingQueryMgr = DistributedBuildingQueryMgrAI(self)
self.buildingQueryMgr.generateWithRequired(2) self.buildingQueryMgr.generateWithRequired(2)
self.groupManager.generateWithRequired(2) self.groupManager.generateWithRequired(2)

View file

@ -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

View file

@ -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)

View file

@ -1852,13 +1852,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
self.inventory.updateTotalPropsText() self.inventory.updateTotalPropsText()
def getAccountDays(self): def getAccountDays(self):
days = 0 return base.cr.accountDateMgr.getAccountDays()
defaultDays = base.cr.config.GetInt('account-days', -1)
if defaultDays >= 0:
days = defaultDays
elif hasattr(base.cr, 'accountDays'):
days = base.cr.accountDays
return days
def hasActiveBoardingGroup(self): def hasActiveBoardingGroup(self):
if hasattr(localAvatar, 'boardingParty') and localAvatar.boardingParty: if hasattr(localAvatar, 'boardingParty') and localAvatar.boardingParty: