Example #1
0
 public void UpdateHealths(UnityEngine.Collider[] colliders, EPlayer thrower, string type)
 {
     foreach (UnityEngine.Collider collider in colliders.Where(c => c.name == "Player"))
     {
         EPlayer player = EPlayer.Get(collider.gameObject);
         if (player != null && player.Team == thrower.Team)
         {
             if (TrackingAndMethods.PlayersWithSubclasses[thrower].FloatOptions.ContainsKey(type))
             {
                 if (TrackingAndMethods.PlayersWithSubclasses[thrower].FloatOptions[type] + player.Health > player.MaxHealth)
                 {
                     player.Health = player.MaxHealth;
                 }
                 else
                 {
                     player.Health += TrackingAndMethods.PlayersWithSubclasses[thrower].FloatOptions[type];
                 }
             }
             else
             {
                 player.Health = player.MaxHealth;
             }
         }
     }
 }
Example #2
0
        protected override void RoleAdded(Player player)
        {
            try
            {
                foreach (CustomAbility ability in CustomAbilities)
                {
                    if (ability is BlackoutAbility blackout)
                    {
                        blackout.CanUseOverride = () => CanUseAbility(player, blackout);
                    }
                }

                if (!ConsumptionStacks.ContainsKey(player))
                {
                    ConsumptionStacks[player] = 1;
                }
                player.UnitName = "Scp575";
                Log.Debug($"{Name} added to {player.Nickname}");
                Cassie.GlitchyMessage("Alert . scp 5 7 5 has breached containment", 0.5f, 0.1f);
                _coroutines.Add(Timing.RunCoroutine(Invisibility(player)));
                player.CustomInfo = $"<color=red>{player.Nickname}\nSCP-575</color>";
                player.ReferenceHub.nicknameSync.ShownPlayerInfo &= ~PlayerInfoArea.Nickname;
                player.ReferenceHub.nicknameSync.ShownPlayerInfo &= ~PlayerInfoArea.Badge;
                player.ReferenceHub.nicknameSync.ShownPlayerInfo &= ~PlayerInfoArea.Role;
                player.ReferenceHub.nicknameSync.ShownPlayerInfo &= ~PlayerInfoArea.PowerStatus;
                player.ReferenceHub.nicknameSync.ShownPlayerInfo &= ~PlayerInfoArea.UnitName;
            }
            catch (Exception e)
            {
                Log.Error($"{Name}: {e}\n{e.StackTrace}");
            }
        }
Example #3
0
        private static void Prefix(ReferenceHub __instance)
        {
            try
            {
                var player = PlayerAPI.Get(__instance);

                // Means it's the server
                if (player == null)
                {
                    return;
                }

                PlayerEvents.OnDestroying(new DestroyingEventArgs(player));

                PlayerAPI.Dictionary.Remove(player.GameObject);
                PlayerAPI.UnverifiedPlayers.Remove(__instance);
                PlayerAPI.IdsCache.Remove(player.Id);

                if (player.UserId != null)
                {
                    PlayerAPI.UserIdsCache.Remove(player.UserId);
                }
            }
            catch (Exception ex)
            {
                Log.Error($"{typeof(Destroying).FullName}.{nameof(Prefix)}:\n{ex}");
            }
        }
Example #4
0
 public void UpdateHealths(ExplodingGrenadeEventArgs ev, string type)
 {
     UnityEngine.Collider[] colliders = UnityEngine.Physics.OverlapSphere(ev.Grenade.transform.position, 4);
     foreach (UnityEngine.Collider collider in colliders.Where(c => c.name == "Player"))
     {
         EPlayer player = EPlayer.Get(collider.gameObject);
         if (player != null && player.Team == ev.Thrower.Team)
         {
             if (TrackingAndMethods.PlayersWithSubclasses.ContainsKey(player) && TrackingAndMethods.PlayersWithSubclasses[player].Abilities.Contains(AbilityType.CantHeal))
             {
                 return;
             }
             if (TrackingAndMethods.PlayersWithSubclasses[ev.Thrower].FloatOptions.ContainsKey(type))
             {
                 if (TrackingAndMethods.PlayersWithSubclasses[ev.Thrower].FloatOptions[type] + player.Health > player.MaxHealth)
                 {
                     player.Health = player.MaxHealth;
                 }
                 else
                 {
                     player.Health += TrackingAndMethods.PlayersWithSubclasses[ev.Thrower].FloatOptions[type];
                 }
             }
             else
             {
                 player.Health = player.MaxHealth;
             }
         }
     }
 }
