2021-07-19 19:50:51 +00:00
|
|
|
const getQueryIdentifiers = (function() {
|
|
|
|
let identCache = null;
|
|
|
|
return function() {
|
|
|
|
if (identCache === null) {
|
|
|
|
const idents = new Set();
|
|
|
|
for (const ident of Object.keys(itemQueryProps)) {
|
|
|
|
idents.add(ident);
|
|
|
|
}
|
2023-01-31 02:55:25 +00:00
|
|
|
for (const ident of Object.keys(queryFuncs)) {
|
2021-07-19 19:50:51 +00:00
|
|
|
idents.add(ident);
|
|
|
|
}
|
|
|
|
identCache = [...idents].sort(); // might use a trie optimally, but the set is probably small enough...
|
|
|
|
}
|
|
|
|
return identCache;
|
|
|
|
};
|
|
|
|
})();
|
|
|
|
|
2023-01-31 02:55:25 +00:00
|
|
|
function generateEntries(size, itemList, itemEntries) {
|
|
|
|
for (let i = 0; i < size; i++) {
|
2021-01-30 15:36:04 +00:00
|
|
|
const itemElem = document.createElement('div');
|
2022-05-13 04:00:16 +00:00
|
|
|
itemElem.classList.add('col-lg-3', 'col-sm-auto', "p-2");
|
|
|
|
// itemElem.setAttribute('id', `item-entry-${i}`);
|
2021-01-30 15:36:04 +00:00
|
|
|
itemList.append(itemElem);
|
|
|
|
itemEntries.push(itemElem);
|
2022-05-13 04:00:16 +00:00
|
|
|
|
|
|
|
const itemElemContained = document.createElement("div");
|
|
|
|
itemElemContained.classList.add("dark-7", "rounded", "px-2", "col-auto");
|
|
|
|
itemElemContained.setAttribute('id', `item-entry-${i}`);
|
|
|
|
itemElem.appendChild(itemElemContained);
|
2021-01-30 15:36:04 +00:00
|
|
|
|
2023-01-31 02:55:25 +00:00
|
|
|
const sortKeyListContainer = document.createElement('div');
|
|
|
|
sortKeyListContainer.classList.add('row');
|
|
|
|
sortKeyListContainer.setAttribute('id', `item-sort-entry-${i}`);
|
|
|
|
itemEntries[i].append(sortKeyListContainer);
|
2021-01-30 15:36:04 +00:00
|
|
|
}
|
2023-01-31 02:55:25 +00:00
|
|
|
}
|
2021-01-30 15:36:04 +00:00
|
|
|
|
2023-01-31 02:55:25 +00:00
|
|
|
function init_values() {
|
|
|
|
// compile the search db from the item db
|
|
|
|
searchDb = items.filter(i => !i.remapID).map(i => [i, expandItem(i)]);
|
2021-07-19 19:50:51 +00:00
|
|
|
|
2023-01-31 02:55:25 +00:00
|
|
|
// create the expression parser
|
|
|
|
exprParser = new ExprParser(itemQueryProps, queryFuncs);
|
|
|
|
}
|
2021-01-30 15:36:04 +00:00
|
|
|
|
2023-01-31 02:55:25 +00:00
|
|
|
function display(itemExp, id) {
|
|
|
|
itemExp.set("powders", []);
|
|
|
|
if (itemExp.get("category") == "weapon") {
|
|
|
|
apply_weapon_powders(itemExp);
|
2021-01-30 15:36:04 +00:00
|
|
|
}
|
2021-07-19 20:13:15 +00:00
|
|
|
|
2023-01-31 02:55:25 +00:00
|
|
|
displayExpandedItem(itemExp, id);
|
2021-01-30 15:36:04 +00:00
|
|
|
}
|
|
|
|
|
2022-08-15 03:39:43 +00:00
|
|
|
(async function() {
|
2023-07-15 01:34:30 +00:00
|
|
|
await Promise.resolve(load_init(), load_major_id_data(wynn_version_names[WYNN_VERSION_LATEST]));
|
2022-08-15 03:39:43 +00:00
|
|
|
init_items_adv();
|
|
|
|
})();
|