From a0abf8b7e1f20a1d19cddf3119ce0db7e2ad9928 Mon Sep 17 00:00:00 2001 From: Horyoshi <42314202+Cinecom@users.noreply.github.com> Date: Thu, 13 Feb 2025 16:05:17 +0100 Subject: [PATCH] Update shootyepgp.lua --- shootyepgp.lua | 87 +++++++++++++++++++++++++++++++------------------- 1 file changed, 55 insertions(+), 32 deletions(-) diff --git a/shootyepgp.lua b/shootyepgp.lua index 8d057c7..6cf416e 100644 --- a/shootyepgp.lua +++ b/shootyepgp.lua @@ -1197,41 +1197,58 @@ function sepgp:addonMessage(message,channel,sender) SendAddonMessage(self.VARS.prefix,message,channel,sender) end +epgp_public = true + +SLASH_PUBLIC1 = "/public" +SlashCmdList["PUBLIC"] = function(msg) + if msg == "off" then + epgp_public = false + DEFAULT_CHAT_FRAME:AddMessage("Public Bid |cffff0000OFF|r") + elseif msg == "on" then + epgp_public = true + DEFAULT_CHAT_FRAME:AddMessage("Public Bid |cff00ff00ON|r") + else + DEFAULT_CHAT_FRAME:AddMessage("Append with |cff00ff00ON|r or |cffff0000OFF|r") + end +end + + function sepgp:addonComms(prefix, message, channel, sender) if prefix ~= self.VARS.prefix then return end if sender == self._playerName then return end if type(message) ~= "string" then return end - -- Process BIDITEM messages to set bid item info on all clients and auto open bids window - if string.sub(message, 1, 8) == "BIDITEM;" then - sepgp:clearBids(true) -- Clear the bid window for everyone - local s, e, bidItemLink = string.find(message, "BIDITEM;(.+)") - if bidItemLink then - sepgp.bid_item = sepgp.bid_item or {} - sepgp.bid_item.linkFull = bidItemLink - local found, _, itemColor, itemString, itemName = string.find(bidItemLink, "^(|c%x+)|H(.+)|h(%[.+%])") - if found then - sepgp.bid_item.link = itemString - sepgp.bid_item.name = string.format("%s%s|r", itemColor, itemName) + -- Process BIDITEM messages to set bid item info on all clients and auto open bids window + if string.sub(message, 1, 8) == "BIDITEM;" then + sepgp:clearBids(true) -- Clear the bid window for everyone + local s, e, bidItemLink = string.find(message, "BIDITEM;(.+)") + if bidItemLink then + sepgp.bid_item = sepgp.bid_item or {} + sepgp.bid_item.linkFull = bidItemLink + local found, _, itemColor, itemString, itemName = string.find(bidItemLink, "^(|c%x+)|H(.+)|h(%[.+%])") + if found then + sepgp.bid_item.link = itemString + sepgp.bid_item.name = string.format("%s%s|r", itemColor, itemName) + end + -- Auto-open the bids window on all clients + sepgp_bids:Toggle(true) end - -- Auto-open the bids window on all clients - sepgp_bids:Toggle(true) + return end - return - end - -- Process BID messages from addon channel - if string.sub(message, 1, 4) == "BID;" then - local s, e, bidType, bidder = string.find(message, "BID;([^;]+);([^;]+)") - if bidType and bidder then - -- Check if this bidder's bid is already recorded; if so, ignore the duplicate. - if bids_blacklist[bidder] then - return + -- Process BID messages from addon channel + if string.sub(message, 1, 4) == "BID;" then + local s, e, bidType, bidder = string.find(message, "BID;([^;]+);([^;]+)") + if bidType and bidder then + -- Check if this bidder's bid is already recorded; if so, ignore the duplicate. + if bids_blacklist[bidder] then + return + end + self:captureBid(bidType, bidder) end - self:captureBid(bidType, bidder) + return end - return - end + local name_g, class, rank = self:verifyGuildMember(sender, true) if not name_g then return end @@ -2055,12 +2072,14 @@ lootBid.msos = {".*[oO][sS][pP][rR][iI][oO].*"} function sepgp:captureBid(text, sender) - -- For any bid we immediately ensure the bids window is shown. + -- For any bid, immediately open the bids window. if not running_bid then running_bid = true sepgp_bids:Toggle(true) end - if not sepgp.bid_item or not sepgp.bid_item.link then return end + if not sepgp.bid_item or not sepgp.bid_item.link then + return + end local mskw_found, oskw_found, msoskw_found for _, f in ipairs(lootBid.ms) do @@ -2083,14 +2102,17 @@ function sepgp:captureBid(text, sender) end if (mskw_found or oskw_found or msoskw_found) and not bids_blacklist[sender] then - -- Forward bid via addon channel (so that all raid members get it) - if string.sub(text, 1, 4) ~= "BID;" then - local bidType = mskw_found and "+" or oskw_found and "-" or msoskw_found and "OSPRIO" or "" - if bidType ~= "" then - self:addonMessage("BID;" .. bidType .. ";" .. sender, "RAID") + -- Only forward the bid if public bidding is enabled. + if epgp_public then + if string.sub(text, 1, 4) ~= "BID;" then + local bidType = mskw_found and "+" or oskw_found and "-" or msoskw_found and "OSPRIO" or "" + if bidType ~= "" then + self:addonMessage("BID;" .. bidType .. ";" .. sender, "RAID") + end end end + local prio_flag = "OSPRIO" for i = 1, GetNumGuildMembers() do local name, _, _, _, class, _, note, officernote, _, _ = GetGuildRosterInfo(i) @@ -2126,6 +2148,7 @@ end + function sepgp:clearBids(reset) if reset~=nil then self:debugPrint(L["Clearing old Bids"])