Example #5
0
        public bool CheckSafeZones(Exiled.API.Features.Player player)
        {
            if (pluginInstance.Config.CuffedSafeZones == null)
            {
                Log.Error($"Detected invalid setting on cuffed_safe_zones! Key cannot be null!");
                return(false);
            }

            else if (pluginInstance.Config.CuffedSafeZones[player.Team]?.Any() == true)
            {
                if (pluginInstance.Config.CuffedSafeZones[player.Team].Contains(player.CurrentRoom.Zone))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            else
            {
                Log.Error($"Detected invalid setting on cuffed_safe_zones! Key: {player.Team}, List cannot be null!");
                return(false);
            }
        }
Example #6
0
        public void OnQuitOrSuicide(Exiled.API.Features.Player player)
        {
            if (!LastWarn.ContainsKey(player.UserId))
            {
                LastWarn.Add(player.UserId, DateTime.MinValue);
            }
            else if (LastWarn[player.UserId] >= DateTime.Now)
            {
                return;
            }

            Player databasePlayer    = player.GetDatabasePlayer();
            float  suicidePercentage = databasePlayer.SuicidePercentage;

            databasePlayer.SuicidePunishment[databasePlayer.SuicidePunishment.Count() - 1] = "Warn";
            AutoWarnPlayer(player);
            if (pluginInstance.Config.EnableSCPSuicideAutoBan && suicidePercentage >= pluginInstance.Config.AutoBanThreshold && player.GetDatabasePlayer().TotalScpGamesPlayed > pluginInstance.Config.ScpSuicideTollerance)
            {
                AutoBanPlayer(player);
            }
            else if (pluginInstance.Config.AutoKickOnSCPSuicide && suicidePercentage >= pluginInstance.Config.AutoKickThreshold && suicidePercentage < pluginInstance.Config.AutoBanThreshold && player.GetDatabasePlayer().TotalScpGamesPlayed > pluginInstance.Config.ScpSuicideTollerance)
            {
                AutoKickPlayer(player);
            }

            LastWarn[player.UserId] = DateTime.Now.AddSeconds(5);
        }
Example #7
0
        internal static void CallEvent(ReferenceHub hub, out Player player)
        {
            try
            {
                player = new PlayerAPI(hub);
#if DEBUG
                Log.Debug($"Creating player object for {hub.nicknameSync.Network_displayName}", true);
#endif
                Player.UnverifiedPlayers.Add(hub, player);
                Player p = player;
                Timing.CallDelayed(0.25f, () =>
                {
                    if (p.IsMuted)
                    {
                        p.ReferenceHub.characterClassManager.SetDirtyBit(2UL);
                    }
                });

                PlayerEvents.OnJoined(new JoinedEventArgs(player));
            }
            catch (Exception e)
            {
                Log.Error($"{nameof(CallEvent)}: {e}\n{e.StackTrace}");
                player = null;
            }
        }
Example #8
0
        public void ChangeIP(Exiled.API.Features.Player player)
        {
            Player databasePlayer = player.GetDatabasePlayer();
            var    accounts       = Database.LiteDatabase.GetCollection <Player>().FindAll()
                                    .Where(ip => ip.Ip == databasePlayer.Ip).ToList();
            StringBuilder message =
                new StringBuilder(
                    $"<color=green>[Player {databasePlayer.Name} ({databasePlayer.Id}@{databasePlayer.Authentication}) has changed IP ({accounts.Count})]</color>")
                .AppendLine();

            foreach (var ips in accounts)
            {
                message.AppendLine();
                message.Append(
                    $"Old IP: <color=yellow>{databasePlayer.Ip}</color>\nNew IP: <color=yellow>{player.IPAddress}</color>\nPlayer: <color=yellow>{ips.Name} ({ips.Id}{ips.Authentication})</color>\nFirst Join: <color=yellow>{ips.FirstJoin}</color>\nIsRestricted: <color=yellow>{ips.IsRestricted()}</color>\nIsBanned: <color=yellow>{ips.IsBanned()}</color>\nTotal played as SCP: <color=yellow>{ips.TotalScpGamesPlayed}</color>\nTotal suicide: <color=yellow>{ips.ScpSuicideCount}</color>")
                .AppendLine();
            }

            foreach (var staffer in Exiled.API.Features.Player.List.Where(x => x.RemoteAdminAccess))
            {
                if (pluginInstance.Config.AlertStaffBroadcastChangeIP.Show)
                {
                    staffer.ClearBroadcasts();
                    staffer.Broadcast(pluginInstance.Config.AlertStaffBroadcastChangeIP.Duration,
                                      pluginInstance.Config.AlertStaffBroadcastChangeIP.Content
                                      .Replace("{player}", player.Nickname + " " + player.UserId)
                                      .Replace("{oldIP}", databasePlayer.Ip).Replace("{newIP}", player.IPAddress));
                    staffer.SendConsoleMessage(message.ToString(), "default");
                }
            }
            databasePlayer.Ip = player.IPAddress;
            Database.LiteDatabase.GetCollection <Player>().Update(databasePlayer);
        }
Example #9
0
 public void InventoryChanges(Dictionary <ItemType, int> items, Exiled.API.Features.Player player, int num, int i)
 {
     foreach (var possibility in items)
     {
         if (num < possibility.Value)
         {
             if (possibility.Key != ItemType.None)
             {
                 Log.Debug($"Turning coin into {possibility.Key} number: {num}", KeepTheChange.Instance.Config.Debug);
                 player.Inventory.items.RemoveAt(i);
                 if (possibility.Key == ItemType.Coin)
                 {
                     Timing.CallDelayed(0.2f, () => // prevents the while loop running forever if it makes a coin.
                     {
                         player.Inventory.AddNewItem(possibility.Key);
                     });
                 }
                 else
                 {
                     player.Inventory.AddNewItem(possibility.Key);
                 }
             }
             else
             {
                 Log.Debug($"ItemType was none", KeepTheChange.Instance.Config.Debug);
                 player.Inventory.items.RemoveAt(i);
             }
             break;
         }
     }
 }
Example #10
0
        public void AutoBanPlayer(Exiled.API.Features.Player player)
        {
            int    duration;
            Player databasePlayer = player.GetDatabasePlayer();

            databasePlayer.TotalScpSuicideBans++;
            databasePlayer.SuicidePunishment[databasePlayer.SuicidePunishment.Count() - 1] = "Ban";

            if (pluginInstance.Config.MultiplyBanDurationEachBan == true)
            {
                duration = databasePlayer.TotalScpSuicideBans * pluginInstance.Config.AutoBanDuration * 60;
            }
            else
            {
                duration = pluginInstance.Config.AutoBanDuration * 60;
            }

            if (pluginInstance.Config.BroadcastSanctions)
            {
                BroadcastSuicideQuitAction($"<color=blue><SCPUtils> {player.Nickname} ({player.Role}) has been <color=red>BANNED</color> from the server for exceeding Quits / Suicides (as SCP) limit. Duration: {duration / 60} mitutes</color>");
            }
            if (pluginInstance.Config.MultiplyBanDurationEachBan == true)
            {
                databasePlayer.Expire[databasePlayer.Expire.Count() - 1] = DateTime.Now.AddMinutes((duration / 60) * databasePlayer.TotalScpSuicideBans);
            }
            else
            {
                databasePlayer.Expire[databasePlayer.Expire.Count() - 1] = DateTime.Now.AddMinutes(duration / 60);
            }
            player.Ban(duration, $"Auto-Ban: {string.Format(pluginInstance.Config.AutoBanMessage, duration)}", "SCPUtils");
        }
Example #11
0
        public void OnShooting(ShootingEventArgs ev)
        {
            if (Tracking.PlayersInvisibleByCommand.Contains(ev.Shooter))
            {
                Tracking.PlayersInvisibleByCommand.Remove(ev.Shooter);
            }
            EPlayer target = EPlayer.Get(ev.Target);

            if (target != null)
            {
                if (Tracking.PlayerHasFFToPlayer(ev.Shooter, target))
                {
                    Log.Debug($"Attacker: {ev.Shooter.Nickname} has been granted friendly fire", Subclass.Instance.Config.Debug);
                    ev.Shooter.IsFriendlyFireEnabled = true;
                    Timing.CallDelayed(0.1f, () =>
                    {
                        ev.Shooter.IsFriendlyFireEnabled = false;
                    });
                }
                else
                {
                    Log.Debug($"Attacker: {ev.Shooter.Nickname} has not been granted friendly fire", Subclass.Instance.Config.Debug);
                }
            }
        }
        void OnlySpecificPlayersBeDisplayedMode2(bool IsJoined, Exiled.API.Features.Player ply)
        {
            if (Plugin.Singleton.Config.SpecificPlayers.ContainsKey(ply.UserId))
            {
                List <String> Messages = Plugin.Singleton.Config.SpecificPlayers[ply.UserId];

                if (IsColoredRanksEnabled == true)
                {
                    string playername = $"<color={ ColorFix(ply.RankColor) }>{ply.Nickname}</color>";
                    if (IsJoined)
                    {
                        Map.Broadcast(LeftMessageDuration, Messages[0].Remove(0, 13).Replace("{playername}", playername));
                    }
                    else
                    {
                        Map.Broadcast(LeftMessageDuration, Messages[1].Remove(0, 13).Replace("{playername}", playername));
                    }
                }
                else
                {
                    if (IsJoined)
                    {
                        Map.Broadcast(LeftMessageDuration, Messages[0].Remove(1, 13).Replace("{playername}", ply.Nickname));
                    }
                    else
                    {
                        Map.Broadcast(LeftMessageDuration, Messages[1].Remove(1, 13).Replace("{playername}", ply.Nickname));
                    }
                }
            }
        }
Example #13
0
        public void AutoRoundBanPlayer(Exiled.API.Features.Player player)
        {
            int    rounds;
            Player databasePlayer = player.GetDatabasePlayer();

            databasePlayer.TotalScpSuicideBans++;
            databasePlayer.SuicidePunishment[databasePlayer.SuicidePunishment.Count() - 1] = "Round-Ban";
            if (pluginInstance.Config.MultiplyBanDurationEachBan == true)
            {
                rounds = databasePlayer.TotalScpSuicideBans * pluginInstance.Config.AutoBanRoundsCount;
            }
            else
            {
                rounds = pluginInstance.Config.AutoBanDuration;
            }
            if (pluginInstance.Config.BroadcastSanctions)
            {
                BroadcastSuicideQuitAction($"<color=blue><SCPUtils> {player.Nickname} ({player.Role}) has been <color=red>BANNED</color> from playing SCP for exceeding Quits / Suicides (as SCP) limit for {rounds} rounds.</color>");
                if (databasePlayer.RoundBanLeft >= 1)
                {
                    BroadcastSuicideQuitAction($"<color=blue><SCPUtils> {player.Nickname} has suicided while having an active ban!</color>");
                }
            }
            databasePlayer.RoundsBan[databasePlayer.RoundsBan.Count() - 1] = rounds;
            databasePlayer.RoundBanLeft += rounds;
            if (pluginInstance.Config.RoundBanNotification.Show)
            {
                player.ClearBroadcasts();
                var message = pluginInstance.Config.RoundBanNotification.Content;
                message = message.Replace("%roundnumber%", databasePlayer.RoundBanLeft.ToString());
                player.Broadcast(pluginInstance.Config.WelcomeMessage.Duration, message, pluginInstance.Config.WelcomeMessage.Type, false);
            }
        }
Example #14
0
 private void addPlayer(Exiled.API.Features.Player p)
 {
     if (!PlayerInfoDict.ContainsKey(p.UserId))
     {
         Exiled.API.Features.Log.Info("Player with userID:" + p.UserId + " added to dict.");
         PlayerInfoDict.Add(p.UserId, new PlayerInfo());
     }
 }
Example #15
0
 private static void RemovePlayer(Exiled.API.Features.Player player)
 {
     if (!Exiled.API.Features.Player.UserIdsCache.ContainsKey(player.UserId) && YouTubeTutorialPlugin.PlayerData.ContainsKey(player.UserId))
     {
         YouTubeTutorialPlugin.PlayerData.GetOrAdd(player.UserId, () => new PlayerData()).SaveData(player.UserId);
         YouTubeTutorialPlugin.PlayerData.Remove(player.UserId);
         Log.Debug($"Player: {player.Nickname} has been stored to disk.");
     }
 }
Example #16
0
        private void DoFlashEffect(Player player, float distance)
        {
            if (ResetConsumptionOnFlashed)
            {
                if (ConsumptionStacks[player] > 0)
                {
                    if (distance < 6 && ConsumptionStacks[player] > 1)
                    {
                        ConsumptionStacks[player]--;
                    }
                    else if (distance > 15)
                    {
                        ConsumptionStacks[player]++;
                    }

                    if ((ConsumptionStacks[player] / 2) >= 3)
                    {
                        ConsumptionStacks[player] -= 3;
                    }
                    else if ((ConsumptionStacks[player] / 2) >= 2)
                    {
                        ConsumptionStacks[player] -= 2;
                    }
                    else
                    {
                        ConsumptionStacks[player]--;
                    }
                }

                player.ShowHint($"You now have {ConsumptionStacks[player]} stacks of Consumption!", 10);
                int newIntensity = ConsumptionStacks[player] / (MaxConsumption / 2);
                player.ChangeEffectIntensity(EffectType.Scp207, (byte)newIntensity);
            }

            if (TeleportOnFlashed)
            {
                player.Position = Vector3.down * 1950f;

                Timing.CallDelayed(15f, () =>
                {
                    foreach (Player ply in Player.Get(Team.SCP))
                    {
                        if (player == ply)
                        {
                            continue;
                        }
                        player.Position = ply.Position + Vector3.up;
                        break;
                    }

                    Door hczArmoryDoor  = Exiled.API.Features.Map.GetDoorByName("HCZ_ARMORY");
                    Transform transform = hczArmoryDoor.Base.transform;
                    player.Position     = transform.position + transform.forward * 2f;
                });
            }
        }
Example #17
0
        private void OnExplodingGrenade(ExplodingGrenadeEventArgs ev)
        {
            if (!Check(ev.Grenade))
            {
                return;
            }

            ev.IsAllowed = false;

            Room room = Exiled.API.Features.Map.FindParentRoom(ev.Grenade);

            Log.Debug($"{ev.Grenade.transform.position} - {room.Position} - {Exiled.API.Features.Map.Rooms.Count}", CustomItems.Instance.Config.IsDebugEnabled);

            LockedRooms079.Add(room);

            room.TurnOffLights(Duration);

            Log.Debug($"{room.Doors.Count()} - {room.Type}", CustomItems.Instance.Config.IsDebugEnabled);

            foreach (DoorVariant door in room.Doors)
            {
                if (door == null ||
                    (!string.IsNullOrEmpty(door.GetNametag()) && BlacklistedDoorNames.Contains(door.GetNametag())) ||
                    (door.NetworkActiveLocks > 0 && !OpenLockedDoors) ||
                    (door.RequiredPermissions.RequiredPermissions != KeycardPermissions.None && !OpenKeycardDoors))
                {
                    continue;
                }

                Log.Debug("Opening a door!", CustomItems.Instance.Config.IsDebugEnabled);

                door.NetworkTargetState = true;
                door.ServerChangeLock(DoorLockReason.NoPower, true);

                if (lockedDoors.Contains(door))
                {
                    lockedDoors.Add(door);
                }

                Timing.CallDelayed(Duration, () =>
                {
                    door.ServerChangeLock(DoorLockReason.NoPower, false);
                    lockedDoors.Remove(door);
                });
            }

            foreach (Player player in Player.Get(RoleType.Scp079))
            {
                if (player.Camera != null && player.Camera.Room() == room)
                {
                    player.SetCamera(198);
                }
            }

            Timing.CallDelayed(Duration, () => LockedRooms079.Remove(room));
        }
Example #18
0
        public void AutoWarnPlayer(Exiled.API.Features.Player player)
        {
            if (pluginInstance.Config.BroadcastWarns)
            {
                BroadcastSuicideQuitAction($"<color=blue><SCPUtils> {player.Nickname} ({player.Role}) has been <color=red>WARNED</color> for Quitting or Suiciding as SCP</color>");
            }

            player.GetDatabasePlayer().ScpSuicideCount++;
            player.ClearBroadcasts();
            player.Broadcast(pluginInstance.Config.SuicideWarnMessage);
        }
Example #19
0
        IEnumerator <float> DoSuction(Player player, Vector3 position)
        {
            Log.Debug($"{player.Nickname} Suction begin", Plugin.Singleton.Config.Debug);
            for (int i = 0; i < Plugin.Singleton.Config.ItemConfigs.ImpCfg.SuctionCount; i++)
            {
                Log.Debug($"{player.Nickname} suctioned?", Plugin.Singleton.Config.Debug);
                player.Position = Vector3.MoveTowards(player.Position, position, Plugin.Singleton.Config.ItemConfigs.ImpCfg.SuctionPerTick);

                yield return(Timing.WaitForSeconds(Plugin.Singleton.Config.ItemConfigs.ImpCfg.SuctionTickRate));
            }
        }
Example #20
0
 protected override void RoleRemoved(Player player)
 {
     player.ReferenceHub.nicknameSync.ShownPlayerInfo |= PlayerInfoArea.PowerStatus;
     player.ReferenceHub.nicknameSync.ShownPlayerInfo |= PlayerInfoArea.UnitName;
     player.ReferenceHub.nicknameSync.ShownPlayerInfo |= PlayerInfoArea.Nickname;
     player.ReferenceHub.nicknameSync.ShownPlayerInfo |= PlayerInfoArea.Role;
     foreach (CoroutineHandle handle in _coroutines)
     {
         Timing.KillCoroutines(handle);
     }
     player.IsInvisible = false;
 }
Example #21
0
 public static void AddDoor(int doorId, DoorItem doorInfo, Exiled.API.Features.Player player)
 {
     if (CBDPlugin.Doors.ContainsKey(doorId))
     {
         CBDPlugin.Doors[doorId].MaxUses += doorInfo.MaxUses;
     }
     else
     {
         CBDPlugin.Doors.Add(doorId, doorInfo);
     }
     CBDPlugin.DoorsBlocked++;
 }
Example #22
0
        public void AutoKickPlayer(Exiled.API.Features.Player player)
        {
            if (pluginInstance.Config.BroadcastSanctions)
            {
                BroadcastSuicideQuitAction($"<color=blue><SCPUtils> {player.Nickname} ({player.Role}) has been <color=red>KICKED</color> from the server for exceeding Quits / Suicides (as SCP) limit</color>");
            }

            Player databasePlayer = player.GetDatabasePlayer();

            databasePlayer.TotalScpSuicideKicks++;
            databasePlayer.SuicidePunishment[databasePlayer.SuicidePunishment.Count() - 1] = "Kick";
            player.Kick($"Auto-Kick: {pluginInstance.Config.SuicideKickMessage}", "SCPUtils");
        }
        public static void ApplySelfHeal(Player p, float missing)
        {
            float MissingHP = p.MaxHealth - p.Health;

            if (p.Health + MissingHP * missing > p.MaxHealth)
            {
                p.Health = p.MaxHealth;
            }
            else
            {
                p.Health += MissingHP * missing;
            }
        }
        public static void CallZombieReinforcement(Player p, ushort cd, SendingConsoleCommandEventArgs ev)
        {
            // List of spectators to randomly choose from later
            List <Player> list = Player.List.Where(r => r.Role == RoleType.Spectator).ToList();

            // Only 049 is allowed to use this command
            if (p.Role != RoleType.Scp049)
            {
                ev.ReturnMessage = DocRework.config.Translation_Active_PermissionDenied;
                return;
            }

            if (CureCounter < DocRework.config.MinCures)
            {
                ev.ReturnMessage = DocRework.config.Translation_Active_NotEnoughRevives;
                return;
            }

            // Pretty self-explanatory i think
            if (cd > 0)
            {
                ev.ReturnMessage = DocRework.config.Translation_Active_OnCooldown + cd;
                return;
            }

            // If the list is empty it means no spectators can be chosen.
            if (list.IsEmpty())
            {
                ev.ReturnMessage = DocRework.config.Translation_Active_NoSpectators;
                return;
            }

            // Get a random player from the spectator list and spawn it as 049-2 then tp it to doc.
            var index = 0;

            index += new System.Random().Next(list.Count);
            var selected = list[index];

            selected.SetRole(RoleType.Scp0492);
            selected.Health = selected.MaxHealth;

            Timing.CallDelayed(0.5f, () =>
            {
                selected.Position = new Vector3(p.Position.x, p.Position.y, p.Position.z);
            });

            index = 0;

            AbilityCooldown = DocRework.config.Cooldown;
            Timing.RunCoroutine(StartCooldownTimer(), "SCP049_Active_Cooldown");
        }
Example #25
0
 public void OnRoundStarted()
 {
     try
     {
         Log.Debug("Round started, finding 049", BloodLust049.Instance.Config.Debug);
         Exiled.API.Features.Player scp049 = Exiled.API.Features.Player.List.First(p => p.Role == RoleType.Scp049);
         Log.Debug("049 found", BloodLust049.Instance.Config.Debug);
         BloodLust049.Instance.Scp049          = scp049;
         BloodLust049.Instance.Scp049InGame    = true;
         BloodLust049.Instance.mainCoroEnabled = true;
         BloodLust049.Instance.Coro            = Timing.RunCoroutine(BloodLust049.Instance.BloodLust());
         BloodLust049.Instance.Coroutines.Add(BloodLust049.Instance.Coro);
     }catch { } // Scp 049 not found, disregard
 }
Example #26
0
        public void IncreasePower(Player player)
        {
            if (ConsumptionStacks[player] >= MaxConsumption)
            {
                return;
            }

            Log.Debug($"{Name} power increase for {player.Nickname}");
            ConsumptionStacks[player]++;

            int newIntensity = ConsumptionStacks[player] / (MaxConsumption / 2);

            player.ChangeEffectIntensity(EffectType.Scp207, (byte)newIntensity);
            player.ShowHint($"You now have {ConsumptionStacks[player]} stacks of Consumption!");
        }
Example #27
0
 public IEnumerator <float> Bleed()
 {
     while (bleeding != null && bleeding.Count > 0)
     {
         double HealthPerSec    = BleedEffect.Instance.Config.HealthDrainPerSecond;
         double HealthPerSecInc = BleedEffect.Instance.Config.HealthDrainPerSecondIncrease;
         foreach (var ent in bleeding)
         {
             double  amount = HealthPerSec;
             EPlayer p      = EPlayer.Get(ent.Key);
             if (p.IsGodModeEnabled)
             {
                 bleeding.Remove(ent.Key);
             }
             if (ent.Value > 1)
             {
                 if (BleedEffect.Instance.Config.HealthDrainExponential)
                 {
                     double power = ent.Value;
                     if (amount < 1)
                     {
                         power /= BleedEffect.Instance.Config.HealthDrainDivisor;
                     }
                     amount = Math.Pow(HealthPerSec, power);
                 }
                 else
                 {
                     amount += HealthPerSecInc * (ent.Value - 1);
                 }
             }
             Log.Debug($"Player with id {ent.Key} has drained {amount} health.", BleedEffect.Instance.Config.Debug);
             if (p.Health - amount <= 0)
             {
                 bleeding.Remove(ent.Key);
                 beenShot.Remove(ent.Key);
                 p.Kill(DamageTypes.Bleeding);
                 continue;
             }
             p.Health -= (float)amount;
         }
         yield return(Timing.WaitForSeconds(1f));
     }
     BleedEffect.Instance.mainCoroEnabled = false;
     Log.Debug($"Stopping Coro {co}", BleedEffect.Instance.Config.Debug);
     BleedEffect.Instance.Coroutines.Remove(co);
     Timing.KillCoroutines(co);
     yield break;
 }
Example #28
0
        public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response)
        {
            PlayerCommandSender playerCommandSender = sender as PlayerCommandSender;
            EPlayer             pplayer             = EPlayer.Get(((CommandSender)sender).SenderId);

            if (!CmdCooldown.Contains(pplayer))
            {
                if (sender is PlayerCommandSender ply && EPlayer.Get(ply.SenderId) is EPlayer pp && pp.Role == RoleType.Scp173)
                {
                    foreach (var effect in pp.ReferenceHub.playerEffectsController.AllEffects.Values
                             .Where(x => x.GetType() == typeof(Scp268) || x.GetType() == typeof(Amnesia)))
                    {
                        if (!effect.Enabled)
                        {
                            pp.ReferenceHub.playerEffectsController.EnableEffect(effect, 15f);
                        }
                        else
                        {
                            effect.ServerDisable();
                        }
                    }
                    pp.IsInvisible = !pp.IsInvisible;
                    pp.Broadcast(5, $"You are now {(pp.IsInvisible ? "invisible" : "visible")}!");
                    response = $"You are {(pp.IsInvisible ? "Invisible" : "Visible")} now";
                    if (pp.IsInvisible)
                    {
                        Timing.CallDelayed(15f, () =>
                        {
                            pp.IsInvisible = false;
                        });
                    }
                    foreach (EPlayer shitass in EPlayer.List)
                    {
                        if (shitass.ReferenceHub.playerEffectsController.GetEffect <Amnesia>().Enabled&& pp.Role == RoleType.Scp173)
                        {
                            Scp173.TurnedPlayers.Add(shitass);
                        }
                    }
                    Coroutine.Add(Timing.RunCoroutine(VentCooldown(Singleton.Config.VentCooldown, pp)));
                    CmdCooldown.Add(pp);
                    return(true);
                }
                else
                {
                    response = "You are not SCP-173";
                    return(false);
                }
            }
        private static void ApplyHeal(byte type, Player p, float flat, float multiplier)
        {
            float HpGiven;
            bool  CanDisplay = true;
            float MissingHP  = p.MaxHealth - p.Health;

            if (p.Health == p.MaxHealth)
            {
                CanDisplay = false;
            }

            // Flat hp
            if (type == 0)
            {
                if (p.Health + flat > p.MaxHealth)
                {
                    HpGiven  = p.MaxHealth - p.Health;
                    p.Health = p.MaxHealth;
                }
                else
                {
                    HpGiven   = flat;
                    p.Health += flat;
                }
            }

            // Percentage HP
            else
            {
                if (p.Health + MissingHP * multiplier > p.MaxHealth)
                {
                    HpGiven  = p.MaxHealth - p.Health;
                    p.Health = p.MaxHealth;
                }
                else
                {
                    HpGiven   = MissingHP * multiplier;
                    p.Health += MissingHP * multiplier;
                }
            }

            // Sent Zombies notification that they got healed.
            if (CanDisplay)
            {
                p.HintDisplay.Show(new TextHint($"<color=red>+{HpGiven} HP</color>", new HintParameter[] { new StringHintParameter("") }, null, 2f));
            }
        }
Example #30
0
        internal static void CallEvent(ReferenceHub hub, out Player player)
        {
            player = new PlayerAPI(hub);

            Player.UnverifiedPlayers.Add(hub, player);
            var p = player;

            Timing.CallDelayed(0.25f, () =>
            {
                if (p.IsMuted)
                {
                    p.ReferenceHub.characterClassManager.SetDirtyBit(2UL);
                }
            });

            PlayerEvents.OnJoined(new JoinedEventArgs(player));
        }