Esempio n. 1
0
    def getCrewBySkillLevels(self, *skillLevels):
        """
        Generate sorted list of tankmans with provided skills levels
        :param skillLevels: desired skills levels (list of integers)
        :return: list of tuples [(role, gui_items.Tankman), (role, gui_items.Tankman), ...] sorted by tankmans roles
        """
        crewItems = list()
        crewRoles = self.descriptor.type.crewRoles
        nationID, vehicleTypeID = self.descriptor.type.id
        passport = tankmen.generatePassport(nationID)
        skillLvlsCount = len(skillLevels)
        for idx, tankmanID in enumerate(crewRoles):
            role = self.descriptor.type.crewRoles[idx][0]
            roleLevel = skillLevels[
                idx] if idx < skillLvlsCount else skillLevels[skillLvlsCount -
                                                              1]
            if roleLevel is not None:
                tankman = Tankman(tankmen.generateCompactDescr(
                    passport, vehicleTypeID, role, roleLevel),
                                  vehicle=self)
            else:
                tankman = None
            crewItems.append((idx, tankman))

        return _sortCrew(crewItems, crewRoles)
 def __makeFakeDescriptor(self):
     vehType = vehicles.VehicleDescr(typeID=(0, 0)).type
     skills = self._getSkillsForDescr()
     freeSkills = self._getFreeSkillsForDescr()
     tmanDescr = tankmen.TankmanDescr(tankmen.generateCompactDescr(tankmen.generatePassport(vehType.id[0], False), vehType.id[1], vehType.crewRoles[0][0], self._roleLevel, skills=skills, freeSkills=freeSkills, lastSkillLevel=self._lastSkillLevel))
     tmanDescr.addXP(self._freeXP)
     return tmanDescr
Esempio n. 3
0
def __makeFakeTankmanDescr(startRoleLevel, freeXpValue, typeID):
    vehType = vehicles.VehicleDescr(typeID=typeID).type
    tmanDescr = tankmen.TankmanDescr(
        tankmen.generateCompactDescr(
            tankmen.generatePassport(vehType.id[0], False), vehType.id[1],
            vehType.crewRoles[0][0], startRoleLevel))
    tmanDescr.addXP(freeXpValue)
    return tmanDescr
Esempio n. 4
0
def __makeFakeTankmanDescr(startRoleLevel, freeXpValue, typeID):
    vehType = vehicles.VehicleDescr(typeID=typeID).type
    tmanDescr = tankmen.TankmanDescr(
        tankmen.generateCompactDescr(
            tankmen.generatePassport(vehType.id[0], False), vehType.id[1], vehType.crewRoles[0][0], startRoleLevel
        )
    )
    tmanDescr.addXP(freeXpValue)
    return tmanDescr
Esempio n. 5
0
def createTankman(nationID, vehicleTypeID, role, roleLevel, skills, vehicle,
                  vehicleSlotIDx):
    descr = tankmen.generateCompactDescr(tankmen.generatePassport(nationID),
                                         vehicleTypeID, role, roleLevel,
                                         skills)
    newTankmen = Tankman(descr, vehicle=vehicle, vehicleSlotIdx=vehicleSlotIDx)
    if BROTHERHOOD_SKILL_NAME in skills:
        newTankmen.setBrotherhoodActivity(True)
        newTankmen.rebuildSkills()
    return newTankmen
Esempio n. 6
0
    def getPerfectCrew(self):
        crewItems = list()
        crewRoles = self.descriptor.type.crewRoles
        nationID, vehicleTypeID = self.descriptor.type.id
        passport = tankmen.generatePassport(nationID)
        for idx, tankmanID in enumerate(crewRoles):
            role = self.descriptor.type.crewRoles[idx][0]
            tankman = Tankman(tankmen.generateCompactDescr(passport, vehicleTypeID, role, 100), vehicle=self)
            crewItems.append((idx, tankman))

        return _sortCrew(crewItems, crewRoles)
