fix: give users free healing if they have less than 20g
authorxangelo <git@xangelo.ca>
Fri, 7 Jul 2023 17:12:42 +0000 (13:12 -0400)
committerxangelo <git@xangelo.ca>
Fri, 7 Jul 2023 17:12:42 +0000 (13:12 -0400)
src/events/healer/server.ts

index 43479544bfcf6768cb02f0db5414d1101d67d91a..e3f363491a4750126f978d991f4bfd858882eb89 100644 (file)
@@ -110,15 +110,15 @@ export const healer: SocketEvent = {
       text.push(`<p>You're already at full health?</p>`);
     }
     else {
-      if(api.player.level <= 3) {
-        text.push(`<p>Since you still seem to be new around here, this one's on the house!</p>`);
+      if(api.player.gold <= (healCost * 2)) {
+        text.push(`<p>You don't seem to have too much money... I guess I can do it for free this time...</p>`);
         text.push(`<p><button type="button" class="city-emit-event" data-event="city:services:healer:heal" data-args="${service.id}">Heal for free!</button></p>`);
       }
       else {
         text.push(`<p><button type="button" class="city-emit-event" data-event="city:services:healer:heal" data-args="${service.id}">Heal for ${healCost}g!</button></p>`);
       }
-    }
 
+    }
 
     api.socket.emit('city:service:healer', {
       text: text.join("\n")
@@ -145,7 +145,7 @@ export const heal: SocketEvent = {
 
     text.push(`<p><b>${service.name}</b></p>`);
 
-    const cost = api.player.level <= 3 ? 0 : healCost;
+    const cost = api.player.gold <= (healCost * 2) ? 0 : healCost;
 
     if(api.player.gold < cost) {
       text.push(`<p>${getText('insufficient_money', service, city)}</p>`)