Example #1
0
    def doAction(self):
        vehicle = None
        if self.__vehInvID > 0:
            vehicle = g_itemsCache.items.getVehicle(self.__vehInvID)
        if vehicle is None:
            return
        else:
            isUseGold = self.__isRemove and self.__oldItemCD is not None
            newComponentItem = g_itemsCache.items.getItemByCD(int(self.__newItemCD))
            if newComponentItem is None:
                return
            oldComponentItem = None
            if self.__oldItemCD:
                oldComponentItem = g_itemsCache.items.getItemByCD(int(self.__oldItemCD))
            if not self.__isRemove and oldComponentItem and oldComponentItem.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE:
                result = yield getInstallerProcessor(vehicle, oldComponentItem, self.__slotIdx, False, True).request()
                if result and result.auxData:
                    for m in result.auxData:
                        SystemMessages.g_instance.pushI18nMessage(m.userMsg, type=m.sysMsgType)

                if result and len(result.userMsg):
                    SystemMessages.g_instance.pushI18nMessage(result.userMsg, type=result.sysMsgType)
                if not result.success:
                    return
            conflictedEqs = newComponentItem.getConflictedEquipments(vehicle)
            if not newComponentItem.isInInventory and not self.__isRemove:
                if not self._canBuy(newComponentItem) and self._canBuyWithExchange(newComponentItem):
                    isOk, args = yield DialogsInterface.showDialog(ExchangeCreditsMeta(newComponentItem.intCD))
                    if not isOk:
                        return
                if self._canBuy(newComponentItem):
                    Waiting.show('buyItem')
                    buyResult = yield ModuleBuyer(newComponentItem, count=1, buyForCredits=True, conflictedEqs=conflictedEqs, install=True).request()
                    Waiting.hide('buyItem')
                    if len(buyResult.userMsg):
                        SystemMessages.g_instance.pushI18nMessage(buyResult.userMsg, type=buyResult.sysMsgType)
                    if buyResult.success:
                        newComponentItem = g_itemsCache.items.getItemByCD(int(self.__newItemCD))
                    else:
                        return
                else:
                    return
            Waiting.show('applyModule')
            result = yield getInstallerProcessor(vehicle, newComponentItem, self.__slotIdx, not self.__isRemove, isUseGold, conflictedEqs).request()
            if result and result.auxData:
                for m in result.auxData:
                    SystemMessages.g_instance.pushI18nMessage(m.userMsg, type=m.sysMsgType)

            if result and len(result.userMsg):
                SystemMessages.g_instance.pushI18nMessage(result.userMsg, type=result.sysMsgType)
            if result.success and newComponentItem.itemTypeID in (GUI_ITEM_TYPE.TURRET, GUI_ITEM_TYPE.GUN):
                vehicle = g_itemsCache.items.getItemByCD(vehicle.intCD)
                yield tryToLoadDefaultShellsLayout(vehicle)
            Waiting.hide('applyModule')
            return
