예제 #1
0
def on_player_say(game_event):
    """Executes ultimate skills and opens the menu."""

    # Get the player and the text
    player = Player.from_userid(game_event.get_int('userid'))
    text = game_event.get_string('text')

    # Finally, execute hero's player_say skills
    player.hero.execute_skills('player_say', player=player, text=text)
예제 #2
0
def on_player_say(game_event):
    """Executes ultimate skills and opens the menu."""

    # Get the player and the text
    player = Player.from_userid(game_event.get_int('userid'))
    text = game_event.get_string('text')

    # Finally, execute hero's player_say skills
    player.hero.execute_skills('player_say', player=player, text=text)
예제 #3
0
def on_bomb_defused(game_event):
    """Give exp from bomb defusion.

    Also executes bomb_defused skills.
    """

    player = Player.from_userid(game_event.get_int('userid'))
    give_exp(player, 'Bomb Defuse')
    give_team_exp(player, 'Bomb Defuse Team')
    player.hero.execute_skills('bomb_defused', player=player)
예제 #4
0
def on_hostage_rescued(game_event):
    """Give exp from hostage rescue.

    Also executes hostage_rescued skills.
    """

    player = Player.from_userid(game_event.get_int('userid'))
    give_exp(player, 'Hostage Rescue')
    give_team_exp(player, 'Hostage Rescue Team')
    player.hero.execute_skills('hostage_rescued', player=player)
예제 #5
0
def on_hostage_follows(game_event):
    """Give exp from hostage pick up.

    Also executes hostage_follows skills.
    """

    player = Player.from_userid(game_event.get_int('userid'))
    give_exp(player, 'Hostage Pick Up')
    give_team_exp(player, 'Hostage Pick Up Team')
    player.hero.execute_skills('hostage_follows', player=player)
예제 #6
0
def on_bomb_defused(game_event):
    """Give exp from bomb defusion.

    Also executes bomb_defused skills.
    """

    player = Player.from_userid(game_event.get_int('userid'))
    give_exp(player, 'Bomb Defuse')
    give_team_exp(player, 'Bomb Defuse Team')
    player.hero.execute_skills('bomb_defused', player=player)
예제 #7
0
def on_bomb_planted(game_event):
    """Give exp from bomb planting.

    Also executes bomb_planted skills.
    """

    player = Player.from_userid(game_event.get_int('userid'))
    give_exp(player, 'Bomb Plant')
    give_team_exp(player, 'Bomb Plant Team')
    player.hero.execute_skills('bomb_planted', player=player)
예제 #8
0
def on_hostage_follows(game_event):
    """Give exp from hostage pick up.

    Also executes hostage_follows skills.
    """

    player = Player.from_userid(game_event.get_int('userid'))
    give_exp(player, 'Hostage Pick Up')
    give_team_exp(player, 'Hostage Pick Up Team')
    player.hero.execute_skills('hostage_follows', player=player)
예제 #9
0
def on_bomb_planted(game_event):
    """Give exp from bomb planting.

    Also executes bomb_planted skills.
    """

    player = Player.from_userid(game_event.get_int('userid'))
    give_exp(player, 'Bomb Plant')
    give_team_exp(player, 'Bomb Plant Team')
    player.hero.execute_skills('bomb_planted', player=player)
예제 #10
0
def on_hostage_rescued(game_event):
    """Give exp from hostage rescue.

    Also executes hostage_rescued skills.
    """

    player = Player.from_userid(game_event.get_int('userid'))
    give_exp(player, 'Hostage Rescue')
    give_team_exp(player, 'Hostage Rescue Team')
    player.hero.execute_skills('hostage_rescued', player=player)
예제 #11
0
def on_player_death(game_event):
    """Executes kill, assist and death skills.

    Also gives exp from kill and assist.
    """

    # Get the defender
    defender = Player.from_userid(game_event.get_int('userid'))

    # Create the event arguments dict
    eargs = {
        'defender': defender,
        'attacker': None,
        'headshot': game_event.get_bool('headshot'),
        'weapon': game_event.get_string('weapon')
    }

    # Get the attacker and execute his and defender's skills
    attacker_id = game_event.get_int('attacker')
    if attacker_id and attacker_id != defender.userid:
        attacker = Player.from_userid(attacker_id)
        eargs['attacker'] = attacker
        attacker.hero.execute_skills('player_kill', **eargs)
        defender.hero.execute_skills('player_death', **eargs)

        # Give attacker exp from kill and headshot
        give_exp(attacker, 'Kill')
        if eargs['headshot']:
            give_exp(attacker, 'Headshot')

        # Give attacker gold from kill
        give_gold(attacker, 'Kill')

    # Else execute player_suicide skills
    else:
        defender.hero.execute_skills('player_suicide', **eargs)

    # Finally, remove defender's items
    for item in defender.hero.items:
        if not item.permanent:
            defender.hero.items.remove(item)
