コード例 #1
0
 def __init__(self, tankman, vehicle, tmanCostTypeIdx):
     hasUndistributedExp = False
     isGoldPrice = tmanCostTypeIdx == 2
     if not isGoldPrice:
         canLearnSkills, lastSkillLevel = tankman.newSkillCount
         hasUndistributedExp = lastSkillLevel > 0 or canLearnSkills > 1
     self.vehicle = vehicle
     self.tmanCostTypeIdx = tmanCostTypeIdx
     self.tmanCost = self._getRecruitPrice(self.tmanCostTypeIdx)
     ctx = {'tankname': vehicle.userName}
     if isGoldPrice:
         ctx['price'] = formatPrice(self.tmanCost,
                                    reverse=True,
                                    useIcon=True,
                                    useStyle=True)
     super(TankmanRetraining, self).__init__(
         tankman,
         (plugins.VehicleValidator(
             vehicle, False), plugins.TankmanLockedValidator(tankman),
          plugins.VehicleCrewLockedValidator(vehicle),
          plugins.MessageConfirmator('tankmanRetraining/knownVehicleByGold',
                                     ctx=ctx,
                                     isEnabled=vehicle.isInInventory
                                     and isGoldPrice),
          plugins.MessageConfirmator(
              'tankmanRetraining/unknownVehicleByGold',
              ctx=ctx,
              isEnabled=not vehicle.isInInventory and isGoldPrice),
          plugins.MessageConfirmator('tankmanRetraining/unknownVehicle',
                                     ctx=ctx,
                                     isEnabled=not vehicle.isInInventory
                                     and not isGoldPrice),
          plugins.MessageConfirmator('tankmanRetraining/undistributedExp',
                                     ctx=ctx,
                                     isEnabled=hasUndistributedExp)))
コード例 #2
0
 def __init__(self, vehicle):
     self.__prefix = 'return_crew'
     self.__vehicle = vehicle
     super(TankmanReturn, self).__init__(
         (plugins.VehicleValidator(self.__vehicle,
                                   False,
                                   prop={'isLocked': True}),
          plugins.VehicleCrewLockedValidator(vehicle)))
コード例 #3
0
 def __init__(self, nationID, vehTypeID, role, tokenName, tokenData):
     vehicle = self.itemsCache.items.getItemByCD(makeIntCompactDescrByID('vehicle', nationID, vehTypeID))
     super(TankmanTokenRecruit, self).__init__([plugins.VehicleCrewLockedValidator(vehicle), plugins.IsLongDisconnectedFromCenter()])
     self.nationID = nationID
     self.vehTypeID = vehTypeID
     self.role = role
     self.tokenName = tokenName
     self.recruitInfo = tokenData
     self.vehicleName = vehicle.shortUserName
コード例 #4
0
 def __init__(self, personalMission, needTankman, nationID, inNationID, role):
     plugs = [plugins.PersonalMissionRewardValidator(personalMission)]
     if needTankman:
         plugs.insert(0, plugins.VehicleCrewLockedValidator(self.itemsCache.items.getItem(ITEM_TYPES.vehicle, nationID, inNationID)))
     super(_PersonalMissionsGetReward, self).__init__(tuple(plugs))
     self.__quest = personalMission
     self.__nationID = nationID
     self.__inNationID = inNationID
     self.__role = role
     self.__needTankman = needTankman
コード例 #5
0
 def __init__(self, nationID, vehTypeID, role, tmanCostTypeIdx):
     super(TankmanRecruit, self).__init__([plugins.VehicleCrewLockedValidator(self.itemsCache.items.getItemByCD(makeIntCompactDescrByID('vehicle', nationID, vehTypeID))),
      plugins.MoneyValidator(self.__getRecruitPrice(tmanCostTypeIdx)),
      plugins.FreeTankmanValidator(isEnabled=tmanCostTypeIdx == 0),
      plugins.BarracksSlotsValidator(),
      plugins.IsLongDisconnectedFromCenter()])
     self.nationID = nationID
     self.vehTypeID = vehTypeID
     self.role = role
     self.tmanCostTypeIdx = tmanCostTypeIdx
