comparison LFGFilter.lua @ 12:64c9517efa88

convert local boss name lookups to GetLFGDungeonEncounterInfo
author ovolkov
date Tue, 03 Feb 2015 11:15:14 +0300
parents bd476e399376
children b9af92090f5e
comparison
equal deleted inserted replaced
11:bd476e399376 12:64c9517efa88
33 -- EJ_SelectInstance(477) 33 -- EJ_SelectInstance(477)
34 -- EJ_GetEncounterInfoByIndex(4) 34 -- EJ_GetEncounterInfoByIndex(4)
35 35
36 local token_to_encounter_id = { 36 local token_to_encounter_id = {
37 highmaul = { 37 highmaul = {
38 ej_instance = 477, 38 lfg_dungeon_id = 849,
39 [1128] = { "kargath", "bladefist", "kargath_bladefist" }, 39 { "kargath", "bladefist", "kargath_bladefist" },
40 [971] = { "butcher", "the_butcher" }, 40 { "butcher", "the_butcher" },
41 [1195] = { "tectus" }, 41 { "tectus" },
42 [1196] = { "brackenspore", "bracken" }, 42 { "brackenspore", "bracken" },
43 [1148] = { "twin_orgon", "twins" }, 43 { "twin_orgon", "twins" },
44 [1153] = { "koragh", "breaker" }, 44 { "koragh", "breaker" },
45 [1197] = { "imperator", "margok" }, 45 { "imperator", "margok" },
46 } 46 }
47 } 47 }
48 48
49 function LFGListSearchPanel_DoSearch(self) 49 function LFGListSearchPanel_DoSearch(self)
50 local searchText = self.SearchBox:GetText(); 50 local searchText = self.SearchBox:GetText();
62 self.selectedResult = nil; 62 self.selectedResult = nil;
63 LFGListSearchPanel_UpdateResultList(self); 63 LFGListSearchPanel_UpdateResultList(self);
64 LFGListSearchPanel_UpdateResults(self); 64 LFGListSearchPanel_UpdateResults(self);
65 end 65 end
66 66
67 local localized_encounter_name_to_id = {} 67 local localized_encounter_name_to_idx = {}
68 68
69 local function InsertEncounterStateAliases(result_env, raid_token, completed_encounters) 69 local function InsertEncounterStateAliases(result_env, raid_token, completed_encounters)
70 local encounter_aliases = token_to_encounter_id[raid_token] 70 local encounter_aliases = token_to_encounter_id[raid_token]
71 if not encounter_aliases then return end 71 if not encounter_aliases then return end
72 72
73 local ej_instance = encounter_aliases.ej_instance 73 local lfg_dungeon_id = encounter_aliases.lfg_dungeon_id
74 local encounter_names = localized_encounter_name_to_id[ej_instance] 74 local encounter_names = localized_encounter_name_to_idx[lfg_dungeon_id]
75 if not encounter_names then 75 if not encounter_names then
76 encounter_names = {} 76 encounter_names = {}
77 EJ_SelectInstance(ej_instance) 77 for idx = 1, GetLFGDungeonNumEncounters(lfg_dungeon_id) do
78 local encounter_idx = 1 78 local bossName, texture, isKilled = GetLFGDungeonEncounterInfo(lfg_dungeon_id, idx)
79 local encounter_name, encounter_id, root_section_id, _ 79 encounter_names[bossName] = idx
80 repeat 80 end
81 encounter_name, _, encounter_id, root_section_id = EJ_GetEncounterInfoByIndex(encounter_idx) 81 localized_encounter_name_to_idx[lfg_dungeon_id] = encounter_names
82 if encounter_name then
83 encounter_names[encounter_name] = encounter_id
84 local next_section_id = root_section_id
85 repeat
86 local title, description, headerType, abilityIcon, displayInfo, siblingID, _, fileredByDifficulty, link, startsOpen, flag1, flag2, flag3, flag4 = EJ_GetSectionInfo(next_section_id)
87 if displayInfo ~= 0 then
88 if not encounter_names[title] then encounter_names[title] = encounter_id end
89 end
90 next_section_id = siblingID
91 until not next_section_id
92 encounter_idx = encounter_idx + 1
93 end
94 until not encounter_name
95 localized_encounter_name_to_id[ej_instance] = encounter_names
96 end 82 end
97 83
98 for idx = 1, #completed_encounters do 84 for idx = 1, #completed_encounters do
99 local encounter_id = encounter_names[completed_encounters[idx]] 85 local encounter_id = encounter_names[completed_encounters[idx]]
100 if encounter_id then 86 if encounter_id then
240 next_section_id = siblingID 226 next_section_id = siblingID
241 until not next_section_id 227 until not next_section_id
242 encounter_idx = encounter_idx + 1 228 encounter_idx = encounter_idx + 1
243 end 229 end
244 until not encounter_name 230 until not encounter_name
245 localized_encounter_name_to_id[ej_instance] = encounter_names 231 localized_encounter_name_to_idx[ej_instance] = encounter_names
246 end 232 end