Example #2
0
 def doAction(self):
     vehicle = self.itemsCache.items.getVehicle(self.__vehInvID)
     if vehicle is None:
         return
     else:
         isUseMoney = self.__isRemove and self.__oldItemCD is not None
         LOG_DEBUG('isUseMoney, self.__isRemove, self.__oldItemCD', isUseMoney, self.__isRemove, self.__oldItemCD)
         newComponentItem = self.itemsCache.items.getItemByCD(int(self.__newItemCD))
         if newComponentItem is None:
             return
         oldComponentItem = None
         if self.__oldItemCD:
             oldComponentItem = self.itemsCache.items.getItemByCD(int(self.__oldItemCD))
         if not self.__isRemove:
             if oldComponentItem and oldComponentItem.itemTypeID in (GUI_ITEM_TYPE.OPTIONALDEVICE, GUI_ITEM_TYPE.BATTLE_BOOSTER):
                 Waiting.show('installEquipment')
                 result = yield getInstallerProcessor(vehicle, oldComponentItem, self.__slotIdx, False, True, skipConfirm=self.skipConfirm).request()
                 processMsg(result)
                 Waiting.hide('installEquipment')
                 if not result.success:
                     return
         if not self.__isRemove and not newComponentItem.isInInventory and not newComponentItem.itemTypeID == GUI_ITEM_TYPE.BATTLE_ABILITY:
             conflictedEqs = newComponentItem.getConflictedEquipments(vehicle)
             if not self._mayObtainForMoney(newComponentItem) and self._mayObtainWithMoneyExchange(newComponentItem):
                 isOk, _ = yield DialogsInterface.showDialog(ExchangeCreditsMeta(newComponentItem.intCD, vehicle.intCD))
                 if not isOk:
                     return
             if self._mayObtainForMoney(newComponentItem):
                 Waiting.show('buyAndInstall')
                 vehicle = self.itemsCache.items.getVehicle(self.__vehInvID)
                 gunCD = getGunCD(newComponentItem, vehicle)
                 result = yield BuyAndInstallItemProcessor(vehicle, newComponentItem, self.__slotIdx, gunCD, conflictedEqs=conflictedEqs, skipConfirm=self.skipConfirm).request()
                 processMsg(result)
                 if result.success and newComponentItem.itemTypeID in (GUI_ITEM_TYPE.TURRET, GUI_ITEM_TYPE.GUN):
                     newComponentItem = self.itemsCache.items.getItemByCD(int(self.__newItemCD))
                     vehicle = self.itemsCache.items.getItemByCD(vehicle.intCD)
                     if newComponentItem.isInstalled(vehicle):
                         yield tryToLoadDefaultShellsLayout(vehicle)
                 Waiting.hide('buyAndInstall')
             else:
                 yield lambda callback=None: callback
         else:
             Waiting.show('applyModule')
             conflictedEqs = newComponentItem.getConflictedEquipments(vehicle)
             result = yield getInstallerProcessor(vehicle, newComponentItem, self.__slotIdx, not self.__isRemove, isUseMoney, conflictedEqs, self.skipConfirm).request()
             processMsg(result)
             if result.success and newComponentItem.itemTypeID in (GUI_ITEM_TYPE.TURRET, GUI_ITEM_TYPE.GUN):
                 newComponentItem = self.itemsCache.items.getItemByCD(int(self.__newItemCD))
                 vehicle = self.itemsCache.items.getItemByCD(vehicle.intCD)
                 if newComponentItem.isInstalled(vehicle):
                     yield tryToLoadDefaultShellsLayout(vehicle)
             Waiting.hide('applyModule')
         return
