racing: leaderboards initial commit

This commit is contained in:
John Cote 2019-12-05 22:03:12 -05:00
parent 2073f67040
commit 6d46f8cd32
2 changed files with 29 additions and 1 deletions

View file

@ -24,6 +24,7 @@ from toontown.hood.MMHoodDataAI import MMHoodDataAI
from toontown.hood.TTHoodDataAI import TTHoodDataAI from toontown.hood.TTHoodDataAI import TTHoodDataAI
from toontown.pets.PetManagerAI import PetManagerAI from toontown.pets.PetManagerAI import PetManagerAI
from toontown.quest.QuestManagerAI import QuestManagerAI from toontown.quest.QuestManagerAI import QuestManagerAI
from toontown.racing.DistributedLeaderBoardAI import DistributedLeaderBoardAI
from toontown.shtiker.CogPageManagerAI import CogPageManagerAI from toontown.shtiker.CogPageManagerAI import CogPageManagerAI
from toontown.suit.SuitInvasionManagerAI import SuitInvasionManagerAI from toontown.suit.SuitInvasionManagerAI import SuitInvasionManagerAI
from toontown.toon import NPCToons from toontown.toon import NPCToons
@ -267,7 +268,19 @@ class ToontownAIRepository(ToontownInternalRepository):
return [], [] # TODO return [], [] # TODO
def findLeaderBoards(self, dnaData, zoneId): def findLeaderBoards(self, dnaData, zoneId):
return [] # TODO leaderBoards = []
if 'leaderBoard' in dnaData.getName():
x, y, z = dnaData.getPos()
h, p, r = dnaData.getHpr()
leaderBoard = DistributedLeaderBoardAI(self, dnaData.getName(), x, y, z, h, p, r)
leaderBoard.generateWithRequired(zoneId)
leaderBoards.append(leaderBoard)
for i in xrange(dnaData.getNumChildren()):
foundLeaderBoards = self.findLeaderBoards(dnaData.at(i), zoneId)
leaderBoards.extend(foundLeaderBoards)
return leaderBoards
def getTrackClsends(self): def getTrackClsends(self):
return False return False

View file

@ -1,5 +1,20 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedLeaderBoardAI(DistributedObjectAI): class DistributedLeaderBoardAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedLeaderBoardAI') notify = DirectNotifyGlobal.directNotify.newCategory('DistributedLeaderBoardAI')
def __init__(self, air, name, x, y, z, h, p, r):
DistributedObjectAI.__init__(self, air)
self.name = name
self.posHpr = (x, y, z, h, p, r)
def getName(self):
return self.name
def getPosHpr(self):
return self.posHpr
def subscribeTo(self, subscription):
pass # TODO