// IW6 GSC SOURCE
// Generated by https://github.com/xensik/gsc-tool

init_perk_none()
{
    var_0 = spawnstruct();
    return var_0;
}

set_perk_none()
{

}

unset_perk_none()
{

}

init_perk_health()
{
    var_0 = spawnstruct();
    var_0.melee_scalar = 1.0;
    return var_0;
}

set_perk_health_level_0()
{
    self.perk_data["health"].max_health = 125;
    self.perk_data["health"].melee_scalar = 1.0;
}

unset_perk_health_level_0()
{
    self.perk_data["health"].melee_scalar = 1.0;
}

set_perk_health_level_1()
{
    self.perk_data["health"].max_health = 125;
    self.maxhealth = self.perk_data["health"].max_health;
    self notify( "health_perk_upgrade" );
    self.perk_data["health"].melee_scalar = 1.25;
}

unset_perk_health_level_1()
{
    self.perk_data["health"].melee_scalar = 1.0;
}

set_perk_health_level_2()
{
    self.perk_data["health"].max_health = 150;
    self.maxhealth = self.perk_data["health"].max_health;
    self notify( "health_perk_upgrade" );
    self.perk_data["health"].melee_scalar = 1.25;
}

unset_perk_health_level_2()
{
    self.perk_data["health"].melee_scalar = 1.0;
}

set_perk_health_level_3()
{
    self.perk_data["health"].max_health = 175;
    self.maxhealth = self.perk_data["health"].max_health;
    self notify( "health_perk_upgrade" );
    self.perk_data["health"].melee_scalar = 1.5;
}

unset_perk_health_level_3()
{
    self.perk_data["health"].melee_scalar = 1.0;
}

set_perk_health_level_4()
{
    self.perk_data["health"].max_health = 200;
    self.maxhealth = self.perk_data["health"].max_health;
    self notify( "health_perk_upgrade" );
    self.perk_data["health"].melee_scalar = 2.0;
}

unset_perk_health_level_4()
{
    self.perk_data["health"].melee_scalar = 1.0;
}

init_perk_bullet_damage()
{
    var_0 = spawnstruct();
    var_0.bullet_damage_scalar = 1.0;
    return var_0;
}

set_perk_bullet_damage_0()
{
    self.perk_data["damagemod"].bullet_damage_scalar = 1.2;
}

unset_perk_bullet_damage_0()
{
    self.perk_data["damagemod"].bullet_damage_scalar = 1.0;
}

set_perk_bullet_damage_1()
{
    self.perk_data["damagemod"].bullet_damage_scalar = 1.2;
    maps\mp\_utility::giveperk( "specialty_quickswap", 0 );
    maps\mp\_utility::giveperk( "specialty_stalker", 0 );
    maps\mp\_utility::giveperk( "specialty_fastoffhand", 0 );
}

unset_perk_bullet_damage_1()
{
    self.perk_data["damagemod"].bullet_damage_scalar = 1.0;
    maps\mp\_utility::_unsetperk( "specialty_quickswap" );
    maps\mp\_utility::_unsetperk( "specialty_stalker" );
    maps\mp\_utility::_unsetperk( "specialty_fastoffhand" );
}

set_perk_bullet_damage_2()
{
    self.perk_data["damagemod"].bullet_damage_scalar = 1.2;
    maps\mp\_utility::giveperk( "specialty_quickswap", 0 );
    maps\mp\_utility::giveperk( "specialty_stalker", 0 );
    maps\mp\_utility::giveperk( "specialty_fastoffhand", 0 );
    maps\mp\_utility::giveperk( "specialty_quickdraw", 0 );
}

unset_perk_bullet_damage_2()
{
    self.perk_data["damagemod"].bullet_damage_scalar = 1.0;
    maps\mp\_utility::_unsetperk( "specialty_quickswap" );
    maps\mp\_utility::_unsetperk( "specialty_stalker" );
    maps\mp\_utility::_unsetperk( "specialty_fastoffhand" );
    maps\mp\_utility::_unsetperk( "specialty_quickdraw" );
}

set_perk_bullet_damage_3()
{
    self.perk_data["damagemod"].bullet_damage_scalar = 1.2;
    maps\mp\_utility::giveperk( "specialty_quickswap", 0 );
    maps\mp\_utility::giveperk( "specialty_stalker", 0 );
    maps\mp\_utility::giveperk( "specialty_fastoffhand", 0 );
    maps\mp\_utility::giveperk( "specialty_quickdraw", 0 );
    maps\mp\_utility::giveperk( "specialty_fastreload", 0 );
}

