示例#1
0
        public override void Register()
        {
            instance = this;

            AddEventHandlers(new EventHandler());

            Timing.Init(this);

            AddConfig(new Smod2.Config.ConfigSetting("sh_spawn_chance", 50, Smod2.Config.SettingType.NUMERIC, true, ""));
            AddConfig(new Smod2.Config.ConfigSetting("sh_entry_announcement", "serpents hand entered", Smod2.Config.SettingType.STRING, true, ""));
            AddConfig(new Smod2.Config.ConfigSetting("sh_spawn_items", new[]
            {
                20,
                26,
                12,
                14,
                10
            }, Smod2.Config.SettingType.NUMERIC_LIST, true, ""));
            AddConfig(new Smod2.Config.ConfigSetting("sh_ci_entry_announcement", "", Smod2.Config.SettingType.STRING, true, ""));
            AddConfig(new Smod2.Config.ConfigSetting("sh_friendly_fire", false, Smod2.Config.SettingType.BOOL, true, ""));
            AddConfig(new Smod2.Config.ConfigSetting("sh_teleport_to_106", true, Smod2.Config.SettingType.BOOL, true, ""));
            AddConfig(new Smod2.Config.ConfigSetting("sh_ci_win_with_scp", false, Smod2.Config.SettingType.BOOL, true, ""));
            AddConfig(new Smod2.Config.ConfigSetting("sh_health", 120, Smod2.Config.SettingType.NUMERIC, true, ""));
            AddConfig(new Smod2.Config.ConfigSetting("sh_max_squad", 8, Smod2.Config.SettingType.NUMERIC, true, ""));
            AddConfig(new Smod2.Config.ConfigSetting("sh_team_respawn_delay", 1, Smod2.Config.SettingType.NUMERIC, true, ""));

            AddCommands(new string[] { "spawnsh" }, new SpawnCommand());
            AddCommands(new string[] { "spawnshsquad" }, new SpawnSquad());
        }
示例#2
0
        public void OnTeamRespawn(TeamRespawnEvent ev)
        {
            if (ev.SpawnChaos)
            {
                if (SHPlugin.rand.Next(1, 101) <= SHPlugin.spawnChance && ev.PlayerList.Count > 0 && respawnCount >= SHPlugin.teamRespawnDelay)
                {
                    List <Player> SHPlayers = new List <Player>();
                    List <Player> CIPlayers = ev.PlayerList;

                    for (int i = 0; i < SHPlugin.shMaxSquad && CIPlayers.Count > 0; i++)
                    {
                        Player player = CIPlayers[SHPlugin.rand.Next(CIPlayers.Count)];
                        SHPlayers.Add(player);
                        CIPlayers.Remove(player);
                    }

                    ev.PlayerList = SHPlayers;

                    Timing.InTicks(() =>
                    {
                        SHPlugin.SpawnSHSquad(ev.PlayerList);
                    }, 4);
                }
                else
                {
                    string ann = SHPlugin.ciAnnouncement;
                    if (ann != "")
                    {
                        PluginManager.Manager.Server.Map.AnnounceCustomMessage(ann);
                    }
                }
            }
            respawnCount++;
        }
        public string[] OnCall(ICommandSender sender, string[] args)
        {
            if (args.Length > 0)
            {
                string id      = "";
                Player cPlayer = SHPlugin.FindPlayer(args[0]);
                if (cPlayer != null)
                {
                    id = cPlayer.SteamId;
                }
                else if (ulong.TryParse(args[0], out ulong a))
                {
                    id = a.ToString();
                }
                else
                {
                    return(new string[] { "Error: invalid player id." });
                }

                Player tPlayer = SHPlugin.FindPlayer(id);
                if (tPlayer != null)
                {
                    SHPlugin.SpawnPlayer(tPlayer);
                    return(new string[] { "Spawned player \"" + tPlayer.Name + "\" as Serpent's Hand." });
                }
            }
            return(new string[] { GetUsage() });
        }
示例#4
0
 public void OnPocketDimensionExit(PlayerPocketDimensionExitEvent ev)
 {
     if (SHPlugin.shPlayers.Contains(ev.Player.SteamId))
     {
         if (SHPlugin.teleportTo106)
         {
             SHPlugin.TeleportTo106(ev.Player);
         }
         SHPlugin.shPlayersInPocket.Remove(ev.Player.SteamId);
     }
 }
示例#5
0
 public void OnPocketDimensionDie(PlayerPocketDimensionDieEvent ev)
 {
     if (SHPlugin.shPlayers.Contains(ev.Player.SteamId))
     {
         if (!SHPlugin.friendlyFire)
         {
             ev.Die = false;
         }
         if (SHPlugin.teleportTo106)
         {
             SHPlugin.TeleportTo106(ev.Player);
         }
         SHPlugin.shPlayersInPocket.Remove(ev.Player.SteamId);
     }
 }
示例#6
0
 public string[] OnCall(ICommandSender sender, string[] args)
 {
     if (args.Length > 0)
     {
         if (int.TryParse(args[0], out int a))
         {
             SHPlugin.SpawnSquad(a);
         }
         else
         {
             return(new string[] { "Error: invalid size." });
         }
     }
     else
     {
         SHPlugin.SpawnSquad(5);
     }
     PluginManager.Manager.Server.Map.AnnounceCustomMessage(SHPlugin.shAnnouncement);
     return(new string[] { "Spawned squad." });
 }
示例#7
0
        public void OnCheckRoundEnd(CheckRoundEndEvent ev)
        {
            if (refreshPlayers)
            {
                refreshPlayers = false;

                string[] curPlayers = PlayerManager.singleton.players
                                      .Select(x => x.GetComponent <CharacterClassManager>().SteamId).ToArray();
                SHPlugin.shPlayers.RemoveAll(x => !curPlayers.Contains(x));
            }

            bool MTFAlive        = SHPlugin.CountRoles(Smod2.API.Team.NINETAILFOX) > 0;
            bool CiAlive         = SHPlugin.CountRoles(Smod2.API.Team.CHAOS_INSURGENCY) > 0;
            bool ScpAlive        = SHPlugin.CountRoles(Smod2.API.Team.SCP) > 0;
            bool DClassAlive     = SHPlugin.CountRoles(Smod2.API.Team.CLASSD) > 0;
            bool ScientistsAlive = SHPlugin.CountRoles(Smod2.API.Team.SCIENTIST) > 0;
            bool SHAlive         = SHPlugin.shPlayers.Count > 0;

            if (MTFAlive && (CiAlive || ScpAlive || DClassAlive || SHAlive))
            {
                ev.Status = ROUND_END_STATUS.ON_GOING;
            }
            else if (CiAlive && (MTFAlive || (DClassAlive && ScpAlive) || ScientistsAlive || SHAlive))
            {
                ev.Status = ROUND_END_STATUS.ON_GOING;
            }
            else if (ScpAlive && (MTFAlive || DClassAlive || ScientistsAlive))
            {
                ev.Status = ROUND_END_STATUS.ON_GOING;
            }
            else if (SHAlive && ScpAlive && !MTFAlive && !CiAlive && !DClassAlive && !ScientistsAlive)
            {
                ev.Status = ROUND_END_STATUS.SCP_VICTORY;
            }
            else if (CiAlive && ScpAlive && !SHPlugin.ciWinWithSCP)
            {
                ev.Status = ROUND_END_STATUS.ON_GOING;
            }
        }