Пример #1
0
        void HandleOwner(Player p, string[] args)
        {
            Team team = p.Game.Team;

            if (team == null)
            {
                p.Message("You need to be in a team first."); return;
            }

            if (args.Length == 1)
            {
                p.Message("The current owner of the team is: " + team.Owner); return;
            }

            Player who = PlayerInfo.FindMatches(p, args[1]);

            if (who == null)
            {
                return;
            }

            if (!p.name.CaselessEq(team.Owner))
            {
                p.Message("Only the team owner can set a new team owner."); return;
            }
            team.Owner = who.name;
            team.Action(p, "set the team owner to " + who.ColoredName);
            Team.SaveList();
        }
Пример #2
0
        void HandleJoin(Player p, string[] args)
        {
            Team team = p.Game.Team;

            if (p.Game.TeamInvite == null)
            {
                p.Message("You do not currently have any invitation to join a team."); return;
            }
            if (team != null)
            {
                p.Message("You need to leave your current team before you can join another one."); return;
            }

            team = Team.Find(p.Game.TeamInvite);
            if (team == null)
            {
                p.Message("The team you were invited to no longer exists."); return;
            }
            team.Members.Add(p.name);
            team.Action(p, "joined the team.");
            p.Game.Team       = team;
            p.Game.TeamInvite = null;
            p.SetPrefix();
            Team.SaveList();
        }
Пример #3
0
        void HandleColor(Player p, string[] args)
        {
            Team team = p.Game.Team;

            if (team == null)
            {
                p.Message("You need to be in a team first."); return;
            }
            if (args.Length == 1)
            {
                p.Message("You need to provide the new color."); return;
            }

            string color = Matcher.FindColor(p, args[1]);

            if (color == null)
            {
                return;
            }

            team.Color = color;
            team.Action(p, "changed the team color to: " + args[1]);
            team.UpdatePrefix();
            Team.SaveList();
        }
Пример #4
0
        void HandleKick(Player p, string[] args)
        {
            Team team = p.Game.Team;

            if (team == null)
            {
                p.Message("You need to be in a team first."); return;
            }
            if (args.Length == 1)
            {
                p.Message("You need to provide the name of the player to kick."); return;
            }
            if (!p.name.CaselessEq(team.Owner))
            {
                p.Message("Only the team owner can kick players from the team."); return;
            }

            if (team.Remove(args[1]))
            {
                team.Action(p, "kicked " + args[1] + " from the team.");
                Player who = PlayerInfo.FindExact(args[1]);
                if (who != null)
                {
                    who.Game.Team = null;
                    who.SetPrefix();
                }

                team.DeleteIfEmpty();
                Team.SaveList();
            }
            else
            {
                p.Message("The given player was not found. You need to use their full account name.");
            }
        }
Пример #5
0
        void HandleLeave(Player p, string[] args)
        {
            Team team = p.Game.Team;

            if (team == null)
            {
                Player.SendMessage(p, "You need to be in a team first to leave one."); return;
            }

            team.Action(p, "left the team.");
            team.Remove(p.name);
            p.Game.Team = null;
            p.SetPrefix();
            Team.SaveList();
        }
Пример #6
0
        void HandleLeave(Player p, string[] args)
        {
            Team team = p.Game.Team;

            if (team == null)
            {
                p.Message("You need to be in a team first to leave one."); return;
            }

            // handle '/team leave me alone', for example
            if (args.Length > 1)
            {
                team.Message(p, args.Join(" ")); return;
            }

            team.Action(p, "left the team.");
            team.Remove(p.name);
            p.Game.Team = null;

            team.DeleteIfEmpty();
            p.SetPrefix();
            Team.SaveList();
        }
Пример #7
0
        void HandleOwner(Player p, string[] args)
        {
            Team team = p.Game.Team;

            if (team == null)
            {
                Player.SendMessage(p, "You need to be in a team first."); return;
            }

            if (args.Length == 1)
            {
                Player.SendMessage(p, "The current owner of the team is: " + team.Owner); return;
            }

            Player who = PlayerInfo.FindOrShowMatches(p, args[1]);

            if (who == null)
            {
                return;
            }
            team.Owner = who.name;
            team.Action(who, "set the team owner to " + who.ColoredName);
            Team.SaveList();
        }
Пример #8
0
        void HandleColor(Player p, string[] args)
        {
            Team team = p.Game.Team;

            if (team == null)
            {
                Player.SendMessage(p, "You need to be in a team first."); return;
            }
            if (args.Length == 1)
            {
                Player.SendMessage(p, "You need to provide the new color."); return;
            }

            string color = Colors.Parse(args[1]);

            if (color == "")
            {
                Player.SendMessage(p, "\"" + color + "\" is not a valid color."); return;
            }
            team.Color = color;
            team.Action(p, "changed the team color to: " + args[1]);
            team.UpdatePrefix();
            Team.SaveList();
        }