예제 #12
0
def on_player_death(game_event):
    """Executes kill, assist and death skills.

    Also gives exp from kill and assist.
    """

    # Get the defender
    defender = Player.from_userid(game_event.get_int('userid'))

    # Create the event arguments dict
    eargs = {
        'defender': defender,
        'attacker': None,
        'headshot': game_event.get_bool('headshot'),
        'weapon': game_event.get_string('weapon')
    }

    # Get the attacker and execute his and defender's skills
    attacker_id = game_event.get_int('attacker')
    if attacker_id and attacker_id != defender.userid:
        attacker = Player.from_userid(attacker_id)
        eargs['attacker'] = attacker
        attacker.hero.execute_skills('player_kill', **eargs)
        defender.hero.execute_skills('player_death', **eargs)

        # Give attacker exp from kill and headshot
        give_exp(attacker, 'Kill')
        if eargs['headshot']:
            give_exp(attacker, 'Headshot')

        # Give attacker gold from kill
        give_gold(attacker, 'Kill')

    # Else execute player_suicide skills
    else:
        defender.hero.execute_skills('player_suicide', **eargs)

    # Finally, remove defender's items
    for item in defender.hero.items:
        if not item.permanent:
            defender.hero.items.remove(item)
예제 #13
0
def on_player_hurt(game_event):
    """Executes attack and defend skills."""

    # Get the defender
    defender = Player.from_userid(game_event.get_int('userid'))

    # Get the attacker
    attacker_id = game_event.get_int('attacker')
    if attacker_id and attacker_id != defender.userid:
        attacker = Player.from_userid(attacker_id)

        # Create event arguments dict
        eargs = {
            'defender': defender,
            'attacker': attacker,
            'damage': game_event.get_int('dmg_health'),
            'damage_armor': game_event.get_int('dmg_armor'),
            'weapon': game_event.get_string('weapon')
        }

        # Execute attacker's and defender's skills
        attacker.hero.execute_skills('player_attack', **eargs)
        defender.hero.execute_skills('player_defend', **eargs)
예제 #14
0
def on_player_hurt(game_event):
    """Executes attack and defend skills."""

    # Get the defender
    defender = Player.from_userid(game_event.get_int('userid'))

    # Get the attacker
    attacker_id = game_event.get_int('attacker')
    if attacker_id and attacker_id != defender.userid:
        attacker = Player.from_userid(attacker_id)

        # Create event arguments dict
        eargs = {
            'defender': defender,
            'attacker': attacker,
            'damage': game_event.get_int('dmg_health'),
            'damage_armor': game_event.get_int('dmg_armor'),
            'weapon': game_event.get_string('weapon')
        }

        # Execute attacker's and defender's skills
        attacker.hero.execute_skills('player_attack', **eargs)
        defender.hero.execute_skills('player_defend', **eargs)
예제 #15
0
def on_player_spawn(game_event):
    """Saves player's data.

    Also executes spawn skills and shows current exp/level progress.
    """

    # Get the player and his hero
    player = Player.from_userid(game_event.get_int('userid'))
    hero = player.hero

    # Show current exp and level
    other_messages['Hero Status'].send(player.index,
                                       name=hero.name,
                                       level=hero.level,
                                       current=hero.exp,
                                       required=hero.required_exp)

    # Execute spawn skills if the player's on a valid team
    if player.team > 1:
        hero.execute_skills('player_spawn', player=player)
예제 #16
0
def on_player_spawn(game_event):
    """Saves player's data.

    Also executes spawn skills and shows current exp/level progress.
    """

    # Get the player and his hero
    player = Player.from_userid(game_event.get_int('userid'))
    hero = player.hero

    # Show current exp and level
    other_messages['Hero Status'].send(
        player.index,
        name=hero.name,
        level=hero.level,
        current=hero.exp,
        required=hero.required_exp
    )

    # Execute spawn skills if the player's on a valid team
    if player.team > 1:
        hero.execute_skills('player_spawn', player=player)
예제 #17
0
def on_player_jump(game_event):
    """Executes jump skills."""

    player = Player.from_userid(game_event.get_int('userid'))
    player.hero.execute_skills('player_jump', player=player)
예제 #18
0
def on_player_jump(game_event):
    """Executes jump skills."""

    player = Player.from_userid(game_event.get_int('userid'))
    player.hero.execute_skills('player_jump', player=player)