util.py (3512B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\market\util.py 2 from carbon.common.script.sys.serviceConst import ROLE_QA 3 from eve.client.script.ui.shared.market.qa import SETTING_SHOULD_SEE_PLEX_ORDERS_LOCATION_INFO, SETTING_SHOULD_SEE_ORDER_REGION 4 from inventorycommon.const import typePlex 5 from localization import GetByLabel 6 from marketutil.feature_flags.client import is_global_plex_market_experiment_enabled 7 8 def does_global_market_apply(type_id): 9 return type_id == typePlex and is_global_plex_market_experiment_enabled() 10 11 12 def should_show_location_info(type_id): 13 if not does_global_market_apply(type_id): 14 return True 15 if session.role & ROLE_QA: 16 return SETTING_SHOULD_SEE_PLEX_ORDERS_LOCATION_INFO.is_enabled() 17 return False 18 19 20 def should_show_region(): 21 if session.role & ROLE_QA: 22 return SETTING_SHOULD_SEE_ORDER_REGION.is_enabled() 23 return False 24 25 26 def get_market_trade_confirm_dialog_key(type_id): 27 if does_global_market_apply(type_id): 28 return 'MktConfirmTradeGlobal' 29 return 'MktConfirmTrade' 30 31 32 def get_regional_average_text(type_id): 33 return GetByLabel('UI/Market/MarketQuote/Average' if does_global_market_apply(type_id) else 'UI/Market/MarketQuote/RegionalAdverage') 34 35 36 def get_regional_best_text(type_id): 37 return GetByLabel('UI/Market/MarketQuote/Best' if does_global_market_apply(type_id) else 'UI/Market/MarketQuote/BestRegional') 38 39 40 def get_price_display_text(type_id, **kwargs): 41 return GetByLabel(('UI/Market/MarketQuote/PriceDisplayGlobal' if does_global_market_apply(type_id) else 'UI/Market/MarketQuote/PriceDisplay'), **kwargs) 42 43 44 def get_best_ask_display_text(type_id, **kwargs): 45 return GetByLabel(('UI/Market/MarketQuote/BestAskDisplayGlobal' if does_global_market_apply(type_id) else 'UI/Market/MarketQuote/BestAskDisplay'), **kwargs) 46 47 48 def get_best_match_text(type_id, **kwargs): 49 return GetByLabel(('UI/Market/MarketQuote/BuyQuantityGlobal' if does_global_market_apply(type_id) else 'UI/Market/MarketQuote/BuyQuantity'), **kwargs) 50 51 52 def get_market_modify_text(type_id, **kwargs): 53 return GetByLabel(('UI/Market/MarketQuote/MarketModifyPriceGlobal' if does_global_market_apply(type_id) else 'UI/Market/MarketQuote/MarketModifyPrice'), **kwargs) 54 55 56 def get_best_price_in_place_text(type_id, location): 57 if does_global_market_apply(type_id): 58 return GetByLabel('UI/Market/Marketbase/BestPrice') 59 return GetByLabel('UI/Market/Marketbase/BestPriceIn', place=location) 60 61 62 def get_units_available_text(type_id, quantity, jumps): 63 if does_global_market_apply(type_id): 64 return GetByLabel('UI/Market/Marketbase/UnitsAvailableGlobal', quantity=quantity) 65 return GetByLabel('UI/Market/Marketbase/UnitsAvailable', quantity=quantity, numberOfJumps=jumps) 66 67 68 def get_item_jumps_quote_text(type_id, jumps, station_id, bid_station_id): 69 if does_global_market_apply(type_id): 70 return '' 71 elif jumps == 0 and station_id == bid_station_id: 72 return GetByLabel('UI/Market/MarketQuote/ItemsInSameStation') 73 else: 74 return GetByLabel('UI/Market/MarketQuote/JumpsFromThisSystem', jumps=jumps) 75 76 77 def get_jumps_quote_text(type_id, jumps, station_id, bid_station_id): 78 if does_global_market_apply(type_id): 79 return '' 80 elif jumps == 0 and bid_station_id == station_id: 81 return GetByLabel('UI/Market/MarketQuote/InSameStation') 82 else: 83 return GetByLabel('UI/Market/MarketQuote/JumpsAway', jumps=jumps)