Ejemplo n.º 1
0
        private static bool Prefix(FlashGrenade __instance)
        {
            List <Exiled.API.Features.Player> players = new List <Exiled.API.Features.Player>();

            foreach (GameObject gameObject in PlayerManager.players)
            {
                Vector3      position = __instance.transform.position;
                ReferenceHub hub      = ReferenceHub.GetHub(gameObject);
                Flashed      effect   = hub.playerEffectsController.GetEffect <Flashed>();
                Deafened     effect2  = hub.playerEffectsController.GetEffect <Deafened>();
                if (effect == null || __instance.thrower == null || (!__instance.Network_friendlyFlash && !effect.Flashable(ReferenceHub.GetHub(__instance.thrower.gameObject), position, __instance.viewLayerMask)))
                {
                    continue;
                }

                float num = __instance.powerOverDistance.Evaluate(Vector3.Distance(gameObject.transform.position, position) / ((position.y > 900f) ? __instance.distanceMultiplierSurface : __instance.distanceMultiplierFacility)) * __instance.powerOverDot.Evaluate(Vector3.Dot(hub.PlayerCameraReference.forward, (hub.PlayerCameraReference.position - position).normalized));
                byte  b   = (byte)Mathf.Clamp(Mathf.RoundToInt(num * 10f * __instance.maximumDuration), 1, 255);
                if (b >= effect.Intensity && num > 0f)
                {
                    players.Add(API.Features.Player.Get(gameObject));
                }
            }

            ExplodingGrenadeEventArgs ev = new ExplodingGrenadeEventArgs(players, false, __instance.gameObject);

            Handlers.Map.OnExplodingGrenade(ev);

            return(ev.IsAllowed);
        }
Ejemplo n.º 2
0
        public static bool Prefix(FlashGrenade __instance, ref bool __result)
        {
            Exiled.API.Features.Log.Debug($"Flash grenade explosion", Subclass.Instance.Config.Debug);
            foreach (GameObject obj2 in PlayerManager.players)
            {
                Player       target   = Player.Get(obj2);
                Vector3      position = ((EffectGrenade)__instance).transform.position;
                ReferenceHub hub      = ReferenceHub.GetHub(obj2);
                Flashed      effect   = hub.playerEffectsController.GetEffect <Flashed>();
                Deafened     deafened = hub.playerEffectsController.GetEffect <Deafened>();
                Exiled.API.Features.Log.Debug($"Flash target is: {target?.Nickname}", Subclass.Instance.Config.Debug);
                if ((effect != null) &&
                    ((((EffectGrenade)__instance).thrower != null) &&
                     (__instance._friendlyFlash ||
                      effect.Flashable(ReferenceHub.GetHub(((EffectGrenade)__instance).thrower.gameObject), position, __instance._ignoredLayers))))
                {
                    if (!Tracking.PlayersWithSubclasses.ContainsKey(target) ||
                        !Tracking.PlayersWithSubclasses[target].Abilities.Contains(AbilityType.FlashImmune))
                    {
                        float num       = __instance.powerOverDistance.Evaluate((float)(Vector3.Distance(obj2.transform.position, position) / ((position.y > 900f) ? __instance.distanceMultiplierSurface : __instance.distanceMultiplierFacility))) * __instance.powerOverDot.Evaluate(Vector3.Dot(hub.PlayerCameraReference.forward, (hub.PlayerCameraReference.position - position).normalized));
                        byte  intensity = (byte)Mathf.Clamp(Mathf.RoundToInt((float)((num * 10f) * __instance.maximumDuration)), 1, 0xff);
                        if ((intensity >= effect.Intensity) && (num > 0f))
                        {
                            hub.playerEffectsController.ChangeEffectIntensity <Flashed>(intensity);
                            if (deafened != null)
                            {
                                hub.playerEffectsController.EnableEffect(deafened, num * __instance.maximumDuration, true);
                            }
                        }
                    }
                    else
                    {
                        Concussed concussedEffect = hub.playerEffectsController.GetEffect <Concussed>();
                        concussedEffect.Intensity = 3;
                        hub.playerEffectsController.EnableEffect(concussedEffect, 5);
                        Disabled disabledEffect = hub.playerEffectsController.GetEffect <Disabled>();
                        disabledEffect.Intensity = 2;
                        hub.playerEffectsController.EnableEffect(disabledEffect, 5);
                    }
                }
            }

            if (((EffectGrenade)__instance).serverGrenadeEffect != null)
            {
                Transform transform = ((Grenade)__instance).transform;
                Object.Instantiate <GameObject>(((EffectGrenade)__instance).serverGrenadeEffect, transform.position, transform.rotation);
            }

            string str = (((Grenade)__instance).thrower != null) ? ((Grenade)__instance).thrower.hub.LoggedNameFromRefHub() : ((string)"(UNKNOWN)");

            string[] textArray1 = new string[] { "Player ", (string)str, "'s ", (string)((Grenade)__instance).logName, " grenade exploded." };
            ServerLogs.AddLog(ServerLogs.Modules.Logger, string.Concat((string[])textArray1), ServerLogs.ServerLogType.GameEvent, false);

            __result = true;
            return(false);
        }
