diff --git a/Cursive.toc b/Cursive.toc index 351b261..31b9b7d 100644 --- a/Cursive.toc +++ b/Cursive.toc @@ -1,10 +1,10 @@ ## Interface: 11200 -## Title: [|CFF33AAFFSUPERWOW|R] Cursive 1.2.1 -## Title-zhCN: [|CFF33AAFFSUPERWOW|R] Cursive 1.2.1 +## Title: [|CFF33AAFFSUPERWOW|R] Cursive 1.3.0 +## Title-zhCN: [|CFF33AAFFSUPERWOW|R] Cursive 1.3.0 ## Author: Pepopo ## Notes: Uses SuperWoW GUIDs to show units in combat and track curses ## Notes-zhCN: 使用SuperWoW的GUID功能来显示战斗中的单位并监视诅咒等 -## Version: 1.2.1 +## Version: 1.3.0 ## SavedVariablesPerCharacter: CursiveDB ## X-Embeds: Ace2, FuBarPlugin-2.0, CompostLib, DewDropLib, TabletLib diff --git a/README.md b/README.md index aabee5e..22ffe7a 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,18 @@ Shared debuffs applied by other players will appear greyed out on targets. Currently only Faerie Fire is supported as I felt it warranted special handling. It works by looking for other players casting faerie fire and then checking if the mob has the debuff, so if someone refreshes faerie fire and gets resisted it will incorrectly restart the timer. However, it should still correctly remove faerie fire if it falls off that target. I didn't want to impact performance to handle this edge case. +## Accessing curse data in other addons + +Cursive data can be accessed in other addons + +You can get raw curse data using +`Cursive.curses:GetCurseData(spellName, guid)` + +Here's an example that gets the time left on Corruption on the current target: +``` +/run _, guid = UnitExists("target"); local data = Cursive.curses:GetCurseData("Corruption", guid); print(Cursive.curses:TimeRemaining(data)) +``` + ## Important info If you have my latest nampower, it will use the SpellInRange function from that to provide improved range checking. diff --git a/curses.lua b/curses.lua index 1718ed8..dc281a9 100644 --- a/curses.lua +++ b/curses.lua @@ -438,6 +438,17 @@ function curses:HasAnyCurse(guid) return nil end +function curses:GetCurseData(spellName, guid) + -- convert to lowercase and remove rank + local lowercaseSpellNameNoRank = Cursive.utils.GetLowercaseSpellNameNoRank(spellName) + + if curses.guids[guid] and curses.guids[guid][lowercaseSpellNameNoRank] then + return curses.guids[guid][lowercaseSpellNameNoRank] + end + + return nil +end + function curses:HasCurse(lowercaseSpellNameNoRank, targetGuid, minRemaining) if not minRemaining then minRemaining = 0 -- default to 0