def available_expeditions(self, value): available_expeditions = [] for exped in value: exped_id = exped['api_mission_id'] if ExpeditionEnum.contains_value(exped_id): available_expeditions.append(ExpeditionEnum(exped_id)) self._available_expeditions = available_expeditions
def __init__(self, name, data): self.name = name self.quest_id = data['id'] self.quest_type = data['type'] self.intervals = tuple(data.get('intervals', (0, 0, 0))) self.enemy_context = tuple(data.get('enemy_context', ())) map_context = data.get('map_context', ()) self.map_context = tuple([MapEnum(m) for m in map_context]) exp_context = data.get('expedition_context', ()) self.expedition_context = tuple( [ExpeditionEnum(e) for e in exp_context])
def fleet_2(self, value): if not self._validate_expeditions(value): raise ValueError( "Specified value for EXPEDITIONS_FLEET2 is not a valid exped") if ( self._config['expedition.enabled'] and len(value) > 0 and self._config['combat.enabled'] and CombinedFleetModeEnum.contains_value( self._config['combat.fleet_mode'])): raise ValueError( "Fleet 2 cannot be assigned to expeditions when combat is CF") self._fleet_2 = [ExpeditionEnum(expedition) for expedition in value]
def fleet_3(self, value): if not self._validate_expeditions(value): raise ValueError( "Specified value for EXPEDITIONS_FLEET3 is not a valid exped") if ( self._config['expedition.enabled'] and len(value) > 0 and self._config['combat.enabled'] and FleetModeEnum.STRIKE.value == self._config[ 'combat.fleet_mode']): raise ValueError( "Fleet 3 cannot be assigned to expeditions when combat is +" " strike force") self._fleet_3 = [ExpeditionEnum(expedition) for expedition in value]
def unpack_config_dict(cls, window, cfg): window['general.jst_offset'].Update(cfg['general.jst_offset']) window['general.interaction_mode'].Update( InteractionModeEnum(cfg['general.interaction_mode']).display_name) window['general.chrome_dev_port'].Update( cfg['general.chrome_dev_port']) # window['general.paused'].Update(cfg['general.paused']) window['expedition.enabled'].Update(cfg['expedition.enabled']) for fleet_id in range(2, 5): window[f'expedition.fleet_{fleet_id}'].Update(','.join([ ExpeditionEnum(x).display_name for x in cfg[f'expedition.fleet_{fleet_id}'] ])) window['pvp.enabled'].Update(cfg['pvp.enabled']) window['pvp.fleet_preset'].Update(cfg['pvp.fleet_preset']) window['combat.enabled'].Update(cfg['combat.enabled']) window['combat.sortie_map'].Update( MapEnum(cfg['combat.sortie_map']).display_name) window['combat.fleet_mode'].Update( FleetModeEnum(cfg['combat.fleet_mode']).display_name) if (cfg['combat.fleet_presets'] and len(cfg['combat.fleet_presets']) > 0): window['combat.fleet_presets'].Update(','.join( [str(fp) for fp in cfg['combat.fleet_presets']])) else: window['combat.fleet_presets'].Update('') window['combat.node_selects'].Update(','.join( cfg['combat.node_selects'])) window['combat.retreat_points'].Update(','.join( [str(x) for x in cfg['combat.retreat_points']])) window['combat.push_nodes'].Update(','.join(cfg['combat.push_nodes'])) window['combat.node_formations'].Update(','.join( cfg['combat.node_formations'])) window['combat.node_night_battles'].Update(','.join( cfg['combat.node_night_battles'])) window['combat.retreat_limit'].Update( DamageStateEnum(cfg['combat.retreat_limit']).display_name) window['combat.repair_limit'].Update( DamageStateEnum(cfg['combat.repair_limit']).display_name) window['combat.repair_timelimit_hours'].Update( cfg['combat.repair_timelimit_hours']) window['combat.repair_timelimit_minutes'].Update( cfg['combat.repair_timelimit_minutes']) for group_id in range(1, 4): if len(cfg[f'combat.lbas_group_{group_id}_nodes']) == 2: node_1 = cfg[f'combat.lbas_group_{group_id}_nodes'][0] node_2 = cfg[f'combat.lbas_group_{group_id}_nodes'][1] else: node_1 = '' node_2 = '' window[f'combat.lbas_group_{group_id}_node_1'].Update(node_1) window[f'combat.lbas_group_{group_id}_node_2'].Update(node_2) window[f'combat.lbas_group_{group_id}.enabled'].Update( group_id in cfg['combat.lbas_groups']) window['combat.check_fatigue'].Update(cfg['combat.check_fatigue']) window['combat.check_lbas_fatigue'].Update( cfg['combat.check_lbas_fatigue']) window['combat.reserve_repair_dock'].Update( cfg['combat.reserve_repair_dock']) window['combat.port_check'].Update(cfg['combat.port_check']) window['combat.clear_stop'].Update(cfg['combat.clear_stop']) window['event_reset.enabled'].Update(cfg['event_reset.enabled']) window['event_reset.frequency'].Update(cfg['event_reset.frequency']) window['event_reset.reset_difficulty'].Update( EventDifficultyEnum( cfg['event_reset.reset_difficulty']).display_name) window['event_reset.farm_difficulty'].Update( EventDifficultyEnum( cfg['event_reset.farm_difficulty']).display_name) window['ship_switcher.enabled'].Update(cfg['ship_switcher.enabled']) for slot_id in range(1, 7): if str(slot_id) in cfg['ship_switcher.slots']: window[f'ship_switcher.slot_{slot_id}_rule'].Update( cfg['ship_switcher.slots'][str(slot_id)]) window['passive_repair.enabled'].Update(cfg['passive_repair.enabled']) window['passive_repair.repair_threshold'].Update( DamageStateEnum( cfg['passive_repair.repair_threshold']).display_name) window['passive_repair.slots_to_reserve'].Update( cfg['passive_repair.slots_to_reserve']) window['quest.enabled'].Update(cfg['quest.enabled']) window['quest.quests'].Update(','.join(cfg['quest.quests'])) window['scheduler.enabled'].Update(cfg['scheduler.enabled']) window['scheduler.rules'].Update(values=cfg['scheduler.rules'])
def _validate_expeditions(self, expeditions): for expedition in expeditions: if not ExpeditionEnum.contains_value(expedition): return False return True
def fleet_4(self, value): if not self._validate_expeditions(value): raise ValueError( "Specified value for EXPEDITIONS_FLEET4 is not a valid exped") self._fleet_4 = [ExpeditionEnum(expedition) for expedition in value]