api: use dynamic shortcut for string.gfind

This commit is contained in:
shagu
2018-09-28 22:53:16 +02:00
parent 0d993806e6
commit 7ecac458ac
8 changed files with 26 additions and 20 deletions
+3 -3
View File
@@ -179,7 +179,7 @@ libdebuff.pending = {}
libdebuff:SetScript("OnEvent", function()
-- Add Combat Log
if event == "CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_DAMAGE" or event == "CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE" then
for unit, effect in string.gfind(arg1, libdebuff.combatlog) do
for unit, effect in gfind(arg1, libdebuff.combatlog) do
local unitlevel = UnitName("target") == unit and UnitLevel("target") or 0
if not libdebuff.objects[unit] or not libdebuff.objects[unit][unitlevel] or not libdebuff.objects[unit][unitlevel][effect] then
@@ -203,7 +203,7 @@ libdebuff:SetScript("OnEvent", function()
elseif event == "CHAT_MSG_SPELL_FAILED_LOCALPLAYER" or event == "CHAT_MSG_SPELL_SELF_DAMAGE" then
-- Persist pending Spell
for _, msg in pairs(libdebuff.pp) do
for effect, _ in string.gfind(arg1, msg) do
for effect, _ in gfind(arg1, msg) do
libdebuff:PersistPending(effect)
return
end
@@ -211,7 +211,7 @@ libdebuff:SetScript("OnEvent", function()
-- Remove pending spell
for _, msg in pairs(libdebuff.rp) do
for effect, _ in string.gfind(arg1, msg) do
for effect, _ in gfind(arg1, msg) do
libdebuff:RemovePending(effect)
return
end