Esempio n. 7
0
    def getPerfectCrew(self):
        crewItems = list()
        crewRoles = self.descriptor.type.crewRoles
        nationID, vehicleTypeID = self.descriptor.type.id
        passport = tankmen.generatePassport(nationID)
        for idx, tankmanID in enumerate(crewRoles):
            role = self.descriptor.type.crewRoles[idx][0]
            tankman = Tankman(tankmen.generateCompactDescr(
                passport, vehicleTypeID, role, 100),
                              vehicle=self)
            crewItems.append((idx, tankman))

        return _sortCrew(crewItems, crewRoles)
Esempio n. 8
0
def createTankman(nationID, vehicleTypeID, role, roleLevel, skills):
    """
    Generates tankmen with provided parameters
    :param nationID: *.nations.INDICES
    :param vehicleTypeID: int
    :param role: *.Tankman.ROLES
    :param roleLevel: *.CREW_TYPES
    :param skills: the set of skills
    :return: gui.shared.gui_items.Tankman
    """
    descr = tankmen.generateCompactDescr(tankmen.generatePassport(nationID),
                                         vehicleTypeID, role, roleLevel,
                                         skills)
    return Tankman(descr)
def __makeFakeTankmanDescr(startRoleLevel,
                           freeXpValue,
                           typeID,
                           skills=(),
                           freeSkills=(),
                           lastSkillLevel=tankmen.MAX_SKILL_LEVEL):
    vehType = vehicles.VehicleDescr(typeID=typeID).type
    tmanDescr = tankmen.TankmanDescr(
        tankmen.generateCompactDescr(tankmen.generatePassport(
            vehType.id[0], False),
                                     vehType.id[1],
                                     vehType.crewRoles[0][0],
                                     startRoleLevel,
                                     skills=skills,
                                     freeSkills=freeSkills,
                                     lastSkillLevel=lastSkillLevel))
    tmanDescr.addXP(freeXpValue)
    return tmanDescr
Esempio n. 10
0
    def getCrewBySkillLevels(self, *skillLevels):
        """
        Generate sorted list of tankmans with provided skills levels
        :param skillLevels: desired skills levels (list of integers)
        :return: list of tuples [(role, gui_items.Tankman), (role, gui_items.Tankman), ...] sorted by tankmans roles
        """
        crewItems = list()
        crewRoles = self.descriptor.type.crewRoles
        nationID, vehicleTypeID = self.descriptor.type.id
        passport = tankmen.generatePassport(nationID)
        skillLvlsCount = len(skillLevels)
        for idx, tankmanID in enumerate(crewRoles):
            role = self.descriptor.type.crewRoles[idx][0]
            roleLevel = skillLevels[idx] if idx < skillLvlsCount else skillLevels[skillLvlsCount - 1]
            if roleLevel is not None:
                tankman = Tankman(tankmen.generateCompactDescr(passport, vehicleTypeID, role, roleLevel), vehicle=self)
            else:
                tankman = None
            crewItems.append((idx, tankman))

        return _sortCrew(crewItems, crewRoles)
Esempio n. 11
0
def createFakeTankmanDescr(role, vehicleType, roleLevel=100):
    nationID, vehicleTypeID = vehicleType.id
    passport = tankmen.generatePassport(nationID)
    return tankmen.generateCompactDescr(passport, vehicleTypeID, role,
                                        roleLevel)
Esempio n. 12
0
def createFakeTankmanDescr(role, vehicleType, roleLevel = 100):
    nationID, vehicleTypeID = vehicleType.id
    passport = tankmen.generatePassport(nationID)
    return tankmen.generateCompactDescr(passport, vehicleTypeID, role, roleLevel)
Esempio n. 13
0
def createTankman(nationID, vehicleTypeID, role, roleLevel, skills):
    descr = tankmen.generateCompactDescr(tankmen.generatePassport(nationID), vehicleTypeID, role, roleLevel, skills)
    return Tankman(descr)
Esempio n. 14
0
def getTankmanRoleLevel(startRoleLevel, freeXpValue = 0, vehTypeName = 'ussr:T-34'):
    vehType = vehicles.VehicleDescr(typeName=vehTypeName).type
    tmanDescr = tankmen.TankmanDescr(tankmen.generateCompactDescr(tankmen.generatePassport(vehType.id[0], False), vehType.id[1], vehType.crewRoles[0][0], startRoleLevel))
    tmanDescr.addXP(freeXpValue)
    return tmanDescr.roleLevel