def updateTankmen(self): Waiting.show('updateTankmen') if g_currentVehicle.isPresent(): tankmen = g_itemsCache.items.getTankmen() vehicle = g_currentVehicle.item commander_bonus = vehicle.bonuses['commander'] roles = [] lessMastered = 0 tankmenDescrs = dict(vehicle.crew) for slotIdx, tman in vehicle.crew: if slotIdx > 0 and tman is not None and (tankmenDescrs[lessMastered] is None or compareMastery(tankmenDescrs[lessMastered].descriptor, tman.descriptor) > 0): lessMastered = slotIdx role = vehicle.descriptor.type.crewRoles[slotIdx][0] roles.append({'tankmanID': tman.invID if tman is not None else None, 'roleType': role, 'role': convert(getSkillsConfig()[role]['userString']), 'roleIcon': Tankman.getRoleBigIconPath(role), 'nationID': vehicle.nationID, 'typeID': vehicle.innationID, 'slot': slotIdx, 'vehicleType': vehicle.shortUserName, 'tankType': vehicle.type, 'vehicleElite': vehicle.isPremium or vehicle.isPremiumIGR, 'roles': list(vehicle.descriptor.type.crewRoles[slotIdx])}) tankmenData = [] for tankman in tankmen.itervalues(): if tankman.isInTank and tankman.vehicleInvID != vehicle.invID: continue tankmanVehicle = g_itemsCache.items.getItemByCD(tankman.vehicleNativeDescr.type.compactDescr) bonus_role_level = commander_bonus if tankman.descriptor.role != 'commander' else 0.0 skills_count = len(list(ACTIVE_SKILLS)) skillsList = [] for skill in tankman.skills: skillsList.append({'tankmanID': tankman.invID, 'id': str(tankman.skills.index(skill)), 'name': skill.userName, 'desc': skill.description, 'icon': skill.icon, 'level': skill.level, 'active': skill.isEnable and skill.isActive}) newSkillsCount, lastNewSkillLvl = tankman.newSkillCount if newSkillsCount > 0: skillsList.append({'buy': True, 'tankmanID': tankman.invID, 'level': lastNewSkillLvl}) tankmanData = {'firstName': tankman.firstUserName, 'lastName': tankman.lastUserName, 'rank': tankman.rankUserName, 'specializationLevel': tankman.realRoleLevel[0], 'role': tankman.roleUserName, 'vehicleType': tankmanVehicle.shortUserName, 'iconFile': tankman.icon, 'rankIconFile': tankman.iconRank, 'roleIconFile': Tankman.getRoleBigIconPath(tankman.descriptor.role), 'contourIconFile': tankmanVehicle.iconContour, 'tankmanID': tankman.invID, 'nationID': tankman.nationID, 'typeID': tankmanVehicle.innationID, 'inTank': tankman.isInTank, 'roleType': tankman.descriptor.role, 'tankType': tankmanVehicle.type, 'efficiencyLevel': tankman.efficiencyRoleLevel, 'bonus': bonus_role_level, 'lastSkillLevel': tankman.descriptor.lastSkillLevel, 'isLessMastered': vehicle.crewIndices.get(tankman.invID) == lessMastered and vehicle.isXPToTman, 'compact': tankman.strCD, 'availableSkillsCount': skills_count, 'skills': skillsList} tankmenData.append(tankmanData) self.as_tankmenResponseS({'roles': roles, 'tankmen': tankmenData}) dogName = '' if 'dog' in g_itemsCache.items.getItemByCD(g_currentVehicle.item.intCD).tags: dogName = MENU.HANGAR_CREW_RODY_DOG_NAME self.as_dogResponseS(dogName) Waiting.hide('updateTankmen') return
def updateTankmen(self): Waiting.show('updateTankmen') if g_currentVehicle.isPresent(): tankmen = g_itemsCache.items.getTankmen() vehicle = g_currentVehicle.item commander_bonus = vehicle.bonuses['commander'] roles = [] lessMastered = 0 tankmenDescrs = dict(vehicle.crew) for slotIdx, tman in vehicle.crew: if slotIdx > 0 and tman is not None and ( tankmenDescrs[lessMastered] is None or compareMastery(tankmenDescrs[lessMastered].descriptor, tman.descriptor) > 0): lessMastered = slotIdx role = vehicle.descriptor.type.crewRoles[slotIdx][0] roles.append({ 'tankmanID': tman.invID if tman is not None else None, 'roleType': role, 'role': convert(getSkillsConfig()[role]['userString']), 'roleIcon': Tankman.getRoleBigIconPath(role), 'nationID': vehicle.nationID, 'typeID': vehicle.innationID, 'slot': slotIdx, 'vehicleType': vehicle.shortUserName, 'tankType': vehicle.type, 'vehicleElite': vehicle.isPremium or vehicle.isPremiumIGR, 'roles': list(vehicle.descriptor.type.crewRoles[slotIdx]) }) tankmenData = [] for tankman in tankmen.itervalues(): if tankman.isInTank and tankman.vehicleInvID != vehicle.invID: continue tankmanVehicle = g_itemsCache.items.getItemByCD( tankman.vehicleNativeDescr.type.compactDescr) bonus_role_level = commander_bonus if tankman.descriptor.role != 'commander' else 0.0 skills_count = len(list(ACTIVE_SKILLS)) skillsList = [] for skill in tankman.skills: skillsList.append({ 'tankmanID': tankman.invID, 'id': str(tankman.skills.index(skill)), 'name': skill.userName, 'desc': skill.description, 'icon': skill.icon, 'level': skill.level, 'active': skill.isEnable and skill.isActive }) newSkillsCount, lastNewSkillLvl = tankman.newSkillCount if newSkillsCount > 0: skillsList.append({ 'buy': True, 'buyCount': newSkillsCount - 1, 'tankmanID': tankman.invID, 'level': lastNewSkillLvl }) tankmanData = { 'firstName': tankman.firstUserName, 'lastName': tankman.lastUserName, 'rank': tankman.rankUserName, 'specializationLevel': tankman.realRoleLevel[0], 'role': tankman.roleUserName, 'vehicleType': tankmanVehicle.shortUserName, 'iconFile': tankman.icon, 'rankIconFile': tankman.iconRank, 'roleIconFile': Tankman.getRoleBigIconPath(tankman.descriptor.role), 'contourIconFile': tankmanVehicle.iconContour, 'tankmanID': tankman.invID, 'nationID': tankman.nationID, 'typeID': tankmanVehicle.innationID, 'inTank': tankman.isInTank, 'roleType': tankman.descriptor.role, 'tankType': tankmanVehicle.type, 'efficiencyLevel': tankman.efficiencyRoleLevel, 'bonus': bonus_role_level, 'lastSkillLevel': tankman.descriptor.lastSkillLevel, 'isLessMastered': vehicle.crewIndices.get(tankman.invID) == lessMastered and vehicle.isXPToTman, 'compact': tankman.strCD, 'availableSkillsCount': skills_count, 'skills': skillsList } tankmenData.append(tankmanData) self.as_tankmenResponseS({'roles': roles, 'tankmen': tankmenData}) dogName = '' if 'dog' in g_itemsCache.items.getItemByCD( g_currentVehicle.item.intCD).tags: dogName = MENU.HANGAR_CREW_RODY_DOG_NAME self.as_dogResponseS(dogName) Waiting.hide('updateTankmen') return
def updateTankmen(self): Waiting.show('updateTankmen') tankmen = yield Requester('tankman').getFromInventory() vehicles = yield Requester('vehicle').getFromInventory() vehicle = None if g_currentVehicle.isPresent(): for veh in vehicles: if veh.inventoryId == g_currentVehicle.invID: vehicle = veh break if vehicle is None: LOG_ERROR('Vehicle not found', g_currentVehicle.invID) Waiting.hide('updateTankmen') return crew = [] for tId in vehicle.crew: if tId is None: crew.append(None) continue for tankman in tankmen: if tankman.inventoryId == tId: crew.append(tankman) vehicle = g_currentVehicle.item commander_bonus = vehicle.bonuses['commander'] roles = [] brotherhood_bonus = getSkillsConfig( )['brotherhood']['crewLevelIncrease'] for t in crew: if t is None or 'brotherhood' not in t.skills or t.skills.index( 'brotherhood') == len( t.skills) - 1 and t.lastSkillLevel != 100: brotherhood_bonus = 0 break lessMastered = 0 tankmenDescrs = dict(vehicle.crew) for slotIdx, tman in vehicle.crew: if slotIdx > 0 and tman is not None and ( tankmenDescrs[lessMastered] is None or compareMastery(tankmenDescrs[lessMastered].descriptor, tman.descriptor) > 0): lessMastered = slotIdx role = vehicle.descriptor.type.crewRoles[slotIdx][0] roles.append({ 'tankmanID': tman.invID if tman is not None else None, 'roleType': role, 'role': convert(getSkillsConfig()[role]['userString']), 'roleIcon': '%s/%s' % (Tankman.ROLE_ICON_PATH_BIG, getSkillsConfig()[role]['icon']), 'nationID': vehicle.nationID, 'typeID': vehicle.innationID, 'slot': slotIdx, 'vehicleType': vehicle.shortUserName, 'tankType': vehicle.type, 'vehicleElite': vehicle.isPremium, 'roles': list(vehicle.descriptor.type.crewRoles[slotIdx]) }) tankmenData = [] crewIDs = vehicle.crewIndices.keys() for tankman in tankmen: if not tankman.isInTank or tankman.inventoryId in crewIDs: bonus_role_level = commander_bonus if tankman.descriptor.role != 'commander' else 0.0 skills_count = len(list(ACTIVE_SKILLS)) skillsList = [] for skill in tankman.skills: skillLevel = tankman.lastSkillLevel if tankman.skills.index( skill) == len(tankman.skills) - 1 else 100 skillsList.append({ 'tankmanID': tankman.inventoryId, 'id': skill, 'name': getSkillsConfig()[skill]['userString'], 'desc': getSkillsConfig()[skill]['description'], 'icon': getSkillsConfig()[skill]['icon'], 'level': tankman.lastSkillLevel, 'active': skill not in PERKS or skill == 'brotherhood' and brotherhood_bonus != 0 or skill != 'brotherhood' and skillLevel == 100 }) newSkillsCount, lastNewSkillLvl = tankman.newSkillCount if newSkillsCount > 0: skillsList.append({ 'buy': True, 'tankmanID': tankman.inventoryId, 'level': lastNewSkillLvl }) tankmanData = { 'firstname': tankman.firstname, 'lastname': tankman.lastname, 'rank': tankman.rank, 'specializationLevel': tankman.roleLevel, 'role': tankman.role, 'vehicleType': tankman.vehicle.type.shortUserString, 'iconFile': tankman.icon, 'rankIconFile': tankman.iconRank, 'roleIconFile': '%s/%s' % (Tankman.ROLE_ICON_PATH_BIG, tankman.iconRole), 'contourIconFile': tankman.vehicleIconContour, 'tankmanID': tankman.inventoryId, 'nationID': tankman.nation, 'typeID': tankman.vehicle.type.id[1], 'inTank': tankman.isInTank, 'roleType': tankman.descriptor.role, 'tankType': tankman.vehicleType, 'efficiencyLevel': tankman.efficiencyRoleLevel(vehicle.descriptor), 'bonus': bonus_role_level, 'lastSkillLevel': tankman.lastSkillLevel, 'isLessMastered': vehicle.crewIndices.get(tankman.inventoryId) == lessMastered and vehicle.isXPToTman, 'compact': tankman.pack(), 'availableSkillsCount': skills_count, 'skills': skillsList } tankmenData.append(tankmanData) self.as_tankmenResponseS(roles, tankmenData) Waiting.hide('updateTankmen') return
def updateTankmen(self, diff=None): Waiting.show('updateTankmen') if g_currentVehicle.isPresent(): vehicle = g_currentVehicle.item allTankmen = self.itemsCache.items.getTankmen() commander_bonus = vehicle.bonuses['commander'] roles = [] lessMastered = 0 tankmenDescrs = dict(vehicle.crew) skillsConfig = getSkillsConfig() for slotIdx, tman in vehicle.crew: if slotIdx > 0 and tman is not None and ( tankmenDescrs[lessMastered] is None or compareMastery(tankmenDescrs[lessMastered].descriptor, tman.descriptor) > 0): lessMastered = slotIdx role = vehicle.descriptor.type.crewRoles[slotIdx][0] roles.append({ 'tankmanID': tman.invID if tman is not None else None, 'roleType': role, 'role': convert(skillsConfig.getSkill(role).userString), 'roleIcon': Tankman.getRoleBigIconPath(role), 'nationID': vehicle.nationID, 'typeID': vehicle.innationID, 'slot': slotIdx, 'vehicleType': vehicle.shortUserName, 'tankType': vehicle.type, 'vehicleElite': vehicle.isPremium or vehicle.isPremiumIGR, 'roles': list(vehicle.descriptor.type.crewRoles[slotIdx]) }) tankmenData = [] for tankman in allTankmen.itervalues(): if tankman.isInTank and tankman.vehicleInvID != vehicle.invID: continue tankmanVehicle = self.itemsCache.items.getItemByCD( tankman.vehicleNativeDescr.type.compactDescr) bonus_role_level = commander_bonus if tankman.descriptor.role != 'commander' else 0.0 skills_count = skillsConfig.getNumberOfActiveSkills() skillsList = [] for skill in tankman.skills: skillsList.append({ 'tankmanID': tankman.invID, 'id': str(tankman.skills.index(skill)), 'name': skill.userName, 'desc': skill.description, 'icon': skill.icon, 'level': skill.level, 'active': skill.isEnable and skill.isActive }) newSkillsCount, lastNewSkillLvl = tankman.newSkillCount if newSkillsCount > 0: skillsList.append({ 'buy': True, 'buyCount': newSkillsCount - 1, 'tankmanID': tankman.invID, 'level': lastNewSkillLvl }) tankmanData = { 'fullName': tankman.fullUserName, 'lastName': tankman.lastUserName or tankman.firstUserName, 'rank': tankman.rankUserName, 'specializationLevel': tankman.realRoleLevel[0], 'role': tankman.roleUserName, 'vehicleType': tankmanVehicle.shortUserName, 'iconFile': tankman.icon, 'rankIconFile': tankman.iconRank, 'roleIconFile': Tankman.getRoleBigIconPath(tankman.descriptor.role), 'contourIconFile': tankmanVehicle.iconContour, 'tankmanID': tankman.invID, 'nationID': tankman.nationID, 'typeID': tankmanVehicle.innationID, 'inTank': tankman.isInTank, 'roleType': tankman.descriptor.role, 'tankType': tankmanVehicle.type, 'efficiencyLevel': tankman.efficiencyRoleLevel, 'bonus': bonus_role_level, 'lastSkillLevel': tankman.descriptor.lastSkillLevel, 'isLessMastered': vehicle.crewIndices.get(tankman.invID) == lessMastered and vehicle.isXPToTman, 'compact': tankman.strCD, 'availableSkillsCount': skills_count, 'skills': skillsList } self.__updateTankmanDataByCrewSkin(tankman, tankmanData) tankmenData.append(tankmanData) self.as_tankmenResponseS({ 'showRecruit': self._showRecruit, 'roles': roles, 'tankmen': tankmenData }) dogName = '' if 'dog' in self.itemsCache.items.getItemByCD( g_currentVehicle.item.intCD).tags: dogName = backport.text( R.strings.menu.hangar.crew.rody.dog.dyn( vehicle.nationName).name()) self.as_dogResponseS(dogName) tooltipId = TOOLTIPS.HANGAR_CREW_RUDY_DOG + vehicle.nationName self.as_setDogTooltipS(tooltipId) Waiting.hide('updateTankmen') return
def updateTankmen(self): Waiting.show('updateTankmen') tankmen = yield Requester('tankman').getFromInventory() vehicles = yield Requester('vehicle').getFromInventory() vehicle = None if g_currentVehicle.isPresent(): for veh in vehicles: if veh.inventoryId == g_currentVehicle.invID: vehicle = veh break if vehicle is None: LOG_ERROR('Vehicle not found', g_currentVehicle.invID) Waiting.hide('updateTankmen') return crew = [] for tId in vehicle.crew: if tId is None: crew.append(None) continue for tankman in tankmen: if tankman.inventoryId == tId: crew.append(tankman) vehicle = g_currentVehicle.item commander_bonus = vehicle.bonuses['commander'] roles = [] brotherhood_bonus = getSkillsConfig()['brotherhood']['crewLevelIncrease'] for t in crew: if t is None or 'brotherhood' not in t.skills or t.skills.index('brotherhood') == len(t.skills) - 1 and t.lastSkillLevel != 100: brotherhood_bonus = 0 break lessMastered = 0 tankmenDescrs = dict(vehicle.crew) for slotIdx, tman in vehicle.crew: if slotIdx > 0 and tman is not None and (tankmenDescrs[lessMastered] is None or compareMastery(tankmenDescrs[lessMastered].descriptor, tman.descriptor) > 0): lessMastered = slotIdx role = vehicle.descriptor.type.crewRoles[slotIdx][0] roles.append({'tankmanID': tman.invID if tman is not None else None, 'roleType': role, 'role': convert(getSkillsConfig()[role]['userString']), 'roleIcon': '%s/%s' % (Tankman.ROLE_ICON_PATH_BIG, getSkillsConfig()[role]['icon']), 'nationID': vehicle.nationID, 'typeID': vehicle.innationID, 'slot': slotIdx, 'vehicleType': vehicle.shortUserName, 'tankType': vehicle.type, 'vehicleElite': vehicle.isPremium, 'roles': list(vehicle.descriptor.type.crewRoles[slotIdx])}) tankmenData = [] crewIDs = vehicle.crewIndices.keys() for tankman in tankmen: if not tankman.isInTank or tankman.inventoryId in crewIDs: bonus_role_level = commander_bonus if tankman.descriptor.role != 'commander' else 0.0 skills_count = len(list(ACTIVE_SKILLS)) skillsList = [] for skill in tankman.skills: skillLevel = tankman.lastSkillLevel if tankman.skills.index(skill) == len(tankman.skills) - 1 else 100 skillsList.append({'tankmanID': tankman.inventoryId, 'id': skill, 'name': getSkillsConfig()[skill]['userString'], 'desc': getSkillsConfig()[skill]['description'], 'icon': getSkillsConfig()[skill]['icon'], 'level': tankman.lastSkillLevel, 'active': skill not in PERKS or skill == 'brotherhood' and brotherhood_bonus != 0 or skill != 'brotherhood' and skillLevel == 100}) newSkillsCount, lastNewSkillLvl = tankman.newSkillCount if newSkillsCount > 0: skillsList.append({'buy': True, 'tankmanID': tankman.inventoryId, 'level': lastNewSkillLvl}) tankmanData = {'firstname': tankman.firstname, 'lastname': tankman.lastname, 'rank': tankman.rank, 'specializationLevel': tankman.roleLevel, 'role': tankman.role, 'vehicleType': tankman.vehicle.type.shortUserString, 'iconFile': tankman.icon, 'rankIconFile': tankman.iconRank, 'roleIconFile': '%s/%s' % (Tankman.ROLE_ICON_PATH_BIG, tankman.iconRole), 'contourIconFile': tankman.vehicleIconContour, 'tankmanID': tankman.inventoryId, 'nationID': tankman.nation, 'typeID': tankman.vehicle.type.id[1], 'inTank': tankman.isInTank, 'roleType': tankman.descriptor.role, 'tankType': tankman.vehicleType, 'efficiencyLevel': tankman.efficiencyRoleLevel(vehicle.descriptor), 'bonus': bonus_role_level, 'lastSkillLevel': tankman.lastSkillLevel, 'isLessMastered': vehicle.crewIndices.get(tankman.inventoryId) == lessMastered and vehicle.isXPToTman, 'compact': tankman.pack(), 'availableSkillsCount': skills_count, 'skills': skillsList} tankmenData.append(tankmanData) self.as_tankmenResponseS(roles, tankmenData) Waiting.hide('updateTankmen') return
def updateTankmen(self): Waiting.show("updateTankmen") if g_currentVehicle.isPresent(): tankmen = g_itemsCache.items.getTankmen() vehicle = g_currentVehicle.item commander_bonus = vehicle.bonuses["commander"] roles = [] lessMastered = 0 tankmenDescrs = dict(vehicle.crew) for slotIdx, tman in vehicle.crew: if ( slotIdx > 0 and tman is not None and ( tankmenDescrs[lessMastered] is None or compareMastery(tankmenDescrs[lessMastered].descriptor, tman.descriptor) > 0 ) ): lessMastered = slotIdx role = vehicle.descriptor.type.crewRoles[slotIdx][0] roles.append( { "tankmanID": tman.invID if tman is not None else None, "roleType": role, "role": convert(getSkillsConfig()[role]["userString"]), "roleIcon": Tankman.getRoleBigIconPath(role), "nationID": vehicle.nationID, "typeID": vehicle.innationID, "slot": slotIdx, "vehicleType": vehicle.shortUserName, "tankType": vehicle.type, "vehicleElite": vehicle.isPremium or vehicle.isPremiumIGR, "roles": list(vehicle.descriptor.type.crewRoles[slotIdx]), } ) tankmenData = [] for tankman in tankmen.itervalues(): if tankman.isInTank and tankman.vehicleInvID != vehicle.invID: continue tankmanVehicle = g_itemsCache.items.getItemByCD(tankman.vehicleNativeDescr.type.compactDescr) bonus_role_level = commander_bonus if tankman.descriptor.role != "commander" else 0.0 skills_count = len(list(ACTIVE_SKILLS)) skillsList = [] for skill in tankman.skills: skillsList.append( { "tankmanID": tankman.invID, "id": str(tankman.skills.index(skill)), "name": skill.userName, "desc": skill.description, "icon": skill.icon, "level": skill.level, "active": skill.isEnable and skill.isActive, } ) newSkillsCount, lastNewSkillLvl = tankman.newSkillCount if newSkillsCount > 0: skillsList.append({"buy": True, "tankmanID": tankman.invID, "level": lastNewSkillLvl}) tankmanData = { "firstName": tankman.firstUserName, "lastName": tankman.lastUserName, "rank": tankman.rankUserName, "specializationLevel": tankman.realRoleLevel[0], "role": tankman.roleUserName, "vehicleType": tankmanVehicle.shortUserName, "iconFile": tankman.icon, "rankIconFile": tankman.iconRank, "roleIconFile": Tankman.getRoleBigIconPath(tankman.descriptor.role), "contourIconFile": tankmanVehicle.iconContour, "tankmanID": tankman.invID, "nationID": tankman.nationID, "typeID": tankmanVehicle.innationID, "inTank": tankman.isInTank, "roleType": tankman.descriptor.role, "tankType": tankmanVehicle.type, "efficiencyLevel": tankman.efficiencyRoleLevel, "bonus": bonus_role_level, "lastSkillLevel": tankman.descriptor.lastSkillLevel, "isLessMastered": vehicle.crewIndices.get(tankman.invID) == lessMastered and vehicle.isXPToTman, "compact": tankman.strCD, "availableSkillsCount": skills_count, "skills": skillsList, } tankmenData.append(tankmanData) self.as_tankmenResponseS({"roles": roles, "tankmen": tankmenData}) dogName = "" if "dog" in g_itemsCache.items.getItemByCD(g_currentVehicle.item.intCD).tags: dogName = MENU.HANGAR_CREW_RODY_DOG_NAME self.as_dogResponseS(dogName) Waiting.hide("updateTankmen") return