-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added command "/giveslot" to manually give players more slots to save kits - Added Preset-based item blacklisting - Removed Slot Shop - Stability improvements - Updated libraries - Various bug fixes
- Loading branch information
Showing
24 changed files
with
2,377 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System.Collections.Generic; | ||
using Rocket.Unturned.Chat; | ||
using Rocket.Unturned.Player; | ||
using Rocket.API; | ||
using Steamworks; | ||
using UnityEngine; | ||
|
||
namespace Teyhota.CustomKits.Commands | ||
{ | ||
public class Command_AutoCopy : IRocketCommand | ||
{ | ||
public static List<CSteamID> AutoCopy = new List<CSteamID>(); | ||
public static Dictionary<CSteamID, CSteamID> Murdered = new Dictionary<CSteamID, CSteamID>(); | ||
|
||
public AllowedCaller AllowedCaller => AllowedCaller.Player; | ||
|
||
public string Name => "autocopy"; | ||
|
||
public string Help => "Toggle Auto-copy"; | ||
|
||
public string Syntax => string.Empty; | ||
|
||
public List<string> Aliases => new List<string>() { "acopy" }; | ||
|
||
public List<string> Permissions => new List<string> { "ck.autocopy" }; | ||
|
||
|
||
public void Execute(IRocketPlayer caller, string[] command) | ||
{ | ||
UnturnedPlayer callr = (UnturnedPlayer)caller; | ||
|
||
if (AutoCopy.Contains(callr.CSteamID)) | ||
{ | ||
AutoCopy.Remove(callr.CSteamID); | ||
UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("autocopy_off"), Color.green); | ||
} | ||
else | ||
{ | ||
AutoCopy.Add(callr.CSteamID); | ||
UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("autocopy_on"), Color.green); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using System.Collections.Generic; | ||
using Rocket.Unturned.Chat; | ||
using Rocket.Unturned.Player; | ||
using Rocket.API; | ||
using Steamworks; | ||
using UnityEngine; | ||
|
||
namespace Teyhota.CustomKits.Commands | ||
{ | ||
public class Command_AutoLoad : IRocketCommand | ||
{ | ||
public static Dictionary<CSteamID, string> AutoLoad = new Dictionary<CSteamID, string>(); | ||
|
||
public AllowedCaller AllowedCaller => AllowedCaller.Player; | ||
|
||
public string Name => "autoload"; | ||
|
||
public string Help => "Auto-load any of your kits when you die"; | ||
|
||
public string Syntax => "<kit name>"; | ||
|
||
public List<string> Aliases => new List<string>() { "aload" }; | ||
|
||
public List<string> Permissions => new List<string> { "ck.autoload" }; | ||
|
||
|
||
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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
using System.Collections.Generic; | ||
using Rocket.Unturned.Chat; | ||
using Rocket.Unturned.Player; | ||
using Rocket.API; | ||
using Steamworks; | ||
using UnityEngine; | ||
|
||
namespace Teyhota.CustomKits.Commands | ||
{ | ||
public class Command_AutoSave : IRocketCommand | ||
{ | ||
public static Dictionary<CSteamID, string> AutoSave = new Dictionary<CSteamID, string>(); | ||
|
||
public AllowedCaller AllowedCaller => AllowedCaller.Player; | ||
|
||
public string Name => "autosave"; | ||
|
||
public string Help => "Toggle Auto-save"; | ||
|
||
public string Syntax => "<kit name>"; | ||
|
||
public List<string> Aliases => new List<string>() { "asave" }; | ||
|
||
public List<string> Permissions => new List<string> { "ck.autosave" }; | ||
|
||
|
||
public void Execute(IRocketPlayer caller, string[] command) | ||
{ | ||
UnturnedPlayer callr = (UnturnedPlayer)caller; | ||
string kitName = null; | ||
|
||
if (command.Length == 0) | ||
{ | ||
if (!AutoSave.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 | ||
{ | ||
AutoSave.Remove(callr.CSteamID); | ||
UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("autosave_off"), Color.green); | ||
return; | ||
} | ||
} | ||
|
||
int slotCount = SlotManager.Slots[callr.CSteamID.m_SteamID].Count; | ||
|
||
if (kitName == "*") | ||
{ | ||
UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("unsupported_character", "*"), Color.red); | ||
return; | ||
} | ||
|
||
if (KitManager.KitCount(callr, KitManager.Kits) >= slotCount && !caller.IsAdmin) | ||
{ | ||
UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("no_kits_left"), Color.red); | ||
return; | ||
} | ||
|
||
if (!AutoSave.ContainsKey(callr.CSteamID)) | ||
{ | ||
AutoSave.Add(callr.CSteamID, kitName); | ||
UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("autosave_on", kitName), Color.green); | ||
} | ||
else | ||
{ | ||
AutoSave[callr.CSteamID] = kitName; | ||
UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("autosave_on", kitName), Color.green); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System.Collections.Generic; | ||
using Rocket.Unturned.Chat; | ||
using Rocket.Unturned.Player; | ||
using Rocket.API; | ||
using Steamworks; | ||
using UnityEngine; | ||
|
||
namespace Teyhota.CustomKits.Commands | ||
{ | ||
public class Command_AutoSkills : IRocketCommand | ||
{ | ||
public static List<CSteamID> AutoSkills = new List<CSteamID>(); | ||
|
||
public AllowedCaller AllowedCaller => AllowedCaller.Player; | ||
|
||
public string Name => "autoskills"; | ||
|
||
public string Help => "Toggle Auto-maxskills"; | ||
|
||
public string Syntax => string.Empty; | ||
|
||
public List<string> Aliases => new List<string>() { "askills" }; | ||
|
||
public List<string> Permissions => new List<string> { "ck.autoskills" }; | ||
|
||
|
||
public void Execute(IRocketPlayer caller, string[] command) | ||
{ | ||
UnturnedPlayer callr = (UnturnedPlayer)caller; | ||
|
||
if (AutoSkills.Contains(callr.CSteamID)) | ||
{ | ||
AutoSkills.Remove(callr.CSteamID); | ||
UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("autoskills_off"), Color.green); | ||
} | ||
else | ||
{ | ||
AutoSkills.Add(callr.CSteamID); | ||
UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("autoskills_on"), Color.green); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
using System.Collections.Generic; | ||
using System; | ||
using Rocket.Unturned.Chat; | ||
using Rocket.Unturned.Player; | ||
using Rocket.API; | ||
using UnityEngine; | ||
|
||
namespace Teyhota.CustomKits.Commands | ||
{ | ||
public class Command_ClearInventory : IRocketCommand | ||
{ | ||
public AllowedCaller AllowedCaller => AllowedCaller.Both; | ||
|
||
public string Name => "clearinventory"; | ||
|
||
public string Help => "Clear your (or someone else's) inventory"; | ||
|
||
public string Syntax => "[player]"; | ||
|
||
public List<string> Aliases => new List<string>() { "ci" }; | ||
|
||
public List<string> Permissions => new List<string> { "ck.clearinventory" }; | ||
|
||
public const string OTHER_PERM = "ck.clearinventory.other"; | ||
public const string BYPASS_PERM = "ck.clearinventory.bypass"; | ||
|
||
|
||
public void Execute(IRocketPlayer caller, string[] command) | ||
{ | ||
if (command.Length == 0) | ||
{ | ||
if (caller is ConsolePlayer) | ||
{ | ||
Plugin.CustomKitsPlugin.Write("<player>", ConsoleColor.Red); | ||
return; | ||
} | ||
|
||
UnturnedPlayer callr = (UnturnedPlayer)caller; | ||
|
||
InventoryManager.Clear(callr); | ||
|
||
UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("inventory_cleared")); | ||
} | ||
|
||
if (command.Length == 1) | ||
{ | ||
UnturnedPlayer toPlayer = UnturnedPlayer.FromName(command[0]); | ||
|
||
if (toPlayer.HasPermission(BYPASS_PERM)) | ||
{ | ||
UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("ci_bypass", toPlayer.CharacterName), Color.red); | ||
return; | ||
} | ||
|
||
if (caller is ConsolePlayer) | ||
{ | ||
if (toPlayer == null) | ||
{ | ||
Plugin.CustomKitsPlugin.Write(Plugin.CustomKitsPlugin.Instance.Translate("player_doesn't_exist", command[0]), ConsoleColor.Red); | ||
return; | ||
} | ||
|
||
InventoryManager.Clear(toPlayer); | ||
|
||
Plugin.CustomKitsPlugin.Write(Plugin.CustomKitsPlugin.Instance.Translate("inventory_cleared_other", toPlayer.CharacterName), ConsoleColor.Cyan); | ||
return; | ||
} | ||
|
||
if (caller.HasPermission(OTHER_PERM)) | ||
{ | ||
if (toPlayer == null) | ||
{ | ||
UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("player_doesn't_exist", command[0]), Color.red); | ||
return; | ||
} | ||
|
||
InventoryManager.Clear(toPlayer); | ||
|
||
UnturnedChat.Say(toPlayer, Plugin.CustomKitsPlugin.Instance.Translate("inventory_cleared")); | ||
UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("inventory_cleared_other", toPlayer.CharacterName)); | ||
} | ||
else | ||
{ | ||
UnturnedChat.Say(caller, "You do not have permissions to execute this command.", Color.red); | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.