Ejemplo n.º 1
0
def _config():
    global affinities
    global attributes
    global base_attr_value
    affinities = config_value("affinities")
    attributes = config_value("attributes")
    base_attr_value = config_value("base_attr_value")
Ejemplo n.º 2
0
def _config():
    global room_stamina
    global room_action
    global default_room_size
    room_stamina = config_value("room_stamina")
    room_action = config_value("room_action")
    default_room_size = config_value("default_room_size")
Ejemplo n.º 3
0
def _config():
    global room_stamina
    global room_action
    global default_room_size
    room_stamina = config_value('room_stamina')
    room_action = config_value('room_action')
    default_room_size = config_value('default_room_size')
Ejemplo n.º 4
0
def _config():
    global damage_categories
    damage_categories = {group['dbo_id']: set() for group in config_value('damage_groups')}
    for damage_type in config_value('damage_types'):
        dbo_id, damage_group = damage_type['dbo_id'], damage_type['group']
        if damage_group:
            damage_categories['any'].add(dbo_id)
            damage_categories[damage_group].add(dbo_id)
Ejemplo n.º 5
0
def _config():
    global _link_status_reg, _broadcast_reg, _link_dead_interval, _link_dead_prune
    check_link_interval = config_value('check_link_interval', 60)
    log.info("Registering check link interval as {} seconds", check_link_interval)
    _link_status_reg = ev.register_p(_check_link_status, seconds=check_link_interval)
    _broadcast_reg = ev.register_p(_broadcast_status, seconds=config_value('broadcast_interval'))

    _link_dead_prune = timedelta(seconds=config_value('link_dead_prune'))
    _link_dead_interval = timedelta(seconds=config_value('link_dead_interval'))
Ejemplo n.º 6
0
def _init():
    global imm_levels
    global _level_to_name
    global immortals
    global system_accounts
    imm_levels = config_value('imm_levels')
    system_accounts = config_value('system_accounts')
    _level_to_name = {level: name for name, level in imm_levels.items()}
    system_level = config_value('system_level')
    immortals = db.get_all_hash('immortals')
    immortals.update({account: system_level for account in system_accounts})
Ejemplo n.º 7
0
    def _config(self):
        refresh_link_interval = config_value('refresh_link_interval')
        log.info("Registering refresh interval as {} seconds", refresh_link_interval)
        self._link_reg = ev.register_p(self._refresh_link_status, seconds=refresh_link_interval)
        self._broadcast_reg = ev.register_p(self._broadcast_status, seconds=config_value('broadcast_interval'))

        self.link_dead_prune = timedelta(seconds=config_value('link_dead_prune'))
        self.link_dead_interval = timedelta(seconds=config_value('link_dead_interval'))
        link_idle_refresh = config_value('link_idle_refresh')
        log.info("Link idle refresh set to {} seconds", link_idle_refresh)
        self.link_idle_refresh = timedelta(seconds=link_idle_refresh)
Ejemplo n.º 8
0
def _init():
    global imm_levels
    global _level_to_name
    global immortals
    global system_accounts
    imm_levels = config_value('imm_levels')
    system_accounts = config_value('system_accounts')
    _level_to_name = {level: name for name, level in imm_levels.items()}
    system_level = config_value('system_level')
    immortals = db.get_all_hash('immortals')
    immortals.update({account: system_level for account in system_accounts})
Ejemplo n.º 9
0
def _config():
    global _link_status_reg, _broadcast_reg, _link_dead_interval, _link_dead_prune
    check_link_interval = config_value('check_link_interval', 60)
    log.info("Registering check link interval as {} seconds",
             check_link_interval)
    _link_status_reg = ev.register_p(_check_link_status,
                                     seconds=check_link_interval)
    _broadcast_reg = ev.register_p(_broadcast_status,
                                   seconds=config_value('broadcast_interval'))

    _link_dead_prune = timedelta(seconds=config_value('link_dead_prune'))
    _link_dead_interval = timedelta(seconds=config_value('link_dead_interval'))
