WoWInterface SVN CoolLine

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 50 to Rev 49
    Reverse comparison

Rev 50 → Rev 49

trunk/CoolLine/core.lua
1,13 → 1,18
local CoolLine = CreateFrame("Frame", "CoolLine", UIParent)
CoolLine:SetScript("OnEvent", function(this, event, ...)
local self = CoolLine
self:SetScript("OnEvent", function(this, event, ...)
this[event](this, ...)
end)
local smed = LibStub("LibSharedMedia-3.0")
 
local _G, pairs, strmatch, tinsert, tremove, random = _G. pairs, string.match, table.insert, table.remove, math.random
local _G = getfenv(0)
local pairs, ipairs = pairs, ipairs
local tinsert, tremove = tinsert, tremove
local GetTime = GetTime
local random = math.random
local strmatch = strmatch
local UnitExists, HasPetUI = UnitExists, HasPetUI
local GetSpellInfo = GetSpellInfo
local UnitExists, HasPetUI = UnitExists, HasPetUI
 
local db, block
local backdrop = { edgeSize=16, } -- Left Unchanged
20,19 → 25,19
 
local SetValue, updatelook, createfs, ShowOptions, RuneCheck
local function SetValueH(this, v, just)
this:SetPoint(just or "CENTER", CoolLine, "LEFT", v, 0)
this:SetPoint(just or "CENTER", self, "LEFT", v, 0)
end
local function SetValueHR(this, v, just)
this:SetPoint(just or "CENTER", CoolLine, "LEFT", db.w - v, 0)
this:SetPoint(just or "CENTER", self, "LEFT", db.w - v, 0)
end
local function SetValueV(this, v, just)
this:SetPoint(just or "CENTER", CoolLine, "BOTTOM", 0, v)
this:SetPoint(just or "CENTER", self, "BOTTOM", 0, v)
end
local function SetValueVR(this, v, just)
this:SetPoint(just or "CENTER", CoolLine, "BOTTOM", 0, db.h - v)
this:SetPoint(just or "CENTER", self, "BOTTOM", 0, db.h - v)
end
 
CoolLine:RegisterEvent("ADDON_LOADED")
self:RegisterEvent("ADDON_LOADED")
function CoolLine:ADDON_LOADED(a1)
if a1 ~= "CoolLine" then return end
self:UnregisterEvent("ADDON_LOADED")
233,8 → 238,9
self:RegisterUnitEvent("UNIT_SPELLCAST_FAILED", "player")
end
CoolLine:SetAlpha((CoolLine.unlock or #cooldowns > 0) and db.activealpha or db.inactivealpha)
for i = 1, #cooldowns do
cooldowns[i]:SetSize(iconsize, iconsize)
for _, frame in ipairs(cooldowns) do
frame:SetWidth(iconsize)
frame:SetHeight(iconsize)
end
end
CoolLine.updatelook = updatelook
297,8 → 303,7
local elapsed, throt, ptime, isactive = 0, 1.5, 0, false
local function ClearCooldown(f, name)
name = name or (f and f.name)
for i = 1, #cooldowns do
local frame = cooldowns[i]
for index, frame in ipairs(cooldowns) do
if frame.name == name then
frame:Hide()
frame.name = nil
323,8 → 328,8
 
if #cooldowns == 0 then
if not CoolLine.unlock then
CoolLine:SetScript("OnUpdate", nil)
CoolLine:SetAlpha(db.inactivealpha)
self:SetScript("OnUpdate", nil)
self:SetAlpha(db.inactivealpha)
end
return
end
368,7 → 373,7
end
end
if not isactive and not CoolLine.unlock then
CoolLine:SetAlpha(db.inactivealpha)
self:SetAlpha(db.inactivealpha)
end
end
local function NewCooldown(name, icon, endtime, isplayer)
402,9 → 407,9
local c = db[isplayer and "spellcolor" or "nospellcolor"]
f:SetBackdropColor(c.r, c.g, c.b, c.a)
f:Show()
CoolLine:SetScript("OnUpdate", OnUpdate)
CoolLine:SetAlpha(db.activealpha)
OnUpdate(CoolLine, 2, ctime)
self:SetScript("OnUpdate", OnUpdate)
self:SetAlpha(db.activealpha)
OnUpdate(self, 2, ctime)
end
CoolLine.NewCooldown, CoolLine.ClearCooldown = NewCooldown, ClearCooldown
 
483,8 → 488,7
local _, _, texture = GetSpellInfo(id)
NewCooldown(name, texture, start + duration, btype == BOOKTYPE_SPELL)
else
for i = 1, #cooldowns do
local frame = cooldowns[i]
for index, frame in ipairs(cooldowns) do
if frame.name == name then
if frame.endtime > start + duration + 0.1 then
frame.endtime = start + duration
604,10 → 608,10
if enable == 1 then
if start > 0 and not block[GetActionInfo(b.action)] then
if duration > 3 then
NewCooldown("vehicle"..i, GetActionTexture(b.action), start + duration)
NewCooldown("vhcle"..i, GetActionTexture(b.action), start + duration)
end
else
ClearCooldown(nil, "vehicle"..i)
ClearCooldown(nil, "vhcle"..i)
end
end
end
625,9 → 629,8
function CoolLine:UNIT_EXITED_VEHICLE()
-----------------------------------------
self:UnregisterEvent("ACTIONBAR_UPDATE_COOLDOWN")
for i = 1, #cooldowns do
local frame = cooldowns[i]
if strmatch(frame.name, "vehicle") then
for index, frame in ipairs(cooldowns) do
if strmatch(frame.name, "vhcle") then
ClearCooldown(nil, frame.name)
end
end