|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 |
local questItemList = {} for questIndex = 1, MAX_JOURNAL_QUESTS do if questItemId ~= 0 then end end if questItemId ~= 0 then end end end end end return questItemListend----[[ Text Search Manager ]]---- end EVENT_MANAGER:RegisterForEvent("ZO_TextSearchManager", EVENT_BACKGROUND_LIST_FILTER_COMPLETE, OnTextSearchFilterComplete)end -- Very broad searches have bad performance implications: The search itself is asynchronous (and snappy), but updating UI to reflect the search is notend--[[ Expected format for filterTargetDescriptors: filterTargetDescriptors = { [<FilterTarget>] = { searchFilterList = { BACKGROUND_LIST_FILTER_TYPE_<FilterType>, ... }, primaryKeys = { <List of keys> (ie. BAG_BACKPACK, BAG_BANK for FILTER_TARGET_BAG_SLOT or filterFunction() for filter like slottable in FILTER_TARGET_COLLECTIBLE) }, }, } This function will also override the filter target descriptors for a context that already exists.]]-- if not contextSearch then contextSearch = {} end contextSearch.filterTargetDescriptors = filterTargetDescriptors contextSearch.isDirty = true contextSearch.isActive = false contextSearch.searchText = "" contextSearch.inProgressSearchTasks = {} contextSearch.searchResults = {}end if context == nil then return end if contextSearch.isActive and currentContext ~= context then internalassert(false, string.format("Activating text search %s, but text search %s is already active, there should only ever be one context search active at a time!", context, currentContext)) end end return true else return false endend return true else return false endendend if contextSearch then return contextSearch.filterTargetDescriptors[filterTarget] ~= nil end return falseendendend if contextSearch then searchText = searchText or "" if contextSearch.searchText ~= searchText then contextSearch.searchText = searchText contextSearch.isDirty = true end end endendfunction ZO_TextSearchManager:MarkDirtyByFilterTargetAndPrimaryKey(filterTarget, primaryKey, shouldSuppressSearchUpdate) local filterTargetData = contextSearch.filterTargetDescriptors[filterTarget] if filterTargetData then end if key == primaryKey then contextSearch.isDirty = true break end end end endend local filterTargetData = contextSearch.filterTargetDescriptors[filterTarget] if filterTargetData then contextSearch.isDirty = true end endend if not contextSearch then return false end return contextSearch.isDirtyend if not contextSearch then return end if not shouldSuppressSearchUpdate then else end endendend endend if not contextSearch then return end --Cancel any in progress filtering so we can do a new one end --If we have filter text then create the tasks end contextSearch.inProgressSearchTasks[filterTarget] = searchTaskId end if filterTarget == BACKGROUND_LIST_FILTER_TARGET_BAG_SLOT then -- Filter Target is a Bag Slot Filter, primary key is a bagId end elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_ITEM_SET_ID then -- Filter Target is a Quest Item Filter, primary key is a questItemId elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_QUEST_ITEM_ID then -- Filter Target is a Quest Item Filter, primary key is a questItemId elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_COLLECTIBLE_ID then -- Filter Target is a Collections Filter, primary key is a collectibleId elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_MARKET_PRODUCT_ID then -- Filter Target is a Market Product Filter, primary key is a marketProductId elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_FURNITURE_ID then -- Filter Target is a Furniture Filter, primary key is a furnitureId elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_HELP_ID then -- Filter Target is a Help Filter, primary key is a HelpId elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_TRIBUTE_PATRON_ID then -- Filter Target is a Collections Filter, primary key is a tributePatronId elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_CRAFTED_ABILITY_ID then -- Filter Target is a Crafted Ability Filter, primary key is a craftedAbilityId elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_CRAFTED_ABILITY_COMBINATION then -- Filter Target is a Crafted Ability Combination Filter, primary key is craftedAbilityId, scripts follow elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_CRAFTED_ABILITY_SCRIPT_ID then -- Filter Target is a Crafted Ability Script Filter, primary key is a craftedAbilityScriptId, second param is associated craftedAbilityId end end end end else contextSearch.isDirty = false endend if searchTaskId == taskId then return context, filterTarget end end end return nilend if contextSearch then --Mark that it was completed. contextSearch.inProgressSearchTasks[filterTarget] = nil local searchResults = contextSearch.searchResults[filterTarget] if not searchResults then searchResults = {} contextSearch.searchResults[filterTarget] = searchResults end local primaryKey, secondaryKey, tertiaryKey, quaternaryKey = GetBackgroundListFilterResult(taskId, filterResultIndex) if filterTarget == BACKGROUND_LIST_FILTER_TARGET_BAG_SLOT then if not searchResults[primaryKey] then searchResults[primaryKey] = {} end searchResults[primaryKey][secondaryKey] = true elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_ITEM_SET_ID then searchResults[primaryKey] = true elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_QUEST_ITEM_ID then searchResults[primaryKey] = true elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_COLLECTIBLE_ID then searchResults[primaryKey] = true elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_MARKET_PRODUCT_ID then searchResults[primaryKey] = true elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_FURNITURE_ID then searchResults[furnitureIdKey] = true elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_HELP_ID then searchResults[primaryKey] = true elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_TRIBUTE_PATRON_ID then searchResults[primaryKey] = true elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_CRAFTED_ABILITY_ID then searchResults[primaryKey] = true elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_CRAFTED_ABILITY_COMBINATION then local primaryResult = searchResults[primaryKey] if not primaryResult then primaryResult = {} searchResults[primaryKey] = primaryResult end local secondaryResult = primaryResult[secondaryKey] if not secondaryResult then secondaryResult = {} primaryResult[secondaryKey] = secondaryResult end local tertiaryResult = secondaryResult[tertiaryKey] if not tertiaryResult then tertiaryResult = {} secondaryResult[tertiaryKey] = tertiaryResult end tertiaryResult[quaternaryKey] = true elseif filterTarget == BACKGROUND_LIST_FILTER_TARGET_CRAFTED_ABILITY_SCRIPT_ID then searchResults[primaryKey] = true end end contextSearch.isDirty = false end endendfunction ZO_TextSearchManager:IsDataInSearchTextResults(context, filterTarget, primaryKey, secondaryKey) return true end local searchResults = contextSearch.searchResults[filterTarget] if searchResults then local tertiaryKey = nil local quaternaryKey = nil local keys = primaryKey end if primaryKey then local primaryResult = searchResults[primaryKey] if secondaryKey then local secondaryResult = primaryResult and primaryResult[secondaryKey] if tertiaryKey then local tertiaryResult = secondaryResult and secondaryResult[tertiaryKey] if quaternaryKey then return tertiaryResult and tertiaryResult[quaternaryKey] end return tertiaryResult end return secondaryResult end return primaryResult end end return falseend |