def _doPutOnAction(self, vehicle, callback): action = ActionsFactory.getAction( ActionsFactory.BUY_AND_INSTALL_BATTLE_BOOSTERS, vehicle, confirmOnlyExchange=True) result = yield ActionsFactory.asyncDoAction(action) callback(result)
def demountAllPairs(self): vehicle = self._vehicle toDiscardIDs = vehicle.postProgression.getInstalledMultiIds() action = ActionsFactory.getAction( ActionsFactory.DISCARD_POST_PROGRESSION_PAIRS, vehicle, *toDiscardIDs) yield ActionsFactory.asyncDoAction(action)
def _demountProcess(self, isDestroy=False, everywhere=True): item = self._itemsCache.items.getItemByCD(self._intCD) action = ActionsFactory.getAction(ActionsFactory.REMOVE_OPT_DEVICE, self._getVehicle(), item, self._installedSlotId, isDestroy, forFitting=False, everywhere=everywhere) result = yield ActionsFactory.asyncDoAction(action) if result: if isDestroy: actionType = BaseSetupModel.DESTROY_SLOT_ACTION elif everywhere: actionType = BaseSetupModel.DEMOUNT_SLOT_FROM_SETUPS_ACTION else: actionType = BaseSetupModel.DEMOUNT_SLOT_ACTION self._sendLastSlotAction(TankSetupConstants.OPT_DEVICES, actionType, {'intCD': item.intCD, 'slotID': self._installedSlotId})
def onChangeSetupLayoutIndex(self, hudGroupID, layoutIdx, callback=None): result = False if self.isNewSetupLayoutIndexValid( hudGroupID, layoutIdx) and hudGroupID in GROUPS_MAP: groupId = GROUPS_MAP[hudGroupID] self._updateSwitchingProgress(True) result = yield ActionsFactory.asyncDoAction( ActionsFactory.getAction( ActionsFactory.CHANGE_SETUP_EQUIPMENTS_INDEX, self._vehicle, groupId, layoutIdx)) if result: self.__markHintUsed(groupId) playSound(Sounds.SETUP_SWITCH) self._updateSwitchingProgress(False) if callback is not None: callback(result) return
def _onPrebattleSwitchToggleClick(self, args): stepID = int(args['stepID']) if stepID in self.__togglingSteps: return elif self.__lockTogglingCallbackID is not None: return else: self.__lockToggling() self.__togglingSteps.add(stepID) featureName = self._vehicle.postProgression.getStep( stepID).action.getTechName() groupID = GROUP_ID_BY_FEATURE[featureName] action = factory.getAction( factory.SWITCH_PREBATTLE_AMMO_PANEL_AVAILABILITY, self._vehicle, groupID, args['active']) yield factory.asyncDoAction(action) self.__togglingSteps.discard(stepID) return
def _doPutOnAction(self, vehicle, callback): action = ActionsFactory.getAction(ActionsFactory.INSTALL_BATTLE_ABILITIES, vehicle) result = yield ActionsFactory.asyncDoAction(action) callback(result)
def __onPurchaseClick(self): vehicle = self._vehicle toPurchaseIDs = self.__getStepsToPurchase(vehicle.postProgression) action = factory.getAction(factory.PURCHASE_POST_PROGRESSION_STEPS, vehicle, toPurchaseIDs) yield factory.asyncDoAction(action)