Add a countdown link on the bids window (admins).

Fix bid refresh when new bid call is done while a previous bid is active.
Fix closing tablets with Esc.
Add an item quality condition (rare+) to bid detection.
Fix GL reset, improve various option descriptions and addon messages.
This commit is contained in:
Road-block
2017-10-09 09:17:56 +03:00
parent 5223968831
commit 82e399ea16
6 changed files with 96 additions and 77 deletions
+46 -39
View File
@@ -4,9 +4,7 @@ local C = AceLibrary("Crayon-2.0")
local BC = AceLibrary("Babble-Class-2.2")
sepgp_bids = sepgp:NewModule("sepgp_bids", "AceDB-2.0")
sepgp_bids.tipOwner = CreateFrame("Frame","shootyepgp_bids_tipowner",UIParent)
sepgp_bids.tipOwner:Show()
sepgp_bids = sepgp:NewModule("sepgp_bids", "AceDB-2.0", "AceEvent-2.0")
function sepgp_bids:OnEnable()
if not T:IsRegistered("sepgp_bids") then
@@ -43,7 +41,7 @@ end
function sepgp_bids:setHideScript()
local detachedFrame, tablet
for i=1,4 do
tablet = getglobal(string.format("Tablet20DetachedFrame%d",1))
tablet = getglobal(string.format("Tablet20DetachedFrame%d",i))
if tablet and tablet.owner ~= nil and tablet.owner == "sepgp_bids" then
if not (tablet:GetScript("OnHide")) then
tablet:SetScript("OnHide",function()
@@ -64,54 +62,53 @@ function sepgp_bids:Toggle(forceShow)
T:ToggleLocked("sepgp_bids")
end
self:setHideScript()
--[[if not (sepgp:IsEventScheduled("shootyepgpBidRefresh")) then
sepgp:ScheduleRepeatingEvent("shootyepgpBidRefresh", self.Refresh, 5, self)
end]]
elseif (forceShow) then
sepgp_bids:Refresh()
else
T:Attach("sepgp_bids")
if GameTooltip:IsOwned(self.tipOwner) and GameTooltip:IsShown() then
GameTooltip:Hide()
end
--[[if (sepgp:IsEventScheduled("shootyepgpBidRefresh")) then
sepgp:CancelScheduledEvent("shootyepgpBidRefresh")
end]]
end
end
function sepgp_bids:lineTooltip(item,line)
if line and line.highlight then
if not sepgp:IsHooked(line.highlight,"Show") then
sepgp:SecureHook(line.highlight,"Show",function()
if not (GameTooltip:IsOwned(sepgp_bids.tipOwner) and GameTooltip:IsShown()) then
GameTooltip:SetOwner(sepgp_bids.tipOwner,"ANCHOR_CURSOR")
GameTooltip:SetHyperlink(item)
GameTooltip:Show()
end
end)
end
if not sepgp:IsHooked(line.highlight,"Hide") then
sepgp:SecureHook(line.highlight,"Hide",function()
if GameTooltip:IsOwned(sepgp_bids.tipOwner) and GameTooltip:IsShown() then
GameTooltip:Hide()
end
end)
end
end
end
function sepgp_bids:announceWinnerMS(name, pr)
if GetNumRaidMembers()>0 then
SendChatMessage(string.format("Highest MainSpec Bid is %s with %.03fPR",name,pr),"RAID")
SendChatMessage(string.format("Winning Mainspec Bid: %s (%.03f PR)",name,pr),"RAID")
end
end
function sepgp_bids:announceWinnerOS(name, pr)
if GetNumRaidMembers()>0 then
SendChatMessage(string.format("Highest OffSpec Bid is %s with %.03fPR",name,pr),"RAID")
SendChatMessage(string.format("Winning Offspec Bid: %s (%.03f PR)",name,pr),"RAID")
end
end
function sepgp_bids:countdownCounter()
self._counter = (self._counter or 6) - 1
if GetNumRaidMembers()>0 and self._counter > 0 then
self._counterText = C:Yellow(tostring(self._counter))
SendChatMessage(tostring(self._counter),"RAID")
self:Refresh()
end
end
function sepgp_bids:countdownFinish(reset)
if self:IsEventScheduled("shootyepgpBidCountdown") then
self:CancelScheduledEvent("shootyepgpBidCountdown")
end
self._counter = 6
if (reset) then
self._counterText = C:Green("Starting")
else
self._counterText = C:Red("Finished")
end
self:Refresh()
end
function sepgp_bids:bidCountdown()
self:countdownFinish(true)
self:ScheduleRepeatingEvent("shootyepgpBidCountdown",self.countdownCounter,1,self)
self:ScheduleEvent("shootyepgpBidCountdownFinish",self.countdownFinish,6,self)
end
function sepgp_bids:BuildBidsTable()
-- {name,class,ep,gp,ep/gp}
table.sort(sepgp.bids_main, function(a,b)
@@ -145,9 +142,19 @@ function sepgp_bids:OnTooltipUpdate()
bidcat:AddLine(
"text", itemName,
"text2", price,
"text3", offspec,
"func", "lineTooltip", "arg1", self, "arg2", link, "arg3", this
"text3", offspec
)
local countdownHeader = T:AddCategory(
"columns", 2,
"text","","child_textR", 1, "child_textG", 1, "child_textB", 1,"child_justify", "LEFT",
"text2","","child_text2R", 1, "child_text2G", 1, "child_text2B", 1,"child_justify2", "CENTER",
"hideBlankLine", true
)
countdownHeader:AddLine(
"text", C:Green("Countdown"),
"text2", self._counterText,
"func", "bidCountdown", "arg1", self
)
local maincatHeader = T:AddCategory(
"columns", 1,
"text", C:Gold("MainSpec Bids")
@@ -193,5 +200,5 @@ function sepgp_bids:OnTooltipUpdate()
"text4", string.format("%.4g", pr),
"func", "announceWinnerOS", "arg1", self, "arg2", name, "arg3", pr
)
end
end
end
+2 -1
View File
@@ -46,7 +46,7 @@ end
function sepgp_logs:setHideScript()
local detachedFrame, tablet
for i=1,4 do
tablet = getglobal(string.format("Tablet20DetachedFrame%d",1))
tablet = getglobal(string.format("Tablet20DetachedFrame%d",i))
if tablet and tablet.owner ~= nil and tablet.owner == "sepgp_logs" then
if not (tablet:GetScript("OnHide")) then
tablet:SetScript("OnHide",function()
@@ -68,6 +68,7 @@ function sepgp_logs:Toggle(forceShow)
end
self:setHideScript()
elseif (forceShow) then
sepgp_logs:Refresh()
else
T:Attach("sepgp_logs")
end
+2 -1
View File
@@ -41,7 +41,7 @@ end
function sepgp_reserves:setHideScript()
local detachedFrame, tablet
for i=1,4 do
tablet = getglobal(string.format("Tablet20DetachedFrame%d",1))
tablet = getglobal(string.format("Tablet20DetachedFrame%d",i))
if tablet and tablet.owner ~= nil and tablet.owner == "sepgp_reserves" then
if not (tablet:GetScript("OnHide")) then
tablet:SetScript("OnHide",function()
@@ -63,6 +63,7 @@ function sepgp_reserves:Toggle(forceShow)
end
self:setHideScript()
elseif (forceShow) then
sepgp_reserves:Refresh()
else
T:Attach("sepgp_reserves")
end
+44 -34
View File
@@ -21,6 +21,7 @@ local admin,sanitizeNote
local shooty_debugchat
local running_check,running_bid
local partyUnit,raidUnit = {},{}
local hexColorQuality = {}
local reserves_blacklist,bids_blacklist = {},{}
local bidlink = {
["ms"]="|cffFF3333|Hshootybid:1:$ML|h[Mainspec/NEED]|h|r",
@@ -33,6 +34,9 @@ do
for i=1,4 do
partyUnit[i] = "party"..i
end
for i=-1,6 do
hexColorQuality[ITEM_QUALITY_COLORS[i].hex] = i
end
end
sepgp.reserves = {}
@@ -135,19 +139,6 @@ function sepgp:TipHook()
sepgp:AddDataToTooltip(GameTooltip, GetLootRollItemLink(id))
end
)
--[[self:SecureHook("SetItemRef", function(link, name, button)
if (link and name and ItemRefTooltip) then
if (strsub(link, 1, 6) ~= "Player") then
if (ItemRefTooltip:IsVisible()) then
if (not DressUpFrame:IsVisible()) then
sepgp:AddDataToTooltip(ItemRefTooltip, link)
end
ItemRefTooltip.isDisplayDone = nil
end
end
end
end
)]]
self:HookScript(GameTooltip, "OnHide", function()
if sepgp.extratip:IsVisible() then sepgp.extratip:Hide() end
self.hooks[GameTooltip]["OnHide"]()
@@ -350,6 +341,20 @@ function sepgp:adminSay(msg)
-- end
end
function sepgp:widestAudience(msg)
local channel = "SAY"
if UnitInRaid("player") then
if (IsRaidLeader() or IsRaidOfficer()) then
channel = "RAID_WARNING"
else
channel = "RAID"
end
elseif UnitExists("party1") then
channel = "PARTY"
end
SendChatMessage(msg, channel)
end
---------------------
-- EPGP Operations
---------------------
@@ -798,7 +803,7 @@ function sepgp:buildMenu()
options.args["progress_tier"] = {
type = "text",
name = "Raid Progress",
desc = "Highest Tier the Guild is raiding.\nUsed to adjust GP Prices.",
desc = "Highest Tier the Guild is raiding.\nUsed to adjust GP Prices.\nUsed for suggested EP awards.",
order = 90,
get = function() return sepgp_progress end,
set = function(v) sepgp_progress = v sepgp_bids:Refresh() end,
@@ -843,7 +848,7 @@ function sepgp:buildMenu()
options.args["set_discount"] = {
type = "range",
name = "Offspec Price %",
desc = "Set Offspec / Resistance Items GP Percent.",
desc = "Set Offspec Items GP Percent.",
order = 115,
get = function() return sepgp_discount end,
set = function(v) sepgp_discount = v end,
@@ -855,10 +860,10 @@ function sepgp:buildMenu()
options.args["reset"] = {
type = "execute",
name = "Reset GP",
desc = string.format("gives everybody %d basic GP (Admin only).",sepgp.VARS.basegp),
desc = string.format("Resets everyone\'s EPGP to 0/%d (Admin only).",sepgp.VARS.basegp),
order = 120,
hidden = function() return not (IsGuildLeader()) end,
func = function() StaticPopup_Show("SHOOTY_EPGP_CONFIRM_RESET_GP") end
func = function() StaticPopup_Show("SHOOTY_EPGP_CONFIRM_RESET") end
}
end
if (needInit) or (needRefresh) then
@@ -1042,17 +1047,20 @@ function sepgp:captureLootCall(text, sender)
link_found, _, itemColor, itemString, itemName = string.find(itemLink, "^(|c%x+)|H(.+)|h(%[.+%])")
end
if (link_found) then
if (IsRaidLeader() or self:lootMaster()) and (sender == playerName) then
self:clearBids()
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,360,self)
running_bid = true
self:debugPrint("Capturing Bids for 6min.")
sepgp_bids:Toggle(true)
local quality = hexColorQuality[itemColor] or -1
if (quality >= 3) then
if (IsRaidLeader() or self:lootMaster()) and (sender == playerName) then
self:clearBids(true)
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)
running_bid = true
self:debugPrint("Capturing Bids for 5min.")
sepgp_bids:Toggle(true)
end
sepgp:bidPrint(itemLink,sender,mskw_found,oskw_found,whisperkw_found)
end
sepgp:bidPrint(itemLink,sender,mskw_found,oskw_found,whisperkw_found)
end
end
end
@@ -1090,7 +1098,6 @@ function sepgp:captureBid(text, sender)
table.insert(sepgp.bids_off,{name,class,ep,gp,ep/gp})
end
sepgp_bids:Toggle(true)
sepgp_bids:Refresh()
return
end
end
@@ -1099,8 +1106,10 @@ function sepgp:captureBid(text, sender)
end
end
function sepgp:clearBids()
sepgp:debugPrint("clearing old Bids")
function sepgp:clearBids(reset)
if reset~=nil then
sepgp:debugPrint("Clearing old Bids")
end
sepgp.bid_item = {}
sepgp.bids_main = {}
sepgp.bids_off = {}
@@ -1109,6 +1118,7 @@ function sepgp:clearBids()
self:CancelScheduledEvent("shootyepgpBidTimeout")
end
running_bid = false
sepgp_bids._counterText = ""
sepgp_bids:Refresh()
end
@@ -1210,7 +1220,7 @@ admin = function()
end
sanitizeNote = function(prefix,epgp,postfix)
-- reserve 12 chars for the epgp pattern {xxxx:yyyy} max public/officernote = 31
-- reserve 12 chars for the epgp pattern {xxxxx:yyyy} max public/officernote = 31
local remainder = string.format("%s%s",prefix,postfix)
local clip = math.min(31-12,string.len(remainder))
local prepend = string.sub(remainder,1,clip)
@@ -1266,12 +1276,12 @@ StaticPopupDialogs["SHOOTY_EPGP_RESERVE_AFKCHECK_RESPONCE"] = {
whileDead = 1,
hideOnEscape = 1
}
StaticPopupDialogs["SHOOTY_EPGP_CONFIRM_RESET_GP"] = {
text = "|cffff0000Are you sure you want to Reset ALL GP?|r",
StaticPopupDialogs["SHOOTY_EPGP_CONFIRM_RESET"] = {
text = "|cffff0000Are you sure you want to Reset ALL EPGP?|r",
button1 = TEXT(OKAY),
button2 = TEXT(CANCEL),
OnAccept = function()
sepgp:gp_reset_v2()
sepgp:gp_reset_v3()
end,
timeout = 0,
whileDead = 1,
+1 -1
View File
@@ -3,7 +3,7 @@
## Notes: Effort Points/Gear Points Loot System
## Author: Roadblock
## X-Credits: shooty for original version
## Version: 3.13
## Version: 3.14
## OptionalDeps: Ace2
## SavedVariables: sepgp_saychannel,sepgp_groupbyclass,sepgp_raidonly,sepgp_decay,sepgp_reservechannel,sepgp_main,sepgp_progress,sepgp_discount
## SavedVariablesPerCharacter: sepgp_log, sepgp_dbver
+1 -1
View File
@@ -125,7 +125,7 @@ end
function sepgp_standings:setHideScript()
local detachedFrame, tablet
for i=1,4 do
tablet = getglobal(string.format("Tablet20DetachedFrame%d",1))
tablet = getglobal(string.format("Tablet20DetachedFrame%d",i))
if tablet and tablet.owner ~= nil and tablet.owner == "sepgp_standings" then
if not (tablet:GetScript("OnHide")) then
tablet:SetScript("OnHide",function()