// this must be called on round start btw
 public static void InitializeStalky106()
 {
     Scp106PlayerScript.stalky106LastTick = 0f;
     Scp106PlayerScript.stalkyCd          = Time.time + ConfigFile.ModConfig.MattyMod.SCP106.InitCooldown;
     Scp106PlayerScript.disableFor        = Time.time + 12f;
     Timing.RunCoroutine(Scp106PlayerScript.StalkyCooldownAnnounce(ConfigFile.ModConfig.MattyMod.SCP106.InitCooldown), 1);
 }
    // Token: 0x0600122F RID: 4655
    private IEnumerator <float> StalkCoroutine(Broadcast bc)
    {
        List <GameObject> list = new List <GameObject>();

        foreach (GameObject gameObject in PlayerManager.players)
        {
            if (gameObject.GetComponent <CharacterClassManager>().CurClass != RoleType.ChaosInsurgency && gameObject.GetComponent <CharacterClassManager>().CurClass != RoleType.Spectator && gameObject.GetComponent <CharacterClassManager>().CurClass != RoleType.Tutorial && gameObject.GetComponent <CharacterClassManager>().IsHuman())
            {
                list.Add(gameObject);
            }
        }
        if (list.Count < 1)
        {
            bc.TargetAddElement(base.connectionToClient, "No valid player found.", 4U, false);
            yield break;
        }
        Scp106PlayerScript.stalky106LastTick = Time.time;
        GameObject gameObject2;
        RaycastHit raycastHit;

        do
        {
            int index = UnityEngine.Random.Range(0, list.Count);
            gameObject2 = list[index];
            Physics.Raycast(new Ray(gameObject2.transform.position, -Vector3.up), out raycastHit, 10f, this.teleportPlacementMask);
            if (Vector3.Distance(gameObject2.transform.position, new Vector3(0f, -1998f, 0f)) < 40f)
            {
                gameObject2      = null;
                raycastHit.point = Vector3.zero;
            }
            list.RemoveAt(index);
        }while (raycastHit.point.Equals(Vector3.zero) && list.Count > 0);
        if (gameObject2 == null)
        {
            bc.TargetAddElement(base.connectionToClient, "No valid player found.", 4U, false);
            yield break;
        }
        if (raycastHit.point.Equals(Vector3.zero))
        {
            bc.TargetAddElement(base.connectionToClient, "An error has ocurred. Try it again in a few seconds.", 4U, false);
            yield break;
        }
        this.MovePortal(raycastHit.point - Vector3.up);
        Scp106PlayerScript.stalkyCd = Time.time + ConfigFile.ModConfig.MattyMod.SCP106.Cooldown;
        Timing.RunCoroutine(Scp106PlayerScript.StalkyCooldownAnnounce(ConfigFile.ModConfig.MattyMod.SCP106.Cooldown), 1);
        Scp106PlayerScript.stalky106LastTick = Time.time;
        Scp106PlayerScript.disableFor        = Time.time + 10f;
        string text = ConfigFile.ModConfig.MattyMod.SCP106.Messages.Stalk;

        text = text.Replace("\\n", Environment.NewLine);
        text = text.Replace("$time", ConfigFile.ModConfig.MattyMod.SCP106.Cooldown.ToString());
        text = text.Replace("$name", gameObject2.GetComponent <NicknameSync>().MyNick);
        text = text.Replace("$class", Scp106PlayerScript.parser[(int)gameObject2.GetComponent <CharacterClassManager>().CurClass]);
        bc.TargetAddElement(base.connectionToClient, text, 5U, false);
        yield break;
    }