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

structuremenu.py (5518B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\structure\structuremenu.py
      2 import structures
      3 from carbonui.control.contextMenu.menuConst import DISABLED_ENTRY0
      4 from eve.client.script.ui.services.menuSvcExtras import menuFunctions, openFunctions
      5 from localization import GetByLabel
      6 from menu import MenuList, MenuLabel
      7 from eve.common.lib import appConst as const
      8 from moonmining.autoMoonMining.client.auto_moon_miner_window import open_auto_moon_miner
      9 
     10 def GetStructureMenu(checker):
     11     entries = MenuList()
     12     if not checker.IsStructure():
     13         return entries
     14     if checker.OfferBoardStructure():
     15         entries.append([MenuLabel('UI/Inflight/BoardStructure'), sm.GetService('structureControl').BoardStructure, [checker.item.itemID]])
     16     elif checker.failure_label:
     17         entries.reasonsWhyNotAvailable['UI/Inflight/BoardStructure'] = GetByLabel(checker.failure_label)
     18     if checker.OfferTransferStructureOwnership():
     19         entries.append([MenuLabel('UI/Inflight/POS/TransferSovStructureOwnership'), menuFunctions.TransferCorporationOwnership, [checker.item.itemID]])
     20     if checker.OfferReleaseControl():
     21         label = MenuLabel('UI/Inflight/HUDOptions/ReleaseControl') if checker.IsDockableStructure() else MenuLabel('UI/Inflight/EjectFromShip')
     22         entries.append([label, sm.GetService('structureControl').ReleaseControl])
     23     if checker.OfferBoardPreviousShip():
     24         label = MenuLabel('UI/Inflight/HUDOptions/BoardPreviousShipFromFlex')
     25         entries.append([label, sm.GetService('structureControl').BoardPreviousShip])
     26     if checker.OfferUndock():
     27         entries.append([MenuLabel('UI/Neocom/UndockBtn'), sm.GetService('structureDocking').Undock, [checker.item.itemID]])
     28     if checker.OfferTakeControl():
     29         entries.append([MenuLabel('UI/Commands/TakeStructureControl'), sm.GetService('structureControl').TakeControl, [checker.item.itemID]])
     30     if checker.OfferAccessHangarTransfer():
     31         if not checker.isMultiSelection:
     32             entries.append([MenuLabel('UI/Inflight/AccessHangarTransfer'), openFunctions.OpenDropbox, (checker.item.itemID, checker.item.typeID)])
     33     elif checker.failure_label:
     34         entries.reasonsWhyNotAvailable['UI/Inflight/AccessHangarTransfer'] = GetByLabel(checker.failure_label)
     35     if not checker.isMultiSelection and checker.OfferAccessAutoMoonMinerDetails():
     36         entries.append([MenuLabel('UI/Moonmining/AutoMoonMiner/OfferDetailsWindow'), open_auto_moon_miner, (checker.item.itemID, checker.item.typeID)])
     37     if checker.OfferActivateJumpBridge():
     38         entries.append([MenuLabel('UI/Inflight/JumpUsingBridge'), sm.GetService('menu').JumpThroughStructureJumpBridge, (checker.item.itemID,)])
     39     else:
     40         if checker.failure_label:
     41             entries.reasonsWhyNotAvailable['UI/Inflight/JumpUsingBridge'] = GetByLabel(checker.failure_label)
     42         if checker.OfferActivateJumpBridgeDisabled():
     43             entries.append([MenuLabel('UI/Inflight/JumpUsingBridge'), DISABLED_ENTRY0])
     44     if checker.session.HasGMHRole() and checker.IsStructureInSpace():
     45         states = [ [name, GMSetStructureState, [checker.item.itemID, value]] for value, name in structures.STATES.iteritems() ]
     46         entries.append(['GM: Set State', states])
     47         times = [ ['{} seconds'.format(time), GMSetStructureTimer, [checker.item.itemID, time]] for time in [5,
     48          15,
     49          60,
     50          600,
     51          6000] ]
     52         entries.append(['GM: Set Timer', times])
     53         if checker.IsStructureInState(structures.STATE_DEPLOY_VULNERABLE):
     54             deployTimes = [ ['{} seconds'.format(time), GMSetDeployTimer, [checker.item.itemID, time]] for time in [5,
     55              15,
     56              60,
     57              600,
     58              6000] ]
     59             entries.append(['GM: Set Deploy Timer', deployTimes])
     60         unanchoring = [['Start Unanchoring', GMSetStructureUnanchoring, [checker.item.itemID]], ['Cancel Unanchoring', GMSetStructureUnanchoring, [checker.item.itemID, 'cancel']]]
     61         unanchoring += [ ['{} seconds'.format(time), GMSetStructureUnanchoring, [checker.item.itemID, time]] for time in [5,
     62          15,
     63          60,
     64          600,
     65          6000] ]
     66         entries.append(['GM: Set Unanchoring', unanchoring])
     67         if checker.CanEditAbandonTimer():
     68             abandonTimes = [ ['{} seconds'.format(time), GMSetStructureAbandonTimer, [checker.item.itemID, time]] for time in [5,
     69              60,
     70              600,
     71              3600,
     72              68400,
     73              604800] ]
     74             entries.append(['GM: Set Abandon Timer', abandonTimes])
     75     return entries
     76 
     77 
     78 def CheckStructureIsNotOffline(slimItem):
     79     if slimItem.categoryID == const.categoryStructure:
     80         return getattr(slimItem, 'state', structures.STATE_UNKNOWN) not in structures.OFFLINE_STATES
     81     return False
     82 
     83 
     84 def GMSetStructureState(structureID, state):
     85     sm.RemoteSvc('slash').SlashCmd('/structure state %d %d' % (structureID, state))
     86 
     87 
     88 def GMSetStructureTimer(structureID, seconds):
     89     sm.RemoteSvc('slash').SlashCmd('/structure timer %d %d' % (structureID, seconds))
     90 
     91 
     92 def GMSetStructureUnanchoring(structureID, action = ''):
     93     sm.RemoteSvc('slash').SlashCmd('/structure unanchor %d %s' % (structureID, action))
     94 
     95 
     96 def GMSetDeployTimer(structureID, seconds):
     97     sm.RemoteSvc('slash').SlashCmd('/structure deploytimer %d %d' % (structureID, seconds))
     98 
     99 
    100 def GMSetStructureAbandonTimer(structureID, seconds):
    101     sm.RemoteSvc('slash').SlashCmd('/structure abandontimer %d %d' % (structureID, seconds))