From 0d7187c80be2ffe262ba2a99a0ad24229b119714 Mon Sep 17 00:00:00 2001 From: Bunny67 Date: Tue, 9 Jun 2020 17:56:01 +0300 Subject: [PATCH] correct GetInstanceTypeAndSize --- WeakAuras/Types.lua | 81 ----------------------------------------- WeakAuras/WeakAuras.lua | 28 +++++++++++--- 2 files changed, 22 insertions(+), 87 deletions(-) diff --git a/WeakAuras/Types.lua b/WeakAuras/Types.lua index f0917b0..01fe762 100644 --- a/WeakAuras/Types.lua +++ b/WeakAuras/Types.lua @@ -1273,7 +1273,6 @@ WeakAuras.instance_types = { none = L["No Instance"], party = L["5 Man Dungeon"], ten = L["10 Man Raid"], - twenty = L["20 Man Raid"], twentyfive = L["25 Man Raid"], fortyman = L["40 Man Raid"], pvp = L["Battleground"], @@ -1950,86 +1949,6 @@ WeakAuras.group_option_types = { array = L["Array"], } -WeakAuras.difficulty_info = { - [1] = { - size = "party", - difficulty = "normal", - }, - [2] = { - size = "party", - difficulty = "heroic", - }, - [3] = { - size = "ten", - difficulty = "normal", - }, - [4] = { - size = "twentyfive", - difficulty = "normal", - }, - [5] = { - size = "ten", - difficulty = "heroic", - }, - [6] = { - size = "twentyfive", - difficulty = "heroic", - }, - [7] = { - size = "twentyfive", - difficulty = "lfr", - }, - [8] = { - size = "party", - difficulty = "challenge", - }, - [9] = { - size = "fortyman", - difficulty = "normal", - }, - [11] = { - size = "scenario", - difficulty = "heroic", - }, - [12] = { - size = "scenario", - difficulty = "normal", - }, - -- 13 is unused - [14] = { - size = "flexible", - difficulty = "normal", - }, - [15] = { - size = "flexible", - difficulty = "heroic", - }, - [16] = { - size = "twenty", - difficulty = "mythic", - }, - [17] = { - size = "flexible", - difficulty = "lfr", - }, - [23] = { - size = "party", - difficulty = "mythic", - }, - [24] = { - size = "party", - difficulty = "timewalking", - }, - [33] = { - size = "flexible", - difficulty = "timewalking", - }, - [148] = { - size = "twenty", - difficulty = "normal", - }, -} - WeakAuras.glow_types = { ACShine = L["Autocast Shine"], Pixel = L["Pixel Glow"], diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index b727e5c..303915a 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -1946,16 +1946,32 @@ end local function GetInstanceTypeAndSize() local size, difficulty local inInstance, Type = IsInInstance() - local _, instanceType, difficultyIndex = GetInstanceInfo() + local _, instanceType, difficultyIndex, _, maxPlayers, playerDifficulty, isDynamicInstance = GetInstanceInfo() if (inInstance) then local ZoneMapID = GetCurrentMapAreaID() size = Type - if Type ~= "pvp" and Type ~= "arena" then - local difficultyInfo = WeakAuras.difficulty_info[difficultyIndex] - if difficultyInfo then - size, difficulty = difficultyInfo.size, difficultyInfo.difficulty + if Type == "raid" then + if maxPlayers == 10 then + size = "ten" + elseif maxPlayers == 25 then + size = "twentyfive" + elseif maxPlayers == 40 then + size = "fortyman" end - end + end + if isDynamic then + if playerDifficulty == 0 then + difficulty = "normal" + elseif playerDifficulty == 1 then + difficulty = "heroic" + end + else + if difficultyIndex == 1 or difficultyIndex == 2 then + difficulty = "normal" + elseif difficultyIndex == 3 or difficultyIndex == 4 then + difficulty = "heroic" + end + end return size, difficulty, instanceType, ZoneMapID end return "none", "none", nil, nil