本文整理匯總了Python中toontown.racing.RaceGlobals.getQualifyingTime方法的典型用法代碼示例。如果您正苦於以下問題:Python RaceGlobals.getQualifyingTime方法的具體用法?Python RaceGlobals.getQualifyingTime怎麽用?Python RaceGlobals.getQualifyingTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類toontown.racing.RaceGlobals
的用法示例。
在下文中一共展示了RaceGlobals.getQualifyingTime方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: avatarFinished
# 需要導入模塊: from toontown.racing import RaceGlobals [as 別名]
# 或者: from toontown.racing.RaceGlobals import getQualifyingTime [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)
self.sendUpdate('setPlace', [avId, totalTime, place, entryFee, qualify, max((winnings-entryFee), 0), bonus, trophies, [], 0])
示例2: avatarFinished
# 需要導入模塊: from toontown.racing import RaceGlobals [as 別名]
# 或者: from toontown.racing.RaceGlobals import getQualifyingTime [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)
listPlace = place + (4 - len(self.avatarProgress)) - 1
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
self.air.leaderboardMgr.submitRace(self.trackId, av.getName(), totalTime)
if self.raceType == RaceGlobals.Practice:
winnings = RaceGlobals.PracticeWinnings
trophies = []
elif qualify:
winnings = entryFee * RaceGlobals.Winnings[listPlace]
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)
av.addStat(ToontownGlobals.STAT_RACING)
points = []
if self.circuitPoints:
avIndex = self.avatars.index(avId)
points = self.circuitPoints[avIndex]
points[0] += points[1]
points[1] = RaceGlobals.CircuitPoints[place - 1]
self.sendUpdate(
"setPlace",
[avId, totalTime, place, entryFee, qualify, max((winnings - entryFee), 0), bonus, trophies, points, 0],
)
if self.circuitPoints:
self.circuitWinnings[avIndex] += winnings
self.sendUpdate("setCircuitPlace", [avId, place, entryFee, self.circuitWinnings[avIndex], bonus, trophies])
if len(self.finishedAvatars) == len(self.avatars):
del self.circuitLoop[0]
self.sendUpdate("setCircuitLoop", [self.circuitLoop])
self.sendUpdate("endCircuitRace")