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

init()
{
    level.killstreakfuncs["specialty_fastsprintrecovery_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_fastreload_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_lightweight_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_marathon_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_stalker_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_reducedsway_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_quickswap_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_pitcher_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_bulletaccuracy_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_quickdraw_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_sprintreload_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_silentkill_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_blindeye_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_gpsjammer_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_quieter_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_incog_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_paint_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_scavenger_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_detectexplosive_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_selectivehearing_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_comexp_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_falldamage_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_regenfaster_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_sharp_focus_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_stun_resistance_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["_specialty_blastshield_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_gunsmith_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_extraammo_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_extra_equipment_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_extra_deadly_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_extra_attachment_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_explosivedamage_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_gambler_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_hardline_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_twoprimaries_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_boom_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["specialty_deadeye_ks"] = ::tryuseperkstreak;
    level.killstreakfuncs["all_perks_bonus"] = ::tryuseallperks;
    level.killstreakfuncs["speed_boost"] = ::tryusespeedboost;
    level.killstreakfuncs["refill_grenades"] = ::tryuserefillgrenades;
    level.killstreakfuncs["refill_ammo"] = ::tryuserefillammo;
    level.killstreakfuncs["regen_faster"] = ::tryuseregenfaster;
}

tryusespeedboost( var_0, var_1 )
{
    dokillstreakfunctions( "specialty_juiced", "speed_boost" );
    return 1;
}

tryuserefillgrenades( var_0, var_1 )
{
    dokillstreakfunctions( "specialty_refill_grenades", "refill_grenades" );
    return 1;
}

tryuserefillammo( var_0, var_1 )
{
    dokillstreakfunctions( "specialty_refill_ammo", "refill_ammo" );
    return 1;
}

tryuseregenfaster( var_0, var_1 )
{
    dokillstreakfunctions( "specialty_regenfaster", "regen_faster" );
    return 1;
}

tryuseallperks( var_0, var_1 )
{
    return 1;
}

tryuseperkstreak( var_0, var_1 )
{
    var_2 = maps\mp\_utility::strip_suffix( var_1, "_ks" );
    doperkfunctions( var_2 );
    return 1;
}

doperkfunctions( var_0 )
{
    maps\mp\_utility::giveperk( var_0, 0 );
    thread watchdeath( var_0 );
    thread checkforperkupgrade( var_0 );

    if ( var_0 == "specialty_hardline" )
        maps\mp\killstreaks\_killstreaks::setstreakcounttonext();

    maps\mp\_matchdata::logkillstreakevent( var_0 + "_ks", self.origin );
}

dokillstreakfunctions( var_0, var_1 )
{
    maps\mp\_utility::giveperk( var_0, 0 );

    if ( isdefined( var_1 ) )
        maps\mp\_matchdata::logkillstreakevent( var_1, self.origin );
}

watchdeath( var_0 )
{
    self endon( "disconnect" );
    self waittill( "death" );
    maps\mp\_utility::_unsetperk( var_0 );
}

checkforperkupgrade( var_0 )
{
    var_1 = maps\mp\gametypes\_class::getperkupgrade( var_0 );

    if ( var_1 != "specialty_null" )
    {
        maps\mp\_utility::giveperk( var_1, 0 );
        thread watchdeath( var_1 );
    }
}

isperkstreakon( var_0 )
{
    for ( var_1 = 1; var_1 < 4; var_1++ )
    {
        if ( isdefined( self.pers["killstreaks"][var_1].streakname ) && self.pers["killstreaks"][var_1].streakname == var_0 )
        {
            if ( self.pers["killstreaks"][var_1].available )
                return 1;
        }
    }

    return 0;
}
