- 23 source files in src/ (build via scripts/build.sh) - Forum-sourced player knowledge in references/ - DESIGN.md with architecture and corrections - References to existing scripts (Monsterbation, jpx, HV Utils)
53 lines
2.1 KiB
JavaScript
53 lines
2.1 KiB
JavaScript
// ═══════════════════════════════════════════════════════════════════════
|
|
// ITEMS — item ID mapping
|
|
// ═══════════════════════════════════════════════════════════════════════
|
|
|
|
const ITEMS = {
|
|
// Gems
|
|
10005: { n: 'Health Gem', t: 'heal' },
|
|
10006: { n: 'Mana Gem', t: 'mana' },
|
|
10007: { n: 'Spirit Gem', t: 'spirit' },
|
|
10008: { n: 'Mystic Gem', t: 'channel' },
|
|
|
|
// Health potions
|
|
11191: { n: 'Health Draught', t: 'heal', cost: 25 },
|
|
11195: { n: 'Health Potion', t: 'heal', cost: 50 },
|
|
11199: { n: 'Health Elixir', t: 'heal', cost: 500 },
|
|
|
|
// Mana potions
|
|
11291: { n: 'Mana Draught', t: 'mana', cost: 50 },
|
|
11295: { n: 'Mana Potion', t: 'mana', cost: 100 },
|
|
11299: { n: 'Mana Elixir', t: 'mana', cost: 1000 },
|
|
|
|
// Spirit potions
|
|
11391: { n: 'Spirit Draught', t: 'spirit', cost: 50 },
|
|
11395: { n: 'Spirit Potion', t: 'spirit', cost: 100 },
|
|
11399: { n: 'Spirit Elixir', t: 'spirit', cost: 1000 },
|
|
|
|
// Crystals
|
|
50001: { n: 'Crystal of Vigor', s: 'STR' },
|
|
50002: { n: 'Crystal of Finesse', s: 'DEX' },
|
|
50003: { n: 'Crystal of Swiftness', s: 'AGI' },
|
|
50004: { n: 'Crystal of Fortitude', s: 'END' },
|
|
50005: { n: 'Crystal of Cunning', s: 'INT' },
|
|
50006: { n: 'Crystal of Knowledge', s: 'WIS' },
|
|
};
|
|
|
|
function getItemType(id) {
|
|
const item = ITEMS[parseInt(id)];
|
|
return item ? item.t : null;
|
|
}
|
|
|
|
function hasUsableGem(type) {
|
|
for (const [id, info] of Object.entries(STATE.itemsKnown)) {
|
|
const d = ITEMS[parseInt(info)];
|
|
if (!d || d.t !== type) continue;
|
|
// P slot (gem) only valid if it has content inside it
|
|
if (id === 'p') {
|
|
const p = document.getElementById('ikey_p');
|
|
if (!p || !p.querySelector('div')) continue;
|
|
}
|
|
return { id, item: d };
|
|
}
|
|
return null;
|
|
}
|