From 6645664e88f657a8b3ba1563a1561a2265566a02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20=C3=81lvarez?= Date: Sat, 1 Nov 2014 01:25:03 +0100 Subject: [PATCH] first commit 1st! --- Broker_ConsolidatedBuffs.lua | 64 +++++ Broker_ConsolidatedBuffs.toc | 17 ++ BuffConsolidation.tga | Bin 0 -> 16402 bytes LICENSE | 21 ++ README.md | 1 + .../CallbackHandler-1.0.toc | 15 ++ .../CallbackHandler-1.0.lua | 238 ++++++++++++++++++ .../CallbackHandler-1.0.xml | 4 + ...ngelog-CallbackHandler-1.0-1.0.6.60000.txt | 16 ++ libs/CallbackHandler-1.0/LibStub/LibStub.lua | 30 +++ .../LibStub/Changelog-LibStub-1.0.2.60000.txt | 20 ++ libs/LibStub/LibStub.lua | 51 ++++ libs/LibStub/LibStub.toc | 13 + libs/LibStub/tests/test.lua | 41 +++ libs/LibStub/tests/test2.lua | 27 ++ libs/LibStub/tests/test3.lua | 14 ++ libs/LibStub/tests/test4.lua | 41 +++ .../LibDataBroker-1.1.lua | 90 +++++++ libs/libdatabroker-1-1-1.1.4/README.textile | 13 + 19 files changed, 716 insertions(+) create mode 100644 Broker_ConsolidatedBuffs.lua create mode 100644 Broker_ConsolidatedBuffs.toc create mode 100644 BuffConsolidation.tga create mode 100644 LICENSE create mode 100644 README.md create mode 100644 libs/CallbackHandler-1.0/CallbackHandler-1.0.toc create mode 100644 libs/CallbackHandler-1.0/CallbackHandler-1.0/CallbackHandler-1.0.lua create mode 100644 libs/CallbackHandler-1.0/CallbackHandler-1.0/CallbackHandler-1.0.xml create mode 100644 libs/CallbackHandler-1.0/Changelog-CallbackHandler-1.0-1.0.6.60000.txt create mode 100644 libs/CallbackHandler-1.0/LibStub/LibStub.lua create mode 100644 libs/LibStub/Changelog-LibStub-1.0.2.60000.txt create mode 100644 libs/LibStub/LibStub.lua create mode 100644 libs/LibStub/LibStub.toc create mode 100644 libs/LibStub/tests/test.lua create mode 100644 libs/LibStub/tests/test2.lua create mode 100644 libs/LibStub/tests/test3.lua create mode 100644 libs/LibStub/tests/test4.lua create mode 100644 libs/libdatabroker-1-1-1.1.4/LibDataBroker-1.1.lua create mode 100644 libs/libdatabroker-1-1-1.1.4/README.textile diff --git a/Broker_ConsolidatedBuffs.lua b/Broker_ConsolidatedBuffs.lua new file mode 100644 index 0000000..bdb8ec0 --- /dev/null +++ b/Broker_ConsolidatedBuffs.lua @@ -0,0 +1,64 @@ + +local addonName, addonNS = ... +local ldb = LibStub("LibDataBroker-1.1") + + +local BrokerConsolidatedBuffs = ldb:NewDataObject("Broker_ConsolidatedBuffs", { + type = "data source", + text = "Please wait", + value = 1, + icon = "Interface\\AddOns\\Broker_ConsolidatedBuffs\\BuffConsolidation", + label = "ConsolidatedBuffs", + + OnTooltipShow = function(tooltip) + tooltip:AddLine("Consolidated Buffs") + tooltip:AddLine(" ") + + for i = 1, NUM_LE_RAID_BUFF_TYPES do + local name, rank, texture, duration, expiration, spellId, slot = GetRaidBuffTrayAuraInfo(i) + local r, g, b + + if name then + r, g, b = 0, 1, 0 + else + r, g, b = 1, 0, 0 + end + + tooltip:AddLine(_G["RAID_BUFF_"..i], r, g, b) + end + end, + + OnClick = function(button) + local missing = "" + + for i = 1, NUM_LE_RAID_BUFF_TYPES do + if not GetRaidBuffTrayAuraInfo(i) then + missing = missing .. _G["RAID_BUFF_"..i] ..", " + end + end + + if missing ~= "" then + SendChatMessage(ADDON_MISSING..": "..strsub(missing, 0, strlen(missing)-2), "SAY") + end + end +}) + + +local function updateBuffs(self, event, unitID) + if (unitID == "player" or event == "PLAYER_ENTERING_WORLD") then + local c = 0 + for i = 1, NUM_LE_RAID_BUFF_TYPES do + if GetRaidBuffTrayAuraInfo(i) then + c = c + 1 + end + end + + BrokerConsolidatedBuffs.text = c.."/"..NUM_LE_RAID_BUFF_TYPES + end +end + + +local frame = CreateFrame("Frame") +frame:RegisterEvent("UNIT_AURA") +frame:RegisterEvent("PLAYER_ENTERING_WORLD") +frame:SetScript("OnEvent", updateBuffs) diff --git a/Broker_ConsolidatedBuffs.toc b/Broker_ConsolidatedBuffs.toc new file mode 100644 index 0000000..91c8bbd --- /dev/null +++ b/Broker_ConsolidatedBuffs.toc @@ -0,0 +1,17 @@ +## Interface: 60300 +## Title: Broker_ConsolidatedBuffs +## Notes: Track consolidated buffs +## Author: Gio +## Version: 0.1 +## SavedVariables: + +libs\LibStub\LibStub.lua +libs\CallbackHandler-1.0\CallbackHandler-1.0.xml +libs\libdatabroker-1-1-1.1.4\LibDataBroker-1.1.lua + +Broker_ConsolidatedBuffs.lua + +# Resources: +# http://www.curse.com/addons/wow/broker_raidbuffs (inspiration) +# ElvUI modules/auras/consolidatedBuffs.lua +# http://sethcoder.com/reference/wow/INTERFACE/BUTTONS/ diff --git a/BuffConsolidation.tga b/BuffConsolidation.tga new file mode 100644 index 0000000000000000000000000000000000000000..0b14cd7aa49c7273408cacbb9fcc2c8294679746 GIT binary patch literal 16402 zcmbVz1$Y!!+xBeMH=9j1$tD|jcOwoFh!RL}f)+^e;@aX4#icj}ifeH#h2jN@l|m?m z0>vE)6w2P;J+q|p_J8|-|DWr+ui2TM+01<&f6h6AU?WuhWeHh=ucqouIu2Q_(l%)C zA$a&Et0GdmJC?P*WGra`O;|jXUO`ZK1w-W#2(@k~5Z z2a@=?niaalH0a`aPa?-Ixd!Y~a$r|2hxb;8t@sSbQ-b(8DF?RV|0VRPd9X__fIcOU zzs3KXo)5cBo~PG>Z5r<(^l3F=%XiYoW&hWLi&EY<7_lm+d1A z8Sr}fj91D40VM90-HAg^MTTP99J=`$FmB50yEH_7M)PUo^Bn5zu-Q zK9SJ+TA}s|r45PqghA^c4cpKp=t2^Ce-t#ny!ZWmRYwiaMd$)!d2gb06u;92$Md-a zX#8m_e!M3jMuM8ZA$RtIjmZnTxD+^Yj6Ey*!Q8OojXoi(QXQEvMTm&W6JlaKgunu| zxEm+|hA@At~dObAElO0>Ys13V0XLVW1_T^T$y51VK=$At*EwWGWrc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<^pOU$HO_13c^JF@`pD?vjEu^G)$OA+3)B)jB zw82r8+VJ={(q2^VA=7a`sfu>2;a*x@T78a9Bk8D3DdYOcy4>r*7@EZUxaX3-m75Xy3W0APehNHiNp!in*rnD+qC@~ zQ%X*yE|mKpy(032pcD^b>Qps#o7&C&ul;8kRW6>TDhK02jc33`U0A{^?z{b6&%Gh~ z^gw_YE>??2{!5+=iS;6%7~8wzv#0dVW^2|T-xhVP&m@aaDp9^4P;-f=M3HV=^? zes=FLi0iX>4}a6E&jfgM8HT`#TnoK$3w%b-rH>!{yRkvVE8FU|FDk;g|1~(FR4C^D zSAm@W`X}yx_6_r)A1G4!h4<73#V*lCB;B&5-1L-*J@-dBHtNW{p$D9~f69q-NKRrN z$#a(v`oP?_FY*4!{a5BTy^f6n_V#B1-bw-cXh z&waNXZ_d-2`P**X3+dLjKjUjJu50cDr_#0rYgiF=Kj5{FaO3~<=*V#)e~+$2_Yv?K z$g%D^?3TV(gCz>?f0oBqFA~DC|GEFUY8=G| zVPFh!;66)Zy$aYDvM%8Kxlw$F`W0~D`-*#o#rHPXZwqs2E0}Z3VCKAnnYpI90l#D2 zWv)js_coXDd+A)fEqA`6W#&F@xAvcKFBjLhvA^xvYYaSkjJjl-lGk0ZbA7-6ef8h=zyA-&5hWr3 literal 0 HcmV?d00001 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..37b155c --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Sergio Álvarez (xergio@hmail.com) @giomoblin @xergio + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..ec6147d --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Broker_ConsolidatedBuffs, simple :) \ No newline at end of file diff --git a/libs/CallbackHandler-1.0/CallbackHandler-1.0.toc b/libs/CallbackHandler-1.0/CallbackHandler-1.0.toc new file mode 100644 index 0000000..7104cd5 --- /dev/null +++ b/libs/CallbackHandler-1.0/CallbackHandler-1.0.toc @@ -0,0 +1,15 @@ +## Interface: 60000 +## LoadOnDemand: 1 +## Title: Lib: CallbackHandler-1.0 +## Notes: Callback handling Library, normally embedded inside other libraries +## Author: Ace3 Development Team +## X-Website: http://www.wowace.com/projects/callbackhandler/ +## X-Category: Library +## X-License: BSD-2.0 +## X-Curse-Packaged-Version: 1.0.6.60000 +## X-Curse-Project-Name: CallbackHandler-1.0 +## X-Curse-Project-ID: callbackhandler +## X-Curse-Repository-ID: wow/callbackhandler/mainline + +LibStub\LibStub.lua +CallbackHandler-1.0\CallbackHandler-1.0.xml diff --git a/libs/CallbackHandler-1.0/CallbackHandler-1.0/CallbackHandler-1.0.lua b/libs/CallbackHandler-1.0/CallbackHandler-1.0/CallbackHandler-1.0.lua new file mode 100644 index 0000000..2a64013 --- /dev/null +++ b/libs/CallbackHandler-1.0/CallbackHandler-1.0/CallbackHandler-1.0.lua @@ -0,0 +1,238 @@ +--[[ $Id: CallbackHandler-1.0.lua 18 2014-10-16 02:52:20Z mikk $ ]] +local MAJOR, MINOR = "CallbackHandler-1.0", 6 +local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR) + +if not CallbackHandler then return end -- No upgrade needed + +local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end} + +-- Lua APIs +local tconcat = table.concat +local assert, error, loadstring = assert, error, loadstring +local setmetatable, rawset, rawget = setmetatable, rawset, rawget +local next, select, pairs, type, tostring = next, select, pairs, type, tostring + +-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded +-- List them here for Mikk's FindGlobals script +-- GLOBALS: geterrorhandler + +local xpcall = xpcall + +local function errorhandler(err) + return geterrorhandler()(err) +end + +local function CreateDispatcher(argCount) + local code = [[ + local next, xpcall, eh = ... + + local method, ARGS + local function call() method(ARGS) end + + local function dispatch(handlers, ...) + local index + index, method = next(handlers) + if not method then return end + local OLD_ARGS = ARGS + ARGS = ... + repeat + xpcall(call, eh) + index, method = next(handlers, index) + until not method + ARGS = OLD_ARGS + end + + return dispatch + ]] + + local ARGS, OLD_ARGS = {}, {} + for i = 1, argCount do ARGS[i], OLD_ARGS[i] = "arg"..i, "old_arg"..i end + code = code:gsub("OLD_ARGS", tconcat(OLD_ARGS, ", ")):gsub("ARGS", tconcat(ARGS, ", ")) + return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(next, xpcall, errorhandler) +end + +local Dispatchers = setmetatable({}, {__index=function(self, argCount) + local dispatcher = CreateDispatcher(argCount) + rawset(self, argCount, dispatcher) + return dispatcher +end}) + +-------------------------------------------------------------------------- +-- CallbackHandler:New +-- +-- target - target object to embed public APIs in +-- RegisterName - name of the callback registration API, default "RegisterCallback" +-- UnregisterName - name of the callback unregistration API, default "UnregisterCallback" +-- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API. + +function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName) + + RegisterName = RegisterName or "RegisterCallback" + UnregisterName = UnregisterName or "UnregisterCallback" + if UnregisterAllName==nil then -- false is used to indicate "don't want this method" + UnregisterAllName = "UnregisterAllCallbacks" + end + + -- we declare all objects and exported APIs inside this closure to quickly gain access + -- to e.g. function names, the "target" parameter, etc + + + -- Create the registry object + local events = setmetatable({}, meta) + local registry = { recurse=0, events=events } + + -- registry:Fire() - fires the given event/message into the registry + function registry:Fire(eventname, ...) + if not rawget(events, eventname) or not next(events[eventname]) then return end + local oldrecurse = registry.recurse + registry.recurse = oldrecurse + 1 + + Dispatchers[select('#', ...) + 1](events[eventname], eventname, ...) + + registry.recurse = oldrecurse + + if registry.insertQueue and oldrecurse==0 then + -- Something in one of our callbacks wanted to register more callbacks; they got queued + for eventname,callbacks in pairs(registry.insertQueue) do + local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten. + for self,func in pairs(callbacks) do + events[eventname][self] = func + -- fire OnUsed callback? + if first and registry.OnUsed then + registry.OnUsed(registry, target, eventname) + first = nil + end + end + end + registry.insertQueue = nil + end + end + + -- Registration of a callback, handles: + -- self["method"], leads to self["method"](self, ...) + -- self with function ref, leads to functionref(...) + -- "addonId" (instead of self) with function ref, leads to functionref(...) + -- all with an optional arg, which, if present, gets passed as first argument (after self if present) + target[RegisterName] = function(self, eventname, method, ... --[[actually just a single arg]]) + if type(eventname) ~= "string" then + error("Usage: "..RegisterName.."(eventname, method[, arg]): 'eventname' - string expected.", 2) + end + + method = method or eventname + + local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten. + + if type(method) ~= "string" and type(method) ~= "function" then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - string or function expected.", 2) + end + + local regfunc + + if type(method) == "string" then + -- self["method"] calling style + if type(self) ~= "table" then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): self was not a table?", 2) + elseif self==target then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): do not use Library:"..RegisterName.."(), use your own 'self'", 2) + elseif type(self[method]) ~= "function" then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - method '"..tostring(method).."' not found on self.", 2) + end + + if select("#",...)>=1 then -- this is not the same as testing for arg==nil! + local arg=select(1,...) + regfunc = function(...) self[method](self,arg,...) end + else + regfunc = function(...) self[method](self,...) end + end + else + -- function ref with self=object or self="addonId" or self=thread + if type(self)~="table" and type(self)~="string" and type(self)~="thread" then + error("Usage: "..RegisterName.."(self or \"addonId\", eventname, method): 'self or addonId': table or string or thread expected.", 2) + end + + if select("#",...)>=1 then -- this is not the same as testing for arg==nil! + local arg=select(1,...) + regfunc = function(...) method(arg,...) end + else + regfunc = method + end + end + + + if events[eventname][self] or registry.recurse<1 then + -- if registry.recurse<1 then + -- we're overwriting an existing entry, or not currently recursing. just set it. + events[eventname][self] = regfunc + -- fire OnUsed callback? + if registry.OnUsed and first then + registry.OnUsed(registry, target, eventname) + end + else + -- we're currently processing a callback in this registry, so delay the registration of this new entry! + -- yes, we're a bit wasteful on garbage, but this is a fringe case, so we're picking low implementation overhead over garbage efficiency + registry.insertQueue = registry.insertQueue or setmetatable({},meta) + registry.insertQueue[eventname][self] = regfunc + end + end + + -- Unregister a callback + target[UnregisterName] = function(self, eventname) + if not self or self==target then + error("Usage: "..UnregisterName.."(eventname): bad 'self'", 2) + end + if type(eventname) ~= "string" then + error("Usage: "..UnregisterName.."(eventname): 'eventname' - string expected.", 2) + end + if rawget(events, eventname) and events[eventname][self] then + events[eventname][self] = nil + -- Fire OnUnused callback? + if registry.OnUnused and not next(events[eventname]) then + registry.OnUnused(registry, target, eventname) + end + end + if registry.insertQueue and rawget(registry.insertQueue, eventname) and registry.insertQueue[eventname][self] then + registry.insertQueue[eventname][self] = nil + end + end + + -- OPTIONAL: Unregister all callbacks for given selfs/addonIds + if UnregisterAllName then + target[UnregisterAllName] = function(...) + if select("#",...)<1 then + error("Usage: "..UnregisterAllName.."([whatFor]): missing 'self' or \"addonId\" to unregister events for.", 2) + end + if select("#",...)==1 and ...==target then + error("Usage: "..UnregisterAllName.."([whatFor]): supply a meaningful 'self' or \"addonId\"", 2) + end + + + for i=1,select("#",...) do + local self = select(i,...) + if registry.insertQueue then + for eventname, callbacks in pairs(registry.insertQueue) do + if callbacks[self] then + callbacks[self] = nil + end + end + end + for eventname, callbacks in pairs(events) do + if callbacks[self] then + callbacks[self] = nil + -- Fire OnUnused callback? + if registry.OnUnused and not next(callbacks) then + registry.OnUnused(registry, target, eventname) + end + end + end + end + end + end + + return registry +end + + +-- CallbackHandler purposefully does NOT do explicit embedding. Nor does it +-- try to upgrade old implicit embeds since the system is selfcontained and +-- relies on closures to work. + diff --git a/libs/CallbackHandler-1.0/CallbackHandler-1.0/CallbackHandler-1.0.xml b/libs/CallbackHandler-1.0/CallbackHandler-1.0/CallbackHandler-1.0.xml new file mode 100644 index 0000000..876df83 --- /dev/null +++ b/libs/CallbackHandler-1.0/CallbackHandler-1.0/CallbackHandler-1.0.xml @@ -0,0 +1,4 @@ + +