Exemplo n.º 1
0
    def __setLimits(self, rosters, teamLimits):
        settings = self.prbFunctional.getSettings()
        self.__selectedDivision = settings[PREBATTLE_SETTING_NAME.DIVISION]
        totalLimit = getTotalLevelLimits(teamLimits)
        totalLevel = 0
        playersCount = 0
        classesLimit = dict(map(lambda vehClass: (vehClass, [0, getClassLevelLimits(teamLimits, vehClass)]), VEHICLE_CLASS_TAGS))
        invalidVehs = []
        if PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1 in rosters:
            for playerInfo in rosters[PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1]:
                totalLevel += self.__validateVehicle(playerInfo, classesLimit, invalidVehs)
                if playerInfo.isReady():
                    playersCount += 1

        maxPlayerCount = getMaxSizeLimits(teamLimits)[0]
        classesLimits = map(self.__makeClassLimitItem, classesLimit.iteritems())
        mixMax = self.__makeMinMaxString(totalLevel, totalLimit)
        self.__makeHeaderData(classesLimits, mixMax, maxPlayerCount)
        self.as_setTotalLimitLabelsS(self.__makeTotalLevelString(totalLevel, totalLimit))
        self.as_setMaxCountLimitLabelS(self.__makeMaxCountLimitLabel(playersCount, maxPlayerCount))
        if PREBATTLE_ROSTER.UNASSIGNED_IN_TEAM1 in rosters:
            for playerInfo in rosters[PREBATTLE_ROSTER.UNASSIGNED_IN_TEAM1]:
                self.__validateVehicle(playerInfo, classesLimit, invalidVehs)

        self.as_setInvalidVehiclesS(invalidVehs)
Exemplo n.º 2
0
    def __setLimits(self, rosters, teamLimits):
        totalLimit = getTotalLevelLimits(teamLimits)
        totalLevel = 0
        playersCount = 0
        classesLimit = dict(
            map(
                lambda vehClass:
                (vehClass, [0, getClassLevelLimits(teamLimits, vehClass)]),
                VEHICLE_CLASS_TAGS))
        invalidVehs = []
        if PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1 in rosters:
            for playerInfo in rosters[PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1]:
                totalLevel += self.__validateVehicle(playerInfo, classesLimit,
                                                     invalidVehs)
                if playerInfo.isReady():
                    playersCount += 1

        self.as_setClassesLimitsS(
            map(self.__makeClassLimitItem, classesLimit.iteritems()))
        self.as_setTotalLimitLabelsS(
            self.__makeTotalLevelString(totalLevel, totalLimit),
            self.__makeMinMaxString(totalLevel, totalLimit))
        self.as_setMaxCountLimitLabelS(
            self.__makeMaxCountLimitLabel(playersCount,
                                          getMaxSizeLimits(teamLimits)[0]))
        if PREBATTLE_ROSTER.UNASSIGNED_IN_TEAM1 in rosters:
            for playerInfo in rosters[PREBATTLE_ROSTER.UNASSIGNED_IN_TEAM1]:
                self.__validateVehicle(playerInfo, classesLimit, invalidVehs)

        self.as_setInvalidVehiclesS(invalidVehs)
Exemplo n.º 3
0
    def __setLimits(self, rosters, teamLimits):
        settings = self.prbFunctional.getSettings()
        self.__selectedDivision = settings[PREBATTLE_SETTING_NAME.DIVISION]
        totalLimit = getTotalLevelLimits(teamLimits)
        totalLevel = 0
        playersCount = 0
        classesLimit = dict(
            map(
                lambda vehClass:
                (vehClass, [0, getClassLevelLimits(teamLimits, vehClass)]),
                VEHICLE_CLASS_TAGS))
        invalidVehs = []
        if PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1 in rosters:
            for playerInfo in rosters[PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1]:
                totalLevel += self.__validateVehicle(playerInfo, classesLimit,
                                                     invalidVehs)
                if playerInfo.isReady():
                    playersCount += 1

        maxPlayerCount = getMaxSizeLimits(teamLimits)[0]
        classesLimits = map(self.__makeClassLimitItem,
                            classesLimit.iteritems())
        mixMax = self.__makeMinMaxString(totalLevel, totalLimit)
        self.__makeHeaderData(classesLimits, mixMax, maxPlayerCount)
        self.as_setTotalLimitLabelsS(
            self.__makeTotalLevelString(totalLevel, totalLimit))
        self.as_setMaxCountLimitLabelS(
            self.__makeMaxCountLimitLabel(playersCount, maxPlayerCount))
        if PREBATTLE_ROSTER.UNASSIGNED_IN_TEAM1 in rosters:
            for playerInfo in rosters[PREBATTLE_ROSTER.UNASSIGNED_IN_TEAM1]:
                self.__validateVehicle(playerInfo, classesLimit, invalidVehs)

        self.as_setInvalidVehiclesS(invalidVehs)
