from config.manager import ConfigManager from cvars.flags import ConVarFlags from .info import info config_manager = ConfigManager(info.basename, cvar_prefix="killerinfo_") config_manager.header = 'KillerInfo Configuration File' killerinfo_enabled = config_manager.cvar('enabled', '1', 'Enable/Disable the plugin\'s functionality (0 = disabled, 1 = enabled)', ConVarFlags.NONE) config_manager.write() config_manager.execute()
# ============================================================================= # >> REGISTRATION # ============================================================================= for _type in ('punishments', 'rewards'): for _file in _base_path.joinpath(_type).files('*.py'): if _file.namebase == '__init__': continue import_module( _file.replace(_base_path.parent, '')[1:-3].replace('/', '.').replace('\\', '.')) # ============================================================================= # >> CONFIGURATION # ============================================================================= with ConfigManager(info.name, 'sasc_') as _config: percent_for_both = _config.cvar('percent_for_both', 50, _config_strings['percent_for_both']) disabled_punishments = _config.cvar( 'disabled_punishments', '', _config_strings['disabled_punishments']) disabled_punishments.text(_config_strings['disabled_options']) disabled_punishments.text(' ' + ','.join(choice_manager.punishments.keys())) disabled_rewards = _config.cvar('disabled_rewards', '', _config_strings['disabled_rewards']) disabled_rewards.text(_config_strings['disabled_options']) disabled_rewards.text(' ' + ','.join(choice_manager.rewards.keys()))
## IMPORTS from config.manager import ConfigManager from translations.strings import LangStrings from .info import info ## ALL DECLARATION __all__ = ('g_configs', ) ## GLOBALS g_configs = dict() with ConfigManager(info.name) as _config: # # Displaying message # _config.section('Display') g_configs['display_type'] = _config.cvar( 'display_type', 2, '1 - Display in chat | 2 - Display in hint text', 0) # # Displaying informations # _config.section('Informations') g_configs['show_hit_member'] = _config.cvar( 'show_hit_member', 1,
from .strings import CONFIG_STRINGS # ============================================================================= # >> ALL DECLARATION # ============================================================================= __all__ = ( 'allow_pickup', 'melee_damage', 'remove_delay', 'total_max', ) # ============================================================================= # >> CONFIGURATION # ============================================================================= with ConfigManager(info.name, 'throw_melee_') as _config: remove_delay = _config.cvar( name='remove_delay', default=10, description=CONFIG_STRINGS['remove_delay'], min_value=1, ) total_max = _config.cvar( name='total_max', default=3, description=CONFIG_STRINGS['total_max'], min_value=1, ) allow_pickup = _config.cvar( name='allow_pickup', default=1,
'cfg_top_public_announcement', 'cfg_top_stolen_notify', 'cfg_welcome_gui_text', 'cfg_welcome_text', 'cfg_debug_alias_duplicate', 'cfg_level_up_effect', 'cfg_rank_gain_effect', 'cfg_assist_xp', 'cfg_round_survival_xp', 'cfg_round_win_xp', 'cfg_bomb_plant_xp', 'cfg_bomb_defuse_xp', 'cfg_bomb_explode_xp', 'cfg_hostage_rescue_xp', 'cfg_bot_assist_xp', 'cfg_bot_round_survival_xp', 'cfg_bot_round_win_xp', 'cfg_bot_bomb_plant_xp', 'cfg_bot_bomb_explode_xp', 'cfg_bot_bomb_defuse_xp', 'cfg_bot_hostage_rescue_xp', 'cfg_bot_ability_chance') # ============================================================================ # >> CONFIGURATION # ============================================================================ # Create the configuration file with ConfigManager(f'{info.name}/config.cfg', cvar_prefix=f'{info.name}_') as config: cfg_interval = config.cvar('interval', '80', config_strings['interval']) cfg_bonus_xp = config.cvar('bonus_xp', '4', config_strings['bonus_xp']) cfg_bonus_bot_xp = config.cvar('bonus_bot_xp', '4', config_strings['bonus_bot_xp']) cfg_bonus_xp_level_cap = config.cvar('bonus_xp_level_cap', '0', config_strings['bonus_xp_level_cap']) cfg_kill_xp = config.cvar('kill_xp', '20', config_strings['kill_xp']) cfg_kill_bot_xp = config.cvar('kill_bot_xp', '20', config_strings['kill_bot_xp']) cfg_knife_xp = config.cvar('knife_xp', '40', config_strings['knife_xp']) cfg_knife_bot_xp = config.cvar('knife_bot_xp', '40', config_strings['knife_bot_xp']) cfg_headshot_xp = config.cvar('headshot_xp', '15', config_strings['headshot_xp']) cfg_headshot_bot_xp = config.cvar('headshot_bot_xp', '15',
from listeners.tick import Repeat from listeners import OnLevelInit from events import Event from players.entity import Player from filters.players import PlayerIter from time import time from menus import PagedMenu from menus import PagedOption from menus import SimpleMenu from menus import SimpleOption from menus import Text import wcs addon_config = ConfigManager('restedxp') toggle = addon_config.cvar("wcs_restedexp_cfg_toggle", 1) timer = addon_config.cvar("wcs_restedexp_cfg_timer", 60) tickaxp = addon_config.cvar("wcs_restedexp_cfg_a_tickxp", 1) tickoxp = addon_config.cvar("wcs_restedexp_cfg_o_tickxp", 0) gainxp = addon_config.cvar("wcs_restedexp_cfg_gainxp", 5) addon_config.write() db = pickle.getDict() joined = set() def exptick(): for player in PlayerIter(): steamid = player.steamid
# ../dnd5e/core/config.py # Source.Python from config.manager import ConfigManager # D&D 5e from ..info import info __all__ = ('bot_races', 'bot_classes') # Create a config file in the '../cfg/source-python/dnd5e' folder. with ConfigManager(f'{info.name}/config.cfg', f'{info.name}_') as config: config.header = f'{info.verbose_name} Settings' bot_races = config.cvar('bot_races', 'Human, Elf, Dwarf', 'Which races are the bots allowed to play as?') bot_classes = config.cvar( 'bot_classes', 'Fighter', 'Which classes are the bots allowed to play as?')
# Get the human player index iterator _human_players = PlayerIter('human') # Store the possible options _options = { int(item.split(':')[1]): value for item, value in most_damage_strings.items() if item.startswith('Option:') } # ============================================================================= # >> CONFIGURATION # ============================================================================= # Create the most_damage.cfg file and execute it upon __exit__ with ConfigManager(info.basename) as config: # Create the default location convar default_location = config.cvar('md_default_location', 1, most_damage_strings['Default Location']) # Loop through the possible location options for _item, _value in sorted(_options.items()): # Add the current option to the convar's text default_location.Options.append('{0} = {1}'.format( _item, _value.get_string())) # ============================================================================= # >> CLASSES
from cvars.flags import ConVarFlags from config.manager import ConfigManager ## __all__ declaration __all__ = ( "rotd_count", "should_remove_requirements", "experience_for_kill", "experience_for_headshot", "experience_for_win", ) ## config with ConfigManager("warcraft/rotd") as manager: ## Add the package header. manager.header = "Warcraft Source - ROTD" rotd_count = manager.cvar("warcraft_rotd_amount", 2, "The amount of races to add as ROTD.\n", ConVarFlags.NOTIFY) should_remove_requirements = manager.cvar( "warcraft_rotd_remove_requirements", 1, "Should the race lose its requirements to use? 1 = Yes, 0 = No\n", ConVarFlags.NOTIFY) experience_for_kill = manager.cvar( "warcraft_rotd_experience_for_kill", 50, "The extra experience gained for killing another player.\n",
from .info import info from .strings import CONFIG_STRINGS # ============================================================================= # >> ALL DECLARATION # ============================================================================= __all__ = ( 'beam_model', 'beam_time', 'beam_width', ) # ============================================================================= # >> CONFIGURATION # ============================================================================= with ConfigManager(info.name, 'db_') as _config: beam_width = _config.cvar( name='beam_width', default=10, description=CONFIG_STRINGS['beam_width'], ) beam_time = _config.cvar( name='beam_time', default=4, description=CONFIG_STRINGS['beam_time'], ) beam_model = _config.cvar( name='beam_model', default='sprites/laser{suffix}.vmt'.format(
# >> IMPORTS # ============================================================================= # Source.Python Imports # Config from config.manager import ConfigManager # Script Imports # Info from udm.info import info # ============================================================================= # >> CONFIGURATION CVARS # ============================================================================= # ../cfg/source-python/udm.cfg with ConfigManager(info.name, f'{info.name}_') as config: config.text('Ultimate Deathmatch plugin configuration file') config.text(' ') config.text('----------------------------------') config.text(' * Respawn') config.text('----------------------------------') cvar_respawn_delay = config.cvar('respawn_delay', 2, 'The respawn delay (in seconds).') config.text('----------------------------------') config.text(' * Spawn Protection') config.text('----------------------------------')
from cvars.flags import ConVarFlags from config.manager import ConfigManager ## __all__ declaration __all__ = ("logging_level", "default_race", "race_minimum_level", "race_maximum_level", "race_bot_options", "experience_for_kill", "experience_for_headshot", "experience_for_level_difference", "experience_for_win", "experience_for_loss", "experience_punish_for_loss", "experience_for_plant", "experience_for_explode", "experience_for_defuse") ## config declaration with ConfigManager("warcraft") as manager: ## Add the package header. manager.header = "Warcraft Source - Remastered" ## Add the package-wide CVARs. logging_level = manager.cvar( "warcraft_logging_level", 1, "The maximum level of logging entries that should print to the log.\n", ConVarFlags.CHEAT) logging_level.Description.append("INFO = 1") logging_level.Description.append("DEBUG = 2") logging_level.Description.append("WARNING = 3") logging_level.Description.append("ERROR = 4") race_section = manager.section("Race Configuration")
from config.manager import ConfigManager from core import SOURCE_ENGINE_BRANCH from paths import PLUGIN_DATA_PATH, GAME_PATH import os WCS_DATA_PATH = PLUGIN_DATA_PATH / 'wcs' if not WCS_DATA_PATH.exists(): WCS_DATA_PATH.makedirs() LEVELBANK_DB_PATH = WCS_DATA_PATH / 'levelbank.db' CORE_DB_PATH = WCS_DATA_PATH / 'players.db' CORE_DB_REL_PATH = CORE_DB_PATH.relpath(GAME_PATH.parent) LEVELBANK_DB_REL_PATH = LEVELBANK_DB_PATH.relpath(GAME_PATH.parent) core_config = ConfigManager('wcs/wcs_core') saving = core_config.cvar('wcs_save_mode', 0) save_time = core_config.cvar('wcs_save_delay', 5) xpsaver = core_config.cvar('wcs_cfg_savexponround', 5) db_string = core_config.cvar('wcs_database_connectstring', f'sqlite:///{CORE_DB_REL_PATH}') lvl_string = core_config.cvar('wcs_levelbank_connectstring', f'sqlite:///{LEVELBANK_DB_REL_PATH}') racecategories = core_config.cvar('wcs_racecats', 0) defaultcategory = core_config.cvar('wcs_racecats_defaultcategory', 'Default category')
## source.python imports from config.manager import ConfigManager from cvars.flags import ConVarFlags ## __all__ declaration __all__ = ( "levelbank_start_amount", "levelbank_menu_values", "levelbank_admin_menu_values", ) ## config with ConfigManager("warcraft/levelbank") as manager: ## Add the package header. manager.header = "Warcraft Source - Level Bank" levelbank_start_amount = manager.cvar( "warcraft_levelbank_start_amount", 100, "The amount of levels a user should start with.\n", ConVarFlags.NOTIFY) levelbank_menu_values = manager.cvar( "warcraft_levelbank_menu_values", "1,5,10,25,40", "The level options available in the levelbank menu.\n", ConVarFlags.NOTIFY) levelbank_admin_menu_values = manager.cvar( "warcraft_levelbank_admin_menu_values", "10,50,100,250,500", "The level options available in the levelbank admin menu.\n",
from config.manager import ConfigManager from wcs import wcsgroup import wcs from events import Event from players.entity import Player from filters.players import PlayerIter cfg = ConfigManager('xpbounty') streakvar = cfg.cvar("wcs_xpbounty_cfg_streak", 5) teambountyvar = cfg.cvar("wcs_xpbounty_cfg_team_bounty", 0) telltypevar = cfg.cvar("wcs_xpbounty_cfg_tell_type", 0) xpstartvar = cfg.cvar("wcs_xpbounty_cfg_xp_start", 5) xpincreasevar = cfg.cvar("wcs_xpbounty_cfg_xp_increase", 5) cfg.write() streak = streakvar.get_int() teambounty = teambountyvar.get_int() telltype = telltypevar.get_int() xpstart = xpstartvar.get_int() xpincrease = xpincreasevar.get_int() @Event('player_activate') def player_activate(ev): wcsgroup.setUser(ev["userid"], "wcs_bounty_kills", 0) wcsgroup.setUser(ev["userid"], "wcs_bounty_bounty", 0) @Event('player_death') def player_death(ev): atk_play = Player.from_userid(ev['attacker'])
'dissolver_delay', 'dissolver_magnitude', 'dissolver_type', ) # ============================================================================= # >> GLOBAL VARIABLES # ============================================================================= # Store the number of dissolve types NUM_DISSOLVE_TYPES = len(DissolveType) # ============================================================================= # >> CONFIGURATION # ============================================================================= # Create the dissolver.cfg file and execute it upon __exit__ with ConfigManager(info.name, 'dissolver_') as _config: # Create the dissolver type cvar dissolver_type = _config.cvar('type', 0, CONFIG_STRINGS['Type']) # Loop through all dissolver types for _obj in DissolveType: # Add the current dissolver type to the list of options dissolver_type.Options.append(f'{_obj.real} = {_obj.name}') # Add random and remove to the list of options for _num, _option in enumerate(('RANDOM', 'REMOVE'), start=NUM_DISSOLVE_TYPES + 1): dissolver_type.Options.append(f'{_num} = {_option}')