Esempio n. 1
0
        public bool Vote(TasSayEventArgs e, string[] words)
        {
            int vote;

            if (!RegisterVote(e, words, out vote))
            {
                AutoHost.Respond(tas, spring, e, "You must vote valid option");
                return(false);
            }

            int winVote;

            if (CheckEnd(out winVote))
            {
                if (winVote == 1)
                {
                    tas.Say(TasClient.SayPlace.Battle, "", "vote successful - kicking " + player, true);
                    tas.Kick(player);
                    spring.Kick(player);
                }
                else
                {
                    tas.Say(TasClient.SayPlace.Battle, "", "not enough votes, player stays", true);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        public bool Vote(TasSayEventArgs e, string[] words)
        {
            int vote;

            if (!RegisterVote(e, words, out vote))
            {
                AutoHost.Respond(tas, spring, e, "You must vote valid option");
                return(false);
            }

            int winVote;

            if (CheckEnd(out winVote))
            {
                if (winVote == 1)
                {
                    ah.SayBattle("vote successful - kicking " + player);
                    ah.ComKick(TasSayEventArgs.Default, new string[] { player });
                }
                else
                {
                    ah.SayBattle("not enough votes, player stays");
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
        public bool Vote(TasSayEventArgs e, string[] words)
        {
            int vote;

            if (!RegisterVote(e, words, out vote))
            {
                AutoHost.Respond(tas, spring, e, "You must vote valid option/not be a spectator");
                return(false);
            }

            int winVote;

            if (CheckEnd(out winVote))
            {
                if (winVote == 1)
                {
                    ah.SayBattle("vote successful - force exiting");
                    ah.ComExit(e, words);
                }
                else
                {
                    ah.SayBattle("not enough votes");
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 4
0
        public bool Vote(TasSayEventArgs e, string[] words)
        {
            int vote;

            if (!RegisterVote(e, words, out vote))
            {
                AutoHost.Respond(tas, spring, e, "You must vote valid option");
                return(false);
            }

            int winVote;

            if (CheckEnd(out winVote))
            {
                if (winVote == 1)
                {
                    tas.Say(TasClient.SayPlace.Battle, "", "vote successful - changing map to " + map, true);
                    tas.ChangeMap(map);
                }
                else
                {
                    tas.Say(TasClient.SayPlace.Battle, "", "not enough votes, map stays", true);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 5
0
        public bool Vote(TasSayEventArgs e, string[] words)
        {
            int vote;

            if (!RegisterVote(e, words, out vote))
            {
                AutoHost.Respond(tas, spring, e, "You must vote valid option");
                return(false);
            }

            int winVote;

            if (CheckEnd(out winVote))
            {
                if (winVote == 1)
                {
                    ah.SayBattle("vote successful - appling preset " + presetName);
                    ah.presets[presetId].Apply(tas);
                }
                else
                {
                    ah.SayBattle("not enough votes for preset");
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 6
0
        public bool Vote(TasSayEventArgs e, string[] words)
        {
            int vote;

            if (!RegisterVote(e, words, out vote))
            {
                AutoHost.Respond(tas, spring, e, "You must vote valid option");
                return(false);
            }

            int winVote;

            if (CheckEnd(out winVote))
            {
                if (winVote == 1)
                {
                    tas.Say(TasClient.SayPlace.Battle, "", "vote successful - force exiting", true);
                    ah.ComExit(e, words);
                }
                else
                {
                    tas.Say(TasClient.SayPlace.Battle, "", "not enough votes", true);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 7
0
        public bool Vote(TasSayEventArgs e, string[] words)
        {
            int vote;

            if (!RegisterVote(e, words, out vote))
            {
                AutoHost.Respond(tas, spring, e, "You must vote valid option");
                return(false);
            }

            int winVote;

            if (CheckEnd(out winVote))
            {
                if (winVote == 1)
                {
                    ah.SayBattle("vote successful - changing map to " + map);
                    tas.ChangeMap(spring.UnitSync.MapList[map]);
                }
                else
                {
                    ah.SayBattle("not enough votes, map stays");
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 8
0
        public bool Vote(TasSayEventArgs e, string[] words)
        {
            int vote;

            if (!RegisterVote(e, words, out vote))
            {
                AutoHost.Respond(tas, spring, e, "You must vote valid option");
                return(false);
            }

            int winVote;

            if (CheckEnd(out winVote))
            {
                if (winVote == 1)
                {
                    ah.SayBattle("vote successful");
                    ah.ComKickSpec(e, new string[] { stateAfter ? "1" : "0" });
                }
                else
                {
                    ah.SayBattle("not enough votes to " + (stateAfter ? "ENABLE" : "DISABLE") + " kickspec");
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 9
0
        public bool Init(TasSayEventArgs e, string[] words)
        {
            if (words.Length == 0)
            {
                if (ah.TempAdminName == "")
                {
                    ah.Respond(e, "there is currently no temp admin to remove");
                    return(false);
                }
                else
                {
                    player = "";
                    ah.SayBattle("Do you want to remove current tempadmin " + ah.TempAdminName + "? !vote 1 = yes, !vote 2 = no");
                    return(true);
                }
            }

            string[] players;
            int[]    indexes;
            if (AutoHost.FilterUsers(words, tas, spring, out players, out indexes) > 0)
            {
                player = players[0];
                ah.SayBattle("Do you want to elect " + player + " for tempadmin? !vote 1 = yes, !vote 2 = no");
                return(true);
            }
            else
            {
                AutoHost.Respond(tas, spring, e, "Cannot find such player");
                return(false);
            }
        }
Esempio n. 10
0
 public bool Init(TasSayEventArgs e, string[] words)
 {
     if (words.Length == 0)
     {
         tas.Say(TasClient.SayPlace.Battle, "", "Do you want to rehost this game? !vote 1 = yes, !vote 2 = no", true);
         spring.SayGame("vote to rehost this game started in lobby");
         return(true);
     }
     else
     {
         string[] mods;
         int[]    indexes;
         if (AutoHost.FilterMods(words, tas, spring, out mods, out indexes) == 0)
         {
             AutoHost.Respond(tas, spring, e, "cannot find such mod");
             return(false);
         }
         else
         {
             modname = mods[0];
             tas.Say(TasClient.SayPlace.Battle, "", "Do you want to rehost this game to " + modname + "? !vote 1 = yes, !vote 2 = no", true);
             spring.SayGame("vote to rehost this game started in lobby");
             return(true);
         }
     }
 }
Esempio n. 11
0
        public bool Vote(TasSayEventArgs e, string[] words)
        {
            int vote;

            if (!RegisterVote(e, words, out vote))
            {
                AutoHost.Respond(tas, spring, e, "You must vote valid option");
                return(false);
            }

            int winVote;

            if (CheckEnd(out winVote))
            {
                if (winVote == 1)
                {
                    ah.SayBattle("vote successful - rehosting");

                    ah.ComRehost(e, new string[] { modname });
                }
                else
                {
                    ah.SayBattle("not enough votes");
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 12
0
        public void ComBan(TasSayEventArgs e, string[] words)
        {
            if (words.Length == 0)
            {
                ah.Respond(e, "this command needs at least 1 argument - exact user name");
                return;
            }

            int duration = 0;

            if (words.Length > 1)
            {
                if (!int.TryParse(words[1], out duration))
                {
                    ah.Respond(e, "second argument must be a number - ban time in minutes or 0 - forever");
                    return;
                }
            }

            if (IsBanned(words[0]))
            {
                ah.Respond(e, "this user is already banned");
                return;
            }

            if (duration < 0)
            {
                duration = 0;
            }
            TimeSpan dur;

            if (duration == 0)
            {
                dur = TimeSpan.FromDays(365 * 1000);
            }
            else
            {
                dur = TimeSpan.FromMinutes(duration);
            }

            BannedUser b = new BannedUser(words[0]);

            b.Duration = dur;
            b.Reason   = Utils.Glue(words, 2);

            Battle           battle = tas.GetBattle();
            UserBattleStatus ubs;

            if (battle.ContainsUser(b.Name, out ubs))
            {
                if (ubs.ip != IPAddress.None)
                {
                    b.ipAddresses.Add(ubs.ip.ToString());
                }
            }
            Items.Add(b);
            tas.Say(TasClient.SayPlace.Battle, "", b.Name + " banned - " + b.Reason, true);
            tas.Kick(b.Name);
            Save();
        }
Esempio n. 13
0
 public bool Init(TasSayEventArgs e, string[] words)
 {
     if (spring.IsRunning)
     {
         ah.SayBattle("Do you want to exit this game? !vote 1 = yes, !vote 2 = no");
         return(true);
     }
     else
     {
         AutoHost.Respond(tas, spring, e, "game not running");
         return(false);
     }
 }
Esempio n. 14
0
 public bool Init(TasSayEventArgs e, string[] words)
 {
     if (!spring.IsRunning)
     {
         ah.SayBattle("Do you want to force start game? !vote 1 = yes, !vote 2 = no");
         return(true);
     }
     else
     {
         AutoHost.Respond(tas, spring, e, "battle already started");
         return(false);
     }
 }
Esempio n. 15
0
 public bool Init(TasSayEventArgs e, string[] words)
 {
     if (spring.IsRunning)
     {
         tas.Say(TasClient.SayPlace.Battle, "", "Do you want to exit this game? !vote 1 = yes, !vote 2 = no", true);
         spring.SayGame("vote to exit this game started in lobby");
         return(true);
     }
     else
     {
         AutoHost.Respond(tas, spring, e, "game not running");
         return(false);
     }
 }
Esempio n. 16
0
        bool IVotable.Init(TasSayEventArgs e, string[] words)
        {
            if (words.Length == 0)
            {
                AutoHost.Respond(tas, spring, e, "You must specify map name");
                return(false);
            }

            string[] vals;
            int[]    indexes;
            if (AutoHost.FilterMaps(words, tas, spring, out vals, out indexes) > 0)
            {
                map = vals[0];
                ah.SayBattle("Do you want to change map to " + map + "? !vote 1 = yes, !vote 2 = no");
                return(true);
            }
            else
            {
                AutoHost.Respond(tas, spring, e, "Cannot find such map");
                return(false);
            }
        }
Esempio n. 17
0
        public bool Init(TasSayEventArgs e, string[] words)
        {
            if (words.Length == 0)
            {
                AutoHost.Respond(tas, spring, e, "You must specify player name");
                return(false);
            }

            string[] players;
            int[]    indexes;
            if (AutoHost.FilterUsers(words, tas, spring, out players, out indexes) > 0)
            {
                player = players[0];
                ah.SayBattle("Do you want to kick " + player + "? !vote 1 = yes, !vote 2 = no");
                return(true);
            }
            else
            {
                AutoHost.Respond(tas, spring, e, "Cannot find such player");
                return(false);
            }
        }
Esempio n. 18
0
        public bool Init(TasSayEventArgs e, string[] words)
        {
            if (words.Length == 0)
            {
                AutoHost.Respond(tas, spring, e, "You must specify preset name");
                return(false);
            }

            string[] vals;
            int[]    indexes;
            if (AutoHost.FilterPresets(words, ah, out vals, out indexes) > 0)
            {
                presetId   = indexes[0];
                presetName = vals[0];
                ah.SayBattle("Do you want to apply preset " + presetName + "? !vote 1 = yes, !vote 2 = no");
                return(true);
            }
            else
            {
                AutoHost.Respond(tas, spring, e, "cannot find such preset");
                return(false);
            }
        }
Esempio n. 19
0
        public bool Vote(TasSayEventArgs e, string[] words)
        {
            int vote;

            if (!RegisterVote(e, words, out vote))
            {
                AutoHost.Respond(tas, spring, e, "You must vote valid option");
                return(false);
            }

            int winVote;

            if (CheckEnd(out winVote))
            {
                if (winVote == 1)
                {
                    if (player == "")
                    {
                        ah.SayBattle("vote successful - tempadmin removed");
                    }
                    else
                    {
                        ah.SayBattle("vote successful - new tempadmin is " + player);
                    }
                    ah.TempAdminName = player;
                }
                else
                {
                    ah.SayBattle("not enough votes");
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 20
0
 public bool Init(TasSayEventArgs e, string[] words)
 {
     if (words.Length == 0)
     {
         ah.SayBattle("Do you want to rehost this game? !vote 1 = yes, !vote 2 = no");
         return(true);
     }
     else
     {
         string[] mods;
         int[]    indexes;
         if (AutoHost.FilterMods(words, tas, spring, out mods, out indexes) == 0)
         {
             AutoHost.Respond(tas, spring, e, "cannot find such mod");
             return(false);
         }
         else
         {
             modname = mods[0];
             ah.SayBattle("Do you want to rehost this game to " + modname + "? !vote 1 = yes, !vote 2 = no");
             return(true);
         }
     }
 }