unset_perk_bullet_damage_3()
{
    self.perk_data["damagemod"].bullet_damage_scalar = 1.0;
    maps\mp\_utility::_unsetperk( "specialty_quickswap" );
    maps\mp\_utility::_unsetperk( "specialty_stalker" );
    maps\mp\_utility::_unsetperk( "specialty_fastoffhand" );
    maps\mp\_utility::_unsetperk( "specialty_quickdraw" );
    maps\mp\_utility::giveperk( "specialty_fastreload", 0 );
}

set_perk_bullet_damage_4()
{
    self.perk_data["damagemod"].bullet_damage_scalar = 1.5;
    maps\mp\_utility::giveperk( "specialty_quickswap", 0 );
    maps\mp\_utility::giveperk( "specialty_stalker", 0 );
    maps\mp\_utility::giveperk( "specialty_fastoffhand", 0 );
    maps\mp\_utility::giveperk( "specialty_quickdraw", 0 );
    self setaimspreadmovementscale( 0.5 );
    maps\mp\_utility::giveperk( "specialty_fastreload", 0 );
}

unset_perk_bullet_damage_4()
{
    self.perk_data["damagemod"].bullet_damage_scalar = 1.0;
    maps\mp\_utility::_unsetperk( "specialty_quickswap" );
    maps\mp\_utility::_unsetperk( "specialty_stalker" );
    maps\mp\_utility::_unsetperk( "specialty_fastoffhand" );
    maps\mp\_utility::_unsetperk( "specialty_quickdraw" );
    self setaimspreadmovementscale( 1.0 );
    maps\mp\_utility::_unsetperk( "specialty_fastreload" );
}

init_perk_medic()
{
    var_0 = spawnstruct();
    var_0.revive_time_scalar = 1.0;
    var_0.gas_damage_scalar = 1.0;
    var_0.move_speed_scalar = 1.0;
    var_0.revive_damage_scalar = 1.0;
    return var_0;
}

set_perk_medic_0()
{
    self.perk_data["medic"].revive_time_scalar = 1.5;
    self.movespeedscaler = maps\mp\alien\_prestige::prestige_getmoveslowscalar();
    self.perk_data["medic"].move_speed_scalar = self.movespeedscaler;
}

unset_perk_medic_0()
{
    self.perk_data["medic"].revive_time_scalar = 1.0;
    self.movespeedscaler = 1.0 * maps\mp\alien\_prestige::prestige_getmoveslowscalar();
    self.perk_data["medic"].move_speed_scalar = self.movespeedscaler;
}

set_perk_medic_1()
{
    self.perk_data["medic"].revive_time_scalar = 1.5;
    self.movespeedscaler = 1.06 * maps\mp\alien\_prestige::prestige_getmoveslowscalar();
    self.perk_data["medic"].move_speed_scalar = self.movespeedscaler;
    self.perk_data["medic"].revive_damage_scalar = 0.75;
}

unset_perk_medic_1()
{
    self.perk_data["medic"].revive_time_scalar = 1.0;
    self.movespeedscaler = 1.0 * maps\mp\alien\_prestige::prestige_getmoveslowscalar();
    self.perk_data["medic"].move_speed_scalar = self.movespeedscaler;
    self.perk_data["medic"].revive_damage_scalar = 1.0;
}

set_perk_medic_2()
{
    maps\mp\_utility::giveperk( "specialty_longersprint", 0 );
    thread medic_health_regen( 65536.0 );
    self.perk_data["medic"].revive_time_scalar = 1.5;
    self.movespeedscaler = 1.06 * maps\mp\alien\_prestige::prestige_getmoveslowscalar();
    self.perk_data["medic"].move_speed_scalar = self.movespeedscaler;
    self.perk_data["medic"].revive_damage_scalar = 0.75;
}

unset_perk_medic_2()
{
    maps\mp\_utility::_unsetperk( "specialty_longersprint" );
    self notify( "end_medic_health_regen" );
    self.perk_data["medic"].revive_time_scalar = 1.0;
    self.movespeedscaler = 1.0 * maps\mp\alien\_prestige::prestige_getmoveslowscalar();
    self.perk_data["medic"].move_speed_scalar = self.movespeedscaler;
    self.perk_data["medic"].revive_damage_scalar = 1.0;
}