Ejemplo n.º 10
0
def _init():
    global attributes
    global resource_pools
    global pool_keys
    global attr_list

    attributes = config_value('attributes')
    attr_list = [attr['dbo_id'] for attr in attributes]

    resource_pools = config_value('resource_pools')
    pool_keys = [(pool['dbo_id'], "base_{}".format(pool['dbo_id'])) for pool in resource_pools]

    player_cls = get_dbo_class('player')
    player_cls.add_dbo_fields({attr['dbo_id']: DBOField(0) for attr in attributes})
    player_cls.add_dbo_fields({pool['dbo_id']: DBOField(0) for pool in resource_pools})
Ejemplo n.º 11
0
def _player_create(player, user):
    if len(user.player_ids) == 1 and not player.imm_level:
        player.imm_level = perm.perm_level('builder')
        perm.update_immortal_list(player)
        ev.dispatch('imm_update', player, 0)
        message_service.add_message('system', "Welcome!  Your first player has been given immortal powers.  Check out the 'Editor' window on the top menu.", player.dbo_id)
    player.room_id = config_value('default_start_room')
Ejemplo n.º 12
0
def first_time_setup(args, db):
    root_area = config_value('root_area_id')
    room_id = "{0}:0".format(root_area)
    imm_name = args.imm_name.lower()

    db.create_object('area', {'dbo_id': root_area, 'name': root_area, 'next_room_id': 1})
    db.create_object('room', {'dbo_id': room_id, 'title': "Immortal Start Room", 'desc': "A brand new start room for immortals."})

    race_dto = PlayerRace.new_dto()
    race_dto.update(config_value('default_player_race'))
    race = db.create_object(PlayerRace, race_dto)

    supreme_level = config_value('imm_levels')['supreme']
    player = db.create_object('player', {'dbo_id': imm_name, 'room_id': room_id, 'race': race.dbo_id, 'home_room': room_id, 'imm_level': supreme_level})
    db.save_object(player)
    return player
Ejemplo n.º 13
0
def _start_heartbeat():
    global pulse_lc, maintenance_lc
    pulse_interval = config_value('pulse_interval')
    maintenance_interval = config_value('maintenance_interval')
    dispatcher.pulses_per_second = 1 / pulse_interval
    if pulse_lc:
        pulse_lc.stop()
    pulse_lc = PeriodicCallback(dispatcher.pulse, pulse_interval * 1000)
    pulse_lc.start()
    log.info("Pulse Event heartbeat started at {} seconds", pulse_interval)

    if maintenance_lc:
        maintenance_lc.stop()
    maintenance_lc = PeriodicCallback(lambda: dispatcher.dispatch('maintenance'), 60 * maintenance_interval * 1000)
    maintenance_lc.start()
    log.info("Maintenance Event heartbeat started at {} minutes", maintenance_interval)
Ejemplo n.º 14
0
def editor_login(session):
    edit_perms = []
    player = session.player
    for perm_level, tab_ids in config_value('editor_tabs').items():
        if perm.has_perm(player, perm_level):
            edit_perms.extend(tab_ids)
    session.append({'editor_login': {'edit_perms': edit_perms, 'playerId': player.dbo_id, 'imm_level': player.imm_level,
                                     'playerName': player.name}})
    edit_update.register(session)
Ejemplo n.º 15
0
 def resurrect(self, auto=True):
     ev.unregister(self._bind_pulse)
     del self._bind_pulse
     res_room = None
     if self.touchstone:
         res_room = db.load_object(self.touchstone, 'room')
     if not res_room:
         res_room = db.load_object(config_value('default_start_room'), 'room')
     self.change_env(res_room)
     self.display_line("With a sick feeling, you return to consciousness")
     self.status = 'ok'
     self.health = 1
     self.check_status()
