本文整理汇总了Python中toontown.racing.RaceGlobals.getEntryFee方法的典型用法代码示例。如果您正苦于以下问题:Python RaceGlobals.getEntryFee方法的具体用法?Python RaceGlobals.getEntryFee怎么用?Python RaceGlobals.getEntryFee使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toontown.racing.RaceGlobals
的用法示例。
在下文中一共展示了RaceGlobals.getEntryFee方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createRace
# 需要导入模块: from toontown.racing import RaceGlobals [as 别名]
# 或者: from toontown.racing.RaceGlobals import getEntryFee [as 别名]
def createRace(self):
self.raceZone = self.air.allocateZone()
avatars = []
for block in self.startingBlocks:
if block.avId != 0:
avatars.append(block.avId)
self.sendUpdateToAvatarId(block.avId, 'setRaceZone', [self.raceZone])
race = DistributedRaceAI(self.air)
race.setZoneId(self.raceZone)
race.setTrackId(self.trackId)
race.setRaceType(self.trackType)
race.setCircuitLoop([])
race.setAvatars(avatars)
race.setStartingPlaces(range(len(avatars)))
race.setLapCount(3)
race.generateWithRequired(self.raceZone)
for avId in avatars:
if avId in self.air.doId2do:
av = self.air.doId2do[avId]
entryFee = RaceGlobals.getEntryFee(self.trackId, self.trackType)
if av.getTickets() < entryFee:
self.air.writeServerEvent('suspicious', avId, 'Toon somehow lost tickets between entering a race and it leaving!')
av.b_setTickets(0)
else:
av.b_setTickets(av.getTickets() - entryFee)
self.b_setState('WaitEmpty', globalClockDelta.getRealNetworkTime())
示例2: avatarFinished
# 需要导入模块: from toontown.racing import RaceGlobals [as 别名]
# 或者: from toontown.racing.RaceGlobals import getEntryFee [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])
示例3: __handleEnterSphere
# 需要导入模块: from toontown.racing import RaceGlobals [as 别名]
# 或者: from toontown.racing.RaceGlobals import getEntryFee [as 别名]
def __handleEnterSphere(self, collEntry):
if base.localAvatar.doId == self.lastAvId and globalClock.getFrameCount() <= self.lastFrame + 1:
self.notify.debug('Ignoring duplicate entry for avatar.')
return
if base.localAvatar.hp > 0:
def handleEnterRequest(self = self):
self.ignore('stoppedAsleep')
if hasattr(self.dialog, 'doneStatus') and self.dialog.doneStatus == 'ok':
self.d_requestEnter(base.cr.isPaid())
elif self.cr and not self.isDisabled():
self.cr.playGame.getPlace().setState('walk')
else:
self.notify.warning('Warning! Object has already been disabled.')
self.dialog.ignoreAll()
self.dialog.cleanup()
del self.dialog
self.cr.playGame.getPlace().fsm.request('stopped')
self.accept('stoppedAsleep', handleEnterRequest)
doneEvent = 'enterRequest|dialog'
if self.kartPad.isPractice():
msg = TTLocalizer.StartingBlock_EnterPractice
else:
raceName = TTLocalizer.KartRace_RaceNames[self.kartPad.trackType]
numTickets = RaceGlobals.getEntryFee(self.kartPad.trackId, self.kartPad.trackType)
msg = TTLocalizer.StartingBlock_EnterNonPractice % (raceName, numTickets)
self.dialog = TTGlobalDialog(msg, doneEvent, 4)
self.dialog.accept(doneEvent, handleEnterRequest)
示例4: requestEnter
# 需要导入模块: from toontown.racing import RaceGlobals [as 别名]
# 或者: from toontown.racing.RaceGlobals import getEntryFee [as 别名]
def requestEnter(self, isPaid):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if not av:
self.air.writeServerEvent(
'suspicious', avId=avId,
issue='Toon tried to board a starting block, but is not on the district!')
return
if not av.hasKart():
self.sendUpdateToAvatarId(
avId, 'rejectEnter', [
KartGlobals.ERROR_CODE.eNoKart])
return
if av.getTickets() < RaceGlobals.getEntryFee(
self.pad.trackId, self.pad.trackType):
self.sendUpdateToAvatarId(
avId, 'rejectEnter', [
KartGlobals.ERROR_CODE.eTickets])
return
if self.pad.state == 'AllAboard' or self.pad.state == 'WaitBoarding':
self.sendUpdateToAvatarId(
avId, 'rejectEnter', [
KartGlobals.ERROR_CODE.eBoardOver])
return
if self.avId != 0:
if self.avId == avId:
self.air.writeServerEvent(
'suspicious', avId=avId,
issue='Toon tried to board the same starting block twice!')
self.sendUpdateToAvatarId(
avId, 'rejectEnter', [
KartGlobals.ERROR_CODE.eOccupied])
return
self.b_setOccupied(avId)
self.b_setMovie(KartGlobals.ENTER_MOVIE)
示例5: avatarFinished
# 需要导入模块: from toontown.racing import RaceGlobals [as 别名]
# 或者: from toontown.racing.RaceGlobals import getEntryFee [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")
示例6: updateTunnelSignText
# 需要导入模块: from toontown.racing import RaceGlobals [as 别名]
# 或者: from toontown.racing.RaceGlobals import getEntryFee [as 别名]
def updateTunnelSignText(self):
self.notify.debugStateCall(self)
trackNameString = TTLocalizer.KartRace_TrackNames[self.trackId]
if not self.trackNameNode:
self.notify.warning('invalid trackNameNode, just returning')
return
self.trackNameNode.setText(trackNameString)
trackTypeString = TTLocalizer.KartRace_RaceNames[self.trackType]
self.trackTypeNode.setText(trackTypeString)
deposit = 0
if self.trackType:
deposit = RaceGlobals.getEntryFee(self.trackId, self.trackType)
depositString = TTLocalizer.KartRace_DepositPhrase + str(deposit)
self.depositNode.setText(depositString)
time = RaceGlobals.TrackDict[self.trackId][1]
secs, hundredths = divmod(time, 1)
min, sec = divmod(secs, 60)
timeText = '%02d:%02d:%02d' % (min, sec, hundredths * 100)
qualifyString = TTLocalizer.KartRace_QualifyPhrase + timeText
self.qualifyNode.setText(qualifyString)