コード例 #6
0
ファイル: quests.py プロジェクト: mahmoudimus/WOT-0.9.20.0
 def __init__(self, potapovQuestItem, needTankman, nationID, inNationID, role):
     plugs = [plugins.PotapovQuestValidator([potapovQuestItem]), plugins.PotapovQuestRewardValidator(potapovQuestItem)]
     if needTankman:
         plugs.insert(0, plugins.VehicleCrewLockedValidator(self.itemsCache.items.getItem(ITEM_TYPES.vehicle, nationID, inNationID)))
     super(_PotapovQuestsGetReward, self).__init__(tuple(plugs))
     self.__quest = potapovQuestItem
     self.__nationID = nationID
     self.__inNationID = inNationID
     self.__role = role
     self.__needTankman = needTankman
コード例 #7
0
 def __init__(self, tankman, role, vehTypeCompDescr):
     self.__roleIdx = SKILL_INDICES[role]
     self.__vehTypeCompDescr = vehTypeCompDescr
     self.__changeRoleCost = self.itemsCache.items.shop.changeRoleCost
     vehicle = self.itemsCache.items.getItemByCD(self.__vehTypeCompDescr)
     super(TankmanChangeRole, self).__init__(tankman, (plugins.TankmanLockedValidator(tankman),
      plugins.VehicleCrewLockedValidator(vehicle),
      plugins.MessageConfirmator('tankmanChageRole/unknownVehicle', ctx={'tankname': vehicle.userName}, isEnabled=not vehicle.isInInventory),
      plugins.VehicleValidator(vehicle, False),
      plugins.VehicleRoleValidator(vehicle, role, tankman),
      plugins.MoneyValidator(Money(gold=self.__changeRoleCost))))
コード例 #8
0
 def __init__(self, vehicle, slot, tmanCostTypeIdx):
     super(TankmanRecruitAndEquip, self).__init__()
     self.vehicle = vehicle
     self.slot = slot
     self.tmanCostTypeIdx = tmanCostTypeIdx
     self.isReplace = dict(vehicle.crew).get(slot) is not None
     self.addPlugins((plugins.VehicleValidator(vehicle, False, prop={'isLocked': True}),
      plugins.VehicleCrewLockedValidator(vehicle),
      plugins.MoneyValidator(self.__getRecruitPrice(tmanCostTypeIdx)),
      plugins.FreeTankmanValidator(isEnabled=tmanCostTypeIdx == 0),
      plugins.BarracksSlotsValidator(isEnabled=self.isReplace)))
     return
コード例 #9
0
 def __init__(self, tankman, vehicle, tmanCostTypeIdx):
     hasUndistributedExp = False
     if tmanCostTypeIdx != 2:
         canLearnSkills, lastSkillLevel = tankman.newSkillCount
         hasUndistributedExp = lastSkillLevel > 0 or canLearnSkills > 1
     super(TankmanRetraining, self).__init__(tankman, (plugins.VehicleValidator(vehicle, False),
      plugins.TankmanLockedValidator(tankman),
      plugins.VehicleCrewLockedValidator(vehicle),
      plugins.MessageConfirmator('tankmanRetraining/unknownVehicle', ctx={'tankname': vehicle.userName}, isEnabled=not vehicle.isInInventory),
      plugins.MessageConfirmator('tankmanRetraining/undistributedExp', ctx={}, isEnabled=hasUndistributedExp)))
     self.vehicle = vehicle
     self.tmanCostTypeIdx = tmanCostTypeIdx
     self.tmanCost = self._getRecruitPrice(self.tmanCostTypeIdx)
