-import { Player, StatDef, StatDisplay } from "../../shared/player";
+import { EquippedItemDetails } from "../../shared/equipped";
+import { expToLevel, maxHp, maxVigor, Player, StatDef, StatDisplay, totalDefence } from "../../shared/player";
function statPointIncreaser(stat: StatDisplay) {
- return `<button class="increase-stat emit-event" data-event="spend-stat-point" data-args="${stat.id}">+</button>`;
+ return `<button class="increase-stat" hx-post="/player/stat/${stat.id}" hx-target="#profile">+</button>`;
}
-export async function renderProfilePage(player: Player): Promise<string> {
+
+export function renderProfilePage(player: Player, equipment: EquippedItemDetails[]): string {
+
let statBreakdown = '';
StatDef.forEach(stat => {
statBreakdown += `<tr>
- <th>${stat.display}</th>
+ <th title="${stat.description}" tabindex="0">${stat.display}</th>
<td class="${stat.id}">
- ${player[stat.id]}
+ ${player[stat.id].toLocaleString()}
${player.stat_points ? statPointIncreaser(stat) : ''}
</td>
</tr>`;
});
const html = `<div id="extra-inventory-info">
- <table id="stat-breakdown">
+ <table class="stat-breakdown">
+ <tr>
+ <th title="The total amount of damage you can take before you pass out" tabindex="0">HP</th>
+ <td>${player.hp.toLocaleString()}/${maxHp(player.constitution, player.level).toLocaleString()}</td>
+ </tr>
+ <tr>
+ <th title="Your energy level. Low vigor will cause your overall defence and damage to drop." tabindex="0">Vigor</th>
+ <td>${player.vigor.toLocaleString()}/${maxVigor(player.constitution, player.level).toLocaleString()}</td>
+ </tr>
+ <tr>
+ <th title="How many experience points you need to get to your next level" tabindex="0">EXP</th>
+ <td>${player.exp.toLocaleString()}/${expToLevel(player.level + 1).toLocaleString()}</td>
+ </tr>
+ <tr>
+ <th title="The max defence you can have (and your true defence affected by your vigor)" tabindex="0">Defence</th>
+ <td>${totalDefence(equipment, player, false).toLocaleString()} (${totalDefence(equipment, player).toLocaleString()})</td>
+ </tr>
+ <tr>
+ <th title="You can use these to increase the base stats below" tabindex="0">Stat Points</th>
+ <td class="stat_points">${player.stat_points}</td>
+ </tr>
${statBreakdown}
- <tr><th>Stat Points</th><td class="stat_points">${player.stat_points}</td></tr>
</table>
- </div>`;
+ </div>
+ <div id="announcements">
+<p>Hi, thanks for checking out this VERY early build of Rising Legends.</p>
+<p>If you have any questions or run into any bugs, feel free to drop an email on our mailing list: <a href="mailto:~xangelo/rising-legends-discuss@lists.sr.ht">~xangelo/rising-legends-discuss@lists.sr.ht</a>
+ </div>
+`;
return html;
}