contentProviderIncursions.py (2481B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\agencyNew\contentProviders\contentProviderIncursions.py 2 from eve.client.script.ui.shared.agencyNew import agencyConst 3 from eve.client.script.ui.shared.agencyNew.contentGroups import contentGroupConst 4 from eve.client.script.ui.shared.agencyNew.contentPieces.incursionContentPiece import IncursionContentPiece 5 from eve.client.script.ui.shared.agencyNew.contentProviders.baseContentProvider import BaseContentProvider 6 from eve.common.lib import appConst 7 import telemetry 8 from talecommon.const import INCURSION_TEMPLATE_CLASSES 9 10 class ContentProviderIncursions(BaseContentProvider): 11 contentType = agencyConst.CONTENTTYPE_INCURSIONS 12 contentGroup = contentGroupConst.contentGroupIncursions 13 contentTypeFilters = (agencyConst.CONTENTTYPE_SUGGESTED, agencyConst.CONTENTTYPE_COMBAT) 14 __notifyevents__ = BaseContentProvider.__notifyevents__ + ['OnInfluenceUpdate', 'OnTaleRemove'] 15 16 def OnInfluenceUpdate(self, taleID, newInfluenceData): 17 self.InvalidateContentPieces() 18 19 def OnTaleRemove(self, taleID, templateClassID, templateID): 20 if templateClassID in INCURSION_TEMPLATE_CLASSES: 21 self.InvalidateContentPieces() 22 23 @telemetry.ZONE_METHOD 24 def _ConstructContentPieces(self): 25 incursions = self.GetAllIncursions() 26 if not incursions: 27 return 28 contentPieces = [ self.ConstructContentPiece(incursion) for incursion in incursions ] 29 contentPieces = [ contentPiece for contentPiece in contentPieces if self.CheckAllCriteria(contentPiece) ] 30 self.ExtendContentPieces(contentPieces) 31 32 def GetAllIncursions(self): 33 incursions = sm.RemoteSvc('map').GetIncursionGlobalReport() 34 return sorted(incursions, key=self._GetSortKey) 35 36 @telemetry.ZONE_METHOD 37 def _GetSortKey(self, incursion): 38 return self.GetNumJumpsToSystem(incursion.stagingSolarSystemID) 39 40 def CheckAllCriteria(self, contentPiece): 41 if not self.CheckDistanceCriteria(contentPiece.solarSystemID): 42 return False 43 if not self.CheckSecurityStatusFilterCriteria(contentPiece.solarSystemID): 44 return False 45 return True 46 47 def ConstructContentPiece(self, incursion): 48 return IncursionContentPiece(solarSystemID=incursion.stagingSolarSystemID, ownerID=appConst.factionCONCORDAssembly, enemyOwnerID=int(incursion.aggressorFactionID), incursionData=incursion)