WoWInterface SVN Blessed

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 18 to Rev 19
    Reverse comparison

Rev 18 → Rev 19

trunk/Blessed/Blessed.lua
8,99 → 8,58
local addon, Blessed = ...
local pguid
 
-- Times, times, times
local durations = {
[1044] = 6, -- Hand of Freedom
[1022] = 10, -- Hand of Protection
[6940] = 12, -- Hand of Sacrifice
[1038] = 10, -- Hand of Salvation
[31842] = 20, -- Divine Favor
[54428] = 9, -- Divine Plea
[20925] = 10, -- Holy Shield
[31821] = 6, -- Devotion Aura
[84963] = 12, -- Inquisition
[88819] = 12, -- Daybreak
[94686] = 8, -- Supplication
[54149] = 15, -- Infusion of Light
[31884] = 20, -- Avenging Wrath
[85499] = 8, -- Speed of Light
[20925] = 30, -- Sacred Shield
-- [86678] = 7, -- Light of the Ancient Kings
[114039] = 6, -- Hand of Purity
[105809] = 18, -- Holy Avenger
}
 
-- defaults
local defaults = {
pandaria = true,
framePoint = "CENTER",
xOfs = 0,
yOfs = -150,
locked = true,
spells = {
[1044] = { -- Hand of Freedom
enabled = true,
duration = 6,
},
[1022] = { -- Hand of Protection
enabled = true,
duration = 10,
},
[6940] = { -- Hand of Sacrifice
enabled = true,
duration = 12,
},
[1038] = { -- Hand of Salvation
enabled = true,
duration = 10,
},
[53563] = { -- Light's Beacon
enabled = true,
duration = 300,
},
[31842] = { -- Divine Favor
enabled = false,
duration = 20,
},
[54428] = { -- Divine Plea
enabled = true,
duration = 9,
},
[53657] = { -- Judgement of the Pure (3/3)
enabled = true,
duration = 60,
},
[20925] = { -- Holy Shield
enabled = true,
duration = 10,
},
[31821] = { -- Aura Mastery
enabled = false,
duration = 6,
},
[84963] = { -- Inquisition
enabled = true,
duration = 12,
},
[88819] = { -- Daybreak
enabled = false,
duration = 12,
},
[85433] = { -- Sacred Duty
enabled = true,
duration = 10,
},
[94686] = { -- Crusader
enabled = true,
duration = 15,
},
[54149] = { -- Infusion of Light
enabled = true,
duration = 15,
},
[105742] = { -- Saint's Vigor
enabled = false,
duration = 15,
},
[85696] = { -- Zealotry
enabled = false,
duration = 20,
},
[31884] = { -- Avenging Wrath
enabled = false,
duration = 20,
},
[86698] = { -- Guardian of Ancient Kings (Retribution)
enabled = false,
duration = 30,
},
[86659] = { -- Guardian of Ancient Kings (Protection)
enabled = false,
duration = 30,
},
[86669] = { -- Guardian of Ancient Kings (Holy)
enabled = false,
duration = 30,
},
}
[1044] = true, -- Hand of Freedom
[1022] = true, -- Hand of Protection
[6940] = true, -- Hand of Sacrifice
[1038] = true, -- Hand of Salvation
[53563] = true, -- Beacon of Light
[31842] = true, -- Divine Favor
[54428] = true, -- Divine Plea
[20925] = true, -- Holy Shield
[31821] = true, -- Devotion Aura
[84963] = true, -- Inquisition
[88819] = true, -- Daybreak
[94686] = true, -- Supplication
[54149] = true, -- Infusion of Light
[31884] = true, -- Avenging Wrath
[85499] = true, -- Speed of Light
[20925] = true, -- Sacred Shield
-- [86678] = true, -- Light of the Ancient Kings
[114039] = true, -- Hand of Purity
[105809] = true, -- Holy Avenger
},
}
 
local db
 
-- cosmetics
190,8 → 149,9
function Blessed:PLAYER_LOGIN()
BlessedDB = BlessedDB or defaults
db = BlessedDB
if not db.spells then
if not db.pandaria then
self:RestoreDefaultSpells()
db.pandaria = true
end
 
-- If new spells have been added, add them to our savedvars
232,7 → 192,7
 
-- this is to make sure talents are loaded or if we need
-- to delay the check
if (GetNumTalentTabs() == 0) then
if (GetNumSpecializations() == 0) then
self:RegisterEvent("PLAYER_ALIVE")
else
self:UpdateDurations()
246,25 → 206,20
end
 
-- Check talents for updates (Hand of Freedom)
function Blessed:UpdateDurations()
if not db.spells[1044] or not db.spells[1044].enabled then return end
 
-- Hand of Freedom
local rank, maxRank = select(5, GetTalentInfo(3, 4))
if rank == maxRank then
db.spells[1044].duration = 10
else
db.spells[1044].duration = 6
function Blessed:UpdateDurations()
-- Sanctified Wrath increases duration of Avenging Wrath
if select(5, GetTalentInfo(14)) then
durations[31884] = 30
end
 
-- Divine Favor
local timer = 20
for i=1, NUM_GLYPH_SLOTS do
local glyph = select(4, GetGlyphSocketInfo(i, nil))
if glyph == 54937 then timer = 30 end
end
db.spells[31842].duration = timer
 