Example #3
0
 def doAction(self):
     vehicle = g_itemsCache.items.getVehicle(self.__vehInvID)
     if vehicle is None:
         return
     else:
         isUseGold = self.__isRemove and self.__oldItemCD is not None
         LOG_DEBUG('isUseGold, self.__isRemove, self.__oldItemCD', isUseGold, self.__isRemove, self.__oldItemCD)
         newComponentItem = g_itemsCache.items.getItemByCD(int(self.__newItemCD))
         if newComponentItem is None:
             return
         oldComponentItem = None
         if self.__oldItemCD:
             oldComponentItem = g_itemsCache.items.getItemByCD(int(self.__oldItemCD))
         if not self.__isRemove:
             if oldComponentItem and oldComponentItem.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE:
                 result = yield getInstallerProcessor(vehicle, oldComponentItem, self.__slotIdx, False, True).request()
                 processMsg(result)
                 if not result.success:
                     return
         if not self.__isRemove and not newComponentItem.isInInventory:
             conflictedEqs = newComponentItem.getConflictedEquipments(vehicle)
             if not self._mayObtainForMoney(newComponentItem) and self._mayObtainWithMoneyExchange(newComponentItem):
                 isOk, args = yield DialogsInterface.showDialog(ExchangeCreditsMeta(newComponentItem.intCD, vehicle.intCD))
                 if not isOk:
                     return
             if self._mayObtainForMoney(newComponentItem):
                 Waiting.show('buyAndInstall')
                 vehicle = g_itemsCache.items.getVehicle(self.__vehInvID)
                 gunCD = getGunCD(newComponentItem, vehicle)
                 result = yield BuyAndInstallItemProcessor(vehicle, newComponentItem, self.__slotIdx, gunCD, conflictedEqs=conflictedEqs).request()
                 processMsg(result)
                 if result.success and newComponentItem.itemTypeID in (GUI_ITEM_TYPE.TURRET, GUI_ITEM_TYPE.GUN):
                     newComponentItem = g_itemsCache.items.getItemByCD(int(self.__newItemCD))
                     vehicle = g_itemsCache.items.getItemByCD(vehicle.intCD)
                     if newComponentItem.isInstalled(vehicle):
                         yield tryToLoadDefaultShellsLayout(vehicle)
                 Waiting.hide('buyAndInstall')
             else:
                 yield lambda callback = None: callback
         else:
             Waiting.show('applyModule')
             conflictedEqs = newComponentItem.getConflictedEquipments(vehicle)
             result = yield getInstallerProcessor(vehicle, newComponentItem, self.__slotIdx, not self.__isRemove, isUseGold, conflictedEqs).request()
             processMsg(result)
             if result.success and newComponentItem.itemTypeID in (GUI_ITEM_TYPE.TURRET, GUI_ITEM_TYPE.GUN):
                 newComponentItem = g_itemsCache.items.getItemByCD(int(self.__newItemCD))
                 vehicle = g_itemsCache.items.getItemByCD(vehicle.intCD)
                 if newComponentItem.isInstalled(vehicle):
                     yield tryToLoadDefaultShellsLayout(vehicle)
             Waiting.hide('applyModule')
         return
Example #4
0
 def installItem(self, itemCD, rootCD, state):
     itemTypeID, nationID, itemID = vehicles.parseIntCompactDescr(itemCD)
     raise itemTypeID in GUI_ITEM_TYPE.VEHICLE_MODULES or AssertionError
     vehicle = self.itemsCache.items.getItemByCD(rootCD)
     if not vehicle.isInInventory:
         raise AssertionError('Vehicle must be in inventory')
         item = self.itemsCache.items.getItemByCD(itemCD)
         conflictedEqs = item.getConflictedEquipments(vehicle)
         RequestState.sent(state)
         if item.isInInventory:
             Waiting.show('applyModule')
             result = yield getInstallerProcessor(
                 vehicle,
                 item,
                 conflictedEqs=conflictedEqs,
                 skipConfirm=self.skipConfirm).request()
             processMsg(result)
             vehicle = result.success and item.itemTypeID in (
                 GUI_ITEM_TYPE.TURRET,
                 GUI_ITEM_TYPE.GUN) and self.itemsCache.items.getItemByCD(
                     vehicle.intCD)
             yield tryToLoadDefaultShellsLayout(vehicle)
         Waiting.hide('applyModule')
     RequestState.received(state)
     yield lambda callback=None: callback
     return
