本文整理汇总了Python中toontown.racing.RaceGlobals.getTrackGenre方法的典型用法代码示例。如果您正苦于以下问题:Python RaceGlobals.getTrackGenre方法的具体用法?Python RaceGlobals.getTrackGenre怎么用?Python RaceGlobals.getTrackGenre使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toontown.racing.RaceGlobals
的用法示例。
在下文中一共展示了RaceGlobals.getTrackGenre方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: calculateTrophies
# 需要导入模块: from toontown.racing import RaceGlobals [as 别名]
# 或者: from toontown.racing.RaceGlobals import getTrackGenre [as 别名]
def calculateTrophies(self, avId, won, qualify, time):
av = self.air.doId2do[avId]
kartingHistory = av.getKartingHistory()
avTrophies = av.getKartingTrophies()
numTrophies = 0
for i in range(30):
if avTrophies[i] != 0:
numTrophies += 1
oldLaffBoost = int(numTrophies / 10)
genre = RaceGlobals.getTrackGenre(self.trackId)
trophies = []
if won:
kartingHistory[genre] += 1
kartingHistory[3] += 1
if kartingHistory[3] > RaceGlobals.TotalWonRaces:
avTrophies[RaceGlobals.TotalWins] = 1
trophies.append(RaceGlobals.TotalWins)
for i in range(3):
if kartingHistory[genre] >= RaceGlobals.WonRaces[
i] and avTrophies[RaceGlobals.AllWinsList[genre][i]] != 1:
avTrophies[RaceGlobals.AllWinsList[genre][i]] = 1
trophies.append(RaceGlobals.AllWinsList[genre][i])
if qualify:
kartingHistory[genre + 4] += 1
kartingHistory[7] += 1
if kartingHistory[7] >= RaceGlobals.TotalQualifiedRaces and avTrophies[
RaceGlobals.TotalQuals] != 1:
avTrophies[RaceGlobals.TotalQuals] = 1
trophies.append(RaceGlobals.TotalQuals)
for i in range(3):
if kartingHistory[
genre +
4] >= RaceGlobals.QualifiedRaces[i] and avTrophies[
RaceGlobals.AllQualsList[genre][i]] != 1:
avTrophies[RaceGlobals.AllQualsList[genre][i]] = 1
trophies.append(RaceGlobals.AllQualsList[genre][i])
av.b_setKartingHistory(kartingHistory)
pKartingBest = av.getKartingPersonalBestAll()
trackIndex = TTLocalizer.KartRace_TrackNames.keys().index(self.trackId)
if pKartingBest[trackIndex] > time or not pKartingBest[trackIndex]:
pKartingBest[trackIndex] = time
av.b_setKartingPersonalBest(pKartingBest)
gTourTrophy = True
for bestTime in pKartingBest:
if not bestTime:
gTourTrophy = False
if gTourTrophy:
if avTrophies[RaceGlobals.GrandTouring] != 1:
avTrophies[RaceGlobals.GrandTouring] = 1
trophies.append(RaceGlobals.GrandTouring)
newLaffBoost = int((len(trophies) + numTrophies) / 10)
if newLaffBoost - oldLaffBoost != 0:
for i in range(newLaffBoost):
if avTrophies[RaceGlobals.TrophyCups[i]] != 1:
avTrophies[RaceGlobals.TrophyCups[i]] = 1
trophies.append(RaceGlobals.TrophyCups[i])
av.b_setMaxHp(av.getMaxHp() + newLaffBoost - oldLaffBoost)
av.toonUp(av.getMaxHp())
av.b_setKartingTrophies(avTrophies)
return trophies
示例2: avatarFinished
# 需要导入模块: from toontown.racing import RaceGlobals [as 别名]
# 或者: from toontown.racing.RaceGlobals import getTrackGenre [as 别名]
def avatarFinished(self, avId):
if not avId in self.avatars:
self.air.writeServerEvent('suspicious', avId, 'Toon tried to finish in a race they\'re not in!')
return
if avId in self.finishedAvatars:
self.air.writeServerEvent('suspicious', avId, 'Toon tried to finish in a race twice!')
return
self.finishedAvatars.append(avId)
av = self.air.doId2do.get(avId)
place = len(self.finishedAvatars)
entryFee = RaceGlobals.getEntryFee(self.trackId, self.raceType)
bonus = 0
totalTime = globalClockDelta.networkToLocalTime(globalClockDelta.getRealNetworkTime()) - self.startTime
qualify = False
if totalTime < RaceGlobals.getQualifyingTime(self.trackId):
qualify = True
if self.raceType == RaceGlobals.Practice:
winnings = RaceGlobals.PracticeWinnings
trophies = []
elif qualify:
offset = 4 - len(self.avatarProgress) # self.avatarProgress contains the amount of STARTING players.
winnings = entryFee * RaceGlobals.Winnings[(place+offset)-1]
trophies = self.calculateTrophies(avId, place == 1, qualify, totalTime)
else:
winnings = 0
trophies = []
av.b_setTickets(av.getTickets() + winnings)
if av.getTickets() > RaceGlobals.MaxTickets:
av.b_setTickets(RaceGlobals.MaxTickets)
genre = RaceGlobals.getTrackGenre(self.trackId)
av = self.air.doId2do[avId]
timeStamp = time.time()
print (self.trackId)
print (genre)
print (totalTime)
print (av)
av = str(av)
av = av.split("/")[1]
self.air.leaderBoardMgr.appendNewRaceEntry(self.trackId, 0, av, totalTime, timeStamp)
self.air.leaderBoardMgr.appendNewRaceEntry(self.trackId, 1, av, totalTime, timeStamp)
self.air.leaderBoardMgr.appendNewRaceEntry(self.trackId, 2, av, totalTime, timeStamp)
print ("TRACK INDEX!!!")
self.sendUpdate('setPlace', [avId, totalTime, place, entryFee, qualify, max((winnings-entryFee), 0), bonus, trophies, [], 0])
示例3: getTunnelSign
# 需要导入模块: from toontown.racing import RaceGlobals [as 别名]
# 或者: from toontown.racing.RaceGlobals import getTrackGenre [as 别名]
def getTunnelSign(self):
cPadId = RaceGlobals.RaceInfo2RacePadId(self.trackId, self.trackType)
genreId = RaceGlobals.getTrackGenre(self.trackId)
tunnelName = RaceGlobals.getTunnelSignName(genreId, cPadId)
self.tunnelSign = self.cr.playGame.hood.loader.geom.find(
'**/' + tunnelName)