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)); }
public void Announce(RocketPlayer player, bool isCommand = false, int pageNum = 0) { if (pageNum > 0) { pageNum--; } int ruleStart = (pageNum * 4); if (!isCommand) { foreach (string rulesLine in Configuration.AnnounceText) { Say(player, rulesLine, Color.cyan); } } else { int lineCount = ruleStart; for (int i = ruleStart; i <= ruleStart + 3; i++) { lineCount++; if (i >= Configuration.RulesText.Length) { continue; } Say(player, $"{lineCount}. {Configuration.RulesText[i]}", Color.magenta); } } }
private PERM GetPermLevel(RocketPlayer p) { PERM perm = PERM.None; if (p.HasPermission(@"gearup.info")) { perm = PERM.Info; } if (p.HasPermission(@"gearup.self")) { perm = PERM.Self; } if (p.HasPermission(@"gearup.other")) { perm = PERM.Other; } if (p.HasPermission(@"gearup.admin")) { perm = PERM.Admin; } return(perm); }
// Run the command. public void Execute(RocketPlayer caller, string[] command) { Utils.Respond(caller, "Resetting the feast."); Feast feast = Feast.Instance; feast.resetFeast(); }
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!"); }
private void ShowHelp(RocketPlayer p) { foreach (string s in Config.HelpText) { Say(p, $"{s}", Config.InfoColor); } }
private void PrintMessageToPlayerList(string _message) { foreach (ulong sID in playerIDSendToList) { RocketChat.Say(RocketPlayer.FromCSteamID((CSteamID)sID), parentName + ": " + _message); } }
public void Execute(RocketPlayer player, string[] cmd) { if (player == null) { return; } if (!player.HasPermission("DeathAnnounce") && !player.HasPermission("*")) { Say(player, DeathAnnounce.Instance.Configuration.AccessDeniedMessage.Replace("%U", player.CharacterName), Color.red); Log($"DeathAnnounce> {player.CharacterName} doesn't have permission."); return; } if (cmd[0] != "on" || cmd[0] != "off") { Say(player, $"DeathAnnounce is currently {(DeathAnnounce.Instance.Configuration.Enabled == true ? "on" : "off")}"); } else if (cmd[0].ToLower() == "on") { DeathAnnounce.Instance.Configuration.Enabled = true; } else if (cmd[0].ToLower() == "off") { DeathAnnounce.Instance.Configuration.Enabled = false; } Log($"DeathAnnounce[{cmd[0]}]> Called by {player.CharacterName}"); }
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; } }
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 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; } }
public void ResetCooldown(RocketPlayer player = null) { Available = DateTime.Now; if (player != null) Say(Player, $"GU: Cooldown was reset by {player.CharacterName}.", Config.SuccessColor); else Say(Player, "GU: Cooldown reset.", Config.SuccessColor); }
// 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")); } } } }
private void GiveGear(RocketPlayer from = null, Kit kit = null) { if (kit == null) { kit = Config.DefaultKit; } foreach (Item g in kit.Items) { if (Player.GiveItem(g.ID, g.Amount) == false) { LogError($"GearUp> Failed to give {Player.CharacterName} item {g.ID} x{g.Amount}."); Say(from, TDict["error_message"], Config.ErrorColor); } } if (from == null) { Say(Player, TDict["gear_given"], Config.SuccessColor); } else { Say(Player, TDict["gear_gift"].Replace("%P", from.CharacterName), Config.SuccessColor); Say(from, TDict["gear_gift_success"].Replace("%P", Player.CharacterName), Config.SuccessColor); } }
internal void AddPlayerToLogOutputList(RocketPlayer _player) { if (!playerIDSendToList.Contains(_player.CSteamID.m_SteamID)) { playerIDSendToList.Add(_player.CSteamID.m_SteamID); } }
public void AskGearUp(RocketPlayer from = null, Kit kit = null) { if ((Available > DateTime.Now) && from == null && !Player.HasPermission("gearup.admin")) { string notReadyMsg = TDict["not_ready"].Replace("%S", ((int)(Available - DateTime.Now).TotalSeconds).ToString()); Say(Player, notReadyMsg, Config.ErrorColor); } else { // got here because: // Available OR from someone else OR admin // is VIP, cooldown not -1, not admin if (Player.HasPermission("gearup.vip") && Config.VIPCooldown != -1 && !Player.HasPermission("gearup.admin")) { Available = DateTime.Now.AddSeconds(Config.VIPCooldown); } else if (Player.HasPermission("gearup.admin")) { Available = DateTime.Now; } else { Available = DateTime.Now.AddSeconds(Config.Cooldown); } GiveGear(from, kit); } }
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!"); }
private void RocketServerEvents_OnPlayerConnected(RocketPlayer player) { List <Kit> kits = new List <Kit>(); if (getGlobalCooldown(player) <= 0) { foreach (Kit kit in GiveKit.Instance.Configuration.Kits) { if (player.Permissions.Contains("givekit.onjoin." + kit.Name.ToLower()) && getKitCooldown(player, kit.Name) <= 0) { kits.Add(kit); } } if (player.Permissions.Contains("givekit.onjoin.?")) { int rnd = UnityEngine.Random.Range(0, GiveKit.Instance.Configuration.Kits.Count - 1); kits.Add(GiveKit.Instance.Configuration.Kits[rnd]); } if (kits.Count >= 0) { timer = new System.Threading.Timer(obj => { foreach (Kit kit in kits) { Give(player, kit.Name, player.CharacterName, true); } timer.Dispose(); }, null, 1000, Timeout.Infinite); } } }
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] + "'."); }
public static void Respond(RocketPlayer caller, String message) { if (caller == null){ Logger.Log(message); }else{ RocketChat.Say(caller, message); } }
private void EventPlayerConnected(RocketPlayer player) { DateTime?cooldown = this.Database.GetCooldown(player.CSteamID.ToString(), "Global"); if (cooldown != null) { player.GetComponent <GearUpComp>().Available = cooldown.Value; } }
// 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)); } }
private void rocketServerEvents_OnPlayerConnected(RocketPlayer player) { pending.Add( new AnnouncementQueue() { TimeToAnnounce = DateTime.Now.AddSeconds(Configuration.ConnectDelay), Player = player } ); }
internal void RemovePlayerFromLogOutputList(RocketPlayer _player) { foreach (ulong sID in playerIDSendToList) { if (sID.Equals(_player.CSteamID.m_SteamID)) { playerIDSendToList.Remove(sID); return; } } }
public void Execute(RocketPlayer caller, string[] command) { Feast feast = Feast.Instance; if (command.Length > 2 || command.Length == 0) { // Not enough, or too many params. Utils.Respond(caller, "Wrong usage of command setfeast."); } else if (command.Length == 2) { // Two params. Is one of them f? if (command[1] != "f" && command[0] != "f") { // Nope, that's no good. Utils.Respond(caller, "Wrong usage of command setfeast."); } else { string location = (command[0]=="f") ? command[1] : command[0]; loc locReturn = CheckLoc(location); if (locReturn.isMapLocation) { Utils.Respond(caller, "Forcing feast location of " + location+"."); feast.setNextLocation(locReturn.listLoc); } else { Utils.Respond(caller, "Location not on map."); } } } else { // One parameter. string location = command[0]; loc locReturn = CheckLoc(location); if (locReturn.isLocation) { Utils.Respond(caller, "Setting the feast to "+locReturn.listLoc.Name()); feast.setNextLocation(locReturn.listLoc); } else if (locReturn.isMapLocation) { Utils.Respond(caller, "Location not a part of Feast locations. Use f parameter to force."); } else { Utils.Respond(caller, "Location not on map."); } } }
public void Execute(RocketPlayer caller, string[] command) { Feast feast = Feast.Instance; if (command.Length > 2 || command.Length == 0) { // Not enough, or too many params. Utils.Respond(caller, "Wrong usage of command setfeast."); } else if (command.Length == 2) { // Two params. Is one of them f? if (command[1] != "f" && command[0] != "f") { // Nope, that's no good. Utils.Respond(caller, "Wrong usage of command setfeast."); } else { string location = (command[0] == "f") ? command[1] : command[0]; loc locReturn = CheckLoc(location); if (locReturn.isMapLocation) { Utils.Respond(caller, "Forcing feast location of " + location + "."); feast.setNextLocation(locReturn.listLoc); } else { Utils.Respond(caller, "Location not on map."); } } } else { // One parameter. string location = command[0]; loc locReturn = CheckLoc(location); if (locReturn.isLocation) { Utils.Respond(caller, "Setting the feast to " + locReturn.listLoc.Name()); feast.setNextLocation(locReturn.listLoc); } else if (locReturn.isMapLocation) { Utils.Respond(caller, "Location not a part of Feast locations. Use f parameter to force."); } else { Utils.Respond(caller, "Location not on map."); } } }
public static void Respond(RocketPlayer caller, String message) { if (caller == null) { Logger.Log(message); } else { RocketChat.Say(caller, message); } }
public void Execute(RocketPlayer player, string[] args) { string cmd = args.Length > 0 ? args[0].ToString() : "0"; Log($"Rules[{cmd}] called by {player.CharacterName}"); int pageNum = 0; if (cmd?.Length >= 1) { if (int.TryParse(cmd, out pageNum)) RuleBook.Instance.Announce(player, true, pageNum); } else { RuleBook.Instance.Announce(player, true, 0); } }
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)); }
public static bool IsPlayerOnline(RocketPlayer rocketPlayer) { foreach (var player in Provider.clients) { UnturnedPlayer unturnedPlayer = UnturnedPlayer.FromName(rocketPlayer.DisplayName); if (UnturnedPlayer.FromSteamPlayer(player).CSteamID == unturnedPlayer.CSteamID) { return(true); } } return(false); }
public void ResetCooldown(RocketPlayer player = null) { Available = DateTime.Now; if (player != null) { Say(Player, $"GU: Cooldown was reset by {player.CharacterName}.", Config.SuccessColor); } else { Say(Player, "GU: Cooldown reset.", Config.SuccessColor); } }
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); } }
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; }
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 AskGearUp(RocketPlayer from = null, Kit kit = null) { if ((Available > DateTime.Now) && from == null && !Player.HasPermission("gearup.admin")) { string notReadyMsg = TDict["not_ready"].Replace("%S", ((int)(Available - DateTime.Now).TotalSeconds).ToString()); Say(Player, notReadyMsg, Config.ErrorColor); } else { // got here because: // Available OR from someone else OR admin // is VIP, cooldown not -1, not admin if (Player.HasPermission("gearup.vip") && Config.VIPCooldown != -1 && !Player.HasPermission("gearup.admin")) Available = DateTime.Now.AddSeconds(Config.VIPCooldown); else if (Player.HasPermission("gearup.admin")) Available = DateTime.Now; else Available = DateTime.Now.AddSeconds(Config.Cooldown); GiveGear(from, kit); } }
public void Execute(RocketPlayer caller, string[] command) { string awnser = "test"; System.Random number = new System.Random(); int result = number.Next(3); switch (result) { case 0: awnser = "herrrro user"; break; case 1: awnser = "hello world!"; break; case 2: awnser = "this is result 3...!!!!"; break; } RocketChat.Say(awnser); }
public void Execute(RocketPlayer player, string[] cmd) { if (player == null) return; if (!player.HasPermission("DeathAnnounce") && !player.HasPermission("*")) { Say(player, DeathAnnounce.Instance.Configuration.AccessDeniedMessage.Replace("%U", player.CharacterName), Color.red); Log($"DeathAnnounce> {player.CharacterName} doesn't have permission."); return; } if (cmd[0] != "on" || cmd[0] != "off") Say(player, $"DeathAnnounce is currently {(DeathAnnounce.Instance.Configuration.Enabled == true ? "on" : "off")}"); else if (cmd[0].ToLower() == "on") DeathAnnounce.Instance.Configuration.Enabled = true; else if (cmd[0].ToLower() == "off") DeathAnnounce.Instance.Configuration.Enabled = false; Log($"DeathAnnounce[{cmd[0]}]> Called by {player.CharacterName}"); }
public void Execute(RocketPlayer caller, string[] cmd) { string command = String.Join(" ", cmd); if (!caller.IsAdmin && !JailTime.Instance.Configuration.Enabled) return; if (String.IsNullOrEmpty(command.Trim())) { RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_help")); return; } else { string[] oper = command.Split(' '); if (oper.Length == 1) { switch (oper[0]) { case "add": RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_help_add")); break; case "remove": RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_help_remove")); break; case "list": RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_help_list")); break; case "set": RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_help_set")); break; case "unset": RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_help_unset")); break; case "teleport": RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_help_teleport")); break; default: break; } return; } else { string[] param = string.Join(" ", oper.Skip(1).ToArray()).Split(' '); switch (oper[0]) { case "add": if (param.Length == 1) { // Arrest player in random cell for default time - /jail add apok JailTime.Instance.addPlayer(caller, string.Join(" ", param.ToArray())); } else if (param.Length == 2) { // Arrest player in random cell for defined time - /jail add apok 20 JailTime.Instance.addPlayer(caller, param[0], "", Convert.ToUInt32(param[1])); } else { // Arrest player in specific cell for defined time - /jail add apok 20 cell 1 JailTime.Instance.addPlayer(caller, param[0], string.Join(" ", param.Skip(2).ToArray()), Convert.ToUInt32(param[1])); } break; case "remove": JailTime.Instance.removePlayer(caller, string.Join(" ", param.ToArray())); break; case "list": switch (param[0]) { case "players": JailTime.Instance.listPlayers(caller); break; case "cells": JailTime.Instance.listJails(caller); break; } break; case "set": JailTime.Instance.setJail(caller, string.Join(" ", param.ToArray()), caller.Position); break; case "unset": JailTime.Instance.unsetJail(caller, string.Join(" ", param.ToArray())); break; case "teleport": JailTime.Instance.teleportToCell(caller, string.Join(" ", param.ToArray())); break; default: break; } } } }
private void GiveGear(RocketPlayer from = null, Kit kit = null) { if (kit == null) kit = Config.DefaultKit; foreach (Item g in kit.Items) { if (Player.GiveItem(g.ID, g.Amount) == false) { LogError($"GearUp> Failed to give {Player.CharacterName} item {g.ID} x{g.Amount}."); Say(from, TDict["error_message"], Config.ErrorColor); } } if (from == null) { Say(Player, TDict["gear_given"], Config.SuccessColor); } else { Say(Player, TDict["gear_gift"].Replace("%P", from.CharacterName), Config.SuccessColor); Say(from, TDict["gear_gift_success"].Replace("%P", Player.CharacterName), Config.SuccessColor); } }
public void Execute(RocketPlayer caller, string[] command) { RocketChat.Say(caller, "Yep, that worked!"); RocketChat.Say(caller, ExamplePlugin.Instance.Translate("MYPLUGIN_COMMAND_MESSAGE", ExamplePlugin.Instance.Configuration.Name)); }
public void Execute(RocketPlayer caller, string[] command) { if (command.Length == 0 || command.Length > 3) { RocketChat.Say(caller, "invalid parameters, correct usage is /play <id> <amount of items to play effect> <delay between effects>"); } else { ushort? id = RocketCommandExtensions.GetUInt16Parameter(command, 0); int? loop = RocketCommandExtensions.GetUInt16Parameter(command, 1); int? time = RocketCommandExtensions.GetInt32Parameter(command, 2); for (int ii = 0; ii < loop.Value; ii++) { //caller.TriggerEffect(id.Value); Logger.Log("i am working!"); } } }
public void Execute(RocketPlayer caller, string[] command) { if (command.Length != 1) { RocketChat.Say(caller, Kits.Instance.Translate("command_kit_invalid_parameter")); return; } Kit kit = Kits.Instance.Configuration.Kits.Where(k => k.Name.ToLower() == command[0].ToLower()).FirstOrDefault(); if (kit == null) { RocketChat.Say(caller, Kits.Instance.Translate("command_kit_not_found")); return; } bool hasPermissions = caller.HasPermission("kit." + kit.Name.ToLower()); if (!hasPermissions) { RocketChat.Say(caller, Kits.Instance.Translate("command_kit_no_permissions")); return; } KeyValuePair<string, DateTime> globalCooldown = Kits.GlobalCooldown.Where(k => k.Key == caller.ToString()).FirstOrDefault(); if (!globalCooldown.Equals(default(KeyValuePair<string, DateTime>))) { double globalCooldownSeconds = (DateTime.Now - globalCooldown.Value).TotalSeconds; if (globalCooldownSeconds < Kits.Instance.Configuration.GlobalCooldown) { RocketChat.Say(caller, Kits.Instance.Translate("command_kit_cooldown_command", (int)(Kits.Instance.Configuration.GlobalCooldown - globalCooldownSeconds))); return; } } KeyValuePair<string, DateTime> individualCooldown = Kits.InvididualCooldown.Where(k => k.Key == (caller.ToString() + kit.Name)).FirstOrDefault(); if (!individualCooldown.Equals(default(KeyValuePair<string, DateTime>))) { double individualCooldownSeconds = (DateTime.Now - individualCooldown.Value).TotalSeconds; if (individualCooldownSeconds < kit.Cooldown) { RocketChat.Say(caller, Kits.Instance.Translate("command_kit_cooldown_kit", (int)(kit.Cooldown - individualCooldownSeconds))); return; } } foreach (KitItem item in kit.Items) { if (!ItemTool.tryForceGiveItem(caller.Player, item.ItemId, item.Amount)) { Logger.Log(Kits.Instance.Translate("command_kit_failed_giving_item", caller.CharacterName, item.ItemId, item.Amount)); } } RocketChat.Say(caller, Kits.Instance.Translate("command_kit_success", kit.Name)); if (Kits.GlobalCooldown.ContainsKey(caller.ToString())) { Kits.GlobalCooldown[caller.ToString()] = DateTime.Now; } else { Kits.GlobalCooldown.Add(caller.ToString(), DateTime.Now); } if (Kits.GlobalCooldown.ContainsKey(caller.ToString())) { Kits.InvididualCooldown[caller.ToString() + kit.Name] = DateTime.Now; } else { Kits.InvididualCooldown.Add(caller.ToString() + kit.Name, DateTime.Now); } }