Go to Page... |
Thread Tools | Display Modes |
07-27-23, 04:42 PM | #1 |
"SPELL_DAMAGE" and "SPELL_PERIODIC_DAMAGE" Crit bool is nil
Ive been working on this addon for a while. here's my code.
Code:
-- Define a table to hold the highest hits data. CritMaticData = CritMaticData or {} local function GetGCD() local _, gcdDuration = GetSpellCooldown(78) -- 78 is the spell ID for Warrior's Heroic Strike if gcdDuration == 0 then return 1.5 -- Default GCD duration if not available (you may adjust this value if needed) else return gcdDuration end end local function AddHighestHitsToTooltip(self, slot) if (not slot) then return end local actionType, id = GetActionInfo(slot) if actionType == "spell" then local spellName, _, _, castTime = GetSpellInfo(id) if CritMaticData[spellName] then local cooldown = (GetSpellBaseCooldown(id) or 0) / 1000 local effectiveCastTime = castTime > 0 and (castTime / 1000) or GetGCD() local effectiveTime = max(effectiveCastTime, cooldown) local critDPS = CritMaticData[spellName].highestCrit / effectiveTime local normalDPS = CritMaticData[spellName].highestNormal / effectiveTime local CritMaticLeft = "Highest Crit: " local CritMaticRight = tostring(CritMaticData[spellName].highestCrit) .. " (" .. format("%.1f", critDPS) .. " DPS)" local normalMaticLeft = "Highest Normal: " local normalMaticRight = tostring(CritMaticData[spellName].highestNormal) .. " (" .. format("%.1f", normalDPS) .. " DPS)" -- Check if lines are already present in the tooltip. local critMaticExists = false local normalMaticExists = false for i = 1, self:NumLines() do local gtl = _G["GameTooltipTextLeft" .. i] local gtr = _G["GameTooltipTextRight" .. i] if gtl and gtr then if gtl:GetText() == CritMaticLeft and gtr:GetText() == CritMaticRight then critMaticExists = true elseif gtl:GetText() == normalMaticLeft and gtr:GetText() == normalMaticRight then normalMaticExists = true end end end -- If lines don't exist, add them. if not critMaticExists then self:AddDoubleLine(CritMaticLeft, CritMaticRight) _G["GameTooltipTextLeft" .. self:NumLines()]:SetTextColor(1, 1, 1) -- left side color (white) _G["GameTooltipTextRight" .. self:NumLines()]:SetTextColor(1, 0.82, 0) -- right side color (white) end if not normalMaticExists then self:AddDoubleLine(normalMaticLeft, normalMaticRight) _G["GameTooltipTextLeft" .. self:NumLines()]:SetTextColor(1, 1, 1) -- left side color (white) _G["GameTooltipTextRight" .. self:NumLines()]:SetTextColor(1, 0.82, 0) -- right side color (white) end self:Show() end end end -- Register an event that fires when the player hits an enemy. local f = CreateFrame("FRAME") f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") f:SetScript("OnEvent", function(self, event) -- Get information about the combat event. local timestamp, eventType, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, spellID, spellName, spellSchool, amount, overhealing, absorbed, critical = CombatLogGetCurrentEventInfo() if eventType == "SWING_DAMAGE" then amount = spellID spellName = "Auto Attack" spellIcon = 6603 -- or specify the path to a melee icon, if you have one else spellName, _, spellIcon = GetSpellInfo(spellID) end -- Check if the event is a player hit or a player heal and update the highest hits/heals data if needed. if sourceGUID == UnitGUID("player") and destGUID ~= UnitGUID("player") and (eventType == "SPELL_DAMAGE" or eventType == "SWING_DAMAGE" or eventType == "RANGE_DAMAGE" or eventType == "SPELL_HEAL" or eventType == "SPELL_PERIODIC_HEAL" or eventType == "SPELL_PERIODIC_DAMAGE") and amount > 0 then print("Event type: " .. eventType) print("Critical flag: " .. tostring(critical)) if spellName then CritMaticData[spellName] = CritMaticData[spellName] or { highestCrit = 0, highestNormal = 0, highestHeal = 0, highestHealCrit = 0, spellIcon = spellIcon, } if critical then print("Critical flag: " .. tostring(critical)) print("Critical hit!") if (eventType == "SPELL_DAMAGE" or eventType == "SPELL_PERIODIC_DAMAGE" or eventType == "SWING_DAMAGE" or eventType == "RANGE_DAMAGE") then print("Damage event!") if amount > CritMaticData[spellName].highestCrit then if spellName == "Auto Attack" then return end print(CritMaticData[spellName].highestCrit) CritMaticData[spellName].highestCrit = amount print(CritMaticData[spellName].highestCrit) PlaySound(888, "SFX") CritMatic.ShowNewCritMessage(spellName, amount) print("New highest crit hit for " .. spellName .. ": " .. CritMaticData[spellName].highestCrit) end else if (eventType == "SPELL_HEAL" or eventType == "SPELL_PERIODIC_HEAL") then if amount > CritMaticData[spellName].highestHealCrit then print(CritMaticData[spellName].highestHealCrit) CritMaticData[spellName].highestHealCrit = amount print(CritMaticData[spellName].highestHealCrit) PlaySound(888, "SFX") CritMatic.ShowNewHealCritMessage(spellName, amount) print("New highest crit heal for " .. spellName .. ": " .. CritMaticData[spellName].highestHealCrit) end end end else if (eventType == "SPELL_HEAL" or eventType == "SPELL_PERIODIC_HEAL") then if amount > CritMaticData[spellName].highestHeal then if spellName == "Auto Attack" then return end CritMaticData[spellName].highestHeal = amount PlaySound(10049, "SFX") CritMatic.ShowNewHealMessage(spellName, amount) print("New highest normal heal for " .. spellName .. ": " .. CritMaticData[spellName].highestHeal) end else if (eventType == "SPELL_DAMAGE" or eventType == "SPELL_PERIODIC_DAMAGE" or eventType == "SWING_DAMAGE" or eventType == "RANGE_DAMAGE") then if amount > CritMaticData[spellName].highestNormal then if spellName == "Auto Attack" then return end CritMaticData[spellName].highestNormal = amount PlaySound(10049, "SFX") CritMatic.ShowNewNormalMessage(spellName, amount) print("New highest normal hit for " .. spellName .. ": " .. CritMaticData[spellName].highestNormal) end end end end end end end) -- Register an event that fires when the addon is loaded. local function OnLoad(self, event) print("CritMatic Loaded!") CritMaticData = _G["CritMaticData"] -- Add the highest hits data to the spell button tooltip. hooksecurefunc(GameTooltip, "SetAction", AddHighestHitsToTooltip) end local frame = CreateFrame("FRAME") frame:RegisterEvent("ADDON_LOADED") frame:SetScript("OnEvent", OnLoad) -- Register an event that fires when the player logs out or exits the game. local function OnSave(self, event) -- Save the highest hits data to the saved variables for the addon. _G["CritMaticData"] = CritMaticData end local frame = CreateFrame("FRAME") frame:RegisterEvent("PLAYER_LOGOUT") frame:SetScript("OnEvent", OnSave) local function ResetData() CritMaticData = {} print("CritMatic data reset.") end SLASH_CRITMATICRESET1 = '/cmreset' function SlashCmdList.CRITMATICRESET(msg, editBox) ResetData() end |
|
![]() |
07-27-23, 06:05 PM | #2 |
You have critical as return 18 from CombatLogGetCurrentEventInfo() which would work for SWING_DAMAGE. WoWPedia says it should be 21 for SPELL_DAMAGE.
There's a side by side comparison table of return for SWING_DAMAGE and SPELL_DAMAGE on that page.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 07-27-23 at 06:08 PM. |
|
![]() |
07-28-23, 07:14 AM | #3 |
I need the problem now ill try something and let you know if it worked
@Fizzlemizz Last edited by Infinite-Loop-Alchemist : 07-28-23 at 07:24 AM. |
|
![]() |
07-28-23, 10:21 AM | #4 | |
Code:
-- Register an event that fires when the player hits an enemy. local f = CreateFrame("FRAME") f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") f:SetScript("OnEvent", function(self, event) -- Get information about the combat event. local eventInfo = {CombatLogGetCurrentEventInfo()} local timestamp, eventType, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = unpack(eventInfo, 1, 11) local spellID, spellName, spellSchool, amount, overhealing, absorbed, critical if eventType == "SWING_DAMAGE" then spellName = "Auto Attack" spellID = 6603 -- or specify the path to a melee icon, if you have one amount, _, _, _, _, _, critical = unpack(eventInfo, 12, 18) else spellID, spellName, spellSchool = unpack(eventInfo, 12, 14) amount, overhealing, absorbed, critical = unpack(eventInfo, 15, 21) end if sourceGUID == UnitGUID("player") and destGUID ~= UnitGUID("player") and amount > 0 then if spellName then CritMaticData[spellName] = CritMaticData[spellName] or { highestCrit = 0, highestNormal = 0, highestHeal = 0, highestHealCrit = 0, spellIcon = GetSpellTexture(spellID) } print(CombatLogGetCurrentEventInfo()) if critical then if eventType == "SPELL_HEAL" or eventType == "SPELL_PERIODIC_HEAL" then if amount > CritMaticData[spellName].highestHealCrit then if spellName == "Auto Attack" then return end CritMaticData[spellName].highestHealCrit = amount PlaySound(888, "SFX") CritMatic.ShowNewHealCritMessage(spellName, amount) print("New highest crit heal for " .. spellName .. ": " .. CritMaticData[spellName].highestHealCrit) end else if amount > CritMaticData[spellName].highestCrit then if spellName == "Auto Attack" then return end CritMaticData[spellName].highestCrit = amount PlaySound(888, "SFX") CritMatic.ShowNewCritMessage(spellName, amount) print("New highest crit hit for " .. spellName .. ": " .. CritMaticData[spellName].highestCrit) end end elseif not critical then if eventType == "SPELL_HEAL" or eventType == "SPELL_PERIODIC_HEAL" then if amount > CritMaticData[spellName].highestHeal then if spellName == "Auto Attack" then return end CritMaticData[spellName].highestHeal = amount PlaySound(10049, "SFX") CritMatic.ShowNewHealMessage(spellName, amount) print("New highest normal heal for " .. spellName .. ": " .. CritMaticData[spellName].highestHeal) end else if amount > CritMaticData[spellName].highestNormal then if spellName == "Auto Attack" then return end CritMaticData[spellName].highestNormal = amount PlaySound(10049, "SFX") CritMatic.ShowNewNormalMessage(spellName, amount) print("New highest normal hit for " .. spellName .. ": " .. CritMaticData[spellName].highestNormal) end end end end end |
||
![]() |
07-28-23, 11:07 AM | #5 |
I'm not exactly sure what you mean by this. Is it that you never see this triggered?
Lua Code:
Or something else? Edit: Taking a closer look: Lua Code:
Lua Code:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 07-28-23 at 11:32 AM. |
|
![]() |
07-29-23, 07:10 AM | #6 | |
Thank you!! but 1 problem
edit The heals crits don't save in the tool-tip or Normal Heals. but works with spell_damage normals hits and Crits The all messages are fix. Code:
if eventType == "SWING_DAMAGE" then spellName = "Auto Attack" spellID = 6603 -- or specify the path to a melee icon, if you have one amount, _, _, _, _, _, critical = unpack(eventInfo, 12, 18) elseif eventType == "SPELL_HEAL" or eventType == "SPELL_PERIODIC_HEAL" then spellID, spellName, spellSchool = unpack(eventInfo, 12, 14) amount, overhealing, absorbed, critical = unpack(eventInfo, 15, 18) elseif eventType == "SPELL_DAMAGE" or eventType == "SPELL_PERIODIC_DAMAGE" then spellID, spellName, spellSchool = unpack(eventInfo, 12, 14) amount, overhealing, _, _, _, absorbed, critical = unpack(eventInfo, 15, 21) end if sourceGUID == UnitGUID("player") and destGUID ~= UnitGUID("player") and (eventType == "SPELL_DAMAGE" or eventType == "SWING_DAMAGE" or eventType == "RANGE_DAMAGE" or eventType == "SPELL_HEAL" or eventType == "SPELL_PERIODIC_HEAL" or eventType == "SPELL_PERIODIC_DAMAGE") and amount > 0 then if spellName then CritMaticData[spellName] = CritMaticData[spellName] or { highestCrit = 0, highestNormal = 0, highestHeal = 0, highestHealCrit = 0, spellIcon = GetSpellTexture(spellID) } print(CombatLogGetCurrentEventInfo()) if eventType == "SPELL_HEAL" or eventType == "SPELL_PERIODIC_HEAL" then if critical then -- When the event is a heal and it's a critical heal. if amount > CritMaticData[spellName].highestHealCrit then CritMaticData[spellName].highestHealCrit = amount PlaySound(888, "SFX") CritMatic.ShowNewHealCritMessage(spellName, amount) print("New highest crit heal for " .. spellName .. ": " .. CritMaticData[spellName].highestHealCrit) end elseif not critical then -- When the event is a heal but it's not a critical heal. if amount > CritMaticData[spellName].highestHeal then CritMaticData[spellName].highestHeal = amount PlaySound(10049, "SFX") CritMatic.ShowNewHealMessage(spellName, amount) print("New highest normal heal for " .. spellName .. ": " .. CritMaticData[spellName].highestHeal) end end elseif eventType == "SPELL_DAMAGE" or eventType == "SWING_DAMAGE" or eventType == "SPELL_PERIODIC_DAMAGE" then if critical then -- When the event is damage and it's a critical hit. if amount > CritMaticData[spellName].highestCrit then CritMaticData[spellName].highestCrit = amount PlaySound(888, "SFX") CritMatic.ShowNewCritMessage(spellName, amount) print("New highest crit hit for " .. spellName .. ": " .. CritMaticData[spellName].highestCrit) end elseif not critical then -- When the event is damage but it's not a critical hit. if amount > CritMaticData[spellName].highestNormal then CritMaticData[spellName].highestNormal = amount PlaySound(10049, "SFX") CritMatic.ShowNewNormalMessage(spellName, amount) print("New highest normal hit for " .. spellName .. ": " .. CritMaticData[spellName].highestNormal) end end end end Last edited by Infinite-Loop-Alchemist : 07-29-23 at 08:42 AM. |
||
![]() |
07-29-23, 10:52 AM | #7 |
Lua Code:
Pretty much the same problem (not differentiating correctly between swing and spell events). As well as the wrong positioning, here you're only retrieving args 15 to 18 and completely missing 20 and 21 (absorbed and critical) Lua Code:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. |
|
![]() |
07-30-23, 07:21 AM | #8 |
for heals its the 18th parameter for crits
1690725202.427 SPELL_HEAL false Player-4384-04EC1DF1 Cryptmender 1297 0 Player-4384-03104595 Sellys 66840 0 52985 Penance 2 4842 4842 0 true from that site Suffix 1st Param (15th) 2nd Param (16th) 3rd Param (17th) 4th Param (18th) 5th Param (19th) 6th Param (20th) 7th Param (21st) 8th Param (22nd) 9th Param (23rd) 10th Param (24th) _DAMAGE amount overkill school resisted blocked absorbed critical glancing crushing isOffHand _MISSED missType isOffHand amountMissed critical _HEAL amount overhealing absorbed critical i fixed that problem one more Issue. This code Code:
-- Define a table to hold the highest hits data. CritMaticData = CritMaticData or {} local function GetGCD() local _, gcdDuration = GetSpellCooldown(78) -- 78 is the spell ID for Warrior's Heroic Strike if gcdDuration == 0 then return 1.5 -- Default GCD duration if not available (you may adjust this value if needed) else return gcdDuration end end local function AddHighestHitsToTooltip(self, slot) if (not slot) then return end local actionType, id = GetActionInfo(slot) if actionType == "spell" then local spellName, _, _, castTime = GetSpellInfo(id) if CritMaticData[spellName] then local cooldown = (GetSpellBaseCooldown(id) or 0) / 1000 local effectiveCastTime = castTime > 0 and (castTime / 1000) or GetGCD() local effectiveTime = max(effectiveCastTime, cooldown) local critHPS = CritMaticData[spellName].highestHealCrit / effectiveTime local normalHPS = CritMaticData[spellName].highestHeal / effectiveTime local critDPS = CritMaticData[spellName].highestCrit / effectiveTime local normalDPS = CritMaticData[spellName].highestNormal / effectiveTime -- Your code here to display tooltip for healing spells local CritMaticHealLeft = "Highest Heal Crit: " local CritMaticHealRight = tostring(CritMaticData[spellName].highestHealCrit) .. " (" .. format("%.1f", critHPS) .. " HPS)" local normalMaticHealLeft = "Highest Heal Normal: " local normalMaticHealRight = tostring(CritMaticData[spellName].highestHeal) .. " (" .. format("%.1f", normalHPS) .. " HPS)" local CritMaticLeft = "Highest Crit: " local CritMaticRight = tostring(CritMaticData[spellName].highestHealCrit) .. " (" .. format("%.1f", critDPS) .. " DPS)" local normalMaticLeft = "Highest Normal: " local normalMaticRight = tostring(CritMaticData[spellName].highestHeal) .. " (" .. format("%.1f", normalDPS) .. " DPS)" -- Check if lines are already present in the tooltip. local critHealMaticExists = false local normalHealMaticExists = false local critMaticExists = false local normalMaticExists = false for i = 1, self:NumLines() do local gtl = _G["GameTooltipTextLeft" .. i] local gtr = _G["GameTooltipTextRight" .. i] if gtl and gtr then -- Healing related if gtl:GetText() == CritMaticHealLeft and gtr:GetText() == CritMaticHealRight then critHealMaticExists = true elseif gtl:GetText() == normalMaticHealLeft and gtr:GetText() == normalMaticHealRight then normalHealMaticExists = true end -- Damage related if gtl:GetText() == CritMaticLeft and gtr:GetText() == CritMaticRight then critDamageMaticExists = true elseif gtl:GetText() == normalMaticLeft and gtr:GetText() == normalMaticRight then normalDamageMaticExists = true end end end -- If lines don't exist, add them. if not critHealMaticExists then self:AddDoubleLine(CritMaticHealLeft, CritMaticHealRight) _G["GameTooltipTextLeft" .. self:NumLines()]:SetTextColor(1, 1, 1) -- left side color (white) _G["GameTooltipTextRight" .. self:NumLines()]:SetTextColor(1, 0.82, 0) -- right side color (white) end if not normalHealMaticExists then self:AddDoubleLine(normalMaticHealLeft, normalMaticHealRight) _G["GameTooltipTextLeft" .. self:NumLines()]:SetTextColor(1, 1, 1) -- left side color (white) _G["GameTooltipTextRight" .. self:NumLines()]:SetTextColor(1, 0.82, 0) -- right side color (white) end if not critMaticExists then self:AddDoubleLine(CritMaticLeft, CritMaticRight) _G["GameTooltipTextLeft" .. self:NumLines()]:SetTextColor(1, 1, 1) -- left side color (white) _G["GameTooltipTextRight" .. self:NumLines()]:SetTextColor(1, 0.82, 0) -- right side color (white) end if not normalMaticExists then self:AddDoubleLine(normalMaticLeft, normalMaticRight) _G["GameTooltipTextLeft" .. self:NumLines()]:SetTextColor(1, 1, 1) -- left side color (white) _G["GameTooltipTextRight" .. self:NumLines()]:SetTextColor(1, 0.82, 0) -- right side color (white) end self:Show() end end end -- Register an event that fires when the player hits an enemy. local f = CreateFrame("FRAME") f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") f:SetScript("OnEvent", function(self, event) -- Get information about the combat event. local eventInfo = { CombatLogGetCurrentEventInfo() } local timestamp, eventType, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = unpack(eventInfo, 1, 11) local spellID, spellName, spellSchool, amount, overhealing, absorbed, critical if eventType == "SWING_DAMAGE" then spellName = "Auto Attack" spellID = 6603 -- or specify the path to a melee icon, if you have one amount, _, _, _, _, _, critical = unpack(eventInfo, 12, 18) elseif eventType == "SPELL_HEAL" or eventType == "SPELL_PERIODIC_HEAL" then spellID, spellName, spellSchool = unpack(eventInfo, 12, 14) amount, overhealing, absorbed, critical = unpack(eventInfo, 15, 18) elseif eventType == "SPELL_DAMAGE" or eventType == "SPELL_PERIODIC_DAMAGE" then spellID, spellName, spellSchool = unpack(eventInfo, 12, 14) amount, overhealing, _, _, _, absorbed, critical = unpack(eventInfo, 15, 21) end --48071 Flash Heal 2 6569 6569 0 true --1690726298.925 SPELL_HEAL false Player-4384-04EC1DF1 Cryptmender 1297 0 Creature-0-4411-571-2846-32688-0000404538 Archmage Tenaj 68120 0 48071 Flash Heal 2 6536 6536 0 true --1617986113.264, "SPELL_DAMAGE", false, "Player-1096-06DF65C1", "Xiaohuli", 1297, 0, "Creature-0-4253-0-160-94-000070569B", "Cutpurse", 68168, 0, 585, "Smite", 2, 47, 19, 2, nil, nil, nil, false, false, false, false if sourceGUID == UnitGUID("player") and destGUID ~= UnitGUID("player") and (eventType == "SPELL_DAMAGE" or eventType == "SWING_DAMAGE" or eventType == "RANGE_DAMAGE" or eventType == "SPELL_HEAL" or eventType == "SPELL_PERIODIC_HEAL" or eventType == "SPELL_PERIODIC_DAMAGE") and amount > 0 then if spellName then CritMaticData[spellName] = CritMaticData[spellName] or { highestCrit = 0, highestNormal = 0, highestHeal = 0, highestHealCrit = 0, spellIcon = GetSpellTexture(spellID) } --print(CombatLogGetCurrentEventInfo()) if eventType == "SPELL_HEAL" or eventType == "SPELL_PERIODIC_HEAL" then if critical then -- When the event is a heal and it's a critical heal. if amount > CritMaticData[spellName].highestHealCrit then CritMaticData[spellName].highestHealCrit = amount print("testing " .. spellName .. ": " .. CritMaticData[spellName].highestHealCrit) PlaySound(888, "SFX") CritMatic.ShowNewHealCritMessage(spellName, amount) print("New highest crit heal for " .. spellName .. ": " .. CritMaticData[spellName].highestHealCrit) end elseif not critical then -- When the event is a heal but it's not a critical heal. if amount > CritMaticData[spellName].highestHeal then CritMaticData[spellName].highestHeal = amount PlaySound(10049, "SFX") CritMatic.ShowNewHealMessage(spellName, amount) print("New highest normal heal for " .. spellName .. ": " .. CritMaticData[spellName].highestHeal) end end elseif eventType == "SPELL_DAMAGE" or eventType == "SWING_DAMAGE" or eventType == "SPELL_PERIODIC_DAMAGE" then if critical then -- When the event is damage and it's a critical hit. if amount > CritMaticData[spellName].highestCrit then CritMaticData[spellName].highestCrit = amount PlaySound(888, "SFX") CritMatic.ShowNewCritMessage(spellName, amount) print("New highest crit hit for " .. spellName .. ": " .. CritMaticData[spellName].highestCrit) end elseif not critical then -- When the event is damage but it's not a critical hit. if amount > CritMaticData[spellName].highestNormal then CritMaticData[spellName].highestNormal = amount PlaySound(10049, "SFX") CritMatic.ShowNewNormalMessage(spellName, amount) print("New highest normal hit for " .. spellName .. ": " .. CritMaticData[spellName].highestNormal) end end end end end end) -- Register an event that fires when the addon is loaded. local function OnLoad(self, event, addonName) if addonName == "CritMatic" then print("CritMatic Loaded!") CritMaticData = _G["CritMaticData"] -- Add the highest hits data to the spell button tooltip. hooksecurefunc(GameTooltip, "SetAction", AddHighestHitsToTooltip) end end local frame = CreateFrame("FRAME") frame:RegisterEvent("ADDON_LOADED") frame:SetScript("OnEvent", OnLoad) -- Register an event that fires when the player logs out or exits the game. local function OnSave(self, event) -- Save the highest hits data to the saved variables for the addon. _G["CritMaticData"] = CritMaticData end local frame = CreateFrame("FRAME") frame:RegisterEvent("PLAYER_LOGOUT") frame:SetScript("OnEvent", OnSave) local function ResetData() CritMaticData = {} print("CritMatic data reset.") end SLASH_CRITMATICRESET1 = '/cmreset' function SlashCmdList.CRITMATICRESET(msg, editBox) ResetData() end Code:
if ![]() but I can think of some checks that would work but its out of scope. Code:
if eventType == "SPELL_DAMAGE" or eventType == "SWING_DAMAGE" or eventType == "SPELL_PERIODIC_DAMAGE" then Last edited by Infinite-Loop-Alchemist : 07-30-23 at 12:19 PM. |
|
![]() |
08-01-23, 01:06 PM | #9 |
One Possability, in your OnEvent you could do something like:
Lua Code:
Then your Tooltip code could check for Lua Code:
And if found, set whatever tooltp, clearing self.CritMaticDataShowHeals in the process if required.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 08-01-23 at 01:20 PM. |
|
![]() |
WoWInterface » Developer Discussions » Lua/XML Help » "SPELL_DAMAGE" and "SPELL_PERIODIC_DAMAGE" Crit bool is nil |
«
Previous Thread
|
Next Thread
»
|
Thread Tools | |
Display Modes | |
|
|