1 import {Player} from "@prisma/client";
2 import $ from 'jquery';
3 import {maxExp, maxHp, maxStamina} from "../../../formulas";
4 import {progressBar} from "../components";
6 function renderStatText(id: string, value: number, incrementable: boolean) {
7 $(`#${id} .text`).html(value.toString());
9 $(`#${id} .stat-increase`).removeClass('hidden');
12 $(`#${id} .stat-increase`).addClass('hidden');
16 export function playerOverview(player: Player) {
18 const incrementable = player.statPoints > 0;
20 $('#name').html(`${player.username}, Level ${player.level}`);
22 renderStatText('pow', player.pow, incrementable);
23 renderStatText('zest', player.zest, incrementable);
24 renderStatText('woosh', player.woosh, incrementable);
25 renderStatText('aha', player.aha, incrementable);
26 renderStatText('luck', player.luck, incrementable);
27 renderStatText('wow', player.wow, incrementable);
28 renderStatText('stp', player.statPoints, incrementable);
30 $('#hit .progress-bar-wrapper').html(progressBar(player.hp, maxHp(player.level, player.zest), {
34 $('#sta .progress-bar-wrapper').html(progressBar(player.stamina, maxStamina(player.level, player.woosh), {
38 $('#exp .progress-bar-wrapper').html(progressBar(player.exp, maxExp(player.level), {