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

fwVictoryPointSvc.py (3032B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\services\fwVictoryPointSvc.py
      2 from carbon.common.script.sys.service import Service
      3 from eveexceptions import UE_OWNERID
      4 from player_messaging.client.ui_message import prompt_player_fsd_dialog
      5 STATE_UNKNOWN = 'STATE_UNKNOWN'
      6 
      7 class FwVictoryPointSvc(Service):
      8     __guid__ = 'svc.fwVictoryPointSvc'
      9     __displayname__ = 'FW Victory Point client service'
     10     __startupdependencies__ = ['machoNet']
     11     __notifyevents__ = ['OnSessionChanged',
     12      'OnVictoryPointStateUpdated',
     13      'OnFacWarBunkerVulnerable',
     14      'OnFacWarBunkerNonVulnerable']
     15     _localVictoryPointState = STATE_UNKNOWN
     16 
     17     def _VictoryPointStateLock(self):
     18         return self.LockedService('VictoryPointState')
     19 
     20     def OnSessionChanged(self, isremote, session, change):
     21         if 'solarsystemid2' in change:
     22             self._localVictoryPointState = STATE_UNKNOWN
     23 
     24     def GetLocalVictoryPointState(self):
     25         if self._localVictoryPointState is STATE_UNKNOWN:
     26             with self._VictoryPointStateLock():
     27                 if self._localVictoryPointState is STATE_UNKNOWN:
     28                     self.LogInfo('GetLocalVictoryPointState - _localVictoryPointState is unknown - asking the server')
     29                     solarsystemID, victoryPointState = sm.RemoteSvc('fwVictoryPointMgr').GetLocalVictoryPointState()
     30                     if solarsystemID != session.solarsystemid2:
     31                         solarsystemID, victoryPointState = sm.RemoteSvc('fwVictoryPointMgr').GetLocalVictoryPointState()
     32                     if solarsystemID == session.solarsystemid2:
     33                         self._localVictoryPointState = victoryPointState
     34         return self._localVictoryPointState
     35 
     36     def GetVictoryPointState(self, solarsystemID):
     37         if solarsystemID == session.solarsystemid2:
     38             return self.GetLocalVictoryPointState()
     39         victoryPointStateBySolarsystemID = sm.RemoteSvc('fwVictoryPointMgr').GetAllVictoryPointStates()
     40         return victoryPointStateBySolarsystemID.get(solarsystemID, None)
     41 
     42     def OnVictoryPointStateUpdated(self, solarsystemID, newVictoryPointState):
     43         self.LogInfo('fwVictoryPointSvc.OnVictoryPointStateUpdated', solarsystemID, newVictoryPointState)
     44         with self._VictoryPointStateLock():
     45             if solarsystemID != session.solarsystemid2:
     46                 return
     47             if newVictoryPointState == self._localVictoryPointState:
     48                 return
     49             self._localVictoryPointState = newVictoryPointState
     50         sm.ScatterEvent('OnVictoryPointStateUpdated_Local')
     51         sm.GetService('infoPanel').UpdateFactionalWarfarePanel()
     52         sm.ScatterEvent('OnSystemStatusChanged')
     53 
     54     def OnFacWarBunkerVulnerable(self, attackerID):
     55         prompt_player_fsd_dialog('FacWarBunkerVulnerable', {'faction': (UE_OWNERID, attackerID)})
     56 
     57     def OnFacWarBunkerNonVulnerable(self, attackerID):
     58         prompt_player_fsd_dialog('FacWarBunkerNonVulnerable', {'faction': (UE_OWNERID, attackerID)})