Example #5
0
    def buyAndInstallItem(self, itemCD, state, inInventory = False):
        itemTypeID, nationID, itemID = vehicles.parseIntCompactDescr(itemCD)
        assert itemTypeID in GUI_ITEM_TYPE.VEHICLE_MODULES
        vehicle = self._data.getRootItem()
        assert vehicle.isInInventory, 'Vehicle must be in inventory'
        item = self._data.getItem(itemCD)
        conflictedEqs = item.getConflictedEquipments(vehicle)
        if not inInventory:
            Waiting.show('buyItem')
            buyResult = yield ModuleBuyer(item, count=1, buyForCredits=True, conflictedEqs=conflictedEqs, install=True).request()
            Waiting.hide('buyItem')
            if len(buyResult.userMsg):
                SystemMessages.g_instance.pushI18nMessage(buyResult.userMsg, type=buyResult.sysMsgType)
            if buyResult.success:
                item = self._data.getItem(itemCD)
            else:
                return
        else:
            RequestState.sent(state)
        if item.isInInventory:
            Waiting.show('applyModule')
            result = yield getInstallerProcessor(vehicle, item, conflictedEqs=conflictedEqs).request()
            if result and result.auxData:
                for m in result.auxData:
                    SystemMessages.g_instance.pushI18nMessage(m.userMsg, type=m.sysMsgType)

            if result and len(result.userMsg):
                SystemMessages.g_instance.pushI18nMessage(result.userMsg, type=result.sysMsgType)
            if result.success and item.itemTypeID in (GUI_ITEM_TYPE.TURRET, GUI_ITEM_TYPE.GUN):
                vehicle = g_itemsCache.items.getItemByCD(vehicle.intCD)
                yield tryToLoadDefaultShellsLayout(vehicle)
            Waiting.hide('applyModule')
        RequestState.received(state)
Example #6
0
 def installItem(self, itemCD, rootCD, state):
     itemTypeID, _, __ = vehicles.parseIntCompactDescr(itemCD)
     if itemTypeID not in GUI_ITEM_TYPE.VEHICLE_MODULES:
         raise SoftException(
             'Specified type (itemTypeID={}) is not type of module'.format(
                 itemTypeID))
     vehicle = self.itemsCache.items.getItemByCD(rootCD)
     if not vehicle.isInInventory:
         raise SoftException(
             'Vehicle (intCD={}) must be in inventory'.format(rootCD))
     item = self.itemsCache.items.getItemByCD(itemCD)
     conflictedEqs = item.getConflictedEquipments(vehicle)
     RequestState.sent(state)
     if item.isInInventory:
         Waiting.show('applyModule')
         result = yield getInstallerProcessor(
             vehicle,
             item,
             conflictedEqs=conflictedEqs,
             skipConfirm=self.skipConfirm).request()
         processMsg(result)
         if result.success and item.itemTypeID in (GUI_ITEM_TYPE.TURRET,
                                                   GUI_ITEM_TYPE.GUN):
             vehicle = self.itemsCache.items.getItemByCD(vehicle.intCD)
             yield tryToLoadDefaultShellsLayout(vehicle)
         Waiting.hide('applyModule')
     RequestState.received(state)
     yield lambda callback=None: callback
     return
Example #7
0
    def buyAndInstallItem(self, itemCD, state, inInventory = False):
        itemTypeID, nationID, itemID = vehicles.parseIntCompactDescr(itemCD)
        raise itemTypeID in _RESEARCH_ITEMS or AssertionError
        oldStyleVehicle = self._data.getInvItem(self._data.getRootCD())
        if not oldStyleVehicle is not None:
            raise AssertionError, 'Vehicle has be in inventory'
            eqs = functions.findConflictedEquipments(itemCD, itemTypeID, oldStyleVehicle)
            item = g_itemsCache.items.getItemByCD(itemCD)
            vehicle = g_itemsCache.items.getItemByCD(self._data.getRootCD())
            if not inInventory:
                Waiting.show('buyItem')
                buyResult = yield ModuleBuyer(item, count=1, buyForCredits=True, conflictedEqs=eqs, install=True).request()
                if len(buyResult.userMsg):
                    SystemMessages.g_instance.pushI18nMessage(buyResult.userMsg, type=buyResult.sysMsgType)
                Waiting.hide('buyItem')
            else:
                RequestState.sent(state)
            item = g_itemsCache.items.getItemByCD(itemCD)
            if item is not None and item.isInInventory:
                Waiting.show('applyModule')
                result = yield getInstallerProcessor(vehicle, item).request()
                success = result.success
                if result and result.auxData:
                    for m in result.auxData:
                        SystemMessages.g_instance.pushI18nMessage(m.userMsg, type=m.sysMsgType)

                if result and len(result.userMsg):
                    SystemMessages.g_instance.pushI18nMessage(result.userMsg, type=result.sysMsgType)
                success and itemTypeID in (_GUN, _TURRET) and self.tryLoadShells()
            Waiting.hide('applyModule')
        RequestState.received(state)
        return