-- Divine Plea glyph (not really needed, there's no applied event anymore)
-- for i=1, NUM_GLYPH_SLOTS do
-- local glyph = select(4, GetGlyphSocketInfo(i))
-- if glyph == 63223 then
-- db.spells.54428 = false
-- end
-- end
 
self:UnregisterEvent("PLAYER_ALIVE")
end
 
275,7 → 230,7
 
-- Handle stuff, plx
function Blessed:COMBAT_LOG_EVENT_UNFILTERED(timestamp, combatEvent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceFlagsTwo, destGUID, destName, destFlags, destFlagsTwo, spellID, ...)
if sourceGUID ~= pguid or not db.spells[spellID] or not db.spells[spellID].enabled then return end
if sourceGUID ~= pguid or not db.spells[spellID] then return end
 
if (combatEvent == "SPELL_AURA_REMOVED") then
self:RemoveFrame(spellID, false)
321,17 → 276,13
 
-- Update barinfo
local function update(self, elapsed)
if not self.duration then return end
self.duration = self.duration - elapsed
self.update = self.update - elapsed
if self.update > 0 then return end
 
self.update = self.update + 1
 
if self.duration > 60 then
self.timer:SetFormattedText("%.0fm", ceil(self.duration/60))
else
self.timer:SetFormattedText("%.0f", floor(self.duration))
end
self.timer:SetFormattedText("%.0f", floor(self.duration))
 
if self.duration <= 0 then
Blessed:RemoveFrame(self.id)
391,7 → 342,7
-- Setup a timer
function Blessed:SetupIcon(spellID, targetName, targetGUID)
local frame = self:GetFrame()
local duration = db.spells[spellID].duration
local duration = durations[spellID]
 
if spellID == 84963 then
duration = select(6, UnitAura("player", INQUISITION))
402,18 → 353,22
 
frame.icon:SetTexture(icon)
frame.target:SetFormattedText("|cff%s%s|r", colors[class], targetGUID ~= pguid and string.sub(targetName, 0, 3) or "You!")
 
if duration > 60 then
frame.timer:SetFormattedText("%.0fm", ceil(duration/60))
else
 
if spellID ~= 53563 then
frame.timer:SetFormattedText("%.0f", floor(duration))
end
frame.timer:SetTextColor(1, 1, 1)
frame.timer:SetTextColor(1, 1, 1)
 
frame.duration = duration
frame.duration = duration
frame.cd:SetCooldown(GetTime(), duration)
else
frame.duration = nil
frame.timer:SetTextColor(1, 1, 1)
frame.timer:SetText("*")
frame.cd:Hide()
end
 
frame.id = spellID
frame.update = 1
frame.cd:SetCooldown(GetTime(), duration)
table.insert(frames, frame)
 
frame:SetScript("OnUpdate", update)
trunk/Blessed/Options.lua
16,6 → 16,18
db = BlessedDB
local items = {}
 
-- Setup scripts to be reused
local function onEnter(self, ...)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT", self:GetWidth()/-4, 5)
GameTooltip:SetSpellByID(self.spellId)
GameTooltip:AddLine(self.spellId)
GameTooltip:Show()
end
 
local function onLeave(self, ...)
GameTooltip:Hide()
end
 
-- Header
local header = self:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
header:SetPoint("TOPLEFT", 16, -16)
25,22 → 37,26
local tag = self:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
tag:SetPoint("TOPLEFT", header, "BOTTOMLEFT", 0, -5)
tag:SetText(desc)
 
local function Checkers(name, text, tooltip, tooltipText)
local check = CreateFrame("CheckButton", string.format("%s%sCheck", addon, name), f, "InterfaceOptionsCheckButtonTemplate")
check.Text:SetText(text)
check.tooltipText = tooltip
check.tooltipRequirement = tooltipText
return check
end
 
local lock = Checkers("Lock", "Lock", "Toggle lock", "Click to toggle lock. When unlocked, press down SHIFT and drag the square to position the frame. This setting will reset to toggled on login.")
 
local lock = CreateFrame("CheckButton", nil, f, "InterfaceOptionsCheckButtonTemplate")
lock:SetPoint("TOPLEFT", tag, "BOTTOMLEFT", 0, -20)
lock:SetChecked(db.locked)
lock.Text:SetText("Lock")
lock.tooltipText = "Toggle lock"
lock.tooltipRequirement = "Click to toggle lock. When unlocked, press down SHIFT and drag the square to position the frame. This setting will reset to toggled on login."
lock:SetScript("OnClick", function()
Blessed:ToggleLock()
end)
 
local function Checkers(id)
local check = CreateFrame("CheckButton", nil, f, "InterfaceOptionsCheckButtonTemplate")
local text = GetSpellInfo(id)
check.Text:SetText(text)
check:SetScript("OnEnter", onEnter)
check:SetScript("OnLeave", onLeave)
return check
end
 
local lockTip = lock:CreateFontString(nil, "OVERLAY", "GameFontNormal")
lockTip:SetPoint("TOPLEFT", lock, "BOTTOMLEFT", 0, -5)
lockTip:SetText("Tip: It's also possible to toggle the lock via the |cffffffff/blessed lock|r slash-command.")
53,22 → 69,21
Blessed:RestoreDefaultSpells()
for i=1,#items do
local item = items[i]
item:SetChecked(db.spells[item.spellId].enabled)
item:SetChecked(db.spells[item.spellId])
end
end)
 
for k,v in pairs(db.spells) do
local n = GetSpellInfo(k)
local spell = Checkers(k, n, n, "Current duration is |cff00ff00" .. v.duration .. "|r seconds.")
local spell = Checkers(k)
if (#items < 10) then
spell:SetPoint("TOPLEFT", reset, "BOTTOMLEFT", 0, -20 * (#items+1))
else
spell:SetPoint("TOPLEFT", reset, "BOTTOMLEFT", 225, -20 * (#items-9))
end
 
spell:SetChecked(v.enabled)
spell:SetChecked(v)
spell:SetScript("OnClick", function()
db.spells[k].enabled = not db.spells[k].enabled
db.spells[k] = not db.spells[k]
end)
spell.spellId = k
table.insert(items, spell)