def __init__(self, vehicle, item, slotIdx, install=True, isUseMoney=False, conflictedEqs=None, skipConfirm=False): """ Ctor. @param vehicle: vehicle @param item: module to install @param slotIdx: vehicle equipment slot index to install @param install: true if device is being installed, false if being demounted @param isUseMoney: if False - it means the user selected 'destroy' device, otherwise - de-install for money @param conflictedEqs: conflicted items """ super(OptDeviceInstaller, self).__init__(vehicle, item, (GUI_ITEM_TYPE.OPTIONALDEVICE, ), slotIdx, install, conflictedEqs, skipConfirm=skipConfirm) self.removalPrice = item.getRemovalPrice(self.itemsCache.items) action = None if self.removalPrice.isActionPrice(): action = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'paidRemovalCost', True, self.removalPrice.price, self.removalPrice.defPrice) addPlugins = [] if install: addPlugins += (plugins.MessageConfirmator( 'installConfirmationNotRemovable_%s' % self.removalPrice.price.getCurrency(), ctx={'name': item.userName}, isEnabled=not item.isRemovable and not skipConfirm), ) else: addPlugins += (plugins.DemountDeviceConfirmator( 'removeConfirmationNotRemovableMoney', ctx={ 'name': item.userName, 'price': self.removalPrice, 'action': action, 'item': item }, isEnabled=not item.isRemovable and isUseMoney and not skipConfirm), plugins.DestroyDeviceConfirmator( 'removeConfirmationNotRemovable', itemName=item.userName, isEnabled=not item.isRemovable and not isUseMoney and not skipConfirm)) self.addPlugins(addPlugins) self.useMoney = isUseMoney return
def __init__(self, vehicle, item, slotIdx, install=True, financeOperation=False, conflictedEqs=None, skipConfirm=False): super(OptDeviceInstaller, self).__init__(vehicle, item, (GUI_ITEM_TYPE.OPTIONALDEVICE,), slotIdx, install, conflictedEqs, skipConfirm=skipConfirm) self.removalPrice = item.getRemovalPrice(self.itemsCache.items) addPlugins = [] if install: addPlugins += (plugins.InstallDeviceConfirmator(isEnabled=not item.isRemovable and not skipConfirm, item=self.item),) else: addPlugins += (plugins.DemountDeviceConfirmator(isEnabled=not item.isRemovable and financeOperation and not skipConfirm, item=self.item, vehicle=vehicle), plugins.DestroyDeviceConfirmator(isEnabled=not item.isRemovable and not financeOperation and not skipConfirm, item=item)) self.addPlugins(addPlugins) self.financeOperation = financeOperation
def __init__(self, vehicle, item, slotIdx, install=True, isUseGold=False, conflictedEqs=None): """ Ctor. @param vehicle: vehicle @param item: module to install @param slotIdx: vehicle equipment slot index to install @param install: flag to designated process @param conflictedEqs: conflicted items """ super(OptDeviceInstaller, self).__init__(vehicle, item, (GUI_ITEM_TYPE.OPTIONALDEVICE, ), slotIdx, install, conflictedEqs) self.cost = g_itemsCache.items.shop.paidRemovalCost defaultCost = g_itemsCache.items.shop.defaults.paidRemovalCost action = None if self.cost != defaultCost: action = { 'type': ACTION_TOOLTIPS_TYPE.ECONOMICS, 'key': 'paidRemovalCost', 'isBuying': True, 'state': (None, ACTION_TOOLTIPS_STATE.DISCOUNT), 'newPrice': (0, self.cost), 'oldPrice': (0, defaultCost) } addPlugins = [] if install: addPlugins += (plugins.MessageConfirmator( 'installConfirmationNotRemovable', ctx={'name': item.userName}, isEnabled=not item.isRemovable), ) else: addPlugins += (plugins.DemountDeviceConfirmator( 'removeConfirmationNotRemovableGold', ctx={ 'name': item.userName, 'price': self.cost, 'action': action }, isEnabled=not item.isRemovable and isUseGold), plugins.DestroyDeviceConfirmator( 'removeConfirmationNotRemovable', itemName=item.userName, isEnabled=not item.isRemovable and not isUseGold)) self.addPlugins(addPlugins) self.useGold = isUseGold
def __init__(self, vehicle, item, slotIdx, install=True, allSetups=True, financeOperation=False, conflictedEqs=None, skipConfirm=False): super(OptDeviceInstaller, self).__init__(vehicle, item, (GUI_ITEM_TYPE.OPTIONALDEVICE, ), slotIdx, install, conflictedEqs, skipConfirm=skipConfirm) self.removalPrice = item.getRemovalPrice(self.itemsCache.items) addPlugins = [] if install: addPlugins += (plugins.MessageConfirmator( 'installConfirmationNotRemovable_{}'.format( self.removalPrice.price.getCurrency()), ctx={ 'name': item.userName, 'complex': _wrapHtmlMessage( 'confirmationNotRemovable', backport.text( R.strings.dialogs.confirmationNotRemovable.message. complex())), 'destroy': _wrapHtmlMessage( 'confirmationNotRemovable', backport.text( R.strings.dialogs.confirmationNotRemovable.message. destroy())) }, isEnabled=not item.isRemovable and not skipConfirm), ) else: addPlugins += (plugins.DemountDeviceConfirmator( isEnabled=not item.isRemovable and financeOperation and not skipConfirm, item=self.item, vehicle=vehicle), plugins.DestroyDeviceConfirmator( isEnabled=not item.isRemovable and not financeOperation and not skipConfirm, item=item)) self.addPlugins(addPlugins) self.financeOperation = financeOperation self.allSetups = allSetups
def __init__(self, vehicle, item, slotIdx, install=True, isUseMoney=False, conflictedEqs=None, skipConfirm=False): super(OptDeviceInstaller, self).__init__(vehicle, item, (GUI_ITEM_TYPE.OPTIONALDEVICE, ), slotIdx, install, conflictedEqs, skipConfirm=skipConfirm) self.removalPrice = item.getRemovalPrice(self.itemsCache.items) action = None if self.removalPrice.isActionPrice(): action = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'paidRemovalCost', True, self.removalPrice.price, self.removalPrice.defPrice) addPlugins = [] if install: addPlugins += (plugins.MessageConfirmator( 'installConfirmationNotRemovable_%s' % self.removalPrice.price.getCurrency(), ctx={'name': item.userName}, isEnabled=not item.isRemovable and not skipConfirm), ) else: addPlugins += (plugins.DemountDeviceConfirmator( 'removeConfirmationNotRemovableMoney', ctx={ 'name': item.userName, 'price': self.removalPrice, 'action': action, 'item': item }, isEnabled=not item.isRemovable and isUseMoney and not skipConfirm), plugins.DestroyDeviceConfirmator( 'removeConfirmationNotRemovable', itemName=item.userName, isEnabled=not item.isRemovable and not isUseMoney and not skipConfirm)) self.addPlugins(addPlugins) self.useMoney = isUseMoney return
def __init__(self, vehicle, item, slotIdx, install=True, isUseGold=False, conflictedEqs=None): """ Ctor. @param vehicle: vehicle @param item: module to install @param slotIdx: vehicle equipment slot index to install @param install: flag to designated process @param conflictedEqs: conflicted items """ super(OptDeviceInstaller, self).__init__(vehicle, item, (GUI_ITEM_TYPE.OPTIONALDEVICE, ), slotIdx, install, conflictedEqs) self.cost = g_itemsCache.items.shop.paidRemovalCost addPlugins = [] if install: addPlugins += (plugins.MessageConfirmator( 'installConfirmationNotRemovable', ctx={'name': item.userName}, isEnabled=not item.isRemovable), ) else: addPlugins += (plugins.DemountDeviceConfirmator( 'removeConfirmationNotRemovableGold', ctx={ 'name': item.userName, 'price': self.cost }, isEnabled=not item.isRemovable and isUseGold), plugins.DestroyDeviceConfirmator( 'removeConfirmationNotRemovable', itemName=item.userName, isEnabled=not item.isRemovable and not isUseGold)) self.addPlugins(addPlugins) self.useGold = isUseGold