Example #8
0
    def setVehicleModule(self, newId, slotIdx, oldId, isRemove):
        isUseGold = isRemove and oldId is not None
        vehicle = g_currentVehicle.item
        newComponentItem = g_itemsCache.items.getItemByCD(int(newId))
        if newComponentItem is None:
            return
        oldComponentItem = None
        if oldId:
            oldComponentItem = g_itemsCache.items.getItemByCD(int(oldId))
        if not isRemove and oldComponentItem and oldComponentItem.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE:
            result = yield getInstallerProcessor(vehicle, oldComponentItem, slotIdx, False, True).request()
            if result and result.auxData:
                for m in result.auxData:
                    SystemMessages.g_instance.pushI18nMessage(m.userMsg, type=m.sysMsgType)

            if result and len(result.userMsg):
                SystemMessages.g_instance.pushI18nMessage(result.userMsg, type=result.sysMsgType)
            if not result.success:
                return
        conflictedEqs = newComponentItem.getConflictedEquipments(vehicle)
        if not newComponentItem.isInInventory and not isRemove:
            Waiting.show('buyItem')
            buyResult = yield ModuleBuyer(newComponentItem, count=1, buyForCredits=True, conflictedEqs=conflictedEqs, install=True).request()
            Waiting.hide('buyItem')
            if len(buyResult.userMsg):
                SystemMessages.g_instance.pushI18nMessage(buyResult.userMsg, type=buyResult.sysMsgType)
            if buyResult.success:
                newComponentItem = g_itemsCache.items.getItemByCD(int(newId))
            else:
                return
        Waiting.show('applyModule')
        result = yield getInstallerProcessor(vehicle, newComponentItem, slotIdx, not isRemove, isUseGold, conflictedEqs).request()
        if result and result.auxData:
            for m in result.auxData:
                SystemMessages.g_instance.pushI18nMessage(m.userMsg, type=m.sysMsgType)

        if result and len(result.userMsg):
            SystemMessages.g_instance.pushI18nMessage(result.userMsg, type=result.sysMsgType)
        if result.success and newComponentItem.itemTypeID in (GUI_ITEM_TYPE.TURRET, GUI_ITEM_TYPE.GUN):
            vehicle = g_itemsCache.items.getItemByCD(vehicle.intCD)
            yield tryToLoadDefaultShellsLayout(vehicle)
        Waiting.hide('applyModule')
Example #9
0
 def installItem(self, itemCD, rootCD, state):
     itemTypeID, nationID, itemID = vehicles.parseIntCompactDescr(itemCD)
     assert itemTypeID in GUI_ITEM_TYPE.VEHICLE_MODULES
     vehicle = g_itemsCache.items.getItemByCD(rootCD)
     assert vehicle.isInInventory, 'Vehicle must be in inventory'
     item = g_itemsCache.items.getItemByCD(itemCD)
     conflictedEqs = item.getConflictedEquipments(vehicle)
     RequestState.sent(state)
     if item.isInInventory:
         Waiting.show('applyModule')
         result = yield getInstallerProcessor(vehicle, item, conflictedEqs=conflictedEqs).request()
         processMsg(result)
         if result.success and item.itemTypeID in (GUI_ITEM_TYPE.TURRET, GUI_ITEM_TYPE.GUN):
             vehicle = g_itemsCache.items.getItemByCD(vehicle.intCD)
             yield tryToLoadDefaultShellsLayout(vehicle)
         Waiting.hide('applyModule')
     RequestState.received(state)
     yield lambda callback = None: callback
