read curse durations from spellbook for warlocks
This commit is contained in:
@@ -22,6 +22,7 @@ L:RegisterTranslations("enUS", function()
|
||||
["Same as HIGHEST_HP_RAID_MARK but with RAID_MARK_SQUARE mark prio."] = true,
|
||||
["Same as HIGHEST_HP_RAID_MARK but with INVERSE_RAID_MARK mark prio."] = true,
|
||||
["|cffffcc00Cursive:|cffffaaaa Couldn't find a target to curse."] = true,
|
||||
["curse_duration_format"] = ".*over ([%d.]+) sec.",
|
||||
|
||||
-- curses
|
||||
["(.+) fades from (.+)"] = true,
|
||||
@@ -164,6 +165,7 @@ L:RegisterTranslations("zhCN", function()
|
||||
["Same as HIGHEST_HP_RAID_MARK but with RAID_MARK_SQUARE mark prio."] = "与HIGHEST_HP_RAID_MARK相同,但是RAID_MARK_SQUARE标记优先.",
|
||||
["Same as HIGHEST_HP_RAID_MARK but with INVERSE_RAID_MARK mark prio."] = "与HIGHEST_HP_RAID_MARK相同,但是INVERSE_RAID_MARK标记优先.",
|
||||
["|cffffcc00Cursive:|cffffaaaa Couldn't find a target to curse."] = "|cffffcc00Cursive:|cffffaaaa 找不到要诅咒的目标.",
|
||||
["curse_duration_format"] = ".*持续([%d.]+)秒.", -- no idea if this is right
|
||||
|
||||
-- curses
|
||||
["(.+) fades from (.+)"] = "(.+)效果从(.+)身上消失",
|
||||
|
||||
@@ -10,6 +10,9 @@ AURAADDEDSELFHARMFUL = "You are afflicted by %s (1)."
|
||||
AURAADDEDSELFHELPFUL = "You gain %s (1)."
|
||||
|
||||
Cursive.core = CreateFrame("Frame", "Cursive", UIParent)
|
||||
|
||||
Cursive.core.tooltipScan = CreateFrame("GameTooltip", "CursiveTooltipScan", UIParent, "GameTooltipTemplate")
|
||||
|
||||
Cursive.core.guids = {}
|
||||
|
||||
Cursive.core.add = function(unit)
|
||||
|
||||
+64
-8
@@ -2,9 +2,13 @@ if not Cursive.superwow then
|
||||
return
|
||||
end
|
||||
local L = AceLibrary("AceLocale-2.2"):new("Cursive")
|
||||
|
||||
local _, playerClassName = UnitClass("player")
|
||||
|
||||
local curses = {
|
||||
trackedCurseIds = {},
|
||||
trackedCurseNamesToTextures = {},
|
||||
trackedCurseNameRanksToSpellSlots = {},
|
||||
guids = {},
|
||||
resistSoundGuids = {},
|
||||
expiringSoundGuids = {},
|
||||
@@ -20,22 +24,42 @@ local resist_test = L["Your (.+) was resisted by (.+)"]
|
||||
local lastGuid = nil
|
||||
|
||||
function curses:LoadCurses()
|
||||
-- reset dicts
|
||||
curses.trackedCurseIds = {}
|
||||
curses.trackedCurseNamesToTextures = {}
|
||||
curses.trackedCurseNameRanksToSpellSlots = {}
|
||||
|
||||
-- curses to track
|
||||
local _, className = UnitClass("player")
|
||||
if className == "WARLOCK" then
|
||||
if playerClassName == "WARLOCK" then
|
||||
curses.trackedCurseIds = getWarlockSpells()
|
||||
elseif className == "PRIEST" then
|
||||
elseif playerClassName == "PRIEST" then
|
||||
curses.trackedCurseIds = getPriestSpells()
|
||||
elseif className == "MAGE" then
|
||||
elseif playerClassName == "MAGE" then
|
||||
curses.trackedCurseIds = getMageSpells()
|
||||
elseif className == "DRUID" then
|
||||
elseif playerClassName == "DRUID" then
|
||||
curses.trackedCurseIds = getDruidSpells()
|
||||
elseif className == "HUNTER" then
|
||||
elseif playerClassName == "HUNTER" then
|
||||
curses.trackedCurseIds = getHunterSpells()
|
||||
elseif className == "ROGUE" then
|
||||
elseif playerClassName == "ROGUE" then
|
||||
curses.trackedCurseIds = getRogueSpells()
|
||||
end
|
||||
|
||||
-- go through spell slots and
|
||||
local i = 1
|
||||
while true do
|
||||
local spellname, spellrank = GetSpellName(i, BOOKTYPE_SPELL)
|
||||
if not spellname then
|
||||
break
|
||||
end
|
||||
|
||||
if spellrank == "" then
|
||||
spellrank = "Rank 1"
|
||||
end
|
||||
|
||||
curses.trackedCurseNameRanksToSpellSlots[spellname .. spellrank] = i
|
||||
i = i + 1
|
||||
end
|
||||
|
||||
for id, data in pairs(curses.trackedCurseIds) do
|
||||
-- get the texture
|
||||
local name, rank, texture = SpellInfo(id)
|
||||
@@ -46,6 +70,33 @@ function curses:LoadCurses()
|
||||
end
|
||||
end
|
||||
|
||||
function curses:GetCurseDuration(curseSpellID)
|
||||
if playerClassName == "WARLOCK" and curses.trackedCurseIds[curseSpellID].rapid_deterioration then
|
||||
-- scan spellbook for duration in case they have haste talent
|
||||
local nameRank = curses.trackedCurseIds[curseSpellID].name .. "Rank " .. curses.trackedCurseIds[curseSpellID].rank
|
||||
local spellSlot = curses.trackedCurseNameRanksToSpellSlots[nameRank]
|
||||
|
||||
if spellSlot then
|
||||
Cursive.core.tooltipScan:SetOwner(Cursive.core.tooltipScan, "ANCHOR_NONE")
|
||||
Cursive.core.tooltipScan:ClearLines()
|
||||
Cursive.core.tooltipScan:SetSpell(spellSlot, BOOKTYPE_SPELL)
|
||||
local numLines = Cursive.core.tooltipScan:NumLines()
|
||||
if numLines and numLines > 0 then
|
||||
-- get the last line
|
||||
local text = getglobal("CursiveTooltipScan" .. "TextLeft" .. numLines):GetText()
|
||||
if text then
|
||||
local _, _, duration = string.find(text, L["curse_duration_format"])
|
||||
if duration then
|
||||
return tonumber(duration)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return curses.trackedCurseIds[curseSpellID].duration
|
||||
end
|
||||
|
||||
function curses:ScanGuidForCurse(guid, curseSpellID)
|
||||
for i = 1, 16 do
|
||||
local _, _, _, spellID = UnitDebuff(guid, i)
|
||||
@@ -71,6 +122,11 @@ function curses:ScanGuidForCurse(guid, curseSpellID)
|
||||
return nil
|
||||
end
|
||||
|
||||
Cursive:RegisterEvent("LEARNED_SPELL_IN_TAB", function()
|
||||
-- reload curses in case spell slots changed
|
||||
curses:LoadCurses()
|
||||
end)
|
||||
|
||||
Cursive:RegisterEvent("UNIT_CASTEVENT", function(casterGuid, targetGuid, event, spellID, castDuration)
|
||||
-- immolate will fire both start and cast
|
||||
if event == "CAST" then
|
||||
@@ -196,7 +252,7 @@ end
|
||||
function curses:ApplyCurse(spellID, targetGuid, startTime)
|
||||
local name = curses.trackedCurseIds[spellID].name
|
||||
local rank = curses.trackedCurseIds[spellID].rank
|
||||
local duration = curses.trackedCurseIds[spellID].duration
|
||||
local duration = curses:GetCurseDuration(spellID)
|
||||
|
||||
if not curses.guids[targetGuid] then
|
||||
curses.guids[targetGuid] = {}
|
||||
|
||||
+17
-17
@@ -1,20 +1,20 @@
|
||||
local L = AceLibrary("AceLocale-2.2"):new("Cursive")
|
||||
function getWarlockSpells()
|
||||
return {
|
||||
[172] = { name = L["Corruption"], rank = 1, duration = 12 },
|
||||
[6222] = { name = L["Corruption"], rank = 2, duration = 15 },
|
||||
[6223] = { name = L["Corruption"], rank = 3, duration = 18 },
|
||||
[7648] = { name = L["Corruption"], rank = 4, duration = 18 },
|
||||
[11671] = { name = L["Corruption"], rank = 5, duration = 18 },
|
||||
[11672] = { name = L["Corruption"], rank = 6, duration = 18 },
|
||||
[25311] = { name = L["Corruption"], rank = 7, duration = 18 },
|
||||
[172] = { name = L["Corruption"], rank = 1, duration = 12, rapid_deterioration = true },
|
||||
[6222] = { name = L["Corruption"], rank = 2, duration = 15, rapid_deterioration = true },
|
||||
[6223] = { name = L["Corruption"], rank = 3, duration = 18, rapid_deterioration = true },
|
||||
[7648] = { name = L["Corruption"], rank = 4, duration = 18, rapid_deterioration = true },
|
||||
[11671] = { name = L["Corruption"], rank = 5, duration = 18, rapid_deterioration = true },
|
||||
[11672] = { name = L["Corruption"], rank = 6, duration = 18, rapid_deterioration = true },
|
||||
[25311] = { name = L["Corruption"], rank = 7, duration = 18, rapid_deterioration = true },
|
||||
|
||||
[980] = { name = L["Curse of Agony"], rank = 1, duration = 24 },
|
||||
[1014] = { name = L["Curse of Agony"], rank = 2, duration = 24 },
|
||||
[6217] = { name = L["Curse of Agony"], rank = 3, duration = 24 },
|
||||
[11711] = { name = L["Curse of Agony"], rank = 4, duration = 24 },
|
||||
[11712] = { name = L["Curse of Agony"], rank = 5, duration = 24 },
|
||||
[11713] = { name = L["Curse of Agony"], rank = 6, duration = 24 },
|
||||
[980] = { name = L["Curse of Agony"], rank = 1, duration = 24, rapid_deterioration = true },
|
||||
[1014] = { name = L["Curse of Agony"], rank = 2, duration = 24, rapid_deterioration = true },
|
||||
[6217] = { name = L["Curse of Agony"], rank = 3, duration = 24, rapid_deterioration = true },
|
||||
[11711] = { name = L["Curse of Agony"], rank = 4, duration = 24, rapid_deterioration = true },
|
||||
[11712] = { name = L["Curse of Agony"], rank = 5, duration = 24, rapid_deterioration = true },
|
||||
[11713] = { name = L["Curse of Agony"], rank = 6, duration = 24, rapid_deterioration = true },
|
||||
|
||||
[603] = { name = L["Curse of Doom"], rank = 1, duration = 60 },
|
||||
|
||||
@@ -58,10 +58,10 @@ function getWarlockSpells()
|
||||
[710] = { name = L["Banish"], rank = 1, duration = 20 },
|
||||
[18647] = { name = L["Banish"], rank = 2, duration = 30 },
|
||||
|
||||
[18265] = { name = L["Siphon Life"], rank = 1, duration = 30 },
|
||||
[18879] = { name = L["Siphon Life"], rank = 2, duration = 30 },
|
||||
[18880] = { name = L["Siphon Life"], rank = 3, duration = 30 },
|
||||
[18881] = { name = L["Siphon Life"], rank = 4, duration = 30 },
|
||||
[18265] = { name = L["Siphon Life"], rank = 1, duration = 30, rapid_deterioration = true },
|
||||
[18879] = { name = L["Siphon Life"], rank = 2, duration = 30, rapid_deterioration = true },
|
||||
[18880] = { name = L["Siphon Life"], rank = 3, duration = 30, rapid_deterioration = true },
|
||||
[18881] = { name = L["Siphon Life"], rank = 4, duration = 30, rapid_deterioration = true },
|
||||
|
||||
[5782] = { name = L["Fear"], rank = 1, duration = 10 },
|
||||
[6213] = { name = L["Fear"], rank = 2, duration = 15 },
|
||||
|
||||
Reference in New Issue
Block a user