Пример #1
0
 def __init__(self, tankmen, vehicle, tmanCostTypeIdx):
     super(TankmanCrewRetraining, self).__init__(
         (plugins.VehicleValidator(vehicle, False),
          plugins.GroupOperationsValidator(tankmen, tmanCostTypeIdx),
          plugins.MessageConfirmator('tankmanRetraining/unknownVehicle',
                                     ctx={'tankname': vehicle.userName},
                                     isEnabled=not vehicle.isInInventory)))
     self.tankmen = tankmen
     self.vehicle = vehicle
     self.tmanCostTypeIdx = tmanCostTypeIdx
Пример #2
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
Пример #3
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)))