mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 19:52:37 -06:00
Implement code redemption! Woo!
This commit is contained in:
parent
a0e61b23b6
commit
f5e41df8f8
8 changed files with 58 additions and 44 deletions
|
@ -287,7 +287,7 @@ from toontown.uberdog.DistributedPartyManager/AI/UD import DistributedPartyManag
|
||||||
from toontown.rpc.AwardManager/UD import AwardManager/UD
|
from toontown.rpc.AwardManager/UD import AwardManager/UD
|
||||||
from toontown.uberdog.DistributedCpuInfoMgr/AI/UD import DistributedCpuInfoMgr/AI/UD
|
from toontown.uberdog.DistributedCpuInfoMgr/AI/UD import DistributedCpuInfoMgr/AI/UD
|
||||||
from toontown.uberdog.DistributedInGameNewsMgr/AI/UD import DistributedInGameNewsMgr/AI/UD
|
from toontown.uberdog.DistributedInGameNewsMgr/AI/UD import DistributedInGameNewsMgr/AI/UD
|
||||||
from toontown.coderedemption.TTCodeRedemptionMgr/AI/UD import TTCodeRedemptionMgr/AI/UD
|
from toontown.coderedemption.TTCodeRedemptionMgr/AI import TTCodeRedemptionMgr/AI
|
||||||
from toontown.distributed.NonRepeatableRandomSourceAI import NonRepeatableRandomSourceAI
|
from toontown.distributed.NonRepeatableRandomSourceAI import NonRepeatableRandomSourceAI
|
||||||
from toontown.distributed.NonRepeatableRandomSourceUD import NonRepeatableRandomSourceUD
|
from toontown.distributed.NonRepeatableRandomSourceUD import NonRepeatableRandomSourceUD
|
||||||
from toontown.ai.DistributedPhaseEventMgr/AI import DistributedPhaseEventMgr/AI
|
from toontown.ai.DistributedPhaseEventMgr/AI import DistributedPhaseEventMgr/AI
|
||||||
|
@ -3310,10 +3310,7 @@ dclass NonRepeatableRandomSourceClient {
|
||||||
};
|
};
|
||||||
|
|
||||||
dclass TTCodeRedemptionMgr : DistributedObject, NonRepeatableRandomSourceClient {
|
dclass TTCodeRedemptionMgr : DistributedObject, NonRepeatableRandomSourceClient {
|
||||||
giveAwardToToonResult(uint32, uint32);
|
|
||||||
redeemCode(uint32, char [0-256]) airecv clsend;
|
redeemCode(uint32, char [0-256]) airecv clsend;
|
||||||
redeemCodeAiToUd(uint32, DoId, uint32, string, uint32);
|
|
||||||
redeemCodeResultUdToAi(uint32, uint32, uint32, uint32, uint32) airecv;
|
|
||||||
redeemCodeResult(uint32, uint32, uint32);
|
redeemCodeResult(uint32, uint32, uint32);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
|
|
||||||
|
|
||||||
hashVal = 3181838135L
|
hashVal = 1907389465
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -27,6 +27,7 @@ from toontown.coghq import MintManagerAI
|
||||||
from toontown.distributed.ToontownDistrictAI import ToontownDistrictAI
|
from toontown.distributed.ToontownDistrictAI import ToontownDistrictAI
|
||||||
from toontown.distributed.ToontownDistrictStatsAI import ToontownDistrictStatsAI
|
from toontown.distributed.ToontownDistrictStatsAI import ToontownDistrictStatsAI
|
||||||
from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository
|
from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository
|
||||||
|
from toontown.coderedemption.TTCodeRedemptionMgrAI import TTCodeRedemptionMgrAI
|
||||||
from toontown.dna.DNAParser import loadDNAFileAI
|
from toontown.dna.DNAParser import loadDNAFileAI
|
||||||
from toontown.estate.EstateManagerAI import EstateManagerAI
|
from toontown.estate.EstateManagerAI import EstateManagerAI
|
||||||
from toontown.hood import BRHoodAI
|
from toontown.hood import BRHoodAI
|
||||||
|
@ -115,6 +116,8 @@ class ToontownAIRepository(ToontownInternalRepository):
|
||||||
self.cogPageManager = CogPageManagerAI.CogPageManagerAI()
|
self.cogPageManager = CogPageManagerAI.CogPageManagerAI()
|
||||||
self.bankManager = BankManagerAI.BankManagerAI(self)
|
self.bankManager = BankManagerAI.BankManagerAI(self)
|
||||||
self.holidayManager = HolidayManagerAI(self)
|
self.holidayManager = HolidayManagerAI(self)
|
||||||
|
self.codeRedemptionMgr = TTCodeRedemptionMgrAI(self)
|
||||||
|
self.codeRedemptionMgr.generateWithRequired(2)
|
||||||
self.buildingQueryMgr = DistributedBuildingQueryMgrAI(self)
|
self.buildingQueryMgr = DistributedBuildingQueryMgrAI(self)
|
||||||
self.buildingQueryMgr.generateWithRequired(2)
|
self.buildingQueryMgr.generateWithRequired(2)
|
||||||
if self.wantFishing:
|
if self.wantFishing:
|
||||||
|
|
|
@ -10,14 +10,14 @@ class TTCodeRedemptionMgr(DistributedObject):
|
||||||
|
|
||||||
def announceGenerate(self):
|
def announceGenerate(self):
|
||||||
DistributedObject.announceGenerate(self)
|
DistributedObject.announceGenerate(self)
|
||||||
base.codeRedemptionMgr = self
|
base.cr.codeRedemptionMgr = self
|
||||||
self._contextGen = SerialMaskedGen(4294967295L)
|
self._contextGen = SerialMaskedGen(4294967295L)
|
||||||
self._context2callback = {}
|
self._context2callback = {}
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
if hasattr(base, 'codeRedemptionMgr'):
|
if hasattr(base.cr, 'codeRedemptionMgr'):
|
||||||
if base.codeRedemptionMgr is self:
|
if base.cr.codeRedemptionMgr is self:
|
||||||
del base.codeRedemptionMgr
|
del base.cr.codeRedemptionMgr
|
||||||
self._context2callback = None
|
self._context2callback = None
|
||||||
self._contextGen = None
|
self._contextGen = None
|
||||||
DistributedObject.delete(self)
|
DistributedObject.delete(self)
|
||||||
|
|
|
@ -1,21 +1,58 @@
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||||
|
from toontown.catalog import CatalogClothingItem
|
||||||
|
from toontown.toonbase import ToontownGlobals
|
||||||
|
from datetime import datetime
|
||||||
|
import time
|
||||||
|
|
||||||
class TTCodeRedemptionMgrAI(DistributedObjectAI):
|
class TTCodeRedemptionMgrAI(DistributedObjectAI):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory("TTCodeRedemptionMgrAI")
|
notify = DirectNotifyGlobal.directNotify.newCategory("TTCodeRedemptionMgrAI")
|
||||||
|
codes = {
|
||||||
|
'weed': {
|
||||||
|
'item': CatalogClothingItem.CatalogClothingItem(1821, 0),
|
||||||
|
'month': 4,
|
||||||
|
'day': 20
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def giveAwardToToonResult(self, todo0, todo1):
|
def announceGenerate(self):
|
||||||
pass
|
DistributedObjectAI.announceGenerate(self)
|
||||||
|
|
||||||
def redeemCode(self, todo0, todo1):
|
def redeemCode(self, context, code):
|
||||||
pass
|
avId = self.air.getAvatarIdFromSender()
|
||||||
|
|
||||||
def redeemCodeAiToUd(self, todo0, todo1, todo2, todo3, todo4):
|
if code in self.codes:
|
||||||
pass
|
codeInfo = self.codes[code]
|
||||||
|
date = datetime.now()
|
||||||
|
|
||||||
def redeemCodeResultUdToAi(self, todo0, todo1, todo2, todo3, todo4):
|
if ('month' in codeInfo and date.month is not codeInfo['month']) or ('day' in codeInfo and date.day is not codeInfo['day']):
|
||||||
pass
|
self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [context, 2, 0])
|
||||||
|
return
|
||||||
|
|
||||||
def redeemCodeResult(self, todo0, todo1, todo2):
|
self.requestCodeRedeem(context, codeInfo['item'])
|
||||||
pass
|
else:
|
||||||
|
self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [context, 1, 0])
|
||||||
|
|
||||||
|
def requestCodeRedeem(self, context, item):
|
||||||
|
avId = self.air.getAvatarIdFromSender()
|
||||||
|
av = self.air.doId2do.get(avId)
|
||||||
|
|
||||||
|
if not av:
|
||||||
|
return
|
||||||
|
|
||||||
|
if len(av.onOrder) > 5:
|
||||||
|
self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [context, 4, 4])
|
||||||
|
return
|
||||||
|
|
||||||
|
if len(av.mailboxContents) + len(av.onOrder) >= ToontownGlobals.MaxMailboxContents:
|
||||||
|
self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [context, 4, 3])
|
||||||
|
return
|
||||||
|
|
||||||
|
if item in av.onOrder or item.reachedPurchaseLimit(av):
|
||||||
|
self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [context, 4, 13])
|
||||||
|
return
|
||||||
|
|
||||||
|
item.deliveryDate = int(time.time() / 60) + 0.01
|
||||||
|
av.onOrder.append(item)
|
||||||
|
av.b_setDeliverySchedule(av.onOrder)
|
||||||
|
self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [context, 0, 0])
|
|
@ -1,21 +0,0 @@
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
|
||||||
from direct.distributed.DistributedObjectUD import DistributedObjectUD
|
|
||||||
|
|
||||||
class TTCodeRedemptionMgrUD(DistributedObjectUD):
|
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory("TTCodeRedemptionMgrUD")
|
|
||||||
|
|
||||||
def giveAwardToToonResult(self, todo0, todo1):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def redeemCode(self, todo0, todo1):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def redeemCodeAiToUd(self, todo0, todo1, todo2, todo3, todo4):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def redeemCodeResultUdToAi(self, todo0, todo1, todo2, todo3, todo4):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def redeemCodeResult(self, todo0, todo1, todo2):
|
|
||||||
pass
|
|
||||||
|
|
|
@ -95,8 +95,6 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
||||||
self.playerFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_PLAYER_FRIENDS_MANAGER, 'TTPlayerFriendsManager')
|
self.playerFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_PLAYER_FRIENDS_MANAGER, 'TTPlayerFriendsManager')
|
||||||
self.ttuFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TTU_FRIENDS_MANAGER, 'TTUFriendsManager')
|
self.ttuFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TTU_FRIENDS_MANAGER, 'TTUFriendsManager')
|
||||||
self.deliveryManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TOONTOWN_DELIVERY_MANAGER, 'DistributedDeliveryManager')
|
self.deliveryManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TOONTOWN_DELIVERY_MANAGER, 'DistributedDeliveryManager')
|
||||||
if config.GetBool('want-code-redemption', 1):
|
|
||||||
self.codeRedemptionManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TOONTOWN_CODE_REDEMPTION_MANAGER, 'TTCodeRedemptionMgr')
|
|
||||||
|
|
||||||
self.streetSign = None
|
self.streetSign = None
|
||||||
self.furnitureManager = None
|
self.furnitureManager = None
|
||||||
|
|
|
@ -633,8 +633,8 @@ class CodesTabPage(DirectFrame):
|
||||||
if input == '':
|
if input == '':
|
||||||
return
|
return
|
||||||
messenger.send('wakeup')
|
messenger.send('wakeup')
|
||||||
if hasattr(base, 'codeRedemptionMgr'):
|
if hasattr(base.cr, 'codeRedemptionMgr'):
|
||||||
base.codeRedemptionMgr.redeemCode(input, self.__getCodeResult)
|
base.cr.codeRedemptionMgr.redeemCode(input, self.__getCodeResult)
|
||||||
self.codeInput.enterText('')
|
self.codeInput.enterText('')
|
||||||
self.__disableCodeEntry()
|
self.__disableCodeEntry()
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue