Esempio n. 1
0
 public void OnPocketDimensionExit(EscapingPocketDimensionEventArgs ev)
 {
     if (shPlayers.Contains(ev.Player.Id))
     {
         ev.IsAllowed = false;
         if (SerpentsHand.instance.Config.TeleportTo106)
         {
             TeleportTo106(ev.Player);
         }
         shPocketPlayers.Remove(ev.Player.Id);
     }
 }
Esempio n. 2
0
        public void OnPocketEscape(EscapingPocketDimensionEventArgs ev)
        {
            foreach (Player player in Player.List)
            {
                if (Round.IsStarted && PlayerXP.instance.Config.Scp106PocketScape > 0)
                {
                    int xp = CalcXP(ev.Player, PlayerXP.instance.Config.Scp106PocketScape);

                    AddXP(ev.Player.UserId, xp, PlayerXP.instance.Config.Scp106PocketScapeMsg.Replace("{xp}", xp.ToString()));

                    SendHint(ev.Player, PlayerXP.instance.Config.Scp106PocketScapeMsg.Replace("{xp}", xp.ToString()));
                }
            }
        }
Esempio n. 3
0
        internal void EscapingPocketDimension(EscapingPocketDimensionEventArgs ev)
        {
            if (Plugin.Instance.Config.EscapingPocketDimension == "")
            {
                return;
            }
            string message = Plugin.Instance.Config.EscapingPocketDimension.Replace("%player%", ev.Player.ToString());


            if (Plugin.Instance.Config.debug_to_console)
            {
                Log.Debug(message: "[ " + Plugin.Instance.Config.player_name + "] " + message);
            }
            Plugin.sendWebHook(Plugin.Instance.Config.player_url, message, Plugin.Instance.Config.player_name);
        }
Esempio n. 4
0
        public async void OnPocketDimensionEscape(EscapingPocketDimensionEventArgs ev)
        {
            var player       = ev.Player;
            var currentTime  = DateTime.UtcNow;
            var initialTime  = _pocketDimensionTime[player.Id];
            var relativeTime = TimeUtils.ToRelativeTimeFuture(initialTime, currentTime);

            StringBuilder builder = new StringBuilder();

            builder.AppendLine("**Player escaped the pocket dimension**");
            builder.AppendLine($"Name: {player.Nickname} ({player.UserId})");
            builder.AppendLine($"Escaped {relativeTime}");

            _pocketDimensionTime.Remove(player.Id);

            await _privateWebhook.ExecuteWebhook(
                builder.ToString(),
                "SCP-Bot",
                false
                );
        }
Esempio n. 5
0
 /// <summary>
 /// Invoked before escaping the pocket dimension.
 /// </summary>
 /// <param name="ev">The <see cref="EscapingPocketDimensionEventArgs"/> instance.</param>
 public static void OnEscapingPocketDimension(EscapingPocketDimensionEventArgs ev) => EscapingPocketDimension.InvokeSafely(ev);
Esempio n. 6
0
 /// <inheritdoc cref="Exiled.Events.Handlers.Player.OnEscapingPocketDimension(EscapingPocketDimensionEventArgs)"/>
 public void OnEscapingPocketDimension(EscapingPocketDimensionEventArgs ev)
 {
     Log.Info($"{ev.Player.Nickname} is escaping from the pocket dimension and will be teleported at {ev.TeleportPosition}");
 }
