general: TTC progress

This commit is contained in:
Open Toontown 2019-11-22 20:58:35 -05:00
parent b9c206a8d9
commit 758024347a
14 changed files with 119 additions and 2 deletions

View file

@ -18,3 +18,7 @@ class OTPInternalRepository(AstronInternalRepository):
def getAvatarIdFromSender(self):
return self.getMsgSender() & 0xFFFFFFFF
def sendSetZone(self, distObj, zoneId):
distObj.setLocation(distObj.parentId, zoneId)
self.sendSetLocation(distObj, distObj.parentId, zoneId)

View file

@ -1,3 +1,4 @@
from libtoontown import *
from direct.directnotify import DirectNotifyGlobal
from otp.ai.AIZoneData import AIZoneDataStore
from otp.distributed.OtpDoGlobals import *
@ -6,8 +7,14 @@ from toontown.distributed.ToontownDistrictAI import ToontownDistrictAI
from toontown.distributed.ToontownDistrictStatsAI import ToontownDistrictStatsAI
from toontown.ai.HolidayManagerAI import HolidayManagerAI
from toontown.ai.NewsManagerAI import NewsManagerAI
from toontown.building.DistributedTrophyMgrAI import DistributedTrophyMgrAI
from toontown.catalog.CatalogManagerAI import CatalogManagerAI
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.uberdog.DistributedInGameNewsMgrAI import DistributedInGameNewsMgrAI
from toontown.toonbase import ToontownGlobals
class ToontownAIRepository(ToontownInternalRepository):
notify = DirectNotifyGlobal.directNotify.newCategory('ToontownAIRepository')
@ -16,14 +23,24 @@ class ToontownAIRepository(ToontownInternalRepository):
ToontownInternalRepository.__init__(self, baseChannel, serverId, dcSuffix='AI')
self.districtName = districtName
self.doLiveUpdates = config.GetBool('want-live-updates', True)
self.wantCogdominiums = config.GetBool('want-cogdominiums', True)
self.districtId = None
self.district = None
self.districtStats = None
self.holidayManager = None
self.zoneDataStore = None
self.petMgr = None
self.suitInvasionManager = None
self.newsManager = None
self.inGameNewsMgr = None
self.catalogManager = None
self.trophyMgr = None
self.zoneTable = {}
self.dnaStoreMap = {}
self.dnaDataMap = {}
self.hoods = []
self.buildingManagers = {}
self.suitPlanners = {}
def handleConnected(self):
ToontownInternalRepository.handleConnected(self)
@ -43,6 +60,9 @@ class ToontownAIRepository(ToontownInternalRepository):
# Create our global objects.
self.createGlobals()
# Create our zones.
self.createZones()
# Make our district available, and we're done.
self.district.b_setAvailable(True)
self.notify.info('Done.')
@ -58,6 +78,12 @@ class ToontownAIRepository(ToontownInternalRepository):
# Create our zone data store...
self.zoneDataStore = AIZoneDataStore()
# Create our pet manager...
self.petMgr = PetManagerAI(self)
# Create our suit invasion manager...
self.suitInvasionManager = SuitInvasionManagerAI(self)
def createGlobals(self):
"""
Creates "global" (distributed) objects.
@ -81,6 +107,53 @@ class ToontownAIRepository(ToontownInternalRepository):
self.catalogManager = CatalogManagerAI(self)
self.catalogManager.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
# Generate our trophy manager...
self.trophyMgr = DistributedTrophyMgrAI(self)
self.trophyMgr.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
def generateHood(self, hoodConstructor, zoneId):
# Bossbot HQ doesn't use DNA, so we skip over that.
if zoneId != ToontownGlobals.BossbotHQ:
self.dnaStoreMap[zoneId] = DNAStorage()
self.dnaDataMap[zoneId] = loadDNAFileAI(self.dnaStoreMap[zoneId], self.genDNAFileName(zoneId))
if zoneId in ToontownGlobals.HoodHierarchy:
for streetId in ToontownGlobals.HoodHierarchy[zoneId]:
self.dnaStoreMap[streetId] = DNAStorage()
self.dnaDataMap[streetId] = loadDNAFileAI(self.dnaStoreMap[streetId], self.genDNAFileName(streetId))
hood = hoodConstructor(self, zoneId)
hood.startup()
self.hoods.append(hood)
def createZones(self):
# Toontown Central
self.zoneTable[ToontownGlobals.ToontownCentral] = (
(ToontownGlobals.ToontownCentral, 1, 0), (ToontownGlobals.SillyStreet, 1, 1),
(ToontownGlobals.LoopyLane, 1, 1), (ToontownGlobals.PunchlinePlace, 1, 1)
)
self.generateHood(TTHoodDataAI, ToontownGlobals.ToontownCentral)
def genDNAFileName(self, zoneId):
canonicalZoneId = ZoneUtil.getCanonicalZoneId(zoneId)
canonicalHoodId = ZoneUtil.getCanonicalHoodId(canonicalZoneId)
hood = ToontownGlobals.dnaMap[canonicalHoodId]
if canonicalHoodId == canonicalZoneId:
canonicalZoneId = 'sz'
phase = ToontownGlobals.phaseMap[canonicalHoodId]
else:
phase = ToontownGlobals.streetPhaseMap[canonicalHoodId]
return 'phase_%s/dna/%s_%s.dna' % (phase, hood, canonicalZoneId)
def loadDNAFileAI(self, dnaStore, dnaFileName):
return loadDNAFileAI(dnaStore, dnaFileName)
def findFishingPonds(self, dnaData, zoneId, area):
return [], [] # TODO
def findPartyHats(self, dnaData, zoneId):
return [] # TODO
def getTrackClsends(self):
return False

View file

@ -3,3 +3,12 @@ from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedTrophyMgrAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedTrophyMgrAI')
def requestTrophyScore(self):
pass
def getLeaderInfo(self):
return [], [], []
def addTrophy(self, *args, **kwargs):
pass

View file

@ -1,5 +1,6 @@
from otp.avatar import Avatar
from pandac.PandaModules import *
from libotp import *
from direct.task import Task
import random
from pandac.PandaModules import *

View file

@ -1,4 +1,5 @@
from pandac.PandaModules import *
from libotp import *
from direct.interval.IntervalGlobal import *
from otp.avatar import Avatar
from libotp import CFQuicktalker

View file

@ -5,6 +5,7 @@ from toontown.suit import DistributedSuitPlannerAI
from toontown.safezone import ButterflyGlobals
from toontown.safezone import DistributedButterflyAI
from pandac.PandaModules import *
from libtoontown import *
from toontown.toon import NPCToons
class HoodDataAI:

View file

@ -0,0 +1,10 @@
from direct.directnotify import DirectNotifyGlobal
class PetManagerAI:
notify = DirectNotifyGlobal.directNotify.newCategory('PetManagerAI')
def __init__(self, air):
self.air = air
def getAvailablePets(self, *args, **kwargs):
return []

View file

@ -1,5 +1,6 @@
from otp.ai.AIBaseGlobal import *
from pandac.PandaModules import *
from libtoontown import *
from direct.distributed.ClockDelta import *
from otp.avatar import DistributedAvatarAI
import SuitTimings

View file

@ -1,3 +1,4 @@
from libtoontown import *
from otp.ai.AIBaseGlobal import *
from direct.distributed import DistributedObjectAI
import SuitPlannerBase, DistributedSuitAI

View file

@ -1,4 +1,5 @@
from pandac.PandaModules import *
from libtoontown import *
from direct.distributed.ClockDelta import *
import math
import random

View file

@ -0,0 +1,13 @@
from direct.directnotify import DirectNotifyGlobal
class SuitInvasionManagerAI:
notify = DirectNotifyGlobal.directNotify.newCategory('SuitInvasionManagerAI')
def __init__(self, air):
self.air = air
def getInvadingCog(self):
return None, 0
def getInvading(self):
return False

View file

@ -1,4 +1,5 @@
from pandac.PandaModules import *
from libtoontown import *
import random
import string
from direct.directnotify import DirectNotifyGlobal
@ -520,7 +521,7 @@ class SuitPlannerBase:
self.setupDNA()
def extractGroupName(self, groupFullName):
return string.split(groupFullName, ':', 1)[0]
return str(groupFullName).split(':', 1)[0]
def initDNAInfo(self):
numGraphs = self.dnaStore.discoverContinuity()

View file

@ -410,7 +410,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
def announceZoneChange(self, newZoneId, oldZoneId):
from toontown.pets import PetObserve
self.air.welcomeValleyManager.toonSetZone(self.doId, newZoneId)
#self.air.welcomeValleyManager.toonSetZone(self.doId, newZoneId)
broadcastZones = [oldZoneId, newZoneId]
if self.isInEstate() or self.wasInEstate():
broadcastZones = union(broadcastZones, self.estateZones)

View file

@ -6,6 +6,7 @@ from otp.otpbase import OTPLocalizer
import types
from direct.showbase import PythonUtil
from pandac.PandaModules import *
from libotp import *
from otp.avatar import Emote
from direct.directnotify import DirectNotifyGlobal
EmoteSleepIndex = 4