private void PrintMessageToPlayerList(string _message) { foreach (ulong sID in playerIDSendToList) { RocketChat.Say(RocketPlayer.FromCSteamID((CSteamID)sID), parentName + ": " + _message); } }
public void Execute(RocketPlayer caller, string[] command) { if (command.Length < 2) { RocketChat.Say(caller, "You did not specify a name or item IDs. Usage: /" + string.Format(Usage, Name)); return; } Unit u = (from Unit unit in Blitz.Instance.Configuration.Units where unit.Name.ToLower().Equals(command [0]) select unit).FirstOrDefault <Unit> (); if (u != null) { RocketChat.Say(caller, "A unit already exists with that name."); return; } List <UnitItem> loadout = new List <UnitItem> (); for (int i = 1; i < command.Length; i++) { loadout.Add(new UnitItem(UInt16.Parse(command [i]))); } Blitz.Instance.Configuration.Units.Add(new Unit(command [0], false, loadout)); Blitz.Instance.Configuration.Save(); RocketChat.Say(caller, "Successfully added new unit '" + command [0] + "'."); }
private void onPlayerConnect(RocketPlayer p) { PlayerData data = PlayerData.ForPlayer(p); if (data == null) { // The player does not have saved data. data = new PlayerData(p.CSteamID, ERank.PRIVATE, Unit.DefaultUnit); Logger.Log("Saving new data for player '" + p.SteamName + "'."); Logger.Log("\t> Rank: " + ERank.PRIVATE + "."); Logger.Log("\t> Unit: " + Unit.DefaultUnit.Name + "."); // Assign the player to the team with the least players. Team team1 = Blitz.Instance.Configuration.Teams[0]; Team team2 = Blitz.Instance.Configuration.Teams[1]; if (team1.Players.Count <= team2.Players.Count) { team1.AddPlayer(data); } else { team2.AddPlayer(data); } } else { // The player already has saved data. Logger.Log("Using existing saved data for player '" + p.SteamName + "'."); } RocketChat.Say(string.Format("{0} {1} joined.", data.Rank, p.SteamName)); }
// Events private void RocketServerEvents_OnPlayerConnected(RocketPlayer player) { if (player.IsAdmin || player.Permissions.Contains("jail.immune")) { return; } if (players.ContainsKey(player.ToString())) { if (Configuration.BanOnReconnect) { removePlayerFromJail(player, players[player.ToString()]); players.Remove(player.ToString()); if (Configuration.BanOnReconnectTime > 0) { player.Ban(JailTime.Instance.Translate("jailtime_ban_time", Configuration.BanOnReconnectTime), Configuration.BanOnReconnectTime); } else { player.Ban(JailTime.Instance.Translate("jailtime_ban"), Configuration.BanOnReconnectTime); } } else { if (!(players[player.ToString()].End <= DateTime.Now)) { movePlayerToJail(player, players[player.ToString()].Cell); RocketChat.Say(player, JailTime.Instance.Translate("jailtime_player_back_msg")); } } } }
public void Execute(RocketPlayer caller, string[] command) { System.Random rand = new System.Random(); int bombsCount = 0; Timer tmr = new Timer(500 * rand.Next(1, 6) + 200); Vector3 initialPosition = caller.Position; tmr.Elapsed += delegate { tmr.Interval = 500 * rand.Next(1, 6) + 200; bombsCount++; if (bombsCount > 10) { tmr.Stop(); } Vector3 explosionPosition = new Vector3( initialPosition.x + rand.Next(-25, 25), initialPosition.y + rand.Next(2, 10), initialPosition.z + rand.Next(-25, 25) ); // The below code is taken from the SDG method 'Grenade#Explode'. DamageTool.explode(explosionPosition, 10, EDeathCause.GRENADE, 200, 200, 200, 200, 200, 1000); EffectManager.sendEffect(34, EffectManager.r, explosionPosition); }; tmr.Start(); RocketChat.Say(caller, "You are being bombarded by the enemy!"); }
internal void removePlayer(RocketPlayer caller, string playerName) { RocketPlayer target; try { target = RocketPlayer.FromCSteamID(new CSteamID(Convert.ToUInt64(playerName))); } catch { target = RocketPlayer.FromName(playerName); } if (target != null && players.ContainsKey(target.ToString())) { removePlayerFromJail(target, players[target.ToString()]); RocketChat.Say(target, JailTime.Instance.Translate("jailtime_player_release_msg")); if (caller != null) { RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_player_released", target.CharacterName)); } players.Remove(target.ToString()); } else { if (caller != null) { RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_player_notfound", playerName)); } return; } }
internal void listPlayers(RocketPlayer caller) { if (players.Count == 0) { RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_player_list_clear")); return; } else { string playersString = ""; foreach (KeyValuePair <string, Sentence> player in players) { try { playersString += RocketPlayer.FromName(player.Key).CharacterName + " (" + player.Value.Cell.Name + "), "; } catch { } } if (playersString != "") { playersString = playersString.Remove(playersString.Length - 2) + "."; } RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_player_list", playersString)); return; } }
private void GivePlayerKit(RocketPlayer _player, string _kit, bool _adminGive) { foreach (Kit kit in this.Configuration.Kits) //Loop through kits and see if kit with name exists. { if (kit.Name.ToLower().Equals(_kit.ToLower())) //Found a matching kit. { if (this.Configuration.randomProfessionMode && this.Configuration.professionChatMessages && _adminGive == false) { RocketChat.Say(_player, "You spawned as a " + _kit + "." + " " + kit.SpawnPercentChance + "% Chance."); } foreach (KitItem kitItem in kit.Items) //Loop through all items { if (!_player.GiveItem(kitItem.ItemId, kitItem.Amount)) { logHelper.LogMessage(LogHelper.MESSAGELEVEL_WARNING, "Failed to give player item!"); } } return; } else { } } logHelper.LogMessage(3, "Kit does not exist!"); }
internal void listJails(RocketPlayer caller) { if (cells.Count == 0) { RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_jail_notset")); return; } else { string jailsString = ""; foreach (KeyValuePair <string, Cell> jail in cells) { jailsString += jail.Value.Name + ", "; } if (jailsString != "") { jailsString = jailsString.Remove(jailsString.Length - 2) + "."; } RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_jail_list", jailsString)); return; } }
// Player Methods internal void addPlayer(RocketPlayer caller, string playerName, string jailName = "", uint jailTime = 0) { Cell jail; RocketPlayer target = RocketPlayer.FromName(playerName); if (jailTime == 0) { jailTime = Configuration.JailTimeInSeconds; } if (target == null) { RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_player_notfound", jailName)); return; } else if (players.ContainsKey(target.ToString())) { RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_player_in_jail", target.CharacterName)); return; } else { if (target.IsAdmin || target.Permissions.Contains("jail.immune")) { RocketChat.Say(target, JailTime.Instance.Translate("jailtime_player_immune")); return; } else if (cells.Count == 0) { RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_jail_notset", jailName)); return; } else if (jailName == "") { jail = getRandomCell(); } else { jail = getCellbyName(jailName); } if (jail == null) { RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_jail_notfound", jailName)); return; } players.Add(target.ToString(), new Sentence(jail, jailTime, target.Position)); movePlayerToJail(target, jail); target.GiveItem(303, 1); target.GiveItem(304, 1); RocketChat.Say(target, JailTime.Instance.Translate("jailtime_player_arrest_msg", jailTime)); RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_player_arrested", target.CharacterName, jail.Name)); } }
public static void Respond(RocketPlayer caller, String message) { if (caller == null) { Logger.Log(message); } else { RocketChat.Say(caller, message); } }
internal void teleportToCell(RocketPlayer caller, string jailName) { if (!cells.ContainsKey(jailName.ToLower())) { RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_jail_notfound", jailName)); return; } else { caller.Teleport(cells[jailName.ToLower()].Location, caller.Rotation); } }
public void Execute(RocketPlayer caller, string[] command) { Vector3 playerLoc = caller.Position; Blitz.Instance.Configuration.Lobby.x = playerLoc.x; Blitz.Instance.Configuration.Lobby.y = playerLoc.y; Blitz.Instance.Configuration.Lobby.z = playerLoc.z; Blitz.Instance.Configuration.Save(); RocketChat.Say(caller, string.Format("Successfully set the lobby at {0}.", playerLoc)); }
internal void List(RocketPlayer caller) { if (!caller.IsAdmin && !caller.Permissions.Contains("givekit") && !caller.Permissions.Contains("givekit.*")) { RocketChat.Say(caller, GiveKit.Instance.Translate("command_givekit_no_permissions")); return; } List <string> kitLists = new List <string>(); String kits = ""; byte v = 0; foreach (Kit kit in GiveKit.Instance.Configuration.Kits) { if (caller.IsAdmin || caller.Permissions.Contains("givekit." + kit.Name.ToLower()) || caller.Permissions.Contains("givekit.*")) { if (v == 7) { if (kits != "") { kits = kits.Remove(kits.Length - 1); } kitLists.Add(kits); kits = ""; v = 0; } kits += ' ' + kit.Name + ','; v++; } } if (kits != "") { kits = kits.Remove(kits.Length - 1); } kitLists.Add(kits); if (caller.IsAdmin || caller.Permissions.Contains("givekit.share") || caller.Permissions.Contains("givekit.*")) { RocketChat.Say(caller, GiveKit.Instance.Translate("command_givekit_instructions_share")); } else { RocketChat.Say(caller, GiveKit.Instance.Translate("command_givekit_instructions")); } foreach (string kitString in kitLists) { RocketChat.Say(caller, GiveKit.Instance.Translate("command_givekit_available_kits", kitString)); } return; }
public void EndMatch() { this.State = MatchState.FINISHED; RocketChat.Say("Match over."); foreach (Team team in Blitz.Instance.Configuration.Teams) { foreach (PlayerData pd in team.Players) { pd.GetRocketPlayer().Teleport(Blitz.Instance.Configuration.Lobby.GetLocation(), 0); pd.GetRocketPlayer().Inventory.Clear(); } } }
private void RocketPlayerEvents_OnPlayerRevive(RocketPlayer player, Vector3 position, byte angle) { if (player.IsAdmin || player.Permissions.Contains("jail.immune")) { return; } if (players.ContainsKey(player.ToString())) { movePlayerToJail(player, players[player.ToString()].Cell); RocketChat.Say(player, JailTime.Instance.Translate("jailtime_player_back_msg")); } }
public void Execute(Rocket.Unturned.Player.RocketPlayer caller, string[] command) { DateTime currenttime = DateTime.Now; DateTime delaytime; //ushort id2 = ushort.Parse(command[0]); // TODO how does this differ from GetUInt16Parameter() ? ushort?id = RocketCommandExtensions.GetUInt16Parameter(command, 0); int? count = RocketCommandExtensions.GetInt32Parameter(command, 1); float? delay = RocketCommandExtensions.GetFloatParameter(command, 2); // if ((command.Length < 3 && caller == null) || (command.Length < 3 && caller.HasPermission("advancedeffect"))) if (command.Length < 3 && (caller.HasPermission("advancedeffect") || caller == null || caller.IsAdmin)) { RocketChat.Say(caller, "missing parameters! command usage: <id> <amount of times> <delay between effects>"); } else if (command.Length == 3 && (caller == null || caller.IsAdmin || caller.HasPermission("advancedeffect"))) { for (int ii = 1; ii <= count.Value; ii++) { delaytime = currenttime.AddMilliseconds(delay.Value); bool doloop = true; while (doloop) { continuelooping: currenttime = DateTime.Now; if (currenttime >= delaytime) { // caller.TriggerEffect(id.Value); Logger.Log("the time comparison worked!"); doloop = false; } else { goto continuelooping; } } } } else { if (caller == null) { Logger.Log("u dont have permission to use this command!"); } else { RocketChat.Say(caller, "u dont have permission to use this command!"); } } }
public void Execute(RocketPlayer caller, string[] command) { // If a unit was not specified, output a list of available units. if (command.Length == 0) { RocketChat.Say(caller, "You did not specify a unit."); RocketChat.Say(caller, "Units are: " + Unit.UnitList); return; } // If a unit name was entered, make sure it is valid. Unit unit = Unit.FromString(command [0], false); if (unit == null) { RocketChat.Say(caller, "Class not found."); return; } // Check the user's current unit. if (PlayerData.ForPlayer(caller).Unit.Equals(unit.Name)) { RocketChat.Say(caller, "You are already " + unit.Name); return; } else { RocketChat.Say(caller, "You have changed unit."); caller.Inventory.Clear(); } // Add them to their new unit. Team t = Team.ForPlayer(PlayerData.ForPlayer(caller)); PlayerData pd = (from PlayerData d in t.Players where d.SteamID64.Equals(caller.CSteamID.ToString()) select d).FirstOrDefault <PlayerData> (); pd.Unit = unit.Name; Blitz.Instance.Configuration.Save(); // Give them their items. if (!Unit.GiveLoadout(PlayerData.ForPlayer(caller))) { RocketChat.Say(caller, "Failed to find items in loadout."); } // Teleport them to their unit's spawn. caller.Teleport(SpawnManager.Instance.GetSpawnpoint(PlayerData.ForPlayer(caller)), 0); }
private void OnTimedEvent(RocketPlayer caller) { try { if (destroyList[dIdx].Type == "s") { try { StructureManager.damage(destroyList[dIdx].Transform, destroyList[dIdx].Transform.position, 65535, 1); } catch { } } else if (destroyList[dIdx].Type == "b") { try { BarricadeManager.damage(destroyList[dIdx].Transform, 65535, 1); } catch { } } else if (destroyList[dIdx].Type == "v") { try { destroyList[dIdx].Vehicle.askDamage(65535); } catch { } } else if (destroyList[dIdx].Type == "z") { EPlayerKill pKill; try { for (int i = 0; i < 100; i++) { destroyList[dIdx].Zombie.askDamage(255, destroyList[dIdx].Zombie.transform.up, out pKill); } } catch { } } dIdx++; if (destroyList.Count == dIdx) { RocketChat.Say(caller, Translate("wreckingball_complete", dIdx)); StructureManager.save(); Abort(); processing = false; } } catch (Exception) { throw; } }
private void Tick(System.Object stateInfo) { // If the time has run out, stop the timer if (Ticks == 0) { Timer.Change(Timeout.Infinite, Timeout.Infinite); this.OnFinish.Invoke(); } if (NumbersToPrint.Contains(Ticks)) { RocketChat.Say(string.Format(Message, Ticks), Color.cyan); } Ticks--; }
internal void Teleport(RocketPlayer caller, bool toBarricades = false) { if (SDG.StructureManager.Structures.Count == 0 && BarricadeManager.BarricadeRegions.LongLength == 0) { RocketChat.Say(caller, Translate("wreckingball_map_clear")); return; } Vector3 tpVector; if (!toBarricades) { foreach (Transform trf in SDG.StructureManager.Structures) { if (Vector3.Distance(trf.position, caller.Position) > 200) { tpVector = new Vector3(trf.position.x, trf.position.y + 3, trf.position.z); caller.Teleport(tpVector, caller.Rotation); return; } } } else { for (int k = 0; k < BarricadeManager.BarricadeRegions.GetLength(0); k++) { for (int l = 0; l < BarricadeManager.BarricadeRegions.GetLength(1); l++) { foreach (Transform trf in BarricadeManager.BarricadeRegions[k, l].Barricades) { if (Vector3.Distance(trf.position, caller.Position) > 20) { tpVector = new Vector3(trf.position.x, trf.position.y + 3, trf.position.z + 3); caller.Teleport(tpVector, caller.Rotation); return; } } } } } Vector3 trfPos = SDG.StructureManager.Structures[UnityEngine.Random.Range(0, SDG.StructureManager.Structures.Count - 1)].position; tpVector = new Vector3(trfPos.x, trfPos.y + 5, trfPos.z); caller.Teleport(tpVector, caller.Rotation); }
// Jail Methods internal void setJail(RocketPlayer caller, string jailName, UnityEngine.Vector3 location) { if (caller != null) { if (cells.ContainsKey(jailName.ToLower())) { RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_jail_exists", jailName)); return; } else { RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_jail_set", jailName)); } Configuration.Cells.Add(new CellLoc(jailName, location.x, location.y, location.z)); Configuration.Save(); } cells.Add(jailName.ToLower(), new Cell(jailName, location)); }
internal void Confirm(RocketPlayer caller) { if (destroyList.Count <= 0) { RocketChat.Say(caller, WreckingBall.Instance.Translate("wreckingball_help")); } else { if (aTimer == null) { aTimer = new Timer(delSpeed); aTimer.Elapsed += delegate { OnTimedEvent(caller); }; aTimer.AutoReset = true; } processing = true; RocketChat.Say(caller, Translate("wreckingball_initiated", (Math.Ceiling((double)(destroyList.Count * delSpeed) / 1000)))); dIdx = 0; aTimer.Enabled = true; } }
public void Execute(RocketPlayer caller, string[] command) { if (command.Length < 1) { RocketChat.Say(caller, "You did not specify a unit name. Usage: /" + string.Format(Usage, Name)); return; } Unit u = Unit.FromString(command [0]); if (u == null) { RocketChat.Say(caller, "Failed to find unit '" + command [0] + "'."); return; } Blitz.Instance.Configuration.Units.Remove(u); Blitz.Instance.Configuration.Save(); RocketChat.Say(caller, "Successfully removed unit '" + command [0] + "'."); }
public void Execute(RocketPlayer caller, string[] command) { // If a team or unit was not specified, output a list of available options. if (command.Length < 2) { RocketChat.Say(caller, "You did not specify a team or unit. Usage: /" + string.Format(Usage, Name)); RocketChat.Say(caller, "Teams are: " + Team.TeamList); RocketChat.Say(caller, "Units are: " + Unit.UnitList); return; } // Make sure a team exists with the specified name. // TODO extract into 'Team##FromString' method. Team team = (from Team t in Blitz.Instance.Configuration.Teams where t.Name.ToLower().Contains(command [0].ToLower()) select t).FirstOrDefault <Team> (); if (team == null) { RocketChat.Say(caller, "You did not specify a valid team."); RocketChat.Say(caller, "Teams are: " + Team.TeamList); return; } // Make sure a unit exists with the specified name. Unit unit = Unit.FromString(command[1]); if (unit == null) { RocketChat.Say(caller, "You did not specify a valid unit."); RocketChat.Say(caller, "Units are: " + Unit.UnitList); return; } Vector3 playerLoc = caller.Position; team.Spawns.Add(new Spawn(playerLoc.x, playerLoc.y, playerLoc.z, unit.Name)); RocketChat.Say(caller, string.Format("Successfully added a new spawn at {0} for {1} {2}.", playerLoc, team.Name, unit.Name)); Blitz.Instance.Configuration.Save(); }
internal void Scan(RocketPlayer caller, string filter, uint radius) { Wreck(caller, filter, radius, true); string report = ""; if (WreckCategories.Instance.reportList.Count > 0) { foreach (KeyValuePair <char, uint> reportFilter in WreckCategories.Instance.reportList) { report += " " + WreckCategories.Instance.category[reportFilter.Key].Name + ": " + reportFilter.Value + ","; } if (report != "") { report = report.Remove(report.Length - 1); } RocketChat.Say(caller, Translate("wreckingball_scan", radius, report)); } else { RocketChat.Say(caller, Translate("wreckingball_not_found", radius)); } }
internal void unsetJail(RocketPlayer caller, string jailName) { if (!cells.ContainsKey(jailName.ToLower())) { RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_jail_notfound", jailName)); return; } else { RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_jail_unset", jailName)); cells.Remove(jailName.ToLower()); foreach (CellLoc cell in Configuration.Cells) { if (cell.Name.ToLower() == jailName.ToLower()) { Configuration.Cells.Remove(cell); Configuration.Save(); return; } } } }
private void checkFeast() { Feast feast = Feast.instance; if (feast.Configuration.Enabled) { if ((feast.nextFeast - DateTime.Now).TotalSeconds - 300.0 <= 0.0 && (DateTime.Now - feast.lastMsg).TotalSeconds >= 60.0) { byte b = feast.msgNum; if (b != 0) { RocketChat.Say(string.Format(feast.Configuration.msgComingFeast, feast.nextLocation.Name(), feast.msgNum)); feast.lastMsg = DateTime.Now; feast.msgNum -= 1; } else { RocketChat.Say(string.Format(feast.Configuration.msgNowFeast, feast.nextLocation.Name())); feast.lastMsg = DateTime.Now; feast.runFeast(); } } } }
public void Execute(RocketPlayer caller, string[] command) { if (command.Length == 0) { RocketChat.Say(caller, "/csay (color) (message) - List of colors:", Color.yellow); RocketChat.Say(caller, "black, blue, clear, cyan, gray, green, grey, magenta, red, white, yellow, debug.", Color.yellow); return; } string color = command[0].ToLower(), message = ""; int i = 0; foreach (string space in command) { if (i != 0) { message += space + " "; } i++; } switch (color) { case "black": RocketChat.Say(message, Color.black); break; case "blue": RocketChat.Say(message, Color.blue); break; case "clear": RocketChat.Say(message, Color.clear); break; case "cyan": RocketChat.Say(message, Color.cyan); break; case "gray": RocketChat.Say(message, Color.gray); break; case "green": RocketChat.Say(message, Color.green); break; case "grey": RocketChat.Say(message, Color.grey); break; case "magenta": RocketChat.Say(message, Color.magenta); break; case "red": RocketChat.Say(message, Color.red); break; case "white": RocketChat.Say(message, Color.white); break; case "yellow": RocketChat.Say(message, Color.yellow); break; case "debug": RocketChat.Say(message, Color.Lerp(Color.blue, Color.red, 255)); break; default: RocketChat.Say(caller, "Error: Color: " + color + " is not available.", Color.red); break; } }
public void Execute(RocketPlayer caller, string[] cmd) { bool isServer; bool isAdmin; string charName; try { charName = caller.CharacterName; isServer = false; isAdmin = caller.IsAdmin; } //Mainly to fix exceptions when user is typing commands from the server console. catch (NullReferenceException n) { charName = "Server"; isServer = true; isAdmin = true; } if (cmd[0].ToLower().Equals("set") && isAdmin) //Set various settings. { if (cmd.Length < 3 || cmd.Length > 3) //Make sure we have the right number or arguments. { SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_WARNING, "Incorrect number of arguments for 'set'."); return; } if (cmd[1].ToLower().Equals("enabled")) //Enable or disable plugin entirely. { if (cmd[2].ToLower().Equals("true")) { SpawnKit.SetEnabled(true); SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_INFO, "Kits enabled" + " by " + charName); return; } if (cmd[2].ToLower().Equals("false")) { SpawnKit.SetEnabled(false); SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_INFO, "Kits disabled" + " by " + charName); return; } SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_WARNING, "Incorrect option. Only true or false is accepted."); return; } if (cmd[1].ToLower().Equals("cooldown")) //Turn off the cooldown. { if (cmd[2].ToLower().Equals("on")) { SpawnKit.SetGlobalCoolDownEnabled(true); SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_INFO, "Cooldown enabled" + " by " + charName); return; } if (cmd[2].ToLower().Equals("off")) { SpawnKit.SetGlobalCoolDownEnabled(false); SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_INFO, "Cooldown disabled" + " by " + charName); return; } SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_WARNING, "Incorrect option. Only on or off is accepted."); return; } if (cmd[1].ToLower().Equals("cooldowntime")) //set the spawn kit cooldown. { try { SpawnKit.SetCooldown(int.Parse(cmd[2])); SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_INFO, "Kit cooldown set to " + cmd[2] + " by " + charName); return; } catch (Exception e) { SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_WARNING, "Not a valid input for cooldown. (Seconds)"); Logger.LogException(e); return; } } if (cmd[1].ToLower().Equals("cooldownmessages")) //Turn off the cooldown chat messages. { if (cmd[2].ToLower().Equals("on")) { SpawnKit.SetCoolDownChatMessagesEnabled(true); SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_INFO, "Cooldown chat messages enabled" + " by " + charName); return; } if (cmd[2].ToLower().Equals("off")) { SpawnKit.SetCoolDownChatMessagesEnabled(false); SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_INFO, "Cooldown chat messages disabled" + " by " + charName); return; } SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_WARNING, "Incorrect option. Only on or off is accepted."); return; } if (cmd[1].ToLower().Equals("professionmode")) //Enable or disable profession mode. { if (cmd[2].ToLower().Equals("on")) { SpawnKit.SetProfessionModeEnable(true); SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_INFO, "Profession mode enabled" + " by " + charName); return; } if (cmd[2].ToLower().Equals("off")) { SpawnKit.SetProfessionModeEnable(false); SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_INFO, "Profession mode disabled" + " by " + charName); return; } SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_WARNING, "Incorrect option. Only on or off is accepted."); return; } if (cmd[1].ToLower().Equals("professionmessages")) //Turn off the prefession chat messages. { if (cmd[2].ToLower().Equals("on")) { SpawnKit.SetProfessionChatMessagesEnabled(true); SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_INFO, "Profession chat messages enabled" + " by " + charName); return; } if (cmd[2].ToLower().Equals("off")) { SpawnKit.SetProfessionChatMessagesEnabled(false); SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_INFO, "Profession chat messages disabled" + " by " + charName); return; } SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_WARNING, "Incorrect option. Only on or off is accepted."); return; } if (cmd[1].ToLower().Equals("subscriptionmode")) //Enable or disable subscription (class) mode. { if (cmd[2].ToLower().Equals("on")) { SpawnKit.SetSubscriptionMode(true); SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_INFO, "Subscription mode enabled" + " by " + charName); return; } if (cmd[2].ToLower().Equals("off")) { SpawnKit.SetSubscriptionMode(false); SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_INFO, "Subscription mode disabled" + " by " + charName); return; } SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_WARNING, "Incorrect option. Only on or off is accepted."); return; } SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_WARNING, "Invalid set option."); return; } if (cmd[0].ToLower().Equals("status") && isAdmin) //View plugin status. { PrintStatus(); return; } if (cmd[0].ToLower().Equals("reload") && isAdmin) { SpawnKit.ReloadSpawnKitConfiguration(); return; } if (cmd[0].ToLower().Equals("save") && isAdmin) { SpawnKit.SaveConfiguration(); return; } if (cmd[0].ToLower().Equals("givekit") && isAdmin) //Clear the named players inventory and give them a kit. { if (cmd.Length == 3) //Make sure we have to proper number of parameters. { SpawnKit.AdminGiveKit(cmd[1], cmd[2]); return; } SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_WARNING, "Incorrect number of arguments for 'givekit'."); return; } if (cmd[0].ToLower().Equals("list")) //List Classes if class subscription mode is on. { if (SpawnKit.GetSubscriptionModeEnabled()) //If subscription mode is enabled print list. { string classListString = ""; foreach (Kit k in SpawnKit.GetKitsList()) { classListString = classListString + k.Name + ", "; } RocketChat.Say(caller, "Class List: " + classListString); RocketChat.Say(caller, "/sk class ClassName to pick class."); return; } RocketChat.Say(caller, "Subscription mode disabled."); return; } if (cmd[0].ToLower().Equals("class")) //Select class { if (SpawnKit.GetSubscriptionModeEnabled()) //If subscription mode is enabled. { try { foreach (Kit k in SpawnKit.GetKitsList()) //Loop through kits to see if they picked a valid class. { if (cmd[1].ToLower().Equals(k.Name.ToLower())) //They did. { SpawnKit.AddPlayerToSubscriptionList(charName, k); RocketChat.Say(caller, "Class selected."); return; } } RocketChat.Say(caller, "No such class."); return; } catch (Exception e) { RocketChat.Say(caller, "No such class."); return; } } RocketChat.Say(caller, "Subscription mode disabled."); return; } if (cmd[0].ToLower().Equals("listsubs") && isAdmin) //Print the player kit subscriptions to the console. { if (SpawnKit.GetSubscriptionModeEnabled()) { var tempSubList = SpawnKit.GetSubscriptionList(); SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_INFO, "-- Kit Subscriptions --"); foreach (var pName in SpawnKit.GetSubscriptionList().Keys) { SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_INFO, "Player: " + pName + " | Kit: " + tempSubList[pName].Name); } return; } SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_WARNING, "Subscription mode disabled."); return; } if (cmd[0].ToLower().Equals("logme") && isAdmin) //Direct SpawnKit console messages to yourself. { if (isServer) { ShowCannotRunFromConsoleWarning(); return; } SpawnKit.AddPlayerToLogList(caller); SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_INFO, "Added player " + charName + " to the log output list."); return; } if (cmd[0].ToLower().Equals("unlogme") && isAdmin) //Disable SpawnKit console messages being sent to you. { if (isServer) { ShowCannotRunFromConsoleWarning(); return; } SpawnKit.RemovePlayerFromLogList(caller); SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_INFO, "Removed player " + charName + " from the log output list."); return; } if (cmd[0].ToLower().Equals("clearlogplayers") && isAdmin) //Disable SpawnKit console messages being sent to you. { SpawnKit.CleanPlayerLogList(); SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_INFO, "Player log message list cleared."); return; } if (cmd[0].ToLower().Equals("help")) { if (cmd.Length == 1) //If we are only showing the default help page. { ShowHelp("help"); return; } if (cmd[1].ToLower().Equals("set")) { ShowHelp("set"); return; } if (cmd[1].ToLower().Equals("status")) { ShowHelp("status"); return; } if (cmd[1].ToLower().Equals("reload")) { ShowHelp("reload"); return; } if (cmd[1].ToLower().Equals("save")) { ShowHelp("save"); return; } if (cmd[1].ToLower().Equals("givekit")) { ShowHelp("givekit"); return; } if (cmd[1].ToLower().Equals("list")) { ShowHelp("list"); return; } if (cmd[1].ToLower().Equals("listsubs")) { ShowHelp("listsubs"); return; } if (cmd[1].ToLower().Equals("class")) { ShowHelp("class"); return; } if (cmd[1].ToLower().Equals("logme")) { ShowHelp("logme"); return; } if (cmd[1].ToLower().Equals("unlogme")) { ShowHelp("unlogme"); return; } if (cmd[1].ToLower().Equals("clearlogplayers")) { ShowHelp("clearlogplayers"); return; } SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_WARNING, "Invalid help topic."); return; } SpawnKit.logHelper.LogMessage(LogHelper.MESSAGELEVEL_WARNING, "Invalid SpawnKit command. Use 'sk help' for more info."); return; }