diff --git a/Libs/Tablet-2.0/Tablet-2.0.lua b/Libs/Tablet-2.0/Tablet-2.0.lua index 369ace8..90a75ed 100644 --- a/Libs/Tablet-2.0/Tablet-2.0.lua +++ b/Libs/Tablet-2.0/Tablet-2.0.lua @@ -1,6 +1,6 @@ --[[ Name: Tablet-2.0 -Revision: $Rev: 17873 $ +Revision: $Rev: 17999 $ Author(s): ckknight (ckknight@gmail.com) Website: http://ckknight.wowinterface.com/ Documentation: http://wiki.wowace.com/index.php/Tablet-2.0 @@ -10,7 +10,7 @@ Dependencies: AceLibrary, (optional) Dewdrop-2.0 ]] local MAJOR_VERSION = "Tablet-2.0" -local MINOR_VERSION = "$Revision: 17873 $" +local MINOR_VERSION = "$Revision: 17999 $" if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end @@ -2205,7 +2205,7 @@ function AcquireDetachedFrame(self, registration, data, detachedData) detached.menu = nil detached.detachedData.detached = nil detached:SetOwner(nil) - detached.notInUse = TRUE + detached.notInUse = true end return AcquireDetachedFrame(self, registration, data, detachedData) diff --git a/alts.lua b/alts.lua new file mode 100644 index 0000000..189cddc --- /dev/null +++ b/alts.lua @@ -0,0 +1,118 @@ +local T = AceLibrary("Tablet-2.0") +local D = AceLibrary("Dewdrop-2.0") +local C = AceLibrary("Crayon-2.0") + +local BC = AceLibrary("Babble-Class-2.2") +local L = AceLibrary("AceLocale-2.2"):new("shootyepgp") + +sepgp_alts = sepgp:NewModule("sepgp_alts", "AceDB-2.0") + +function sepgp_alts:OnEnable() + if not T:IsRegistered("sepgp_alts") then + T:Register("sepgp_alts", + "children", function() + T:SetTitle(L["shootyepgp alts"]) + self:OnTooltipUpdate() + end, + "showTitleWhenDetached", true, + "showHintWhenDetached", true, + "cantAttach", true, + "menu", function() + D:AddLine( + "text", L["Refresh"], + "tooltipText", L["Refresh window"], + "func", function() sepgp_alts:Refresh() end + ) + end + ) + end + if not T:IsAttached("sepgp_alts") then + T:Open("sepgp_alts") + end +end + +function sepgp_alts:OnDisable() + T:Close("sepgp_alts") +end + +function sepgp_alts:Refresh() + T:Refresh("sepgp_alts") +end + +function sepgp_alts:setHideScript() + local i = 1 + local tablet = getglobal(string.format("Tablet20DetachedFrame%d",i)) + while (tablet) and i<100 do + if tablet.owner ~= nil and tablet.owner == "sepgp_alts" then + sepgp:make_escable(string.format("Tablet20DetachedFrame%d",i),"add") + if not (tablet:GetScript("OnHide")) then + tablet:SetScript("OnHide",function() + if not T:IsAttached("sepgp_alts") then + T:Attach("sepgp_alts") + this:SetScript("OnHide",nil) + end + end) + end + break + end + i = i+1 + tablet = getglobal(string.format("Tablet20DetachedFrame%d",i)) + end +end + +function sepgp_alts:Top() + if T:IsRegistered("sepgp_alts") and (T.registry.sepgp_alts.tooltip) then + T.registry.sepgp_alts.tooltip.scroll=0 + end +end + +function sepgp_alts:Toggle(forceShow) + self:Top() + if T:IsAttached("sepgp_alts") then + T:Detach("sepgp_alts") -- show + if (T:IsLocked("sepgp_alts")) then + T:ToggleLocked("sepgp_alts") + end + self:setHideScript() + elseif (forceShow) then + sepgp_alts:Refresh() + else + T:Attach("sepgp_alts") -- hide + end +end + +function sepgp_alts:OnClickItem(name) + --ChatFrame_SendTell(name) +end + +function sepgp_alts:BuildAltsTable() + return sepgp.alts +end + +function sepgp_alts:OnTooltipUpdate() + local cat = T:AddCategory( + "columns", 2, + "text", C:Orange(L["Main"]), "child_textR", 1, "child_textG", 1, "child_textB", 1, "child_justify", "LEFT", + "text2", C:Orange(L["Alts"]), "child_text2R", 0, "child_text2G", 1, "child_text2B", 0, "child_justify2", "RIGHT" + ) + local t = self:BuildAltsTable() + for main, alts in pairs(t) do + local altstring = "" + for alt,class in pairs(alts) do + local coloredalt = C:Colorize(BC:GetHexColor(class), alt) + if altstring == "" then + altstring = coloredalt + else + altstring = string.format("%s, %s",altstring,coloredalt) + end + end + cat:AddLine( + "text", main, + "text2", altstring--, + --"func", "OnClickItem", "arg1", self, "arg2", main + ) + end +end + +-- GLOBALS: sepgp_saychannel,sepgp_groupbyclass,sepgp_raidonly,sepgp_decay,sepgp_reservechannel,sepgp_main,sepgp_progress,sepgp_discount,sepgp_log,sepgp_dbver,sepgp_looted +-- GLOBALS: sepgp,sepgp_prices,sepgp_standings,sepgp_bids,sepgp_loot,sepgp_reserves,sepgp_alts,sepgp_logs diff --git a/bids.lua b/bids.lua index 0228c0e..c7de1dc 100644 --- a/bids.lua +++ b/bids.lua @@ -1,3 +1,9 @@ +--[[ +TODO: Bids need to be Main/Alt aware too +- Bids tablet needs to show Main's points +- Bids tablet needs to mark the Alts. +]] + local T = AceLibrary("Tablet-2.0") local D = AceLibrary("Dewdrop-2.0") local C = AceLibrary("Crayon-2.0") @@ -40,10 +46,11 @@ function sepgp_bids:Refresh() end function sepgp_bids:setHideScript() - local detachedFrame, tablet - for i=1,5 do - tablet = getglobal(string.format("Tablet20DetachedFrame%d",i)) - if tablet and tablet.owner ~= nil and tablet.owner == "sepgp_bids" then + local i = 1 + local tablet = getglobal(string.format("Tablet20DetachedFrame%d",i)) + while (tablet) and i<100 do + if tablet.owner ~= nil and tablet.owner == "sepgp_bids" then + sepgp:make_escable(string.format("Tablet20DetachedFrame%d",i),"add") if not (tablet:GetScript("OnHide")) then tablet:SetScript("OnHide",function() if not T:IsAttached("sepgp_bids") then @@ -52,8 +59,11 @@ function sepgp_bids:setHideScript() end end) end - end - end + break + end + i = i+1 + tablet = getglobal(string.format("Tablet20DetachedFrame%d",i)) + end end function sepgp_bids:Top() @@ -65,7 +75,7 @@ end function sepgp_bids:Toggle(forceShow) self:Top() if T:IsAttached("sepgp_bids") then - T:Detach("sepgp_bids") + T:Detach("sepgp_bids") -- show if (T:IsLocked("sepgp_bids")) then T:ToggleLocked("sepgp_bids") end @@ -73,8 +83,8 @@ function sepgp_bids:Toggle(forceShow) elseif (forceShow) then sepgp_bids:Refresh() else - T:Attach("sepgp_bids") - end + T:Attach("sepgp_bids") -- hide + end end function sepgp_bids:announceWinnerMS(name, pr) @@ -115,7 +125,7 @@ function sepgp_bids:bidCountdown() end function sepgp_bids:BuildBidsTable() - -- {name,class,ep,gp,ep/gp} + -- {name,class,ep,gp,ep/gp[,main]} table.sort(sepgp.bids_main, function(a,b) return a[5] > b[5] end) @@ -165,21 +175,23 @@ function sepgp_bids:OnTooltipUpdate() "text", C:Gold("MainSpec Bids") ):AddLine("text","") local maincat = T:AddCategory( - "columns", 4, + "columns", 5, "text", C:Orange("Name"), "child_textR", 1, "child_textG", 1, "child_textB", 1, "child_justify", "LEFT", "text2", C:Orange("ep"), "child_text2R", 1, "child_text2G", 1, "child_text2B", 1, "child_justify2", "RIGHT", "text3", C:Orange("gp"), "child_text3R", 1, "child_text3G", 1, "child_text3B", 1, "child_justify3", "RIGHT", "text4", C:Orange("pr"), "child_text4R", 1, "child_text4G", 1, "child_text4B", 0, "child_justify4", "RIGHT", + "text5", C:Orange("Main"), "child_text5R", 1, "child_text5G", 1, "child_text5B", 0, "child_justify5", "RIGHT", "hideBlankLine", true ) local tm = self:BuildBidsTable() for i = 1, table.getn(tm) do - local name, class, ep, gp, pr = unpack(tm[i]) + local name, class, ep, gp, pr, main = unpack(tm[i]) maincat:AddLine( "text", C:Colorize(BC:GetHexColor(class), name), "text2", string.format("%.4g", ep), "text3", string.format("%.4g", gp), "text4", string.format("%.4g", pr), + "text5", (main or ""), "func", "announceWinnerMS", "arg1", self, "arg2", name, "arg3", pr ) end @@ -188,25 +200,27 @@ function sepgp_bids:OnTooltipUpdate() "text", C:Silver("OffSpec Bids") ):AddLine("text","") local offcat = T:AddCategory( - "columns", 4, + "columns", 5, "text", C:Orange("Name"), "child_textR", 1, "child_textG", 1, "child_textB", 1, "child_justify", "LEFT", "text2", C:Orange("ep"), "child_text2R", 1, "child_text2G", 1, "child_text2B", 1, "child_justify2", "RIGHT", "text3", C:Orange("gp"), "child_text3R", 1, "child_text3G", 1, "child_text3B", 1, "child_justify3", "RIGHT", "text4", C:Orange("pr"), "child_text4R", 1, "child_text4G", 1, "child_text4B", 0, "child_justify4", "RIGHT", + "text5", C:Orange("Main"), "child_text5R", 1, "child_text5G", 1, "child_text5B", 0, "child_justify5", "RIGHT", "hideBlankLine", true ) local _,to = self:BuildBidsTable() for i = 1, table.getn(to) do - local name, class, ep, gp, pr = unpack(to[i]) + local name, class, ep, gp, pr, main = unpack(to[i]) offcat:AddLine( "text", C:Colorize(BC:GetHexColor(class), name), "text2", string.format("%.4g", ep), "text3", string.format("%.4g", gp), "text4", string.format("%.4g", pr), + "text5", (main or ""), "func", "announceWinnerOS", "arg1", self, "arg2", name, "arg3", pr ) end end -- GLOBALS: sepgp_saychannel,sepgp_groupbyclass,sepgp_raidonly,sepgp_decay,sepgp_reservechannel,sepgp_main,sepgp_progress,sepgp_discount,sepgp_log,sepgp_dbver,sepgp_looted --- GLOBALS: sepgp,sepgp_prices,sepgp_standings,sepgp_bids,sepgp_loot,sepgp_reserves,sepgp_logs +-- GLOBALS: sepgp,sepgp_prices,sepgp_standings,sepgp_bids,sepgp_loot,sepgp_reserves,sepgp_alts,sepgp_logs diff --git a/localization.lua b/localization.lua index 449734e..12bca37 100644 --- a/localization.lua +++ b/localization.lua @@ -102,10 +102,10 @@ Results will print here when done.]], ["Giving %d ep to all raidmembers"] = true, ["You aren't in a raid dummy"] = true, ["Giving %d ep to active reserves"] = true, - ["Giving %d ep to %s"] = true, - ["%s EP Penalty to %s."] = true, - ["Giving %d gp to %s"] = true, - ["Awarding %d GP to %s. (Previous: %d, New: %d)"] = true, + ["Giving %d ep to %s%s."] = true, + ["%s EP Penalty to %s%s."] = true, + ["Giving %d gp to %s%s."] = true, + ["Awarding %d GP to %s%s. (Previous: %d, New: %d)"] = true, ["%s\'s officernote is broken:%q"] = true, ["All EP and GP decayed by %d%%"] = true, ["All EP and GP decayed by %s%%"] = true, @@ -114,7 +114,7 @@ Results will print here when done.]], ["You now have: %d EP %d GP |cffffff00%.03f|r|cffff7f00PR|r."] = true, ["Close to EPGP Cap. Next Decay will change your |cffff7f00PR|r by |cffff0000%.4g|r."] = true, ["|cffffff00Click|r to toggle Standings.%s \n|cffffff00Right-Click|r for Options."] = true, - [" \n|cffffff00Ctrl+Click|r to toggle Reserves. \n|cffffff00Alt+Click|r to toggle Bids. \n|cffffff00Shift+Click|r to toggle Loot. \n|cffffff00Ctrl+Shift+Click|r to toggle Logs."] = true, + [" \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."] = true, ["Account EPs to %s."] = true, ["Account GPs to %s."] = true, ["shootyepgp options"] = true, @@ -173,6 +173,21 @@ Results will print here when done.]], ["GP Actions"] = true, ["Remind me Later"] = true, ["Need MasterLooter to perform Bid Calls!"] = true, + ["shootyepgp alts"] = true, + ["Enable Alts"] = true, + ["Main"] = true, + ["Allow Alts to use Main\'s EPGP."] = true, + ["Alts EP %"] = true, + ["Set the % EP Alts can earn."] = true, + [", alts"] = true, + ["New Alts"] = true, + [", alts ep %"] = true, + ["New Alts EP %"] = true, + ["Manually modified %s\'s note. Previous main was %s"] = true, + ["|cffff0000Manually modified %s\'s note. Previous main was %s|r"] = true, + [", %s\'s Main."] = true, + ["Your main has been set to %s"] = true, + ["Alts"] = true, } end) L:RegisterTranslations("zhCN", function() return { @@ -277,10 +292,10 @@ L:RegisterTranslations("zhCN", function() return { ["Giving %d ep to all raidmembers"] = "给予 %d ep 到所有团员", ["You aren't in a raid dummy"] = "你不在一个团队", ["Giving %d ep to active reserves"] = "给予 %d ep 在线的替补队员", - ["Giving %d ep to %s"] = "给予 %d ep 给 %s", - ["%s EP Penalty to %s."] = "%s EP 惩罚 %s.", - ["Giving %d gp to %s"] = "给予 %d gp 给 %s", - ["Awarding %d GP to %s. (Previous: %d, New: %d)"] = "奖励 %d GP 给 %s. (以前: %d, 新: %d)", + ["Giving %d ep to %s%s."] = "给予 %d ep 给 %s", + ["%s EP Penalty to %s%s."] = "%s EP 惩罚 %s.", + ["Giving %d gp to %s%s."] = "给予 %d gp 给 %s", + ["Awarding %d GP to %s%s. (Previous: %d, New: %d)"] = "奖励 %d GP 给 %s. (以前: %d, 新: %d)", ["%s\'s officernote is broken:%q"] = "%s\'s 官员备注无法执行:%q", ["All EP and GP decayed by %d%%"] = "所有EP和GP递减 %d%%", ["All EP and GP decayed by %s%%"] = "所有EP和GP递减 %s%%", @@ -289,7 +304,7 @@ L:RegisterTranslations("zhCN", function() return { ["You now have: %d EP %d GP |cffffff00%.03f|r|cffff7f00PR|r."] = "你现在有: %d EP %d GP |cffffff00%.03f|r|cffff7f00PR|r.", ["Close to EPGP Cap. Next Decay will change your |cffff7f00PR|r by |cffff0000%.4g|r."] = "下次递减会改变你的 |cffff7f00PR|r 从 |cffff0000%.4g|r.", ["|cffffff00Click|r to toggle Standings.%s \n|cffffff00Right-Click|r for Options."] = "|cffffff00点击|r 切换名单.%s \n|cffffff00右键|r 设置.", - [" \n|cffffff00Ctrl+Click|r to toggle Reserves. \n|cffffff00Alt+Click|r to toggle Bids. \n|cffffff00Shift+Click|r to toggle Loot. \n|cffffff00Ctrl+Shift+Click|r to toggle Logs."] = " \n|cffffff00Ctrl+点击|r 切换到替补队员. \n|cffffff00Alt+点击|r 切换到竞拍. \n|cffffff00Shift+点击|r 切换到拾取. \n|cffffff00Ctrl+Shift+点击|r 切换到日志.", + [" \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."] = " \n|cffffff00Ctrl+点击|r 切换到替补队员. \n|cffffff00Alt+点击|r 切换到竞拍. \n|cffffff00Shift+点击|r 切换到拾取. \n|cffffff00Ctrl+Shift+点击|r 切换到日志.", -- needs update ["Account EPs to %s."] = "记账 EP 到 %s.", ["Account GPs to %s."] = "记账 GP 到 %s.", ["shootyepgp options"] = "shootyepgp 设置", @@ -348,4 +363,19 @@ L:RegisterTranslations("zhCN", function() return { ["GP Actions"] = "GP 操作", ["Remind me Later"] = "以后提醒我", ["Need MasterLooter to perform Bid Calls!"] = "Need MasterLooter to perform Bid Calls!", + ["shootyepgp alts"] = "shootyepgp alts", + ["Enable Alts"] = "Enable Alts", + ["Main"] = "Main", + ["Allow Alts to use Main\'s EPGP."] = "Allow Alts to use Main\'s EPGP.", + ["Alts EP %"] = "Alts EP %", + ["Set the % EP Alts can earn."] = "Set the % EP Alts can earn.", + [", alts"] = ", alts", + ["New Alts"] = "New Alts", + [", alts ep %"] = ", alts ep %", + ["New Alts EP %"] = "New Alts EP %", + ["Manually modified %s\'s note. Previous main was %s"] = "Manually modified %s\'s note. Previous main was %s", + ["|cffff0000Manually modified %s\'s note. Previous main was %s|r"] = "|cffff0000Manually modified %s\'s note. Previous main was %s|r", + [", %s\'s Main."] = ", %s\'s Main.", + ["Your main has been set to %s"] = "Your main has been set to %s", + ["Alts"] = "Alts", } end) \ No newline at end of file diff --git a/logs.lua b/logs.lua index 8369371..cfd8354 100644 --- a/logs.lua +++ b/logs.lua @@ -45,10 +45,11 @@ function sepgp_logs:Refresh() end function sepgp_logs:setHideScript() - local detachedFrame, tablet - for i=1,5 do - tablet = getglobal(string.format("Tablet20DetachedFrame%d",i)) - if tablet and tablet.owner ~= nil and tablet.owner == "sepgp_logs" then + local i = 1 + local tablet = getglobal(string.format("Tablet20DetachedFrame%d",i)) + while (tablet) and i<100 do + if tablet.owner ~= nil and tablet.owner == "sepgp_logs" then + sepgp:make_escable(string.format("Tablet20DetachedFrame%d",i),"add") if not (tablet:GetScript("OnHide")) then tablet:SetScript("OnHide",function() if not T:IsAttached("sepgp_logs") then @@ -57,8 +58,11 @@ function sepgp_logs:setHideScript() end end) end - end - end + break + end + i = i+1 + tablet = getglobal(string.format("Tablet20DetachedFrame%d",i)) + end end function sepgp_logs:Top() @@ -70,7 +74,7 @@ end function sepgp_logs:Toggle(forceShow) self:Top() if T:IsAttached("sepgp_logs") then - T:Detach("sepgp_logs") + T:Detach("sepgp_logs") -- show if (T:IsLocked("sepgp_logs")) then T:ToggleLocked("sepgp_logs") end @@ -78,8 +82,8 @@ function sepgp_logs:Toggle(forceShow) elseif (forceShow) then sepgp_logs:Refresh() else - T:Attach("sepgp_logs") - end + T:Attach("sepgp_logs") -- hide + end end function sepgp_logs:reverse(arr) @@ -118,4 +122,4 @@ function sepgp_logs:OnTooltipUpdate() end -- GLOBALS: sepgp_saychannel,sepgp_groupbyclass,sepgp_raidonly,sepgp_decay,sepgp_reservechannel,sepgp_main,sepgp_progress,sepgp_discount,sepgp_log,sepgp_dbver,sepgp_looted --- GLOBALS: sepgp,sepgp_prices,sepgp_standings,sepgp_bids,sepgp_loot,sepgp_reserves,sepgp_logs +-- GLOBALS: sepgp,sepgp_prices,sepgp_standings,sepgp_bids,sepgp_loot,sepgp_reserves,sepgp_alts,sepgp_logs diff --git a/loot.lua b/loot.lua index c106cc0..a53ef2e 100644 --- a/loot.lua +++ b/loot.lua @@ -45,10 +45,11 @@ function sepgp_loot:Refresh() end function sepgp_loot:setHideScript() - local detachedFrame, tablet - for i=1,5 do - tablet = getglobal(string.format("Tablet20DetachedFrame%d",i)) - if tablet and tablet.owner ~= nil and tablet.owner == "sepgp_loot" then + local i = 1 + local tablet = getglobal(string.format("Tablet20DetachedFrame%d",i)) + while (tablet) and i<100 do + if tablet.owner ~= nil and tablet.owner == "sepgp_loot" then + sepgp:make_escable(string.format("Tablet20DetachedFrame%d",i),"add") if not (tablet:GetScript("OnHide")) then tablet:SetScript("OnHide",function() if not T:IsAttached("sepgp_loot") then @@ -57,8 +58,11 @@ function sepgp_loot:setHideScript() end end) end - end - end + break + end + i = i+1 + tablet = getglobal(string.format("Tablet20DetachedFrame%d",i)) + end end function sepgp_loot:Top() @@ -70,7 +74,7 @@ end function sepgp_loot:Toggle(forceShow) self:Top() if T:IsAttached("sepgp_loot") then - T:Detach("sepgp_loot") + T:Detach("sepgp_loot") -- show if (T:IsLocked("sepgp_loot")) then T:ToggleLocked("sepgp_loot") end @@ -78,8 +82,8 @@ function sepgp_loot:Toggle(forceShow) elseif (forceShow) then sepgp_loot:Refresh() else - T:Attach("sepgp_loot") - end + T:Attach("sepgp_loot") -- hide + end end function sepgp_loot:BuildLootTable() @@ -91,7 +95,7 @@ function sepgp_loot:BuildLootTable() end function sepgp_loot:OnClickItem(data) - + end function sepgp_loot:OnTooltipUpdate() @@ -118,4 +122,4 @@ function sepgp_loot:OnTooltipUpdate() end -- GLOBALS: sepgp_saychannel,sepgp_groupbyclass,sepgp_raidonly,sepgp_decay,sepgp_reservechannel,sepgp_main,sepgp_progress,sepgp_discount,sepgp_log,sepgp_dbver,sepgp_looted --- GLOBALS: sepgp,sepgp_prices,sepgp_standings,sepgp_bids,sepgp_loot,sepgp_reserves,sepgp_logs +-- GLOBALS: sepgp,sepgp_prices,sepgp_standings,sepgp_bids,sepgp_loot,sepgp_reserves,sepgp_alts,sepgp_logs diff --git a/migrations.lua b/migrations.lua index c27a4ab..c113ad4 100644 --- a/migrations.lua +++ b/migrations.lua @@ -20,4 +20,4 @@ function sepgp:v2tov3() end -- GLOBALS: sepgp_saychannel,sepgp_groupbyclass,sepgp_raidonly,sepgp_decay,sepgp_reservechannel,sepgp_main,sepgp_progress,sepgp_discount,sepgp_log,sepgp_dbver,sepgp_looted --- GLOBALS: sepgp,sepgp_prices,sepgp_standings,sepgp_bids,sepgp_loot,sepgp_reserves,sepgp_logs +-- GLOBALS: sepgp,sepgp_prices,sepgp_standings,sepgp_bids,sepgp_loot,sepgp_reserves,sepgp_alts,sepgp_logs diff --git a/prices.lua b/prices.lua index 7584ea3..c577a06 100644 --- a/prices.lua +++ b/prices.lua @@ -813,4 +813,4 @@ function sepgp_prices:GetPrice(item,progress) end -- GLOBALS: sepgp_saychannel,sepgp_groupbyclass,sepgp_raidonly,sepgp_decay,sepgp_reservechannel,sepgp_main,sepgp_progress,sepgp_discount,sepgp_log,sepgp_dbver,sepgp_looted --- GLOBALS: sepgp,sepgp_prices,sepgp_standings,sepgp_bids,sepgp_loot,sepgp_reserves,sepgp_logs \ No newline at end of file +-- GLOBALS: sepgp,sepgp_prices,sepgp_standings,sepgp_bids,sepgp_loot,sepgp_reserves,sepgp_alts,sepgp_logs \ No newline at end of file diff --git a/reserves.lua b/reserves.lua index ad168c7..be9eb6e 100644 --- a/reserves.lua +++ b/reserves.lua @@ -40,10 +40,11 @@ function sepgp_reserves:Refresh() end function sepgp_reserves:setHideScript() - local detachedFrame, tablet - for i=1,5 do - tablet = getglobal(string.format("Tablet20DetachedFrame%d",i)) - if tablet and tablet.owner ~= nil and tablet.owner == "sepgp_reserves" then + local i = 1 + local tablet = getglobal(string.format("Tablet20DetachedFrame%d",i)) + while (tablet) and i<100 do + if tablet.owner ~= nil and tablet.owner == "sepgp_reserves" then + sepgp:make_escable(string.format("Tablet20DetachedFrame%d",i),"add") if not (tablet:GetScript("OnHide")) then tablet:SetScript("OnHide",function() if not T:IsAttached("sepgp_reserves") then @@ -52,8 +53,11 @@ function sepgp_reserves:setHideScript() end end) end - end - end + break + end + i = i+1 + tablet = getglobal(string.format("Tablet20DetachedFrame%d",i)) + end end function sepgp_reserves:Top() @@ -65,7 +69,7 @@ end function sepgp_reserves:Toggle(forceShow) self:Top() if T:IsAttached("sepgp_reserves") then - T:Detach("sepgp_reserves") + T:Detach("sepgp_reserves") -- show if (T:IsLocked("sepgp_reserves")) then T:ToggleLocked("sepgp_reserves") end @@ -73,8 +77,8 @@ function sepgp_reserves:Toggle(forceShow) elseif (forceShow) then sepgp_reserves:Refresh() else - T:Attach("sepgp_reserves") - end + T:Attach("sepgp_reserves") -- hide + end end function sepgp_reserves:OnClickItem(name) @@ -117,4 +121,4 @@ function sepgp_reserves:OnTooltipUpdate() end -- GLOBALS: sepgp_saychannel,sepgp_groupbyclass,sepgp_raidonly,sepgp_decay,sepgp_reservechannel,sepgp_main,sepgp_progress,sepgp_discount,sepgp_log,sepgp_dbver,sepgp_looted --- GLOBALS: sepgp,sepgp_prices,sepgp_standings,sepgp_bids,sepgp_loot,sepgp_reserves,sepgp_logs +-- GLOBALS: sepgp,sepgp_prices,sepgp_standings,sepgp_bids,sepgp_loot,sepgp_reserves,sepgp_alts,sepgp_logs diff --git a/shootyepgp.lua b/shootyepgp.lua index 8176db2..b0a0112 100644 --- a/shootyepgp.lua +++ b/shootyepgp.lua @@ -1,12 +1,3 @@ ---[[ -TODO -1. Add EP / GP Menu to raid unit context menu and loot info window. -2. Figure out a way to pool EPGP for multiple characters. -High risk of abuse though .. -One approach is have officer notes on alts contain the main name, -that at least limits the risk to officers exploiting. -Both EP and GP should transfer to main points, no earning without spending. -]] 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") @@ -136,12 +127,15 @@ sepgp.timer:Hide() sepgp.timer:SetScript("OnUpdate",function() sepgp.OnUpdate(this,arg1) end) sepgp.timer:SetScript("OnEvent",function() end) +sepgp.alts = {} function sepgp:OnInitialize() -- ADDON_LOADED (1) unless LoD if sepgp_saychannel == nil then sepgp_saychannel = "GUILD" end if sepgp_decay == nil then sepgp_decay = sepgp.VARS.decay end if sepgp_progress == nil then sepgp_progress = "T1" end if sepgp_discount == nil then sepgp_discount = 0.25 end + if sepgp_altspool == nil then sepgp_altspool = false end + if sepgp_altpercent == nil then sepgp_altpercent = 1.0 end if sepgp_log == nil then sepgp_log = {} end if sepgp_looted == nil then sepgp_looted = {} end if sepgp_debug == nil then sepgp_debug = {} end @@ -151,6 +145,15 @@ end function sepgp:OnEnable() -- PLAYER_LOGIN (2) --table.insert(sepgp_debug,{[date("%b/%d %H:%M:%S")]="OnEnable"}) sepgp.extratip = (sepgp.extratip) or CreateFrame("GameTooltip","shootyepgp_tooltip",UIParent,"GameTooltipTemplate") + sepgp._versionString = GetAddOnMetadata("shootyepgp","Version") + sepgp._websiteString = GetAddOnMetadata("shootyepgp","X-Website") + + if (IsInGuild()) then + if (GetNumGuildMembers()==0) then + GuildRoster() + end + end + self:RegisterEvent("GUILD_ROSTER_UPDATE",function() if (arg1) then -- member join /leave sepgp:SetRefresh(true) @@ -177,12 +180,6 @@ function sepgp:OnEnable() -- PLAYER_LOGIN (2) self:RegisterEvent("TRADE_PLAYER_ITEM_CHANGED","tradeLoot") self:RegisterEvent("TRADE_ACCEPT_UPDATE","tradeLoot") - if (IsInGuild()) then - if (GetNumGuildMembers()==0) then - GuildRoster() - end - end - if AceLibrary("AceEvent-2.0"):IsFullyInitialized() then self:AceEvent_FullyInitialized() else @@ -242,8 +239,8 @@ function sepgp:AceEvent_FullyInitialized() -- SYNTHETIC EVENT, later than PLAYER self:SecureHook(pfUI.loot, "UpdateLootFrame", "pfUI_UpdateLootFrame") end -- make tablets closable with ESC - for i=1,5 do - table.insert(UISpecialFrames,string.format("Tablet20DetachedFrame%d",i)) + for i=1,6 do + self:make_escable(string.format("Tablet20DetachedFrame%d",i),"add") end self:RegisterChatCommand({"/shooty","/sepgp","/shootyepgp"},self.cmdtable()) self._hasInitFull = true @@ -254,12 +251,16 @@ function sepgp:OnMenuRequest() local now = GetTime() if not self._lastRosterRequest or (now - self._lastRosterRequest > 2) then self._lastRosterRequest = now + self:SetRefresh(true) GuildRoster() end D:FeedAceOptionsTable(self:buildMenu()) end function sepgp:TipHook() + self:SecureHook(GameTooltip, "SetHyperlink", function(this, itemstring) + sepgp:AddDataToTooltip(GameTooltip, nil, itemstring) + end) self:SecureHook(GameTooltip, "SetBagItem", function(this, bag, slot) local itemLink = GetContainerItemLink(bag, slot) local ml_tip @@ -311,6 +312,15 @@ function sepgp:TipHook() self.hooks[ItemRefTooltip]["OnHide"]() end ) + if (AtlasLootTooltip) then + self:SecureHook(AtlasLootTooltip, "SetHyperlink", function(this, itemstring) + sepgp:AddDataToTooltip(AtlasLootTooltip,nil,itemstring) + end) + self:HookScript(AtlasLootTooltip, "OnHide", function() + if sepgp.extratip:IsVisible() then sepgp.extratip:Hide() end + self.hooks[AtlasLootTooltip]["OnHide"]() + end) + end end function sepgp:delayedInit() @@ -327,8 +337,6 @@ function sepgp:delayedInit() self:reservesToggle(true) end -- migrate EPGP storage if needed - sepgp._versionString = GetAddOnMetadata("shootyepgp","Version") - sepgp._websiteString = GetAddOnMetadata("shootyepgp","X-Website") self:parseVersion(sepgp._versionString) local major_ver = self._version.major if IsGuildLeader() and ( (sepgp_dbver == nil) or (major_ver > sepgp_dbver) ) then @@ -383,8 +391,13 @@ function sepgp:AddDataToTooltip(tooltip,itemlink,itemstring,is_master) sepgp.extratip:ClearLines() sepgp.extratip:SetOwner(tooltip,"ANCHOR_NONE") sepgp.extratip:ClearAllPoints() - sepgp.extratip:SetPoint("TOPLEFT", tooltip, "BOTTOMLEFT", 0, -5) - --sepgp.extratip:SetPoint("TOPRIGHT", tooltip, "BOTTOMRIGHT", 0, -5) + if (EnhTooltip) and EnhancedTooltip:IsVisible() then + sepgp.extratip:SetPoint("BOTTOMLEFT", tooltip, "TOPLEFT", 0, 5) + sepgp.extratip:SetPoint("BOTTOMRIGHT", tooltip, "TOPRIGHT", 0, 5) + else + sepgp.extratip:SetPoint("TOPLEFT", tooltip, "BOTTOMLEFT", 0, -5) + sepgp.extratip:SetPoint("TOPRIGHT", tooltip, "BOTTOMRIGHT", 0, -5) + end sepgp.extratip:SetText("|cff9664c8shootyepgp|r") sepgp.extratip:AddDoubleLine(" ",textRight) sepgp.extratip:AddDoubleLine(" ",textRight2) @@ -419,6 +432,16 @@ function sepgp:GuildRosterSetOfficerNote(index,note,fromAddon) local name, _, _, _, _, _, _, prevnote, _, _ = GetGuildRosterInfo(index) local _,_,_,oldepgp,_ = string.find(prevnote or "","(.*)({%d+:%d+})(.*)") local _,_,_,epgp,_ = string.find(note or "","(.*)({%d+:%d+})(.*)") + if (sepgp_altspool) then + local oldmain = self:parseAlt(name,prevnote) + local main = self:parseAlt(name,note) + if oldmain ~= nil then + if main == nil or main ~= oldmain then + self:adminSay(string.format(L["Manually modified %s\'s note. Previous main was %s"],name,oldmain)) + self:defaultPrint(string.format(L["|cffff0000Manually modified %s\'s note. Previous main was %s|r"],name,oldmain)) + end + end + end if oldepgp ~= nil then if epgp == nil or epgp ~= oldepgp then self:adminSay(string.format(L["Manually modified %s\'s note. EPGP was %s"],name,oldepgp)) @@ -426,7 +449,7 @@ function sepgp:GuildRosterSetOfficerNote(index,note,fromAddon) end end local safenote = string.gsub(note,"(.*)({%d+:%d+})(.*)",sanitizeNote) - self.hooks["GuildRosterSetOfficerNote"](index,safenote) + return self.hooks["GuildRosterSetOfficerNote"](index,safenote) end end @@ -650,7 +673,7 @@ function sepgp:addonComms(prefix,message,channel,sender) end if (who) and (what) and (amount) then local msg - if who == self._playerName then + if (who == self._playerName) or (sepgp_main and (who == sepgp_main)) then if what == "EP" then if amount < 0 then msg = string.format(L["You have received a %d EP penalty."],amount) @@ -677,9 +700,11 @@ function sepgp:addonComms(prefix,message,channel,sender) self:shareSettings() end elseif who == "SETTINGS" then - for progress,discount,decay in string.gfind(what,"([^:]+):([^:]+):([^:]+)") do + for progress,discount,decay,alts,altspct in string.gfind(what,"([^:]+):([^:]+):([^:]+):([^:]+):([^:]+)") do discount = tonumber(discount) decay = tonumber(decay) + altspct = tonumber(altspct) + alts = (alts == "true") and true or false local settings_notice if progress and progress ~= sepgp_progress then sepgp_progress = progress @@ -703,6 +728,26 @@ function sepgp:addonComms(prefix,message,channel,sender) end end end + if alts and alts ~= sepgp_altspool then + sepgp_altspool = alts + if (admin()) then + if (settings_notice) then + settings_notice = settings_notice..L[", alts"] + else + settings_notice = L["New Alts"] + 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 %"] + else + settings_notice = L["New Alts EP %"] + 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) @@ -721,7 +766,7 @@ function sepgp:shareSettings(force) local now = GetTime() if self._lastSettingsShare == nil or (now - self._lastSettingsShare > 30) or (force) then self._lastSettingsShare = now - local addonMsg = string.format("SETTINGS;%s:%s:%s;1",sepgp_progress,sepgp_discount,sepgp_decay) + local addonMsg = string.format("SETTINGS;%s:%s:%s:%s:%s;1",sepgp_progress,sepgp_discount,sepgp_decay,tostring(sepgp_altspool),sepgp_altpercent) self:addonMessage(addonMsg,"GUILD") end end @@ -897,11 +942,21 @@ end function sepgp:givename_ep(getname,ep) -- awards ep to a single character if not (admin()) then return end - local newep = ep + (self:get_ep_v3(getname) or 0) --DONE: update v3 - self:update_ep_v3(getname,newep) --DONE: update v3 - self:debugPrint(string.format(L["Giving %d ep to %s"],ep,getname)) + local postfix, alt = "" + if (sepgp_altspool) then -- TODO: Main/Alt notification + local main = self:parseAlt(getname) + if (main) then + alt = getname + getname = main + ep = self:num_round(sepgp_altpercent*ep) + postfix = string.format(L[", %s\'s Main."],alt) + end + end + local newep = ep + (self:get_ep_v3(getname) or 0) + self:update_ep_v3(getname,newep) + self:debugPrint(string.format(L["Giving %d ep to %s%s."],ep,getname,postfix)) if ep < 0 then -- inform admins and victim of penalties - local msg = string.format(L["%s EP Penalty to %s."],ep,getname) + local msg = string.format(L["%s EP Penalty to %s%s."],ep,getname,postfix) self:adminSay(msg) self:addToLog(msg) local addonMsg = string.format("%s;%s;%s",getname,"EP",ep) @@ -911,11 +966,20 @@ end function sepgp:givename_gp(getname,gp) -- assigns gp to a single character if not (admin()) then return end - local oldgp = (self:get_gp_v3(getname) or sepgp.VARS.basegp) --DONE: update v3 + local postfix, alt = "" + if (sepgp_altspool) then -- TODO: Main/Alt notification + local main = self:parseAlt(getname) + if (main) then + alt = getname + getname = main + postfix = string.format(L[", %s\'s Main."],alt) + end + end + local oldgp = (self:get_gp_v3(getname) or sepgp.VARS.basegp) local newgp = gp + oldgp - self:update_gp_v3(getname,newgp) --DONE: update v3 - self:debugPrint(string.format(L["Giving %d gp to %s"],gp,getname)) - local msg = string.format(L["Awarding %d GP to %s. (Previous: %d, New: %d)"],gp,getname,oldgp,math.max(sepgp.VARS.basegp,newgp)) + self:update_gp_v3(getname,newgp) + self:debugPrint(string.format(L["Giving %d gp to %s%s."],gp,getname,postfix)) + local msg = string.format(L["Awarding %d GP to %s%s. (Previous: %d, New: %d)"],gp,getname,postfix,oldgp,math.max(sepgp.VARS.basegp,newgp)) self:adminSay(msg) self:addToLog(msg) local addonMsg = string.format("%s;%s;%s",getname,"GP",gp) @@ -1039,12 +1103,12 @@ local T = AceLibrary("Tablet-2.0") sepgp.defaultMinimapPosition = 180 sepgp.cannotDetachTooltip = true sepgp.tooltipHiddenWhenEmpty = false -sepgp.hasIcon = "Interface\\Icons\\INV_Misc_Orb_04" +sepgp.hasIcon = "Interface\\PetitionFrame\\GuildCharter-Icon" 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+Shift+Click|r to toggle Logs."]) + 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 @@ -1055,6 +1119,8 @@ function sepgp:OnClick() local is_admin = admin() if (IsControlKeyDown() and IsShiftKeyDown() and is_admin) then sepgp_logs:Toggle() + elseif (IsControlKeyDown() and IsAltKeyDown() and is_admin) then + sepgp_alts:Toggle() elseif (IsControlKeyDown() and is_admin) then sepgp_reserves:Toggle() elseif (IsShiftKeyDown() and is_admin) then @@ -1082,8 +1148,21 @@ function sepgp:buildRosterTable() r[name] = true end end + sepgp.alts = {} for i = 1, numGuildMembers do - local member_name,_,_,_,class,_,ep,gp,_,_ = GetGuildRosterInfo(i) + local member_name,_,_,_,class,_,note,officernote,_,_ = GetGuildRosterInfo(i) + local main, main_class, main_rank = self:parseAlt(member_name,officernote) + if (main) then + if ((self._playerName) and (name == self._playerName)) then + if (not sepgp_main) or (sepgp_main and sepgp_main ~= main) then + sepgp_main = main + self:defaultPrint(L["Your main has been set to %s"],sepgp_main) + end + end + main = C:Colorize(BC:GetHexColor(main_class), main) + sepgp.alts[main] = sepgp.alts[main] or {} + sepgp.alts[main][member_name] = class + end if (sepgp_raidonly) and next(r) then if r[member_name] then table.insert(g,{["name"]=member_name,["class"]=class}) @@ -1202,6 +1281,40 @@ function sepgp:buildMenu() hidden = function() return not (admin()) end, func = function() sepgp:afkcheck_reserves() end } + options.args["alts"] = { + type = "toggle", + name = L["Enable Alts"], + desc = L["Allow Alts to use Main\'s EPGP."], + order = 63, + hidden = function() return not (admin()) end, + disabled = function() return not (IsGuildLeader()) end, + get = function() return not not sepgp_altspool end, + set = function(v) + sepgp_altspool = not sepgp_altspool + if (IsGuildLeader()) then + sepgp:shareSettings(true) + end + end, + } + options.args["alts_percent"] = { + type = "range", + name = L["Alts EP %"], + desc = L["Set the % EP Alts can earn."], + order = 66, + hidden = function() return not (admin()) end, + disabled = function() return not sepgp_altspool end, + get = function() return sepgp_altpercent end, + set = function(v) + sepgp_altpercent = v + if (IsGuildLeader()) then + sepgp:shareSettings(true) + end + end, + min = 0.5, + max = 1, + step = 0.05, + isPercent = true + } options.args["set_main"] = { type = "text", name = L["Set Main"], @@ -1253,7 +1366,7 @@ function sepgp:buildMenu() desc = string.format(L["Decays all EPGP by %s%%"],(1-(sepgp_decay or sepgp.VARS.decay))*100), order = 100, hidden = function() return not (admin()) end, - func = function() sepgp:decay_epgp_v3() end --DONE: update v3 + func = function() sepgp:decay_epgp_v3() end } options.args["set_decay"] = { type = "range", @@ -1313,6 +1426,35 @@ function sepgp:buildMenu() return options end +--------------- +-- Alts +--------------- +function sepgp:parseAlt(name,officernote) + if (officernote) then + local _,_,_,main,_ = string.find(officernote or "","(.*){([%a][%a]%a*)}(.*)") + if type(main)=="string" and (string.len(main) < 13) then + main = self:camelCase(main) + local g_name, g_class, g_rank, g_officernote = self:verifyGuildMember(main) + if (g_name) then + return g_name, g_class, g_rank, g_officernote + else + return nil + end + else + return nil + end + else + for i=1,GetNumGuildMembers(1) do + local g_name, _, _, _, g_class, _, g_note, g_officernote, _, _ = GetGuildRosterInfo(i) + if (name == g_name) then + return self:parseAlt(g_name, g_officernote) + end + end + end + return nil +end + + --------------- -- Reserves --------------- @@ -1426,7 +1568,7 @@ function sepgp:captureReserveChatter(text, sender, _, _, _, _, _, _, channel) end local q = string.find(text,L["^{shootyepgp}Type"]) if (q) and not (running_check) then - if (not UnitInRaid("player")) or (not self:inRaid(sender)) then + if --[[(not UnitInRaid("player")) or]] (not self:inRaid(sender)) then StaticPopup_Show("SHOOTY_EPGP_RESERVE_AFKCHECK_RESPONCE") end end @@ -1524,14 +1666,31 @@ function sepgp:captureBid(text, sender) for i = 1, GetNumGuildMembers(1) do local name, _, _, _, class, _, note, officernote, _, _ = GetGuildRosterInfo(i) if name == sender then - local ep = (self:get_ep_v3(name,officernote) or 0) --DONE: update v3 - local gp = (self:get_gp_v3(name,officernote) or sepgp.VARS.basegp) --DONE: update v3 + 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 main, main_class, main_rank, main_offnote = self:parseAlt(name,officernote) + if (main) then + ep = (self:get_ep_v3(main,main_offnote) or 0) + gp = (self:get_gp_v3(main,main_offnote) or sepgp.VARS.basegp) + main_name = main + end + end if (mskw_found) then bids_blacklist[sender] = true - table.insert(sepgp.bids_main,{name,class,ep,gp,ep/gp}) + if (sepgp_altspool) and (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 bids_blacklist[sender] = true - table.insert(sepgp.bids_off,{name,class,ep,gp,ep/gp}) + if (sepgp_altspool) and (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 end sepgp_bids:Toggle(true) return @@ -1753,7 +1912,7 @@ function sepgp:verifyGuildMember(name,silent) for i=1,GetNumGuildMembers(1) do local g_name, g_rank, g_rankIndex, g_level, g_class, g_zone, g_note, g_officernote, g_online = GetGuildRosterInfo(i) if (string.lower(name) == string.lower(g_name)) and (tonumber(g_level) == MAX_PLAYER_LEVEL) then - return g_name, g_class, g_rank + return g_name, g_class, g_rank, g_officernote end end if (name) and name ~= "" and not (silent) then @@ -1780,6 +1939,20 @@ function sepgp:lootMaster() end end +function sepgp:make_escable(framename,operation) + local found + for i in UISpecialFrames do + if UISpecialFrames[i]==framename then + found = i + end + end + if not found and operation=="add" then + table.insert(UISpecialFrames,framename) + elseif found and operation=="remove" then + table.remove(UISpecialFrames,found) + end +end + local raidZones = {[L["Molten Core"]]="T1",[L["Onyxia\'s Lair"]]="T1.5",[L["Blackwing Lair"]]="T2",[L["Ahn\'Qiraj"]]="T2.5",[L["Naxxramas"]]="T3"} local zone_multipliers = { ["T3"] = {["T3"]=1,["T2.5"]=0.75,["T2"]=0.5,["T1.5"]=0.25,["T1"]=0.25}, @@ -1859,6 +2032,12 @@ function sepgp:parseVersion(version,otherVersion) end end +function sepgp:camelCase(word) + return string.gsub(word,"(%a)([%w_']*)",function(head,tail) + return string.format("%s%s",string.upper(head),string.lower(tail)) + end) +end + admin = function() return (CanEditOfficerNote() --[[and CanEditPublicNote()]]) end @@ -1901,7 +2080,8 @@ StaticPopupDialogs["SHOOTY_EPGP_SET_MAIN"] = { maxLetters = 12, OnAccept = function() local editBox = getglobal(this:GetParent():GetName().."EditBox") - sepgp_main = sepgp:verifyGuildMember(editBox:GetText()) + local name = sepgp:camelCase(editBox:GetText()) + sepgp_main = sepgp:verifyGuildMember(name) end, OnShow = function() getglobal(this:GetName().."EditBox"):SetText(sepgp_main or "") @@ -2053,5 +2233,5 @@ function sepgp:EasyMenu_Initialize(level, menuList) end end --- GLOBALS: sepgp_saychannel,sepgp_groupbyclass,sepgp_raidonly,sepgp_decay,sepgp_reservechannel,sepgp_main,sepgp_progress,sepgp_discount,sepgp_log,sepgp_dbver,sepgp_looted --- GLOBALS: sepgp,sepgp_prices,sepgp_standings,sepgp_bids,sepgp_loot,sepgp_reserves,sepgp_logs,sepgp_debug +-- GLOBALS: sepgp_saychannel,sepgp_groupbyclass,sepgp_raidonly,sepgp_decay,sepgp_reservechannel,sepgp_main,sepgp_progress,sepgp_discount,sepgp_altspool,sepgp_altpercent,sepgp_log,sepgp_dbver,sepgp_looted,sepgp_debug +-- GLOBALS: sepgp,sepgp_prices,sepgp_standings,sepgp_bids,sepgp_loot,sepgp_reserves,sepgp_alts,sepgp_logs diff --git a/shootyepgp.toc b/shootyepgp.toc index 40ff56f..7ee38f1 100644 --- a/shootyepgp.toc +++ b/shootyepgp.toc @@ -8,10 +8,10 @@ ## X-Category: Guild ## X-Credits: shooty,Qcat(zhCN) ## Version: 3.31.1 -## X-Alpha: 3.31.2 +## X-Alpha: 3.4 ## OptionalDeps: Ace2 ## SavedVariables: sepgp_saychannel, sepgp_groupbyclass, sepgp_raidonly, sepgp_dbver, sepgp_debug -## SavedVariablesPerCharacter: sepgp_main, sepgp_log, sepgp_looted, sepgp_decay, sepgp_reservechannel, sepgp_progress, sepgp_discount +## SavedVariablesPerCharacter: sepgp_main, sepgp_log, sepgp_looted, sepgp_decay, sepgp_reservechannel, sepgp_progress, sepgp_discount, sepgp_altspool, sepgp_altpercent Libs\AceLibrary\AceLibrary.lua Libs\AceOO-2.0\AceOO-2.0.lua @@ -42,4 +42,5 @@ standings.lua bids.lua loot.lua reserves.lua +alts.lua logs.lua diff --git a/standings.lua b/standings.lua index 0861099..1cfb38b 100644 --- a/standings.lua +++ b/standings.lua @@ -71,8 +71,8 @@ function sepgp_standings:Export() local t = {} for i = 1, GetNumGuildMembers(1) do local name, _, _, _, class, _, note, officernote, _, _ = GetGuildRosterInfo(i) - local ep = (sepgp:get_ep_v3(name,officernote) or 0) --DONE: update v3 - local gp = (sepgp:get_gp_v3(name,officernote) or sepgp.VARS.basegp) --DONE: update v3 + local ep = (sepgp:get_ep_v3(name,officernote) or 0) + local gp = (sepgp:get_gp_v3(name,officernote) or sepgp.VARS.basegp) if ep > 0 then table.insert(t,{name,ep,gp,ep/gp}) end @@ -189,10 +189,11 @@ function sepgp_standings:Refresh() end function sepgp_standings:setHideScript() - local detachedFrame, tablet - for i=1,5 do - tablet = getglobal(string.format("Tablet20DetachedFrame%d",i)) - if tablet and tablet.owner ~= nil and tablet.owner == "sepgp_standings" then + local i = 1 + local tablet = getglobal(string.format("Tablet20DetachedFrame%d",i)) + while (tablet) and i<100 do + if tablet.owner ~= nil and tablet.owner == "sepgp_standings" then + sepgp:make_escable(string.format("Tablet20DetachedFrame%d",i),"add") if not (tablet:GetScript("OnHide")) then tablet:SetScript("OnHide",function() if not T:IsAttached("sepgp_standings") then @@ -201,8 +202,11 @@ function sepgp_standings:setHideScript() end end) end - end - end + break + end + i = i+1 + tablet = getglobal(string.format("Tablet20DetachedFrame%d",i)) + end end function sepgp_standings:Top() @@ -211,17 +215,20 @@ function sepgp_standings:Top() end end -function sepgp_standings:Toggle() +function sepgp_standings:Toggle(forceShow) self:Top() if T:IsAttached("sepgp_standings") then - T:Detach("sepgp_standings") + T:Detach("sepgp_standings") -- show if (T:IsLocked("sepgp_standings")) then T:ToggleLocked("sepgp_standings") end self:setHideScript() + elseif (forceShow) then + sepgp_standings:Refresh() + else - T:Attach("sepgp_standings") - end + T:Attach("sepgp_standings") -- hide + end end function sepgp_standings:ToggleGroupByClass() @@ -247,10 +254,23 @@ function sepgp_standings:BuildStandingsTable() r[name] = true end end + sepgp.alts = {} for i = 1, GetNumGuildMembers(1) do local name, _, _, _, class, _, note, officernote, _, _ = GetGuildRosterInfo(i) - local ep = (sepgp:get_ep_v3(name,officernote) or 0) --DONE: update v3 - local gp = (sepgp:get_gp_v3(name,officernote) or sepgp.VARS.basegp) --DONE: update v3 + local ep = (sepgp:get_ep_v3(name,officernote) or 0) + local gp = (sepgp:get_gp_v3(name,officernote) or sepgp.VARS.basegp) + local main, main_class, main_rank = sepgp:parseAlt(name,officernote) + if (main) then + if ((self._playerName) and (name == self._playerName)) then + if (not sepgp_main) or (sepgp_main and sepgp_main ~= main) then + sepgp_main = main + self:defaultPrint(L["Your main has been set to %s"],sepgp_main) + end + end + main = C:Colorize(BC:GetHexColor(main_class), main) + sepgp.alts[main] = sepgp.alts[main] or {} + sepgp.alts[main][name] = class + end if ep > 0 then if (sepgp_raidonly) and next(r) then if r[name] then @@ -289,7 +309,7 @@ function sepgp_standings:OnTooltipUpdate() local text2 = string.format("%.4g", ep) local text3 = string.format("%.4g", gp) local text4 = string.format("%.4g", pr) - if (sepgp._playerName) and sepgp._playerName == name then + if ((sepgp._playerName) and sepgp._playerName == name) or ((sepgp_main) and sepgp_main == name) then text = string.format("(*)%s",text) local pr_decay = sepgp:capcalc(ep,gp) if pr_decay < 0 then @@ -306,4 +326,4 @@ function sepgp_standings:OnTooltipUpdate() end -- GLOBALS: sepgp_saychannel,sepgp_groupbyclass,sepgp_raidonly,sepgp_decay,sepgp_reservechannel,sepgp_main,sepgp_progress,sepgp_discount,sepgp_log,sepgp_dbver,sepgp_looted --- GLOBALS: sepgp,sepgp_prices,sepgp_standings,sepgp_bids,sepgp_loot,sepgp_reserves,sepgp_logs +-- GLOBALS: sepgp,sepgp_prices,sepgp_standings,sepgp_bids,sepgp_loot,sepgp_reserves,sepgp_alts,sepgp_logs