hunter pets

I used LibQTip for better presentation
This commit is contained in:
Sergio Álvarez 2014-11-09 00:25:26 +01:00
parent 9ae0d0a04d
commit b375fec5a3
13 changed files with 1661 additions and 4 deletions

View File

@ -1,5 +1,6 @@
local addonName, addonNS = ...
local LQT = LibStub('LibQTip-1.0')
local LDB = LibStub("LibDataBroker-1.1")
local LTT = LibStub("LibBabble-TalentTree-3.0"):GetLookupTable()
local LCT = LibStub("LibBabble-CreatureType-3.0"):GetLookupTable()
@ -113,9 +114,15 @@ local BrokerConsolidatedBuffs = LDB:NewDataObject("Broker_ConsolidatedBuffs", {
icon = "Interface\\AddOns\\Broker_ConsolidatedBuffs\\BuffConsolidation", -- I can't use the default because is a combination texture :(
label = "ConsolidatedBuffs",
OnTooltipShow = function(tooltip)
tooltip:AddLine(CONSOLIDATE_BUFFS_TEXT)
OnEnter = function(self)
local tooltip = LQT:Acquire("Broker_ConsolidatedBuffsTooltip", 3, "LEFT", "LEFT", "LEFT")
self.tooltip = tooltip
tooltip:AddHeader(CONSOLIDATE_BUFFS_TEXT)
tooltip:AddLine(" ")
tooltip:AddHeader(STATISTICS, ALL_CLASSES, PETS)--CONSOLIDATE_BUFFS_TEXT)
tooltip:AddSeparator()
--tooltip:AddLine(" ")
for i = 1, NUM_LE_RAID_BUFF_TYPES do
local name, rank, texture, duration, expiration, spellId, slot = GetRaidBuffTrayAuraInfo(i)
@ -135,13 +142,24 @@ local BrokerConsolidatedBuffs = LDB:NewDataObject("Broker_ConsolidatedBuffs", {
for ii = 1, #defaults[i][3] do
pets = pets ..", ".. defaults[i][3][ii]
end
tooltip:AddDoubleLine("\124T"..defaults[i][1]..":0\124t \124c"..c.._G["RAID_BUFF_"..i].."\124r", strsub(classes, 2))
tooltip:AddDoubleLine(" ", strsub(pets, 2))
tooltip:AddLine(
"\124T"..defaults[i][1]..":0\124t \124c"..c.._G["RAID_BUFF_"..i].."\124r",
strsub(classes, 2),
strsub(pets, 2)
)
--tooltip:AddLine(" ")
--tooltip:AddLine("\124T"..defaults[i][1]..":0\124t \124c"..c.._G["RAID_BUFF_"..i].."\124r "..list)
--tooltip:AddLine(" "..list)
end
tooltip:SmartAnchorTo(self)
tooltip:Show()
end,
OnLeave = function(self)
LQT:Release(self.tooltip)
self.tooltip = nil
end,
OnClick = function(button)

View File

@ -10,6 +10,7 @@ libs\CallbackHandler-1.0\CallbackHandler-1.0.xml
libs\libdatabroker-1-1-1.1.4\LibDataBroker-1.1.lua
libs\LibBabble-TalentTree-3.0\lib.xml
libs\LibBabble-CreatureType-3.0\lib.xml
libs\LibQTip-1.0\LibQTip-1.0.lua
Broker_ConsolidatedBuffs.lua

View File

@ -0,0 +1,13 @@
------------------------------------------------------------------------
r167 | torhal | 2014-10-25 18:10:40 +0000 (Sat, 25 Oct 2014) | 1 line
Changed paths:
A /tags/r167-release (from /trunk:166)
Tagging as r167-release
------------------------------------------------------------------------
r166 | torhal | 2014-10-25 18:09:58 +0000 (Sat, 25 Oct 2014) | 1 line
Changed paths:
M /trunk/LibQTip-1.0.toc
Updated ToC Interface to 60000
------------------------------------------------------------------------

View File

@ -0,0 +1,29 @@
Copyright (c) 2008, LibQTip Development Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Redistribution of a stand alone version is strictly prohibited without
prior written authorization from the Lead of the LibQTip Development Team.
* Neither the name of the LibQTip Development Team nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
## Interface: 60000
## Title: Lib: QTip-1.0
## Notes: Library providing multi-column tooltips.
## Author: Torhal, Adirelle, Elkano, Tristanian
## Version: r167-release
## LoadOnDemand: 1
## X-Date: 2014-10-25T18:09:58Z
## X-Credits: Kaelten (input on initial design)
## X-Category: Library, Tooltip
## X-License: Ace3 BSD-like license
## X-Website: http://www.wowace.com/addons/libqtip-1-0/
## X-Curse-Packaged-Version: r167-release
## X-Curse-Project-Name: LibQTip-1.0
## X-Curse-Project-ID: libqtip-1-0
## X-Curse-Repository-ID: wow/libqtip-1-0/mainline
LibStub\LibStub.lua
lib.xml

View File

@ -0,0 +1,51 @@
-- $Id: LibStub.lua 103 2014-10-16 03:02:50Z mikk $
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/addons/libstub/ for more info
-- LibStub is hereby placed in the Public Domain
-- Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
local LibStub = _G[LIBSTUB_MAJOR]
-- Check to see is this version of the stub is obsolete
if not LibStub or LibStub.minor < LIBSTUB_MINOR then
LibStub = LibStub or {libs = {}, minors = {} }
_G[LIBSTUB_MAJOR] = LibStub
LibStub.minor = LIBSTUB_MINOR
-- LibStub:NewLibrary(major, minor)
-- major (string) - the major version of the library
-- minor (string or number ) - the minor version of the library
--
-- returns nil if a newer or same version of the lib is already present
-- returns empty library object or old library object if upgrade is needed
function LibStub:NewLibrary(major, minor)
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")
local oldminor = self.minors[major]
if oldminor and oldminor >= minor then return nil end
self.minors[major], self.libs[major] = minor, self.libs[major] or {}
return self.libs[major], oldminor
end
-- LibStub:GetLibrary(major, [silent])
-- major (string) - the major version of the library
-- silent (boolean) - if true, library is optional, silently return nil if its not found
--
-- throws an error if the library can not be found (except silent is set)
-- returns the library object if found
function LibStub:GetLibrary(major, silent)
if not self.libs[major] and not silent then
error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
end
return self.libs[major], self.minors[major]
end
-- LibStub:IterateLibraries()
--
-- Returns an iterator for the currently registered libraries
function LibStub:IterateLibraries()
return pairs(self.libs)
end
setmetatable(LibStub, { __call = LibStub.GetLibrary })
end

View File

@ -0,0 +1,13 @@
## Interface: 60000
## Title: Lib: LibStub
## Notes: Universal Library Stub
## Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel
## X-Website: http://www.wowace.com/addons/libstub/
## X-Category: Library
## X-License: Public Domain
## X-Curse-Packaged-Version: 1.0.2.60000
## X-Curse-Project-Name: LibStub
## X-Curse-Project-ID: libstub
## X-Curse-Repository-ID: wow/libstub/mainline
LibStub.lua

View File

@ -0,0 +1,41 @@
debugstack = debug.traceback
strmatch = string.match
loadfile("../LibStub.lua")()
local lib, oldMinor = LibStub:NewLibrary("Pants", 1) -- make a new thingy
assert(lib) -- should return the library table
assert(not oldMinor) -- should not return the old minor, since it didn't exist
-- the following is to create data and then be able to check if the same data exists after the fact
function lib:MyMethod()
end
local MyMethod = lib.MyMethod
lib.MyTable = {}
local MyTable = lib.MyTable
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 1) -- try to register a library with the same version, should silently fail
assert(not newLib) -- should not return since out of date
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 0) -- try to register a library with a previous, should silently fail
assert(not newLib) -- should not return since out of date
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 2) -- register a new version
assert(newLib) -- library table
assert(rawequal(newLib, lib)) -- should be the same reference as the previous
assert(newOldMinor == 1) -- should return the minor version of the previous version
assert(rawequal(lib.MyMethod, MyMethod)) -- verify that values were saved
assert(rawequal(lib.MyTable, MyTable)) -- verify that values were saved
local newLib, newOldMinor = LibStub:NewLibrary("Pants", "Blah 3 Blah") -- register a new version with a string minor version (instead of a number)
assert(newLib) -- library table
assert(newOldMinor == 2) -- previous version was 2
local newLib, newOldMinor = LibStub:NewLibrary("Pants", "Blah 4 and please ignore 15 Blah") -- register a new version with a string minor version (instead of a number)
assert(newLib)
assert(newOldMinor == 3) -- previous version was 3 (even though it gave a string)
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 5) -- register a new library, using a normal number instead of a string
assert(newLib)
assert(newOldMinor == 4) -- previous version was 4 (even though it gave a string)

