Ejemplo n.º 1
0
        public bool killstreakUsePressed(Entity player)
        {
            string streakName = (string)player.GetField <Entity[]>("pers_killstreaks")[player.GetField <int>("killstreakIndexWeapon")].GetField("streakName");
            int    lifeId     = (int)player.GetField <Entity[]>("pers_killstreaks")[player.GetField <int>("killstreakIndexWeapon")].GetField("lifeId");
            bool   isEarned   = (bool)player.GetField <Entity[]>("pers_killstreaks")[player.GetField <int>("killstreakIndexWeapon")].GetField("earned");
            int    awardXp    = (int)player.GetField <Entity[]>("pers_killstreaks")[player.GetField <int>("killstreakIndexWeapon")].GetField("awardXp");
            int    kID        = (int)player.GetField <Entity[]>("pers_killstreaks")[player.GetField <int>("killstreakIndexWeapon")].GetField("kID");
            bool   isGimme    = (bool)player.GetField <Entity[]>("pers_killstreaks")[player.GetField <int>("killstreakIndexWeapon")].GetField("isGimme");

            if (!player.IsOnGround() && (isRideKillstreak(streakName) || isCarryKillstreak(streakName)))
            {
                return(false);
            }

            if (player.IsUsingTurret())//isUsingRemote
            {
                return(true);
            }

            //if ((bool)player.GetField("selectingLocation"))
            //return false;

            if (deadlyKillstreak(streakName) && (bool)level.GetField("killstreakRoundDelay") && getGametypeNumLives())
            {
                if ((int)level.GetField("gracePeriod") - (int)level.GetField("inGracePeriod") < (int)level.GetField("killstreakRoundDelay"))
                {
                    player.IPrintLnBold("Unavailable for " + ((int)level.GetField("killstreakRoundDelay") - ((int)level.GetField("gracePeriod") - (int)level.GetField("inGracePeriod"))) + " seconds.");
                    return(false);
                }
            }

            if (((bool)level.GetField("isTeamBased") && (bool)level.GetField("teamEMPed_" + player.GetField("sessionteam"))) || (!(bool)level.GetField("isTeamBased") && level.GetField("empPlayer") != Entity.Level && level.GetField("empPlayer") != player))
            {
                if (streakName != "deployable_vest")
                {
                    player.IPrintLnBold("Unavailable for " + level.GetField("empTimeRemaining") + " seconds.");
                    return(false);
                }

                if (player.HasField("nuked") && (bool)player.GetField("nuked"))
                {
                    if (streakName != "deployable_vest")
                    {
                        player.IPrintLnBold("Unavailable for " + nuke.nukeEmpTimeRemaining + " seconds.");
                        return(false);
                    }
                }
            }

            if (player.IsUsingTurret() && (isRideKillstreak(streakName) || isCarryKillstreak(streakName)))
            {
                player.IPrintLnBold("Unavailable while using a turret.");
                return(false);
            }

            if (player.HasField("lastStand") && isRideKillstreak(streakName))
            {
                player.IPrintLnBold("Unavailable in last stand.");
                return(false);
            }

            bool removeExplosiveAmmo = false;

            if (player.HasPerk("specialty_explosivebullets") && GSCFunctions.IsSubStr(streakName, "explosive_amoo"))
            {
                removeExplosiveAmmo = true;
            }

            if (GSCFunctions.IsSubStr(streakName, "airdrop") || streakName == "littlebird_flock")
            {
                if ((bool)level.GetField <Dictionary <string, Delegate> >("killstreakFuncs")[streakName].DynamicInvoke(player, lifeId, kID))
                {
                    return(false);
                }
            }
            else
            {
                if ((bool)level.GetField <Dictionary <string, Delegate> >("killstreakFuncs")[streakName].DynamicInvoke(player, lifeId))
                {
                    return(false);
                }
            }

            if (removeExplosiveAmmo)
            {
                player.UnSetPerk("specialty_explosivebullets");
            }

            updateKillstreaks(player);
            usedKillstreak(player, streakName, awardXp);

            return(true);
        }