set_perk_medic_3()
{
    self.perk_data["medic"].gas_damage_scalar = 0.0;
    maps\mp\_utility::giveperk( "specialty_longersprint", 0 );
    thread medic_health_regen( 65536.0 );
    self.perk_data["medic"].revive_time_scalar = 1.5;
    self.movespeedscaler = 1.06 * maps\mp\alien\_prestige::prestige_getmoveslowscalar();
    self.perk_data["medic"].move_speed_scalar = self.movespeedscaler;
    self.perk_data["medic"].revive_damage_scalar = 0.75;
}

unset_perk_medic_3()
{
    self.perk_data["medic"].gas_damage_scalar = 1.0;
    maps\mp\_utility::_unsetperk( "specialty_longersprint" );
    self notify( "end_medic_health_regen" );
    self.perk_data["medic"].revive_time_scalar = 1.0;
    self.movespeedscaler = 1.0 * maps\mp\alien\_prestige::prestige_getmoveslowscalar();
    self.perk_data["medic"].move_speed_scalar = self.movespeedscaler;
    self.perk_data["medic"].revive_damage_scalar = 1.0;
}

set_perk_medic_4()
{
    self.perk_data["medic"].revive_time_scalar = 1.5;
    self.perk_data["medic"].gas_damage_scalar = 0.0;
    thread medic_health_regen( 0.0 );
    self.movespeedscaler = 1.12 * maps\mp\alien\_prestige::prestige_getmoveslowscalar();
    self.perk_data["medic"].move_speed_scalar = self.movespeedscaler;
    maps\mp\_utility::giveperk( "specialty_longersprint", 0 );
    maps\mp\_utility::giveperk( "specialty_fastsprintrecovery", 0 );
    self.perk_data["medic"].revive_damage_scalar = 0.75;
}

unset_perk_medic_4()
{
    self.perk_data["medic"].revive_time_scalar = 1.0;
    self.perk_data["medic"].gas_damage_scalar = 1.0;
    self notify( "end_medic_health_regen" );
    self.movespeedscaler = 1.0 * maps\mp\alien\_prestige::prestige_getmoveslowscalar();
    self.perk_data["medic"].move_speed_scalar = self.movespeedscaler;
    maps\mp\_utility::_unsetperk( "specialty_longersprint" );
    maps\mp\_utility::_unsetperk( "specialty_fastsprintrecovery" );
    self.perk_data["medic"].revive_damage_scalar = 1.0;
}

medic_health_regen( var_0 )
{
    self endon( "death" );
    self endon( "disconnect" );
    self endon( "end_medic_health_regen" );
    var_1 = var_0 > 0.0;

    for (;;)
    {
        foreach ( var_3 in level.players )
        {
            if ( maps\mp\_utility::isreallyalive( var_3 ) && !isdefined( var_3.medic_regeneration ) )
            {
                if ( var_1 && distancesquared( self.origin, var_3.origin ) > var_0 )
                    continue;

                var_3 thread medic_regenerate_health_once();
            }
        }

        wait 1.0;
    }
}

medic_regenerate_health_once()
{
    self endon( "death" );
    self endon( "disconnect" );

    if ( !maps\mp\alien\_utility::has_fragile_relic_and_is_sprinting() )
    {
        self.medic_regeneration = 1;
        wait 1.0;
        self.health = int( min( self.maxhealth, self.health + 5.0 ) );
        self.medic_regeneration = undefined;
    }
}

init_perk_rigger()
{
    var_0 = spawnstruct();
    var_0.drill_health_scalar = 1.0;
    var_0.drill_time_scalar = 1.0;
    var_0.trap_cost_scalar = 1;
    var_0.trap_duration_scalar = 1;
    var_0.trap_damage_scalar = 1;
    var_0.currency_scale_per_hive = 1.0;
    var_0.explosive_damage_scalar = 1.0;
    var_0.repair_damage_scalar = 1.0;
    return var_0;
}

set_perk_rigger_0()
{
    self.perk_data["rigger"].drill_health_scalar = 1.256;
    self.perk_data["rigger"].currency_scale_per_hive = 1.2;
}

unset_perk_rigger_0()
{
    self.perk_data["rigger"].drill_health_scalar = 1.0;
    self.perk_data["rigger"].currency_scale_per_hive = 1.0;
}

