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
Ejemplo n.º 2
0
 def getCommonData(self, callback):
     items = g_itemsCache.items
     tankman = items.getTankman(self.tmanInvID)
     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)
     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]})
     callback({'tankman': packTankman(tankman),
      'currentVehicle': packVehicle(currentVehicle) if currentVehicle is not None else None,
      'nativeVehicle': packVehicle(nativeVehicle),
      'isOpsLocked': isLocked or g_currentVehicle.isLocked(),
      'lockMessage': reason,
      'modifiers': modifiers,
      'enoughFreeXPForTeaching': enoughFreeXPForTeaching})
Ejemplo n.º 3
0
 def getCommonData(self, callback):
     items = self.itemsCache.items
     tankman = items.getTankman(self.tmanInvID)
     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 = ''
     else:
         tooltipChangeRole = makeTooltip(TOOLTIPS.CREW_ROLECHANGEFORBID_HEADER, TOOLTIPS.CREW_ROLECHANGEFORBID_TEXT)
     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]})
     callback({'tankman': packTankman(tankman),
      'currentVehicle': packVehicle(currentVehicle) if currentVehicle is not None else None,
      'nativeVehicle': packVehicle(nativeVehicle),
      'isOpsLocked': isLocked or g_currentVehicle.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})
     return
Ejemplo n.º 4
0
 def getCommonData(self, callback):
     items = g_itemsCache.items
     tankman = items.getTankman(self.tmanInvID)
     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)
     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]})
     callback({
         'tankman':
         packTankman(tankman),
         'currentVehicle':
         packVehicle(currentVehicle)
         if currentVehicle is not None else None,
         'nativeVehicle':
         packVehicle(nativeVehicle),
         'isOpsLocked':
         isLocked or g_currentVehicle.isLocked(),
         'lockMessage':
         reason,
         'modifiers':
         modifiers,
         'enoughFreeXPForTeaching':
         enoughFreeXPForTeaching
     })
     return
Ejemplo n.º 5
0
 def getCommonData(self, callback):
     items = g_itemsCache.items
     tankman = items.getTankman(self.tmanInvID)
     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)
     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]})
     callback(
         {
             "tankman": packTankman(tankman),
             "currentVehicle": packVehicle(currentVehicle) if currentVehicle is not None else None,
             "nativeVehicle": packVehicle(nativeVehicle),
             "isOpsLocked": isLocked or g_currentVehicle.isLocked(),
             "lockMessage": reason,
             "modifiers": modifiers,
             "enoughFreeXPForTeaching": enoughFreeXPForTeaching,
         }
     )
     return