From c1d8082546b467068dc20885f189a697f70f3eff Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Mon, 5 Feb 2024 19:57:19 -0300 Subject: [PATCH] Using now a crowd control spell list from Lib Open Raid --- Libs/LibOpenRaid/LibOpenRaid.lua | 2 +- .../ThingsToMantain_Dragonflight.lua | 154 ++++++++++++++++++ classes/class_utility.lua | 12 +- core/parser.lua | 6 +- frames/window_eventtracker.lua | 5 - 5 files changed, 168 insertions(+), 11 deletions(-) diff --git a/Libs/LibOpenRaid/LibOpenRaid.lua b/Libs/LibOpenRaid/LibOpenRaid.lua index e36cc47a..e64a420b 100644 --- a/Libs/LibOpenRaid/LibOpenRaid.lua +++ b/Libs/LibOpenRaid/LibOpenRaid.lua @@ -44,7 +44,7 @@ end local major = "LibOpenRaid-1.0" -local CONST_LIB_VERSION = 124 +local CONST_LIB_VERSION = 125 if (LIB_OPEN_RAID_MAX_VERSION) then if (CONST_LIB_VERSION <= LIB_OPEN_RAID_MAX_VERSION) then diff --git a/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua b/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua index a3c733d9..c7a9e020 100644 --- a/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua +++ b/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua @@ -781,6 +781,124 @@ do --[412710] = {cooldown = 0, duration = 0, specs = {1473}, talent = false, charges = 1, class = "EVOKER", type = 0}, --Timelessness } + --list of all crowd control spells + --it is not transmitted to other clients + LIB_OPEN_RAID_CROWDCONTROL = { + [331866] = {cooldown = 0, class = "COVENANT|VENTHYR"}, --Agent of Chaos + [334693] = {cooldown = 0, class = "DEAHTKNIGHT"}, --Absolute Zero + [221562] = {cooldown = 45, class = "DEATHKNIGHT"}, --Asphyxiate + [47528] = {cooldown = 15, class = "DEATHKNIGHT"}, --Mind Freeze + [207167] = {cooldown = 60, class = "DEATHKNIGHT"}, --Blinding Sleet + [91807] = {cooldown = 0, class = "DEATHKNIGHT"}, --Shambling Rush + [108194] = {cooldown = 45, class = "DEATHKNIGHT"}, --Asphyxiate + [211881] = {cooldown = 30, class = "DEMONHUNTER"}, --Fel Eruption + [200166] = {cooldown = 0, class = "DEMONHUNTER"}, --Metamorphosis + [217832] = {cooldown = 45, class = "DEMONHUNTER"}, --Imprison + [183752] = {cooldown = 15, class = "DEMONHUNTER"}, --Disrupt + [207685] = {cooldown = 0, class = "DEMONHUNTER"}, --Sigil of Misery + [179057] = {cooldown = 45, class = "DEMONHUNTER"}, --Chaos Nova + [221527] = {cooldown = 45, class = "DEMONHUNTER"}, --Imprison with detainment talent + [339] = {cooldown = 0, class = "DRUID"}, --Entangling Roots + [102359] = {cooldown = 30, class = "DRUID"}, --Mass Entanglement + [93985] = {cooldown = 0, class = "DRUID"}, --Skull Bash + [2637] = {cooldown = 0, class = "DRUID"}, --Hibernate + [5211] = {cooldown = 60, class = "DRUID"}, --Mighty Bash + [99] = {cooldown = 30, class = "DRUID"}, --Incapacitating Roar + [127797] = {cooldown = 0, class = "DRUID"}, --Ursol's Vortex + [203123] = {cooldown = 0, class = "DRUID"}, --Maim + [45334] = {cooldown = 0, class = "DRUID"}, --Immobilized + [33786] = {cooldown = 0, class = "DRUID"}, --Cyclone + [236748] = {cooldown = 30, class = "DRUID"}, --Intimidating Roar + [61391] = {cooldown = 0, class = "DRUID"}, --Typhoon + [163505] = {cooldown = 0, class = "DRUID"}, --Rake + [50259] = {cooldown = 0, class = "DRUID"}, --Dazed + [372245] = {cooldown = 0, class = "EVOKER"}, --Terror of the Skies + [360806] = {cooldown = 15, class = "EVOKER"}, --Sleep Walk + [162480] = {cooldown = 0, class = "HUNTER"}, --Steel Trap + [187707] = {cooldown = 15, class = "HUNTER"}, --Muzzle + [147362] = {cooldown = 24, class = "HUNTER"}, --Counter Shot + [190927] = {cooldown = 6, class = "HUNTER"}, --Harpoon + [117526] = {cooldown = 45, class = "HUNTER"}, --Binding Shot + [24394] = {cooldown = 0, class = "HUNTER"}, --Intimidation + [117405] = {cooldown = 0, class = "HUNTER"}, --Binding Shot + [19577] = {cooldown = 60, class = "HUNTER"}, --Intimidation + [1513] = {cooldown = 0, class = "HUNTER"}, --Scare Beast + [3355] = {cooldown = 30, class = "HUNTER"}, --Freezing Trap + [203337] = {cooldown = 30, class = "HUNTER"}, --Freezing trap with diamond ice talent + [31661] = {cooldown = 45, class = "MAGE"}, --Dragon's Breath + [161353] = {cooldown = 0, class = "MAGE"}, --Polymorph + [277787] = {cooldown = 0, class = "MAGE"}, --Polymorph + [157981] = {cooldown = 30, class = "MAGE"}, --Blast Wave + [82691] = {cooldown = 0, class = "MAGE"}, --Ring of Frost + [118] = {cooldown = 0, class = "MAGE"}, --Polymorph + [161354] = {cooldown = 0, class = "MAGE"}, --Polymorph + [157997] = {cooldown = 25, class = "MAGE"}, --Ice Nova + [391622] = {cooldown = 0, class = "MAGE"}, --Polymorph + [28271] = {cooldown = 0, class = "MAGE"}, --Polymorph + [122] = {cooldown = 0, class = "MAGE"}, --Frost Nova + [277792] = {cooldown = 0, class = "MAGE"}, --Polymorph + [61721] = {cooldown = 0, class = "MAGE"}, --Polymorph + [126819] = {cooldown = 0, class = "MAGE"}, --Polymorph + [61305] = {cooldown = 0, class = "MAGE"}, --Polymorph + [28272] = {cooldown = 0, class = "MAGE"}, --Polymorph + [2139] = {cooldown = 24, class = "MAGE"}, --Counterspell + [198909] = {cooldown = 0, class = "MONK"}, --Song of Chi-Ji + [119381] = {cooldown = 60, class = "MONK"}, --Leg Sweep + [107079] = {cooldown = 120, class = "MONK"}, --Quaking Palm + [116706] = {cooldown = 0, class = "MONK"}, --Disable + [115078] = {cooldown = 45, class = "MONK"}, --Paralysis + [116705] = {cooldown = 15, class = "MONK"}, --Spear Hand Strike + [31935] = {cooldown = 15, class = "PALADIN"}, --Avenger's Shield + [20066] = {cooldown = 15, class = "PALADIN"}, --Repentance + [217824] = {cooldown = 0, class = "PALADIN"}, --Shield of Virtue + [105421] = {cooldown = 0, class = "PALADIN"}, --Blinding Light + [10326] = {cooldown = 15, class = "PALADIN"}, --Turn Evil + [853] = {cooldown = 60, class = "PALADIN"}, --Hammer of Justice + [96231] = {cooldown = 15, class = "PALADIN"}, --Rebuke + [205364] = {cooldown = 30, class = "PRIEST"}, --Dominate Mind + [64044] = {cooldown = 45, class = "PRIEST"}, --Psychic Horror + [226943] = {cooldown = 0, class = "PRIEST"}, --Mind Bomb + [15487] = {cooldown = 45, class = "PRIEST"}, --Silence + [605] = {cooldown = 0, class = "PRIEST"}, --Mind Control + [8122] = {cooldown = 45, class = "PRIEST"}, --Psychic Scream + [200200] = {cooldown = 60, class = "PRIEST"}, --Holy Word: Chastise + [9484] = {cooldown = 0, class = "PRIEST"}, --Shackle Undead + [200196] = {cooldown = 60, class = "PRIEST"}, --Holy Word: Chastise + [6770] = {cooldown = 0, class = "ROGUE"}, --Sap + [2094] = {cooldown = 120, class = "ROGUE"}, --Blind + [1766] = {cooldown = 15, class = "ROGUE"}, --Kick + [427773] = {cooldown = 0, class = "ROGUE"}, --Blind + [408] = {cooldown = 20, class = "ROGUE"}, --Kidney Shot + [1776] = {cooldown = 20, class = "ROGUE"}, --Gouge + [1833] = {cooldown = 0, class = "ROGUE"}, --Cheap Shot + [211015] = {cooldown = 30, class = "SHAMAN"}, --Hex + [269352] = {cooldown = 30, class = "SHAMAN"}, --Hex + [277778] = {cooldown = 30, class = "SHAMAN"}, --Hex + [64695] = {cooldown = 0, class = "SHAMAN"}, --Earthgrab + [57994] = {cooldown = 12, class = "SHAMAN"}, --Wind Shear + [197214] = {cooldown = 40, class = "SHAMAN"}, --Sundering + [118905] = {cooldown = 0, class = "SHAMAN"}, --Static Charge + [277784] = {cooldown = 30, class = "SHAMAN"}, --Hex + [309328] = {cooldown = 30, class = "SHAMAN"}, --Hex + [211010] = {cooldown = 30, class = "SHAMAN"}, --Hex + [210873] = {cooldown = 30, class = "SHAMAN"}, --Hex + [211004] = {cooldown = 30, class = "SHAMAN"}, --Hex + [51514] = {cooldown = 30, class = "SHAMAN"}, --Hex + [305485] = {cooldown = 30, class = "SHAMAN"}, --Lightning Lasso + [89766] = {cooldown = 30, class = "WARLOCK"}, --Axe Toss (pet felguard ability) + [6789] = {cooldown = 45, class = "WARLOCK"}, --Mortal Coil + [118699] = {cooldown = 0, class = "WARLOCK"}, --Fear + [710] = {cooldown = 0, class = "WARLOCK"}, --Banish + [212619] = {cooldown = 60, class = "WARLOCK"}, --Call Felhunter + [19647] = {cooldown = 24, class = "WARLOCK"}, --Spell Lock + [30283] = {cooldown = 60, class = "WARLOCK"}, --Shadowfury + [5484] = {cooldown = 40, class = "WARLOCK"}, --Howl of Terror + [6552] = {cooldown = 15, class = "WARRIOR"}, --Pummel + [132168] = {cooldown = 0, class = "WARRIOR"}, --Shockwave + [132169] = {cooldown = 0, class = "WARRIOR"}, --Storm Bolt + [5246] = {cooldown = 90, class = "WARRIOR"}, --Intimidating Shout + } + --this table store all cooldowns the player currently have available LIB_OPEN_RAID_PLAYERCOOLDOWNS = {} @@ -995,3 +1113,39 @@ do end) loadLibDatabase() end + + +--[=[ code used to build the crowd control list +for spellId, spellInfo in pairs(LIB_OPEN_RAID_COOLDOWNS_INFO) do + if (spellInfo.type == 8) then + LIB_OPEN_RAID_CROWDCONTROL[spellId] = spellInfo + end +end + +LIB_OPEN_RAID_CROWDCONTROL = {} + +C_Timer.After(5, function() + --for debugging, compares which crowd control spells are in the details framework that are not in the lib + local notInLib = {} + + local DF_CrowdControlSpells = DetailsFramework.CrowdControlSpells + for spellId, className in pairs(DF_CrowdControlSpells) do + local spellName = GetSpellInfo(spellId) + if (spellName) then -- and not LIB_OPEN_RAID_CROWDCONTROL[spellId] + local spellCooldown = math.floor(GetSpellBaseCooldown(spellId)/1000) + notInLib[#notInLib+1] = {spellId, spellName, spellCooldown, className} + end + end + + table.sort(notInLib, function(t1, t2) return t1[4] < t2[4] end) + + --make a string like the one above + local result = "" + for i = 1, #notInLib do + local spellId, spellName, spellCooldown, className = unpack(notInLib[i]) + result = result .. "["..spellId.."] =\t{cooldown = "..spellCooldown..",\t\tclass = \"" .. className .. "\"}, --" .. spellName .. "\n" + end + + dumpt(result) +end) +--]=] \ No newline at end of file diff --git a/classes/class_utility.lua b/classes/class_utility.lua index c1cb187b..7067d229 100644 --- a/classes/class_utility.lua +++ b/classes/class_utility.lua @@ -1176,7 +1176,9 @@ function atributo_misc:ToolTipDispell(instancia, numero, barra) if (spellTable.dispell) then spellsUsedToDispel[#spellsUsedToDispel+1] = {spellId, math.floor(spellTable.dispell)} else - Details:Msg("D! table.dispell is invalid. spellId:", spellId) + --happens when druid uses shapeshift to break root + --Details:Msg("D! table.dispell is invalid. spellId:", spellId) + spellsUsedToDispel[#spellsUsedToDispel+1] = {spellId, math.floor(-1)} end end table.sort (spellsUsedToDispel, _detalhes.Sort2) @@ -1193,7 +1195,13 @@ function atributo_misc:ToolTipDispell(instancia, numero, barra) local spellId = spellInfo[1] local amountDispels = spellInfo[2] local spellName, _, spellicon = _GetSpellInfo(spellId) - GameCooltip:AddLine(spellName, amountDispels .. " (" .. string.format("%.1f", amountDispels / totalDispels * 100) .. "%)") + local amountOfDispelsStr = "" .. amountDispels + + if (amountDispels == -1) then + amountOfDispelsStr = _G["UNKNOWN"] + end + + GameCooltip:AddLine(spellName, amountOfDispelsStr .. " (" .. string.format("%.1f", amountDispels / totalDispels * 100) .. "%)") GameCooltip:AddIcon(spellicon, nil, nil, icon_size.W, icon_size.H, icon_border.L, icon_border.R, icon_border.T, icon_border.B) _detalhes:AddTooltipBackgroundStatusbar() end diff --git a/core/parser.lua b/core/parser.lua index 036fbee2..f512d4b6 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -35,7 +35,7 @@ local shield_cache = Details.ShieldCache --details local local parser = Details.parser --details local - local cc_spell_list = detailsFramework.CrowdControlSpells + local crowdControlSpells = LIB_OPEN_RAID_CROWDCONTROL local spellContainerClass = Details.container_habilidades --details local --localize the cooldown table from the framework @@ -2981,7 +2981,7 @@ if (_in_combat) then ------------------------------------------------------------------------------------------------ --buff uptime - if (cc_spell_list [spellId]) then + if (crowdControlSpells[spellId]) then parser:add_cc_done (token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellId, spellName) end @@ -4374,7 +4374,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 --serach key: ~cc function parser:break_cc(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellId, spellName, spellType, extraSpellID, extraSpellName, extraSchool, auraType) - if (not cc_spell_list[spellId]) then + if (not crowdControlSpells[spellId]) then return elseif (bitBand(sourceFlags, AFFILIATION_GROUP) == 0) then diff --git a/frames/window_eventtracker.lua b/frames/window_eventtracker.lua index 32a71d36..0877e0f8 100644 --- a/frames/window_eventtracker.lua +++ b/frames/window_eventtracker.lua @@ -771,11 +771,6 @@ function Details:CreateEventTrackerFrame(parentObject, name) scrollframe:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16}) scrollframe:SetBackdropColor(0, 0, 0, 0) - --get tables used inside the combat parser - local cooldownListFromFramework = DetailsFramework.CooldownsAllDeffensive - local attackCooldownsFromFramework = DetailsFramework.CooldownsAttack - local crowdControlFromFramework = DetailsFramework.CrowdControlSpells - local combatLog = CreateFrame("frame") combatLog:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") local OBJECT_TYPE_PLAYER = 0x00000400