Skip to content

Commit

Permalink
Add DD stages to bookmarklets
Browse files Browse the repository at this point in the history
  • Loading branch information
hymccord committed Aug 28, 2024
1 parent c82b339 commit 9c4e513
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/bookmarklet/bm-cre.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,29 @@
} else {
return "Hallway";
}
} else if (userLocation === "Draconic Depths") {
const ddQuest = userQuests["QuestDraconicDepths"];
if (ddQuest["in_cavern"]) {
const cavernCategory = ddQuest["cavern"]["category"]; // "fire" | "ice" | "poison" | "elemental"
const category = cavernCategory.charAt(0).toUpperCase() + cavernCategory.slice(1);

const currentTier = quest.cavern.loot_tier.current_tier;
const lootTiers = quest.cavern.loot_tier.tier_data;

// if we're not at the last tier (currentTier is one indexed), then we need a range '0-99'
// which consists of the current tier threshold and the next tier threshold - 1
// otherwise, we just need the a number '750+'
let range;
if (currentTier < lootTiers.length) {
range = `${lootTiers[currentTier - 1].threshold}-${lootTiers[currentTier].threshold - 1}`;
} else {
range = `${lootTiers[currentTier - 1].threshold}+`;
}

return `Cavern - ${category} ${range}`;
} else {
return "Crucible Forge";
}
}

return "N/A";
Expand Down
23 changes: 23 additions & 0 deletions src/bookmarklet/bm-setup-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,29 @@
} else {
return "Hallway";
}
} else if (userLocation === "Draconic Depths") {
const ddQuest = userQuests["QuestDraconicDepths"];
if (ddQuest["in_cavern"]) {
const cavernCategory = ddQuest["cavern"]["category"]; // "fire" | "ice" | "poison" | "elemental"
const category = cavernCategory.charAt(0).toUpperCase() + cavernCategory.slice(1);

const currentTier = quest.cavern.loot_tier.current_tier;
const lootTiers = quest.cavern.loot_tier.tier_data;

// if we're not at the last tier (currentTier is one indexed), then we need a range '0-99'
// which consists of the current tier threshold and the next tier threshold - 1
// otherwise, we just need the a number '750+'
let range;
if (currentTier < lootTiers.length) {
range = `${lootTiers[currentTier - 1].threshold}-${lootTiers[currentTier].threshold - 1}`;
} else {
range = `${lootTiers[currentTier - 1].threshold}+`;
}

return `Cavern - ${category} ${range}`;
} else {
return "Crucible Forge";
}
}

return "N/A";
Expand Down

0 comments on commit 9c4e513

Please sign in to comment.