/// <inheritdoc cref="Exiled.Events.Handlers.Scp096.OnAddingTarget(AddingTargetEventArgs)"/>
        public static void OnAddingTarget(AddingTargetEventArgs ev)
        {
            if (ev.Target.IsNpc() || ev.Scp096.IsNpc())
            {
                return;
            }

            if (Config.Enable096SeenMessage)
            {
                ev.Target.ShowHint(Config.Scp096SeenMessage, 5f);
            }

            if (Config.Enable096NewTargetMessage)
            {
                if (!Config.RoleStrings.TryGetValue(ev.Target.Role, out string translatedRole))
                {
                    translatedRole = ev.Target.Role.ToString();
                }

                string message = Config.Scp096NewTargetMessage.ReplaceAfterToken('$', new[]
                {
                    new Tuple <string, object>("name", ev.Target.Nickname),
                    new Tuple <string, object>("class", $"<color={ev.Target.RoleColor.ToHex()}>{translatedRole}</color>"),
                });

                ev.Scp096.ShowHint(message, 5f);
            }
        }
예제 #2
0
 internal void On096AddTarget(AddingTargetEventArgs ev)
 {
     if (pluginInstance.Config.Scp096TargetNotifyEnabled)
     {
         ev.Target.ShowHint(pluginInstance.Config.Scp096TargetNotifyText, pluginInstance.Config.Scp096TargetMessageDuration);
     }
 }
예제 #3
0
 public void OnAddingTarget(AddingTargetEventArgs ev)
 {
     if (plugin.Config.SendTargetMessage)
     {
         ev.Target.Broadcast(5, plugin.Config.TargetMessage);
     }
     dDamageToBeDone += plugin.Config.DamagePerTarget;
 }
예제 #4
0
        private static bool Prefix(Scp096 __instance, GameObject target)
        {
            ReferenceHub hub = ReferenceHub.GetHub(target);

            if (!__instance.CanReceiveTargets || hub == null || __instance._targets.Contains(hub))
            {
                return(false);
            }
            API.Features.Player scp096       = API.Features.Player.Get(__instance.Hub.gameObject);
            API.Features.Player targetPlayer = API.Features.Player.Get(target);
            if (scp096 == null)
            {
                Log.Error("SCP-096.AddTarget: Could not get SCP-096 player object.");
                return(true);
            }

            if (targetPlayer == null)
            {
                Log.Error("SCP-096.AddTarget: Could not get Target player object.");
                return(true);
            }

            AddingTargetEventArgs ev = new AddingTargetEventArgs(scp096, targetPlayer, 70, __instance.EnrageTimePerReset);

            Exiled.Events.Handlers.Scp096.OnAddingTarget(ev);
            if (ev.IsAllowed)
            {
                if (!__instance._targets.IsEmpty() || __instance.Enraged)
                {
                    if (__instance.AddedTimeThisRage + ev.EnrageTimeToAdd >= __instance.MaximumAddedEnrageTime)
                    {
                        ev.EnrageTimeToAdd = 0f;
                    }
                    else if (__instance.AddedTimeThisRage + ev.EnrageTimeToAdd > __instance.MaximumAddedEnrageTime)
                    {
                        ev.EnrageTimeToAdd = __instance.AddedTimeThisRage + ev.EnrageTimeToAdd - __instance.MaximumAddedEnrageTime;
                    }
                    __instance.EnrageTimeLeft    += ev.EnrageTimeToAdd;
                    __instance.AddedTimeThisRage += ev.EnrageTimeToAdd;
                }

                __instance._targets.Add(hub);
                __instance.AdjustShield(ev.AhpToAdd);
                NetworkServer.SendToClientOfPlayer <Scp096ToTargetMessage>(hub.characterClassManager.netIdentity, new Scp096ToTargetMessage(hub));
            }

            return(false);
        }
