Esempio n. 1
0
 def _selectVehicle(resultID, ext, cacheResultID, cacheData=None):
     vhTypeID = ext.get('switchToVhInvID', 0)
     if vhTypeID:
         from CurrentVehicle import g_currentVehicle
         if not g_currentVehicle.item.activeInNationGroup:
             g_currentVehicle.selectVehicle(vhTypeID)
     callback(resultID)
def selectVehicleInHangar(itemCD):
    from CurrentVehicle import g_currentVehicle
    itemsCache = dependency.instance(IItemsCache)
    veh = itemsCache.items.getItemByCD(int(itemCD))
    if not veh.isInInventory:
        raise SoftException('Vehicle (itemCD={}) must be in inventory.'.format(itemCD))
    g_currentVehicle.selectVehicle(veh.invID)
    showHangar()
Esempio n. 3
0
 def selectLessonVehicle(self):
     selected = yield self.isSecondVehicleSelectedAsync()
     invID = selected or self.getSecondVehicleInvId()
     if not invID is not None:
         raise AssertionError
         from CurrentVehicle import g_currentVehicle
         g_currentVehicle.selectVehicle(invID)
     return
 def showAwardVehicleInHangar(self, vehTypeCompDescr):
     try:
         vehicle = g_itemsCache.items.getItemByCD(int(vehTypeCompDescr))
         g_currentVehicle.selectVehicle(vehicle.invID)
         shared_events.showHangar()
         self.__proxy.destroy()
     except:
         LOG_WARNING('Error while getting event window to slose it')
         LOG_CURRENT_EXCEPTION()
 def showAwardVehicleInHangar(self, vehTypeCompDescr):
     try:
         vehicle = g_itemsCache.items.getItemByCD(int(vehTypeCompDescr))
         g_currentVehicle.selectVehicle(vehicle.invID)
         shared_events.showHangar()
         self.__proxy.destroy()
     except:
         LOG_WARNING('Error while getting event window to close it')
         LOG_CURRENT_EXCEPTION()
Esempio n. 6
0
def selectVehicleInHangar(itemCD):
    """
    Selects vehicle and returns to hangar.
    :param itemCD: int-type compact descriptor of vehicle
    """
    from CurrentVehicle import g_currentVehicle
    veh = g_itemsCache.items.getItemByCD(int(itemCD))
    raise veh.isInInventory or AssertionError('Vehicle must be in inventory.')
    g_currentVehicle.selectVehicle(veh.invID)
    showHangar()
Esempio n. 7
0
 def __processVehicleChange(self):
     if not isPlayerAccount():
         return
     else:
         if self.__vehicleBonus is not None:
             vehicle, _ = first(self.__vehicleBonus.getVehicles(),
                                (None, None))
             if vehicle is not None:
                 g_currentVehicle.selectVehicle(vehicle.invID)
         return
 def onUnitAutoSearchStarted(self, timeLeft):
     self.__currentState = CYBER_SPORT_ALIASES.AUTO_SEARCH_COMMANDS_STATE
     vehicles = self.prbEntity.getSelectedVehicles(
         SELECTED_INTRO_VEHICLES_FIELD)
     if vehicles and g_currentVehicle.item.intCD != vehicles[0]:
         itemsCache = dependency.instance(IItemsCache)
         item = itemsCache.items.getItemByCD(vehicles[0])
         if hasattr(item, 'invID'):
             g_currentVehicle.selectVehicle(item.invID)
     self.as_enableWndCloseBtnS(False)
     self.__initState(timeLeft=timeLeft)
