WoWInterface SVN CoolLineFix

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 1 to Rev 2
    Reverse comparison

Rev 1 → Rev 2

trunk/CoolLineFix.toc New file
0,0 → 1,21
## Interface: 50400
## Version: 5.4.8.2
 
## Title: CoolLine Fix
## Notes: Hides CoolLine in pet battles, and adds support for spell charges.
## Notes-deDE: Versteckt CoolLine in Haustierkämpfen, und fügt Unterstützung für die Zaubersaufladungen hinzu.
## Notes-esES: Oculta CoolLine en los duelos de mascotas, y añade soporto para los cargas de hechizos.
## Notes-esMX: Oculta CoolLine en los duelos de mascotas, y añade soporto para los cargas de hechizos.
 
## Author: Phanx
## X-Email: addons@phanx.net
## X-Copyright: Copyright (c) 2014 Phanx
## X-License: Do not redistribute. See accompanying LICENSE file for details.
## X-CompatibleLocales: enUS, deDE, esES, esMX, frFR, itIT, ptBR, ruRU, koKR, zhCN, zhTW
## X-Website: http://www.wowinterface.com/downloads/info22791-CoolLineFix
## X-Curse-Project-ID: coolline-fix
## X-WoWI-ID: 22791
 
## Dependencies: CoolLine
 
Fix.lua
\ No newline at end of file
trunk/LICENSE.txt New file
0,0 → 1,33
Copyright (c) 2009-2014 Phanx <addons@phanx.net>
 
All rights reserved.
 
Permission is granted for anyone to use, read, or otherwise interpret
this software for any purpose, without any restrictions.
 
Permission is granted for anyone to modify this software or sample from
it, and to distribute such modified versions or derivative works as long
as neither the names of this software nor its authors are used in the
name or title of the work or in any other way that may cause it to be
confused with this software.
 
Permission is granted for anyone to distribute this software as part of
a bundled World of Warcraft user interface compilation as long as the
software is not modified in any way, including by modifying or removing
any files.
 
This software may not be distributed standalone or in any other way, in
whole or in part, modified or unmodified, without specific prior written
permission from the authors of this software.
 
The names of this software and/or its authors may not be used to promote
or endorse works derived from this software without specific prior
written permission from the authors of this 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 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
trunk/Fix.lua New file
0,0 → 1,84
--[[--------------------------------------------------------------------
CoolLine Fix
Hides CoolLine in pet battles, and adds support for spell charges.
Copyright (c) 2014 Phanx <addons@phanx.net>
Do not redistribute. See accompanying LICENSE file for details.
http://www.wowinterface.com/downloads/info22791-CoolLineFix
http://www.curse.com/wow/addons/coolline-fix
----------------------------------------------------------------------]]
-- Hide in pet battles
 
CoolLine:RegisterEvent("PET_BATTLE_OPENING_START")
CoolLine:RegisterEvent("PET_BATTLE_CLOSE")
 
CoolLine.PET_BATTLE_OPENING_START = CoolLine.Hide
CoolLine.PET_BATTLE_CLOSE = CoolLine.Show
 
if C_PetBattles.IsInBattle() then
CoolLine:Hide()
end
 
------------------------------------------------------------------------
-- Show spell charges
 
local CoolLineFix = CreateFrame("Frame")
CoolLineFix:SetScript("OnEvent", function(f, e, ...) return (f[e] or f["SPELLS_CHANGED"])(f, ...) end)
CoolLineFix:RegisterEvent("PLAYER_LOGIN")
CoolLineFix:RegisterEvent("SPELLS_CHANGED")
CoolLineFix:RegisterEvent("SPELL_UPDATE_CHARGES")
 
local chargeSpells = {
[BOOKTYPE_SPELL] = {},
[BOOKTYPE_PET] = {},
}
 
do -- cache spells that have a cooldown
local last
local GetSpellBookItemName, GetSpellBookItemInfo, GetSpellCharges = GetSpellBookItemName, GetSpellBookItemInfo, GetSpellCharges
local function CacheBook(bookType)
local t = chargeSpells[bookType]
local _, _, offset, numSpells = GetSpellTabInfo(2)
for i = 1, offset + numSpells do
local name = GetSpellBookItemName(i, bookType)
if not name then break end
local slotType, id = GetSpellBookItemInfo(i, bookType)
if id and slotType ~= "FLYOUT" and slotType ~= "FUTURESPELL" and id ~= last then
last = id
local currentCharges, maxCharges, cooldownStart, cooldownDuration = GetSpellCharges(id)
if maxCharges and maxCharges > 0 then
t[id] = name
end
end
end
end
 
function CoolLineFix:SPELLS_CHANGED()
CacheBook(BOOKTYPE_SPELL)
if not CoolLineDB.hidepet then
CacheBook(BOOKTYPE_PET)
end
end
end
 
do
local AVAILABLE = 2^32 / 1000
local GetSpellCharges, GetSpellTexture = GetSpellCharges, GetSpellTexture
local function CheckSpellBook(bookType)
for id, name in pairs(chargeSpells[bookType]) do
local currentCharges, maxCharges, cooldownStart, cooldownDuration = GetSpellCharges(id)
if cooldownStart and cooldownDuration and currentCharges < maxCharges and not CoolLineDB.block[name] then
local _, _, texture = GetSpellInfo(id)
CoolLine.NewCooldown(name, texture, cooldownStart + cooldownDuration, bookType == BOOKTYPE_SPELL)
else
CoolLine.ClearCooldown(nil, name)
end
end
end
 
function CoolLineFix:SPELL_UPDATE_CHARGES()
CheckSpellBook(BOOKTYPE_SPELL)
if not CoolLineDB.hidepet and HasPetUI() then
CheckSpellBook(BOOKTYPE_PET)
end
end
end
\ No newline at end of file