castbar: use locale independent combat log parsing

This commit is contained in:
shagu
2017-02-05 00:11:53 +01:00
parent d43fdc7a3d
commit 4b5926d9b8
7 changed files with 32 additions and 52 deletions
+32 -6
View File
@@ -294,6 +294,24 @@ pfUI:RegisterModule("castbar", function ()
end
end)
-- Parse localized combatlog strings available in globalstrings.lua:
-- SPELL_CAST: (.+) begins to cast (.+).
-- SPELL_PERFORM: (.+) begins to perform (.+).
-- SPELL_GAINS: (.+) gains (.+).
-- SPELL_AFFLICTED: (.+) %a+ afflicted by (.+).
-- SPELL_HIT: Your (.+) %a hits (.+) for %d+\.
-- SPELL_CRIT: Your (.+) %a crits (.+) for %d+\.
-- OTHER_SPELL_HIT: %a+'s (.+) %a hits (.+) for %d+\.
-- OTHER_SPELL_CRIT: %a+'s (.+) %a crits (.+) for %d+\.
pfUI.castbar.target.SPELL_CAST = string.gsub(string.gsub(SPELLCASTOTHERSTART,"%d%$",""), "%%s", "(.+)")
pfUI.castbar.target.SPELL_PERFORM = string.gsub(string.gsub(SPELLPERFORMOTHERSTART,"%d%$",""), "%%s", "(.+)")
pfUI.castbar.target.SPELL_GAINS = string.gsub(string.gsub(AURAADDEDOTHERHELPFUL,"%d%$",""), "%%s", "(.+)")
pfUI.castbar.target.SPELL_AFFLICTED = string.gsub(string.gsub(AURAADDEDOTHERHARMFUL,"%d%$",""), "%%s", "(.+)")
pfUI.castbar.target.SPELL_HIT = string.gsub(string.gsub(string.gsub(SPELLLOGSELFOTHER,"%d%$",""),"%%d","%%d+"),"%%s","(.+)")
pfUI.castbar.target.SPELL_CRIT = string.gsub(string.gsub(string.gsub(SPELLLOGCRITSELFOTHER,"%d%$",""),"%%d","%%d+"),"%%s","(.+)")
pfUI.castbar.target.OTHER_SPELL_HIT = string.gsub(string.gsub(string.gsub(SPELLLOGOTHEROTHER,"%d%$",""), "%%s", "(.+)"), "%%d", "%%d+")
pfUI.castbar.target.OTHER_SPELL_CRIT = string.gsub(string.gsub(string.gsub(SPELLLOGOTHEROTHER,"%d%$",""), "%%s", "(.+)"), "%%d", "%%d+")
pfUI.castbar.target:RegisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE")
pfUI.castbar.target:RegisterEvent("CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE")
pfUI.castbar.target:RegisterEvent("CHAT_MSG_SPELL_HOSTILEPLAYER_BUFF")
@@ -318,29 +336,37 @@ pfUI:RegisterModule("castbar", function ()
pfUI.castbar.target:SetScript("OnEvent", function()
if (arg1 ~= nil) then
-- cast action
for mob, spell in string.gfind(arg1, pfLocaleSpellEvents[pfUI.cache["locale"]]['SPELL_CAST']) do
for mob, spell in string.gfind(arg1, pfUI.castbar.target.SPELL_CAST) do
pfUI.castbar.target:Action(mob, spell)
return
end
for mob, spell in string.gfind(arg1, pfLocaleSpellEvents[pfUI.cache["locale"]]['SPELL_PERFORM']) do
for mob, spell in string.gfind(arg1, pfUI.castbar.target.SPELL_PERFORM) do
pfUI.castbar.target:Action(mob, spell)
return
end
-- interrupt action
for mob, spell in string.gfind(arg1, pfLocaleSpellEvents[pfUI.cache["locale"]]['SPELL_GAINS']) do
for mob, spell in string.gfind(arg1, pfUI.castbar.target.SPELL_GAINS) do
pfUI.castbar.target:StopAction(mob, spell)
return
end
for mob, spell in string.gfind(arg1, pfLocaleSpellEvents[pfUI.cache["locale"]]['SPELL_AFFLICTED']) do
for mob, spell in string.gfind(arg1, pfUI.castbar.target.SPELL_AFFLICTED) do
pfUI.castbar.target:StopAction(mob, spell)
return
end
for spell, mob in string.gfind(arg1, pfLocaleSpellEvents[pfUI.cache["locale"]]['SPELL_HIT']) do
for spell, mob in string.gfind(arg1, pfUI.castbar.target.SPELL_HIT) do
pfUI.castbar.target:StopAction(mob, spell)
return
end
for spell, mob in string.gfind(arg1, pfLocaleSpellEvents[pfUI.cache["locale"]]['OTHER_SPELL_HIT']) do
for spell, mob in string.gfind(arg1, pfUI.castbar.target.SPELL_CRIT) do
pfUI.castbar.target:StopAction(mob, spell)
return
end
for spell, mob in string.gfind(arg1, pfUI.castbar.target.OTHER_SPELL_HIT) do
pfUI.castbar.target:StopAction(mob, spell)
return
end
for spell, mob in string.gfind(arg1, pfUI.castbar.target.OTHER_SPELL_CRIT) do
pfUI.castbar.target:StopAction(mob, spell)
return
end