예제 #1
0
 def __init__(self, strCompactDescr, inventoryID=-1, vehicle=None, dismissedAt=None, proxy=None):
     GUIItem.__init__(self, proxy)
     HasStrCD.__init__(self, strCompactDescr)
     self.__descriptor = None
     self.invID = inventoryID
     self.nationID = self.descriptor.nationID
     self.itemTypeID = GUI_ITEM_TYPE.TANKMAN
     self.itemTypeName = ITEM_TYPE_NAMES[self.itemTypeID]
     self.combinedRoles = (self.descriptor.role,)
     self.dismissedAt = dismissedAt
     self.isDismissed = self.dismissedAt is not None
     self.vehicleNativeDescr = vehicles.VehicleDescr(typeID=(self.nationID, self.descriptor.vehicleTypeID))
     self.vehicleInvID = -1
     self.vehicleDescr = None
     self.vehicleBonuses = dict()
     self.vehicleSlotIdx = -1
     if vehicle is not None:
         self.vehicleInvID = vehicle.invID
         self.vehicleDescr = vehicle.descriptor
         self.vehicleBonuses = dict(vehicle.bonuses)
         self.vehicleSlotIdx = vehicle.crewIndices.get(inventoryID, -1)
         crewRoles = self.vehicleDescr.type.crewRoles
         if -1 < self.vehicleSlotIdx < len(crewRoles):
             self.combinedRoles = crewRoles[self.vehicleSlotIdx]
     self.skills = self._buildSkills(proxy)
     self.skillsMap = self._buildSkillsMap()
     if proxy is not None:
         pass
     self.__cmp__ = TankmenComparator()
     return
예제 #2
0
 def __init__(self, strCompactDescr, inventoryID = -1, vehicle = None, proxy = None):
     """
     Ctor.
     
     @param strCompactDescr: string compact descriptor
     @param inventoryID: tankman's inventory id
     @param vehicle: tankman's vehicle where it has been seat
     @param proxy: instance of ItemsRequester
     """
     GUIItem.__init__(self, proxy)
     HasStrCD.__init__(self, strCompactDescr)
     self.__descriptor = None
     self.invID = inventoryID
     self.nationID = self.descriptor.nationID
     self.itemTypeID = vehicles._TANKMAN
     self.itemTypeName = ITEM_TYPE_NAMES[self.itemTypeID]
     self.combinedRoles = (self.descriptor.role,)
     self.vehicleNativeDescr = vehicles.VehicleDescr(typeID=(self.nationID, self.descriptor.vehicleTypeID))
     self.vehicleInvID = -1
     self.vehicleDescr = None
     self.vehicleBonuses = dict()
     self.vehicleSlotIdx = -1
     if vehicle is not None:
         self.vehicleInvID = vehicle.invID
         self.vehicleDescr = vehicle.descriptor
         self.vehicleBonuses = dict(vehicle.bonuses)
         self.vehicleSlotIdx = vehicle.crewIndices.get(inventoryID, -1)
         crewRoles = self.vehicleDescr.type.crewRoles
         if -1 < self.vehicleSlotIdx < len(crewRoles):
             self.combinedRoles = crewRoles[self.vehicleSlotIdx]
     self.skills = self._buildSkills(proxy)
     self.skillsMap = self._buildSkillsMap()
     if proxy is not None:
         pass
     self.__cmp__ = TankmenComparator()
예제 #3
0
 def __init__(self,
              strCompactDescr,
              inventoryID=-1,
              vehicle=None,
              proxy=None):
     GUIItem.__init__(self, proxy)
     HasStrCD.__init__(self, strCompactDescr)
     self.__descriptor = None
     self.invID = inventoryID
     self.nationID = self.descriptor.nationID
     self.itemTypeID = vehicles._TANKMAN
     self.itemTypeName = ITEM_TYPE_NAMES[self.itemTypeID]
     self.combinedRoles = (self.descriptor.role, )
     self.vehicleNativeDescr = vehicles.VehicleDescr(
         typeID=(self.nationID, self.descriptor.vehicleTypeID))
     self.vehicleInvID = -1
     self.vehicleDescr = None
     self.vehicleBonuses = dict()
     self.vehicleSlotIdx = -1
     if vehicle is not None:
         self.vehicleInvID = vehicle.invID
         self.vehicleDescr = vehicle.descriptor
         self.vehicleBonuses = dict(vehicle.bonuses)
         self.vehicleSlotIdx = vehicle.crewIndices.get(inventoryID, -1)
         crewRoles = self.vehicleDescr.type.crewRoles
         if -1 < self.vehicleSlotIdx < len(crewRoles):
             self.combinedRoles = crewRoles[self.vehicleSlotIdx]
     self.skills = self._buildSkills(proxy)
     self.skillsMap = self._buildSkillsMap()
     if proxy is not None:
         pass
     self.__cmp__ = TankmenComparator()
