From a1753f6cf3c834519fdb3d1609e2d87c681a6b02 Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Mon, 2 Mar 2026 04:18:10 +0100 Subject: [PATCH 1/4] wip --- Modules/Config/GeneralSection.lua | 13 ++ Modules/Data/Constants.lua | 151 ++++++++++++++++++ Modules/Data/Data.lua | 1 + Modules/Data/General.lua | 35 ++++ Modules/Migration.lua | 7 +- Modules/Profile.lua | 5 + Modules/Stats.lua | 6 +- .../GeneralConfigTranslations.lua | 10 ++ .../i18n/translations/StatTranslations.lua | 10 ++ 9 files changed, 236 insertions(+), 2 deletions(-) diff --git a/Modules/Config/GeneralSection.lua b/Modules/Config/GeneralSection.lua index 8adafb23..4c3621c0 100644 --- a/Modules/Config/GeneralSection.lua +++ b/Modules/Config/GeneralSection.lua @@ -40,6 +40,19 @@ function _Config:LoadGeneralSection() Stats.RebuildStatInfos() end, }, + invisibility = { + type = "toggle", + order = 1, + name = function() return i18n("Show invisibility") end, + desc = function() return i18n("Shows/Hides the invisibility value.") end, + width = 1.5, + disabled = function() return (not ExtendedCharacterStats.profile.general.display); end, + get = function () return ExtendedCharacterStats.profile.general.invisibility.display; end, + set = function (_, value) + ExtendedCharacterStats.profile.general.invisibility.display = value + Stats.RebuildStatInfos() + end, + }, }, } end \ No newline at end of file diff --git a/Modules/Data/Constants.lua b/Modules/Data/Constants.lua index 7f424a18..fb62be7d 100755 --- a/Modules/Data/Constants.lua +++ b/Modules/Data/Constants.lua @@ -1,3 +1,6 @@ +local IsClassic = ECS.IsClassic +local IsWotlk = ECS.IsWotlk + ---@class Data local Data = ECSLoader:ImportModule("Data") @@ -79,6 +82,154 @@ Data.Aura = { [17800] = (ECS.IsWotlk and -5 or nil), -- Shadow Mastery 5/5 [22959] = (ECS.IsWotlk and -5 or nil), -- Improved Scorch }, + --- index 0 is for "Apply Aura: Invisibility" + --- index n is for "Apply Aura: Invisibility (n)" + --- auras with attributes "Passive spell" or "Aura is hidden" aren't listed here + Invisibility = { + [0] = { + [66] = IsClassic and 100 or nil, -- Lesser Invisibility + [3680] = 100, -- Lesser Invisibility + [4079] = 200, -- Cloaking + [4952] = 200, -- Helcular's War + [5543] = 500, -- Fade Out + [6298] = 200, -- Form of the Moonstalker + [7870] = IsWotlk and 200 or 100, -- Lesser Invisibility + [8611] = 5000, -- Phase Shift + [885] = 200, -- Invisibility + [9095] = -1000, -- Cantation of Manifestation + [9587] = 200, -- Magic Potion + [9738] = -1000, -- Rift Spawn Becomes Visible + [10228] = 300, -- Greater Invisibility + [11392] = 200, -- Invisibility + [12332] = 10000, -- Lathoric the Black + [12845] = 100, -- Lesser Invisibility + [16380] = 300, -- Greater Invisibility + [17651] = 5000, -- Image Projection + [20672] = 500, -- Fade + [23452] = 300, -- Invisibility + [24235] = 10000, -- Super Invis + [25905] = 10000, -- Invis Self + [26222] = 10000, -- Super Invis + [28500] = 200, -- Invisibility + [29309] = 5000, -- Phase Shift + [32943] = 300, -- Phasing Invisibility + [29627] = 200, -- Nether Step + [29921] = 150, -- Phasing Invisibility + [30447] = 50, -- Shadow of the Forest + [30448] = 100, -- Shadow of the Forest + [32612] = 340, -- Invisibility + [32811] = 300, -- Greater Invisibility + [41253] = 300, -- Greater Invisibility + [44312] = 9999, -- Head of the Horseman Invisible + [46021] = 350, -- Spectral Realm + [49399] = 100, -- Skeleton Invis + [50700] = 350, -- Copy of Spectral Realm (Test) + [54436] = 600, -- Demonic Empowerment + [55848] = 1000, -- Invisibility + [69107] = 300, -- Killing Spree Invis Aura + [72343] = 400, -- Hallucination + [440505] = 200, -- Invisibility + [441785] = 101, -- Drained of Blood + [1221579] = 201, -- Super Invis + [1227700] = 201, -- Invisibility + [1231389] = 10000, -- Vanish + }, + [1] = { + [8203] = 1000, -- Elemental Spirit Invisibility + }, + [2] = { + [17680] = 1, -- Spirit Spawn-out + [24221] = 1, -- Quest - Teleport Spawn-out + [24699] = 10000, -- Vanish + [36748] = 1, -- Smoke Spawn-out + [448779] = 5001, -- Wake Up Dead + [459280] = 101, -- Transiting Realities + [1234595] = 10000, -- Vanish + }, + [4] = { + [12495] = 1000, -- Eranikus the Chained Invisibility + [29448] = 9999, -- Vanish + [32727] = 100, -- Arena Preparation + [32754] = 100, -- Invisibility + [34341] = 9999, -- Ember Blast + [38544] = 300, -- Coax Marmot + [39667] = 9999, -- Vanish + [41476] = 9999, -- Vanish + [44036] = 340, -- Fade + [44199] = 9999, -- Ember Blast + [49337] = 1000, -- Racer Slam death scene: car flip Parent + [50008] = 1, -- BOTM - Jungle Brew - Jungle Invisibility Aura + [50015] = 9999, -- You're a ...! (NPC) Death Scene + [55964] = 9999, -- Vanish + [74069] = 100, -- Spawn Invisibility Aura + }, + [5] = { + [56783] = 50, -- Quest Invis Tier 4 + }, + [7] = { + [23303] = 100, -- Vaelen the Flayed [The Shadow Vault] - Invisibility + [27622] = 100, -- Get the Key: Vaelen's Invisibility & See Invisibility + [37754] = 5000, -- Through The Eyes of Gorefiend + [38012] = 5000, -- Garm Wolfbrother: Invisibility + [43890] = 1000, -- Flying Machine Invisibility + [45636] = 100, -- Mist of the Kvaldir + [50734] = 1000, -- Frenzyheart Chicken: Invisibility + [52060] = 300, -- Invisibility + [54500] = 1000, -- Quest Invisibility 1 + [56304] = 350, -- Hodir's Helm Bunny: Invisibility + [56768] = 50, -- Quest Invis Tier 1 + [56779] = 50, -- Quest Invis Tier 1 + [57744] = 1000, -- Quest Invisibility 1 + [59649] = 99, -- Icecrown Bomber - Cloak Dome Bunny + [60190] = 1000, -- Invisibility + [60464] = 9, -- Cloaked Alliance Peeps + [70693] = 1000, -- Uther Despawn + [74980] = 1000, -- Spy Frog Invisibility + [75779] = 1000, -- [DND] Marker + [1221135] = 101, -- Torment's Illusion + }, + [8] = { + [34840] = 1000, -- Triangulation Point One Invisibility + [34858] = 2000, -- Triangulation Point Two Invisibility + [40194] = 1000, -- Bombing Run: Invisibility + [51113] = 500, -- Monte Muzzleshot's Invisibility (Mangal) + [51114] = 250, -- Monte Muzzleshot's Invisibility (Camp) + [54503] = 1000, -- Quest Invisibility 2 + [56058] = 100, -- Get the Key: Instructor Hroegar's Invisibility + [59660] = 999, -- Inside Cloak Dome Individual + [60191] = 1000, -- Invisibility + [60481] = 9, -- Cloaked Horde Peeps + [73973] = 1000, -- Poster Location Marker + [75433] = 100, -- Spawn Invisibility Aura (QZS 2) + }, + [9] = { + [39596] = 1000, -- Ethereum Relay + [39680] = 5000, -- Sai'kkal Invisibility + [42175] = 5000, -- Evidence Marker Invis + [52213] = 1000, -- Rainspeaker Treasures: Invisibility + [61208] = 300, -- Fjorn's Anvil - Quest Invisibility 3 + [74144] = 1000, -- Poster Location Marker + [74466] = 1000, -- Raging Fire Elemental Invisibility + [75165] = 1000, -- Spirit of the Tiger Aura + [75166] = 1000, -- Spirit of the Tiger Aura (Rider) + [75179] = 1000, -- Matriarch's Shroud + }, + [10] = { + [44856] = 100, -- Bash'ir Phasing Device + [45614] = 300, -- Shroud of the Scourge + [48809] = 48812, -- Binding Life + [49097] = 100, -- Out of Body Experience + [52215] = 1000, -- Kartak and Sparktouched: Invisibility + [75513] = 1000, -- Spawn Invisibility Aura (QZM) + [364459] = 1000, -- Shroud of Death + [426062] = 101, -- Quest Invisibility + [462593] = 101, -- Quest Invisibility + [468882] = 101, -- Quest Invisibility + }, + [28] = { + [425147] = 101, -- Quest Invisibility + }, + }, IsFeralForm = { [768] = true, -- Cat Form [5487] = true, -- Bear Form diff --git a/Modules/Data/Data.lua b/Modules/Data/Data.lua index 4d1f3fe1..cc9fe437 100755 --- a/Modules/Data/Data.lua +++ b/Modules/Data/Data.lua @@ -19,6 +19,7 @@ end dataFunctionRefs = { ["MovementSpeed"] = function() return Data:GetMovementSpeed() end, + ["Invisibility"] = function() return Data:GetInvisibility() end, -- Melee ["MeleeAttackPower"] = function() return Data:GetMeleeAttackPower() end, ["MeleeCritChance"] = function() return Data:MeleeCrit() end, diff --git a/Modules/Data/General.lua b/Modules/Data/General.lua index d8c8f7e2..c130d438 100644 --- a/Modules/Data/General.lua +++ b/Modules/Data/General.lua @@ -1,3 +1,7 @@ +local GetBuffDataByIndex = C_UnitAuras.GetBuffDataByIndex +local GetDebuffDataByIndex = C_UnitAuras.GetDebuffDataByIndex +local pairs = pairs + ---@class Data local Data = ECSLoader:ImportModule("Data") ---@type DataUtils @@ -20,4 +24,35 @@ function Data:GetMovementSpeed() currentSpeed = currentSpeed / 7 * 100 return DataUtils:Round(currentSpeed, 0) .. "%" +end + +---@return number +function Data:GetInvisibility() + local inv = 0 + + -- buffs + local i = 1 + repeat + local aura = GetBuffDataByIndex("player", i) + if aura and aura.spellId then + for invisibilityType, Id in pairs(Data.Aura.Invisibility) do + inv = inv + (Id[aura.spellId] or 0) + end + end + i = i + 1 + until (not aura) + + -- debuffs + i = 1 + repeat + local aura = GetDebuffDataByIndex("player", i) + if aura and aura.spellId then + for invisibilityType, Id in pairs(Data.Aura.Invisibility) do + inv = inv + (Id[aura.spellId] or 0) + end + end + i = i + 1 + until (not aura) + + return DataUtils:Round(inv, 2) end \ No newline at end of file diff --git a/Modules/Migration.lua b/Modules/Migration.lua index 0f1bf19b..cfed226e 100644 --- a/Modules/Migration.lua +++ b/Modules/Migration.lua @@ -15,6 +15,8 @@ function Migration:ToLatestProfileVersion(profileVersion) return end + local defaultProfile = Profile:GetDefaultProfile() + if profileVersion < 24 then ExtendedCharacterStats.profile.defense.resilienceRating = ExtendedCharacterStats.profile.defense.resilience ExtendedCharacterStats.profile.defense.resilience = nil @@ -22,4 +24,7 @@ function Migration:ToLatestProfileVersion(profileVersion) if profileVersion < 25 then ExtendedCharacterStats.profile.defense.resilience = nil end -end + if profileVersion < 26 then + ExtendedCharacterStats.profile.general.invisibility = defaultProfile.profile.general.invisibility + end +end \ No newline at end of file diff --git a/Modules/Profile.lua b/Modules/Profile.lua index 2a2152fe..587f916e 100755 --- a/Modules/Profile.lua +++ b/Modules/Profile.lua @@ -20,6 +20,11 @@ local function GetDefaultStatsProfile() text = "General", movementSpeed = {display = true, refName = "MovementSpeed", text = "Movement Speed"}, + invisibility = { + display = true, + refName = "Invisibility", + text = "Invisibility", + }, }, melee = { diff --git a/Modules/Stats.lua b/Modules/Stats.lua index acac2a0b..c6494345 100755 --- a/Modules/Stats.lua +++ b/Modules/Stats.lua @@ -210,7 +210,11 @@ _CreateStatInfos = function() local profile = ExtendedCharacterStats.profile local category = profile.general - _CreateStatInfo(category, category.movementSpeed) + _CreateStatInfo( + category, + category.movementSpeed, + category.invisibility + ) category = profile.melee _CreateStatInfo( diff --git a/Modules/i18n/translations/ConfigTranslations/GeneralConfigTranslations.lua b/Modules/i18n/translations/ConfigTranslations/GeneralConfigTranslations.lua index 88bb1158..c3a57fc4 100644 --- a/Modules/i18n/translations/ConfigTranslations/GeneralConfigTranslations.lua +++ b/Modules/i18n/translations/ConfigTranslations/GeneralConfigTranslations.lua @@ -42,6 +42,16 @@ local generalConfigTranslations = { ["esMX"] = "Muestra/oculta el valor de velocidad de movimiento", ["ptBR"] = "Mostra/oculta o valor da velocidade de movimento" }, + ["Shows/Hides the invisibility value."] = { + ["enUS"] = true, + ["deDE"] = false, + ["frFR"] = false, + ["zhCN"] = false, + ["ruRU"] = false, + ["esES"] = false, + ["esMX"] = false, + ["ptBR"] = false + }, } for k, v in pairs(generalConfigTranslations) do diff --git a/Modules/i18n/translations/StatTranslations.lua b/Modules/i18n/translations/StatTranslations.lua index 6bf9140e..a8dee7a1 100644 --- a/Modules/i18n/translations/StatTranslations.lua +++ b/Modules/i18n/translations/StatTranslations.lua @@ -812,6 +812,16 @@ local statTranslations = { ["esMX"] = "Fallo de las sombras (Niv. + 3)", ["ptBR"] = "Erro de sombra (Nív. + 3)" }, + ["Invisibility"] = { + ["enUS"] = true, + ["deDE"] = false, + ["frFR"] = false, + ["zhCN"] = false, + ["ruRU"] = false, + ["esES"] = false, + ["esMX"] = false, + ["ptBR"] = false + }, } for k, v in pairs(statTranslations) do From 10e06c47b651ef8062e9920eca7302d47bdae96c Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Mon, 2 Mar 2026 04:23:40 +0100 Subject: [PATCH 2/4] unused variable --- Modules/Data/General.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Data/General.lua b/Modules/Data/General.lua index c130d438..d75e3ffc 100644 --- a/Modules/Data/General.lua +++ b/Modules/Data/General.lua @@ -35,7 +35,7 @@ function Data:GetInvisibility() repeat local aura = GetBuffDataByIndex("player", i) if aura and aura.spellId then - for invisibilityType, Id in pairs(Data.Aura.Invisibility) do + for _, Id in pairs(Data.Aura.Invisibility) do inv = inv + (Id[aura.spellId] or 0) end end @@ -47,7 +47,7 @@ function Data:GetInvisibility() repeat local aura = GetDebuffDataByIndex("player", i) if aura and aura.spellId then - for invisibilityType, Id in pairs(Data.Aura.Invisibility) do + for _, Id in pairs(Data.Aura.Invisibility) do inv = inv + (Id[aura.spellId] or 0) end end From cbf8b26e05a2cc9be9f351715590ab70cc72b70f Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Mon, 2 Mar 2026 04:24:30 +0100 Subject: [PATCH 3/4] spaces --- Modules/Data/Constants.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Data/Constants.lua b/Modules/Data/Constants.lua index fb62be7d..a2f9f79a 100755 --- a/Modules/Data/Constants.lua +++ b/Modules/Data/Constants.lua @@ -220,7 +220,7 @@ Data.Aura = { [48809] = 48812, -- Binding Life [49097] = 100, -- Out of Body Experience [52215] = 1000, -- Kartak and Sparktouched: Invisibility - [75513] = 1000, -- Spawn Invisibility Aura (QZM) + [75513] = 1000, -- Spawn Invisibility Aura (QZM) [364459] = 1000, -- Shroud of Death [426062] = 101, -- Quest Invisibility [462593] = 101, -- Quest Invisibility From a12556c85b4c4fe864ede6263e11708b86ca2a8d Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Wed, 4 Mar 2026 04:30:53 +0100 Subject: [PATCH 4/4] wip --- Modules/Data/Constants.lua | 106 ++++++++++++++++++++++++++++++++++++- Modules/Data/General.lua | 98 ++++++++++++++++++++++++++++++++++ 2 files changed, 203 insertions(+), 1 deletion(-) diff --git a/Modules/Data/Constants.lua b/Modules/Data/Constants.lua index a2f9f79a..343ef07c 100755 --- a/Modules/Data/Constants.lua +++ b/Modules/Data/Constants.lua @@ -1,4 +1,5 @@ local IsClassic = ECS.IsClassic +local IsTBC = ECS.IsTBC local IsWotlk = ECS.IsWotlk ---@class Data @@ -23,6 +24,7 @@ Data.MAGE = 8 Data.WARLOCK = 9 Data.DRUID = 11 +--- auras with attributes "Passive spell" or "Aura is hidden" should not be listed here Data.Aura = { AllowCastingManaRegeneration = { [6117] = (ECS.IsWotlk and 0.5 or 0.3), -- Mage Armor rank 1 @@ -84,7 +86,6 @@ Data.Aura = { }, --- index 0 is for "Apply Aura: Invisibility" --- index n is for "Apply Aura: Invisibility (n)" - --- auras with attributes "Passive spell" or "Aura is hidden" aren't listed here Invisibility = { [0] = { [66] = IsClassic and 100 or nil, -- Lesser Invisibility @@ -263,6 +264,15 @@ Data.Aura = { [49280] = true, -- Lightning Shield rank 10 [49281] = true, -- Lightning Shield rank 11 }, + IsProwlOrStealth = { + [1784] = true, -- Stealth + [1785] = true, -- Stealth + [1786] = true, -- Stealth + [1787] = true, -- Stealth + [5215] = true, -- Prowl + [6783] = true, -- Prowl + [9913] = true, -- Prowl + }, MP5 = { [430] = 42, -- drink [431] = 104, -- drink @@ -573,6 +583,77 @@ Data.Aura = { [1227200] = 20, -- Wickedness [1236220] = -50, -- Slow }, + Stealth = { + [1784] = 5, -- Stealth + [1785] = 100, -- Stealth + [1786] = 200, -- Stealth + [1787] = 300, -- Stealth + [2425] = -100, -- Spotted + [3648] = 5, -- Phase Out + [5215] = 100, -- Prowl + [5916] = 1, -- Shadowstalker Stealth + [6408] = 1, -- Faded + [6538] = 140, -- Dig Trap + [6634] = (IsClassic and 6 or 300), -- Phasing Stealth + [6783] = 200, -- Prowl + [6920] = 100, -- Hide + [8152] = 5, -- Prowl + [8218] = 5, -- Sneak + [8822] = 9999, -- Stealth + [9736] = 180, -- Arantir's Deception + [9740] = 180, -- Arantir's Deception + [9913] = 300, -- Prowl + [10032] = 9999, -- Uber Stealth + [11327] = 170, -- Vanish + [11329] = 270, -- Vanish + [16122] = 99999, -- Phasing + [20540] = 5, -- Ashenvale Outrunner Sneak + [20580] = 50, -- Shadowmeld + [22766] = 1, -- Sneak + [24450] = 150, -- Prowl + [24452] = 200, -- Prowl + [24453] = 250, -- Prowl + [24690] = 1000, -- Aspect of Arlokk + [26381] = 10000, -- Burrow + [26888] = 370, -- Vanish + [29448] = 9999, -- Vanish + [30831] = 1, -- Stealth + [30991] = 1, -- Stealth + [31526] = 9999, -- Stealth + [31621] = 9999, -- Stealth + [32199] = 65, -- Stealth + [32615] = 1, -- Stealth + [34189] = -50, -- Stealth + [35205] = 9999, -- Vanish + [39581] = 10000, -- Storm Blink + [42347] = 1, -- Stealth + [42866] = 9999, -- Stealth + [42932] = 1, -- Prowl + [42943] = 9999, -- Stealth + [47521] = 9999, -- Mole Machine Player Hide and Root + [51755] = 600, -- Camouflage + [52006] = 5000, -- Shroud + [53061] = 1000, -- Cover + [58548] = 4200, -- Ethereal + [59045] = 300, -- Camoflogue + [61704] = 1, -- Sneaky Walk + [66296] = 350, -- Shadow Veil + [66305] = 300, -- Shadow Veil + [67340] = 100, -- Hide + [448471] = 101, -- Lledra's Vehicle Test [DNT] + [460631] = 251, -- (DNT) Pyranis Add Fog Stealth + [467049] = 301, -- Blessing of Bethekk + [469182] = 11, -- Lying Low + [473544] = 5, -- Sneaking + [1220930] = 10000, -- Phantom's Veil + [1221341] = 6, -- Poorly Camouflaged + [1231389] = 10000, -- Vanish + }, + StealthEffectiveness = { + [28492] = 30, -- Sneaking + [38552] = 8, -- Improved Stealth + [1220708] = 8, -- Displaced + }, } Data.Enchant = { BlockValue = { @@ -609,6 +690,10 @@ Data.Enchant = { [3836] = 8, -- Master's Inscription of the Crag [7099] = 12, -- Blackfathom Mana Oil. This effect only applies within Blackfathom Deeps. }, + StealthEffectiveness = { + [910] = 5, -- Enchant Cloak - Stealth + [3256] = 5, -- Enchant Cloak - Shadow Armor + }, } Data.Gem = { MP5 = { @@ -929,6 +1014,25 @@ Data.Item = { [242315] = 3, [242317] = 3, }, + StealthEffectiveness = { + [8197] = 5, -- Nightscape Boots + [20255] = 5, -- Whisperwalk Boots + [21758] = 3, -- Figurine - Black Pearl Panther + [22003] = 8, -- Darkmantle Boots + [23073] = 8, -- Boots of Displacement + [24128] = (IsTBC and 5 or nil), -- Figurine - Nightseye Panther + [27467] = 5, -- Silent-Strider Kneeboots + [31228] = 5, -- The Master's Treads + [35702] = (IsTBC and 5 or nil), -- Figurine - Shadowsong Panther + [213341] = 5, -- Insulated Workboots + [219343] = 3, -- Filcher's Cowl + [220860] = 5, -- Sergeant Major's Leather Boots + [220861] = 5, -- First Sergeant's Leather Boots + [221409] = 5, -- Emerald Leather Sabatons + [226831] = 8, -- Darkmantle Footpads + [226851] = 8, -- Darkmantle Boots + [236314] = 8, -- Boots of Displacement + }, TimewornSpellHaste = { [234016] = 2, [234020] = 2, diff --git a/Modules/Data/General.lua b/Modules/Data/General.lua index d75e3ffc..355973a6 100644 --- a/Modules/Data/General.lua +++ b/Modules/Data/General.lua @@ -1,12 +1,18 @@ local GetBuffDataByIndex = C_UnitAuras.GetBuffDataByIndex local GetDebuffDataByIndex = C_UnitAuras.GetDebuffDataByIndex +local IsWotlk = ECS.IsWotlk +local max = math.max local pairs = pairs +local playerLevel = UnitLevel("player") +local UnitClass = UnitClass +local GetInventoryItemID = GetInventoryItemID ---@class Data local Data = ECSLoader:ImportModule("Data") ---@type DataUtils local DataUtils = ECSLoader:ImportModule("DataUtils") +local _, _, classId = UnitClass("player") ---@return string function Data:GetMovementSpeed() @@ -55,4 +61,96 @@ function Data:GetInvisibility() until (not aura) return DataUtils:Round(inv, 2) +end + +---@return number +function Data:GetStealth() + local stealth = 0 + local prowlOrStealth = false + + for i = 1, 18 do + local id, _ = GetInventoryItemID("player", i) + stealth = stealth + (Data.Item.StealthEffectiveness[id] or 0) + local itemLink = GetInventoryItemLink("player", i) + if itemLink then + local enchant = DataUtils:GetEnchantFromItemLink(itemLink) + if enchant then + stealth = stealth + (Data.Enchant.StealthEffectiveness[enchant] or 0) + end + end + end + + -- buffs + local i = 1 + repeat + local aura = GetBuffDataByIndex("player", i) + if aura and aura.spellId then + if classId == Data.ROGUE or classId == Data.DRUID then + -- check if character is prowling or stealthing + prowlOrStealth = prowlOrStealth or Data.Aura.IsProwlOrStealth[aura.spellId] + end + stealth = max(stealth, (Data.Aura.Stealth[aura.spellId] or 0)) + if aura.spellId == 58984 then -- Shadowmeld + stealth = max(stealth, playerLevel * 5) + end + end + i = i + 1 + until (not aura) + + -- debuffs + i = 1 + repeat + local aura = GetDebuffDataByIndex("player", i) + if aura and aura.spellId then + stealth = max(stealth, (Data.Aura.Stealth[aura.spellId] or 0)) + end + i = i + 1 + until (not aura) + + -- wotlk stealth/prowl stealth level is dependent on level + if prowlOrStealth and IsWotlk then + stealth = max(stealth, playerLevel * 5) + end + + return stealth +end + +---@return number +function Data:GetModStealthEffectiveness() + local stealth = 0 + local prowlOrStealth = false + local hasShadowmeldBonus = false + + -- buffs + local i = 1 + repeat + local aura = GetBuffDataByIndex("player", i) + if aura and aura.spellId then + if classId == Data.ROGUE or classId == Data.DRUID then + -- check if character is prowling or stealthing + hasShadowmeldBonus = hasShadowmeldBonus or Data.Aura.IsProwlOrStealth[aura.spellId] + end + stealth = stealth + (Data.Aura.StealthEffectiveness[aura.spellId] or 0) + if aura.spellId == 58984 then -- Shadowmeld + hasShadowmeldBonus = true + end + end + i = i + 1 + until (not aura) + + -- debuffs + i = 1 + repeat + local aura = GetDebuffDataByIndex("player", i) + if aura and aura.spellId then + stealth = stealth + (Data.Aura.StealthEffectiveness[aura.spellId] or 0) + end + i = i + 1 + until (not aura) + + if hasShadowmeldBonus and IsPlayerSpell(21009) then + stealth = stealth + 5 -- Shadowmeld passive / elusiveness + end + + return stealth end \ No newline at end of file