Mercurial > wow > lfg-premade-filter
comparison LFGFilter.lua @ 11:bd476e399376
individual boss information for Highmaul, EJ detection version
author | ovolkov |
---|---|
date | Tue, 03 Feb 2015 10:26:29 +0300 |
parents | 627bb3803132 |
children | 64c9517efa88 |
comparison
equal
deleted
inserted
replaced
10:627bb3803132 | 11:bd476e399376 |
---|---|
1 local dump = DevTools_Dump | 1 local dump = DevTools_Dump |
2 | |
3 LFGListFrame.SearchPanel.SearchBox:SetMaxLetters(2048) | 2 LFGListFrame.SearchPanel.SearchBox:SetMaxLetters(2048) |
4 | 3 |
5 local filter_expression_functions = setmetatable({}, { | 4 local filter_expression_functions = setmetatable({}, { |
6 __mode = "k", | 5 __mode = "k", |
7 __index = function(t, key) | 6 __index = function(t, key) |
28 for idx = 1, MAX_CLASSES do | 27 for idx = 1, MAX_CLASSES do |
29 local class_lc = CLASS_SORT_ORDER[idx]:lower() | 28 local class_lc = CLASS_SORT_ORDER[idx]:lower() |
30 aliases[class_lc .. "s"] = class_lc | 29 aliases[class_lc .. "s"] = class_lc |
31 end | 30 end |
32 | 31 |
32 -- EJ_GetCurrentInstance() | |
33 -- EJ_SelectInstance(477) | |
34 -- EJ_GetEncounterInfoByIndex(4) | |
35 | |
36 local token_to_encounter_id = { | |
37 highmaul = { | |
38 ej_instance = 477, | |
39 [1128] = { "kargath", "bladefist", "kargath_bladefist" }, | |
40 [971] = { "butcher", "the_butcher" }, | |
41 [1195] = { "tectus" }, | |
42 [1196] = { "brackenspore", "bracken" }, | |
43 [1148] = { "twin_orgon", "twins" }, | |
44 [1153] = { "koragh", "breaker" }, | |
45 [1197] = { "imperator", "margok" }, | |
46 } | |
47 } | |
48 | |
33 function LFGListSearchPanel_DoSearch(self) | 49 function LFGListSearchPanel_DoSearch(self) |
34 local searchText = self.SearchBox:GetText(); | 50 local searchText = self.SearchBox:GetText(); |
35 local real_search, filter_expression = searchText:match("^([^=]-)=(.+)$") | 51 local real_search, filter_expression = searchText:match("^([^=]-)=(.+)$") |
36 if filter_expression then | 52 if filter_expression then |
37 filter_expression = filter_expression:lower() | 53 filter_expression = filter_expression:lower() |
44 self.searching = true; | 60 self.searching = true; |
45 self.searchFailed = false; | 61 self.searchFailed = false; |
46 self.selectedResult = nil; | 62 self.selectedResult = nil; |
47 LFGListSearchPanel_UpdateResultList(self); | 63 LFGListSearchPanel_UpdateResultList(self); |
48 LFGListSearchPanel_UpdateResults(self); | 64 LFGListSearchPanel_UpdateResults(self); |
65 end | |
66 | |
67 local localized_encounter_name_to_id = {} | |
68 | |
69 local function InsertEncounterStateAliases(result_env, raid_token, completed_encounters) | |
70 local encounter_aliases = token_to_encounter_id[raid_token] | |
71 if not encounter_aliases then return end | |
72 | |
73 local ej_instance = encounter_aliases.ej_instance | |
74 local encounter_names = localized_encounter_name_to_id[ej_instance] | |
75 if not encounter_names then | |
76 encounter_names = {} | |
77 EJ_SelectInstance(ej_instance) | |
78 local encounter_idx = 1 | |
79 local encounter_name, encounter_id, root_section_id, _ | |
80 repeat | |
81 encounter_name, _, encounter_id, root_section_id = EJ_GetEncounterInfoByIndex(encounter_idx) | |
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 | |
97 | |
98 for idx = 1, #completed_encounters do | |
99 local encounter_id = encounter_names[completed_encounters[idx]] | |
100 if encounter_id then | |
101 local aliases = encounter_aliases[encounter_id] | |
102 if aliases then | |
103 for alias_idx = 1, #aliases do | |
104 result_env[aliases[alias_idx]] = true | |
105 end | |
106 end | |
107 end | |
108 end | |
49 end | 109 end |
50 | 110 |
51 local result_env = {} | 111 local result_env = {} |
52 -- =highmaul and ((normal and (name:match("imp") or defeated == 6)) or (heroic and defeated == 2)) | 112 -- =highmaul and ((normal and (name:match("imp") or defeated == 6)) or (heroic and defeated == 2)) |
53 function LFGListUtil_SortSearchResults(results) | 113 function LFGListUtil_SortSearchResults(results) |
84 local class_lc = CLASS_SORT_ORDER[idx]:lower() | 144 local class_lc = CLASS_SORT_ORDER[idx]:lower() |
85 local count = result_env[class_lc] | 145 local count = result_env[class_lc] |
86 if not count then result_env[class_lc] = 0 end | 146 if not count then result_env[class_lc] = 0 end |
87 end | 147 end |
88 | 148 |
149 local raid_token | |
89 if activityID == 37 then | 150 if activityID == 37 then |
90 result_env.highmaul = true | 151 raid_token = "highmaul" |
91 result_env.normal = true | 152 result_env.normal = true |
92 elseif activityID == 38 then | 153 elseif activityID == 38 then |
93 result_env.highmaul = true | 154 raid_token = "highmaul" |
94 result_env.heroic = true | 155 result_env.heroic = true |
95 end | 156 |
96 | 157 end |
97 -- dump(result_env) | 158 |
159 result_env[raid_token] = true | |
160 if completedEncounters then InsertEncounterStateAliases(result_env, raid_token, completedEncounters) end | |
161 | |
162 result_env.dead = true | |
163 result_env.defeated = true | |
164 | |
165 -- dump(result_env) | |
98 | 166 |
99 for alias, original in pairs(aliases) do result_env[alias] = result_env[original] end | 167 for alias, original in pairs(aliases) do result_env[alias] = result_env[original] end |
100 | 168 |
101 -- dump(result_env) | 169 -- dump(result_env) |
102 | 170 |
152 for idx = 1, totalResults do | 220 for idx = 1, totalResults do |
153 local id1, activityID1, name1, comment1, voiceChat1, iLvl1, age1, numBNetFriends1, numCharFriends1, numGuildMates1, isDelisted1 = C_LFGList.GetSearchResultInfo(results[idx]) | 221 local id1, activityID1, name1, comment1, voiceChat1, iLvl1, age1, numBNetFriends1, numCharFriends1, numGuildMates1, isDelisted1 = C_LFGList.GetSearchResultInfo(results[idx]) |
154 print(id1, activityID1, C_LFGList.GetActivityInfo(activityID1), '*', name1) | 222 print(id1, activityID1, C_LFGList.GetActivityInfo(activityID1), '*', name1) |
155 end | 223 end |
156 end | 224 end |
225 | |
226 function LFGPrintInstanceScan(ej_instance) | |
227 EJ_SelectInstance(ej_instance) | |
228 local encounter_idx = 1 | |
229 local encounter_name, encounter_id, root_section_id, _ | |
230 repeat | |
231 encounter_name, _, encounter_id, root_section_id = EJ_GetEncounterInfoByIndex(encounter_idx) | |
232 if encounter_name then | |
233 print(encounter_id, encounter_name) | |
234 local next_section_id = root_section_id | |
235 repeat | |
236 local title, description, headerType, abilityIcon, displayInfo, siblingID, _, fileredByDifficulty, link, startsOpen, flag1, flag2, flag3, flag4 = EJ_GetSectionInfo(next_section_id) | |
237 if displayInfo ~= 0 then | |
238 print(encounter_id, title) | |
239 end | |
240 next_section_id = siblingID | |
241 until not next_section_id | |
242 encounter_idx = encounter_idx + 1 | |
243 end | |
244 until not encounter_name | |
245 localized_encounter_name_to_id[ej_instance] = encounter_names | |
246 end |