NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

contentProviderFactionalWarfareSystems.py (3407B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\agencyNew\contentProviders\contentProviderFactionalWarfareSystems.py
      2 import telemetry
      3 from eve.client.script.ui.shared.agencyNew import agencyConst, agencyFilters
      4 from eve.client.script.ui.shared.agencyNew.agencyConst import ADJACENCY_BY_FILTER_VALUE
      5 from eve.client.script.ui.shared.agencyNew.contentGroups import contentGroupConst
      6 from eve.client.script.ui.shared.agencyNew.contentPieces.factionalWarfareSystemContentPiece import FactionalWarfareSystemContentPiece
      7 from eve.client.script.ui.shared.agencyNew.contentProviders.baseContentProviderCosmicAnomalies import BaseContentProviderCosmicAnomalies
      8 from inventorycommon import const as invConst
      9 
     10 class ContentProviderFactionalWarfareSystems(BaseContentProviderCosmicAnomalies):
     11     contentType = agencyConst.CONTENTTYPE_FACTIONALWARFARESYSTEM
     12     contentGroup = contentGroupConst.contentGroupFactionalWarfareSystems
     13     DUNGEON_TRACKER_ID = 'factional_warfare'
     14 
     15     def __init__(self):
     16         super(ContentProviderFactionalWarfareSystems, self).__init__()
     17         self.facWarSvc = sm.GetService('facwar')
     18         self.fwVictoryPointSvc = sm.GetService('fwVictoryPointSvc')
     19 
     20     def ConstructContentPiece(self, solarSystemID, dungeonInstances):
     21         occupierID = self.facWarSvc.GetSystemOccupier(solarSystemID)
     22         return FactionalWarfareSystemContentPiece(solarSystemID=solarSystemID, typeID=invConst.typeSolarSystem, itemID=solarSystemID, ownerID=occupierID, enemyOwnerID=occupierID, myFactionID=self.GetMyWarFactionID(), dungeonInstances=dungeonInstances)
     23 
     24     def CheckCriteria(self, solarSystemID):
     25         if not self.CheckFactionCriteria(self.facWarSvc.GetSystemOccupier(solarSystemID)):
     26             return False
     27         if not self.CheckDistanceCriteria(solarSystemID):
     28             return False
     29         if not self.CheckAdjacencyCriteria(self._GetAdjacencyStateFromSystemID(solarSystemID)):
     30             return False
     31         return True
     32 
     33     def CheckFactionCriteria(self, factionID):
     34         if factionID is None:
     35             return False
     36         else:
     37             selectedFaction = agencyFilters.GetFilterValue(self.contentGroup, agencyConst.FILTERTYPE_SYSTEMFACTION)
     38             if selectedFaction == agencyConst.FILTERVALUE_ANY:
     39                 return True
     40             return selectedFaction == factionID
     41 
     42     def CheckAdjacencyCriteria(self, adjacencyState):
     43         if adjacencyState is None:
     44             return False
     45         selectedAdjacencyValue = agencyFilters.GetFilterValue(self.contentGroup, agencyConst.FILTERTYPE_FWADJACENCY)
     46         if selectedAdjacencyValue == agencyConst.FILTERVALUE_ANY:
     47             return True
     48         selectedAdjacency = ADJACENCY_BY_FILTER_VALUE.get(selectedAdjacencyValue, None)
     49         return selectedAdjacency == adjacencyState
     50 
     51     def GetMyWarFactionID(self):
     52         return session.warfactionid
     53 
     54     @telemetry.ZONE_METHOD
     55     def _GetSystemSortKey(self, solarSystemID):
     56         victoryPointState = self.fwVictoryPointSvc.GetVictoryPointState(solarSystemID)
     57         return (-victoryPointState.contestedFraction, self.GetNumJumpsToSystem(solarSystemID))
     58 
     59     def _GetAdjacencyStateFromSystemID(self, solarSystemID):
     60         fwOccupationState = sm.GetService('fwWarzoneSvc').GetOccupationState(solarSystemID)
     61         if fwOccupationState:
     62             return fwOccupationState.adjacencyState