예제 #4
0
    def __init__(self, strCompactDescr = None, inventoryID = -1, typeCompDescr = None, proxy = None):
        if strCompactDescr is not None:
            vehDescr = vehicles.VehicleDescr(compactDescr=strCompactDescr)
        else:
            raise typeCompDescr is not None or AssertionError
            _, nID, innID = vehicles.parseIntCompactDescr(typeCompDescr)
            vehDescr = vehicles.VehicleDescr(typeID=(nID, innID))
        self.__descriptor = vehDescr
        HasStrCD.__init__(self, strCompactDescr)
        FittingItem.__init__(self, vehDescr.type.compactDescr, proxy)
        self.inventoryID = inventoryID
        self.xp = 0
        self.dailyXPFactor = -1
        self.isElite = False
        self.clanLock = 0
        self.isUnique = self.isHidden
        invData = dict()
        if proxy is not None:
            invDataTmp = proxy.inventory.getItems(vehicles._VEHICLE, inventoryID)
            if invDataTmp is not None:
                invData = invDataTmp
            self.xp = proxy.stats.vehiclesXPs.get(self.intCD, self.xp)
            self.dailyXPFactor = proxy.shop.dailyXPFactor if self.intCD not in proxy.stats.multipliedVehicles else self.dailyXPFactor
            self.isElite = len(vehDescr.type.unlocksDescrs) == 0 or self.intCD in proxy.stats.eliteVehicles
            clanDamageLock = proxy.stats.vehicleTypeLocks.get(self.intCD, {}).get(CLAN_LOCK, 0)
            clanNewbieLock = proxy.stats.globalVehicleLocks.get(CLAN_LOCK, 0)
            self.clanLock = clanDamageLock or clanNewbieLock
        self.inventoryCount = 1 if len(invData.keys()) else 0
        self.settings = invData.get('settings', 0)
        self.lock = invData.get('lock', 0)
        self.repairCost, self.health = invData.get('repair', (0, 0))
        self.gun = VehicleGun(vehDescr.gun['compactDescr'], proxy, vehDescr.gun)
        self.turret = VehicleTurret(vehDescr.turret['compactDescr'], proxy, vehDescr.turret)
        self.engine = VehicleEngine(vehDescr.engine['compactDescr'], proxy, vehDescr.engine)
        self.chassis = VehicleChassis(vehDescr.chassis['compactDescr'], proxy, vehDescr.chassis)
        self.radio = VehicleRadio(vehDescr.radio['compactDescr'], proxy, vehDescr.radio)
        self.fuelTank = VehicleFuelTank(vehDescr.fuelTank['compactDescr'], proxy, vehDescr.fuelTank)
        self.sellPrice = self._calcSellPrice(proxy)
        self.optDevices = self._parserOptDevs(vehDescr.optionalDevices, proxy)
        gunAmmoLayout = []
        for shell in self.gun.defaultAmmo:
            gunAmmoLayout += (shell.intCD, shell.defaultCount)

        self.shells = self._parseShells(invData.get('shells', list()), invData.get('shellsLayout', dict()).get(self.shellsLayoutIdx, gunAmmoLayout), proxy)
        self.eqs = self._parseEqs(invData.get('eqs') or [0, 0, 0], proxy)
        self.eqsLayout = self._parseEqs(invData.get('eqsLayout') or [0, 0, 0], proxy)
        defaultCrew = [None] * len(vehDescr.type.crewRoles)
        crewList = invData.get('crew', defaultCrew)
        self.bonuses = self._calcCrewBonuses(crewList, proxy)
        self.crewIndices = dict([ (invID, idx) for idx, invID in enumerate(crewList) ])
        self.crew = self._buildCrew(crewList, proxy)
        return
