changeset 12:64c9517efa88

convert local boss name lookups to GetLFGDungeonEncounterInfo
author ovolkov
date Tue, 03 Feb 2015 11:15:14 +0300
parents bd476e399376
children b9af92090f5e
files LFGFilter.lua
diffstat 1 files changed, 17 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/LFGFilter.lua	Tue Feb 03 10:26:29 2015 +0300
+++ b/LFGFilter.lua	Tue Feb 03 11:15:14 2015 +0300
@@ -35,14 +35,14 @@
 
 local token_to_encounter_id = {
    highmaul = {
-      ej_instance = 477,
-      [1128] = { "kargath", "bladefist", "kargath_bladefist" },
-      [971]  = { "butcher", "the_butcher" },
-      [1195] = { "tectus" },
-      [1196] = { "brackenspore", "bracken" },
-      [1148] = { "twin_orgon", "twins" },
-      [1153] = { "koragh", "breaker" },
-      [1197] = { "imperator", "margok" },
+      lfg_dungeon_id = 849,
+      { "kargath", "bladefist", "kargath_bladefist" },
+      { "butcher", "the_butcher" },
+      { "tectus" },
+      { "brackenspore", "bracken" },
+      { "twin_orgon", "twins" },
+      { "koragh", "breaker" },
+      { "imperator", "margok" },
    }
 }
 
@@ -64,35 +64,21 @@
    LFGListSearchPanel_UpdateResults(self);
 end
 
-local localized_encounter_name_to_id = {}
+local localized_encounter_name_to_idx = {}
 
 local function InsertEncounterStateAliases(result_env, raid_token, completed_encounters)
    local encounter_aliases = token_to_encounter_id[raid_token]
    if not encounter_aliases then return end
 
-   local ej_instance = encounter_aliases.ej_instance
-   local encounter_names = localized_encounter_name_to_id[ej_instance]
+   local lfg_dungeon_id = encounter_aliases.lfg_dungeon_id
+   local encounter_names = localized_encounter_name_to_idx[lfg_dungeon_id]
    if not encounter_names then
       encounter_names = {}
-      EJ_SelectInstance(ej_instance)
-      local encounter_idx = 1
-      local encounter_name, encounter_id, root_section_id, _
-      repeat
-         encounter_name, _, encounter_id, root_section_id = EJ_GetEncounterInfoByIndex(encounter_idx)
-         if encounter_name then
-            encounter_names[encounter_name] = encounter_id
-            local next_section_id = root_section_id
-            repeat
-               local title, description, headerType, abilityIcon, displayInfo, siblingID, _, fileredByDifficulty, link, startsOpen, flag1, flag2, flag3, flag4 = EJ_GetSectionInfo(next_section_id)
-               if displayInfo ~= 0 then
-                  if not encounter_names[title] then encounter_names[title] = encounter_id end
-               end
-               next_section_id = siblingID
-            until not next_section_id
-            encounter_idx = encounter_idx + 1
-         end
-      until not encounter_name
-      localized_encounter_name_to_id[ej_instance] = encounter_names
+      for idx = 1, GetLFGDungeonNumEncounters(lfg_dungeon_id) do
+         local bossName, texture, isKilled = GetLFGDungeonEncounterInfo(lfg_dungeon_id, idx)
+         encounter_names[bossName] = idx
+      end
+      localized_encounter_name_to_idx[lfg_dungeon_id] = encounter_names
    end
 
    for idx = 1, #completed_encounters do
@@ -242,5 +228,5 @@
          encounter_idx = encounter_idx + 1
       end
    until not encounter_name
-   localized_encounter_name_to_id[ej_instance] = encounter_names
+   localized_encounter_name_to_idx[ej_instance] = encounter_names
 end