Esempio n. 9
0
 def setUnitChanged(self, loadHangar=False):
     flags = self._entity.getFlags()
     if self._entity.getPlayerInfo().isReady and flags.isInQueue():
         _, unit = self._entity.getUnit()
         pInfo = self._entity.getPlayerInfo()
         vInfos = unit.getMemberVehicles(pInfo.dbID)
         if vInfos is not None:
             g_currentVehicle.selectVehicle(vInfos[0].vehInvID)
         g_eventDispatcher.loadBattleQueue()
     elif loadHangar:
         g_eventDispatcher.loadHangar()
     return
 def onVehicleSelected(self, vehicleID, setSelection = False):
     self.selectedVehicleID = int(vehicleID)
     self.priceIndex, _ = self.preQueueFunctional.getSelectedPrice(self.selectedBattleID, self.selectedVehicleID)
     self.preQueueFunctional.changeSetting(PREQUEUE_SETTING_NAME.SELECTED_VEHICLE_ID, self.selectedVehicleID)
     self.updateStatusMessage()
     self.updatePriceBlock()
     self.updatePriceStatus()
     self.updateFightButton()
     if self.selectedVehicleID != -1:
         vehicle = g_itemsCache.items.getItemByCD(self.selectedVehicleID)
         if vehicle.invID != g_currentVehicle.invID:
             self.skipListenerNotification(self._handleCurrentVehicleChanged)
             g_currentVehicle.selectVehicle(vehicle.invID)
 def onVehicleSelected(self, vehicleID, setSelection = False):
     self.selectedVehicleID = int(vehicleID)
     self.priceIndex, _ = self.preQueueFunctional.getSelectedPrice(self.selectedBattleID, self.selectedVehicleID)
     self.preQueueFunctional.changeSetting(PREQUEUE_SETTING_NAME.SELECTED_VEHICLE_ID, self.selectedVehicleID)
     self.updateStatusMessage()
     self.updatePriceBlock()
     self.updatePriceStatus()
     self.updateFightButton()
     if self.selectedVehicleID != -1:
         vehicle = g_itemsCache.items.getItemByCD(self.selectedVehicleID)
         if vehicle.invID != g_currentVehicle.invID:
             self.skipListenerNotification(self._handleCurrentVehicleChanged)
             g_currentVehicle.selectVehicle(vehicle.invID)
Esempio n. 12
0
 def __disableRoyaleMode(self):
     storedVehInvID = AccountSettings.getFavorites(CURRENT_VEHICLE)
     if not storedVehInvID:
         criteria = REQ_CRITERIA.INVENTORY | ~REQ_CRITERIA.VEHICLE.HAS_TAGS(
             [VEHICLE_TAGS.BATTLE_ROYALE])
         vehicle = first(
             self.__itemsCache.items.getVehicles(
                 criteria=criteria).values())
         if vehicle:
             storedVehInvID = vehicle.invID
     if storedVehInvID:
         g_currentVehicle.selectVehicle(storedVehInvID)
     else:
         g_currentVehicle.selectNoVehicle()
     self.__voControl.deactivate()
 def __doTrigger(self, *_):
     if self.__waitingForItemsCacheSync:
         self.__waitingForItemsCacheSync = False
         self.itemsCache.onSyncCompleted -= self.__doTrigger
     varID = self._effect.getTargetID()
     vehicleCD = self._tutorial.getVars().get(varID, default=None)
     if vehicleCD is None:
         LOG_ERROR('invalid vehicle CD')
         return False
     else:
         vehicle = self.itemsCache.items.getItemByCD(vehicleCD)
         if vehicle is None:
             LOG_ERROR('vehicle not found in inventory')
             return False
         g_currentVehicle.selectVehicle(vehicle.invID)
         return True
 def __enableRoyaleMode(self):
     royaleVehicleID = AccountSettings.getFavorites(ROYALE_VEHICLE)
     if not royaleVehicleID or self.__itemsCache.items.getVehicle(
             royaleVehicleID) is None:
         criteria = REQ_CRITERIA.VEHICLE.HAS_TAGS(
             [VEHICLE_TAGS.BATTLE_ROYALE]) | REQ_CRITERIA.INVENTORY
         vehicles = self.__itemsCache.items.getVehicles
         royaleVehicle = first(
             sorted(vehicles(criteria=criteria).values(),
                    key=lambda item: item.intCD))
         if royaleVehicle:
             royaleVehicleID = royaleVehicle.invID
     if royaleVehicleID:
         g_currentVehicle.selectVehicle(royaleVehicleID)
     else:
         g_currentVehicle.selectNoVehicle()
     self.__voControl.activate()
     return
 def __loadCustomization(self, vehInvID=None, callback=None):
     if vehInvID is not None and vehInvID != g_currentVehicle.item.invID:
         return g_currentVehicle.selectVehicle(
             vehInvID, lambda: self.__loadCustomization(vehInvID, callback),
             True)
     else:
         if callback is not None:
             BigWorld.callback(0.0, callback)
         return
 def __enableRoyaleMode(self):
     royaleVehicleID = AccountSettings.getFavorites(ROYALE_VEHICLE)
     if not royaleVehicleID or self.__itemsCache.items.getVehicle(
             royaleVehicleID) is None:
         criteria = REQ_CRITERIA.VEHICLE.HAS_TAGS(
             [VEHICLE_TAGS.BATTLE_ROYALE]) | REQ_CRITERIA.INVENTORY
         vehicles = self.__itemsCache.items.getVehicles
         values = vehicles(criteria=criteria).values()
         royaleVehicle = first(
             sorted(
                 values,
                 key=lambda item:
                 (item.isRented, GUI_NATIONS_ORDER_INDEX[item.nationName],
                  VEHICLE_TYPES_ORDER_INDICES[item.type], item.userName)))
         if royaleVehicle:
             royaleVehicleID = royaleVehicle.invID
     if self.__c11nVisible:
         pass
     elif royaleVehicleID:
         g_currentVehicle.selectVehicle(royaleVehicleID)
     else:
         g_currentVehicle.selectNoVehicle()
     self.__voControl.activate()
     return
 def __loadCustomization(self,
                         vehInvID=None,
                         callback=None,
                         season=None,
                         modeId=None,
                         tabId=None):
     self.__createCtx(season, modeId, tabId)
     if vehInvID is not None and vehInvID != g_currentVehicle.item.invID:
         return g_currentVehicle.selectVehicle(
             vehInvID, lambda: self.__loadCustomization(
                 vehInvID, callback, season, modeId, tabId), True)
     else:
         if callback is not None:
             BigWorld.callback(0.0, callback)
         return
 def handleBodyButton(self):
     from CurrentVehicle import g_currentVehicle
     item = self.itemsCache.items.getItemByCD(self.__vehicleDesrs[0])
     if hasattr(item, 'invID'):
         g_currentVehicle.selectVehicle(item.invID)
     shared_events.showHangar()
 def selectVehicle(self, inventoryId):
     g_currentVehicle.selectVehicle(inventoryId)
     return g_currentVehicle.invID == inventoryId