Exemplo n.º 4
0
    def __updateCommonRequirements(self, teamLimits, rosters):
        minTotalLvl, maxTotalLvl = prb_control.getTotalLevelLimits(teamLimits)
        playersMaxCount = prb_control.getMaxSizeLimits(teamLimits)[0]
        totalLvl = 0
        for roster, players in rosters.iteritems():
            if roster ^ self.__team == PREBATTLE_ROSTER.ASSIGNED:
                for player in players:
                    if player.isVehicleSpecified():
                        totalLvl += player.getVehicle().level

        self.as_setCommonLimitsS(totalLvl, minTotalLvl, maxTotalLvl, playersMaxCount)
Exemplo n.º 5
0
    def __updateCommonRequirements(self, teamLimits, rosters):
        minTotalLvl, maxTotalLvl = prb_control.getTotalLevelLimits(teamLimits)
        playersMaxCount = prb_control.getMaxSizeLimits(teamLimits)[0]
        totalLvl = 0
        for roster, players in rosters.iteritems():
            if roster ^ self.__team == PREBATTLE_ROSTER.ASSIGNED:
                for player in players:
                    if player.isVehicleSpecified():
                        totalLvl += player.getVehicle().level

        self.as_setCommonLimitsS(totalLvl, minTotalLvl, maxTotalLvl,
                                 playersMaxCount)
Exemplo n.º 6
0
    def check(self, rosters, team, teamLimits):
        maxCount = sum(getMaxSizeLimits(teamLimits))
        result, restriction = True, ''
        if team is 1:
            keys = [PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1, PREBATTLE_ROSTER.UNASSIGNED_IN_TEAM1]
        else:
            keys = [PREBATTLE_ROSTER.ASSIGNED_IN_TEAM2, PREBATTLE_ROSTER.UNASSIGNED_IN_TEAM2]
        playersCount = 0
        for key in keys:
            if key in rosters:
                playersCount += len(rosters[key])

        if playersCount >= maxCount:
            result, restriction = False, PREBATTLE_RESTRICTION.LIMIT_MAX_COUNT
        return (result, restriction)
Exemplo n.º 7
0
    def __updateCommonRequirements(self, teamLimits, rosters):
        minTotalLvl, maxTotalLvl = prb_control.getTotalLevelLimits(teamLimits)
        playersMaxCount = prb_control.getMaxSizeLimits(teamLimits)[0]
        totalLvl = 0
        playersCount = 0
        for roster, players in rosters.iteritems():
            if roster ^ self.__team == PREBATTLE_ROSTER.ASSIGNED:
                for player in players:
                    if player.isReady():
                        playersCount += 1
                    if player.isVehicleSpecified():
                        totalLvl += player.getVehicle().level

        self.as_setCommonLimitsS(totalLvl, minTotalLvl, maxTotalLvl, playersMaxCount)
        self.as_setPlayersCountTextS(makeHtmlString('html_templates:lobby/prebattle', 'specBattlePlayersCount', {'membersCount': playersCount,
         'maxMembersCount': playersMaxCount}))
Exemplo n.º 8
0
 def check(self, rosters, team, teamLimits):
     if self.__assigned:
         index = 0
         if team is 1:
             key = PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1
         else:
             key = PREBATTLE_ROSTER.ASSIGNED_IN_TEAM2
     else:
         index = 1
         if team is 1:
             key = PREBATTLE_ROSTER.UNASSIGNED_IN_TEAM1
         else:
             key = PREBATTLE_ROSTER.UNASSIGNED_IN_TEAM2
     maxCount = getMaxSizeLimits(teamLimits)[index]
     if key in rosters and len(rosters[key]) >= maxCount:
         return (False, PREBATTLE_RESTRICTION.LIMIT_MAX_COUNT)
     return (True, '')
