def getCommonData(self, callback): items = self.itemsCache.items tankman = items.getTankman(self.tmanInvID) changeRoleCost = items.shop.changeRoleCost defaultChangeRoleCost = items.shop.defaults.changeRoleCost if changeRoleCost != defaultChangeRoleCost and not self.bootcamp.isInBootcamp(): discount = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'changeRoleCost', True, Money(gold=changeRoleCost), Money(gold=defaultChangeRoleCost)) else: discount = None rate = items.shop.freeXPToTManXPRate if rate: toNextPrcLeft = roundByModulo(tankman.getNextLevelXpCost(), rate) enoughFreeXPForTeaching = items.stats.freeXP - max(1, toNextPrcLeft / rate) >= 0 else: enoughFreeXPForTeaching = False nativeVehicle = items.getItemByCD(tankman.vehicleNativeDescr.type.compactDescr) currentVehicle = None if tankman.isInTank: currentVehicle = items.getItemByCD(tankman.vehicleDescr.type.compactDescr) isLocked, reason = self.__getTankmanLockMessage(currentVehicle) td = tankman.descriptor changeRoleEnabled = tankmen.tankmenGroupCanChangeRole(td.nationID, td.gid, td.isPremium) if changeRoleEnabled: tooltipChangeRole = makeTooltip(TOOLTIPS.CREW_ROLECHANGE_HEADER, TOOLTIPS.CREW_ROLECHANGE_TEXT) else: roleStr = i18n.makeString(TOOLTIPS.crewRole(td.role)) tooltipChangeRole = makeTooltip(TOOLTIPS.CREW_ROLECHANGEFORBID_HEADER, i18n.makeString(TOOLTIPS.CREW_ROLECHANGEFORBID_TEXT, role=roleStr)) showDocumentTab = not td.getRestrictions().isPassportReplacementForbidden() bonuses = tankman.realRoleLevel[1] modifiers = [] if bonuses[0]: modifiers.append({'id': 'fromCommander', 'val': bonuses[0]}) if bonuses[1]: modifiers.append({'id': 'fromSkills', 'val': bonuses[1]}) if bonuses[2] or bonuses[3]: modifiers.append({'id': 'fromEquipment', 'val': bonuses[2] + bonuses[3]}) if bonuses[4]: modifiers.append({'id': 'penalty', 'val': bonuses[4]}) tankmanData = packTankman(tankman) repackTankmanWithSkinData(tankman, tankmanData) callback({'tankman': tankmanData, 'currentVehicle': packVehicle(currentVehicle) if currentVehicle is not None else None, 'nativeVehicle': packVehicle(nativeVehicle), 'isOpsLocked': isLocked, 'lockMessage': reason, 'modifiers': modifiers, 'enoughFreeXPForTeaching': enoughFreeXPForTeaching, 'tabsData': self.getTabsButtons(showDocumentTab), 'tooltipDismiss': TOOLTIPS.BARRACKS_TANKMEN_DISMISS, 'tooltipUnload': TOOLTIPS.BARRACKS_TANKMEN_UNLOAD, 'dismissEnabled': True, 'unloadEnabled': True, 'changeRoleEnabled': changeRoleEnabled, 'tooltipChangeRole': tooltipChangeRole, 'actionChangeRole': discount}) return
def getCrewComment(skill, crewLevel, role, forOne): if skill.name == 'new': if forOne: tKey = TOOLTIPS.VEHICLEPREVIEW_VEHICLEPANEL_INFO_HEADER_CREW_NEWSKILL_FORONE else: tKey = TOOLTIPS.VEHICLEPREVIEW_VEHICLEPANEL_INFO_HEADER_CREW_NEWSKILL_FORALL elif forOne: tKey = TOOLTIPS.VEHICLEPREVIEW_VEHICLEPANEL_INFO_HEADER_CREW_ONESKILL_FORONE else: tKey = TOOLTIPS.VEHICLEPREVIEW_VEHICLEPANEL_INFO_HEADER_CREW_ONESKILL_FORALL return _ms(key=tKey, level=crewLevel, role=_ms(TOOLTIPS.crewRole(role)) if role != '' else None, skillType=_ms( TOOLTIPS.VEHICLEPREVIEW_VEHICLEPANEL_INFO_HEADER_CREW_ISPERK if skill.isPerk else TOOLTIPS. VEHICLEPREVIEW_VEHICLEPANEL_INFO_HEADER_CREW_ISABILLITY), skillName=text_styles.statusAttention( _ms(MENU.QUOTE, string=skill.userName)))