diff --git a/README.md b/README.md index 0561bc9f..6cffd5ad 100644 --- a/README.md +++ b/README.md @@ -13,4 +13,10 @@ Since Toontown Stride was originally meant to be a community-based server, we de ##Is this version safe? Feel free to scan yourself and give us feedback on your findings! -##Credit goes to Mr. Batty and Alexalexer for this build of the source. +##A lot of this code looks stolen, why is this? +When Stride started, it was started by a team of hackers that decided it would be fun to take code from Toontown Rewritten, Toontown Infinite, and Toontown House with the claim of new features and community-based tweaks in order to reel people in- the plan was to get people to join Toontown Stride and plant a honeypot within the game and/or launcher. This build is guaranteed to be virus-free and is safe to use amongst anyone out there willing to try this version of Stride, as it's no different then the current version that's out there. The features this version DOESNT have are: +*The rushed Paint Shop* +*The new pick a room screen* +*a few deletions of important code that cause the current build to be unstable to release* + +###Credit goes to Mr. Batty and Alexalexer for this build of the source. diff --git a/toontown/ai/AIZoneData.py b/toontown/ai/AIZoneData.py new file mode 100644 index 00000000..560ab7fb --- /dev/null +++ b/toontown/ai/AIZoneData.py @@ -0,0 +1,209 @@ +from panda3d.core import * +from direct.distributed import ParentMgr +from direct.directnotify.DirectNotifyGlobal import directNotify +from direct.task import Task +from src.otp.otpbase import OTPGlobals +import random + +class AIZoneData: + notify = directNotify.newCategory('AIZoneData') + + def __init__(self, air, parentId, zoneId): + self._air = air + self._parentId = parentId + self._zoneId = zoneId + self._data = self._air.getZoneDataStore().getDataForZone(self._parentId, self._zoneId) + + def destroy(self): + del self._data + self._air.getZoneDataStore().releaseDataForZone(self._parentId, self._zoneId) + del self._zoneId + del self._parentId + del self._air + + def __getattr__(self, attr): + return getattr(self._data, attr) + + +class AIZoneDataObj: + notify = directNotify.newCategory('AIZoneDataObj') + DefaultCTravName = 'default' + + def __init__(self, parentId, zoneId): + self._parentId = parentId + self._zoneId = zoneId + self._refCount = 0 + self._collTravs = {} + self._collTravsStarted = set() + + def __str__(self): + output = str(self._collTravs) + output += '\n' + totalColliders = 0 + totalTraversers = 0 + for currCollTrav in self._collTravs.values(): + totalTraversers += 1 + totalColliders += currCollTrav.getNumColliders() + + output += 'Num traversers: %s Num total colliders: %s' % (totalTraversers, totalColliders) + return output + + def _incRefCount(self): + self._refCount += 1 + + def _decRefCount(self): + self._refCount -= 1 + + def _getRefCount(self): + return self._refCount + + def destroy(self): + for name in list(self._collTravsStarted): + self.stopCollTrav(cTravName=name) + + del self._collTravsStarted + del self._collTravs + if hasattr(self, '_nonCollidableParent'): + self._nonCollidableParent.removeNode() + del self._nonCollidableParent + if hasattr(self, '_render'): + self._render.removeNode() + del self._render + if hasattr(self, '_parentMgr'): + self._parentMgr.destroy() + del self._parentMgr + del self._zoneId + del self._parentId + + def getLocation(self): + return (self._parentId, self._zoneId) + + def getRender(self): + if not hasattr(self, '_render'): + self._render = NodePath('render-%s-%s' % (self._parentId, self._zoneId)) + return self._render + + def getNonCollidableParent(self): + if not hasattr(self, '_nonCollidableParent'): + render = self.getRender() + self._nonCollidableParent = render.attachNewNode('nonCollidables') + return self._nonCollidableParent + + def getParentMgr(self): + if not hasattr(self, '_parentMgr'): + self._parentMgr = ParentMgr.ParentMgr() + self._parentMgr.registerParent(OTPGlobals.SPHidden, hidden) + self._parentMgr.registerParent(OTPGlobals.SPRender, self.getRender()) + return self._parentMgr + + def hasCollTrav(self, name = None): + if name is None: + name = AIZoneDataObj.DefaultCTravName + return name in self._collTravs + + def getCollTrav(self, name = None): + if name is None: + name = AIZoneDataObj.DefaultCTravName + if name not in self._collTravs: + self._collTravs[name] = CollisionTraverser('cTrav-%s-%s-%s' % (name, self._parentId, self._zoneId)) + return self._collTravs[name] + + def removeCollTrav(self, name): + if name in self._collTravs: + del self._collTravs[name] + + def _getCTravTaskName(self, name = None): + if name is None: + name = AIZoneDataObj.DefaultCTravName + return 'collTrav-%s-%s-%s' % (name, self._parentId, self._zoneId) + + def _doCollisions(self, task = None, topNode = None, cTravName = None): + render = self.getRender() + curTime = globalClock.getFrameTime() + render.setTag('lastTraverseTime', str(curTime)) + if topNode is not None: + if not render.isAncestorOf(topNode): + self.notify.warning('invalid topNode for collision traversal in %s: %s' % (self.getLocation(), topNode)) + else: + topNode = render + if cTravName is None: + cTravName = AIZoneDataObj.DefaultCTravName + collTrav = self._collTravs[cTravName] + messenger.send('preColl-' + collTrav.getName()) + collTrav.traverse(topNode) + messenger.send('postColl-' + collTrav.getName()) + return Task.cont + + def doCollTrav(self, topNode = None, cTravName = None): + self.getCollTrav(cTravName) + self._doCollisions(topNode=topNode, cTravName=cTravName) + + def startCollTrav(self, respectPrevTransform = 1, cTravName = None): + if cTravName is None: + cTravName = AIZoneDataObj.DefaultCTravName + if cTravName not in self._collTravsStarted: + self.getCollTrav(name=cTravName) + taskMgr.add(self._doCollisions, self._getCTravTaskName(name=cTravName), priority=OTPGlobals.AICollisionPriority, extraArgs=[self._zoneId]) + self._collTravsStarted.add(cTravName) + self.setRespectPrevTransform(respectPrevTransform, cTravName=cTravName) + return + + def stopCollTrav(self, cTravName = None): + if cTravName is None: + cTravName = AIZoneDataObj.DefaultCTravName + self.notify.debug('stopCollTrav(%s, %s, %s)' % (cTravName, self._parentId, self._zoneId)) + if cTravName in self._collTravsStarted: + self.notify.info('removing %s collision traversal for (%s, %s)' % (cTravName, self._parentId, self._zoneId)) + taskMgr.remove(self._getCTravTaskName(name=cTravName)) + self._collTravsStarted.remove(cTravName) + return + + def setRespectPrevTransform(self, flag, cTravName = None): + if cTravName is None: + cTravName = AIZoneDataObj.DefaultCTravName + self._collTravs[cTravName].setRespectPrevTransform(flag) + return + + def getRespectPrevTransform(self, cTravName = None): + if cTravName is None: + cTravName = AIZoneDataObj.DefaultCTravName + return self._collTravs[cTravName].getRespectPrevTransform() + + +class AIZoneDataStore: + notify = directNotify.newCategory('AIZoneDataStore') + + def __init__(self): + self._zone2data = {} + + def destroy(self): + for zone, data in self._zone2data.items(): + data.destroy() + + del self._zone2data + + def hasDataForZone(self, parentId, zoneId): + key = (parentId, zoneId) + return key in self._zone2data + + def getDataForZone(self, parentId, zoneId): + key = (parentId, zoneId) + if key not in self._zone2data: + self._zone2data[key] = AIZoneDataObj(parentId, zoneId) + self.printStats() + data = self._zone2data[key] + data._incRefCount() + return data + + def releaseDataForZone(self, parentId, zoneId): + key = (parentId, zoneId) + data = self._zone2data[key] + data._decRefCount() + refCount = data._getRefCount() + if refCount == 0: + del self._zone2data[key] + data.destroy() + self.printStats() + + def printStats(self): + self.notify.debug('%s zones have zone data allocated' % len(self._zone2data)) diff --git a/toontown/ai/AIZoneData.pyc b/toontown/ai/AIZoneData.pyc new file mode 100644 index 00000000..2f310aa1 Binary files /dev/null and b/toontown/ai/AIZoneData.pyc differ diff --git a/toontown/ai/CogPageManagerAI.pyc b/toontown/ai/CogPageManagerAI.pyc index 6cc41baf..ab0956aa 100644 Binary files a/toontown/ai/CogPageManagerAI.pyc and b/toontown/ai/CogPageManagerAI.pyc differ diff --git a/toontown/ai/CogSuitManagerAI.pyc b/toontown/ai/CogSuitManagerAI.pyc index e8745078..de9c6da1 100644 Binary files a/toontown/ai/CogSuitManagerAI.pyc and b/toontown/ai/CogSuitManagerAI.pyc differ diff --git a/toontown/ai/DistributedBlackCatMgr.pyc b/toontown/ai/DistributedBlackCatMgr.pyc index 20fc30f7..1c40a15c 100644 Binary files a/toontown/ai/DistributedBlackCatMgr.pyc and b/toontown/ai/DistributedBlackCatMgr.pyc differ diff --git a/toontown/ai/DistributedBlackCatMgrAI.pyc b/toontown/ai/DistributedBlackCatMgrAI.pyc index 7e799855..d4cc3220 100644 Binary files a/toontown/ai/DistributedBlackCatMgrAI.pyc and b/toontown/ai/DistributedBlackCatMgrAI.pyc differ diff --git a/toontown/ai/DistributedEffectMgr.pyc b/toontown/ai/DistributedEffectMgr.pyc index 6bc095b9..0abb8303 100644 Binary files a/toontown/ai/DistributedEffectMgr.pyc and b/toontown/ai/DistributedEffectMgr.pyc differ diff --git a/toontown/ai/DistributedEffectMgrAI.pyc b/toontown/ai/DistributedEffectMgrAI.pyc index e8429377..6884d2fb 100644 Binary files a/toontown/ai/DistributedEffectMgrAI.pyc and b/toontown/ai/DistributedEffectMgrAI.pyc differ diff --git a/toontown/ai/DistributedPolarPlaceEffectMgr.pyc b/toontown/ai/DistributedPolarPlaceEffectMgr.pyc index 7ffa211c..292a704f 100644 Binary files a/toontown/ai/DistributedPolarPlaceEffectMgr.pyc and b/toontown/ai/DistributedPolarPlaceEffectMgr.pyc differ diff --git a/toontown/ai/DistributedPolarPlaceEffectMgrAI.pyc b/toontown/ai/DistributedPolarPlaceEffectMgrAI.pyc index 41adf1f6..22ec1897 100644 Binary files a/toontown/ai/DistributedPolarPlaceEffectMgrAI.pyc and b/toontown/ai/DistributedPolarPlaceEffectMgrAI.pyc differ diff --git a/toontown/ai/DistributedReportMgr.pyc b/toontown/ai/DistributedReportMgr.pyc index b3f85b6f..38878785 100644 Binary files a/toontown/ai/DistributedReportMgr.pyc and b/toontown/ai/DistributedReportMgr.pyc differ diff --git a/toontown/ai/DistributedReportMgrAI.pyc b/toontown/ai/DistributedReportMgrAI.pyc index 1c11143b..de3c73a3 100644 Binary files a/toontown/ai/DistributedReportMgrAI.pyc and b/toontown/ai/DistributedReportMgrAI.pyc differ diff --git a/toontown/ai/DistributedResistanceEmoteMgr.pyc b/toontown/ai/DistributedResistanceEmoteMgr.pyc index b317dc56..7b1c8e49 100644 Binary files a/toontown/ai/DistributedResistanceEmoteMgr.pyc and b/toontown/ai/DistributedResistanceEmoteMgr.pyc differ diff --git a/toontown/ai/DistributedResistanceEmoteMgrAI.pyc b/toontown/ai/DistributedResistanceEmoteMgrAI.pyc index 9ab42f83..10569c0a 100644 Binary files a/toontown/ai/DistributedResistanceEmoteMgrAI.pyc and b/toontown/ai/DistributedResistanceEmoteMgrAI.pyc differ diff --git a/toontown/ai/FishManagerAI.pyc b/toontown/ai/FishManagerAI.pyc index 1129d9f3..9588f612 100644 Binary files a/toontown/ai/FishManagerAI.pyc and b/toontown/ai/FishManagerAI.pyc differ diff --git a/toontown/ai/HolidayGlobals.pyc b/toontown/ai/HolidayGlobals.pyc index 74fd980e..c7f41a3a 100644 Binary files a/toontown/ai/HolidayGlobals.pyc and b/toontown/ai/HolidayGlobals.pyc differ diff --git a/toontown/ai/NewsManager.pyc b/toontown/ai/NewsManager.pyc index c4985d4c..acd36504 100644 Binary files a/toontown/ai/NewsManager.pyc and b/toontown/ai/NewsManager.pyc differ diff --git a/toontown/ai/NewsManagerAI.pyc b/toontown/ai/NewsManagerAI.pyc index 36cf9472..8b82a525 100644 Binary files a/toontown/ai/NewsManagerAI.pyc and b/toontown/ai/NewsManagerAI.pyc differ diff --git a/toontown/ai/PromotionManagerAI.pyc b/toontown/ai/PromotionManagerAI.pyc index 45893ef1..0c4f1514 100644 Binary files a/toontown/ai/PromotionManagerAI.pyc and b/toontown/ai/PromotionManagerAI.pyc differ diff --git a/toontown/ai/QuestManagerAI.pyc b/toontown/ai/QuestManagerAI.pyc index 56426551..e68e9c62 100644 Binary files a/toontown/ai/QuestManagerAI.pyc and b/toontown/ai/QuestManagerAI.pyc differ diff --git a/toontown/ai/ReportGlobals.pyc b/toontown/ai/ReportGlobals.pyc index ad47ce73..3539b07e 100644 Binary files a/toontown/ai/ReportGlobals.pyc and b/toontown/ai/ReportGlobals.pyc differ diff --git a/toontown/ai/ToonBarrier.pyc b/toontown/ai/ToonBarrier.pyc index bda10392..43f29afa 100644 Binary files a/toontown/ai/ToonBarrier.pyc and b/toontown/ai/ToonBarrier.pyc differ diff --git a/toontown/ai/ToontownAIRepository.py b/toontown/ai/ToontownAIRepository.py index 958e3f1c..b65779c3 100644 --- a/toontown/ai/ToontownAIRepository.py +++ b/toontown/ai/ToontownAIRepository.py @@ -100,6 +100,8 @@ class ToontownAIRepository(ToontownInternalRepository): self.newsManager.generateWithRequired(2) self.safeZoneManager = SafeZoneManagerAI(self) self.safeZoneManager.generateWithRequired(2) + self.topToonsMgr = TopToonsManagerAI(self) + #self.topToonsMgr.generateWithRequired(2) self.tutorialManager = TutorialManagerAI(self) self.tutorialManager.generateWithRequired(2) self.friendManager = FriendManagerAI(self) diff --git a/toontown/ai/ToontownAIRepository.pyc b/toontown/ai/ToontownAIRepository.pyc index f2547239..978ec15e 100644 Binary files a/toontown/ai/ToontownAIRepository.pyc and b/toontown/ai/ToontownAIRepository.pyc differ diff --git a/toontown/ai/__init__.pyc b/toontown/ai/__init__.pyc index c4b95c7e..4bd3470c 100644 Binary files a/toontown/ai/__init__.pyc and b/toontown/ai/__init__.pyc differ