lpstoreRequirement.py (4262B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\station\lpstoreRequirement.py 2 from carbon.common.script.util.format import FmtAmt 3 from eve.common.script.util.eveFormat import FmtISK 4 PARENT_CONTAINER_SUFFIX = 'Parent' 5 NOT_FULFILLED_ICON_SUFFIX = 'NotFulfilledIcon' 6 LABEL_SUFFIX = 'Label' 7 8 def getContainerName(requirement): 9 requirementName = getattr(requirement, 'name', '') 10 return requirementName + PARENT_CONTAINER_SUFFIX 11 12 13 def getNotFulfilledIconName(requirement): 14 requirementName = getattr(requirement, 'name', '') 15 return requirementName + NOT_FULFILLED_ICON_SUFFIX 16 17 18 def getLabelName(requirement): 19 requirementName = getattr(requirement, 'name', '') 20 return requirementName + LABEL_SUFFIX 21 22 23 class LpStoreRequirement: 24 25 def __init__(self, name = '', amountName = '', checkAmountFunction = None, amountHintPath = None, notFulfilledHintPath = None, costLabelPath = None, priceLabelPath = None, *args, **kwargs): 26 self.name = name 27 self.amountName = amountName 28 self.checkAmountFunction = checkAmountFunction 29 self.amountHintPath = amountHintPath 30 self.notFulfilledHintPath = notFulfilledHintPath 31 self.costLabelPath = costLabelPath 32 self.priceLabelPath = priceLabelPath 33 34 def formatAmount(self, amount): 35 return amount 36 37 def checkAmount(self, amount): 38 if self.checkAmountFunction: 39 return self.checkAmountFunction() >= amount 40 return True 41 42 43 class LpRequirement(LpStoreRequirement): 44 LP_REQUIREMENT_NAME = 'lpCost' 45 LP_AMOUNT_NAME = 'lpAmount' 46 LP_AMOUNT_HINT_PATH = 'UI/LPStore/AmountLP' 47 LP_NOT_FULFILLED_HINT_PATH = 'UI/LPStore/HintInsufficientLPs' 48 LP_COST_LABEL_PATH = 'UI/LPStore/LPCost' 49 LP_PRICE_LABEL_PATH = 'UI/LPStore/PriceInLP' 50 51 def __init__(self, *args, **kwargs): 52 LpStoreRequirement.__init__(self, name=self.LP_REQUIREMENT_NAME, amountName=self.LP_AMOUNT_NAME, amountHintPath=self.LP_AMOUNT_HINT_PATH, notFulfilledHintPath=self.LP_NOT_FULFILLED_HINT_PATH, costLabelPath=self.LP_COST_LABEL_PATH, priceLabelPath=self.LP_PRICE_LABEL_PATH, *args, **kwargs) 53 self.formatAmount = FmtAmt 54 55 56 class EMRequirement(LpStoreRequirement): 57 LP_REQUIREMENT_NAME = 'lpCost' 58 LP_AMOUNT_NAME = 'lpAmount' 59 LP_AMOUNT_HINT_PATH = 'UI/LPStore/AmountEM' 60 LP_NOT_FULFILLED_HINT_PATH = 'UI/LPStore/HintInsufficientEMs' 61 LP_COST_LABEL_PATH = 'UI/LPStore/EMCost' 62 LP_PRICE_LABEL_PATH = 'UI/LPStore/PriceInEM' 63 64 def __init__(self, *args, **kwargs): 65 LpStoreRequirement.__init__(self, name=self.LP_REQUIREMENT_NAME, amountName=self.LP_AMOUNT_NAME, amountHintPath=self.LP_AMOUNT_HINT_PATH, notFulfilledHintPath=self.LP_NOT_FULFILLED_HINT_PATH, costLabelPath=self.LP_COST_LABEL_PATH, priceLabelPath=self.LP_PRICE_LABEL_PATH, *args, **kwargs) 66 self.formatAmount = FmtAmt 67 68 69 class ISKRequirement(LpStoreRequirement): 70 ISK_REQUIREMENT_NAME = 'iskCost' 71 ISK_AMOUNT_NAME = 'iskCost' 72 ISK_AMOUNT_HINT_PATH = None 73 ISK_NOT_FULFILLED_HINT_PATH = 'UI/LPStore/HintInsufficientISK' 74 ISK_COST_LABEL_PATH = 'UI/LPStore/ISKCost' 75 ISK_PRICE_LABEL_PATH = None 76 77 def __init__(self, *args, **kwargs): 78 LpStoreRequirement.__init__(self, name=self.ISK_REQUIREMENT_NAME, amountName=self.ISK_AMOUNT_NAME, amountHintPath=self.ISK_AMOUNT_HINT_PATH, notFulfilledHintPath=self.ISK_NOT_FULFILLED_HINT_PATH, costLabelPath=self.ISK_COST_LABEL_PATH, priceLabelPath=self.ISK_PRICE_LABEL_PATH, *args, **kwargs) 79 self.formatAmount = FmtISK 80 81 82 class AnalysisKreditsRequirement(LpStoreRequirement): 83 AK_REQUIREMENT_NAME = 'akCost' 84 AK_AMOUNT_NAME = 'akAmount' 85 AK_AMOUNT_HINT_PATH = 'UI/LPStore/AmountAK' 86 AK_NOT_FULFILLED_HINT_PATH = 'UI/LPStore/HintInsufficientAKs' 87 AK_COST_LABEL_PATH = 'UI/LPStore/AKCost' 88 AK_PRICE_LABEL_PATH = 'UI/LPStore/PriceInAK' 89 90 def __init__(self, *args, **kwargs): 91 LpStoreRequirement.__init__(self, name=self.AK_REQUIREMENT_NAME, amountName=self.AK_AMOUNT_NAME, amountHintPath=self.AK_AMOUNT_HINT_PATH, notFulfilledHintPath=self.AK_NOT_FULFILLED_HINT_PATH, costLabelPath=self.AK_COST_LABEL_PATH, priceLabelPath=self.AK_PRICE_LABEL_PATH, *args, **kwargs) 92 self.formatAmount = FmtAmt