from .database import load_hero_data from .database import save_player_data from .database import save_hero_data from .database import manager ## ALL DECLARATION __all__ = ( 'players', 'unload_database', ) ## GLOBALS players = dict() all_weapons = set(weapon.name for weapon in WeaponClassIter()) for player in PlayerIter(): load_player_data(player) load_hero_data(player) players[player.userid] = player def unload_database(): manager.connection.commit() manager.connection.close() ## PLAYER MANAGMENT
from warcraft.registration import events from warcraft.skill import Skill from warcraft.utility import classproperty ## warcraft.skills imports from ..skills.self_reduce_gravity import ReduceGravitySkill ## __all__ declaration __all__ = ("FlamePredator", ) ## flamepredator declaration _knifeonly = set(weapon.basename for weapon in WeaponClassIter(not_filters='knife')) class FlamePredator(Race): @classproperty def description(cls): return 'Recoded Flame Predator. (Kryptonite)' @classproperty def max_level(cls): return 99 @classproperty def requirement_sort_key(cls): return 10
from .info import info ## ALL DECLARATION __all__ = ( '_all_weapons', 'g_configs', 'g_configs_map', ) ## GLOBALS _weapons = [ item.name.split('_')[1] for item in WeaponClassIter(not_filters=['knife', 'objective']) ] _all_weapons = set(weapon.name for weapon in WeaponClassIter()) g_configs = dict() g_configs_map = dict() with ConfigManager(info.name) as _config: # # Displaying informations # _config.section('Restrictions') for weapon in _weapons: g_configs['restrict_' + weapon + '_ct'] = _config.cvar(
from filters.weapons import WeaponClassIter from weapons.manager import weapon_manager ## __all__ = ( 'viewmodel_manager', 'worldmodel_manager', 'all_weapons', 'all_projectiles', 'all_class_names', ) ## all_weapons = [weapon.name for weapon in WeaponClassIter()] all_projectiles = list(weapon_manager.projectiles) all_class_names = all_weapons + all_projectiles ## class ModelManager(dict): '''A simplistic dictionary to store all changed models. This will raise exceptions if users try to apply more than 1 view model to a single weapon. ''' def __init__(self, name): self._name = name
if (TRANSLATION_PATH / 'strings.ini').isfile(): _strings = LangStrings(TRANSLATION_PATH / 'strings') for key in _strings: for language, message in _strings[key].items(): _strings[key][language] = message.replace( '#default', COLOR_DEFAULT).replace('#green', COLOR_GREEN).replace( '#lightgreen', COLOR_LIGHTGREEN).replace('#darkgreen', COLOR_DARKGREEN) else: _strings = None _restrictions = WeaponRestrictionHandler() _all_weapons = set( [x.basename for x in WeaponClassIter('all', ['melee', 'objective'])]) if (CFG_PATH / 'es_WCSlanguage_db.txt').isfile(): _languages = KeyValues.load_from_file(CFG_PATH / 'es_WCSlanguage_db.txt').as_dict() else: _languages = {} # ============================================================================ # >> HELPER FUNCTIONS # ============================================================================ def validate_userid_after_delay(callback, userid, *args, validator=convert_userid_to_player):
# ============================================================================= # >> ALL DECLARATION # ============================================================================= # Add all the global variables to __all__ __all__ = ('BaseEntity', 'Entity', ) # ============================================================================= # >> GLOBAL VARIABLES # ============================================================================= # Get a list of projectiles for the game _projectile_weapons = [weapon.name for weapon in WeaponClassIter('grenade')] # ============================================================================= # >> CLASSES # ============================================================================= class Entity(BaseEntity): """Class used to interact directly with entities.""" def __init__(self, index): """Initialize the Entity object.""" # Initialize the object super().__init__(index) # Set the entity's base attributes object.__setattr__(self, '_index', index)
from udm.info import info # Menus from udm.weapons.menus import primary_menu # Players from udm.players import PlayerEntity # Spawn Locations from udm.spawn_locations import menus # Weapons from udm.weapons import weapon_manager # ============================================================================= # >> FORBIDDEN ENTITIES # ============================================================================= # Store a list of forbidden entities forbidden_entities = list([ weapon_data.name for weapon_data in WeaponClassIter(is_filters='objective') ] + ['hostage_entity', 'item_defuser']) # ============================================================================= # >> MAP FUNCTIONS # ============================================================================= # Store a list of map functions to disable when they have spawned map_functions = ['func_bomb_target', 'func_buyzone', 'func_hostage_rescue'] # ============================================================================= # >> HELPER FUNCTIONS # ============================================================================= def prepare_player(player): """Prepare the player for battle.""" # Perform setting the player's spawn location on another thread
from listeners.tick import Delay from memory import make_object from messages import SayText2, TextMsg from players.constants import HitGroup from players.entity import Player from players.helpers import index_from_userid from weapons.entity import Weapon # Plugin from .config import allow_pickup, melee_damage, remove_delay, total_max from .strings import MESSAGE_STRINGS # ============================================================================= # >> GLOBAL VARIABLES # ============================================================================= _melee_weapons = [weapon.name for weapon in WeaponClassIter('melee')] _available_count = defaultdict(int) _throwers = {} _marked_for_removal = set() # ============================================================================= # >> CLIENT COMMANDS # ============================================================================= @ClientCommand('drop') def _drop_command(command, index): """Throw melee weapon on 'drop'.""" player = Player(index) class_name = getattr(player.active_weapon, 'classname', None) if class_name not in _melee_weapons: