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..a2f9f79a 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..d75e3ffc 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 _, 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 _, 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