From 3f49cfcab56fb0599b86062ebd90703149d325eb Mon Sep 17 00:00:00 2001 From: Open Toontown Date: Fri, 22 Nov 2019 22:11:12 -0500 Subject: [PATCH] general: the rest of the work from the livestream --- etc/Configrc.prc | 1 + etc/otp.dc | 3 +-- otp/ai/TimeManagerAI.py | 12 ++++++++++++ toontown/ai/HolidayManagerAI.py | 3 +++ toontown/ai/ToontownAIRepository.py | 10 ++++++++++ toontown/toon/DistributedNPCToonBase.py | 1 + 6 files changed, 28 insertions(+), 2 deletions(-) diff --git a/etc/Configrc.prc b/etc/Configrc.prc index 7c532e6..95b0298 100644 --- a/etc/Configrc.prc +++ b/etc/Configrc.prc @@ -95,6 +95,7 @@ audio-music-active #t audio-master-sfx-volume 1 audio-master-music-volume 1 server-type prod +want-dev 0 # TEMP fake-playtoken dev diff --git a/etc/otp.dc b/etc/otp.dc index aed8554..228fbd7 100755 --- a/etc/otp.dc +++ b/etc/otp.dc @@ -106,7 +106,7 @@ dclass TimeManager : DistributedObject { serverTime(uint8, int32, uint32); setDisconnectReason(uint8) airecv clsend; setExceptionInfo(string(0-1024)) airecv clsend; - setSignature(string(0-1024), char [16], char [16]) airecv clsend; + setSignature(string(0-1024), blob, blob) airecv clsend; setFrameRate(uint16/10, uint16/1000, uint16, string(0-256), uint32/10, uint32/10, string(0-256), uint16, uint16, uint32/10, uint32/10, uint32/10, uint32, OSInfo, CPUSpeed, uint16, uint16, string(0-256)) airecv clsend; setCpuInfo(string(0-1024), string) airecv clsend; checkForGarbageLeaks(bool) airecv clsend; @@ -545,4 +545,3 @@ dclass AstronLoginManager : DistributedObject { requestRemoveAvatar(uint32) clsend; requestPlayAvatar(uint32) clsend; }; - diff --git a/otp/ai/TimeManagerAI.py b/otp/ai/TimeManagerAI.py index cc9f258..9c876cb 100644 --- a/otp/ai/TimeManagerAI.py +++ b/otp/ai/TimeManagerAI.py @@ -1,5 +1,17 @@ from direct.directnotify import DirectNotifyGlobal from direct.distributed.DistributedObjectAI import DistributedObjectAI +from direct.distributed.ClockDelta import globalClockDelta +import time class TimeManagerAI(DistributedObjectAI): notify = DirectNotifyGlobal.directNotify.newCategory('TimeManagerAI') + + def requestServerTime(self, context): + avId = self.air.getAvatarIdFromSender() + if not avId: + return + + self.sendUpdateToAvatarId(avId, 'serverTime', [context, globalClockDelta.getRealNetworkTime(bits=32), int(time.time())]) + + def setSignature(self, todo0, todo1, todo2): + pass diff --git a/toontown/ai/HolidayManagerAI.py b/toontown/ai/HolidayManagerAI.py index 8f4d17f..78df7bd 100644 --- a/toontown/ai/HolidayManagerAI.py +++ b/toontown/ai/HolidayManagerAI.py @@ -2,3 +2,6 @@ class HolidayManagerAI: def __init__(self, air): self.air = air self.currentHolidays = {} + + def isHolidayRunning(self, holidayId): + return False # NO diff --git a/toontown/ai/ToontownAIRepository.py b/toontown/ai/ToontownAIRepository.py index a1e7b31..b46e8bb 100644 --- a/toontown/ai/ToontownAIRepository.py +++ b/toontown/ai/ToontownAIRepository.py @@ -1,6 +1,7 @@ from libtoontown import * from direct.directnotify import DirectNotifyGlobal from otp.ai.AIZoneData import AIZoneDataStore +from otp.ai.TimeManagerAI import TimeManagerAI from otp.distributed.OtpDoGlobals import * from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository from toontown.distributed.ToontownDistrictAI import ToontownDistrictAI @@ -13,6 +14,7 @@ from toontown.hood.TTHoodDataAI import TTHoodDataAI from toontown.hood import ZoneUtil from toontown.pets.PetManagerAI import PetManagerAI from toontown.suit.SuitInvasionManagerAI import SuitInvasionManagerAI +from toontown.toon import NPCToons from toontown.uberdog.DistributedInGameNewsMgrAI import DistributedInGameNewsMgrAI from toontown.toonbase import ToontownGlobals @@ -31,6 +33,7 @@ class ToontownAIRepository(ToontownInternalRepository): self.zoneDataStore = None self.petMgr = None self.suitInvasionManager = None + self.timeManager = None self.newsManager = None self.inGameNewsMgr = None self.catalogManager = None @@ -95,6 +98,10 @@ class ToontownAIRepository(ToontownInternalRepository): self.districtStats.generateWithRequiredAndId(self.allocateChannel(), self.district.getDoId(), OTP_ZONE_ID_DISTRICTS_STATS) + # Generate our time manager... + self.timeManager = TimeManagerAI(self) + self.timeManager.generateWithRequired(OTP_ZONE_ID_MANAGEMENT) + # Generate our news manager... self.newsManager = NewsManagerAI(self) self.newsManager.generateWithRequired(OTP_ZONE_ID_MANAGEMENT) @@ -126,6 +133,9 @@ class ToontownAIRepository(ToontownInternalRepository): self.hoods.append(hood) def createZones(self): + # First, generate our zone2NpcDict... + NPCToons.generateZone2NpcDict() + # Toontown Central self.zoneTable[ToontownGlobals.ToontownCentral] = ( (ToontownGlobals.ToontownCentral, 1, 0), (ToontownGlobals.SillyStreet, 1, 1), diff --git a/toontown/toon/DistributedNPCToonBase.py b/toontown/toon/DistributedNPCToonBase.py index 3c82b28..a9b5ea1 100644 --- a/toontown/toon/DistributedNPCToonBase.py +++ b/toontown/toon/DistributedNPCToonBase.py @@ -1,4 +1,5 @@ from pandac.PandaModules import * +from libotp import * from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM from direct.fsm import State