__init__.py (3982B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\moonmining\__init__.py 2 import evetypes 3 import gametime 4 from carbon.common.lib.const import HOUR, SEC 5 from carbonui.util.color import Color 6 from dogma.const import attributeExtractionYieldMultiplier 7 from eveservices.scheduling import GetSchedulingService 8 from inventorycommon.typeHelpers import GetAveragePrice 9 from localization import GetByLabel 10 from moonmining.const import MAXIMUM_EXTRACTION_DURATION 11 DAY_NAME_TEXT = [GetByLabel('/Carbon/UI/Common/Days/Sunday'), 12 GetByLabel('/Carbon/UI/Common/Days/Monday'), 13 GetByLabel('/Carbon/UI/Common/Days/Tuesday'), 14 GetByLabel('/Carbon/UI/Common/Days/Wednesday'), 15 GetByLabel('/Carbon/UI/Common/Days/Thursday'), 16 GetByLabel('/Carbon/UI/Common/Days/Friday'), 17 GetByLabel('/Carbon/UI/Common/Days/Saturday')] 18 DAY_NAME_TEXT_SHORT = [GetByLabel('UI/Moonmining/SundayShort'), 19 GetByLabel('UI/Moonmining/MondayShort'), 20 GetByLabel('UI/Moonmining/TuesdayShort'), 21 GetByLabel('UI/Moonmining/WednesdayShort'), 22 GetByLabel('UI/Moonmining/ThursdayShort'), 23 GetByLabel('UI/Moonmining/FridayShort'), 24 GetByLabel('UI/Moonmining/SaturdayShort')] 25 COLOR_IN_PROGRESS = (0.8, 0, 0, 1.0) 26 COLOR_READY = (0.46, 0.85, 1.0, 1.0) 27 COLOR_RECALIBRATING = (0.95, 0.6, 0.14, 1.0) 28 COLOR_STOPPED = (1.0, 1.0, 1.0, 1.0) 29 COLOR_FRACTURE = (0.24, 0.67, 0.16, 1.0) 30 STAGE_STOPPED = 1 31 STAGE_CALIBRATING = 2 32 STAGE_IN_PROGRESS = 3 33 STAGE_READY = 4 34 STAGE_FRACTURING = 5 35 NUM_HOURS_IN_BLOCK = 4 36 NUM_HOURS_ZOOMER = 96 37 HOUR_WIDTH_ZOOMER = 5 38 PARTS_IN_HOUR = 2 39 VULNERABILITY_COLOR = COLOR_RECALIBRATING[:3] + (0.75,) 40 41 def GetPrice(typeID, qty): 42 price = GetAveragePrice(typeID) or evetypes.GetBasePrice(typeID) or 0 43 return price * qty 44 45 46 def GetOreColor(typeID): 47 colors = [(0.1, 0.37, 0.55, 1.0), 48 (0.55, 0.1, 0.1, 1.0), 49 (0.45, 0.45, 0.45, 1.0), 50 (0.55, 0.37, 0.1, 1.0)] 51 return colors[typeID % 4] 52 53 54 def GetRangeTimeForSlider(): 55 now = gametime.GetWallclockTime() 56 timeInBlcok = NUM_HOURS_IN_BLOCK * HOUR 57 startTime = now + (timeInBlcok - now % timeInBlcok) 58 maxTime = now + MAXIMUM_EXTRACTION_DURATION * SEC 59 return (startTime, maxTime) 60 61 62 def GetExtractionStage(extraction): 63 if not extraction: 64 return STAGE_STOPPED 65 if extraction.chunkAvailableTime > gametime.GetWallclockTime(): 66 return STAGE_IN_PROGRESS 67 laserFiredTimestamp = GetSchedulingService().GetLaserFiredTimestamp() 68 if laserFiredTimestamp: 69 return STAGE_FRACTURING 70 return STAGE_READY 71 72 73 def GetColorAndStatusTextForExtraction(extraction): 74 currentStage = GetExtractionStage(extraction) 75 if currentStage == STAGE_READY: 76 text = GetByLabel('UI/Moonmining/ExtractionReadyStatus') 77 helpText = GetByLabel('UI/Moonmining/ExtractionReadyStatusHint') 78 statusColor = COLOR_READY 79 elif currentStage == STAGE_FRACTURING: 80 text = GetByLabel('UI/Moonmining/ExtractionFracturingStatus') 81 helpText = GetByLabel('UI/Moonmining/ExtractionFracturingStatusHint') 82 statusColor = COLOR_FRACTURE 83 elif currentStage == STAGE_IN_PROGRESS: 84 text = GetByLabel('UI/Moonmining/ExtractionInProgress') 85 helpText = GetByLabel('UI/Moonmining/ExtractionInProgressHint') 86 statusColor = COLOR_IN_PROGRESS 87 else: 88 text = GetByLabel('UI/Moonmining/ExtrationStoppedStatus') 89 helpText = GetByLabel('UI/Moonmining/ExtrationStoppedStatusHint') 90 statusColor = COLOR_STOPPED 91 return (text, helpText, statusColor) 92 93 94 def GetTextColor(color, maximumSaturation = 0.3): 95 c = Color(*color) 96 currentSaturation = c.GetSaturation() 97 if currentSaturation < maximumSaturation: 98 return color 99 return c.SetSaturation(maximumSaturation).GetRGBA() 100 101 102 def GetYieldMultiplier(structureID): 103 dogmaLocation = sm.GetService('clientDogmaIM').GetDogmaLocation() 104 yieldMultiplier = dogmaLocation.GetAttributeValue(structureID, attributeExtractionYieldMultiplier) 105 return yieldMultiplier