Update shootyepgp.lua
This commit is contained in:
+144
-302
@@ -1,119 +1,12 @@
|
||||
SLASH_DATAMINE1 = "/datamine"
|
||||
|
||||
local function GetItemByID(id, retry)
|
||||
local itemName, _, itemQuality = GetItemInfo(id)
|
||||
|
||||
if itemName then
|
||||
-- Get item color based on quality
|
||||
local itemColor = ITEM_QUALITY_COLORS[itemQuality] and ITEM_QUALITY_COLORS[itemQuality].hex or "|cffffffff"
|
||||
local coloredItemLink = itemColor .. "|Hitem:" .. id .. ":0:0:0:0:0:0:0|h[" .. itemName .. "]|h|r"
|
||||
DEFAULT_CHAT_FRAME:AddMessage("Item: " .. coloredItemLink)
|
||||
else
|
||||
if not retry then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cffff9900[Info]|r Try one more time. If it fails again try another ID")
|
||||
GameTooltip:SetHyperlink("item:" .. id) -- Force a server query
|
||||
end
|
||||
|
||||
local frame = CreateFrame("Frame")
|
||||
frame:RegisterEvent("GET_ITEM_INFO_RECEIVED")
|
||||
frame:SetScript("OnEvent", function(self, event, itemID, success)
|
||||
if itemID == id then
|
||||
local newItemName, _, newItemQuality = GetItemInfo(itemID)
|
||||
if newItemName then
|
||||
local newItemColor = ITEM_QUALITY_COLORS[newItemQuality] and ITEM_QUALITY_COLORS[newItemQuality].hex or "|cffffffff"
|
||||
local newColoredItemLink = newItemColor .. "|Hitem:" .. itemID .. ":0:0:0:0:0:0:0|h[" .. newItemName .. "]|h|r"
|
||||
DEFAULT_CHAT_FRAME:AddMessage("Item: " .. newColoredItemLink)
|
||||
else
|
||||
if not retry then
|
||||
GetItemByID(itemID, true) -- Retry once
|
||||
else
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000[Error]|r Failed to fetch item data.")
|
||||
end
|
||||
end
|
||||
frame:UnregisterEvent("GET_ITEM_INFO_RECEIVED")
|
||||
frame:SetScript("OnEvent", nil)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
local function CreateItemIDFrame()
|
||||
|
||||
|
||||
local frame = CreateFrame("Frame", "ItemIDFrame", UIParent)
|
||||
frame:SetWidth(200)
|
||||
frame:SetHeight(100)
|
||||
frame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
|
||||
frame:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = true, tileSize = 16, edgeSize = 16, insets = { left = 4, right = 4, top = 4, bottom = 4 }})
|
||||
frame:SetBackdropColor(0, 0, 0, 0.8)
|
||||
frame:EnableMouse(true)
|
||||
frame:SetMovable(true)
|
||||
frame:RegisterForDrag("LeftButton")
|
||||
frame:SetScript("OnDragStart", function() ItemIDFrame:StartMoving() end)
|
||||
frame:SetScript("OnDragStop", function() ItemIDFrame:StopMovingOrSizing() end)
|
||||
|
||||
local title = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
title:SetPoint("TOPLEFT", frame, "TOPLEFT", 10, -10)
|
||||
title:SetText("DATA MINER")
|
||||
|
||||
local editBox = CreateFrame("EditBox", nil, frame, "InputBoxTemplate")
|
||||
editBox:SetWidth(120)
|
||||
editBox:SetHeight(20)
|
||||
editBox:SetPoint("TOP", frame, "TOP", 0, -40)
|
||||
editBox:SetAutoFocus(false)
|
||||
editBox:SetNumeric(true)
|
||||
|
||||
local function AdjustItemID(delta)
|
||||
local currentID = tonumber(editBox:GetText()) or 0
|
||||
editBox:SetText(currentID + delta)
|
||||
end
|
||||
|
||||
local upButton = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
|
||||
upButton:SetWidth(20)
|
||||
upButton:SetHeight(20)
|
||||
upButton:SetPoint("LEFT", editBox, "RIGHT", 5, 0)
|
||||
upButton:SetText("+")
|
||||
upButton:SetScript("OnClick", function() AdjustItemID(1) end)
|
||||
|
||||
local downButton = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
|
||||
downButton:SetWidth(20)
|
||||
downButton:SetHeight(20)
|
||||
downButton:SetPoint("RIGHT", editBox, "LEFT", -5, 0)
|
||||
downButton:SetText("-")
|
||||
downButton:SetScript("OnClick", function() AdjustItemID(-1) end)
|
||||
local queryButton = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
|
||||
queryButton:SetWidth(80)
|
||||
queryButton:SetHeight(20)
|
||||
queryButton:SetPoint("BOTTOM", frame, "BOTTOM", 0, 10)
|
||||
queryButton:SetText("Query Item")
|
||||
queryButton:SetScript("OnClick", function()
|
||||
local itemID = tonumber(editBox:GetText())
|
||||
if itemID then GetItemByID(itemID, false) end
|
||||
end)
|
||||
|
||||
local closeButton = CreateFrame("Button", nil, frame, "UIPanelCloseButton")
|
||||
closeButton:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -5, -5)
|
||||
closeButton:SetScript("OnClick", function() frame:Hide() end)
|
||||
|
||||
frame:Hide()
|
||||
return frame
|
||||
end
|
||||
|
||||
local itemIDFrame = CreateItemIDFrame()
|
||||
|
||||
SlashCmdList["DATAMINE"] = function(msg)
|
||||
if itemIDFrame:IsShown() then
|
||||
itemIDFrame:Hide()
|
||||
else
|
||||
itemIDFrame:Show()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- FUNCTION TO CATCH ITEM ID
|
||||
-- 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
|
||||
@@ -1197,102 +1090,52 @@ 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")
|
||||
function sepgp:addonComms(prefix,message,channel,sender)
|
||||
if not prefix == self.VARS.prefix then return end -- we don't care for messages from other addons
|
||||
if sender == self._playerName then return end -- we don't care for messages from ourselves
|
||||
local name_g,class,rank = self:verifyGuildMember(sender,true)
|
||||
if not (name_g) then return end -- only accept messages from guild members
|
||||
local who,what,amount
|
||||
for name,epgp,change in string.gfind(message,"([^;]+);([^;]+);([^;]+)") do
|
||||
who=name
|
||||
what=epgp
|
||||
amount=tonumber(change)
|
||||
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)
|
||||
end
|
||||
-- Auto-open the bids window on all clients
|
||||
sepgp_bids:Toggle(true)
|
||||
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
|
||||
end
|
||||
self:captureBid(bidType, bidder)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local name_g, class, rank = self:verifyGuildMember(sender, true)
|
||||
if not name_g then return end
|
||||
local who, what, amount
|
||||
for name, epgp, change in string.gfind(message, "([^;]+);([^;]+);([^;]+)") do
|
||||
who = name
|
||||
what = epgp
|
||||
amount = tonumber(change)
|
||||
end
|
||||
if who and what and amount then
|
||||
if (who) and (what) and (amount) then
|
||||
local msg
|
||||
local for_main = (sepgp_main and (who == sepgp_main))
|
||||
if (who == self._playerName) or for_main then
|
||||
if (who == self._playerName) or (for_main) then
|
||||
if what == "EP" then
|
||||
if amount < 0 then
|
||||
msg = string.format(L["You have received a %d EP penalty."], amount)
|
||||
msg = string.format(L["You have received a %d EP penalty."],amount)
|
||||
else
|
||||
msg = string.format(L["You have been awarded %d EP."], amount)
|
||||
msg = string.format(L["You have been awarded %d EP."],amount)
|
||||
end
|
||||
elseif what == "GP" then
|
||||
msg = string.format(L["You have gained %d GP."], amount)
|
||||
msg = string.format(L["You have gained %d GP."],amount)
|
||||
end
|
||||
elseif who == "ALL" and what == "DECAY" then
|
||||
msg = string.format(L["%s%% decay to EP and GP."], amount)
|
||||
msg = string.format(L["%s%% decay to EP and GP."],amount)
|
||||
elseif who == "RAID" and what == "AWARD" then
|
||||
msg = string.format(L["%d EP awarded to Raid."], amount)
|
||||
msg = string.format(L["%d EP awarded to Raid."],amount)
|
||||
elseif who == "RESERVES" and what == "AWARD" then
|
||||
msg = string.format(L["%d EP awarded to Reserves."], amount)
|
||||
msg = string.format(L["%d EP awarded to Reserves."],amount)
|
||||
elseif who == "VERSION" then
|
||||
local out_of_date, version_type = self:parseVersion(self._versionString, what)
|
||||
if out_of_date and self._newVersionNotification == nil then
|
||||
self._newVersionNotification = true
|
||||
self:defaultPrint(string.format(L["New %s version available: |cff00ff00%s|r"], version_type, what))
|
||||
self:defaultPrint(string.format(L["Visit https://github.com/Cinecom/shootyepgp/ to update."], self._websiteString))
|
||||
local out_of_date, version_type = self:parseVersion(self._versionString,what)
|
||||
if (out_of_date) and self._newVersionNotification == nil then
|
||||
self._newVersionNotification = true -- only inform once per session
|
||||
self:defaultPrint(string.format(L["New %s version available: |cff00ff00%s|r"],version_type,what))
|
||||
self:defaultPrint(string.format(L["Visit %s to update."],self._websiteString))
|
||||
end
|
||||
if IsGuildLeader() then
|
||||
if (IsGuildLeader()) then
|
||||
self:shareSettings()
|
||||
end
|
||||
elseif who == "SETTINGS" then
|
||||
for progress, discount, decay, minep, alts, altspct in string.gfind(what, "([^:]+):([^:]+):([^:]+):([^:]+):([^:]+):([^:]+)") do
|
||||
for progress,discount,decay,minep,alts,altspct in string.gfind(what, "([^:]+):([^:]+):([^:]+):([^:]+):([^:]+):([^:]+)") do
|
||||
discount = tonumber(discount)
|
||||
decay = tonumber(decay)
|
||||
minep = tonumber(minep)
|
||||
alts = (alts == "true")
|
||||
alts = (alts == "true") and true or false
|
||||
altspct = tonumber(altspct)
|
||||
local settings_notice
|
||||
if progress and progress ~= sepgp_progress then
|
||||
@@ -1301,8 +1144,8 @@ function sepgp:addonComms(prefix, message, channel, sender)
|
||||
end
|
||||
if discount and discount ~= sepgp_discount then
|
||||
sepgp_discount = discount
|
||||
if settings_notice then
|
||||
settings_notice = settings_notice .. L[", offspec price %"]
|
||||
if (settings_notice) then
|
||||
settings_notice = settings_notice..L[", offspec price %"]
|
||||
else
|
||||
settings_notice = L["New offspec price %"]
|
||||
end
|
||||
@@ -1314,9 +1157,9 @@ function sepgp:addonComms(prefix, message, channel, sender)
|
||||
end
|
||||
if decay and decay ~= sepgp_decay then
|
||||
sepgp_decay = decay
|
||||
if admin() then
|
||||
if settings_notice then
|
||||
settings_notice = settings_notice .. L[", decay %"]
|
||||
if (admin()) then
|
||||
if (settings_notice) then
|
||||
settings_notice = settings_notice..L[", decay %"]
|
||||
else
|
||||
settings_notice = L["New decay %"]
|
||||
end
|
||||
@@ -1324,46 +1167,41 @@ function sepgp:addonComms(prefix, message, channel, sender)
|
||||
end
|
||||
if alts ~= nil and alts ~= sepgp_altspool then
|
||||
sepgp_altspool = alts
|
||||
if admin() then
|
||||
if settings_notice then
|
||||
settings_notice = settings_notice .. L[", alts"]
|
||||
if (admin()) then
|
||||
if (settings_notice) then
|
||||
settings_notice = settings_notice..L[", alts"]
|
||||
else
|
||||
settings_notice = L["New Alts"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if altspct and altspct ~= sepgp_altpercent then
|
||||
sepgp_altpercent = altspct
|
||||
if admin() then
|
||||
if settings_notice then
|
||||
settings_notice = settings_notice .. L[", alts ep %"]
|
||||
if (admin()) then
|
||||
if (settings_notice) then
|
||||
settings_notice = settings_notice..L[", alts ep %"]
|
||||
else
|
||||
settings_notice = L["New Alts EP %"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if settings_notice and settings_notice ~= "" then
|
||||
local sender_rank = string.format("%s(%s)", C:Colorize(BC:GetHexColor(class), sender), rank)
|
||||
settings_notice = settings_notice .. string.format(L[" settings accepted from %s"], sender_rank)
|
||||
if (settings_notice) and settings_notice ~= "" then
|
||||
local sender_rank = string.format("%s(%s)",C:Colorize(BC:GetHexColor(class),sender),rank)
|
||||
settings_notice = settings_notice..string.format(L[" settings accepted from %s"],sender_rank)
|
||||
self:defaultPrint(settings_notice)
|
||||
self._options.args["progress_tier_header"].name = string.format(L["Progress Setting: %s"], sepgp_progress)
|
||||
self._options.args["set_discount_header"].name = string.format(L["Offspec Price: %s%%"], sepgp_discount * 100)
|
||||
self._options.args["set_min_ep_header"].name = string.format(L["Minimum EP: %s"], sepgp_minep)
|
||||
self._options.args["progress_tier_header"].name = string.format(L["Progress Setting: %s"],sepgp_progress)
|
||||
self._options.args["set_discount_header"].name = string.format(L["Offspec Price: %s%%"],sepgp_discount*100)
|
||||
self._options.args["set_min_ep_header"].name = string.format(L["Minimum EP: %s"],sepgp_minep)
|
||||
end
|
||||
end
|
||||
end
|
||||
if msg and msg ~= "" then
|
||||
if msg and msg~="" then
|
||||
self:defaultPrint(msg)
|
||||
self:my_epgp(for_main)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function sepgp:shareSettings(force)
|
||||
local now = GetTime()
|
||||
if self._lastSettingsShare == nil or (now - self._lastSettingsShare > 30) or (force) then
|
||||
@@ -1725,17 +1563,16 @@ sepgp.defaultPosition = "RIGHT"
|
||||
sepgp.cannotDetachTooltip = true
|
||||
sepgp.tooltipHiddenWhenEmpty = false
|
||||
sepgp.independentProfile = true
|
||||
function sepgp:OnTooltipUpdate()
|
||||
local baseHint = L["|cffffff00Click|r to toggle Standings.%s \n|cffffff00Right-Click|r for Options."] or "|cffffff00Click|r to toggle Standings.%s \n|cffffff00Right-Click|r for Options."
|
||||
local extraHint = ""
|
||||
if admin() then
|
||||
extraHint = L[" \n|cffffff00Ctrl+Click|r to toggle Reserves. \n|cffffff00Alt+Click|r to toggle Bids. \n|cffffff00Shift+Click|r to toggle Loot. \n|cffffff00Ctrl+Alt+Click|r to toggle Alts. \n|cffffff00Ctrl+Shift+Click|r to toggle Logs."] or " \nCtrl+Click to toggle Reserves. \nAlt+Click to toggle Bids. \nShift+Click to toggle Loot. \nCtrl+Alt+Click to toggle Alts. \nCtrl+Shift+Click to toggle Logs."
|
||||
else
|
||||
extraHint = L[" \n|cffffff00Alt+Click|r to toggle Bids."] or " \n|cffffff00Alt+Click|r to toggle Bids."
|
||||
end
|
||||
T:SetHint(string.format(baseHint, extraHint))
|
||||
end
|
||||
|
||||
function sepgp:OnTooltipUpdate()
|
||||
local hint = L["|cffffff00Click|r to toggle Standings.%s \n|cffffff00Right-Click|r for Options."]
|
||||
if (admin()) then
|
||||
hint = string.format(hint,L[" \n|cffffff00Ctrl+Click|r to toggle Reserves. \n|cffffff00Alt+Click|r to toggle Bids. \n|cffffff00Shift+Click|r to toggle Loot. \n|cffffff00Ctrl+Alt+Click|r to toggle Alts. \n|cffffff00Ctrl+Shift+Click|r to toggle Logs."])
|
||||
else
|
||||
hint = string.format(hint,"")
|
||||
end
|
||||
T:SetHint(hint)
|
||||
end
|
||||
|
||||
function sepgp:OnClick()
|
||||
local is_admin = admin()
|
||||
@@ -1747,14 +1584,13 @@ function sepgp:OnClick()
|
||||
sepgp_reserves:Toggle()
|
||||
elseif (IsShiftKeyDown() and is_admin) then
|
||||
sepgp_loot:Toggle()
|
||||
elseif (IsAltKeyDown()) then
|
||||
elseif (IsAltKeyDown() and is_admin) then
|
||||
sepgp_bids:Toggle()
|
||||
else
|
||||
sepgp_standings:Toggle()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function sepgp:SetRefresh(flag)
|
||||
needRefresh = flag
|
||||
if (flag) then
|
||||
@@ -2015,56 +1851,51 @@ lootCall.bs = { -- blacklist
|
||||
}
|
||||
function sepgp:captureLootCall(text, sender)
|
||||
if not (string.find(text, "|Hitem:", 1, true)) then return end
|
||||
local linkstriptext, count = string.gsub(text, "|c%x+|H[eimt:%d]+|h%[[%w%s',%-]+%]|h|r", " ; ")
|
||||
local linkstriptext, count = string.gsub(text,"|c%x+|H[eimt:%d]+|h%[[%w%s',%-]+%]|h|r"," ; ")
|
||||
if count > 1 then return end
|
||||
local lowtext = string.lower(linkstriptext)
|
||||
local whisperkw_found, mskw_found, oskw_found, link_found, blacklist_found
|
||||
for _, f in ipairs(lootCall.bs) do
|
||||
blacklist_found = string.find(lowtext, f)
|
||||
if blacklist_found then return end
|
||||
for _,f in ipairs(lootCall.bs) do
|
||||
blacklist_found = string.find(lowtext,f)
|
||||
if (blacklist_found) then return end
|
||||
end
|
||||
local _, itemLink, itemColor, itemString, itemName
|
||||
for _, f in ipairs(lootCall.whisp) do
|
||||
whisperkw_found = string.find(lowtext, f)
|
||||
if whisperkw_found then break end
|
||||
for _,f in ipairs(lootCall.whisp) do
|
||||
whisperkw_found = string.find(lowtext,f)
|
||||
if (whisperkw_found) then break end
|
||||
end
|
||||
for _, f in ipairs(lootCall.ms) do
|
||||
mskw_found = string.find(lowtext, f)
|
||||
if mskw_found then break end
|
||||
for _,f in ipairs(lootCall.ms) do
|
||||
mskw_found = string.find(lowtext,f)
|
||||
if (mskw_found) then break end
|
||||
end
|
||||
for _, f in ipairs(lootCall.os) do
|
||||
oskw_found = string.find(lowtext, f)
|
||||
if oskw_found then break end
|
||||
for _,f in ipairs(lootCall.os) do
|
||||
oskw_found = string.find(lowtext,f)
|
||||
if (oskw_found) then break end
|
||||
end
|
||||
if whisperkw_found or mskw_found or oskw_found then
|
||||
_,_,itemLink = string.find(text, "(|c%x+|H[eimt:%d]+|h%[[%w%s',%-]+%]|h|r)")
|
||||
if itemLink and itemLink ~= "" then
|
||||
if (whisperkw_found) or (mskw_found) or (oskw_found) then
|
||||
_,_,itemLink = string.find(text,"(|c%x+|H[eimt:%d]+|h%[[%w%s',%-]+%]|h|r)")
|
||||
if (itemLink) and (itemLink ~= "") then
|
||||
link_found, _, itemColor, itemString, itemName = string.find(itemLink, "^(|c%x+)|H(.+)|h(%[.+%])")
|
||||
end
|
||||
if link_found then
|
||||
if (link_found) then
|
||||
local quality = hexColorQuality[itemColor] or -1
|
||||
if quality >= 3 then
|
||||
if sender == self._playerName then
|
||||
if (quality >= 3) then
|
||||
if (IsRaidLeader() or self:lootMaster()) and (sender == self._playerName) then
|
||||
self:clearBids(true)
|
||||
sepgp.bid_item = {}
|
||||
sepgp.bid_item.link = itemString
|
||||
sepgp.bid_item.linkFull = itemLink
|
||||
sepgp.bid_item.name = string.format("%s%s|r", itemColor, itemName)
|
||||
self:ScheduleEvent("shootyepgpBidTimeout", self.clearBids, 300, self)
|
||||
sepgp.bid_item.name = string.format("%s%s|r",itemColor,itemName)
|
||||
self:ScheduleEvent("shootyepgpBidTimeout",self.clearBids,300,self)
|
||||
running_bid = true
|
||||
self:debugPrint("Capturing Bids for 5min.")
|
||||
sepgp_bids:Toggle(true)
|
||||
-- Broadcast BIDITEM info so all clients open their bids window.
|
||||
self:addonMessage("BIDITEM;" .. itemLink, "RAID")
|
||||
end
|
||||
self:bidPrint(itemLink, sender, mskw_found, oskw_found, whisperkw_found)
|
||||
self:bidPrint(itemLink,sender,mskw_found,oskw_found,whisperkw_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
local lootBid = {}
|
||||
lootBid.ms = {"(%+)",".+(%+).*",".*(%+).+",".*(%+).*","(ms)","(need)"}
|
||||
lootBid.os = {"(%-)",".+(%-).*",".*(%-).+",".*(%-).*","(os)","(greed)"}
|
||||
@@ -2072,28 +1903,29 @@ lootBid.msos = {".*[oO][sS][pP][rR][iI][oO].*"}
|
||||
|
||||
|
||||
function sepgp:captureBid(text, sender)
|
||||
-- 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 running_bid then return end
|
||||
if not (IsRaidLeader() or self:lootMaster()) then return end
|
||||
if not sepgp.bid_item.link then return end
|
||||
|
||||
local mskw_found, oskw_found, msoskw_found
|
||||
|
||||
-- Check for + (mainspec)
|
||||
for _, f in ipairs(lootBid.ms) do
|
||||
if string.find(text, f) then
|
||||
mskw_found = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
-- Check for - (offspec)
|
||||
for _, f in ipairs(lootBid.os) do
|
||||
if string.find(text, f) then
|
||||
oskw_found = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
-- Check for OSPRIO
|
||||
for _, f in ipairs(lootBid.msos) do
|
||||
if string.find(text, f) then
|
||||
msoskw_found = true
|
||||
@@ -2101,54 +1933,64 @@ function sepgp:captureBid(text, sender)
|
||||
end
|
||||
end
|
||||
|
||||
if (mskw_found or oskw_found or msoskw_found) and not bids_blacklist[sender] then
|
||||
-- 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
|
||||
if mskw_found or oskw_found or msoskw_found then
|
||||
if self:inRaid(sender) and not bids_blacklist[sender] then
|
||||
local prio_flag = "OSPRIO"
|
||||
for i = 1, GetNumGuildMembers() do
|
||||
local name, _, _, _, class, _, note, officernote, _, _ = GetGuildRosterInfo(i)
|
||||
if name == sender then
|
||||
local ep = (self:get_ep_v3(name, officernote) or 0)
|
||||
local gp = (self:get_gp_v3(name, officernote) or sepgp.VARS.basegp)
|
||||
local main_name
|
||||
|
||||
|
||||
local prio_flag = "OSPRIO"
|
||||
for i = 1, GetNumGuildMembers() do
|
||||
local name, _, _, _, class, _, note, officernote, _, _ = GetGuildRosterInfo(i)
|
||||
if name == sender then
|
||||
local ep = (self:get_ep_v3(name, officernote) or 0)
|
||||
local gp = (self:get_gp_v3(name, officernote) or sepgp.VARS.basegp)
|
||||
local main_name = ""
|
||||
if sepgp_altspool then
|
||||
local alt_main, alt_class, _, alt_officernote = self:parseAlt(name, officernote)
|
||||
if alt_main then
|
||||
ep = (self:get_ep_v3(alt_main, alt_officernote) or 0)
|
||||
gp = (self:get_gp_v3(alt_main, alt_officernote) or sepgp.VARS.basegp)
|
||||
main_name = alt_main
|
||||
-- If pooling alts into main's EPGP
|
||||
if sepgp_altspool then
|
||||
local alt_main, alt_class, _, alt_officernote = self:parseAlt(name, officernote)
|
||||
if alt_main then
|
||||
ep = (self:get_ep_v3(alt_main, alt_officernote) or 0)
|
||||
gp = (self:get_gp_v3(alt_main, alt_officernote) or sepgp.VARS.basegp)
|
||||
main_name = alt_main
|
||||
end
|
||||
end
|
||||
|
||||
-- Mark them so we don't double-add
|
||||
bids_blacklist[sender] = true
|
||||
|
||||
if mskw_found then
|
||||
-- It's a + (Mainspec)
|
||||
if main_name then
|
||||
table.insert(sepgp.bids_main, {name, class, ep, gp, ep / gp, main_name, ""})
|
||||
else
|
||||
table.insert(sepgp.bids_main, {name, class, ep, gp, ep / gp, "", ""})
|
||||
end
|
||||
|
||||
elseif oskw_found then
|
||||
-- It's a - (Offspec)
|
||||
if main_name then
|
||||
table.insert(sepgp.bids_off, {name, class, ep, gp, ep / gp, main_name, ""})
|
||||
else
|
||||
table.insert(sepgp.bids_off, {name, class, ep, gp, ep / gp, "", ""})
|
||||
end
|
||||
|
||||
elseif msoskw_found then
|
||||
-- It's OSPRIO -> Also place in the Offspec table,
|
||||
-- but with "OSPRIO" flag so we can detect it in the GUI
|
||||
if main_name then
|
||||
table.insert(sepgp.bids_off, {name, class, ep, gp, ep / gp, main_name, prio_flag})
|
||||
else
|
||||
table.insert(sepgp.bids_off, {name, class, ep, gp, ep / gp, "", prio_flag})
|
||||
end
|
||||
end
|
||||
|
||||
-- Refresh the bids window
|
||||
sepgp_bids:Toggle(true)
|
||||
return
|
||||
end
|
||||
|
||||
bids_blacklist[sender] = true
|
||||
|
||||
if mskw_found then
|
||||
table.insert(sepgp.bids_main, {name, class, ep, gp, ep / gp, main_name, ""})
|
||||
elseif oskw_found then
|
||||
table.insert(sepgp.bids_off, {name, class, ep, gp, ep / gp, main_name, ""})
|
||||
elseif msoskw_found then
|
||||
table.insert(sepgp.bids_off, {name, class, ep, gp, ep / gp, main_name, prio_flag})
|
||||
end
|
||||
|
||||
sepgp_bids:Toggle(true)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
function sepgp:clearBids(reset)
|
||||
if reset~=nil then
|
||||
self:debugPrint(L["Clearing old Bids"])
|
||||
|
||||
Reference in New Issue
Block a user