WoWInterface SVN CoolLineFix

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 10 to Rev 9
    Reverse comparison

Rev 10 → Rev 9

trunk/Fix.lua
1,7 → 1,84
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", function()
C_Timer.After(5, function()
DEFAULT_CHAT_FRAME:AddMessage("|cffff7f7fIMPORTANT:|r CoolLine Fix is no longer needed. You should uninstall it!")
end)
end)
\ No newline at end of file +--[[-------------------------------------------------------------------- + CoolLine Fix + Hides CoolLine in pet battles, and adds support for spell charges. + Copyright (c) 2014 Phanx . All rights reserved. + See the accompanying README and LICENSE files for more information. + http://www.wowinterface.com/downloads/info22791-CoolLineFix.html + 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
trunk/README.txt New file
0,0 → 1,26
CoolLine Fix
===============
 
Hides CoolLine in pet battles, and adds support for spells charge.
 
 
Feedback
-----------
 
Post a ticket on either download site, or a comment on WoWInterface.
 
If you are reporting a bug, please include directions I can follow to
reproduce the bug, whether it still happens when all other addons are
disabled, and the exact text of the related error message (if any) from
[Bugger](http://www.wowinterface.com/downloads/info23144-Bugger.html).
 
If you need to contact me privately, you can send me a private message
on either download site, or email me at <addons@phanx.net>.
 
 
License
----------
 
Copyright (c) 2014 Phanx <addons@phanx.net>. All rights reserved.
See the accompanying LICENSE file for information about the conditions
under which redistribution and modification may be allowed.
trunk/CoolLineFix.toc
1,5 → 1,21
## Interface: 60000
## Version: 6.0.2.wowi:revision
 
## Title: CoolLine Fix
## Notes: No longer needed. Uninstall!
## 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. All rights reserved.
## X-License: See the 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.html
## 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) 2014 Phanx. 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 or interfere with the simultaneous use of this software.
 
Permission is granted for anyone to aggregate this software with other
works not derived from this software for the purpose of creating a user
interface replacement (also commonly known as a "compilation" or "addon
pack") for the "World of Warcraft" game client, and to distribute such
collective works 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.