diff --git a/Localization.lua b/Localization.lua index 5b87b7f..758f205 100644 --- a/Localization.lua +++ b/Localization.lua @@ -104,10 +104,18 @@ L:RegisterTranslations("enUS", function() ["Not ignored"] = true, ["Ignored Mobs List (Enter to save)"] = true, ["Ignored Mobs Desc"] = "Comma separated list of strings to ignore if found in the unit name. If you use any of these regex characters (*+%?) it will do a regex search otherwise it will do a plain text search. So both Rift-Lost and Rift%-Lost should work.", - ["Shared Faerie Fire"] = true, - ["This will show other player's Faerie Fires and avoid trying to cast Faerie Fire on those mobs"] = true, + ["Shared Faerie Fire"] = true, + ["This will show other player's Faerie Fires and avoid trying to cast Faerie Fire on those mobs"] = true, + ["Shared Sunder Armor"] = true, + ["This will show other player's Sunder Armor"] = true, + ["Shared Expose Armor"] = true, + ["This will show other player's Expose Armor"] = true, + ["Shared Curse of Recklessness"] = true, + ["This will show other player's Curse of Recklessness"] = true, + ["Hide Own Debuffs"] = true, + ["Hide your own debuffs, show only shared debuffs from other players"] = true, - -- spells + -- spells ["Rank"] = true, ["Rank 1"] = true, ["Rank 2"] = true, @@ -181,11 +189,11 @@ L:RegisterTranslations("enUS", function() ["hemorrhage"] = true, ["cheap shot"] = true, - -- shaman - ["flame shock"] = true, - ["molten blast"] = true, + -- shaman + ["flame shock"] = true, + ["molten blast"] = true, - -- warlock + -- warlock ["conflagrate"] = true, ["corruption"] = true, ["curse of agony"] = true, @@ -203,9 +211,10 @@ L:RegisterTranslations("enUS", function() ["siphon life"] = true, ["fear"] = true, - -- warrior - ["rend"] = true, - } + -- warrior + ["rend"] = true, + ["sunder armor"] = true, +} end) L:RegisterTranslations("zhCN", function() @@ -314,10 +323,18 @@ L:RegisterTranslations("zhCN", function() ["Not ignored"] = "不被忽略", ["Ignored Mobs List (Enter to save)"] = "忽略的怪物列表(回车保存)", ["Ignored Mobs Desc"] = "用逗号分隔的字符串列表,如果在单位名称中找到则忽略。如果你使用了这些正则表达式字符(*+%?),它将进行正则表达式搜索,否则将进行纯文本搜索。所以Rift-Lost和Rift%-Lost都应该有效.", - ["Shared Faerie Fire"] = "共享精灵之火", - ["This will show other player's Faerie Fires and avoid trying to cast Faerie Fire on those mobs"] = "这将显示其他玩家的精灵之火,并避免尝试在这些怪物上施放精灵之火", + ["Shared Faerie Fire"] = "共享精灵之火", + ["This will show other player's Faerie Fires and avoid trying to cast Faerie Fire on those mobs"] = "这将显示其他玩家的精灵之火,并避免尝试在这些怪物上施放精灵之火", + ["Shared Sunder Armor"] = "共享破甲", + ["This will show other player's Sunder Armor"] = "这将显示其他玩家的破甲", + ["Shared Expose Armor"] = "共享破甲", + ["This will show other player's Expose Armor"] = "这将显示其他玩家的破甲", + ["Shared Curse of Recklessness"] = "共享鲁莽诅咒", + ["This will show other player's Curse of Recklessness"] = "这将显示其他玩家的鲁莽诅咒", + ["Hide Own Debuffs"] = "隐藏自己的减益", + ["Hide your own debuffs, show only shared debuffs from other players"] = "隐藏自己的减益,只显示其他玩家的共享减益", - -- spells + -- spells ["Rank"] = "等级", ["Rank 1"] = "等级 1", ["Rank 2"] = "等级 2", @@ -391,11 +408,11 @@ L:RegisterTranslations("zhCN", function() ["hemorrhage"] = "出血", -- no idea if right ["cheap shot"] = "肮脏的打击", -- no idea if right - -- shaman - ["flame shock"] = "烈焰震击", -- no idea if right - ["molten blast"] = "熔岩爆裂", -- no idea if right + -- shaman + ["flame shock"] = "烈焰震击", -- no idea if right + ["molten blast"] = "熔岩爆裂", -- no idea if right - -- warlock + -- warlock ["conflagrate"] = "引燃", -- no idea if right ["corruption"] = "腐蚀术", ["curse of agony"] = "痛苦诅咒", @@ -413,7 +430,8 @@ L:RegisterTranslations("zhCN", function() ["siphon life"] = "生命虹吸", ["fear"] = "恐惧", - -- warrior - ["rend"] = '撕裂', -- no idea if right - } + -- warrior + ["rend"] = '撕裂', -- no idea if right + ["sunder armor"] = '破甲', -- no idea if right +} end) diff --git a/curses.lua b/curses.lua index 71a0bb3..ca00550 100644 --- a/curses.lua +++ b/curses.lua @@ -35,10 +35,16 @@ local curses = { sharedDebuffs = { faeriefire = {}, + sunderarmor = {}, + exposearmor = {}, + curseofrecklessness = {}, }, sharedDebuffGuids = { - faeriefire = {}, -- used for scanning for shared debuffs like faerie fire - }, -- used for scanning for shared debuffs like faerie fire + faeriefire = {}, + sunderarmor = {}, + exposearmor = {}, + curseofrecklessness = {}, + }, -- Whitelist of mobs that can bleed (for rake tracking at client debuff cap) mobsThatBleed = { @@ -277,15 +283,24 @@ Cursive:RegisterEvent("SPELLCAST_FAILED", StopChanneling); Cursive:RegisterEvent("UNIT_CASTEVENT", function(casterGuid, targetGuid, event, spellID, castDuration) -- immolate will fire both start and cast if event == "CAST" then - local _, guid = UnitExists("player") - if casterGuid ~= guid then - -- check for faeriefire - if Cursive.db.profile.shareddebuffs.faeriefire and curses.sharedDebuffs.faeriefire[spellID] then - curses.sharedDebuffGuids.faeriefire[targetGuid] = GetTime() - end - - return + local _, guid = UnitExists("player") + if casterGuid ~= guid then + -- check for shared debuffs from other players + if Cursive.db.profile.shareddebuffs.faeriefire and curses.sharedDebuffs.faeriefire[spellID] then + curses.sharedDebuffGuids.faeriefire[targetGuid] = GetTime() + end + if Cursive.db.profile.shareddebuffs.sunderarmor and curses.sharedDebuffs.sunderarmor[spellID] then + curses.sharedDebuffGuids.sunderarmor[targetGuid] = GetTime() end + if Cursive.db.profile.shareddebuffs.exposearmor and curses.sharedDebuffs.exposearmor[spellID] then + curses.sharedDebuffGuids.exposearmor[targetGuid] = GetTime() + end + if Cursive.db.profile.shareddebuffs.curseofrecklessness and curses.sharedDebuffs.curseofrecklessness[spellID] then + curses.sharedDebuffGuids.curseofrecklessness[targetGuid] = GetTime() + end + + return + end -- store pending cast curses.pendingCast = { @@ -619,7 +634,7 @@ function curses:HasCurse(lowercaseSpellNameNoRank, targetGuid, minRemaining) end -- Apply shared curse from another player -function curses:ApplySharedCurse(sharedDebuffKey, spellID, targetGuid, startTime) +function curses:ApplySharedCurse(sharedDebuffKey, spellID, targetGuid, startTime, stacks) local name = curses.sharedDebuffs[sharedDebuffKey][spellID].name local rank = curses.sharedDebuffs[sharedDebuffKey][spellID].rank local duration = curses.sharedDebuffs[sharedDebuffKey][spellID].duration @@ -635,6 +650,7 @@ function curses:ApplySharedCurse(sharedDebuffKey, spellID, targetGuid, startTime spellID = spellID, targetGuid = targetGuid, currentPlayer = false, + stacks = stacks or 0, } end diff --git a/global.lua b/global.lua index e32d14a..299af9c 100644 --- a/global.lua +++ b/global.lua @@ -19,8 +19,11 @@ function Cursive:OnEnable() DEFAULT_CHAT_FRAME:AddMessage(L["|cffffcc00Cursive:|cffffaaaa Loaded. /cursive for commands and minimap icon for options."]) - Cursive.curses:LoadCurses() - if Cursive.db.profile.enabled then + if Cursive.curses then + Cursive.curses:LoadCurses() + end + + if Cursive.db and Cursive.db.profile and Cursive.db.profile.enabled then Cursive.core.enable() end end diff --git a/settings.lua b/settings.lua index dca9fd3..9b15e74 100644 --- a/settings.lua +++ b/settings.lua @@ -22,7 +22,12 @@ Cursive:RegisterDefaults("profile", { shareddebuffs = { faeriefire = false, + sunderarmor = false, + exposearmor = false, + curseofrecklessness = false, }, + + hideonlydebuffs = false, alwaysshowcurrenttarget = true, @@ -493,6 +498,24 @@ local mobFilters = { } local sharedDebuffs = { + ["hideOwnDebuffs"] = { + type = "toggle", + name = L["Hide Own Debuffs"], + desc = L["Hide your own debuffs, show only shared debuffs from other players"], + order = 1, + get = function() + return Cursive.db.profile.hideonlydebuffs + end, + set = function(v) + Cursive.db.profile.hideonlydebuffs = v + Cursive.UpdateFramesFromConfig() + end, + }, + ["spacer"] = { + type = "header", + name = " ", + order = 5, + }, ["sharedFaerieFire"] = { type = "toggle", name = L["Shared Faerie Fire"], @@ -506,6 +529,45 @@ local sharedDebuffs = { Cursive.UpdateFramesFromConfig() end, }, + ["sharedSunderArmor"] = { + type = "toggle", + name = L["Shared Sunder Armor"], + desc = L["This will show other player's Sunder Armor"], + order = 20, + get = function() + return Cursive.db.profile.shareddebuffs.sunderarmor + end, + set = function(v) + Cursive.db.profile.shareddebuffs.sunderarmor = v + Cursive.UpdateFramesFromConfig() + end, + }, + ["sharedExposeArmor"] = { + type = "toggle", + name = L["Shared Expose Armor"], + desc = L["This will show other player's Expose Armor"], + order = 30, + get = function() + return Cursive.db.profile.shareddebuffs.exposearmor + end, + set = function(v) + Cursive.db.profile.shareddebuffs.exposearmor = v + Cursive.UpdateFramesFromConfig() + end, + }, + ["sharedCurseOfRecklessness"] = { + type = "toggle", + name = L["Shared Curse of Recklessness"], + desc = L["This will show other player's Curse of Recklessness"], + order = 40, + get = function() + return Cursive.db.profile.shareddebuffs.curseofrecklessness + end, + set = function(v) + Cursive.db.profile.shareddebuffs.curseofrecklessness = v + Cursive.UpdateFramesFromConfig() + end, + }, } Cursive.cmdtable = { diff --git a/spells/shared_debuffs.lua b/spells/shared_debuffs.lua index 4485ff9..9f3ff5f 100644 --- a/spells/shared_debuffs.lua +++ b/spells/shared_debuffs.lua @@ -16,6 +16,27 @@ function getSharedDebuffs() [17390] = { name = L["faerie fire"], rank = 2, duration = 40 }, [17391] = { name = L["faerie fire"], rank = 3, duration = 40 }, [17392] = { name = L["faerie fire"], rank = 4, duration = 40 }, - } + }, + sunderarmor = { + [7386] = { name = L["sunder armor"], rank = 1, duration = 30 }, + [7405] = { name = L["sunder armor"], rank = 2, duration = 30 }, + [8380] = { name = L["sunder armor"], rank = 3, duration = 30 }, + [11596] = { name = L["sunder armor"], rank = 4, duration = 30 }, + [11597] = { name = L["sunder armor"], rank = 5, duration = 30 }, + [25225] = { name = L["sunder armor"], rank = 6, duration = 30 }, + }, + exposearmor = { + [8647] = { name = L["expose armor"], rank = 1, duration = 30 }, + [8649] = { name = L["expose armor"], rank = 2, duration = 30 }, + [8650] = { name = L["expose armor"], rank = 3, duration = 30 }, + [11197] = { name = L["expose armor"], rank = 4, duration = 30 }, + [11198] = { name = L["expose armor"], rank = 5, duration = 30 }, + }, + curseofrecklessness = { + [704] = { name = L["curse of recklessness"], rank = 1, duration = 120 }, + [7658] = { name = L["curse of recklessness"], rank = 2, duration = 120 }, + [7659] = { name = L["curse of recklessness"], rank = 3, duration = 120 }, + [11717] = { name = L["curse of recklessness"], rank = 4, duration = 120 }, } +} end diff --git a/ui.lua b/ui.lua index 612e294..97fe0ae 100644 --- a/ui.lua +++ b/ui.lua @@ -513,7 +513,7 @@ local function hasAnySpellId(guid, spellIds) break end if spellIds[spellId] then - return spellId + return spellId, stacks end end @@ -523,11 +523,11 @@ local function hasAnySpellId(guid, spellIds) break end if spellIds[spellId] then - return spellId + return spellId, stacks end end - return nil + return nil, 0 end local function GetSortedCurses(guidCurses) @@ -590,18 +590,18 @@ local function DisplayGuid(guid) end -- check for shared debuffs - for sharedDebuffKey, guids in pairs(Cursive.curses.sharedDebuffGuids) do - if guids[guid] then - local sharedDebuffSpellIds = Cursive.curses.sharedDebuffs[sharedDebuffKey] - local spellId = hasAnySpellId(guid, sharedDebuffSpellIds) - if spellId ~= nil then - -- add curse to curses - Cursive.curses:ApplySharedCurse(sharedDebuffKey, spellId, guid, GetTime()) - -- remove guid - Cursive.curses.sharedDebuffGuids[sharedDebuffKey][guid] = nil + for sharedDebuffKey, guids in pairs(Cursive.curses.sharedDebuffGuids) do + if guids[guid] then + local sharedDebuffSpellIds = Cursive.curses.sharedDebuffs[sharedDebuffKey] + local spellId, stacks = hasAnySpellId(guid, sharedDebuffSpellIds) + if spellId ~= nil then + -- add curse to curses + Cursive.curses:ApplySharedCurse(sharedDebuffKey, spellId, guid, GetTime(), stacks) + -- remove guid + Cursive.curses.sharedDebuffGuids[sharedDebuffKey][guid] = nil + end end end - end -- update curses local curseNumber = 1 @@ -619,14 +619,41 @@ local function DisplayGuid(guid) if curseNumber > Cursive.db.profile.maxcurses then break end + + -- Skip own debuffs if hideownly is enabled + if Cursive.db.profile.hideonlydebuffs and curseData.currentPlayer then + -- skip this debuff, it's our own + else - local remaining = Cursive.curses:TimeRemaining(curseData) - local curse = unitFrame["curse" .. curseNumber] - if remaining >= 0 then - curse:SetTexture(Cursive.curses.trackedCurseIds[curseData.spellID].texture) + local remaining = Cursive.curses:TimeRemaining(curseData) + local curse = unitFrame["curse" .. curseNumber] + if remaining >= 0 then + -- Get texture from trackedCurseIds or directly from spell info for shared debuffs + local texture + if Cursive.curses.trackedCurseIds[curseData.spellID] then + texture = Cursive.curses.trackedCurseIds[curseData.spellID].texture + else + local _, _, spellTexture = SpellInfo(curseData.spellID) + texture = spellTexture + end + curse:SetTexture(texture) + -- Color logic: if hideownly is enabled, show shared debuffs in color, otherwise desaturated if curseData["currentPlayer"] == false then - curse:SetDesaturated(true); -- desaturate if not applied by current player + if Cursive.db.profile.hideonlydebuffs then + -- Check if it's Sunder Armor - only show in color if 5 stacks + if curseName == L["sunder armor"] then + if curseData.stacks and curseData.stacks >= 5 then + curse:SetDesaturated(false); -- red when 5 stacks + else + curse:SetDesaturated(true); -- grey if less than 5 stacks + end + else + curse:SetDesaturated(false); -- show other shared debuffs in color when hiding own + end + else + curse:SetDesaturated(true); -- desaturate if not applied by current player + end else curse:SetDesaturated(false); -- saturate if applied by current player end @@ -645,6 +672,7 @@ local function DisplayGuid(guid) end curseNumber = curseNumber + 1 end + end -- end of hideownly check end end @@ -693,6 +721,10 @@ local displayedGuids = {}; ui:SetAllPoints() ui:SetScript("OnUpdate", function() + if not Cursive.curses or not Cursive.core then + return + end + local config = Cursive.db.profile if not config.enabled then