general: More fixes
This commit is contained in:
parent
31286a2962
commit
6ba9b959c9
|
|
@ -432,7 +432,7 @@ class WelcomeValleyManagerAI(DistributedObjectAI.DistributedObjectAI):
|
|||
assert((hoodId % 2000) == 0)
|
||||
|
||||
del self.welcomeValleys[hoodId]
|
||||
self.welcomeValleyAllocator.free(hoodId / 2000)
|
||||
self.welcomeValleyAllocator.free(hoodId // 2000)
|
||||
self.air.shutdownHood(hood[0])
|
||||
self.air.shutdownHood(hood[1])
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,9 @@ class QuietZoneState(StateData.StateData):
|
|||
return
|
||||
|
||||
def handleWaitForQuietZoneResponse(self, msgType, di):
|
||||
self.notify.debug('handleWaitForQuietZoneResponse(' + 'msgType=' + str(msgType) + ', di=' + str(di) + ')')
|
||||
self.notify.debug('handleWaitForQuietZoneResponse(' + 'msgType=' + str(msgType) + ')')
|
||||
if self.notify.getDebug():
|
||||
di.getDatagram().dumpHex(Notify.out())
|
||||
if msgType == CLIENT_CREATE_OBJECT_REQUIRED:
|
||||
base.cr.handleQuietZoneGenerateWithRequired(di)
|
||||
elif msgType == CLIENT_CREATE_OBJECT_REQUIRED_OTHER:
|
||||
|
|
@ -152,7 +154,9 @@ class QuietZoneState(StateData.StateData):
|
|||
base.cr.handlePlayGame(msgType, di)
|
||||
|
||||
def handleWaitForZoneRedirect(self, msgType, di):
|
||||
self.notify.debug('handleWaitForZoneRedirect(' + 'msgType=' + str(msgType) + ', di=' + str(di) + ')')
|
||||
self.notify.debug('handleWaitForZoneRedirect(' + 'msgType=' + str(msgType) + ')')
|
||||
if self.notify.getDebug():
|
||||
di.getDatagram().dumpHex(Notify.out())
|
||||
if msgType == CLIENT_CREATE_OBJECT_REQUIRED:
|
||||
base.cr.handleQuietZoneGenerateWithRequired(di)
|
||||
elif msgType == CLIENT_CREATE_OBJECT_REQUIRED_OTHER:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,92 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
import socket
|
||||
import datetime
|
||||
import os
|
||||
from direct.distributed.DistributedObjectGlobal import DistributedObjectGlobal
|
||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||
from otp.distributed import OtpDoGlobals
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.uberdog import InGameNewsResponses
|
||||
|
||||
class DistributedCpuInfoMgrAI(DistributedObjectAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCpuInfoMgrAI')
|
||||
ParentClass = DistributedObjectAI
|
||||
#ParentClass = DistributedObjectGlobal
|
||||
class DistributedCpuInfoMgrAI(ParentClass ):
|
||||
"""
|
||||
Uberdog object that keeps track of the last time in game news has been updated
|
||||
"""
|
||||
notify = directNotify.newCategory('DistributedInGameNewsMgrAI')
|
||||
|
||||
|
||||
def __init__(self, cr):
|
||||
"""Construct ourselves, set up web dispatcher."""
|
||||
assert self.notify.debugCall()
|
||||
ParentClass.__init__(self, cr)
|
||||
self.latestIssueStr = ""
|
||||
self.avId2Fingerprint = {}
|
||||
self.accept("avatarEntered", self.handleAvatarEntered)
|
||||
|
||||
def generate(self):
|
||||
"""We have zone info but not required fields, register for the special."""
|
||||
# IN_GAME_NEWS_MGR_UD_TO_ALL_AI will arrive on this channel
|
||||
self.air.registerForChannel(OtpDoGlobals.OTP_DO_ID_TOONTOWN_CPU_INFO_MANAGER)
|
||||
ParentClass.generate(self)
|
||||
|
||||
def announceGenerate(self):
|
||||
# tell uberdog we are starting up, so we can get info on the currently running public parties
|
||||
# do whatever other sanity checks is necessary here
|
||||
DistributedObjectAI.announceGenerate(self)
|
||||
#self.air.sendUpdateToDoId("DistributedInGameNewsMgr",
|
||||
# 'inGameNewsMgrAIStartingUp',
|
||||
# OtpDoGlobals.OTP_DO_ID_TOONTOWN_CPU_INFO_MANAGER,
|
||||
# [self.doId, self.air.districtId]
|
||||
#)
|
||||
def setLatestIssueStr(self, issueStr):
|
||||
"""We normally get this once, we could get this when a new issue is released while logged in."""
|
||||
# we receive this as a utc str
|
||||
assert self.notify.debugStateCall(self)
|
||||
self.latestIssueStr = issueStr
|
||||
pass
|
||||
|
||||
def b_setLatestIssueStr(self, latestIssue):
|
||||
self.setLatestIssueStr(latestIssue)
|
||||
self.d_setLatestIssueStr(latestIssue)
|
||||
|
||||
def d_setLatestIssueStr(self, latestIssue):
|
||||
self.sendUpdate("setLatestIssueStr",[self.getLatestIssueStr()])
|
||||
|
||||
|
||||
def getLatestIssueStr(self):
|
||||
"""We normally get this once, we could get this when a new issue is released while logged in."""
|
||||
assert self.notify.debugStateCall(self)
|
||||
return self.latestIssueStr
|
||||
pass
|
||||
|
||||
|
||||
def newIssueUDtoAI(self, issueStr):
|
||||
"""Well the UD is telling us we have a new issue, spread it to the clients."""
|
||||
self.b_setLatestIssueStr(issueStr)
|
||||
|
||||
def sendCpuInfoToUd(self, info, fingerprint):
|
||||
"""Prepare to send the info to the UD, we don't have the DISLid yet."""
|
||||
requesterId = self.air.getAvatarIdFromSender()
|
||||
self.avId2Fingerprint[requesterId] = (info,fingerprint)
|
||||
|
||||
def handleAvatarEntered(self, avatar):
|
||||
"""Send the cpu info to the UD once we get the avatar and the DISL id."""
|
||||
if avatar.doId in self.avId2Fingerprint:
|
||||
info, fingerprint = self.avId2Fingerprint.get(avatar.doId)
|
||||
dislId = 0
|
||||
if avatar:
|
||||
try:
|
||||
dislId = avatar.DISLid
|
||||
except:
|
||||
pass
|
||||
if dislId:
|
||||
self.air.sendUpdateToDoId("DistributedCpuInfoMgr",
|
||||
'setCpuInfoToUd',
|
||||
OtpDoGlobals.OTP_DO_ID_TOONTOWN_CPU_INFO_MANAGER,
|
||||
[avatar.doId, dislId, info[:255],fingerprint[:255]]
|
||||
)
|
||||
else:
|
||||
self.notify.warning("avId=%s has dislId=%s" % (avatar.doId, dislId))
|
||||
del self.avId2Fingerprint[avatar.doId]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.distributed.DistributedObjectUD import DistributedObjectUD
|
||||
from direct.distributed.DistributedObjectGlobalUD import DistributedObjectGlobalUD
|
||||
|
||||
class DistributedCpuInfoMgrUD(DistributedObjectUD):
|
||||
class DistributedCpuInfoMgrUD(DistributedObjectGlobalUD):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCpuInfoMgrUD')
|
||||
|
|
|
|||
Loading…
Reference in New Issue