fix: missing % from player bar
authorxangelo <me@xangelo.ca>
Fri, 18 Aug 2023 18:38:28 +0000 (14:38 -0400)
committerxangelo <me@xangelo.ca>
Fri, 18 Aug 2023 18:38:28 +0000 (14:38 -0400)
src/server/views/player-bar.ts
src/shared/player.ts

index 3b57789a6649e95bb983c5e0fdbbdea2f3f496be..d02ea682928a310f8066a82772099e232c7d053b 100644 (file)
@@ -75,7 +75,7 @@ function progressBar(current: number, max: number, id: string, opts: ProgressBar
   }
 
   return `<div class="progress-bar" id="${id}" style="background: linear-gradient(to right, ${opts.startingColor}, ${opts.endingColor} ${percent}%, transparent ${percent}%, transparent)"
-title="${percent}% - ${current}/${max}">${current}/${max} - ${percent}</div>`;
+title="${percent}% - ${current}/${max}">${current}/${max} - ${percent}%</div>`;
 }
 
 export function renderPlayerBar(player: Player, inventory: EquippedItemDetails[]): string {
index e3af5f7e8050380b1009c4338cd8794a5767d3d9..ca94496dc7216f55e32c3bf2bac58ba2d7be4f8f 100644 (file)
@@ -26,7 +26,7 @@ export type PlayerWithSkills = Player & {
 }
 
 export function maxHp(constitution: number, playerLevel: number): number {
-  return Math.ceil((constitution + (playerLevel * 1.3)) * 1.7);
+  return Math.ceil((constitution * 1.7) + (playerLevel * 1.3));
 }
 
 export function expToLevel(level: number): number {