Ejemplo n.º 16
0
def _editor_login(session):
    edit_perms = []
    player = session.player
    for perm_level, tab_ids in config_value('editor_tabs').items():
        if perm.has_perm(player, perm_level):
            edit_perms.extend(tab_ids)
    session.append({
        'editor_login': {
            'edit_perms': edit_perms,
            'playerId': player.dbo_id,
            'imm_level': player.imm_level,
            'playerName': player.name
        }
    })
    edit_update.register(session)
Ejemplo n.º 17
0
 def main(self):
     constants = {key: config_value(key) for key in ['attributes', 'resource_pools', 'equip_types', 'equip_slots', 'weapon_types',
                                                         'damage_types', 'damage_delivery', 'damage_groups', 'affinities', 'imm_levels']}
     constants['weapon_options'] = constants['weapon_types'] + [{'dbo_id': 'unused'}, {'dbo_id': 'unarmed'}, {'dbo_id': 'any'}]
     constants['skill_calculation'] = constants['attributes'] + [{'dbo_id': 'roll', 'name': 'Dice Roll'}, {'dbo_id': 'skill', 'name': 'Skill Level'}]
     constants['defense_damage_types'] = constants['damage_types'] + constants['damage_groups']
     constants['directions'] = Direction.ordered
     constants['article_load_types'] = ['equip', 'default']
     constants['broadcast_types'] = broadcast_types
     constants['broadcast_tokens'] = broadcast_tokens
     constants['skill_types'] =  [skill_template.dbo_key_type for skill_template in dbo_types(SkillTemplate)]
     constants['features'] = [get_dbo_class(feature_id)().edit_dto for feature_id in ['touchstone', 'entrance', 'store']]
     constants['action_args'] = action_keywords
     shadow_types = {}
     for class_id, cls in itertools.chain(implementors(Scriptable), instance_implementors(Scriptable)):
         shadows = [{'name': name, 'args': inspect.getargspec(member.func).args} for name, member in inspect.getmembers(cls) if isinstance(member, Shadow)]
         if shadows:
             shadow_types[class_id] = shadows
     constants['shadow_types'] = shadow_types
     constants['script_builders'] = list(builders.keys())
     self._return(constants)
Ejemplo n.º 18
0
def _start_env(player):
    instance = instance_manager.get(player.instance_id)
    instance_room = db.load_object(player.instance_room_id, 'room', silent=True)
    player_room = db.load_object(player.room_id, 'room', silent=True)

    if instance and instance_room:
        # Player is returning to an instance still in memory
        return instance.get_room(instance_room)

    if instance_room and not player_room:
        # Player has no 'non-instanced' room, so presumably was created in a new instanced tutorial/racial area
        instance = instance_manager.next_instance()
        return instance.get_room(instance_room)

    # If we get here whatever instance data was associated with the player is no longer valid
    del player.instance_id
    del player.instance_room_id

    if player_room:
        return player_room

    return db.load_object(config_value('default_start_room'), 'room')
Ejemplo n.º 19
0
 def new_dto(cls):
     dto = super().new_dto()
     dto['start_room'] = config_value('default_start_room')
     base_val = config_value('base_attr_value')
     dto['base_attrs'] = {attr['dbo_id']: base_val for attr in config_value('attributes')}
     return dto
Ejemplo n.º 20
0
def _set_displays():
    client_displays.clear()
    for display in config_value('default_displays'):
        client_displays[display['name']] = display['value']
Ejemplo n.º 21
0
def _config():
    global refresh_interval
    global refresh_rates
    refresh_interval = config_value('refresh_interval')
    refresh_rates = config_value('refresh_rates')
Ejemplo n.º 22
0
def _config():
    global room_reset_time
    room_reset_time = config_value('room_reset_time')
Ejemplo n.º 23
0
 def _prune_channels(self):
     for channel_id in self.all_channels:
         db.trim_db_list(channel_key(channel_id), 0, config_value('max_channel_history'))