当前位置: 首页>>代码示例>>Python>>正文


Python RaceGlobals.getQualifyingTime方法代码示例

本文整理汇总了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])
开发者ID:CalebSmith376,项目名称:src,代码行数:34,代码来源:DistributedRaceAI.py

示例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")
开发者ID:BmanGames,项目名称:ToontownStride,代码行数:53,代码来源:DistributedRaceAI.py


注:本文中的toontown.racing.RaceGlobals.getQualifyingTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。