Go to Page... |
Thread Tools | Display Modes |
08-12-23, 12:22 PM | #1 |
![]() I'm having a problem with my addon CritMatic. It records The highest Crits and Normals for every spell. It works for every spell but Killing Spree. Been Trying every thing I can think of for a week now. (Finally broke down to ask for help.) I think I know the cause or at least why is not working as expected. I Think Killing Spree has more then 1 icon Id or spell ids.
Code:
print(CombatLogGetCurrentEventInfo()) The IconID from idTip addon says 236277 but print("Spell Name: ".. spellName .. GetSpellTexture(spellID)) -- shows 132369 132345 The data gets recorded by Spell Name but not displayed in a tooltip. /dump CritMaticData["Killing Spree"] --[1]={ --highestCrit=2337, --spellIcon=132345, --highestHealCrit=0, --highestNormal=1325, --highestHeal=0 --} Here's the my addons git repo Currently working in the killingspree branch. https://github.com/InfiniteLoopAlchemist/CritMatic Here's parts of the code that's important, if you don't want to leave wow Interface. Code:
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)" 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 critMaticHealExists = true elseif gtl:GetText() == normalMaticHealLeft and gtr:GetText() == normalMaticHealRight then normalMaticHealExists = true end -- Damage related 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 CritMaticData[spellName].highestHeal > 0 or CritMaticData[spellName].highestHealCrit > 0 then -- If lines don't exist, add them. if not critMaticHealExists 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 normalMaticHealExists 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 end --if CritMaticData[spellName].highestNormal > 0 or CritMaticData[spellName].highestCrit > 0 or CritMaticData["Killing Spree"].highestCrit > 0 or CritMaticData["Killing Spree"].highestNormal > 0 then if CritMaticData[spellName].highestNormal > 0 or CritMaticData[spellName].highestCrit > 0 then -- This is a damaging spell 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 end local isKillingSpreeActive = false local killingSpreeDamage = 0 local killingSpreeCritDamage = 0 local killingSpreeCount = 0 -- Get information about the combat event. local killingSpreeCritCount = 0 if event == "UNIT_SPELLCAST_SUCCEEDED" then local unitTarget, castGUID, spellID = ... local spellName = GetSpellInfo(spellID) if unitTarget == "player" and spellName == "Killing Spree" then isKillingSpreeActive = true killingSpreeDamage = 0 killingSpreeCritDamage = 0 killingSpreeCount = 0 killingSpreeCritCount = 0 end if spellName then CritMaticData[baseSpellName] = CritMaticData[baseSpellName] or { highestCrit = 0, highestNormal = 0, highestHeal = 0, highestHealCrit = 0, -- spellIcon = baseSpellName == "Killing Spree" and GetSpellTexture(57842) or GetSpellTexture(spellID) spellIcon = GetSpellTexture(spellID) } --print(CombatLogGetCurrentEventInfo()) --print("Spell Name: ".. spellName .. GetSpellTexture(spellID)) if isKillingSpreeActive and baseSpellName == "Killing Spree" then print("[Debug] Killing Spree attack detected. Damage:", amount) -- Debug: Damage of the current attack if critical then print("[Debug] This attack was a critical hit!") -- Debug: Indicate if the attack was a critical hit killingSpreeCritDamage = killingSpreeCritDamage + amount killingSpreeCritCount = killingSpreeCritCount + 1 else killingSpreeDamage = killingSpreeDamage + amount end killingSpreeCount = killingSpreeCount + 1 print("[Debug] Attack count so far:", killingSpreeCount) -- Debug: Track the number of attacks if killingSpreeCount >= 5 then print("[Debug] Killing Spree ended. Total Damage:", killingSpreeDamage, "Total Crit Damage:", killingSpreeCritDamage) -- Debug: Total damage and crit damage after 5 attacks isKillingSpreeActive = false if killingSpreeCritCount > 0 then if killingSpreeCritDamage + killingSpreeDamage > CritMaticData[baseSpellName].highestCrit then print("[Debug] New highest critical damage recorded for Killing Spree:", killingSpreeCritDamage) -- Debug: New highest critical damage CritMaticData["Killing Spree"].highestCrit = killingSpreeCritDamage + killingSpreeDamage PlaySound(888, "SFX") CritMatic.ShowNewCritMessage(baseSpellName, killingSpreeCritDamage + killingSpreeDamage) print("New highest crit hit for " .. baseSpellName .. ": " .. CritMaticData[baseSpellName].highestCrit) --print(" crit saved! " .. baseSpellName .. ": " .. CritMaticData[spellName].highestCrit) end else if killingSpreeDamage > CritMaticData[baseSpellName].highestNormal then print("[Debug] New highest normal damage recorded for Killing Spree:", killingSpreeDamage) -- Debug: New highest normal damage CritMaticData["Killing Spree"].highestNormal = killingSpreeDamage PlaySound(10049, "SFX") CritMatic.ShowNewNormalMessage(baseSpellName, killingSpreeDamage) print("New highest normal hit for " .. baseSpellName .. ": " .. CritMaticData[baseSpellName].highestNormal) --print("normal saved " .. baseSpellName .. ": " .. CritMaticData[spellName].highestNormal) end end killingSpreeCount = 0 killingSpreeDamage = 0 killingSpreeCritDamage = 0 killingSpreeCritCount = 0 end |
|
![]() |
08-14-23, 12:57 PM | #2 |
I solved this
I solved this
|
|
![]() |
WoWInterface » Developer Discussions » Lua/XML Help » The data gets stored, but wont Display in the tooltip for Killing Spree |
«
Previous Thread
|
Next Thread
»
|
Thread Tools | |
Display Modes | |
|
|