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

qa.py (7856B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\shipprogression\boarding_moment\qa.py
      2 from __future__ import print_function
      3 from carbon.common.script.sys.serviceConst import ROLE_QA
      4 from clientsettings.setting import CharSettingBool
      5 from player_messaging.client.ui_message import message_player
      6 from .boardingMomentSvc import GetBoardingMomentService
      7 from .const import ShipShape, ShipSize, MomentSteps
      8 overlay_setting = CharSettingBool(settings_key='boarding_moment_qa_ui_enabled', default_value=False)
      9 
     10 def clear_data():
     11     GetBoardingMomentService().Clear()
     12     message_player('Boarding moment tracking has been reset')
     13 
     14 
     15 def is_ui_overlay_enabled():
     16     return settings.char.ui.Get('boarding_moment_qa_ui_enabled', False)
     17 
     18 
     19 SHAPE_STRINGS = {ShipShape.UNDEFINED: 'UNDEFINED',
     20  ShipShape.BOX: 'BOX',
     21  ShipShape.LONG: 'LONG',
     22  ShipShape.TALL: 'TALL',
     23  ShipShape.WIDE: 'WIDE'}
     24 SIZE_STRINGS = {ShipSize.SMALL: 'SMALL',
     25  ShipSize.MEDIUM: 'MEDIUM',
     26  ShipSize.LARGE: 'LARGE',
     27  ShipSize.TITAN: 'TITAN'}
     28 MOMENT_STEP_STRINGS = {MomentSteps.TEASE_1: 'TEASE_1',
     29  MomentSteps.TEASE_2: 'TEASE_2',
     30  MomentSteps.TEASE_3: 'TEASE_3',
     31  MomentSteps.BOOSTERS_1: 'BOOSTERS_1',
     32  MomentSteps.BOOSTERS_2: 'BOOSTERS_2',
     33  MomentSteps.BOOSTERS_3: 'BOOSTERS_3',
     34  MomentSteps.REVEAL_1: 'REVEAL_1',
     35  MomentSteps.REVEAL_2: 'REVEAL_2',
     36  MomentSteps.REVEAL_3: 'REVEAL_3',
     37  MomentSteps.CLIMAX_1: 'CLIMAX_1',
     38  MomentSteps.CLIMAX_2: 'CLIMAX_2',
     39  MomentSteps.CLIMAX_3: 'CLIMAX_3'}
     40 
     41 def get_boarding_moment_ship_info(type_ids = None, separator = '\t', copy_to_clipboard = True, print_to_console = True):
     42     from shipprogression.boarding_moment import get_ship_shape_group, get_ship_size_group
     43     from fsdBuiltData.common.graphicIDs import GetSofHullName, GetSofFactionName, GetSofRaceName
     44     from eve.client.script.environment.sofService import GetSofService
     45     import evetypes
     46     import blue
     47     if not session.role & ROLE_QA:
     48         print('not a qa')
     49         return
     50     type_id_set = set(type_ids or evetypes.GetTypeIDsByCategory(6))
     51     result = '{}\n'.format(separator.join((str(i) for i in ('type_id', 'type_name', 'hull_name', 'shape_group', 'size_group'))))
     52     print('get_boarding_moment_ship_info starting for {} ships'.format(len(type_id_set)))
     53     for type_id in type_id_set:
     54         graphic_id = evetypes.GetGraphicID(type_id)
     55         hull = GetSofHullName(graphic_id)
     56         faction = GetSofFactionName(graphic_id)
     57         race = GetSofRaceName(graphic_id)
     58         dna = '%s:%s:%s' % (hull, faction, race)
     59         ship_model = GetSofService().spaceObjectFactory.BuildFromDNA(dna)
     60         shape = SHAPE_STRINGS.get(get_ship_shape_group(type_id, ship_model), 'UNDEFINED')
     61         if ship_model.dynamicBoundingSphereEnabled:
     62             shape += '**'
     63         entry = separator.join((str(i) for i in (type_id,
     64          evetypes.GetName(type_id, languageID='en-us'),
     65          hull,
     66          shape,
     67          SIZE_STRINGS.get(get_ship_size_group(type_id, ship_model.GetBoundingSphereRadius()), 'UNDEFINED'))))
     68         if print_to_console:
     69             print(entry)
     70         result += '{}\n'.format(entry)
     71 
     72     if copy_to_clipboard:
     73         blue.pyos.SetClipboardData(result)
     74         print('get_boarding_moment_ship_info copied to clipboard')
     75     print('get_boarding_moment_ship_info completed')
     76 
     77 
     78 def play_cinematic_for_ships(type_ids = None, skip_unpublished = True, skip_duplicate_hulls = False, only_unseen = False):
     79     import evetypes
     80     import uthread2
     81     from fsdBuiltData.common.graphicIDs import GetSofHullName
     82     from inventorycommon.util import IsModularShip
     83     from ballparkCommon.docking import CanDock
     84     from eve.client.script.ui.services.menuSvcExtras import invItemFunctions
     85     from nodegraph.client.getters.inventory import GetInventoryItem
     86     from nodegraph.client.actions.qa import SlashCommand
     87     from nodegraph.client.util import wait_for_session
     88     from shipprogression.boarding_moment import is_excluded_from_boarding_moment
     89     if not session.role & ROLE_QA:
     90         print('not a qa')
     91         return
     92     get_ship = GetInventoryItem()
     93     slash_command = SlashCommand(wait_for_session=True)
     94     if session.structureid:
     95         structure_type_id = sm.GetService('invCache').GetInventoryFromId(session.structureid).typeID
     96     else:
     97         structure_type_id = None
     98     type_id_list = type_ids or evetypes.GetTypeIDsByCategory(6)
     99     hulls_played = set()
    100     was_naming_suppressed = settings.user.suppress.Get('suppress.ShipNameChangeOnAssemble', False)
    101     settings.user.suppress.Set('suppress.ShipNameChangeOnAssemble', True)
    102     bm_svc = GetBoardingMomentService()
    103     print('play_cinematic_for_ships starting for {} ships'.format(len(type_id_list)))
    104 
    105     def the_action(type_id):
    106         print('starting', type_id, evetypes.GetName(type_id, languageID='en-us'))
    107         get_ship.type_id = type_id
    108         item_info = get_ship.get_values()
    109         if not item_info:
    110             slash_command.slash_command = u'/create {} 1'.format(type_id)
    111             slash_command.start()
    112             uthread2.sleep(0.5)
    113         item_info = get_ship.get_values()
    114         if not item_info:
    115             print('skipping - failed to create item', type_id, evetypes.GetName(type_id, languageID='en-us'))
    116             return
    117         bm_svc.SetSeen(type_id)
    118         item = item_info['inventory_item']
    119         if not item.singleton:
    120             invItemFunctions.AssembleAndBoardShip(item)
    121         else:
    122             sm.GetService('station').TryActivateShip(item)
    123         uthread2.sleep(0.5)
    124         wait_for_session()
    125         uthread2.sleep(1)
    126         wait_for_session()
    127         counter = 0
    128         while True:
    129             current_view = sm.GetService('viewState').GetCurrentView()
    130             if current_view and current_view.activeShipModel and current_view._vfxMultiEffect and current_view.GetActiveShipTypeID() == type_id:
    131                 break
    132             uthread2.sleep(0.1)
    133             counter += 1
    134             if not bool(counter % 10):
    135                 print('waiting for hangar - has activeShipModel {} - is correct ship type {}'.format(bool(current_view.activeShipModel), current_view.GetActiveShipTypeID() == type_id))
    136 
    137         current_view.on_first_boarding()
    138         uthread2.sleep(0.5)
    139         while bm_svc.IsPlaying():
    140             uthread2.sleep(0.1)
    141 
    142         uthread2.sleep(0.5)
    143 
    144     def the_loop():
    145         for type_id in type_id_list:
    146             if skip_unpublished and not evetypes.IsPublished(type_id):
    147                 continue
    148             if is_excluded_from_boarding_moment(type_id):
    149                 print('skipping - excluded from boarding moments', type_id, evetypes.GetName(type_id, languageID='en-us'))
    150                 continue
    151             if IsModularShip(type_id):
    152                 print('skipping - modular ship', type_id, evetypes.GetName(type_id, languageID='en-us'))
    153                 continue
    154             if structure_type_id and not CanDock(structure_type_id, type_id):
    155                 print('skipping - not allowed to dock', type_id, evetypes.GetName(type_id, languageID='en-us'))
    156                 continue
    157             if only_unseen and bm_svc.HasSeen(type_id):
    158                 print('skipping - has seen', type_id, evetypes.GetName(type_id, languageID='en-us'))
    159                 continue
    160             if skip_duplicate_hulls:
    161                 graphic_id = evetypes.GetGraphicID(type_id)
    162                 hull = GetSofHullName(graphic_id)
    163                 if hull in hulls_played:
    164                     print('skipping - duplicate hull', type_id, evetypes.GetName(type_id, languageID='en-us'))
    165                     continue
    166                 hulls_played.add(hull)
    167             the_action(type_id)
    168 
    169         settings.user.suppress.Set('suppress.ShipNameChangeOnAssemble', was_naming_suppressed)
    170         print('play_cinematic_for_ships completed')
    171 
    172     tasklet = uthread2.start_tasklet(the_loop)
    173     return tasklet