예제 #5
0
 def __init__(self,
              strCompactDescr,
              inventoryID=-1,
              vehicle=None,
              proxy=None):
     """
     Ctor.
     
     @param strCompactDescr: string compact descriptor
     @param inventoryID: tankman's inventory id
     @param vehicle: tankman's vehicle where it has been seat
     @param proxy: instance of ItemsRequester
     """
     GUIItem.__init__(self, proxy)
     HasStrCD.__init__(self, strCompactDescr)
     self.__descriptor = None
     self.invID = inventoryID
     self.nationID = self.descriptor.nationID
     self.itemTypeID = vehicles._TANKMAN
     self.itemTypeName = ITEM_TYPE_NAMES[self.itemTypeID]
     self.combinedRoles = (self.descriptor.role, )
     self.vehicleNativeDescr = vehicles.VehicleDescr(
         typeID=(self.nationID, self.descriptor.vehicleTypeID))
     self.vehicleInvID = -1
     self.vehicleDescr = None
     self.vehicleBonuses = dict()
     self.vehicleSlotIdx = -1
     if vehicle is not None:
         self.vehicleInvID = vehicle.invID
         self.vehicleDescr = vehicle.descriptor
         self.vehicleBonuses = dict(vehicle.bonuses)
         self.vehicleSlotIdx = vehicle.crewIndices.get(inventoryID, -1)
         crewRoles = self.vehicleDescr.type.crewRoles
         if -1 < self.vehicleSlotIdx < len(crewRoles):
             self.combinedRoles = crewRoles[self.vehicleSlotIdx]
     self.skills = self._buildSkills(proxy)
     self.skillsMap = self._buildSkillsMap()
     if proxy is not None:
         pass
     return