View File

@ -0,0 +1,27 @@
debugstack = debug.traceback
strmatch = string.match
loadfile("../LibStub.lua")()
for major, library in LibStub:IterateLibraries() do
-- check that MyLib doesn't exist yet, by iterating through all the libraries
assert(major ~= "MyLib")
end
assert(not LibStub:GetLibrary("MyLib", true)) -- check that MyLib doesn't exist yet by direct checking
assert(not pcall(LibStub.GetLibrary, LibStub, "MyLib")) -- don't silently fail, thus it should raise an error.
local lib = LibStub:NewLibrary("MyLib", 1) -- create the lib
assert(lib) -- check it exists
assert(rawequal(LibStub:GetLibrary("MyLib"), lib)) -- verify that :GetLibrary("MyLib") properly equals the lib reference
assert(LibStub:NewLibrary("MyLib", 2)) -- create a new version
local count=0
for major, library in LibStub:IterateLibraries() do
-- check that MyLib exists somewhere in the libraries, by iterating through all the libraries
if major == "MyLib" then -- we found it!
count = count +1
assert(rawequal(library, lib)) -- verify that the references are equal
end
end
assert(count == 1) -- verify that we actually found it, and only once

View File

@ -0,0 +1,14 @@
debugstack = debug.traceback
strmatch = string.match
loadfile("../LibStub.lua")()
local proxy = newproxy() -- non-string
assert(not pcall(LibStub.NewLibrary, LibStub, proxy, 1)) -- should error, proxy is not a string, it's userdata
local success, ret = pcall(LibStub.GetLibrary, proxy, true)
assert(not success or not ret) -- either error because proxy is not a string or because it's not actually registered.
assert(not pcall(LibStub.NewLibrary, LibStub, "Something", "No number in here")) -- should error, minor has no string in it.
assert(not LibStub:GetLibrary("Something", true)) -- shouldn't've created it from the above statement

View File

@ -0,0 +1,41 @@
debugstack = debug.traceback
strmatch = string.match
loadfile("../LibStub.lua")()
-- Pretend like loaded libstub is old and doesn't have :IterateLibraries
assert(LibStub.minor)
LibStub.minor = LibStub.minor - 0.0001
LibStub.IterateLibraries = nil
loadfile("../LibStub.lua")()
assert(type(LibStub.IterateLibraries)=="function")
-- Now pretend that we're the same version -- :IterateLibraries should NOT be re-created
LibStub.IterateLibraries = 123
loadfile("../LibStub.lua")()
assert(LibStub.IterateLibraries == 123)
-- Now pretend that a newer version is loaded -- :IterateLibraries should NOT be re-created
LibStub.minor = LibStub.minor + 0.0001
loadfile("../LibStub.lua")()
assert(LibStub.IterateLibraries == 123)
-- Again with a huge number
LibStub.minor = LibStub.minor + 1234567890
loadfile("../LibStub.lua")()
assert(LibStub.IterateLibraries == 123)
print("OK")

4
libs/LibQTip-1.0/lib.xml Normal file
View File

@ -0,0 +1,4 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="LibQTip-1.0.lua"/>
</Ui>