general: TTC progress
This commit is contained in:
parent
b9c206a8d9
commit
758024347a
14 changed files with 119 additions and 2 deletions
|
@ -18,3 +18,7 @@ class OTPInternalRepository(AstronInternalRepository):
|
||||||
|
|
||||||
def getAvatarIdFromSender(self):
|
def getAvatarIdFromSender(self):
|
||||||
return self.getMsgSender() & 0xFFFFFFFF
|
return self.getMsgSender() & 0xFFFFFFFF
|
||||||
|
|
||||||
|
def sendSetZone(self, distObj, zoneId):
|
||||||
|
distObj.setLocation(distObj.parentId, zoneId)
|
||||||
|
self.sendSetLocation(distObj, distObj.parentId, zoneId)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from libtoontown import *
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
from otp.ai.AIZoneData import AIZoneDataStore
|
from otp.ai.AIZoneData import AIZoneDataStore
|
||||||
from otp.distributed.OtpDoGlobals import *
|
from otp.distributed.OtpDoGlobals import *
|
||||||
|
@ -6,8 +7,14 @@ from toontown.distributed.ToontownDistrictAI import ToontownDistrictAI
|
||||||
from toontown.distributed.ToontownDistrictStatsAI import ToontownDistrictStatsAI
|
from toontown.distributed.ToontownDistrictStatsAI import ToontownDistrictStatsAI
|
||||||
from toontown.ai.HolidayManagerAI import HolidayManagerAI
|
from toontown.ai.HolidayManagerAI import HolidayManagerAI
|
||||||
from toontown.ai.NewsManagerAI import NewsManagerAI
|
from toontown.ai.NewsManagerAI import NewsManagerAI
|
||||||
|
from toontown.building.DistributedTrophyMgrAI import DistributedTrophyMgrAI
|
||||||
from toontown.catalog.CatalogManagerAI import CatalogManagerAI
|
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.uberdog.DistributedInGameNewsMgrAI import DistributedInGameNewsMgrAI
|
||||||
|
from toontown.toonbase import ToontownGlobals
|
||||||
|
|
||||||
class ToontownAIRepository(ToontownInternalRepository):
|
class ToontownAIRepository(ToontownInternalRepository):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory('ToontownAIRepository')
|
notify = DirectNotifyGlobal.directNotify.newCategory('ToontownAIRepository')
|
||||||
|
@ -16,14 +23,24 @@ class ToontownAIRepository(ToontownInternalRepository):
|
||||||
ToontownInternalRepository.__init__(self, baseChannel, serverId, dcSuffix='AI')
|
ToontownInternalRepository.__init__(self, baseChannel, serverId, dcSuffix='AI')
|
||||||
self.districtName = districtName
|
self.districtName = districtName
|
||||||
self.doLiveUpdates = config.GetBool('want-live-updates', True)
|
self.doLiveUpdates = config.GetBool('want-live-updates', True)
|
||||||
|
self.wantCogdominiums = config.GetBool('want-cogdominiums', True)
|
||||||
self.districtId = None
|
self.districtId = None
|
||||||
self.district = None
|
self.district = None
|
||||||
self.districtStats = None
|
self.districtStats = None
|
||||||
self.holidayManager = None
|
self.holidayManager = None
|
||||||
self.zoneDataStore = None
|
self.zoneDataStore = None
|
||||||
|
self.petMgr = None
|
||||||
|
self.suitInvasionManager = None
|
||||||
self.newsManager = None
|
self.newsManager = None
|
||||||
self.inGameNewsMgr = None
|
self.inGameNewsMgr = None
|
||||||
self.catalogManager = None
|
self.catalogManager = None
|
||||||
|
self.trophyMgr = None
|
||||||
|
self.zoneTable = {}
|
||||||
|
self.dnaStoreMap = {}
|
||||||
|
self.dnaDataMap = {}
|
||||||
|
self.hoods = []
|
||||||
|
self.buildingManagers = {}
|
||||||
|
self.suitPlanners = {}
|
||||||
|
|
||||||
def handleConnected(self):
|
def handleConnected(self):
|
||||||
ToontownInternalRepository.handleConnected(self)
|
ToontownInternalRepository.handleConnected(self)
|
||||||
|
@ -43,6 +60,9 @@ class ToontownAIRepository(ToontownInternalRepository):
|
||||||
# Create our global objects.
|
# Create our global objects.
|
||||||
self.createGlobals()
|
self.createGlobals()
|
||||||
|
|
||||||
|
# Create our zones.
|
||||||
|
self.createZones()
|
||||||
|
|
||||||
# Make our district available, and we're done.
|
# Make our district available, and we're done.
|
||||||
self.district.b_setAvailable(True)
|
self.district.b_setAvailable(True)
|
||||||
self.notify.info('Done.')
|
self.notify.info('Done.')
|
||||||
|
@ -58,6 +78,12 @@ class ToontownAIRepository(ToontownInternalRepository):
|
||||||
# Create our zone data store...
|
# Create our zone data store...
|
||||||
self.zoneDataStore = AIZoneDataStore()
|
self.zoneDataStore = AIZoneDataStore()
|
||||||
|
|
||||||
|
# Create our pet manager...
|
||||||
|
self.petMgr = PetManagerAI(self)
|
||||||
|
|
||||||
|
# Create our suit invasion manager...
|
||||||
|
self.suitInvasionManager = SuitInvasionManagerAI(self)
|
||||||
|
|
||||||
def createGlobals(self):
|
def createGlobals(self):
|
||||||
"""
|
"""
|
||||||
Creates "global" (distributed) objects.
|
Creates "global" (distributed) objects.
|
||||||
|
@ -81,6 +107,53 @@ class ToontownAIRepository(ToontownInternalRepository):
|
||||||
self.catalogManager = CatalogManagerAI(self)
|
self.catalogManager = CatalogManagerAI(self)
|
||||||
self.catalogManager.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
|
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):
|
def getTrackClsends(self):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -3,3 +3,12 @@ from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||||
|
|
||||||
class DistributedTrophyMgrAI(DistributedObjectAI):
|
class DistributedTrophyMgrAI(DistributedObjectAI):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedTrophyMgrAI')
|
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedTrophyMgrAI')
|
||||||
|
|
||||||
|
def requestTrophyScore(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def getLeaderInfo(self):
|
||||||
|
return [], [], []
|
||||||
|
|
||||||
|
def addTrophy(self, *args, **kwargs):
|
||||||
|
pass
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from otp.avatar import Avatar
|
from otp.avatar import Avatar
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
|
from libotp import *
|
||||||
from direct.task import Task
|
from direct.task import Task
|
||||||
import random
|
import random
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
|
from libotp import *
|
||||||
from direct.interval.IntervalGlobal import *
|
from direct.interval.IntervalGlobal import *
|
||||||
from otp.avatar import Avatar
|
from otp.avatar import Avatar
|
||||||
from libotp import CFQuicktalker
|
from libotp import CFQuicktalker
|
||||||
|
|
|
@ -5,6 +5,7 @@ from toontown.suit import DistributedSuitPlannerAI
|
||||||
from toontown.safezone import ButterflyGlobals
|
from toontown.safezone import ButterflyGlobals
|
||||||
from toontown.safezone import DistributedButterflyAI
|
from toontown.safezone import DistributedButterflyAI
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
|
from libtoontown import *
|
||||||
from toontown.toon import NPCToons
|
from toontown.toon import NPCToons
|
||||||
|
|
||||||
class HoodDataAI:
|
class HoodDataAI:
|
||||||
|
|
10
toontown/pets/PetManagerAI.py
Normal file
10
toontown/pets/PetManagerAI.py
Normal 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 []
|
|
@ -1,5 +1,6 @@
|
||||||
from otp.ai.AIBaseGlobal import *
|
from otp.ai.AIBaseGlobal import *
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
|
from libtoontown import *
|
||||||
from direct.distributed.ClockDelta import *
|
from direct.distributed.ClockDelta import *
|
||||||
from otp.avatar import DistributedAvatarAI
|
from otp.avatar import DistributedAvatarAI
|
||||||
import SuitTimings
|
import SuitTimings
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from libtoontown import *
|
||||||
from otp.ai.AIBaseGlobal import *
|
from otp.ai.AIBaseGlobal import *
|
||||||
from direct.distributed import DistributedObjectAI
|
from direct.distributed import DistributedObjectAI
|
||||||
import SuitPlannerBase, DistributedSuitAI
|
import SuitPlannerBase, DistributedSuitAI
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
|
from libtoontown import *
|
||||||
from direct.distributed.ClockDelta import *
|
from direct.distributed.ClockDelta import *
|
||||||
import math
|
import math
|
||||||
import random
|
import random
|
||||||
|
|
13
toontown/suit/SuitInvasionManagerAI.py
Normal file
13
toontown/suit/SuitInvasionManagerAI.py
Normal 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
|
|
@ -1,4 +1,5 @@
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
|
from libtoontown import *
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
|
@ -520,7 +521,7 @@ class SuitPlannerBase:
|
||||||
self.setupDNA()
|
self.setupDNA()
|
||||||
|
|
||||||
def extractGroupName(self, groupFullName):
|
def extractGroupName(self, groupFullName):
|
||||||
return string.split(groupFullName, ':', 1)[0]
|
return str(groupFullName).split(':', 1)[0]
|
||||||
|
|
||||||
def initDNAInfo(self):
|
def initDNAInfo(self):
|
||||||
numGraphs = self.dnaStore.discoverContinuity()
|
numGraphs = self.dnaStore.discoverContinuity()
|
||||||
|
|
|
@ -410,7 +410,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
|
||||||
|
|
||||||
def announceZoneChange(self, newZoneId, oldZoneId):
|
def announceZoneChange(self, newZoneId, oldZoneId):
|
||||||
from toontown.pets import PetObserve
|
from toontown.pets import PetObserve
|
||||||
self.air.welcomeValleyManager.toonSetZone(self.doId, newZoneId)
|
#self.air.welcomeValleyManager.toonSetZone(self.doId, newZoneId)
|
||||||
broadcastZones = [oldZoneId, newZoneId]
|
broadcastZones = [oldZoneId, newZoneId]
|
||||||
if self.isInEstate() or self.wasInEstate():
|
if self.isInEstate() or self.wasInEstate():
|
||||||
broadcastZones = union(broadcastZones, self.estateZones)
|
broadcastZones = union(broadcastZones, self.estateZones)
|
||||||
|
|
|
@ -6,6 +6,7 @@ from otp.otpbase import OTPLocalizer
|
||||||
import types
|
import types
|
||||||
from direct.showbase import PythonUtil
|
from direct.showbase import PythonUtil
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
|
from libotp import *
|
||||||
from otp.avatar import Emote
|
from otp.avatar import Emote
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
EmoteSleepIndex = 4
|
EmoteSleepIndex = 4
|
||||||
|
|
Loading…
Reference in a new issue