Esempio n. 7
0
        private static bool Prefix(PocketDimensionTeleport __instance, Collider other)
        {
            try
            {
                NetworkIdentity component1 = other.GetComponent <NetworkIdentity>();
                if (!(component1 != null))
                {
                    return(false);
                }
                if (__instance.type == PocketDimensionTeleport.PDTeleportType.Killer || BlastDoor.OneDoor.isClosed)
                {
                    if (__instance.type == PocketDimensionTeleport.PDTeleportType.Killer)
                    {
                        var ev = new FailingEscapePocketDimensionEventArgs(API.Features.Player.Get(other.gameObject), __instance);

                        Player.OnFailingEscapePocketDimension(ev);

                        if (!ev.IsAllowed)
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        // warhead larry event goes here
                    }

                    component1.GetComponent <PlayerStats>()
                    .HurtPlayer(new PlayerStats.HitInfo(999990f, "WORLD", DamageTypes.Pocket, 0), other.gameObject);
                }
                else if (__instance.type == PocketDimensionTeleport.PDTeleportType.Exit)
                {
                    __instance.tpPositions.Clear();
                    bool flag = false;
                    DecontaminationController.DecontaminationPhase[] decontaminationPhases =
                        DecontaminationController.Singleton.DecontaminationPhases;
                    if (DecontaminationController.GetServerTime >
                        decontaminationPhases[decontaminationPhases.Length - 2].TimeTrigger)
                    {
                        flag = true;
                    }
                    List <string> stringList =
                        ConfigFile.ServerConfig.GetStringList(flag
                            ? "pd_random_exit_rids_after_decontamination"
                            : "pd_random_exit_rids");
                    if (stringList.Count > 0)
                    {
                        foreach (GameObject gameObject in GameObject.FindGameObjectsWithTag("RoomID"))
                        {
                            if (gameObject.GetComponent <Rid>() != null &&
                                stringList.Contains(gameObject.GetComponent <Rid>().id))
                            {
                                __instance.tpPositions.Add(gameObject.transform.position);
                            }
                        }

                        if (stringList.Contains("PORTAL"))
                        {
                            foreach (Scp106PlayerScript scp106PlayerScript in Object
                                     .FindObjectsOfType <Scp106PlayerScript>())
                            {
                                if (scp106PlayerScript.portalPosition != Vector3.zero)
                                {
                                    __instance.tpPositions.Add(scp106PlayerScript.portalPosition);
                                }
                            }
                        }
                    }

                    if (__instance.tpPositions == null || __instance.tpPositions.Count == 0)
                    {
                        foreach (GameObject gameObject in GameObject.FindGameObjectsWithTag("PD_EXIT"))
                        {
                            __instance.tpPositions.Add(gameObject.transform.position);
                        }
                    }

                    Vector3 tpPosition = __instance.tpPositions[Random.Range(0, __instance.tpPositions.Count)];
                    tpPosition.y += 2f;
                    PlayerMovementSync component2 = other.GetComponent <PlayerMovementSync>();
                    component2.SetSafeTime(2f);

                    var ev = new EscapingPocketDimensionEventArgs(API.Features.Player.Get(component2.gameObject), tpPosition);

                    Player.OnEscapingPocketDimension(ev);

                    if (ev.IsAllowed)
                    {
                        component2.OverridePosition(tpPosition, 0.0f, false);
                        __instance.RemoveCorrosionEffect(other.gameObject);
                        PlayerManager.localPlayer.GetComponent <PlayerStats>()
                        .TargetAchieve(component1.connectionToClient, "larryisyourfriend");
                    }

                    component2.OverridePosition(tpPosition, 0.0f, false);
                    __instance.RemoveCorrosionEffect(other.gameObject);
                    PlayerManager.localPlayer.GetComponent <PlayerStats>()
                    .TargetAchieve(component1.connectionToClient, "larryisyourfriend");
                }

                if (!__instance.RefreshExit)
                {
                    return(false);
                }
                ImageGenerator.pocketDimensionGenerator.GenerateRandom();
                return(false);
            }
            catch (Exception e)
            {
                Exiled.API.Features.Log.Error($"Exiled.Events.Patches.Events.Player.EscapingAndFailingEscapePocketDimension: {e}\n{e.StackTrace}");

                return(true);
            }
        }
Esempio n. 8
0
 public void OnEscapingPocketDimension(EscapingPocketDimensionEventArgs ev)
 {
     CheckForEvent("OnEscapingPocketDimension", true, false, ev.Player);
 }