Esempio n. 20
0
def selectVehicleInHangar(itemCD):
    from CurrentVehicle import g_currentVehicle
    veh = g_itemsCache.items.getItemByCD(int(itemCD))
    raise veh.isInInventory or AssertionError('Vehicle must be in inventory.')
    g_currentVehicle.selectVehicle(veh.invID)
    showHangar()
 def handleBodyButton(self):
     from CurrentVehicle import g_currentVehicle
     item = g_itemsCache.items.getItemByCD(self.__vehicleDesrs[0])
     if hasattr(item, 'invID'):
         g_currentVehicle.selectVehicle(item.invID)
     shared_events.showHangar()
 def selectVehicle(self, inventoryId):
     g_currentVehicle.selectVehicle(inventoryId)
     return g_currentVehicle.invID == inventoryId
Esempio n. 23
0
 def vehicleChange(self, vehInvID):
     g_currentVehicle.selectVehicle(int(vehInvID))
Esempio n. 24
0
 def selectLessonVehicle(self):
     invID = self.getSecondVehicleInvId()
     if not self.isSecondVehicleSelected():
         from CurrentVehicle import g_currentVehicle
         g_currentVehicle.selectVehicle(invID)
Esempio n. 25
0
 def selectVehicleInHangar(self, itemCD):
     veh = self._data.getItem(int(itemCD))
     assert veh.isInInventory, 'Vehicle must be in inventory.'
     g_currentVehicle.selectVehicle(veh.invID)
Esempio n. 26
0
 def _loadWindow(self, ctx):
     super(EventBattleSquadActionsHandler, self)._loadWindow(ctx)
     if not self._entity.getPlayerInfo().isReady:
         eventVehicle = self.eventsCache.getEventVehicles()[0]
         g_currentVehicle.selectVehicle(eventVehicle.invID)
Esempio n. 27
0
def selectVehicleInHangar(itemCD):
    from CurrentVehicle import g_currentVehicle
    veh = g_itemsCache.items.getItemByCD(int(itemCD))
    raise veh.isInInventory or AssertionError('Vehicle must be in inventory.')
    g_currentVehicle.selectVehicle(veh.invID)
    showHangar()
Esempio n. 28
0
 def _loadWindow(self, ctx):
     g_eventDispatcher.loadEventSquad(ctx, self._getTeamReady())
     if not self._functional.getPlayerInfo().isReady:
         eventVehicle = g_eventsCache.getEventVehicles()[0]
         g_currentVehicle.selectVehicle(eventVehicle.invID)
Esempio n. 29
0
 def _loadWindow(self, ctx):
     g_eventDispatcher.loadEventSquad(ctx, self._getTeamReady())
     if not self._functional.getPlayerInfo().isReady:
         eventVehicle = g_eventsCache.getEventVehicles()[0]
         g_currentVehicle.selectVehicle(eventVehicle.invID)
Esempio n. 30
0
 def vehicleChange(self, vehInvID):
     g_currentVehicle.selectVehicle(int(vehInvID))