예제 #6
0
    def __init__(self,
                 strCompactDescr=None,
                 inventoryID=-1,
                 typeCompDescr=None,
                 proxy=None):
        if strCompactDescr is not None:
            vehDescr = vehicles.VehicleDescr(compactDescr=strCompactDescr)
        else:
            raise typeCompDescr is not None or AssertionError
            _, nID, innID = vehicles.parseIntCompactDescr(typeCompDescr)
            vehDescr = vehicles.VehicleDescr(typeID=(nID, innID))
        self.__descriptor = vehDescr
        HasStrCD.__init__(self, strCompactDescr)
        FittingItem.__init__(self, vehDescr.type.compactDescr, proxy)
        self.inventoryID = inventoryID
        self.xp = 0
        self.dailyXPFactor = -1
        self.isElite = False
        self.isFullyElite = False
        self.clanLock = 0
        self.isUnique = self.isHidden
        self.rentPackages = []
        self.hasRentPackages = False
        self.isDisabledForBuy = False
        self.isSelected = False
        self.igrCustomizationsLayout = {}
        invData = dict()
        if proxy is not None and proxy.inventory.isSynced(
        ) and proxy.stats.isSynced() and proxy.shop.isSynced():
            invDataTmp = proxy.inventory.getItems(GUI_ITEM_TYPE.VEHICLE,
                                                  inventoryID)
            if invDataTmp is not None:
                invData = invDataTmp
            self.xp = proxy.stats.vehiclesXPs.get(self.intCD, self.xp)
            if proxy.shop.winXPFactorMode == WIN_XP_FACTOR_MODE.ALWAYS or self.intCD not in proxy.stats.multipliedVehicles and not self.isOnlyForEventBattles:
                self.dailyXPFactor = proxy.shop.dailyXPFactor
            self.isElite = len(
                vehDescr.type.unlocksDescrs
            ) == 0 or self.intCD in proxy.stats.eliteVehicles
            self.isFullyElite = self.isElite and len([
                data for data in vehDescr.type.unlocksDescrs
                if data[1] not in proxy.stats.unlocks
            ]) == 0
            clanDamageLock = proxy.stats.vehicleTypeLocks.get(self.intCD,
                                                              {}).get(
                                                                  CLAN_LOCK, 0)
            clanNewbieLock = proxy.stats.globalVehicleLocks.get(CLAN_LOCK, 0)
            self.clanLock = clanDamageLock or clanNewbieLock
            self.isDisabledForBuy = self.intCD in proxy.shop.getNotToBuyVehicles(
            )
            self.hasRentPackages = bool(proxy.shop.getVehicleRentPrices().get(
                self.intCD, {}))
            self.isSelected = bool(self.invID in proxy.stats.oldVehInvIDs)
            self.igrCustomizationsLayout = proxy.inventory.getIgrCustomizationsLayout(
            ).get(self.inventoryID, {})
        self.inventoryCount = 1 if len(invData.keys()) else 0
        data = invData.get('rent')
        if data is not None:
            self.rentInfo = RentalInfoProvider(isRented=True, *data)
        self.settings = invData.get('settings', 0)
        self.lock = invData.get('lock', (0, 0))
        self.repairCost, self.health = invData.get('repair', (0, 0))
        self.gun = VehicleGun(vehDescr.gun['compactDescr'], proxy,
                              vehDescr.gun)
        self.turret = VehicleTurret(vehDescr.turret['compactDescr'], proxy,
                                    vehDescr.turret)
        self.engine = VehicleEngine(vehDescr.engine['compactDescr'], proxy,
                                    vehDescr.engine)
        self.chassis = VehicleChassis(vehDescr.chassis['compactDescr'], proxy,
                                      vehDescr.chassis)
        self.radio = VehicleRadio(vehDescr.radio['compactDescr'], proxy,
                                  vehDescr.radio)
        self.fuelTank = VehicleFuelTank(vehDescr.fuelTank['compactDescr'],
                                        proxy, vehDescr.fuelTank)
        self.sellPrice = self._calcSellPrice(proxy)
        self.defaultSellPrice = self._calcDefaultSellPrice(proxy)
        self.optDevices = self._parserOptDevs(vehDescr.optionalDevices, proxy)
        gunAmmoLayout = []
        for shell in self.gun.defaultAmmo:
            gunAmmoLayout += (shell.intCD, shell.defaultCount)

        self.shells = self._parseShells(
            invData.get('shells', list()),
            invData.get('shellsLayout', dict()).get(self.shellsLayoutIdx,
                                                    gunAmmoLayout), proxy)
        self.eqs = self._parseEqs(invData.get('eqs') or [0, 0, 0], proxy)
        self.eqsLayout = self._parseEqs(
            invData.get('eqsLayout') or [0, 0, 0], proxy)
        defaultCrew = [None] * len(vehDescr.type.crewRoles)
        crewList = invData.get('crew', defaultCrew)
        self.bonuses = self._calcCrewBonuses(crewList, proxy)
        self.crewIndices = dict([(invID, idx)
                                 for idx, invID in enumerate(crewList)])
        self.crew = self._buildCrew(crewList, proxy)
        self.lastCrew = invData.get('lastCrew')
        self.rentPackages = calcRentPackages(self, proxy)
        self.__customState = ''
        return
