diff --git a/Config/modifiers.cwt b/Config/modifiers.cwt index 6378e0a4..f9efd08e 100644 --- a/Config/modifiers.cwt +++ b/Config/modifiers.cwt @@ -290,6 +290,7 @@ modifiers = { modifier_army_sub_unit_paratrooper_defence_factor = army modifier_army_sub_unit_paratrooper_max_org_factor = army modifier_army_sub_unit_paratrooper_speed_factor = army + module__design_cost_factor = army motorized_attack_factor = army motorized_defence_factor = army mountaineers_special_forces_contribution_factor = army @@ -347,6 +348,7 @@ modifiers = { subjects_autonomy_gain = autonomy # country + enum[equipment_bonus_type]_design_cost_factor = country additional_brigade_column_size = country agency_upgrade_time = country air_doctrine_cost_factor = country @@ -478,6 +480,7 @@ modifiers = { min_export = country minimum_training_level = country modifier_enemy_port_superiority_limit = country + module__design_cost_factor = army monthly_population = country naval_doctrine_cost_factor = country naval_equipment_upgrade_xp_cost = country @@ -514,6 +517,7 @@ modifiers = { production_lack_of_resource_penalty_factor = country production_oil_factor = country production_speed_buildings_factor = country + production_speed__factor = country railway_gun_bombardment_factor = country refit_ic_cost = country refit_speed = country @@ -694,6 +698,7 @@ modifiers = { invasion_preparation = naval mines_planting_by_fleets_factor = naval mines_sweeping_by_fleets_factor = naval + module__design_cost_factor = army naval_accidents_chance = naval naval_attrition = naval naval_coordination = naval @@ -773,6 +778,7 @@ modifiers = { puppet_cost_factor = peace # politics + _drift = politics drift_defence_factor = politics embargo_cost_factor = politics embargo_threshold_factor = politics diff --git a/tests/test_check_missing_modifiers.py b/tests/test_check_missing_modifiers.py index 956d9e06..a3235988 100644 --- a/tests/test_check_missing_modifiers.py +++ b/tests/test_check_missing_modifiers.py @@ -1,4 +1,5 @@ import json +import re path_to_config = "Config\\modifiers.cwt" path_to_documentation = "Config\\script_documentation.json" @@ -22,7 +23,7 @@ def check_missing_modifiers(): modifiers_dict[modifier['name']] = modifier['categories'] # Dynamic modifier elif "groupname" in modifier.keys(): - pass + modifiers_dict[modifier['groupname']] = modifier['categories'] # 2 Extract modifiers from config files with open(path_to_config, 'r') as text_file: @@ -31,7 +32,30 @@ def check_missing_modifiers(): # 3 Compare documentation and config for key, values in modifiers_dict.items(): for value in values: - if f'{key} = {value}\n' not in config_file: + # Dynamic modifier + if "<" in key: + # Modifier starts with the token + if key[0] == '<': + stripped_key = key[key.index('>')+1:] + if f'{stripped_key} = {value}\n' not in config_file: + results.append(f'{key} = {value}') + # Modifier ends with the token + elif key[-1] == '>': + stripped_key = key[:key.index('<')] + pattern = stripped_key + r'.*? = ' + value + pattern_matches = re.findall(pattern, config_file) + if pattern_matches == []: + results.append(f'{key} = {value}') + # Token is somewhere in the middle of the modifier + else: + splitted_key = key.split('<') + key1 = splitted_key[0] + key2 = splitted_key[1][splitted_key[1].index('>')+1:] + pattern = key1 + r'.*?' + key2 + r' = ' + value + pattern_matches = re.findall(pattern, config_file) + if pattern_matches == []: + results.append(f'{key} = {value}') + elif f'{key} = {value}\n' not in config_file: results.append(f'{key} = {value}') # 4 Format the results