Ejemplo n.º 1
0
        public static void RefNextTeamSpawn(Respawning.SpawnableTeamType spawnableTeamType)
        {
            Log.Debug("Getting Team Referances", Instance.Config.Debug);
            Log.Debug($"Spawning on side {spawnableTeamType}", Instance.Config.Debug);
            var list = Instance.Config.Teams.Where(x => x.SpawnTypes.Contains(spawnableTeamType) && x.Active == true).ToList();

            if (list.Count == 0)
            {
                Instance.EventHandlers.HasReference = true;
                return;
            }

            var team    = list[Rand.Next(0, list.Count)];
            var handler = new TeamEvents.ReferencingTeamEventArgs(team, spawnableTeamType);

            handler.StartInvoke();
        }
Ejemplo n.º 2
0
        public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response)
        {
            if (sender.CheckPermission("ATC.forcenextteam"))
            {
                if (arguments.Count == 0)
                {
                    response = "<color=red>You need to add the name of the team.</color>\nUsage: fnt teamname";
                    return(false);
                }

                if (!AdvancedTeam.TryGet(arguments.At(0), out AdvancedTeam team))
                {
                    response = "<color=red>The name of the team isn't valid.</color> Teams:";
                    foreach (var tm in Instance.Config.Teams)
                    {
                        if (tm.Active)
                        {
                            response += "\n" + tm.Name;
                        }
                    }

                    return(false);
                }

                if (!team.Active)
                {
                    response = "<color=red>The team isn't active</color>";
                    return(false);
                }

                var handler = new TeamEvents.ReferencingTeamEventArgs(team, team.SpawnTypes.FirstOrDefault())
                {
                    ForceTeam = true
                };
                handler.StartInvoke();

                response = $"<color=green> Done, {arguments.At(0)} team forced</color>";
                return(true);
            }

            response = Instance.Translation.NoPermissions;
            return(false);
        }
Ejemplo n.º 3
0
        // Not in use
        public static void RefNextTeamSpawn()
        {
            Log.Debug("Getting Team Referances", Instance.Config.Debug);
            var list = Instance.Config.Teams.Where(x => x.SpawnTypes.Contains(Respawn.NextKnownTeam) && x.Active == true).ToList();

            if (list.Count == 0)
            {
                Instance.EventHandlers.HasReference = true;
                return;
            }

            Log.Debug("Got list", Instance.Config.Debug);
            var team = list[Rand.Next(0, list.Count)];

            Log.Debug("Got team", Instance.Config.Debug);
            var handler = new TeamEvents.ReferencingTeamEventArgs(team, Respawning.SpawnableTeamType.None);

            Log.Debug("Got Handler and invoking", Instance.Config.Debug);
            handler.StartInvoke();
        }