mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 11:42:39 -06:00
parent
f445474b33
commit
c823ff41e6
8 changed files with 89 additions and 3 deletions
|
@ -14,6 +14,7 @@ from otp.friends import GuildManager/AI/UD
|
|||
from otp.friends import FriendInfo
|
||||
from otp.friends import AvatarFriendInfo
|
||||
from otp.distributed import DistributedDistrict/AI/UD
|
||||
from otp.distributed import DistributedDirectory/AI
|
||||
from otp.chat import ChatAgent/UD
|
||||
from otp.avatar import AvatarHandle
|
||||
|
||||
|
@ -86,6 +87,10 @@ dclass TimeManager : DistributedObject {
|
|||
checkAvOnDistrictResult(uint32 context, DoId av, bool isOnDistrict);
|
||||
};
|
||||
|
||||
dclass DistributedDirectory : DistributedObject {
|
||||
setParentingRules(string, string) broadcast ram;
|
||||
};
|
||||
|
||||
dclass DistributedDistrict : DistributedObject {
|
||||
setName(string) required broadcast ram;
|
||||
setAvailable(uint8) required broadcast ram;
|
||||
|
|
|
@ -7,13 +7,15 @@ from otp.ai.MagicWordGlobal import *
|
|||
from otp.avatar import DistributedAvatarAI
|
||||
from otp.avatar import PlayerBase
|
||||
from otp.distributed import OtpDoGlobals
|
||||
from otp.distributed.ClsendTracker import ClsendTracker
|
||||
from otp.otpbase import OTPLocalizer
|
||||
|
||||
|
||||
class DistributedPlayerAI(DistributedAvatarAI.DistributedAvatarAI, PlayerBase.PlayerBase):
|
||||
class DistributedPlayerAI(DistributedAvatarAI.DistributedAvatarAI, PlayerBase.PlayerBase, ClsendTracker):
|
||||
def __init__(self, air):
|
||||
DistributedAvatarAI.DistributedAvatarAI.__init__(self, air)
|
||||
PlayerBase.PlayerBase.__init__(self)
|
||||
ClsendTracker.__init__(self)
|
||||
self.friendsList = []
|
||||
self.DISLname = ''
|
||||
self.DISLid = 0
|
||||
|
@ -27,6 +29,7 @@ class DistributedPlayerAI(DistributedAvatarAI.DistributedAvatarAI, PlayerBase.Pl
|
|||
|
||||
def announceGenerate(self):
|
||||
DistributedAvatarAI.DistributedAvatarAI.announceGenerate(self)
|
||||
ClsendTracker.announceGenerate(self)
|
||||
self._doPlayerEnter()
|
||||
|
||||
def _announceArrival(self):
|
||||
|
@ -44,6 +47,7 @@ class DistributedPlayerAI(DistributedAvatarAI.DistributedAvatarAI, PlayerBase.Pl
|
|||
if __dev__:
|
||||
del self._sentExitServerEvent
|
||||
self._doPlayerExit()
|
||||
ClsendTracker.destroy(self)
|
||||
if __dev__:
|
||||
GarbageReport.checkForGarbageLeaks()
|
||||
DistributedAvatarAI.DistributedAvatarAI.delete(self)
|
||||
|
|
58
otp/distributed/ClsendTracker.py
Normal file
58
otp/distributed/ClsendTracker.py
Normal file
|
@ -0,0 +1,58 @@
|
|||
from pandac.PandaModules import StringStream
|
||||
from direct.distributed.PyDatagram import PyDatagram
|
||||
import random
|
||||
|
||||
class ClsendTracker:
|
||||
clsendNotify = directNotify.newCategory('clsend')
|
||||
NumTrackersLoggingOverflow = 0
|
||||
MaxTrackersLoggingOverflow = config.GetInt('max-clsend-loggers', 5)
|
||||
|
||||
def __init__(self):
|
||||
self._logClsendOverflow = False
|
||||
if self.isPlayerControlled():
|
||||
if simbase.air.getTrackClsends():
|
||||
if ClsendTracker.NumTrackersLoggingOverflow < ClsendTracker.MaxTrackersLoggingOverflow:
|
||||
self._logClsendOverflow = random.random() < 1.0 / config.GetFloat('clsend-log-one-av-in-every', choice(__dev__, 4, 50))
|
||||
if self._logClsendOverflow:
|
||||
ClsendTracker.NumTrackersLoggingOverflow += 1
|
||||
self._clsendMsgs = []
|
||||
self._clsendBufLimit = 100
|
||||
self._clsendFlushNum = 20
|
||||
self._clsendCounter = 0
|
||||
|
||||
def announceGenerate(self):
|
||||
if self._logClsendOverflow:
|
||||
self.clsendNotify.info('logging all clsends for %s' % self.doId)
|
||||
|
||||
def destroy(self):
|
||||
if self._logClsendOverflow:
|
||||
ClsendTracker.NumTrackersLoggingOverflow -= 1
|
||||
|
||||
def trackClientSendMsg(self, dataStr):
|
||||
self._clsendMsgs.append((self.air.getAvatarIdFromSender(), dataStr))
|
||||
if len(self._clsendMsgs) >= self._clsendBufLimit:
|
||||
self._trimClsend()
|
||||
|
||||
def _trimClsend(self):
|
||||
for i in xrange(self._clsendFlushNum):
|
||||
if self._logClsendOverflow:
|
||||
self._logClsend(*self._clsendMsgs[0])
|
||||
self._clsendMsgs = self._clsendMsgs[1:]
|
||||
self._clsendCounter += 1
|
||||
|
||||
def _logClsend(self, senderId, dataStr):
|
||||
msgStream = StringStream()
|
||||
simbase.air.describeMessage(msgStream, '', dataStr)
|
||||
readableStr = msgStream.getData()
|
||||
sstream = StringStream()
|
||||
PyDatagram(dataStr).dumpHex(sstream)
|
||||
hexDump = sstream.getData()
|
||||
self.clsendNotify.info('%s [%s]: %s%s' % (self.doId,
|
||||
self._clsendCounter,
|
||||
readableStr,
|
||||
hexDump))
|
||||
|
||||
def dumpClientSentMsgs(self):
|
||||
for msg in self._clsendMsgs:
|
||||
self._logClsend(*msg)
|
||||
self._clsendCounter += 1
|
|
@ -2,7 +2,7 @@
|
|||
from pandac.PandaModules import *
|
||||
|
||||
|
||||
hashVal = 849017532
|
||||
hashVal = 3611798738L
|
||||
|
||||
|
||||
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.friends.TrueFriendsMgr import TrueFriendsMgr
|
|||
from toontown.coghq.InGameEditorDCImports import *
|
||||
from toontown.friends import TTPlayerFriendsManager, TTUFriendsManager
|
||||
from toontown.cogdominium import DistributedCogdoInterior, DistributedCogdoBattleBldg, DistributedCogdoElevatorExt, DistributedCogdoElevatorInt, DistributedCogdoBarrel, DistCogdoGame, DistCogdoLevelGame, DistCogdoBoardroomGame, DistCogdoCraneGame, DistCogdoMazeGame, DistCogdoFlyingGame, DistCogdoCrane, DistCogdoCraneMoneyBag, DistCogdoCraneCog
|
||||
from otp.distributed import Account, DistributedDistrict
|
||||
from otp.distributed import Account, DistributedDistrict, DistributedDirectory
|
||||
from toontown.estate import DistributedCannon, DistributedTarget, EstateManager, DistributedEstate, DistributedHouse, DistributedHouseInterior, DistributedGarden, DistributedHouseDoor, DistributedMailbox, DistributedFurnitureManager, DistributedFurnitureItem, DistributedBank, DistributedCloset, DistributedTrunk, DistributedPhone, DistributedFireworksCannon, DistributedLawnDecor, DistributedGardenPlot, DistributedGardenBox, DistributedFlower, DistributedGagTree, DistributedStatuary, DistributedToonStatuary, DistributedChangingStatuary, DistributedAnimatedStatuary, DistributedPlantBase, DistributedLawnDecor
|
||||
from toontown.toon import DistributedToon, DistributedNPCToonBase, DistributedNPCToon, DistributedSmartNPC, DistributedSmartNPC, DistributedNPCSpecialQuestGiver, DistributedNPCFlippyInToonHall, DistributedNPCScientist, DistributedNPCClerk, DistributedNPCTailor, DistributedNPCBlocker, DistributedNPCFisherman, DistributedNPCPartyPerson, DistributedNPCPetclerk, DistributedNPCKartClerk, DistributedNPCGlove
|
||||
from toontown.tutorial import DistributedBattleTutorial, TutorialManager
|
||||
|
|
4
otp/distributed/DistributedDirectory.py
Normal file
4
otp/distributed/DistributedDirectory.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
from direct.distributed.DistributedObject import DistributedObject
|
||||
|
||||
class DistributedDirectory(DistributedObject):
|
||||
pass
|
9
otp/distributed/DistributedDirectoryAI.py
Normal file
9
otp/distributed/DistributedDirectoryAI.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||
|
||||
class DistributedDirectoryAI(DistributedObjectAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedDirectoryAI")
|
||||
|
||||
def setParentingRules(self, todo0, todo1):
|
||||
pass
|
||||
|
|
@ -940,6 +940,7 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
'meta-h',
|
||||
'meta-h-repeat',
|
||||
'control-f9',
|
||||
'newDistributedDirectory',
|
||||
'page_down',
|
||||
'page_up',
|
||||
'panda3d-render-error',
|
||||
|
@ -952,6 +953,7 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
'window-event',
|
||||
'TCRSetZoneDone',
|
||||
'aspectRatioChanged',
|
||||
'newDistributedDirectory',
|
||||
CConnectionRepository.getOverflowEventName(),
|
||||
self._getLostConnectionEvent(),
|
||||
'render-texture-targets-changed',
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from direct.distributed.PyDatagram import *
|
||||
import urlparse
|
||||
|
||||
from otp.distributed.DistributedDirectoryAI import DistributedDirectoryAI
|
||||
from otp.distributed.OtpDoGlobals import *
|
||||
from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository
|
||||
import toontown.minigame.MinigameCreatorAI
|
||||
|
@ -31,6 +32,9 @@ class ToontownUberRepository(ToontownInternalRepository):
|
|||
self.notify.setInfo(True)
|
||||
|
||||
def handleConnected(self):
|
||||
rootObj = DistributedDirectoryAI(self)
|
||||
rootObj.generateWithRequiredAndId(self.getGameDoId(), 0, 0)
|
||||
|
||||
if config.GetBool('want-rpc-server', False):
|
||||
endpoint = config.GetString('rpc-server-endpoint', 'http://localhost:8080/')
|
||||
self.rpcServer = ToontownRPCServer(endpoint, ToontownRPCHandler(self))
|
||||
|
|
Loading…
Reference in a new issue