Example #10
0
    def buyAndInstallItem(self, itemCD, state, inInventory=False):
        itemTypeID, nationID, itemID = vehicles.parseIntCompactDescr(itemCD)
        raise itemTypeID in _RESEARCH_ITEMS or AssertionError
        oldStyleVehicle = self._data.getInvItem(self._data.getRootCD())
        if not oldStyleVehicle is not None:
            raise AssertionError, 'Vehicle has be in inventory'
            eqs = functions.findConflictedEquipments(itemCD, itemTypeID,
                                                     oldStyleVehicle)
            item = g_itemsCache.items.getItemByCD(itemCD)
            vehicle = g_itemsCache.items.getItemByCD(self._data.getRootCD())
            if not inInventory:
                Waiting.show('buyItem')
                buyResult = yield ModuleBuyer(item,
                                              count=1,
                                              buyForCredits=True,
                                              conflictedEqs=eqs,
                                              install=True).request()
                if len(buyResult.userMsg):
                    SystemMessages.g_instance.pushI18nMessage(
                        buyResult.userMsg, type=buyResult.sysMsgType)
                Waiting.hide('buyItem')
            else:
                RequestState.sent(state)
            item = g_itemsCache.items.getItemByCD(itemCD)
            if item is not None and item.isInInventory:
                Waiting.show('applyModule')
                result = yield getInstallerProcessor(vehicle, item).request()
                success = result.success
                if result and result.auxData:
                    for m in result.auxData:
                        SystemMessages.g_instance.pushI18nMessage(
                            m.userMsg, type=m.sysMsgType)

                if result and len(result.userMsg):
                    SystemMessages.g_instance.pushI18nMessage(
                        result.userMsg, type=result.sysMsgType)
                success and itemTypeID in (_GUN,
                                           _TURRET) and self.tryLoadShells()
            Waiting.hide('applyModule')
        RequestState.received(state)
        return
Example #11
0
    def buyAndInstallItem(self, itemCD, rootCD, state, inInventory = False):
        itemTypeID, nationID, itemID = vehicles.parseIntCompactDescr(itemCD)
        raise itemTypeID in GUI_ITEM_TYPE.VEHICLE_MODULES or AssertionError
        vehicle = g_itemsCache.items.getItemByCD(rootCD)
        if not vehicle.isInInventory:
            raise AssertionError('Vehicle must be in inventory')
            item = g_itemsCache.items.getItemByCD(itemCD)
            conflictedEqs = item.getConflictedEquipments(vehicle)
            if not inInventory:
                if not self._canBuy(item) and self._canBuyWithExchange(item):
                    isOk, args = yield DialogsInterface.showDialog(ExchangeCreditsMeta(itemCD))
                    if not isOk:
                        return
                if self._canBuy(item):
                    Waiting.show('buyItem')
                    buyResult = yield ModuleBuyer(item, count=1, buyForCredits=True, conflictedEqs=conflictedEqs, install=True).request()
                    Waiting.hide('buyItem')
                    if len(buyResult.userMsg):
                        SystemMessages.g_instance.pushI18nMessage(buyResult.userMsg, type=buyResult.sysMsgType)
                    if buyResult.success:
                        item = g_itemsCache.items.getItemByCD(itemCD)
                    else:
                        return
            else:
                RequestState.sent(state)
            if item.isInInventory:
                Waiting.show('applyModule')
                result = yield getInstallerProcessor(vehicle, item, conflictedEqs=conflictedEqs).request()
                if result and result.auxData:
                    for m in result.auxData:
                        SystemMessages.g_instance.pushI18nMessage(m.userMsg, type=m.sysMsgType)

                if result and len(result.userMsg):
                    SystemMessages.g_instance.pushI18nMessage(result.userMsg, type=result.sysMsgType)
                vehicle = result.success and item.itemTypeID in (GUI_ITEM_TYPE.TURRET, GUI_ITEM_TYPE.GUN) and g_itemsCache.items.getItemByCD(vehicle.intCD)
                yield tryToLoadDefaultShellsLayout(vehicle)
            Waiting.hide('applyModule')
        RequestState.received(state)
        yield lambda callback = None: callback
        return
