Beispiel #1
0
def getVehicleState(actionCDs):
    result = VehicleState()
    for actionCD in actionCDs:
        actionType, itemId, _ = parseActionCompDescr(actionCD)
        if actionType == ACTION_TYPES.FEATURE:
            result.addFeature(itemId)

    return result
Beispiel #2
0
 def setDisabledSwitches(self, vehicleID, groupIDs):
     if self.__playerVehicleID != vehicleID or self.__isSelectionStopped() or self.__state & _States.DISABLED_SWITCHES:
         return
     state = self.__extData.get(EXT_DATA_PROGRESSION_KEY, VehicleState())
     setDisabledSwitches(state, groupIDs)
     self.__extData[EXT_DATA_PROGRESSION_KEY] = state
     self.__onInitStepCompleted(_States.DISABLED_SWITCHES)
 def __init__(self,
              vehicleIntCD,
              vehicleStrCD,
              vehStockStrCD,
              isFromCache=False,
              rentalIsOver=False):
     super(_VehCompareData, self).__init__()
     self.__isInInventory = False
     self.__isFromCache = isFromCache
     self.__invVehStrCD = None
     self.__rentalIsOver = rentalIsOver
     self.__crewLvl = CrewTypes.SKILL_100
     self.__inventoryCrewLvl = CrewTypes.SKILL_100
     self.__crewSkills = self.getStockCrewSkills()
     self.__inventoryCrewSkills = self.getStockCrewSkills()
     self.__intCD = vehicleIntCD
     self.__strCD = vehicleStrCD
     self.__stockVehStrCD = vehStockStrCD
     self.__equipment = self.getNoEquipmentLayout()
     self.__battleBooster = None
     self.__invEquipment = self.getNoEquipmentLayout()
     self.__selectedShellIndex = _DEF_SHELL_INDEX
     self.__invHasCamouflage = False
     self.__hasCamouflage = False
     self.__hasBattleBooster = False
     self.__dynSlotType = None
     self.__invDynSlotType = None
     self.__postProgressionState = None
     self.__invPostProgressionState = VehicleState()
     return
 def __init__(self, cache, vehCompareData):
     super(_VehCompareParametersData, self).__init__()
     self.__crewLvl = None
     self.__skills = None
     self.__configurationType = None
     self.__isInInventory = None
     self.__currentVehParams = None
     self.__vehicleStrCD = None
     self.__equipment = []
     self.__hasCamouflage = False
     self.__selectedShellIdx = 0
     self.__vehicle = None
     self.__battleBooster = None
     self.__dynSlotType = None
     self.__postProgressionState = VehicleState()
     self.__isCrewInvalid = False
     self.__isInInvInvalid = False
     self.__isConfigurationTypesInvalid = False
     self.__isCurrVehParamsInvalid = False
     self.__vehicleIntCD = vehCompareData.getVehicleCD()
     self.setIsInInventory(vehCompareData.isInInventory())
     self.setVehicleData(vehCompareData)
     self.setCrewData(*vehCompareData.getCrewData())
     self.setConfigurationType(vehCompareData.getConfigurationType())
     self.__cache = cache
     self.__paramGenerator = _VehParamsValuesGenerator(*_COLOR_SCHEMES)
     self.__parameters = self.__initParameters(
         vehCompareData.getVehicleCD(), self.__vehicle)
     return
Beispiel #5
0
 def setPostProgression(self, vehicleID, itemCDs):
     if self.__playerVehicleID != vehicleID or self.__isSelectionStopped() or self.__state & _States.PROGRESSION:
         return
     self.__extData[_EXT_PROGRESSION_MODS] = getActiveModifications(itemCDs, vehicles.g_cache.postProgression())
     state = self.__extData.get(EXT_DATA_PROGRESSION_KEY, VehicleState())
     setFeatures(state, itemCDs)
     self.__extData[EXT_DATA_PROGRESSION_KEY] = state
     self.__onInitStepCompleted(_States.PROGRESSION)
 def __updatePostProgression(cls,
                             vehCmpData,
                             vehicle,
                             dynSlotType=None,
                             progressState=None):
     invState = vehicle.postProgression.getState(
     ) if vehicle.isPostProgressionActive else VehicleState()
     invDynSlotType = vehicle.optDevices.dynSlotType if vehicle.isRoleSlotActive else None
     vehCmpData.setInvPostProgressionState(invState)
     vehCmpData.setInvDynSlotType(invDynSlotType)
     progressState = progressState if progressState is not None else vehCmpData.getPostProgressionState(
     )
     progressState = progressState if progressState is not None else invState
     dynSlotType = dynSlotType if dynSlotType is not None else vehCmpData.getDynSlotType(
     )
     dynSlotType = dynSlotType if dynSlotType is not None else invDynSlotType
     postProgressionState = progressState if vehicle.isPostProgressionExists else VehicleState(
     )
     vehCmpData.setDynSlotType(dynSlotType if vehicle.isRoleSlotExists(
         postProgressionState) else None)
     vehCmpData.setPostProgressionState(postProgressionState)
     return
