add GetCurseData function

This commit is contained in:
pepopo978
2025-06-20 10:57:26 -07:00
parent 7e81cd7558
commit cd1b47ec45
3 changed files with 26 additions and 3 deletions
+3 -3
View File
@@ -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
+12
View File
@@ -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.
+11
View File
@@ -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