def setModule(self, newId, oldId, isRemove):
     module = self.itemsCache.items.getItemByCD(int(newId))
     if module.isUnlocked or self._slotType == FITTING_TYPES.OPTIONAL_DEVICE:
         if oldId < 0:
             if not isRemove and self._slotType == FITTING_TYPES.OPTIONAL_DEVICE and g_currentVehicle.isPresent():
                 installedOptDevice = g_currentVehicle.item.optDevices[self._slotIndex]
                 oldId = installedOptDevice.intCD if installedOptDevice else None
             else:
                 oldId = None
         ItemsActionsFactory.doAction(ItemsActionsFactory.SET_VEHICLE_MODULE, self._vehicle.invID, newId, self._slotIndex, oldId, isRemove)
     elif self._slotType == FITTING_TYPES.BOOSTER:
         battleBooster = 0 if isRemove else module
         if battleBooster and not battleBooster.isInInventory:
             showBattleBoosterBuyDialog(int(newId), install=True)
         else:
             ItemsActionsFactory.doAction(ItemsActionsFactory.SET_VEHICLE_LAYOUT, self._vehicle, None, None, battleBooster)
     return
Пример #2
0
 def buyVehicleModule(self, moduleId):
     showBattleBoosterBuyDialog(int(moduleId), install=False)
     self.destroy()