Skip to content

Commit

Permalink
Fix stamina display precision in notes and stamina commands
Browse files Browse the repository at this point in the history
  • Loading branch information
torikushiii committed Aug 27, 2024
1 parent 27ef2ce commit dd55eed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions commands/notes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const getNotesEmbedData = async (accounts, game, platformId) => {
const { data } = notes;
const { stamina, dailies, weeklies, expedition, realm } = data;

const currentStamina = Math.round(stamina.currentStamina);
const embed = {
color: data.assets.color,
author: {
Expand All @@ -26,7 +27,7 @@ const getNotesEmbedData = async (accounts, game, platformId) => {
fields: [
{
name: `Current Stamina:`,
value: `${stamina.currentStamina}/${stamina.maxStamina}`
value: `${currentStamina}/${stamina.maxStamina}`
+ `\nFull in:\n${app.Utils.formatTime(stamina.recoveryTime)}`,
inline: true
}
Expand Down Expand Up @@ -134,9 +135,10 @@ const getNotesEmbedData = async (accounts, game, platformId) => {
if (platform.gameId === 2) {
const { task, maxTask, storedAttendance, storedAttendanceRefresh } = dailies;

const currentStamina = Math.floor(stamina.currentStamina);
message = [
`${account.nickname} - ${account.uid}`,
`Current Stamina: ${stamina.currentStamina}/${stamina.maxStamina}`
`Current Stamina: ${currentStamina}/${stamina.maxStamina}`
+ `\nFull in: ${app.Utils.formatTime(stamina.recoveryTime)}`,
"Expedition Status",
expedition.list.map((i, idx) => `Account ${idx + 1} - ${app.Utils.formatTime(i.remaining_time)}`).join("\n"),
Expand Down
2 changes: 1 addition & 1 deletion commands/stamina/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const formatStaminaMessage = (data, discord = false) => {

const description = [
discord ? `\n\`\`\`yaml\n${username} (${uid}) - ${fixedRegion}\`\`\`` : `\n${username} (${uid}) - ${fixedRegion}`,
`Current: ${currentStamina}/${maxStamina}`,
`Current: ${Math.floor(currentStamina)}/${maxStamina}`,
`Recovery Time: ${delta}`
];

Expand Down

0 comments on commit dd55eed

Please sign in to comment.