from spyd.utils.import_all import import_all import_all(__file__, 'spyd.game.room.player_event_handlers', ['__init__']) from spyd.registry_manager import RegistryManager def get_player_event_handlers(): player_event_handlers = {} for registered_event_handler in RegistryManager.get_registrations( 'room_player_event_handler'): event_handler = registered_event_handler.registered_object event_type = event_handler.event_type player_event_handlers[event_type] = event_handler return player_event_handlers
from spyd.registry_manager import register, RegistryManager from spyd.utils.import_all import import_all import_all(__file__, 'spyd.game.client.message_handlers', ['__init__']) def get_message_handlers(): message_handlers = {} for registered_message_handler in RegistryManager.get_registrations( 'client_message_handler'): message_handler = registered_message_handler.registered_object message_type = message_handler.message_type message_handlers[message_type] = message_handler return message_handlers
from spyd.registry_manager import RegistryManager from spyd.utils.import_all import import_all import_all(__file__, 'spyd.game.gamemode', ['__init__']) mode_nums = {} gamemodes = {} gamemode_objects = map(lambda a: a.registered_object, RegistryManager.get_registrations('gamemode')) for gamemode_object in gamemode_objects: if gamemode_object.isbasemode: mode_nums[gamemode_object.clientmodenum] = gamemode_object.clientmodename for gamemode_object in gamemode_objects: gamemodes[gamemode_object.clientmodename] = gamemode_object def get_mode_name_from_num(mode_num): return mode_nums.get(mode_num, None)
from spyd.utils.import_all import import_all import_all(__file__, 'spyd.authentication.services', ['__init__'])
from spyd.registry_manager import RegistryManager from spyd.utils.import_all import import_all import_all(__file__, 'spyd.game.gamemode', ['__init__']) mode_nums = {} gamemodes = {} gamemode_objects = [ a.registered_object for a in RegistryManager.get_registrations('gamemode') ] for gamemode_object in gamemode_objects: if gamemode_object.isbasemode: mode_nums[ gamemode_object.clientmodenum] = gamemode_object.clientmodename for gamemode_object in gamemode_objects: gamemodes[gamemode_object.clientmodename] = gamemode_object def get_mode_name_from_num(mode_num): return mode_nums.get(mode_num, None)
from spyd.registry_manager import register, RegistryManager from spyd.utils.import_all import import_all import_all(__file__, 'spyd.game.client.message_handlers', ['__init__']) def get_message_handlers(): message_handlers = {} for registered_message_handler in RegistryManager.get_registrations('client_message_handler'): message_handler = registered_message_handler.registered_object message_type = message_handler.message_type message_handlers[message_type] = message_handler return message_handlers
from cube2common.colors import colors from spyd.game.server_message_formatter import smf, info, wrapper_function from spyd.registry_manager import RegistryManager from spyd.utils.import_all import import_all import_all(__file__, 'spyd.game.awards', ['__init__']) def format_name(client): return smf.format("{name#client}", client=client) def format_names(clients): names = map(format_name, clients) if len(names) == 1: return names[0] if len(names) > 2: names = [', '.join(names[:-1]), names[-1]] return ', and '.join(names) def format_award(award, names, value): award_text = award.award_text names = format_names(names) value = award.format_stat(value) return smf.format("{award_text}: {winners} ({value#value})", award_text=award_text, winners=names, value=value) class AwardInstance(object): def __init__(self, award, clients_iter):
from spyd.utils.import_all import import_all import_all(__file__, 'spyd.game.command.commands', ['__init__'])
from spyd.utils.import_all import import_all import_all(__file__, 'spyd.game.room.player_event_handlers', ['__init__']) from spyd.registry_manager import RegistryManager def get_player_event_handlers(): player_event_handlers = {} for registered_event_handler in RegistryManager.get_registrations('room_player_event_handler'): event_handler = registered_event_handler.registered_object event_type = event_handler.event_type player_event_handlers[event_type] = event_handler return player_event_handlers
from spyd.utils.import_all import import_all import_all(__file__, 'spyd.server.gep_message_handlers', ['__init__'])
from cube2common.colors import colors from spyd.game.server_message_formatter import smf, info, wrapper_function from spyd.registry_manager import RegistryManager from spyd.utils.import_all import import_all import_all(__file__, 'spyd.game.awards', ['__init__']) def format_name(client): return smf.format("{name#client}", client=client) def format_names(clients): names = list(map(format_name, clients)) if len(names) == 1: return names[0] if len(names) > 2: names = [', '.join(names[:-1]), names[-1]] return ', and '.join(names) def format_award(award, names, value): award_text = award.award_text names = format_names(names) value = award.format_stat(value) return smf.format("{award_text}: {winners} ({value#value})", award_text=award_text, winners=names, value=value) class AwardInstance(object): def __init__(self, award, clients_iter):