public void Execute(IRocketPlayer caller, string[] command) { UnturnedPlayer callr = (UnturnedPlayer)caller; string kitName = Plugin.CustomKitsPlugin.Instance.Configuration.Instance.DefaultKitName; if (!KitManager.HasSavedKits(callr, KitManager.Kits)) { UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("no_saved_kits"), Color.red); return; } if (Plugin.CustomKitsPlugin.Instance.Configuration.Instance.DefaultKitName == "preset_name") { foreach (Plugin.CustomKitsConfig.Preset Preset in Plugin.CustomKitsPlugin.Instance.Configuration.Instance.Presets) { if (caller.HasPermission(Plugin.CustomKitsPlugin.PERMISSION + Preset.Name)) { kitName = Preset.Name; } } } if (command.Length == 1) { kitName = command[0]; } if (kitName == "*") { if (KitManager.HasSavedKits(callr, KitManager.Kits)) { UnturnedChat.Say(callr, Plugin.CustomKitsPlugin.Instance.Translate("are_you_sure"), Color.yellow); if (!Yes.Contains(callr.CSteamID)) { Yes.Add(callr.CSteamID); return; } } else { UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("no_saved_kits"), Color.red); return; } } if (KitManager.HasKit(callr, kitName, KitManager.Kits)) { KitManager.DeleteKit(callr, kitName, KitManager.Kits); } else { UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("no_kit_exists"), Color.red); return; } UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("kit_deleted", kitName), Color.green); }
public void Execute(IRocketPlayer caller, string[] command) { UnturnedPlayer callr = (UnturnedPlayer)caller; string kitName = null; if (command.Length == 0) { if (!AutoLoad.ContainsKey(callr.CSteamID)) { if (Plugin.CustomKitsPlugin.Instance.Configuration.Instance.DefaultKitName == "preset_name") { foreach (Plugin.CustomKitsConfig.Preset Preset in Plugin.CustomKitsPlugin.Instance.Configuration.Instance.Presets) { if (caller.HasPermission(Plugin.CustomKitsPlugin.PERMISSION + Preset.Name)) { kitName = Preset.Name; } } } else { kitName = Plugin.CustomKitsPlugin.Instance.Configuration.Instance.DefaultKitName; } } else { AutoLoad.Remove(callr.CSteamID); UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("autoload_off"), Color.green); return; } } else { kitName = command[0]; } if (!KitManager.HasKit(callr, kitName, KitManager.Kits)) { UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("no_kit_exists"), Color.red); return; } if (!AutoLoad.ContainsKey(callr.CSteamID)) { AutoLoad.Add(callr.CSteamID, kitName); UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("autoload_on", kitName), Color.green); } else { AutoLoad[callr.CSteamID] = kitName; UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("autoload_on", kitName), Color.green); } }
public void Execute(IRocketPlayer caller, string[] command) { UnturnedPlayer callr = (UnturnedPlayer)caller; string kitName = Plugin.CustomKitsPlugin.Instance.Configuration.Instance.DefaultKitName; if (Plugin.CustomKitsPlugin.Instance.Configuration.Instance.DefaultKitName == "preset_name") { foreach (Plugin.CustomKitsConfig.Preset Preset in Plugin.CustomKitsPlugin.Instance.Configuration.Instance.Presets) { if (caller.HasPermission(Plugin.CustomKitsPlugin.PERMISSION + Preset.Name)) { kitName = Preset.Name; } } } if (command.Length == 1) { kitName = command[0]; } if (!KitManager.HasSavedKits(callr, KitManager.Kits)) { UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("no_saved_kits"), Color.red); return; } if (!KitManager.HasKit(callr, kitName, KitManager.Kits)) { UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("no_kit_exists"), Color.red); return; } InventoryManager.Clear(callr, Plugin.CustomKitsPlugin.Instance.Configuration.Instance.IncludeClothingInKits); KitManager.LoadKit(callr, callr, kitName, Plugin.CustomKitsPlugin.Instance.Configuration.Instance.IncludeClothingInKits, KitManager.Kits); UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("kit_loaded", kitName), Color.green); }
private void OnPlayerRevive(UnturnedPlayer player, Vector3 position, byte angle) { if (Commands.Command_AutoSkills.AutoSkills.Contains(player.CSteamID)) { player.MaxSkills(); UnturnedChat.Say(player, Translate("max_skills"), Color.green); } if (Commands.Command_AutoCopy.AutoCopy.Contains(player.CSteamID)) { InventoryManager.AutoCopy(player); } if (Commands.Command_AutoSave.AutoSave.ContainsKey(player.CSteamID)) { KitManager.AutoSave(player); } if (Commands.Command_AutoLoad.AutoLoad.ContainsKey(player.CSteamID)) { string kitName = Commands.Command_AutoLoad.AutoLoad[player.CSteamID]; if (!KitManager.HasSavedKits(player, KitManager.Kits)) { UnturnedChat.Say(player, Instance.Translate("no_saved_kits"), Color.red); return; } if (!KitManager.HasKit(player, kitName, KitManager.Kits)) { UnturnedChat.Say(player, Translate("no_kit_exists"), Color.red); return; } StartCoroutine(KitManager.DelayedLoad(player, kitName, 0.3f)); } }
public void Execute(IRocketPlayer caller, string[] command) { UnturnedPlayer callr = (UnturnedPlayer)caller; string kitName = Plugin.CustomKitsPlugin.Instance.Configuration.Instance.DefaultKitName; string presetName = "ADMIN_KIT"; List <InventoryManager.Item> itemList = InventoryManager.ListItems(callr); int inventoryCount = itemList.Count; if (!caller.IsAdmin || !caller.HasPermission("ck.admin")) { string[] blackList = new string[] { }; int itemLimit = int.MaxValue; foreach (Plugin.CustomKitsConfig.Preset Preset in Plugin.CustomKitsPlugin.Instance.Configuration.Instance.Presets) { if (caller.HasPermission(Plugin.CustomKitsPlugin.PERMISSION + Preset.Name)) { presetName = Preset.Name; if (Preset.Blacklist != "") { blackList = Preset.Blacklist.Split(','); break; } } else { UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("set_permissions"), Color.red); return; } } if (KitManager.KitCount(callr, KitManager.Kits) >= SlotManager.SlotCount(callr)) { UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("no_kits_left"), Color.red); return; } var v = KitManager.KitCount(callr, KitManager.Kits); var slot = SlotManager.Slots[callr.CSteamID.m_SteamID][v]; itemLimit = slot.itemLimit; if (blackList.Length > 0) { foreach (InventoryManager.Item item in itemList) { List <int> bList = new List <int>(); foreach (var itemID in blackList) { bList.Add(int.Parse(itemID)); } if (bList.Contains(item.id)) { UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("blacklisted", UnturnedItems.GetItemAssetById(item.id)), Color.red); } } } if (inventoryCount > itemLimit) { UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("item_limit", itemLimit), Color.red); return; } } if (Plugin.CustomKitsPlugin.Instance.Configuration.Instance.DefaultKitName == "preset_name") { kitName = presetName; } if (command.Length == 1) { kitName = command[0]; } if (kitName == "*") { UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("unsupported_character", "*"), Color.red); return; } if (inventoryCount < 1 || itemList == null) { UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("empty_inventory"), Color.red); return; } if (KitManager.HasKit(callr, kitName, KitManager.Kits)) { KitManager.DeleteKit(callr, kitName, KitManager.Kits); } KitManager.SaveKit(callr, callr, kitName, KitManager.Kits); UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("kit_saved", kitName), Color.green); }