Example #12
0
    def setVehicleModule(self, newId, slotIdx, oldId, isRemove):
        if isRemove:
            isUseGold = oldId is not None
            newComponent = gui_items.getItemByCompact(newId)
            newComponentItem = g_itemsCache.items.getItemByCD(newComponent.compactDescr)
            return newComponentItem is None and None
        else:
            oldComponentItem = None
            if oldId:
                oldComponent = gui_items.getItemByCompact(oldId)
                oldComponentItem = g_itemsCache.items.getItemByCD(oldComponent.compactDescr)
            if not isRemove and oldComponentItem and oldComponentItem.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE:
                result = yield getInstallerProcessor(g_currentVehicle.item, oldComponentItem, slotIdx, False, True).request()
                if result and result.auxData:
                    for m in result.auxData:
                        SystemMessages.g_instance.pushI18nMessage(m.userMsg, type=m.sysMsgType)

                if result and len(result.userMsg):
                    SystemMessages.g_instance.pushI18nMessage(result.userMsg, type=result.sysMsgType)
                if not result.success:
                    return
            iVehicles = yield Requester(ITEM_TYPE_NAMES[1]).getFromInventory()
            oldStyleVehicle = None
            for v in iVehicles:
                if v.inventoryId == g_currentVehicle.invID:
                    oldStyleVehicle = v
                    break

            conflictedEqs = findConflictedEquipmentForModule(newComponent, oldStyleVehicle)
            if isinstance(newComponent, gui_items.ShopItem):
                Waiting.show('buyItem')
                buyResult = yield ModuleBuyer(newComponentItem, count=1, buyForCredits=True, conflictedEqs=conflictedEqs, install=True).request()
                if len(buyResult.userMsg):
                    SystemMessages.g_instance.pushI18nMessage(buyResult.userMsg, type=buyResult.sysMsgType)
                if buyResult.success:
                    newComponentItem = g_itemsCache.items.getItemByCD(newComponent.compactDescr)
                Waiting.hide('buyItem')
                if not buyResult.success:
                    return
            Waiting.show('applyModule')
            result = yield getInstallerProcessor(g_currentVehicle.item, newComponentItem, slotIdx, not isRemove, isUseGold, conflictedEqs).request()
            if result and result.auxData:
                for m in result.auxData:
                    SystemMessages.g_instance.pushI18nMessage(m.userMsg, type=m.sysMsgType)

            if result and len(result.userMsg):
                SystemMessages.g_instance.pushI18nMessage(result.userMsg, type=result.sysMsgType)
            if result and result.success and newComponentItem.itemTypeID in (GUI_ITEM_TYPE.TURRET, GUI_ITEM_TYPE.GUN):
                iAmmo = yield Requester(ITEM_TYPE_NAMES[10]).getFromInventory()
                iVehicles = yield Requester(ITEM_TYPE_NAMES[1]).getFromInventory()
                for iVehicle in iVehicles:
                    if iVehicle.inventoryId == g_currentVehicle.invID:
                        installAmmoVehicle = iVehicle

                for shell in installAmmoVehicle.shells:
                    iCount = iAmmo[iAmmo.index(shell)].count if shell in iAmmo else 0
                    if shell.default > iCount:
                        success, message = False, '#system_messages:charge/inventory_error'
                        break
                else:
                    success, message = yield installAmmoVehicle.loadShells(None)

                SystemMessages.g_instance.pushI18nMessage(message, type=SystemMessages.SM_TYPE.Information if success else SystemMessages.SM_TYPE.Warning)
            Waiting.hide('applyModule')
            return