View Single Post
07-29-23, 07:10 AM   #6
Infinite-Loop-Alchemist
A Murloc Raider
 
Infinite-Loop-Alchemist's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2023
Posts: 7
Thank you!! but 1 problem

Originally Posted by Fizzlemizz View Post
I'm not exactly sure what you mean by this. Is it that you never see this triggered?
Lua Code:
  1. else
  2.           if amount > CritMaticData[spellName].highestCrit then
  3.             if spellName == "Auto Attack" then
  4.               return
  5.             end
  6.             CritMaticData[spellName].highestCrit = amount
  7.             PlaySound(888, "SFX")
  8.             CritMatic.ShowNewCritMessage(spellName, amount)
  9.             print("New highest crit hit for " .. spellName .. ": " .. CritMaticData[spellName].highestCrit)
  10.           end
  11. end

Or something else?

Edit: Taking a closer look:
Lua Code:
  1. if eventType == "SWING_DAMAGE" then
  2.     spellName = "Auto Attack"
  3.     spellID = 6603 -- or specify the path to a melee icon, if you have one
  4.     amount, _, _, _, _, _, critical = unpack(eventInfo, 12, 18)
  5.   else
  6.     spellID, spellName, spellSchool = unpack(eventInfo, 12, 14)
  7.     amount, overhealing, absorbed, critical = unpack(eventInfo, 15, 21)
  8.   end
If the eventType is not "SWING_DAMAGE" then critical is unpacked from argument 18 not 21
Lua Code:
  1. amount, overhealing, _, _, _, absorbed, critical = unpack(eventInfo, 15, 21)
That worked but caused 1 problem now.
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.
  Reply With Quote