stationController.py (4304B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\dockedUI\controllers\stationController.py 2 import blue 3 import carbonui.const as uiconst 4 from eve.client.script.ui.shared.dockedUI.controllers.baseController import BaseStationController 5 from eve.client.script.ui.shared.inventory.invConst import ContainerType 6 from eve.client.script.ui.station import stationServiceConst 7 from eve.common.lib import appConst 8 from eve.common.script.util.structuresCommon import GetServices 9 import structures 10 import sys 11 from player_messaging.client.ui_message import prompt_player_fsd_dialog 12 13 class StationController(BaseStationController): 14 15 def __init__(self, itemID = None): 16 BaseStationController.__init__(self) 17 self.corpStationMgr = None 18 self.itemID = self.stationID = itemID 19 20 def IsMyHQ(self): 21 return sm.GetService('corp').GetCorporation().stationID == session.stationid 22 23 def SetHQ(self): 24 if prompt_player_fsd_dialog('MoveHQHere', {}, uiconst.YESNO) == uiconst.ID_YES: 25 sm.GetService('corp').GetCorpStationManager().MoveCorpHQHere() 26 27 def GetServicesInStation(self): 28 stationItem = sm.GetService('station').stationItem 29 servicesAtStation = GetServices(session.solarsystemid2, stationItem) 30 haveServices = self._GetServiceInfoAvailable(servicesAtStation) 31 for serviceData in stationServiceConst.serviceData: 32 if serviceData not in haveServices: 33 continue 34 if serviceData.serviceID == structures.SERVICE_FACTION_WARFARE: 35 if not sm.GetService('facwar').CheckStationElegibleForMilitia(): 36 haveServices.remove(serviceData) 37 elif serviceData.serviceID == structures.SERVICE_SECURITY_OFFICE: 38 if not sm.GetService('securityOfficeSvc').CanAccessServiceInStation(session.stationid): 39 haveServices.remove(serviceData) 40 41 return haveServices 42 43 def GetGuests(self): 44 return sm.GetService('station').GetGuests() 45 46 def PerformAndGetErrorForStandingCheck(self, stationServiceID): 47 time, result = self._GetResultFromCache(stationServiceID) 48 now = blue.os.GetWallclockTime() 49 if time and time + const.MIN * 5 > now: 50 return result 51 try: 52 self._DoStandingCheckForServices(stationServiceID) 53 result = None 54 except Exception as e: 55 sys.exc_clear() 56 result = e 57 58 self._AddServiceToCache(stationServiceID, now, result) 59 return result 60 61 def _DoStandingCheckForServices(self, stationServiceID): 62 if stationServiceID in (appConst.stationServiceCloning, 63 appConst.stationServiceSurgery, 64 appConst.stationServiceDNATherapy, 65 appConst.stationServiceJumpCloneFacility, 66 appConst.stationServiceNavyOffices): 67 return 68 if self.corpStationMgr is None: 69 self.corpStationMgr = sm.GetService('corp').GetCorpStationManager() 70 self.corpStationMgr.DoStandingCheckForStationService(stationServiceID) 71 72 def _AddServiceToCache(self, serviceID, timestamp, error): 73 self.serviceAccessCache[serviceID] = (timestamp, error) 74 75 def RemoveServiceFromCache(self, serviceID): 76 if serviceID in self.serviceAccessCache: 77 del self.serviceAccessCache[serviceID] 78 79 def _GetResultFromCache(self, serviceID): 80 if serviceID in self.serviceAccessCache: 81 time, result = self.serviceAccessCache[serviceID] 82 return (time, result) 83 return (None, None) 84 85 def GetAgents(self): 86 return sm.GetService('agents').GetAgentsByStationID()[session.stationid] 87 88 def GetOwnerID(self): 89 return sm.GetService('station').stationItem.ownerID 90 91 def _GetShipInventoryType(self): 92 return ContainerType.STATION_SHIPS 93 94 def _GetItemInventoryType(self): 95 return ContainerType.STATION_ITEMS 96 97 def GetItemID(self): 98 return sm.GetService('station').stationItem.itemID 99 100 def InProcessOfUndocking(self): 101 return sm.GetService('undocking').PastUndockPointOfNoReturn() 102 103 def GetDisabledDockingModeHint(self): 104 return 'UI/Station/CannotEnterCaptainsQuarters' 105 106 def IsControlable(self): 107 return False