Ejemplo n.º 3
0
        private static void SpawnFlash(Player player)
        {
            Vector3 position = player.Camera.gameObject
                ? player.Camera.transform.position
                : player.ReferenceHub.scp079PlayerScript.transform.position;

            GrenadeManager  gm       = player.GrenadeManager;
            GrenadeSettings settings = gm.availableGrenades.First(g => g.inventoryID == ItemType.GrenadeFlash);
            FlashGrenade    flash    = UnityEngine.Object.Instantiate(settings.grenadeInstance).GetComponent <FlashGrenade>();

            flash.fuseDuration = 0.5f;
            flash.InitData(gm, Vector3.zero, Vector3.zero);
            flash.transform.position = position;
            NetworkServer.Spawn(flash.gameObject);
        }
Ejemplo n.º 4
0
        private static bool Prefix(FlashGrenade __instance)
        {
            try
            {
                Dictionary <Player, float> players = new Dictionary <Player, float>();

                foreach (GameObject gameObject in PlayerManager.players)
                {
                    Vector3      position = __instance.transform.position;
                    ReferenceHub hub      = ReferenceHub.GetHub(gameObject);
                    Flashed      effect   = hub.playerEffectsController.GetEffect <Flashed>();
                    Deafened     effect2  = hub.playerEffectsController.GetEffect <Deafened>();
                    if (effect == null || __instance.thrower == null ||
                        (!__instance.Network_friendlyFlash && !effect.Flashable(
                             ReferenceHub.GetHub(__instance.thrower.gameObject), position, __instance._ignoredLayers)))
                    {
                        continue;
                    }

                    float num = __instance.powerOverDistance.Evaluate(
                        Vector3.Distance(gameObject.transform.position, position) / ((position.y > 900f)
                                        ? __instance.distanceMultiplierSurface
                                        : __instance.distanceMultiplierFacility)) *
                                __instance.powerOverDot.Evaluate(Vector3.Dot(hub.PlayerCameraReference.forward, (hub.PlayerCameraReference.position - position).normalized));
                    byte b = (byte)Mathf.Clamp(Mathf.RoundToInt(num * 10f * __instance.maximumDuration), 1, 255);
                    if (b >= effect.Intensity && num > 0f)
                    {
                        players.Add(Player.Get(gameObject), num);
                    }
                }

                ExplodingGrenadeEventArgs ev = new ExplodingGrenadeEventArgs(Player.Get(__instance.throwerGameObject), players, false, __instance.gameObject);

                Handlers.Map.OnExplodingGrenade(ev);

                return(ev.IsAllowed);
            }
            catch (Exception exception)
            {
                Log.Error($"{typeof(ExplodingFlashGrenade).FullName}:\n{exception}");

                return(true);
            }
        }
