diff options
Diffstat (limited to 'Server/Plugins/Debuggers')
-rw-r--r-- | Server/Plugins/Debuggers/Debuggers.lua | 47 | ||||
-rw-r--r-- | Server/Plugins/Debuggers/Info.lua | 12 |
2 files changed, 59 insertions, 0 deletions
diff --git a/Server/Plugins/Debuggers/Debuggers.lua b/Server/Plugins/Debuggers/Debuggers.lua index 914da8036..4dfc55030 100644 --- a/Server/Plugins/Debuggers/Debuggers.lua +++ b/Server/Plugins/Debuggers/Debuggers.lua @@ -1031,6 +1031,28 @@ end +function HandleGetPropCmd(a_Split, a_Player) + local item = a_Player:GetInventory():GetEquippedItem() + if not(item.m_DebuggersCustomProp) then + a_Player:SendMessage("The custom property is not set.") + return true + end + local dispValue = string.gsub(item.m_DebuggersCustomProp, ".", + function(a_Char) + if (a_Char < " ") then + return string.byte(a_Char) + end + return a_Char + end + ) + a_Player:SendMessage(string.format("The custom property value is %d bytes: %s", string.len(item.m_DebuggersCustomProp), dispValue)) + return true +end + + + + + function HandleHungerCmd(a_Split, a_Player) a_Player:SendMessage("FoodLevel: " .. a_Player:GetFoodLevel()); a_Player:SendMessage("FoodSaturationLevel: " .. a_Player:GetFoodSaturationLevel()); @@ -1109,6 +1131,31 @@ end +function HandleSetPropCmd(a_Split, a_Player, a_EntireCmd) + if not(a_Split[2]) then + a_Player:SendMessageFatal("Missing an argument: the property value to set"); + return true + end + local valueToSet = a_EntireCmd:match("/setprop%s(.*)") + if not(valueToSet) then + a_Player:SendMessageFatal("Failed to extract the property value to set") + return true + end + valueToSet = valueToSet:gsub("\\([0-9][0-9][0-9])", string.char) + + local inv = a_Player:GetInventory() + local slotNum = inv:GetEquippedSlotNum() + local item = inv:GetEquippedItem() + item.m_DebuggersCustomProp = valueToSet + inv:SetHotbarSlot(slotNum, item) + a_Player:SendMessage("Custom property set to " .. valueToSet) + return true +end + + + + + function HandleSetLoreCmd(a_Split, a_Player, a_EntireCmd) if not(a_Split[2]) then a_Player:SendMessageFatal("Missing an argument: the lore to set"); diff --git a/Server/Plugins/Debuggers/Info.lua b/Server/Plugins/Debuggers/Info.lua index dcdcdd17f..c21865218 100644 --- a/Server/Plugins/Debuggers/Info.lua +++ b/Server/Plugins/Debuggers/Info.lua @@ -112,6 +112,12 @@ g_PluginInfo = Handler = HandleGetLoreCmd, HelpString = "Displays the exact Lore of currently held item (including non-printables)", }, + ["/getprop"] = + { + Permission = "debuggers", + Handler = HandleGetPropCmd, + HelpString = "Displays the custom cItem property of the currently held item", + }, ["/hunger"] = { Permission = "debuggers", @@ -190,6 +196,12 @@ g_PluginInfo = Handler = HandleSetLoreCmd, HelpString = "Sets the lore for the item currently in hand", }, + ["/setprop"] = + { + Permission = "debuggers", + Handler = HandleSetPropCmd, + HelpString = "Sets the custom property for the item currently in hand", + }, ["/spidey"] = { Permission = "debuggers", |