예제 #5
0
        public void Scp096AddingTarget(AddingTargetEventArgs ev)
        {
            if (ev.Target.Team == Team.SCP)
            {
                return;
            }

            if (plugin.Config.Enable096SeenMessage)
            {
                ShowMessage(ev.Target, plugin.Config.Scp096SeenMessage, 5f);
            }
            if (plugin.Config.Enable096NewTargetMessage)
            {
                string message = plugin.Config.Scp096NewTargetMessage.Replace("{name}", ev.Target.Nickname).Replace("{class}", $"<color={ev.Target.RoleColor.ToHex()}>{plugin.Config.RoleStrings[ev.Target.Role]}</color>");
                ShowMessage(ev.Scp096, message, 5f);
            }
        }
        public void Scp096AddingTarget(AddingTargetEventArgs ev)
        {
            if (ev.Target.Role.Team == Team.SCP || !ev.IsAllowed)
            {
                return;
            }

            if (plugin.Config.Enable096SeenMessage)
            {
                ShowMessage(ev.Target, plugin.Config.Scp096SeenMessage, plugin.Config.NotifDuration);
            }
            if (plugin.Config.Enable096NewTargetMessage)
            {
                string message = plugin.Config.Scp096NewTargetMessage.Replace("{name}", ev.Target.Nickname).Replace("{class}", $"<color={ev.Target.Role.Color.ToHex()}>{plugin.Config.RoleStrings?[ev.Target.Role] ?? "UNKNOWN"}</color>");
                ShowMessage(ev.Scp096, message, plugin.Config.NotifDuration);
            }
        }
예제 #7
0
        private static bool Prefix(Scp096 __instance, GameObject target)
        {
            ReferenceHub hub = ReferenceHub.GetHub(target);

            if (!__instance.CanReceiveTargets || hub == null || __instance._targets.Contains(hub))
            {
                return(false);
            }
            API.Features.Player scp096       = API.Features.Player.Get(__instance.Hub.gameObject);
            API.Features.Player targetPlayer = API.Features.Player.Get(target);
            if (scp096 == null)
            {
                Log.Error("SCP-096.AddTarget: Could not get SCP-096 player object.");
                return(true);
            }

            if (targetPlayer == null)
            {
                Log.Error("SCP-096.AddTarget: Could not get Target player object.");
                return(true);
            }

            AddingTargetEventArgs ev = new AddingTargetEventArgs(scp096, targetPlayer, 200, __instance.EnrageTimePerReset);

            if (targetPlayer.Role == RoleType.Tutorial && !Exiled.Events.Events.Instance.Config.CanTutorialTriggerScp096)
            {
                ev.IsAllowed = false;
            }
            Exiled.Events.Handlers.Scp096.OnAddingTarget(ev);

            if (ev.IsAllowed)
            {
                if (!__instance._targets.IsEmpty())
                {
                    __instance.EnrageTimeLeft += ev.EnrageTimeToAdd;
                }
                __instance._targets.Add(hub);
                __instance.AdjustShield(ev.AhpToAdd);
            }

            return(false);
        }
예제 #8
0
 /// <inheritdoc cref="Exiled.Events.Handlers.Scp096.OnAddingTarget(AddingTargetEventArgs)"/>
 public void OnAddingTarget(AddingTargetEventArgs ev)
 {
     Log.Info($"{ev.Target.Nickname} is being added to {ev.Scp096.Nickname} targets! Enrage time to add: {ev.EnrageTimeToAdd}");
 }
예제 #9
0
파일: Scp096.cs 프로젝트: somebofy/EXILED
 /// <summary>
 /// Called before adding a target to SCP-096.
 /// </summary>
 /// <param name="ev">The <see cref="AddingTargetEventArgs"/> instance.</param>
 public static void OnAddingTarget(AddingTargetEventArgs ev) => AddingTarget.InvokeSafely(ev);
예제 #10
0
 public void OnLookedAtSCP096(AddingTargetEventArgs ev)
 {
     ev.Target.Broadcast(5, YouLookedAtSCP096.Instance.Config.LookedMessage);
 }