Skip to content

Commit

Permalink
feat: add new forge items
Browse files Browse the repository at this point in the history
  • Loading branch information
DuckySoLucky committed Apr 21, 2024
1 parent 8f8ec76 commit 9d04685
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
37 changes: 37 additions & 0 deletions src/constants/forge.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,43 @@ export const FORGE_TIMES = {
FORGE_TRAVEL_SCROLL: 5 * 60,
CRYSTAL_HOLLOWS_TRAVEL_SCROLL: 10 * 60,
DIAMONITE: 6 * 60,

REFINED_TUNGSTEN: 6 * 60,
REFINED_UMBER: 6 * 60,
TUNGSTEN_PLATE: 0.5,
UMBER_PLATE: 0.5,
GLACITE_AMALGAMATION: 4 * 60,
PERFECT_ONYX_GEM: 20 * 60,
PERFECT_CITRINE_GEM: 20 * 60,
PERFECT_AQUAMARINE_GEM: 20 * 60,
PERFECT_PERIDOT_GEM: 20 * 60,
PERFECT_PLATE: 30 * 60,
MINING_3_TRAVEL_SCROLL: 5 * 60,
BEJEWELED_COLLAR: 2 * 60,
CHISEL: 0.5,
TUNGSTEN_KEY: 30 * 60,
UMBER_KEY: 30 * 60,
FRIGID_HUSK: 10 * 60,
BASE_CAMP_TRAVEL_SCROLL: 10 * 60,
LVL_1_LEGENDARY_AMMONITE: 12 * 24 * 60,
LVL_1_LEGENDARY_MOLE: 3 * 24 * 60,
SECRET_RAILROAD_PASS: 0.5,
LVL_1_LEGENDARY_TYRANNOSAURUS: 7 * 24 * 60,
LVL_1_LEGENDARY_SPINOSAURUS: 7 * 24 * 60,
LVL_1_LEGENDARY_GOBLIN: 7 * 24 * 60,
LVL_1_LEGENDARY_ANKYLOSAURUS: 7 * 24 * 60,
LVL_1_LEGENDARY_PENGUIN: 7 * 24 * 60,
LVL_1_LEGENDARY_MAMMOTH: 7 * 24 * 60,
DWARVEN_HANDWARMERS: 4 * 60,
REINFORCED_CHISEL: 12 * 60,
DWARVEN_METAL: 24 * 60,
PORTABLE_CAMPFIRE: 30 * 60,
TUNGSTEN_KEYCHAIN: 6 * 60,
GLACITE_CHISEL: 18 * 60,
PERFECT_CHISEL: 24 * 60,
DIVAN_PENDANT: 7 * 24 * 60,
POWER_RELIC: 8 * 60,
SKELETON_KEY: 30 * 60 * 1000,
};

export const QUICK_FORGE_MULTIPLIER = {
Expand Down
4 changes: 3 additions & 1 deletion src/stats/mining.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,22 @@ async function getForge(userProfile) {
timeFinishedText: "",
};

const dbObject = constants.ITEMS.get(item.id);

if (item.id in constants.FORGE_TIMES) {
let forgeTime = constants.FORGE_TIMES[item.id] * 60 * 1000;
const quickForge = userProfile.mining_core?.nodes?.forge_time;
if (quickForge != null) {
forgeTime *= constants.QUICK_FORGE_MULTIPLIER[quickForge];
}

const dbObject = constants.ITEMS.get(item.id);
forgeItem.name = item.id == "PET" ? "[Lvl 1] Ammonite" : dbObject ? dbObject.name : item.id;

const timeFinished = item.startTime + forgeTime;
forgeItem.timeFinished = timeFinished;
forgeItem.timeFinishedText = moment(timeFinished).fromNow();
} else {
forgeItem.name = dbObject?.name ?? helper.titleCase(item.id);
forgeItem.id = `UNKNOWN-${item.id}`;
}

Expand Down
2 changes: 1 addition & 1 deletion views/sections/stats/skills/mining.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ function itemIcon(item, classes) { %>
<%= process.name %> - <%= process.timeFinished < Date.now() ? "ended" : `ending ${process.timeFinishedText}`%>
</span>
<% } else { %>
<span class="stat-value">Unknown item</span>
<span class="stat-value"><%= process.name %></span>
<script>
console.error( "Unknown forge item id: <%= process.id.split('UNKNOWN-')[1] %>" )
Expand Down

0 comments on commit 9d04685

Please sign in to comment.