コード例 #10
0
 def __init__(self, vehicle, slot=-1):
     super(TankmanUnload, self).__init__()
     self.vehicle = vehicle
     self.slot = slot
     berthsNeeded = 1
     if slot == -1:
         berthsNeeded = len(
             [item for item in vehicle.crew if item[1] is not None])
     self.__sysMsgPrefix = 'unload_tankman' if berthsNeeded == 1 else 'unload_crew'
     self.addPlugins([
         plugins.VehicleValidator(vehicle, False, prop={'isLocked': True}),
         plugins.VehicleCrewLockedValidator(vehicle),
         plugins.BarracksSlotsValidator(berthsNeeded)
     ])
     return
コード例 #11
0
 def __init__(self, tankman, vehicle, slot):
     super(TankmanEquip, self).__init__()
     self.tankman = tankman
     self.vehicle = vehicle
     self.slot = slot
     self.isReequip = False
     anotherTankman = dict(vehicle.crew).get(slot)
     if tankman is not None and anotherTankman is not None and anotherTankman.invID != tankman.invID:
         self.isReequip = True
     self.addPlugins((plugins.TankmanLockedValidator(tankman),
      plugins.VehicleCrewLockedValidator(vehicle),
      plugins.VehicleValidator(vehicle, False, prop={'isLocked': True}),
      plugins.ModuleValidator(tankman),
      plugins.ModuleTypeValidator(tankman, (GUI_ITEM_TYPE.TANKMAN,))))
     return
コード例 #12
0
    def __init__(self, tmen, vehicle, tmanCostTypeIdx):
        hasUndistributedExp = False
        if tmanCostTypeIdx != 2:
            for tmanInvID in tmen:
                canLearnSkills, lastSkillLevel = self.itemsCache.items.getTankman(tmanInvID).newSkillCount
                hasUndistributedExp = lastSkillLevel > 0 or canLearnSkills > 1
                if hasUndistributedExp:
                    break

        super(TankmanCrewRetraining, self).__init__((plugins.VehicleValidator(vehicle, False),
         plugins.VehicleCrewLockedValidator(vehicle),
         plugins.GroupOperationsValidator(tmen, tmanCostTypeIdx),
         plugins.MessageConfirmator('tankmanRetraining/unknownVehicle', ctx={'tankname': vehicle.userName}, isEnabled=not vehicle.isInInventory),
         plugins.MessageConfirmator('tankmanRetraining/undistributedExp', ctx={}, isEnabled=hasUndistributedExp)))
        self.tankmen = tmen
        self.vehicle = vehicle
        self.tmanCostTypeIdx = tmanCostTypeIdx
コード例 #13
0
 def __init__(self, tankman, role, vehTypeCompDescr):
     self.__roleIdx = SKILL_INDICES[role]
     self.__vehTypeCompDescr = vehTypeCompDescr
     self.__changeRoleCost = self.itemsCache.items.shop.changeRoleCost
     vehicle = self.itemsCache.items.getItemByCD(self.__vehTypeCompDescr)
     super(TankmanChangeRole, self).__init__(
         tankman,
         (plugins.TankmanLockedValidator(tankman),
          plugins.VehicleCrewLockedValidator(vehicle),
          plugins.MessageConfirmator('tankmanChageRole/unknownVehicle',
                                     ctx={'tankname': vehicle.userName},
                                     isEnabled=not vehicle.isInInventory),
          plugins.VehicleValidator(vehicle, False),
          plugins.VehicleRoleValidator(vehicle, role, tankman),
          plugins.MoneyValidator(Money(gold=self.__changeRoleCost))))
     self.__compensationPriceObject = None
     self.__compensationRequired = False
     lobbyContext = dependency.instance(ILobbyContext)
     equippedSkinID = tankman.skinID
     if equippedSkinID != NO_CREW_SKIN_ID and lobbyContext.getServerSettings(
     ).isCrewSkinsEnabled():
         crewSkinItem = self.itemsCache.items.getCrewSkin(equippedSkinID)
         roleMismatch = crewSkinItem.getRoleID(
         ) is not None and crewSkinItem.getRoleID() != role
         self.__compensationPriceObject = crewSkinItem.getBuyPrice()
         self.__compensationRequired = roleMismatch and not crewSkinItem.isStorageAvailable(
         )
         self.addPlugins(
             (plugins.CrewSkinsRoleChangeRemovalConfirmator(
                 'crewSkins/skinWillBeRemoved',
                 ctx={'items': [crewSkinItem]},
                 isEnabled=roleMismatch
                 and crewSkinItem.isStorageAvailable()),
              plugins.CrewSkinsCompensationDialogConfirmator(
                  'crewSkins/skinWillBeDeleted',
                  plugins.CrewSkinsRemovalCompensationDialogMeta.
                  ROLE_MISMATCH_SUFFIX,
                  ctx={
                      'price': self.__compensationPriceObject,
                      'items': [crewSkinItem]
                  },
                  isEnabled=self.__compensationRequired)))
     return