set_perk_rigger_1()
{
    self.perk_data["rigger"].drill_health_scalar = 1.256;
    self.perk_data["rigger"].currency_scale_per_hive = 1.2;
    self.perk_data["rigger"].drill_time_scalar = 0.5;
}

unset_perk_rigger_1()
{
    self.perk_data["rigger"].drill_health_scalar = 1.0;
    self.perk_data["rigger"].drill_time_scalar = 1.0;
    self.perk_data["rigger"].currency_scale_per_hive = 1.0;
}

set_perk_rigger_2()
{
    self.perk_data["rigger"].drill_health_scalar = 1.256;
    self.perk_data["rigger"].currency_scale_per_hive = 1.2;
    self.perk_data["rigger"].drill_time_scalar = 0.5;
    self.perk_data["rigger"].trap_cost_scalar = 0.8;
}

unset_perk_rigger_2()
{
    self.perk_data["rigger"].drill_health_scalar = 1.0;
    self.perk_data["rigger"].drill_time_scalar = 1;
    self.perk_data["rigger"].trap_cost_scalar = 1.0;
    self.perk_data["rigger"].currency_scale_per_hive = 1.0;
}

set_perk_rigger_3()
{
    self.perk_data["rigger"].drill_health_scalar = 1.256;
    self.perk_data["rigger"].currency_scale_per_hive = 1.2;
    self.perk_data["rigger"].drill_time_scalar = 0.5;
    self.perk_data["rigger"].trap_cost_scalar = 0.8;
    self.perk_data["rigger"].trap_duration_scalar = 1.5;
    self.perk_data["rigger"].repair_damage_scalar = 0.75;
}

unset_perk_rigger_3()
{
    self.perk_data["rigger"].drill_health_scalar = 1.0;
    self.perk_data["rigger"].drill_time_scalar = 1;
    self.perk_data["rigger"].trap_cost_scalar = 1.0;
    self.perk_data["rigger"].trap_duration_scalar = 1;
    self.perk_data["rigger"].currency_scale_per_hive = 1.0;
    self.perk_data["rigger"].repair_damage_scalar = 1.0;
}

set_perk_rigger_4()
{
    self.perk_data["rigger"].drill_health_scalar = 1.256;
    self.perk_data["rigger"].currency_scale_per_hive = 1.2;
    self.perk_data["rigger"].drill_time_scalar = 0.5;
    self.perk_data["rigger"].trap_cost_scalar = 0.8;
    self.perk_data["rigger"].trap_duration_scalar = 1.5;
    self.perk_data["rigger"].trap_damage_scalar = 2;
    maps\mp\alien\_persistence::set_player_max_currency( 8000 * maps\mp\alien\_prestige::prestige_getwalletsizescalar() );
    self.perk_data["rigger"].repair_damage_scalar = 0.75;
    self.perk_data["rigger"].explosive_damage_scalar = 1.5;
}

unset_perk_rigger_4()
{
    self.perk_data["rigger"].drill_health_scalar = 1.0;
    self.perk_data["rigger"].drill_time_scalar = 1;
    self.perk_data["rigger"].trap_cost_scalar = 1.0;
    self.perk_data["rigger"].trap_duration_scalar = 1;
    self.perk_data["rigger"].trap_damage_scalar = 1;
    self.perk_data["rigger"].currency_scale_per_hive = 1.0;
    maps\mp\alien\_persistence::set_player_max_currency( 6000 * maps\mp\alien\_prestige::prestige_getwalletsizescalar() );
    self.perk_data["rigger"].repair_damage_scalar = 1.0;
    self.perk_data["rigger"].explosive_damage_scalar = 1.0;
}

init_perk_pistol()
{
    var_0 = spawnstruct();
    var_0.pistol_overkill = 0;
    var_0.pistol_regen = 0;
    return var_0;
}

check_for_pistol_ammo( var_0, var_1 )
{
    self.lastweapon = self getcurrentweapon();
    self.pistol_clip_ammo_right = self getweaponammoclip( var_1, "right" );
    self.pistol_ammo_remaining = self getweaponammostock( var_1 );
}

