socket.on('city:services:healer', async () => {
let text: string[] = [`Welcome to the <b>Healer</b>`];
- if(player.gold < 10) {
- text.push(`Oh wow.. you sure dont have any money on you... I guess I'll heal you for free this time.`);
+ if(player.hp < maxHp(player.constitution, player.level)) {
+ if(player.gold < 10) {
+ text.push(`Oh wow.. you sure dont have any money on you... I guess I'll heal you for free this time.`);
+ }
+ else {
+ text.push('Healing to full health will cost you 10G.');
+ }
+ text.push(`<br><button type="button" class="city-emit-event" data-event="city:service:healer:heal">Heal!</button>`);
}
else {
- text.push('Healing to full health will cost you 10G.');
+ text.push(`You seem like you're in pretty good health right now, not sure I can do anything...`);
}
- text.push(`<br><button type="button" class="city-emit-event" data-event="city:service:healer:heal">Heal!</button>`);
socket.emit('city:service:healer', {
text: text.join("<br>")