Exemplo n.º 9
0
 def check(self, rosters, team, teamLimits):
     if self.__assigned:
         index = 0
         if team is 1:
             key = PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1
         else:
             key = PREBATTLE_ROSTER.ASSIGNED_IN_TEAM2
     else:
         index = 1
         if team is 1:
             key = PREBATTLE_ROSTER.UNASSIGNED_IN_TEAM1
         else:
             key = PREBATTLE_ROSTER.UNASSIGNED_IN_TEAM2
     maxCount = getMaxSizeLimits(teamLimits)[index]
     if key in rosters and len(rosters[key]) >= maxCount:
         return (False, PREBATTLE_RESTRICTION.LIMIT_MAX_COUNT)
     return (True, '')
Exemplo n.º 10
0
    def __setLimits(self, rosters, teamLimits):
        totalLimit = getTotalLevelLimits(teamLimits)
        totalLevel = 0
        playersCount = 0
        classesLimit = dict(map(lambda vehClass: (vehClass, [0, getClassLevelLimits(teamLimits, vehClass)]), VEHICLE_CLASS_TAGS))
        invalidVehs = []
        if PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1 in rosters:
            for playerInfo in rosters[PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1]:
                totalLevel += self.__validateVehicle(playerInfo, classesLimit, invalidVehs)
                if playerInfo.isReady():
                    playersCount += 1

        self.as_setClassesLimitsS(map(self.__makeClassLimitItem, classesLimit.iteritems()))
        self.as_setTotalLimitLabelsS(self.__makeTotalLevelString(totalLevel, totalLimit), self.__makeMinMaxString(totalLevel, totalLimit))
        self.as_setMaxCountLimitLabelS(self.__makeMaxCountLimitLabel(playersCount, getMaxSizeLimits(teamLimits)[0]))
        if PREBATTLE_ROSTER.UNASSIGNED_IN_TEAM1 in rosters:
            for playerInfo in rosters[PREBATTLE_ROSTER.UNASSIGNED_IN_TEAM1]:
                self.__validateVehicle(playerInfo, classesLimit, invalidVehs)

        self.as_setInvalidVehiclesS(invalidVehs)
Exemplo n.º 11
0
    def check(self, rosters, team, teamLimits):
        maxCount = sum(getMaxSizeLimits(teamLimits))
        result, restriction = True, ''
        if team is 1:
            keys = [
                PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1,
                PREBATTLE_ROSTER.UNASSIGNED_IN_TEAM1
            ]
        else:
            keys = [
                PREBATTLE_ROSTER.ASSIGNED_IN_TEAM2,
                PREBATTLE_ROSTER.UNASSIGNED_IN_TEAM2
            ]
        playersCount = 0
        for key in keys:
            if key in rosters:
                playersCount += len(rosters[key])

        if playersCount >= maxCount:
            result, restriction = False, PREBATTLE_RESTRICTION.LIMIT_MAX_COUNT
        return (result, restriction)
Exemplo n.º 12
0
    def __updateCommonRequirements(self, teamLimits, rosters):
        minTotalLvl, maxTotalLvl = prb_control.getTotalLevelLimits(teamLimits)
        playersMaxCount = prb_control.getMaxSizeLimits(teamLimits)[0]
        totalLvl = 0
        playersCount = 0
        for roster, players in rosters.iteritems():
            if roster ^ self.__team == PREBATTLE_ROSTER.ASSIGNED:
                for player in players:
                    if player.isReady():
                        playersCount += 1
                    if player.isVehicleSpecified():
                        totalLvl += player.getVehicle().level

        self.as_setCommonLimitsS(totalLvl, minTotalLvl, maxTotalLvl,
                                 playersMaxCount)
        self.as_setPlayersCountTextS(
            makeHtmlString('html_templates:lobby/prebattle',
                           'specBattlePlayersCount', {
                               'membersCount': playersCount,
                               'maxMembersCount': playersMaxCount
                           }))