give_new_pistol( var_0 )
{
    var_1 = var_0;
    maps\mp\_utility::_giveweapon( var_1 );
    self setweaponammoclip( var_1, self.pistol_clip_ammo_right, "right" );
    self setweaponammostock( var_1, self.pistol_ammo_remaining );
    var_2 = self getweaponslistprimaries();

    if ( !self hasweapon( self.lastweapon ) && !maps\mp\alien\_utility::has_special_weapon() && !maps\mp\alien\_utility::is_holding_deployable() )
        self switchtoweapon( var_1 );
}

set_perk_pistol_p226_0()
{

}

unset_perk_pistol_p226_0()
{
    store_ammo_and_take_pistol( "iw6_alienp226_mp" );
}

set_perk_pistol_p226_1()
{
    if ( maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw6_alienp226_mp_alienmuzzlebrakepi" );
    else
        give_new_pistol( "iw6_alienp226_mp_barrelrange02" );
}

unset_perk_pistol_p226_1()
{
    store_ammo_and_take_pistol( "iw6_alienp226_mp" );
}

set_perk_pistol_p226_2()
{
    if ( maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw6_alienp226_mp_alienmuzzlebrakepi_xmags" );
    else
        give_new_pistol( "iw6_alienp226_mp_barrelrange02_xmags" );
}

unset_perk_pistol_p226_2()
{
    store_ammo_and_take_pistol( "iw6_alienp226_mp" );
}

set_perk_pistol_p226_3()
{
    if ( maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw6_alienp226_mp_alienmuzzlebrakepi_xmags" );
    else
        give_new_pistol( "iw6_alienp226_mp_barrelrange02_xmags" );

    self.perk_data["pistol"].pistol_overkill = 1;
}

unset_perk_pistol_p226_3()
{
    store_ammo_and_take_pistol( "iw6_alienp226_mp" );
    self.perk_data["pistol"].pistol_overkill = 0;
}

set_perk_pistol_p226_4()
{
    if ( maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw5_alienp226_mp_akimbo_alienmuzzlebrakepi_xmags" );
    else
        give_new_pistol( "iw5_alienp226_mp_akimbo_barrelrange02_xmags" );

    self.perk_data["pistol"].pistol_overkill = 1;
}

unset_perk_pistol_p226_4()
{
    store_ammo_and_take_pistol( "iw5_alienp226_mp" );
    self.perk_data["pistol"].pistol_overkill = 0;
}

set_perk_pistol_magnum_0()
{

}

unset_perk_pistol_magnum_0()
{
    store_ammo_and_take_pistol( "iw6_alienmagnum_mp" );
}

set_perk_pistol_magnum_1()
{
    if ( maps\mp\alien\_persistence::is_upgrade_enabled( "magnum_acog_upgrade" ) && !maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw6_alienmagnum_mp_acogpistol_barrelrange02_scope5" );
    else if ( !maps\mp\alien\_persistence::is_upgrade_enabled( "magnum_acog_upgrade" ) && maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw6_alienmagnum_mp_alienmuzzlebrakepi" );
    else if ( maps\mp\alien\_persistence::is_upgrade_enabled( "magnum_acog_upgrade" ) && maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw6_alienmagnum_mp_acogpistol_alienmuzzlebrakepi_scope5" );
    else
        give_new_pistol( "iw6_alienmagnum_mp_barrelrange02" );
}

unset_perk_pistol_magnum_1()
{
    store_ammo_and_take_pistol( "iw6_alienmagnum_mp" );
}

set_perk_pistol_magnum_2()
{
    if ( maps\mp\alien\_persistence::is_upgrade_enabled( "magnum_acog_upgrade" ) && !maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw6_alienmagnum_mp_acogpistol_barrelrange02_xmags_scope5" );
    else if ( !maps\mp\alien\_persistence::is_upgrade_enabled( "magnum_acog_upgrade" ) && maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw6_alienmagnum_mp_alienmuzzlebrakepi_xmags" );
    else if ( maps\mp\alien\_persistence::is_upgrade_enabled( "magnum_acog_upgrade" ) && maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw6_alienmagnum_mp_acogpistol_alienmuzzlebrakepi_xmags_scope5" );
    else
        give_new_pistol( "iw6_alienmagnum_mp_barrelrange02_xmags" );
}

unset_perk_pistol_magnum_2()
{
    store_ammo_and_take_pistol( "iw6_alienmagnum_mp" );
}

set_perk_pistol_magnum_3()
{
    if ( maps\mp\alien\_persistence::is_upgrade_enabled( "magnum_acog_upgrade" ) && !maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw6_alienmagnum_mp_acogpistol_barrelrange02_xmags_scope5" );
    else if ( !maps\mp\alien\_persistence::is_upgrade_enabled( "magnum_acog_upgrade" ) && maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw6_alienmagnum_mp_alienmuzzlebrakepi_xmags" );
    else if ( maps\mp\alien\_persistence::is_upgrade_enabled( "magnum_acog_upgrade" ) && maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw6_alienmagnum_mp_acogpistol_alienmuzzlebrakepi_xmags_scope5" );
    else
        give_new_pistol( "iw6_alienmagnum_mp_barrelrange02_xmags" );

    self.perk_data["pistol"].pistol_overkill = 1;
}

unset_perk_pistol_magnum_3()
{
    store_ammo_and_take_pistol( "iw6_alienmagnum_mp" );
    self.perk_data["pistol"].pistol_overkill = 0;
}

set_perk_pistol_magnum_4()
{
    if ( maps\mp\alien\_persistence::is_upgrade_enabled( "magnum_acog_upgrade" ) && !maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw5_alienmagnum_mp_acogpistol_akimbo_barrelrange02_xmags_scope5" );
    else if ( !maps\mp\alien\_persistence::is_upgrade_enabled( "magnum_acog_upgrade" ) && maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw5_alienmagnum_mp_akimbo_alienmuzzlebrakepi_xmags" );
    else if ( maps\mp\alien\_persistence::is_upgrade_enabled( "magnum_acog_upgrade" ) && maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw5_alienmagnum_mp_acogpistol_akimbo_alienmuzzlebrakepi_xmags_scope5" );
    else
        give_new_pistol( "iw5_alienmagnum_mp_akimbo_barrelrange02_xmags" );

    self.perk_data["pistol"].pistol_overkill = 1;
}

unset_perk_pistol_magnum_4()
{
    store_ammo_and_take_pistol( "iw5_alienmagnum_mp" );
    self.perk_data["pistol"].pistol_overkill = 0;
}

set_perk_pistol_m9a1_0()
{

}

unset_perk_pistol_m9a1_0()
{
    store_ammo_and_take_pistol( "iw6_alienm9a1_mp" );
}

set_perk_pistol_m9a1_1()
{
    if ( maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw6_alienm9a1_mp_alienmuzzlebrakep3" );
    else
        give_new_pistol( "iw6_alienm9a1_mp_barrelrange02" );
}

unset_perk_pistol_m9a1_1()
{
    store_ammo_and_take_pistol( "iw6_alienm9a1_mp" );
}

set_perk_pistol_m9a1_2()
{
    if ( maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw6_alienm9a1_mp_alienmuzzlebrakep3_xmags" );
    else
        give_new_pistol( "iw6_alienm9a1_mp_barrelrange02_xmags" );
}

unset_perk_pistol_m9a1_2()
{
    store_ammo_and_take_pistol( "iw6_alienm9a1_mp" );
}

set_perk_pistol_m9a1_3()
{
    if ( maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw6_alienm9a1_mp_alienmuzzlebrakep3_xmags" );
    else
        give_new_pistol( "iw6_alienm9a1_mp_barrelrange02_xmags" );

    self.perk_data["pistol"].pistol_overkill = 1;
}

unset_perk_pistol_m9a1_3()
{
    store_ammo_and_take_pistol( "iw6_alienm9a1_mp" );
    self.perk_data["pistol"].pistol_overkill = 0;
}

set_perk_pistol_m9a1_4()
{
    if ( maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw5_alienm9a1_mp_akimbo_alienmuzzlebrakep3_xmags" );
    else
        give_new_pistol( "iw5_alienm9a1_mp_akimbo_barrelrange02_xmags" );

    self.perk_data["pistol"].pistol_overkill = 1;
}

unset_perk_pistol_m9a1_4()
{
    store_ammo_and_take_pistol( "iw5_alienm9a1_mp" );
    self.perk_data["pistol"].pistol_overkill = 0;
}

store_ammo_and_take_pistol( var_0 )
{
    var_1 = maps\mp\alien\_utility::get_current_pistol();
    check_for_pistol_ammo( var_0, var_1 );
    self takeweapon( var_1 );
}

set_perk_pistol_mp443_0()
{

}

unset_perk_pistol_mp443_0()
{
    store_ammo_and_take_pistol( "iw6_alienmp443_mp" );
}

set_perk_pistol_mp443_1()
{
    if ( maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw6_alienmp443_mp_alienmuzzlebrakepa" );
    else
        give_new_pistol( "iw6_alienmp443_mp_barrelrange02" );
}

unset_perk_pistol_mp443_1()
{
    store_ammo_and_take_pistol( "iw6_alienmp443_mp" );
}

set_perk_pistol_mp443_2()
{
    if ( maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw6_alienmp443_mp_alienmuzzlebrakepa_xmags" );
    else
        give_new_pistol( "iw6_alienmp443_mp_barrelrange02_xmags" );
}

unset_perk_pistol_mp443_2()
{
    store_ammo_and_take_pistol( "iw6_alienmp443_mp" );
}

set_perk_pistol_mp443_3()
{
    if ( maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw6_alienmp443_mp_alienmuzzlebrakepa_xmags" );
    else
        give_new_pistol( "iw6_alienmp443_mp_barrelrange02_xmags" );

    self.perk_data["pistol"].pistol_overkill = 1;
}

unset_perk_pistol_mp443_3()
{
    store_ammo_and_take_pistol( "iw6_alienmp443_mp" );
    self.perk_data["pistol"].pistol_overkill = 0;
}

set_perk_pistol_mp443_4()
{
    if ( maps\mp\alien\_persistence::is_upgrade_enabled( "ark_pistol_upgrade" ) )
        give_new_pistol( "iw5_alienmp443_mp_akimbo_alienmuzzlebrakepa_xmags" );
    else
        give_new_pistol( "iw5_alienmp443_mp_akimbo_barrelrange02_xmags" );

    self.perk_data["pistol"].pistol_overkill = 1;
}

unset_perk_pistol_mp443_4()
{
    store_ammo_and_take_pistol( "iw5_alienmp443_mp" );
    self.perk_data["pistol"].pistol_overkill = 0;
}

watchcombatspeedscaler()
{
    self endon( "death" );
    self endon( "disconnect" );
    self.pistolcombatspeedscalar = 1.0;
    self.aliensnarespeedscalar = 1.0;
    self.aliensnarecount = 0;
    self.combatspeedscalar = getcombatspeedscalar();
    maps\mp\gametypes\_weapons::updatemovespeedscale();

    for (;;)
    {
        self waittill( "weapon_change", var_0 );

        if ( maps\mp\alien\_perk_utility::has_perk( "perk_pistol_p226", [ 1, 2, 3, 4 ] ) || maps\mp\alien\_perk_utility::has_perk( "perk_pistol_magnum", [ 1, 2, 3, 4 ] ) || maps\mp\alien\_perk_utility::has_perk( "perk_pistol_m9a1", [ 1, 2, 3, 4 ] ) || maps\mp\alien\_perk_utility::has_perk( "perk_pistol_mp443", [ 1, 2, 3, 4 ] ) )
        {
            var_1 = self getcurrentweapon();
            var_2 = maps\mp\alien\_utility::getrawbaseweaponname( var_1 );

            if ( isdefined( var_2 ) )
            {
                if ( var_2 == "alienp226" || var_2 == "alienmagnum" || var_2 == "alienm9a1" || var_2 == "alienmp443" )
                    self.pistolcombatspeedscalar = 1.1;
                else
                    self.pistolcombatspeedscalar = 1.0;

                wait 0.05;
                updatecombatspeedscalar();
            }
        }

        wait 0.05;
    }
}

updatecombatspeedscalar()
{
    self.combatspeedscalar = getcombatspeedscalar();
    maps\mp\gametypes\_weapons::updatemovespeedscale();
}

getcombatspeedscalar()
{
    return self.pistolcombatspeedscalar * self.aliensnarespeedscalar;
}

watchflamingriotshield()
{
    self endon( "death" );
    self endon( "disconnect" );

    for (;;)
    {
        var_0 = self getcurrentweapon();

        if ( isdefined( var_0 ) )
        {
            if ( var_0 == "iw5_alienriotshield4_mp_camo05" && self.fireshield == 1.0 )
            {
                playfxontag( level._effect["Riotshield_fire"], self, "TAG_origin" );
                continue;
            }

            stopfxontag( level._effect["Riotshield_fire"], self, "TAG_origin" );
        }
    }

    wait 0.05;
}
