diff --git a/README.md b/README.md index 43b1bcc..a031477 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ - Ability to look up an item's ID by typing ``/parseid [ITEM_LINK]`` in game - Bid option: OS PRIO - Sound plays when loot is announced -- Datamine items by typing ``/datamine`` in game # shootyepgp diff --git a/extra_features.lua b/extra_features.lua new file mode 100644 index 0000000..4ecbae4 --- /dev/null +++ b/extra_features.lua @@ -0,0 +1,64 @@ +-- PARSE ID +SLASH_PARSEID1 = "/parseid" + +SlashCmdList["PARSEID"] = function(msg) + + local _, _, itemID = string.find(msg, "Hitem:(%d+)") + + if itemID then + DEFAULT_CHAT_FRAME:AddMessage("Item ID is: " .. itemID) + else + DEFAULT_CHAT_FRAME:AddMessage( + "No item ID found. Make sure to shift-click an actual item link.\nReceived: " .. (msg or "nil") + ) + end +end + + +-- SHOW RANK IN ROLL +-- Hook the chat event for roll results +local origSystemMessage = ChatFrame_MessageEventHandler +function ChatFrame_MessageEventHandler(self, event, message, ...) + -- Check if it's a roll message + if event == "CHAT_MSG_SYSTEM" then + -- Pattern to match roll messages: "PlayerName rolls X (1-Y)" + local playerName, roll, range = string.match(message, "^([^%s]+) rolls (%d+) %(1%-(%d+)%)$") + + if playerName and roll then + -- Get player's guild information + local guildRank = GetGuildRankForPlayer(playerName) + + if guildRank then + -- Modify message to include guild rank + local newMessage = playerName .. " <" .. guildRank .. "> rolls " .. roll .. " (1-" .. range .. ")" + -- Call original handler with modified message + return origSystemMessage(self, event, newMessage, ...) + end + end + end + + -- Call original handler for all other messages + return origSystemMessage(self, event, message, ...) +end + +-- Helper function to get guild rank for a player +function GetGuildRankForPlayer(playerName) + -- Make sure we're in a guild + if not IsInGuild() then + return nil + end + + -- Check if player is in our guild + local numGuildMembers = GetNumGuildMembers() + for i = 1, numGuildMembers do + local name, rank = GetGuildRosterInfo(i) + -- Strip realm name if present + name = string.match(name, "([^-]+)") or name + + if name == playerName then + return rank + end + end + + return nil +end \ No newline at end of file diff --git a/shootyepgp.lua b/shootyepgp.lua index dc9f047..f181754 100644 --- a/shootyepgp.lua +++ b/shootyepgp.lua @@ -1,24 +1,3 @@ --- 1) Register a new slash command /parseid -SLASH_PARSEID1 = "/parseid" - --- 2) Command handler function -SlashCmdList["PARSEID"] = function(msg) - -- Example input might be: - -- |cffa335ee|Hitem:12345:0:0:0|h[Some Item]|h|r - - -- Use string.find to capture the digits after "Hitem:" - local _, _, itemID = string.find(msg, "Hitem:(%d+)") - - if itemID then - DEFAULT_CHAT_FRAME:AddMessage("Item ID is: " .. itemID) - else - DEFAULT_CHAT_FRAME:AddMessage( - "No item ID found. Make sure to shift-click an actual item link.\nReceived: " .. (msg or "nil") - ) - end -end - - sepgp = AceLibrary("AceAddon-2.0"):new("AceConsole-2.0", "AceHook-2.1", "AceDB-2.0", "AceDebug-2.0", "AceEvent-2.0", "AceModuleCore-2.0", "FuBarPlugin-2.0") sepgp:SetModuleMixins("AceDebug-2.0") local D = AceLibrary("Dewdrop-2.0") diff --git a/shootyepgp.toc b/shootyepgp.toc index 49ec1b9..f99552f 100644 --- a/shootyepgp.toc +++ b/shootyepgp.toc @@ -7,7 +7,7 @@ ## X-Website: https://github.com/cinecom/shootyepgp/ ## X-Category: Guild ## X-Credits: shooty, Qcat(zhCN) -## Version: 3.85 +## Version: 3.86 ## X-Alpha: ## OptionalDeps: Ace2 ## SavedVariables: sepgp_saychannel, sepgp_groupbyclass, sepgp_groupbyarmor, sepgp_groupbyrole, sepgp_raidonly, sepgp_dbver, sepgp_debug, sepgp_fubar @@ -44,3 +44,4 @@ loot.lua reserves.lua alts.lua logs.lua +extra_features.lua