예제 #7
0
    def __init__(self, strCompactDescr = None, inventoryID = -1, typeCompDescr = None, proxy = None):
        if strCompactDescr is not None:
            vehDescr = vehicles.VehicleDescr(compactDescr=strCompactDescr)
        else:
            raise typeCompDescr is not None or AssertionError
            _, nID, innID = vehicles.parseIntCompactDescr(typeCompDescr)
            vehDescr = vehicles.VehicleDescr(typeID=(nID, innID))
        self.__descriptor = vehDescr
        HasStrCD.__init__(self, strCompactDescr)
        FittingItem.__init__(self, vehDescr.type.compactDescr, proxy)
        self.inventoryID = inventoryID
        self.xp = 0
        self.dailyXPFactor = -1
        self.isElite = False
        self.isFullyElite = False
        self.clanLock = 0
        self.isUnique = self.isHidden
        self.rentPackages = []
        self.hasRentPackages = False
        self.isDisabledForBuy = False
        invData = dict()
        if proxy is not None and proxy.inventory.isSynced() and proxy.stats.isSynced() and proxy.shop.isSynced():
            invDataTmp = proxy.inventory.getItems(GUI_ITEM_TYPE.VEHICLE, inventoryID)
            if invDataTmp is not None:
                invData = invDataTmp
            self.xp = proxy.stats.vehiclesXPs.get(self.intCD, self.xp)
            if proxy.shop.winXPFactorMode == WIN_XP_FACTOR_MODE.ALWAYS or self.intCD not in proxy.stats.multipliedVehicles:
                self.dailyXPFactor = proxy.shop.dailyXPFactor
            self.isElite = len(vehDescr.type.unlocksDescrs) == 0 or self.intCD in proxy.stats.eliteVehicles
            self.isFullyElite = self.isElite and len([ data for data in vehDescr.type.unlocksDescrs if data[1] not in proxy.stats.unlocks ]) == 0
            clanDamageLock = proxy.stats.vehicleTypeLocks.get(self.intCD, {}).get(CLAN_LOCK, 0)
            clanNewbieLock = proxy.stats.globalVehicleLocks.get(CLAN_LOCK, 0)
            self.clanLock = clanDamageLock or clanNewbieLock
            self.isDisabledForBuy = self.intCD in proxy.shop.getNotToBuyVehicles()
            self.hasRentPackages = bool(proxy.shop.getVehicleRentPrices().get(self.intCD, {}))
        self.inventoryCount = 1 if len(invData.keys()) else 0
        data = invData.get('rent')
        if data is not None:
            self.rentInfo = RentalInfoProvider(isRented=True, *data)
        self.settings = invData.get('settings', 0)
        self.lock = invData.get('lock', (0, 0))
        self.repairCost, self.health = invData.get('repair', (0, 0))
        self.gun = VehicleGun(vehDescr.gun['compactDescr'], proxy, vehDescr.gun)
        self.turret = VehicleTurret(vehDescr.turret['compactDescr'], proxy, vehDescr.turret)
        self.engine = VehicleEngine(vehDescr.engine['compactDescr'], proxy, vehDescr.engine)
        self.chassis = VehicleChassis(vehDescr.chassis['compactDescr'], proxy, vehDescr.chassis)
        self.radio = VehicleRadio(vehDescr.radio['compactDescr'], proxy, vehDescr.radio)
        self.fuelTank = VehicleFuelTank(vehDescr.fuelTank['compactDescr'], proxy, vehDescr.fuelTank)
        self.sellPrice = self._calcSellPrice(proxy)
        self.defaultSellPrice = self._calcDefaultSellPrice(proxy)
        self.optDevices = self._parserOptDevs(vehDescr.optionalDevices, proxy)
        gunAmmoLayout = []
        for shell in self.gun.defaultAmmo:
            gunAmmoLayout += (shell.intCD, shell.defaultCount)

        self.shells = self._parseShells(invData.get('shells', list()), invData.get('shellsLayout', dict()).get(self.shellsLayoutIdx, gunAmmoLayout), proxy)
        self.eqs = self._parseEqs(invData.get('eqs') or [0, 0, 0], proxy)
        self.eqsLayout = self._parseEqs(invData.get('eqsLayout') or [0, 0, 0], proxy)
        defaultCrew = [None] * len(vehDescr.type.crewRoles)
        crewList = invData.get('crew', defaultCrew)
        self.bonuses = self._calcCrewBonuses(crewList, proxy)
        self.crewIndices = dict([ (invID, idx) for idx, invID in enumerate(crewList) ])
        self.crew = self._buildCrew(crewList, proxy)
        self.lastCrew = invData.get('lastCrew')
        self.rentPackages = calcRentPackages(self, proxy)
        self.__customState = ''
        return
예제 #8
0
 def __init__(self, buildingCompactDescr=None, typeID=None):
     BuildingDescr.__init__(self, buildingCompactDescr, typeID=typeID)
     HasStrCD.__init__(self, buildingCompactDescr
                       or self.makeCompactDescr())
예제 #9
0
 def __init__(self, buildingCompactDescr = None, typeID = None):
     BuildingDescr.__init__(self, buildingCompactDescr, typeID=typeID)
     HasStrCD.__init__(self, buildingCompactDescr or self.makeCompactDescr())