def getTankmanSkill(skillName, tankman=None): if tankman: if _isSabatonCrew(tankman): return SabatonTankmanSkill(skillName) if _isOffspringCrew(tankman): return OffspringTankmanSkill(skillName) return TankmanSkill(skillName, proxy=(0, ))
def _getItem(self, items, itemID): skillName, tankmanID = itemID if tankmanID > 0: tankman = items.getTankman(tankmanID) if tankman is None: LOG_WARNING('Empty tankman for skill', skillName, tankmanID) for s in tankman.skills: if s.name == skillName: return s return TankmanSkill(skillName)
def getSkillsData(self, callback): tankman = g_itemsCache.items.getTankman(self.tmanInvID) tankmanDescr = tankman.descriptor result = [] commonSkills = [] for skill in tankmen.COMMON_SKILLS: if skill not in tankmanDescr.skills: commonSkills.append( self.__packSkill(tankman, TankmanSkill(skill))) result.append({'id': 'common', 'skills': commonSkills}) for role in TANKMEN_ROLES_ORDER_DICT['plain']: roleSkills = tankmen.SKILLS_BY_ROLES.get(role, tuple()) if role not in tankman.combinedRoles: continue skills = [] for skill in roleSkills: if skill not in tankmen.COMMON_SKILLS and skill not in tankmanDescr.skills: skills.append( self.__packSkill(tankman, TankmanSkill(skill))) result.append({'id': role, 'skills': skills}) callback(result)
def buildItem(self, skillID, tankmanID): tankman = g_itemsCache.items.getTankman(int(tankmanID)) skill = findFirst(lambda x: x.name == skillID, tankman.skills) if skill is None: skill = TankmanSkill(skillID) return skill
def buildItem(self, skillID): if skillID == 'sabaton_brotherhood': return SabatonTankmanSkill('brotherhood') return OffspringTankmanSkill( 'brotherhood' ) if skillID == 'offspring_brotherhood' else TankmanSkill(skillID)