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 - kicking " + player); ah.ComKick(TasSayEventArgs.Default, new string[] { player }); } else { ah.SayBattle("not enough votes, player stays"); } return(true); } else { return(false); } }
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 - changing map to " + map); tas.ChangeMap(spring.UnitSync.MapList[map]); } else { ah.SayBattle("not enough votes, map stays"); } return(true); } else { return(false); } }
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 - appling preset " + presetName); ah.presets[presetId].Apply(tas, ah.ladder); } else { ah.SayBattle("not enough votes for preset"); } return(true); } else { return(false); } }
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"); ah.ComKickSpec(e, new string[] { stateAfter ? "1" : "0" }); } else { ah.SayBattle("not enough votes to " + (stateAfter ? "ENABLE" : "DISABLE") + " kickspec"); } return(true); } else { return(false); } }
public bool Init(TasSayEventArgs e, string[] words) { if (words.Length == 0) { if (ah.BossName == "") { ah.Respond(e, "there is currently no boss to remove"); return(false); } else { player = ""; ah.SayBattle("Do you want to remove current boss " + ah.BossName + "? !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 the boss? !vote 1 = yes, !vote 2 = no"); return(true); } else { AutoHost.Respond(tas, spring, e, "Cannot find such player"); return(false); } }
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 - appling options " + wordFormat); tas.SetScriptTag(scriptTagsFormat); } else { ah.SayBattle("not enough votes for setoptions"); } return(true); } else { return(false); } }
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 - rehosting"); ah.ComRehost(e, new string[] { modname }); } else { ah.SayBattle("not enough votes"); } return(true); } else { return(false); } }
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"); // only smallest ally team can vote var b = tas.GetBattle(); var grouping = b.Users.Where(u => !u.IsSpectator).GroupBy(u => u.AllyNumber).OrderBy(g => g.Count()).ToList(); if (grouping.Count() == 2) { allowedAlly = grouping[0].Key; initialUserCount = grouping[0].Count(); } else { allowedAlly = -1; } return(true); } else { AutoHost.Respond(tas, spring, e, "battle already started"); return(false); } }
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); } var b = new BannedUser(words[0]); b.Duration = dur; b.Reason = Utils.Glue(words, 2); var 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(); }
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); } }
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); } }
public bool Vote(TasSayEventArgs e, string[] words) { int vote; var pw = Program.main.PlanetWars; if (e.UserName != "") { // this is needed due to "timeout" hackthing with vote var info = pw.GetPlayerInfo(e.UserName); if (info == null || info.FactionName != faction) { AutoHost.Respond(tas, spring, e, string.Format("{0}, it's not your faction's turn", e.UserName)); return(false); } 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 - changing planet to " + planet); var sel = pw.GetAttackOptions().Find((p) => p.Name == planet); tas.ChangeMap(spring.UnitSync.MapList[sel.MapName]); } else { ah.SayBattle("not enough votes, planet stays"); } return(true); } else { return(false); } }
public bool Vote(TasSayEventArgs e, string[] words) { int vote; if (allowedAlly != -1) { int ally = tas.GetBattle().Users.Where(u => u.name == e.UserName && !u.IsSpectator).Select(u => u.AllyNumber).SingleOrDefault(); if (ally != allowedAlly) { AutoHost.Respond(tas, spring, e, "Only smaller team can vote"); return(false); } } 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 starting"); ah.ComForceStart(e, words); } else { ah.SayBattle("not enough votes"); } return(true); } else { return(false); } }
bool IVotable.Init(TasSayEventArgs e, string[] words) { if (words.Length == 0) { AutoHost.Respond(tas, spring, e, "You must specify planet name"); return(false); } string[] vals; int[] indexes; if (ah.FilterPlanets(words, out vals, out indexes) > 0) { planet = vals[0]; ah.SayBattle(string.Format("Do you want to change planet to {0}? !vote 1 = yes, !vote 2 = no", planet)); return(true); } else { AutoHost.Respond(tas, spring, e, "Cannot find such planet"); return(false); } }
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 (ah.FilterMaps(words, 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); } }
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); } }
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); } }
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) { if (player == "") { ah.SayBattle("vote successful - boss removed"); } else { ah.SayBattle("vote successful - new boss is " + player); } ah.BossName = player; } else { ah.SayBattle("not enough votes"); } return(true); } else { return(false); } }
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); } } }