prediction: send healcomm compatible predictions

This commit is contained in:
shagu
2018-08-25 16:52:57 +02:00
parent 0e05531ddb
commit e8538b3b77
9 changed files with 175 additions and 5 deletions
+8 -1
View File
@@ -101,8 +101,8 @@ pfUI_locale["deDE"]["critters"] = {
'Salome',
'Fischschwarm',
'Skorpid',
'Schaf',
'Verwandeltes Schaf',
'Schaf',
'Irrwisch der Shen\'dralar',
'Kränkliches Reh',
'Kränkliche Gazelle',
@@ -180,6 +180,13 @@ pfUI_locale["deDE"]["interrupts"] = {
["Goblin-Mörser"] = true,
}
pfUI_locale["deDE"]["resurrections"] = {
["Auferstehung"] = true,
["Wiedergeburt"] = true,
["Erlösung"] = true,
["Geist der Ahnen"] = true,
}
pfUI_locale["deDE"]["spells"] = {
[' Dämmerungstrickfalle']={t=1500,icon='Temp'},
['Aasskarabäus beschwören']={t=2000,icon='Spell_Shadow_CarrionSwarm'},
+7
View File
@@ -180,6 +180,13 @@ pfUI_locale["enUS"]["interrupts"] = {
["Goblin Mortar"] = true,
}
pfUI_locale["enUS"]["resurrections"] = {
["Resurrection"] = true,
["Rebirth"] = true,
["Redemption"] = true,
["Ancestral Spirit"] = true,
}
pfUI_locale["enUS"]["spells"] = {
['"Plucky" Resumes Chicken Form']={t=1000,icon='Ability_Racial_BearForm'},
['Abomination Spit']={t=2500,icon='Spell_Nature_CorrosiveBreath'},
+8 -1
View File
@@ -101,8 +101,8 @@ pfUI_locale["esES"]["critters"] = {
'Salome',
'Banco de peces',
'Escórpido',
'Oveja',
'Oveja polimórfica',
'Oveja',
'Fuego fatuo Shen\'dralar',
'Ciervo enfermo',
'Gacela enferma',
@@ -180,6 +180,13 @@ pfUI_locale["esES"]["interrupts"] = {
["Mortero goblin"] = true,
}
pfUI_locale["esES"]["resurrections"] = {
["Resurrección"] = true,
["Renacer"] = true,
["Redención"] = true,
["Espíritu ancestral"] = true,
}
pfUI_locale["esES"]["spells"] = {
['"Desplumado" mantiene forma de pollo']={t=1000,icon='Ability_Racial_BearForm'},
['Abrazo de la viuda']={t=500,icon='Spell_Arcane_Blink'},
+8 -1
View File
@@ -97,8 +97,8 @@ pfUI_locale["frFR"]["critters"] = {
'Salome',
'Banc de poisson',
'Scorpion',
'Mouton',
'Métamorphosé en mouton',
'Mouton',
'Feu follet de Shen\'dralar',
'Daim malade',
'Gazelle malade',
@@ -175,6 +175,13 @@ pfUI_locale["frFR"]["interrupts"] = {
["Mortier des gobelins"] = true,
}
pfUI_locale["frFR"]["resurrections"] = {
["Résurrection"] = true,
["Renaissance"] = true,
["Rédemption"] = true,
["Esprit ancestral"] = true,
}
pfUI_locale["frFR"]["spells"] = {
['Accomplissement véritable']={t=500,icon='Spell_Shadow_Charm'},
['Acide corrosif']={t=1500,icon='Spell_Nature_Acid_01'},
+8 -1
View File
@@ -101,8 +101,8 @@ pfUI_locale["koKR"]["critters"] = {
'살로메',
'물고기 떼',
'전갈',
'양',
'변이된 양',
'양',
'셴드랄라 위습',
'병든 사슴',
'병든 가젤',
@@ -180,6 +180,13 @@ pfUI_locale["koKR"]["interrupts"] = {
["고블린 박격포"] = true,
}
pfUI_locale["koKR"]["resurrections"] = {
["부활"] = true,
["환생"] = true,
["구원"] = true,
["고대의 영혼"] = true,
}
pfUI_locale["koKR"]["spells"] = {
['"씩씩이" 닭 모습']={t=1000,icon='Ability_Racial_BearForm'},
['100만 볼트']={t=2000,icon='Spell_Nature_ChainLightning'},
+7
View File
@@ -180,6 +180,13 @@ pfUI_locale["ruRU"]["interrupts"] = {
["Гоблинская мортира"] = true,
}
pfUI_locale["ruRU"]["resurrections"] = {
["Воскрешение"] = true,
["Возрождение"] = true,
["Искупление"] = true,
["Дух предков"] = true,
}
pfUI_locale["ruRU"]["spells"] = {
[' Пробуждение каменного дворфа - визуальный эффект']={t=1500,icon='Spell_Nature_Earthquake'},
['"Отчаянный" снова принимает облик цыпленка"']={t=1000,icon='Ability_Racial_BearForm'},
+8 -1
View File
@@ -97,8 +97,8 @@ pfUI_locale["zhCN"]["critters"] = {
'萨罗米',
'鱼群',
'蝎子',
'绵羊',
'小绵羊',
'绵羊',
'辛德拉小精灵',
'生病的鹿',
'生病的瞪羚',
@@ -175,6 +175,13 @@ pfUI_locale["zhCN"]["interrupts"] = {
["地精迫击炮"] = true,
}
pfUI_locale["zhCN"]["resurrections"] = {
["复活术"] = true,
["复生"] = true,
["救赎"] = true,
["先祖之魂"] = true,
}
pfUI_locale["zhCN"]["spells"] = {
['"Plucky" Resumes Chicken Form']={t=1000,icon='Ability_Racial_BearForm'},
['Aqual Quintessence - Dowse Molten Core Rune']={t=1000,icon='Temp'},
+115
View File
@@ -219,4 +219,119 @@ pfUI:RegisterModule("prediction", function ()
end
end
end
local healedselfother = SanitizePattern(HEALEDSELFOTHER)
local healedselfself = SanitizePattern(HEALEDSELFSELF)
local healedcritselfother = SanitizePattern(HEALEDCRITSELFOTHER)
local healedcritselfself = SanitizePattern(HEALEDCRITSELFSELF)
local spell_queue = { "DUMMY", "DUMMYRank 9", "TARGET" }
local realm = GetRealmName()
local player = UnitName("player")
pfUI_cache["prediction"] = pfUI_cache["prediction"] or {}
pfUI_cache["prediction"][realm] = pfUI_cache["prediction"][realm] or {}
pfUI_cache["prediction"][realm][player] = pfUI_cache["prediction"][realm][player] or {}
pfUI_cache["prediction"][realm][player]["heals"] = pfUI_cache["prediction"][realm][player]["heals"] or {}
local cache = pfUI_cache["prediction"][realm][player]["heals"]
-- Gather Data by User Actions
hooksecurefunc("CastSpell", function(id, bookType)
if not pfUI.prediction.sender.enabled then return end
local effect, rank = libspell.GetSpellInfo(id, bookType)
spell_queue[1] = effect
spell_queue[2] = effect.. ( rank or "" )
spell_queue[3] = UnitName("target") and UnitCanAssist("player", "target") and UnitName("target") or UnitName("player")
end, true)
hooksecurefunc("CastSpellByName", function(effect, target)
if not pfUI.prediction.sender.enabled then return end
local effect, rank = libspell.GetSpellInfo(effect)
spell_queue[1] = effect
spell_queue[2] = effect.. ( rank or "" )
spell_queue[3] = UnitName("target") and UnitCanAssist("player", "target") and UnitName("target") or UnitName("player")
end, true)
local scanner = libtipscan:GetScanner("prediction")
hooksecurefunc("UseAction", function(slot, target, button)
if not pfUI.prediction.sender.enabled then return end
if GetActionText(slot) or not IsCurrentAction(slot) then return end
scanner:SetAction(slot)
local effect, rank = scanner:Line(1)
spell_queue[1] = effect
spell_queue[2] = effect.. ( rank or "" )
spell_queue[3] = UnitName("target") and UnitCanAssist("player", "target") and UnitName("target") or UnitName("player")
end, true)
pfUI.prediction.sender = CreateFrame("Frame", "pfPredictionSender", UIParent)
pfUI.prediction.sender.enabled = true
pfUI.prediction.sender.SendHealCommMsg = function(self, msg)
SendAddonMessage("HealComm", msg, "RAID")
SendAddonMessage("HealComm", msg, "BATTLEGROUND")
end
pfUI.prediction.sender:RegisterEvent("CHAT_MSG_SPELL_SELF_BUFF")
pfUI.prediction.sender:RegisterEvent("SPELLCAST_START")
pfUI.prediction.sender:RegisterEvent("SPELLCAST_STOP")
pfUI.prediction.sender:RegisterEvent("SPELLCAST_FAILED")
pfUI.prediction.sender:RegisterEvent("SPELLCAST_INTERRUPTED")
pfUI.prediction.sender:RegisterEvent("SPELLCAST_DELAYED")
pfUI.prediction.sender:SetScript("OnEvent", function()
if event == "CHAT_MSG_SPELL_SELF_BUFF" then
-- "Your %s heals %s for %d.";
for spell, _, heal in string.gfind(arg1, healedselfother) do
if spell == spell_queue[1] then cache[spell_queue[2]] = tonumber(heal) end
return
end
-- "Your %s heals you for %d."
for spell, heal in string.gfind(arg1, healedselfself) do
if spell == spell_queue[1] then cache[spell_queue[2]] = tonumber(heal) end
return
end
-- "Your %s critically heals %s for %d."
for spell, heal in string.gfind(arg1, healedcritselfother) do
if spell == spell_queue[1] and not cache[spell_queue[2]] then cache[spell_queue[2]] = tonumber(heal)*2/3 end
return
end
-- "Your %s critically heals you for %d."
for spell, _, heal in string.gfind(arg1, healedcritselfself) do
if spell == spell_queue[1] and not cache[spell_queue[2]] then cache[spell_queue[2]] = tonumber(heal)*2/3 end
return
end
elseif event == "SPELLCAST_START" then
if spell_queue[1] == arg1 and cache[spell_queue[2]] then
local sender = player
local target = spell_queue[3]
local amount = cache[spell_queue[2]]
local casttime = arg2
pfUI.prediction:Heal(player, target, amount, casttime)
pfUI.prediction.sender:SendHealCommMsg("Heal/" .. target .. "/" .. amount .. "/" .. casttime .. "/")
pfUI.prediction.sender.healing = true
elseif spell_queue[1] == arg1 and L["resurrections"][arg1] then
pfUI.prediction:Ress(player, spell_queue[3])
pfUI.prediction.sender:SendHealCommMsg("Resurrection/" .. spell_queue[3] .. "/start/")
pfUI.prediction.sender.resurrecting = true
end
elseif event == "SPELLCAST_FAILED" or event == "SPELLCAST_INTERRUPTED" then
if pfUI.prediction.sender.healing then
pfUI.prediction:HealStop(player)
pfUI.prediction.sender:SendHealCommMsg("HealStop")
pfUI.prediction.sender.healing = nil
elseif pfUI.prediction.sender.resurrecting then
pfUI.prediction:RessStop(player)
pfUI.prediction.sender:SendHealCommMsg("Resurrection/stop/")
pfUI.prediction.sender.resurrecting = nil
end
elseif event =="SPELLCAST_DELAYED" then
if pfUI.prediction.sender.healing then
pfUI.prediction:HealDelay(player, arg1)
pfUI.prediction.sender:SendHealCommMsg("Healdelay/" .. arg1 .. "/")
end
elseif event == "SPELLCAST_STOP" then
pfUI.prediction:HealStop(player)
end
end)
end)
+6
View File
@@ -694,6 +694,8 @@ pfUI:RegisterModule("thirdparty", function ()
-- hook healcomm's addon message to parse single-player events
if AceLibrary and AceLibrary:HasInstance("HealComm-1.0") and pfUI.prediction then
local HealComm = AceLibrary("HealComm-1.0")
-- use pfUI frames to draw healComm predictions
local pfHookHealCommSendAddonMessage = HealComm.SendAddonMessage
function HealComm.SendAddonMessage(this, msg)
if not UnitInRaid("player") and GetNumPartyMembers() < 1 then
@@ -701,6 +703,10 @@ pfUI:RegisterModule("thirdparty", function ()
end
pfHookHealCommSendAddonMessage(this, msg)
end
-- disable pfUI predictions
pfUI.prediction.sender:UnregisterAllEvents()
pfUI.prediction.sender.enabled = nil
end
end)
end)