incursionContentPiece.py (3781B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\agencyNew\contentPieces\incursionContentPiece.py 2 from eve.client.script.ui.shared.agencyNew import agencyConst 3 from eve.client.script.ui.shared.agencyNew.contentPieces.baseContentPiece import BaseContentPiece 4 from eve.client.script.ui.shared.agencyNew.contentPieces.incursionSystemContentPiece import IncursionSystemContentPiece 5 from eve.client.script.ui.shared.comtool.constants import CHANNEL_INCURSIONS 6 from eve.client.script.ui.shared.incursions import incursionConst 7 from eve.common.lib import appConst 8 from grouprewards import REWARD_TYPE_LP 9 from localization import GetByLabel 10 from talecommon.influence import CalculateDecayedInfluence 11 12 class IncursionContentPiece(BaseContentPiece): 13 contentType = agencyConst.CONTENTTYPE_INCURSIONS 14 15 def __init__(self, incursionData, **kwargs): 16 super(IncursionContentPiece, self).__init__(**kwargs) 17 self.incursionData = incursionData 18 self.state = incursionData.state 19 self.constellationID = sm.GetService('map').GetItem(incursionData.stagingSolarSystemID).locationID 20 self.influence = incursionData.influence 21 self.hasFinalEncounter = incursionData.hasFinalEncounter 22 23 def GetConstellationEffects(self): 24 return self.incursionData.effects 25 26 def GetIncursionState(self): 27 return self.state 28 29 def GetStateName(self): 30 return incursionConst.NAME_BY_INCURSION_STATE[self.state] 31 32 def GetStateHint(self): 33 return incursionConst.HINT_BY_INCURSION_STATE[self.state] 34 35 def GetStateColor(self): 36 return incursionConst.COLOR_BY_INCURSION_STATE[self.state] 37 38 def GetConstellationID(self): 39 return self.constellationID 40 41 def GetConstellationName(self): 42 return cfg.evelocations.Get(self.constellationID).locationName 43 44 def GetLPPayoutPool(self): 45 rewards = sm.GetService('incursion').GetDelayedRewards(self.incursionData.rewardGroupID) 46 if not rewards: 47 return 48 for reward in rewards: 49 if reward.rewardTypeID == REWARD_TYPE_LP: 50 return reward.rewardQuantity 51 52 def GetConstellationText(self): 53 return GetByLabel('UI/Incursion/Journal/ReportRowHeader', constellation=self.constellationID, constellationInfo=('showinfo', appConst.typeConstellation, self.constellationID)) 54 55 def GetInfluence(self): 56 return CalculateDecayedInfluence(self.incursionData) 57 58 def HasFinalEncounter(self): 59 return self.hasFinalEncounter 60 61 def GetCardID(self): 62 return (self.contentType, 63 self.solarSystemID, 64 self.ownerID, 65 self.enemyOwnerID) 66 67 def GetChatChannelID(self): 68 return CHANNEL_INCURSIONS 69 70 def GetMenu(self): 71 return sm.GetService('menu').GetMenuFromItemIDTypeID(self.solarSystemID, appConst.typeSolarSystem) 72 73 def GetSystemContentPieces(self): 74 solarSystemIDs = cfg.mapConstellationCache.Get(self.GetConstellationID()).solarSystemIDs 75 sceneTypeBySolarSystemID = self.GetSceneTypeBySolarSystemID() 76 contentPieces = [ self.ConstructContentPiece(solarSystemID, sceneTypeBySolarSystemID.get(solarSystemID, None)) for solarSystemID in solarSystemIDs if solarSystemID in sceneTypeBySolarSystemID ] 77 return sorted(contentPieces, key=lambda x: x.GetJumpsToSelfFromCurrentLocation()) 78 79 def ConstructContentPiece(self, solarSystemID, sceneType): 80 return IncursionSystemContentPiece(solarSystemID=solarSystemID, itemID=solarSystemID, sceneType=sceneType, hasFinalEncounter=self.hasFinalEncounter) 81 82 def GetSceneTypeBySolarSystemID(self): 83 rows = sm.RemoteSvc('map').GetSystemsInIncursions() 84 return {row.locationID:row.sceneType for row in rows}