Beispiel #7
0
    def setPostProgression(self, progression):
        self.__mainStepsBorder = 0
        self.__mainStepsSelection.clear()
        self.__multiStepsSelection.clear()
        for step in progression.iterOrderedSteps():
            if not step.isReceived():
                continue
            if not step.action.isMultiAction():
                self.__mainStepsSelection.add(step.stepID)
                self.__mainStepsBorder = step.stepID
            if step.action.isPurchased():
                self.__multiStepsSelection[step.stepID] = step.action.getPurchasedID()

        progression.setState(VehicleState())
        self.__postProgression = progression
 def _updateGuiVehicle(self, vehicleInfo, setupIndexes):
     emptyVehicle = Vehicle(strCompactDescr=vehicleInfo.strCD)
     shellsCDs = [ shell.intCD for shell in emptyVehicle.gun.defaultAmmo ]
     shellsLayoutKey = (emptyVehicle.turret.intCD, emptyVehicle.gun.intCD)
     actualSetupIndexes = vehicleInfo.vehSetupsIndexes.copy()
     actualSetupIndexes.update(setupIndexes)
     invData = {'battleCrewCDs': vehicleInfo.crewDescrs,
      'shells': getInstalledShells(shellsCDs, vehicleInfo.vehSetups['shellsSetups']),
      'shellsLayout': {shellsLayoutKey: vehicleInfo.vehSetups['shellsSetups']},
      'eqsLayout': vehicleInfo.vehSetups['eqsSetups'],
      'boostersLayout': vehicleInfo.vehSetups['boostersSetups'],
      'devicesLayout': vehicleInfo.vehSetups['devicesSetups'],
      'layoutIndexes': actualSetupIndexes}
     updateInvInstalled(invData, actualSetupIndexes)
     vehState = VehicleState()
     setFeatures(vehState, vehicleInfo.vehPostProgression)
     setDisabledSwitches(vehState, vehicleInfo.disabledSwitchGroupIDs)
     extData = {EXT_DATA_PROGRESSION_KEY: vehState,
      EXT_DATA_SLOT_KEY: vehicleInfo.customRoleSlotTypeId,
      EXT_DATA_MODIFIERS_KEY: self.__sessionProvider.arenaVisitor.getArenaModifiers()}
     vehicle = self._vehicle = Vehicle(strCompactDescr=vehicleInfo.strCD, extData=extData.copy(), invData=invData)
     vehicle.installPostProgressionItem(self.__itemsFactory.createVehPostProgression(vehicle.compactDescr, extData[EXT_DATA_PROGRESSION_KEY], vehicle.typeDescr))
    def _applyVehiclesFromCache(self, data):
        if not data:
            return
        else:
            vehCDs = []
            for strCD, equipment, crew, shellIndex, hasCamouflage, booster, postProgression, dynSlotID in data:
                intCD = VehicleDescr(strCD).type.compactDescr
                vehCmpData = self._createVehCompareData(
                    intCD,
                    initParameters={
                        'strCD':
                        strCD,
                        'isFromCache':
                        True,
                        'crewData':
                        crew,
                        'equipment':
                        equipment,
                        'shellIndex':
                        shellIndex,
                        'hasCamouflage':
                        hasCamouflage,
                        'battleBooster':
                        booster,
                        'postProgressionState':
                        VehicleState(postProgression),
                        'dynSlotType':
                        vehicles.g_cache.supplySlots().slotDescrs[dynSlotID]
                        if dynSlotID else None
                    })
                if vehCmpData:
                    self.__vehicles.append(vehCmpData)
                    vehCDs.append(intCD)

            if vehCDs:
                self.__applyChanges(addedIDXs=range(0, len(vehCDs)),
                                    addedCDs=vehCDs)
            return
 def removePostProgression(self):
     self.__installPostProgression(VehicleState())
     self.__notifyViews('onPostProgressionUpdated')
 def getState(self, implicitCopy=True):
     return VehicleState(self.__state.toRawData()) if implicitCopy else self.__state