Ejemplo n.º 5
0
        private static void Postfix(FlashGrenade __instance)
        {
            Player thrower = Player.Get(__instance.thrower.gameObject);

            foreach (var scp035 in API.AllScp035)
            {
                if (thrower != null && scp035 != null && thrower.Id != scp035.Id && thrower.Team == scp035.Team)
                {
                    GameObject   gameObject            = scp035.GameObject;
                    Vector3      position              = __instance.transform.position;
                    ReferenceHub hub                   = scp035.ReferenceHub;
                    CustomPlayerEffects.Flashed effect =
                        hub.playerEffectsController.GetEffect <CustomPlayerEffects.Flashed>();
                    CustomPlayerEffects.Deafened effect2 =
                        hub.playerEffectsController.GetEffect <CustomPlayerEffects.Deafened>();
                    if (effect != null && __instance.thrower != null && IsFlashable(thrower.ReferenceHub,
                                                                                    scp035.ReferenceHub,
                                                                                    position, __instance._ignoredLayers))
                    {
                        float num = __instance.powerOverDistance.Evaluate(
                            Vector3.Distance(gameObject.transform.position, position) / ((position.y > 900f)
                                ? __instance.distanceMultiplierSurface
                                : __instance.distanceMultiplierFacility)) * __instance.powerOverDot.Evaluate(
                            Vector3.Dot(hub.PlayerCameraReference.forward,
                                        (hub.PlayerCameraReference.position - position).normalized));
                        byte b = (byte)Mathf.Clamp(Mathf.RoundToInt(num * 10f * __instance.maximumDuration), 1,
                                                   255);
                        if (b >= effect.Intensity && num > 0f)
                        {
                            hub.playerEffectsController.ChangeEffectIntensity <CustomPlayerEffects.Flashed>(b);
                            if (effect2 != null)
                            {
                                hub.playerEffectsController.EnableEffect(effect2, num * __instance.maximumDuration,
                                                                         true);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response)
        {
            if (sender is PlayerCommandSender)
            {
                var plr = sender as PlayerCommandSender;
                if (plr.RH.characterClassManager.NetworkCurClass == RoleType.Scp079)
                {
                    var plugin = Better079Plugin.instance;
                    var args   = arguments.Array;
                    {
                        if (args.Length == 1)
                        {
                            if (args[1].ToLower().Equals("help") || args[1].ToLower().Equals("commands") || args[1].ToLower().Equals("?"))
                            {
                                response = plugin.Config.b079_help_title + "\n" +
                                           "\"." + plugin.Config.b079_prefix + " a1\" - " + plugin.Config.b079_help_a1 + " - " + plugin.Config.b079_a1_power + "+ AP - Tier " + (plugin.Config.b079_a1_tier + 1) + "+\n" +
                                           "\"." + plugin.Config.b079_prefix + " a2\" - " + plugin.Config.b079_help_a2 + " - " + plugin.Config.b079_a2_power + "+ AP - Tier " + (plugin.Config.b079_a2_tier + 1) + "+\n" +
                                           "\"." + plugin.Config.b079_prefix + " a3\" - " + plugin.Config.b079_help_a3 + " - " + plugin.Config.b079_a3_power + "+ AP - Tier " + (plugin.Config.b079_a3_tier + 1) + "+\n" +
                                           "\"." + plugin.Config.b079_prefix + " a4\" - " + plugin.Config.b079_help_a4 + " - " + plugin.Config.b079_a4_power + "+ AP - Tier " + (plugin.Config.b079_a4_tier + 1) + "+\n";
                                return(true);
                            }

                            if (args[1].ToLower().Equals("a1"))
                            {
                                if (plr.RH.scp079PlayerScript.NetworkcurLvl < plugin.Config.b079_a1_tier)
                                {
                                    response = plugin.Config.b079_msg_tier_required.Replace("$tier", "" + (plugin.Config.b079_a1_tier + 1));
                                    return(true);
                                }
                                if (plr.RH.scp079PlayerScript.NetworkcurMana >= plugin.Config.b079_a1_power)
                                {
                                    plr.RH.scp079PlayerScript.NetworkcurMana -= plugin.Config.b079_a1_power;
                                }
                                else
                                {
                                    response = plugin.Config.b079_msg_no_power;
                                    return(true);
                                }
                                var cams = PluginEvents.GetSCPCameras();
                                if (cams.Count > 0)
                                {
                                    Camera079 cam = cams[UnityEngine.Random.Range(0, cams.Count)];
                                    plr.RH.scp079PlayerScript.CmdSwitchCamera(cam.cameraId, false);
                                    response = plugin.Config.b079_msg_a1_run;
                                    return(true);
                                }
                                else
                                {
                                    plr.RH.scp079PlayerScript.NetworkcurMana += plugin.Config.b079_a1_power;
                                    response = plugin.Config.b079_msg_a1_fail;
                                    return(true);
                                }
                            }

                            if (args[1].ToLower().Equals("a2"))
                            {
                                if (plr.RH.scp079PlayerScript.NetworkcurLvl < plugin.Config.b079_a2_tier)
                                {
                                    response = plugin.Config.b079_msg_tier_required.Replace("$tier", "" + (plugin.Config.b079_a2_tier + 1));
                                    return(true);
                                }
                                if (plr.RH.scp079PlayerScript.NetworkcurMana >= plugin.Config.b079_a2_power)
                                {
                                    plr.RH.scp079PlayerScript.NetworkcurMana -= plugin.Config.b079_a2_power;
                                }
                                else
                                {
                                    response = plugin.Config.b079_msg_no_power;
                                    return(true);
                                }
                                if (Time.timeSinceLevelLoad - PluginEvents.a2cooldown < plugin.Config.b079_a2_cooldown)
                                {
                                    plr.RH.scp079PlayerScript.NetworkcurMana += plugin.Config.b079_a2_power;
                                    response = plugin.Config.b079_msg_a2_fail;
                                    return(true);
                                }
                                Room room = PluginEvents.SCP079Room(plr.RH);
                                if (room == null)
                                {
                                    plr.RH.scp079PlayerScript.NetworkcurMana += plugin.Config.b079_a2_power;
                                    response = plugin.Config.b079_msg_a2_fail;
                                    return(true);
                                }
                                if (room.Zone == ZoneType.Surface)
                                {
                                    plr.RH.scp079PlayerScript.NetworkcurMana += plugin.Config.b079_a2_power;
                                    response = plugin.Config.b079_msg_a2_fail;
                                    return(true);
                                }
                                foreach (var item in plugin.Config.b079_a2_blacklisted_rooms)
                                {
                                    if (room.Name.ToLower().Contains(item.ToLower()))
                                    {
                                        plr.RH.scp079PlayerScript.NetworkcurMana += plugin.Config.b079_a2_power;
                                        response = plugin.Config.b079_msg_a2_fail;
                                        return(true);
                                    }
                                }
                                Timing.RunCoroutine(PluginEvents.GasRoom(room, plr.RH));
                                response = plugin.Config.b079_msg_a2_run;
                                return(true);
                            }

                            if (args[1].ToLower().Equals("a3"))
                            {
                                if (plr.RH.scp079PlayerScript.NetworkcurLvl < plugin.Config.b079_a3_tier)
                                {
                                    response = plugin.Config.b079_msg_tier_required.Replace("$tier", "" + (plugin.Config.b079_a3_tier + 1));
                                    return(true);
                                }
                                if (plr.RH.scp079PlayerScript.NetworkcurMana >= plugin.Config.b079_a3_power)
                                {
                                    plr.RH.scp079PlayerScript.NetworkcurMana -= plugin.Config.b079_a3_power;
                                }
                                else
                                {
                                    response = plugin.Config.b079_msg_no_power;
                                    return(true);
                                }
                                Generator079.Generators[0].RpcCustomOverchargeForOurBeautifulModCreators(plugin.Config.b079_a3_timer, false);
                                response = plugin.Config.b079_msg_a3_run;
                                return(true);
                            }

                            if (args[1].ToLower().Equals("a4"))
                            {
                                if (plr.RH.scp079PlayerScript.NetworkcurLvl < plugin.Config.b079_a4_tier)
                                {
                                    response = plugin.Config.b079_msg_tier_required.Replace("$tier", "" + (plugin.Config.b079_a4_tier + 1));
                                    return(true);
                                }
                                if (plr.RH.scp079PlayerScript.NetworkcurMana >= plugin.Config.b079_a4_power)
                                {
                                    plr.RH.scp079PlayerScript.NetworkcurMana -= plugin.Config.b079_a4_power;
                                }
                                else
                                {
                                    response = plugin.Config.b079_msg_no_power;
                                    return(true);
                                }
                                var             pos      = plr.RH.scp079PlayerScript.currentCamera.transform.position;
                                GrenadeManager  gm       = plr.RH.GetComponent <GrenadeManager>();
                                GrenadeSettings settings = gm.availableGrenades.FirstOrDefault(g => g.inventoryID == ItemType.GrenadeFlash);
                                FlashGrenade    flash    = GameObject.Instantiate(settings.grenadeInstance).GetComponent <FlashGrenade>();
                                flash.fuseDuration = 0.5f;
                                flash.InitData(gm, Vector3.zero, Vector3.zero, 1f);
                                flash.transform.position = pos;
                                NetworkServer.Spawn(flash.gameObject);
                                response = plugin.Config.b079_msg_a4_run;
                                return(true);
                            }
                            response = plugin.Config.b079_msg_help_cmd_fail.Replace("$prefix", "" + plugin.Config.b079_prefix);
                            return(true);
                        }
                        response = plugin.Config.b079_msg_help_cmd_fail.Replace("$prefix", "" + plugin.Config.b079_prefix);
                        return(true);
                    }
                }
            }
            response = Better079Plugin.instance.Config.b079_msg_help_cmd_fail.Replace("$prefix", "" + Better079Plugin.instance.Config.b079_prefix);
            return(false);
        }
Ejemplo n.º 7
0
        public void ConsoleCmd(ConsoleCommandEvent ev)
        {
            if (ev.Player.GetRole() == RoleType.Scp079)
            {
                string[] args = ev.Command.Split(' ');
                if (args[0].Equals(Plugin.CommandPrefix))
                {
                    if (args.Length >= 2)
                    {
                        if (args[1].ToLower().Equals("help") || args[1].ToLower().Equals("commands") || args[1].ToLower().Equals("?"))
                        {
                            ev.ReturnMessage = Plugin.HelpMsgTitle + "\n" +
                                               "\"." + Plugin.CommandPrefix + " a1\" - " + Plugin.HelpMsgA1 + " | Coût: " + Plugin.A1Power + " AP | Tier " + (Plugin.A1Tier + 1) + ".\n" +
                                               "\"." + Plugin.CommandPrefix + " a2\" - " + Plugin.HelpMsgA2 + " | Coût: " + Plugin.A2Power + " AP | Tier " + (Plugin.A2Tier + 1) + ".\n" +
                                               "\"." + Plugin.CommandPrefix + " a3\" - " + Plugin.HelpMsgA3 + " | Coût: " + Plugin.A3Power + " AP | Tier " + (Plugin.A3Tier + 1) + ".\n" +
                                               "\"." + Plugin.CommandPrefix + " a4\" - " + Plugin.HelpMsgA4 + " | Coût: " + Plugin.A4Power + " AP | Tier " + (Plugin.A4Tier + 1) + ".\n" +
                                               "\"." + Plugin.CommandPrefix + " a5\" - " + Plugin.HelpMsgA5 + " | Coût: " + Plugin.A5Power + " AP | Tier " + (Plugin.A5Tier + 1) + ".\n" +
                                               "\"." + Plugin.CommandPrefix + " a6\" - " + Plugin.HelpMsgA6 + " | Coût: " + Plugin.A6Cost + " Tier | Tier " + (Plugin.A6Tier + 1) + ".\n" +
                                               "\"." + Plugin.CommandPrefix + " suicide\" - " + Plugin.HelpMsgSuicide + ".\n";
                            return;
                        }

                        if (args[1].ToLower().Equals("a1"))
                        {
                            if (ev.Player.scp079PlayerScript.NetworkcurLvl < Plugin.A1Tier)
                            {
                                ev.ReturnMessage = Plugin.TierRequiredMsg.Replace("$tier", "" + (Plugin.A1Tier + 1));
                                return;
                            }
                            if (ev.Player.scp079PlayerScript.NetworkcurMana < Plugin.A1Power)
                            {
                                ev.ReturnMessage = Plugin.NoPowerMsg;
                                return;
                            }
                            if (args.Length > 3)
                            {
                                if (Plugin.A1AntiSpam > TimeBehaviour.CurrentTimestamp())
                                {
                                    ev.ReturnMessage = Plugin.AntiSpamMsg.Replace("%s", Math.Ceiling(TimeSpan.FromTicks(Plugin.A1AntiSpam - TimeBehaviour.CurrentTimestamp()).TotalSeconds).ToString());
                                    return;
                                }
                                else
                                {
                                    // .079 a1 SCP CAUSE[unknow/as/mtf/chaos] UNIT[C] UNIT[25]
                                    if (int.TryParse(args[2], out int SCP) || !String.IsNullOrWhiteSpace(args[3]))
                                    {
                                        string tts = string.Empty;
                                        tts += "BG_MTF2 BREAK_PREANNC SCP";
                                        foreach (char c in args[2])
                                        {
                                            tts += " " + c;
                                        }
                                        switch (args[3].ToLower())
                                        {
                                        case "mtf":
                                            if (args.Length > 5)
                                            {
                                                if (char.IsLetter(args[4][0]) || !String.IsNullOrWhiteSpace(args[5]))
                                                {
                                                    tts += " CONTAINEDSUCCESSFULLY CONTAINMENTUNIT NATO_" + args[4][0] + " " + args[5];
                                                }
                                                else
                                                {
                                                    ev.ReturnMessage = Plugin.FailA1Msg;
                                                    return;
                                                }
                                            }
                                            else
                                            {
                                                ev.ReturnMessage = Plugin.FailA1Msg;
                                                return;
                                            }
                                            break;

                                        case "security":
                                            tts += " SUCCESSFULLY TERMINATED BY AUTOMATIC SECURITY SYSTEM";
                                            break;

                                        case "chaos":
                                            tts += " TERMINATED BY CHAOSINSURGENCY";
                                            break;

                                        case "classed":
                                            tts += " TERMINATED BY CLASSD PERSONNEL";
                                            break;

                                        case "scientifique":
                                            tts += " TERMINATED BY SCIENCE PERSONNEL";
                                            break;

                                        case "decontamination":
                                            tts += " LOST IN DECONTAMINATION SEQUENCE";
                                            break;

                                        default:
                                            tts += " SUCCESSFULLY TERMINATED . CONTAINMENTUNIT UNKNOWN";
                                            break;
                                        }
                                        DoAnnouncement(tts, true);
                                        ev.Player.scp079PlayerScript.NetworkcurMana -= Plugin.A1Power;
                                        Plugin.A1AntiSpam = DateTime.UtcNow.AddSeconds((double)Plugin.A1TimeBetween).Ticks;
                                        ev.ReturnMessage  = Plugin.RunA1Msg;
                                        return;
                                    }
                                }
                            }
                            else
                            {
                                ev.ReturnMessage = Plugin.FailA1Msg;
                                return;
                            }
                        }

                        if (args[1].ToLower().Equals("a2"))
                        {
                            if (ev.Player.scp079PlayerScript.NetworkcurLvl < Plugin.A2Tier)
                            {
                                ev.ReturnMessage = Plugin.TierRequiredMsg.Replace("$tier", "" + (Plugin.A2Tier + 1));
                                return;
                            }
                            if (ev.Player.scp079PlayerScript.NetworkcurMana >= Plugin.A2Power)
                            {
                                ev.Player.scp079PlayerScript.NetworkcurMana -= Plugin.A2Power;
                            }
                            else
                            {
                                ev.ReturnMessage = Plugin.NoPowerMsg;
                                return;
                            }
                            Room room = SCP079Room(ev.Player);
                            if (room == null)
                            {
                                ev.ReturnMessage = Plugin.FailA2Msg;
                                return;
                            }
                            if (room.Zone == ZoneType.Surface)
                            {
                                ev.ReturnMessage = Plugin.FailA2Msg;
                                return;
                            }
                            foreach (var item in Plugin.A2BlacklistRooms)
                            {
                                if (room.Name.ToLower().Contains(item.ToLower()))
                                {
                                    ev.ReturnMessage = Plugin.FailA2Msg;
                                    return;
                                }
                            }
                            if (Plugin.A2AntiSpam > TimeBehaviour.CurrentTimestamp())
                            {
                                ev.ReturnMessage = Plugin.AntiSpamMsg.Replace("%s", Math.Ceiling(TimeSpan.FromTicks(Plugin.A2AntiSpam - TimeBehaviour.CurrentTimestamp()).TotalSeconds).ToString());
                                return;
                            }
                            Timing.RunCoroutine(GasRoom(room, ev.Player));
                            Plugin.A2AntiSpam = DateTime.UtcNow.AddSeconds((double)Plugin.A2TimeBetween).Ticks;
                            ev.ReturnMessage  = Plugin.RunA2Msg;
                            return;
                        }

                        if (args[1].ToLower().Equals("a3"))
                        {
                            if (ev.Player.scp079PlayerScript.NetworkcurLvl < Plugin.A3Tier)
                            {
                                ev.ReturnMessage = Plugin.TierRequiredMsg.Replace("$tier", "" + (Plugin.A3Tier + 1));
                                return;
                            }
                            if (ev.Player.scp079PlayerScript.NetworkcurMana >= Plugin.A3Power)
                            {
                                ev.Player.scp079PlayerScript.NetworkcurMana -= Plugin.A3Power;
                            }
                            else
                            {
                                ev.ReturnMessage = Plugin.NoPowerMsg;
                                return;
                            }
                            Generator079.generators[0].RpcCustomOverchargeForOurBeautifulModCreators(Plugin.A3Timer, false);
                            ev.ReturnMessage = Plugin.RunA3Msg;
                            return;
                        }

                        if (args[1].ToLower().Equals("a4"))
                        {
                            if (ev.Player.scp079PlayerScript.NetworkcurLvl < Plugin.A4Tier)
                            {
                                ev.ReturnMessage = Plugin.TierRequiredMsg.Replace("$tier", "" + (Plugin.A4Tier + 1));
                                return;
                            }
                            if (ev.Player.scp079PlayerScript.NetworkcurMana >= Plugin.A4Power)
                            {
                                ev.Player.scp079PlayerScript.NetworkcurMana -= Plugin.A4Power;
                            }
                            else
                            {
                                ev.ReturnMessage = Plugin.NoPowerMsg;
                                return;
                            }
                            var             pos      = ev.Player.scp079PlayerScript.currentCamera.transform.position;
                            GrenadeManager  gm       = ev.Player.GetComponent <GrenadeManager>();
                            GrenadeSettings settings = gm.availableGrenades.FirstOrDefault(g => g.inventoryID == ItemType.GrenadeFlash);
                            FlashGrenade    flash    = GameObject.Instantiate(settings.grenadeInstance).GetComponent <FlashGrenade>();
                            flash.fuseDuration = 0.5f;
                            flash.InitData(gm, Vector3.zero, Vector3.zero, 1f);
                            flash.transform.position = pos;
                            NetworkServer.Spawn(flash.gameObject);
                            ev.ReturnMessage = Plugin.RunA4Msg;
                            return;
                        }

                        if (args[1].ToLower().Equals("suicide"))
                        {
                            ev.Player.playerStats.HurtPlayer(new PlayerStats.HitInfo(119000000, ev.Player.GetNickname(), DamageTypes.Wall, ev.Player.GetPlayerId()), ev.Player.gameObject);
                            return;
                        }

                        if (args[1].ToLower().Equals("a5"))
                        {
                            if (ev.Player.scp079PlayerScript.NetworkcurLvl < Plugin.A1Tier)
                            {
                                ev.ReturnMessage = Plugin.TierRequiredMsg.Replace("$tier", "" + (Plugin.A5Tier + 1));
                                return;
                            }
                            if (ev.Player.scp079PlayerScript.NetworkcurMana < Plugin.A5Power)
                            {
                                ev.ReturnMessage = Plugin.NoPowerMsg;
                                return;
                            }
                            if (args.Length > 2)
                            {
                                if (Plugin.A5AntiSpam > TimeBehaviour.CurrentTimestamp())
                                {
                                    ev.ReturnMessage = Plugin.AntiSpamMsg.Replace("%s", Math.Ceiling(TimeSpan.FromTicks(Plugin.A5AntiSpam - TimeBehaviour.CurrentTimestamp()).TotalSeconds).ToString());
                                    return;
                                }
                                else
                                {
                                    // .079 a5 GROUPE[unknow/mtf] UNIT[C] UNIT[25] [REMAIN SCP]
                                    if (!String.IsNullOrWhiteSpace(args[2]))
                                    {
                                        string tts = string.Empty;
                                        switch (args[2].ToLower())
                                        {
                                        case "mtf":
                                            if (args.Length > 5)
                                            {
                                                bool success = Int32.TryParse(args[5], out int scpleft);
                                                if (char.IsLetter(args[3][0]) || !String.IsNullOrWhiteSpace(args[4]) || success)
                                                {
                                                    tts += "MTFUNIT EPSILON 11 DESIGNATED NATO_" + args[3][0] + " " + args[4] + " HASENTERED ALLREMAINING ";
                                                    tts += ((scpleft <= 0) ? "NOSCPSLEFT" : ("AWAITINGRECONTAINMENT " + scpleft + ((scpleft == 1) ? " SCPSUBJECT" : " SCPSUBJECTS")));
                                                }
                                                else
                                                {
                                                    ev.ReturnMessage = Plugin.FailA5Msg;
                                                    return;
                                                }
                                            }
                                            else
                                            {
                                                ev.ReturnMessage = Plugin.FailA5Msg;
                                                return;
                                            }
                                            break;

                                        default:
                                            tts += "Danger. Alert all security .g1 personnel. .g4 Unauthorized personnel .g2 have been detected .g1 in the facility.";
                                            break;
                                        }
                                        DoAnnouncement(tts, true);
                                        ev.Player.scp079PlayerScript.NetworkcurMana -= Plugin.A5Power;
                                        Plugin.A5AntiSpam = DateTime.UtcNow.AddSeconds((double)Plugin.A5TimeBetween).Ticks;
                                        ev.ReturnMessage  = Plugin.RunA5Msg;
                                        return;
                                    }
                                }
                            }
                            else
                            {
                                ev.ReturnMessage = Plugin.FailA5Msg;
                                return;
                            }
                        }

                        if (args[1].ToLower().Equals("a6"))
                        {
                            if (ev.Player.scp079PlayerScript.NetworkcurLvl < Plugin.A6Tier)
                            {
                                ev.ReturnMessage = Plugin.TierRequiredMsg.Replace("$tier", "" + (Plugin.A6Tier + 1));
                                return;
                            }
                            if (ev.Player.scp079PlayerScript.NetworkcurMana < Plugin.A6Power)
                            {
                                ev.ReturnMessage = Plugin.NoPowerMsg;
                                return;
                            }
                            else
                            {
                                List <ReferenceHub> riplist;
                                ReferenceHub        chosenPlayer;
                                riplist = GetHubList(RoleType.Spectator);
                                if (riplist.Count > 0)
                                {
                                    chosenPlayer = riplist[(new System.Random()).Next(riplist.Count)];
                                    int SCP = PlayerManager.localPlayer.GetComponent <CharacterClassManager>().FindRandomIdUsingDefinedTeam(Team.SCP);
                                    if (SCP != 1)
                                    {
                                        chosenPlayer.SetRole((RoleType)SCP);
                                        chosenPlayer.Broadcast(10, Plugin.NewSCPA6Msg, false);
                                        ev.Player.scp079PlayerScript.NetworkcurLvl  -= Plugin.A6Cost;
                                        ev.Player.scp079PlayerScript.NetworkcurMana -= Plugin.A6Power;
                                        Scp079.SetMaxEnergy(ev.Player, 125);
                                        Timing.CallDelayed(0.8f, () => { foreach (Room r in Map.Rooms)
                                                                         {
                                                                             if (r.Name.ToLower().Equals("HCZ_079".ToLower()))
                                                                             {
                                                                                 chosenPlayer.SetPosition(r.Position.x, r.Position.y + 1, r.Position.z);
                                                                             }
                                                                         }
                                                                         chosenPlayer.SetHealth(chosenPlayer.GetMaxHealth()); });
                                        DoAnnouncement("Alert. New containment .g1 breach detected. Cassie .g2 corruption detected. Code .g4 red.", true);
                                        ev.ReturnMessage = Plugin.RunA6Msg;
                                        return;
                                    }
                                    else
                                    {
                                        ev.ReturnMessage = Plugin.NoSCPA6Msg;
                                        return;
                                    }
                                }
                                else
                                {
                                    ev.ReturnMessage = Plugin.NoPlayerA6Msg;
                                    return;
                                }
                            }
                        }
                        ev.ReturnMessage = Plugin.HelpMsg.Replace("$prefix", "" + Plugin.CommandPrefix);
                        return;
                    }
                    ev.ReturnMessage = Plugin.HelpMsg.Replace("$prefix", "" + Plugin.CommandPrefix);
                    return;
                }
            }
        }
Ejemplo n.º 8
0
        // https://github.com/galaxy119/EXILED/blob/master/EXILED_Main/Extensions/Player.cs


        public void ConsoleCmd(SendingConsoleCommandEventArgs ev)
        {
            if (ev.Player.Role.Equals(RoleType.Scp079))
            {
                if (ev.Name.Equals(plugin.Config.b079_prefix))
                {
                    ev.Allow = false;
                    if (ev.Arguments.IsEmpty())
                    {
                        ev.ReturnMessage = plugin.Config.b079_help_title + "\n" +
                                           "\"." + plugin.Config.b079_prefix + " a1\" - " + plugin.Config.b079_help_a1 + " - " + plugin.Config.b079_a1_power + "+ AP - Tier " + (plugin.Config.b079_a1_tier + 1) + "+\n" +
                                           "\"." + plugin.Config.b079_prefix + " a2\" - " + plugin.Config.b079_help_a2 + " - " + plugin.Config.b079_a2_power + "+ AP - Tier " + (plugin.Config.b079_a2_tier + 1) + "+\n" +
                                           "\"." + plugin.Config.b079_prefix + " a3\" - " + plugin.Config.b079_help_a3 + " - " + plugin.Config.b079_a3_power + "+ AP - Tier " + (plugin.Config.b079_a3_tier + 1) + "+\n" +
                                           "\"." + plugin.Config.b079_prefix + " a4\" - " + plugin.Config.b079_help_a4 + " - " + plugin.Config.b079_a4_power + "+ AP - Tier " + (plugin.Config.b079_a4_tier + 1) + "+\n";
                        return;
                    }
                    if (ev.Arguments.Count >= 1)
                    {
                        if (ev.Arguments[0].ToLower().Equals("help") || ev.Arguments[0].ToLower().Equals("commands") || ev.Arguments[0].ToLower().Equals("?"))
                        {
                            ev.ReturnMessage = plugin.Config.b079_help_title + "\n" +
                                               "\"." + plugin.Config.b079_prefix + " a1\" - " + plugin.Config.b079_help_a1 + " - " + plugin.Config.b079_a1_power + "+ AP - Tier " + (plugin.Config.b079_a1_tier + 1) + "+\n" +
                                               "\"." + plugin.Config.b079_prefix + " a2\" - " + plugin.Config.b079_help_a2 + " - " + plugin.Config.b079_a2_power + "+ AP - Tier " + (plugin.Config.b079_a2_tier + 1) + "+\n" +
                                               "\"." + plugin.Config.b079_prefix + " a3\" - " + plugin.Config.b079_help_a3 + " - " + plugin.Config.b079_a3_power + "+ AP - Tier " + (plugin.Config.b079_a3_tier + 1) + "+\n" +
                                               "\"." + plugin.Config.b079_prefix + " a4\" - " + plugin.Config.b079_help_a4 + " - " + plugin.Config.b079_a4_power + "+ AP - Tier " + (plugin.Config.b079_a4_tier + 1) + "+\n";
                            return;
                        }

                        if (ev.Arguments[0].ToLower().Equals("a1"))
                        {
                            if (ev.Player.ReferenceHub.scp079PlayerScript.NetworkcurLvl < plugin.Config.b079_a1_tier)
                            {
                                ev.ReturnMessage = plugin.Config.b079_msg_tier_required.Replace("$tier", "" + (plugin.Config.b079_a1_tier + 1));
                                return;
                            }
                            if (ev.Player.ReferenceHub.scp079PlayerScript.NetworkcurMana >= plugin.Config.b079_a1_power)
                            {
                                ev.Player.ReferenceHub.scp079PlayerScript.NetworkcurMana -= plugin.Config.b079_a1_power;
                            }
                            else
                            {
                                ev.ReturnMessage = plugin.Config.b079_msg_no_power;
                                return;
                            }
                            var cams = GetSCPCameras();
                            if (cams.Count > 0)
                            {
                                Camera079 cam = cams[UnityEngine.Random.Range(0, cams.Count)];
                                ev.Player.ReferenceHub.scp079PlayerScript.CmdSwitchCamera(cam.cameraId, false);
                                ev.ReturnMessage = plugin.Config.b079_msg_a1_run;
                                return;
                            }
                            else
                            {
                                ev.ReturnMessage = plugin.Config.b079_msg_a1_fail;
                                ev.Player.ReferenceHub.scp079PlayerScript.NetworkcurMana += plugin.Config.b079_a1_power;
                                return;
                            }
                        }

                        if (ev.Arguments[0].ToLower().Equals("a2"))
                        {
                            if (ev.Player.ReferenceHub.scp079PlayerScript.NetworkcurLvl < plugin.Config.b079_a2_tier)
                            {
                                ev.ReturnMessage = plugin.Config.b079_msg_tier_required.Replace("$tier", "" + (plugin.Config.b079_a2_tier + 1));
                                return;
                            }
                            if (ev.Player.ReferenceHub.scp079PlayerScript.NetworkcurMana >= plugin.Config.b079_a2_power)
                            {
                                ev.Player.ReferenceHub.scp079PlayerScript.NetworkcurMana -= plugin.Config.b079_a2_power;
                            }
                            else
                            {
                                ev.ReturnMessage = plugin.Config.b079_msg_no_power;
                                return;
                            }
                            if (Time.timeSinceLevelLoad - a2cooldown < plugin.Config.b079_a2_cooldown)
                            {
                                ev.Player.ReferenceHub.scp079PlayerScript.NetworkcurMana += plugin.Config.b079_a2_power;
                                ev.ReturnMessage = plugin.Config.b079_msg_a2_fail;
                                return;
                            }
                            Room room = ev.Player.CurrentRoom;
                            if (room == null)
                            {
                                ev.Player.ReferenceHub.scp079PlayerScript.NetworkcurMana += plugin.Config.b079_a2_power;
                                ev.ReturnMessage = plugin.Config.b079_msg_a2_fail;
                                return;
                            }
                            if (room.Zone == ZoneType.Surface)
                            {
                                ev.Player.ReferenceHub.scp079PlayerScript.NetworkcurMana += plugin.Config.b079_a2_power;
                                ev.ReturnMessage = plugin.Config.b079_msg_a2_fail;
                                return;
                            }
                            foreach (var item in plugin.Config.b079_a2_blacklisted_rooms)
                            {
                                if (room.Name.ToLower().Contains(item.ToLower()))
                                {
                                    ev.Player.ReferenceHub.scp079PlayerScript.NetworkcurMana += plugin.Config.b079_a2_power;
                                    ev.ReturnMessage = plugin.Config.b079_msg_a2_fail;
                                    return;
                                }
                            }
                            Timing.RunCoroutine(GasRoom(room, ev.Player.ReferenceHub));
                            ev.ReturnMessage = plugin.Config.b079_msg_a2_run;
                            return;
                        }

                        if (ev.Arguments[0].ToLower().Equals("a3"))
                        {
                            if (ev.Player.ReferenceHub.scp079PlayerScript.NetworkcurLvl < plugin.Config.b079_a3_tier)
                            {
                                ev.ReturnMessage = plugin.Config.b079_msg_tier_required.Replace("$tier", "" + (plugin.Config.b079_a3_tier + 1));
                                return;
                            }
                            if (ev.Player.ReferenceHub.scp079PlayerScript.NetworkcurMana >= plugin.Config.b079_a3_power)
                            {
                                ev.Player.ReferenceHub.scp079PlayerScript.NetworkcurMana -= plugin.Config.b079_a3_power;
                            }
                            else
                            {
                                ev.ReturnMessage = plugin.Config.b079_msg_no_power;
                                return;
                            }
                            Generator079.Generators[0].ServerOvercharge(plugin.Config.b079_a3_timer, false);
                            ev.ReturnMessage = plugin.Config.b079_msg_a3_run;
                            return;
                        }

                        if (ev.Arguments[0].ToLower().Equals("a4"))
                        {
                            if (ev.Player.ReferenceHub.scp079PlayerScript.NetworkcurLvl < plugin.Config.b079_a4_tier)
                            {
                                ev.ReturnMessage = plugin.Config.b079_msg_tier_required.Replace("$tier", "" + (plugin.Config.b079_a4_tier + 1));
                                return;
                            }
                            if (a4cooldown >= Time.time)
                            {
                                ev.ReturnMessage = $"<color=red>This ability is in CoolDown ({(int) (a4cooldown - Time.time)})</color>";
                                return;
                            }
                            if (ev.Player.ReferenceHub.scp079PlayerScript.NetworkcurMana >= plugin.Config.b079_a4_power)
                            {
                                ev.Player.ReferenceHub.scp079PlayerScript.NetworkcurMana -= plugin.Config.b079_a4_power;
                            }
                            else
                            {
                                ev.ReturnMessage = plugin.Config.b079_msg_no_power;
                                return;
                            }
                            a4cooldown = Time.time + 5f;
                            var             pos      = ev.Player.ReferenceHub.scp079PlayerScript.currentCamera.transform.position;
                            GrenadeManager  gm       = ev.Player.ReferenceHub.GetComponent <GrenadeManager>();
                            GrenadeSettings settings = gm.availableGrenades.FirstOrDefault(g => g.inventoryID == ItemType.GrenadeFlash);
                            FlashGrenade    flash    = GameObject.Instantiate(settings.grenadeInstance).GetComponent <FlashGrenade>();
                            flash.fuseDuration = 0.5f;
                            flash.InitData(gm, Vector3.zero, Vector3.zero, 1f);
                            flash.transform.position = pos;
                            NetworkServer.Spawn(flash.gameObject);
                            ev.ReturnMessage = plugin.Config.b079_msg_a4_run;
                            return;
                        }
                        ev.ReturnMessage = plugin.Config.b079_msg_help_cmd_fail.Replace("$prefix", "" + plugin.Config.b079_prefix);
                        return;
                    }
                    ev.ReturnMessage = plugin.Config.b079_msg_help_cmd_fail.Replace("$prefix", "" + plugin.Config.b079_prefix);
                    return;
                }
            }
        }