コード例 #14
0
ファイル: tankman.py プロジェクト: mahmoudimus/WOT-0.9.20.0
 def __init__(self, vehicle, slot=-1):
     """
     Ctor.
     
     @param vehicle: vehicle to unload tankman
     @param slot:    slot in given vehicle to unload. -1 by default,
                                     that means - unload all tankmen from vehicle.
     """
     super(TankmanUnload, self).__init__()
     self.vehicle = vehicle
     self.slot = slot
     berthsNeeded = 1
     if slot == -1:
         berthsNeeded = len(
             filter(lambda (role, t): t is not None, vehicle.crew))
     self.__sysMsgPrefix = 'unload_tankman' if berthsNeeded == 1 else 'unload_crew'
     self.addPlugins([
         plugins.VehicleValidator(vehicle, False, prop={'isLocked': True}),
         plugins.VehicleCrewLockedValidator(vehicle),
         plugins.BarracksSlotsValidator(berthsNeeded)
     ])
コード例 #15
0
    def __init__(self, tmen, vehicle, tmanCostTypeIdx):
        hasUndistributedExp = False
        isGoldPrice = tmanCostTypeIdx == 2
        if not isGoldPrice:
            for tmanInvID in tmen:
                canLearnSkills, lastSkillLevel = self.itemsCache.items.getTankman(
                    tmanInvID).newSkillCount
                hasUndistributedExp = lastSkillLevel > 0 or canLearnSkills > 1
                if hasUndistributedExp:
                    break

        self.tankmen = tmen
        self.vehicle = vehicle
        self.tmanCostTypeIdx = tmanCostTypeIdx
        ctx = {'tankname': vehicle.userName}
        if isGoldPrice:
            ctx['price'] = formatPrice(Money(
                gold=self.itemsCache.items.shop.tankmanCost[tmanCostTypeIdx]
                ['gold'] * len(self.tankmen)),
                                       reverse=True,
                                       useIcon=True,
                                       useStyle=True)
        super(TankmanCrewRetraining, self).__init__(
            (plugins.VehicleValidator(vehicle, False),
             plugins.VehicleCrewLockedValidator(vehicle),
             plugins.GroupOperationsValidator(tmen, tmanCostTypeIdx),
             plugins.MessageConfirmator(
                 'tankmanRetraining/knownVehicleByGold/pack',
                 ctx=ctx,
                 isEnabled=isGoldPrice and len(tmen) > 1),
             plugins.MessageConfirmator('tankmanRetraining/knownVehicleByGold',
                                        ctx=ctx,
                                        isEnabled=isGoldPrice
                                        and len(tmen) == 1),
             plugins.MessageConfirmator('tankmanRetraining/unknownVehicle',
                                        ctx=ctx,
                                        isEnabled=not vehicle.isInInventory),
             plugins.MessageConfirmator('tankmanRetraining/undistributedExp',
                                        ctx=ctx,
                                        isEnabled=hasUndistributedExp)))