epicArcAgentContentPiece.py (6798B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\agencyNew\contentPieces\epicArcAgentContentPiece.py 2 from carbon.common.script.sys.serviceConst import ROLE_PROGRAMMER 3 from carbonui.util.color import Color 4 from eve.client.script.ui.shared.agencyNew import agencyConst 5 from eve.client.script.ui.shared.agencyNew.contentPieces.agentContentPiece import AgentContentPiece 6 from eve.client.script.ui.shared.agencyNew.ui import agencyUIConst 7 from eve.client.script.ui.shared.epicArcs import epicArcConst 8 from eve.common.lib import appConst 9 from localization import GetByLabel 10 import blue 11 12 class EpicArcAgentContentPiece(AgentContentPiece): 13 contentType = agencyConst.CONTENTTYPE_EPICARCS 14 15 def __init__(self, epicArc, *args, **kwargs): 16 self.epicArc = epicArc 17 AgentContentPiece.__init__(self, *args, **kwargs) 18 19 def GetOwnerName(self): 20 ownerID = self.GetOwnerID() 21 if ownerID is None: 22 return '' 23 return cfg.eveowners.Get(ownerID).ownerName 24 25 def GetCardSortValue(self): 26 return (self.epicArc.GetState(), self.GetJumpsToSelfFromCurrentLocation()) 27 28 def GetTitle(self): 29 return self.GetEpicArcName() 30 31 def GetExpandedTitle(self): 32 return self.GetEpicArcName() 33 34 def GetEpicArcName(self): 35 return self.epicArc.GetName() 36 37 def GetEpicArcProgressRatio(self): 38 return self.epicArc.GetProgressRatio() 39 40 def GetExpandedSubtitle(self): 41 return self.GetEpicArcFlavorLine() 42 43 def GetEpicArcFlavorLine(self): 44 return GetByLabel(epicArcConst.FLAVORLINES_BY_EPICARCID[self.epicArc.epicArcID]) 45 46 def GetNumMissionsCompletedText(self): 47 return GetByLabel('UI/Agency/NumMissionsCompleted', numCompleted=self.epicArc.GetNumMissionsCompleted(), numMissions=self.epicArc.GetNumMissions()) 48 49 def GetSubtitle(self): 50 return self.GetEpicArcStateText() 51 52 def GetEpicArcStateText(self): 53 state = self.epicArc.GetState() 54 if state == epicArcConst.ARC_UNAVAILABLE: 55 color = Color.RGBtoHex(*agencyUIConst.COLOR_UNAVAILABLE_HILIGHT) 56 return '<color=%s>' % color + GetByLabel('UI/Menusvc/MenuHints/Unavailable') + '</color>' 57 if state == epicArcConst.ARC_AVAILABLE: 58 color = Color.RGBtoHex(*agencyUIConst.COLOR_AVAILABLE_HILIGHT) 59 return '<color=%s>' % color + GetByLabel('UI/Agency/EpicArcAvailable') + '</color>' 60 if state == epicArcConst.ARC_COMPLETE: 61 completeTime = self.epicArc.GetCompleteTime() 62 return GetByLabel('UI/Agency/EpicArcComplete', completeTime=completeTime) 63 64 def IsAvailable(self): 65 return self.epicArc.IsStandingSufficientToStart() 66 67 def GetStanding(self): 68 return self.epicArc.GetRequiredStanding() 69 70 def GetBlurbText(self): 71 ownerName = cfg.eveowners.Get(self.ownerID).ownerName 72 return GetByLabel('UI/Agency/Blurbs/EpicArcAgent', ownerName=ownerName) 73 74 def GetRewardTypes(self): 75 return [agencyConst.REWARDTYPE_ISK3, agencyConst.REWARDTYPE_LOOT] 76 77 def GetBGVideoPath(self): 78 factionID = self.GetFactionID() 79 if factionID == appConst.factionMinmatarRepublic: 80 return 'res:/Video/Agency/epicArcMinmatar.webm' 81 if factionID == appConst.factionGallenteFederation: 82 return 'res:/Video/Agency/epicArcGallente.webm' 83 if factionID == appConst.factionCaldariState: 84 return 'res:/Video/Agency/epicArcCaldari.webm' 85 if factionID == appConst.factionAmarrEmpire: 86 return 'res:/Video/Agency/epicArcAmarr.webm' 87 if factionID == appConst.factionSistersOfEVE: 88 return 'res:/Video/Agency/epicArcSOE.webm' 89 if factionID == appConst.factionGuristasPirates: 90 return 'res:/Video/Agency/epicArcGuristas.webm' 91 if factionID == appConst.factionAngelCartel: 92 return 'res:/Video/Agency/epicArcAngels.webm' 93 94 def GetIconTexturePath(self): 95 factionID = self.GetFactionID() 96 if factionID == appConst.factionMinmatarRepublic: 97 return 'res:/UI/Texture/Classes/Agency/Icons/ContentTypes/MinmatarEpic.png' 98 if factionID == appConst.factionGallenteFederation: 99 return 'res:/UI/Texture/Classes/Agency/Icons/ContentTypes/GallenteEpic.png' 100 if factionID == appConst.factionCaldariState: 101 return 'res:/UI/Texture/Classes/Agency/Icons/ContentTypes/CaldariEpic.png' 102 if factionID == appConst.factionAmarrEmpire: 103 return 'res:/UI/Texture/Classes/Agency/Icons/ContentTypes/AmarrEpic.png' 104 if factionID == appConst.factionSistersOfEVE: 105 return 'res:/UI/Texture/Classes/Agency/Icons/ContentTypes/SOEEpic.png' 106 if factionID == appConst.factionGuristasPirates: 107 return 'res:/UI/Texture/Classes/Agency/Icons/ContentTypes/GuiristasEpic.png' 108 if factionID == appConst.factionAngelCartel: 109 return 'res:/UI/Texture/Classes/Agency/Icons/ContentTypes/AngelsEpic.png' 110 if factionID == appConst.factionORE: 111 return 'res:/UI/Texture/Classes/Agency/Icons/ContentTypes/OREEpic.png' 112 if factionID == appConst.factionAIR: 113 return 'res:/UI/Texture/Classes/Agency/Icons/ContentTypes/AIREpic.png' 114 if factionID is None: 115 return 'res:/UI/Texture/Classes/Agency/Icons/ContentTypes/AngelsEpic.png' 116 117 def GetSubSolarSystemPosition(self): 118 agentEntryPoint = sm.GetService('agents').GetAgentMoniker(self.itemID).GetEntryPoint() 119 return agentEntryPoint or super(EpicArcAgentContentPiece, self).GetSubSolarSystemPosition() 120 121 def GetFactionID(self): 122 return self.epicArc.GetFactionID() 123 124 def GetCorpID(self): 125 return self.agent.corporationID 126 127 def GetCardID(self): 128 return (self.contentType, self.epicArc.epicArcID) 129 130 def GetMenu(self): 131 m = AgentContentPiece.GetMenu(self) 132 if session.role & ROLE_PROGRAMMER: 133 m.insert(0, ('Epic arc id: %s' % self.epicArc.epicArcID, blue.pyos.SetClipboardData, (str(self.epicArc.epicArcID),))) 134 return m 135 136 def GetChatChannelID(self): 137 return None 138 139 def IsInCurrentStation(self): 140 if session.stationid is None: 141 return False 142 if self.IsActiveAndAcceptedMission(): 143 return super(EpicArcAgentContentPiece, self).IsInCurrentStation() 144 agent = self.epicArc.GetActiveAgent() 145 if agent: 146 return session.stationid == agent.stationID 147 return False 148 149 def GetActiveAgentContentPiece(self): 150 agent = self.epicArc.GetActiveAgent() 151 return AgentContentPiece(solarSystemID=agent.solarsystemID, itemID=agent.agentID, locationID=agent.stationID, typeID=agent.agentTypeID, ownerID=agent.corporationID, agent=agent)