chore(release): 0.2.10 v0.2.10
authorxangelo <me@xangelo.ca>
Fri, 18 Aug 2023 18:40:05 +0000 (14:40 -0400)
committerxangelo <me@xangelo.ca>
Fri, 18 Aug 2023 18:40:05 +0000 (14:40 -0400)
39 files changed:
CHANGELOG.md
package-lock.json
package.json
public/assets/css/game.css
public/assets/img/icons/equipment/adventurers_sword.png [new file with mode: 0755]
public/assets/img/icons/equipment/arm_t_02.PNG [deleted file]
public/assets/img/icons/equipment/boot_t_02.png [deleted file]
public/assets/img/icons/equipment/dagger.png [new file with mode: 0755]
public/assets/img/icons/equipment/gl_t_07.png [deleted file]
public/assets/img/icons/equipment/heavy_hammer.png [new file with mode: 0755]
public/assets/img/icons/equipment/hlm_t_02.png [deleted file]
public/assets/img/icons/equipment/leather/armour.png [new file with mode: 0755]
public/assets/img/icons/equipment/leather/boots.png [new file with mode: 0755]
public/assets/img/icons/equipment/leather/gloves.png [new file with mode: 0755]
public/assets/img/icons/equipment/leather/helm.png [new file with mode: 0755]
public/assets/img/icons/equipment/leather/pants.png [new file with mode: 0755]
public/assets/img/icons/equipment/magic/firebolt_1.png [new file with mode: 0755]
public/assets/img/icons/equipment/magic/heal_1.png [new file with mode: 0755]
public/assets/img/icons/equipment/magic/icebolt_1.png [new file with mode: 0755]
public/assets/img/icons/equipment/padded/boots.png [new file with mode: 0755]
public/assets/img/icons/equipment/padded/gloves.png [new file with mode: 0755]
public/assets/img/icons/equipment/padded/greaves.png [new file with mode: 0755]
public/assets/img/icons/equipment/padded/helm.png [new file with mode: 0755]
public/assets/img/icons/equipment/padded/tunic.png [new file with mode: 0755]
public/assets/img/icons/equipment/plain/boots.png [new file with mode: 0755]
public/assets/img/icons/equipment/plain/gloves.png [new file with mode: 0755]
public/assets/img/icons/equipment/plain/helm.png [new file with mode: 0755]
public/assets/img/icons/equipment/plain/pants.png [new file with mode: 0755]
public/assets/img/icons/equipment/plain/tunic.png [new file with mode: 0755]
public/assets/img/icons/equipment/pn_t_06.png [deleted file]
public/assets/img/icons/equipment/well_used_sword.png [new file with mode: 0755]
public/index.html
src/server/api.ts
src/server/views/fight.ts
src/server/views/inventory.ts
src/server/views/map.ts
src/server/views/player-bar.ts
src/server/views/stores.ts
src/shared/player.ts

index 1d97f817f4d39c6066d6b5cdd9e26738b4defaeb..3cdb4ac2d6832969a4ab2463a4518ef51166eb74 100644 (file)
@@ -2,6 +2,25 @@
 
 All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
 
 
 All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
 
+### [0.2.10](https://git.xangelo.ca/?p=risinglegends.git;a=commitdiff;h=v0.2.10;hp=v0.2.9;ds=sidebyside) (2023-08-18)
+
+
+### Features
+
+* add icons for beginner equipment 218a9ee
+* increase hp gain rate 1f9aaf6
+
+
+### Bug Fixes
+
+* background not appearing if reload during fight 64a76af
+* cant perform other actions in a fight b1a1999
+* chat timeline to messages show up chronologically b82a2ef
+* dont display death text after fleeing 2a1bffe
+* missing % from player bar a0606a5
+* move purchase button under icon in stores 93aeef5
+* only disable equipping/unequipping in a fight b6e9f9a
+
 ### [0.2.9](https://git.xangelo.ca/?p=risinglegends.git;a=commitdiff;h=v0.2.9;hp=v0.2.8;ds=sidebyside) (2023-08-15)
 
 
 ### [0.2.9](https://git.xangelo.ca/?p=risinglegends.git;a=commitdiff;h=v0.2.9;hp=v0.2.8;ds=sidebyside) (2023-08-15)
 
 
index 7aca8b69a2fa434e66971ea1ad665e2fa8e499c7..5a3857378ce5eca6e12a5aa685b14ced74d8de6f 100644 (file)
@@ -1,12 +1,12 @@
 {
   "name": "rising-legends",
 {
   "name": "rising-legends",
-  "version": "0.2.9",
+  "version": "0.2.10",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "rising-legends",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "rising-legends",
-      "version": "0.2.9",
+      "version": "0.2.10",
       "dependencies": {
         "@honeycombio/opentelemetry-node": "^0.4.0",
         "@opentelemetry/auto-instrumentations-node": "^0.37.0",
       "dependencies": {
         "@honeycombio/opentelemetry-node": "^0.4.0",
         "@opentelemetry/auto-instrumentations-node": "^0.37.0",
index 46fcf75aa6f0f0d657d2ca9a8343c59ebdeb7517..2a9e74bc152878481e64d3c2c270fe001b25cb20 100644 (file)
@@ -1,7 +1,7 @@
 {
   "name": "rising-legends",
   "private": true,
 {
   "name": "rising-legends",
   "private": true,
-  "version": "0.2.9",
+  "version": "0.2.10",
   "scripts": {
     "up": "npx prisma migrate dev --name \"init\"",
     "start": "pm2 start dist/server/api.js",
   "scripts": {
     "up": "npx prisma migrate dev --name \"init\"",
     "start": "pm2 start dist/server/api.js",
index b29a4ec21a5a6af341bc869a0e98061e4402584f..55a52fc9ff1022d80c50c920123c91b712211a78 100644 (file)
@@ -513,14 +513,10 @@ h3 {
 .store-list {
   display: flex;
   text-align: left;
 .store-list {
   display: flex;
   text-align: left;
-  margin: 0 0 0.3rem 0.3rem;
-}
-.store-list:last-child {
-  margin-bottom: 0;
+  padding: 0.5rem;
 }
 }
-.store-list img {
-  width: 64px;
-  height: 64px;
+.store-list:nth-child(even) {
+  background-color: #f2f0ec;
 }
 .store-list .details {
   padding: 0 0.4rem;
 }
 .store-list .details {
   padding: 0 0.4rem;
@@ -530,19 +526,49 @@ h3 {
 .store-list .name {
   font-weight: bold;
 }
 .store-list .name {
   font-weight: bold;
 }
+.requirements {
+  margin-top: 0.5rem;
+  line-height: 1.3rem;
+}
 .requirement-title {
   font-weight: bold;
   text-transform: capitalize;
 }
 .requirement-title {
   font-weight: bold;
   text-transform: capitalize;
 }
+.store-cost {
+  margin-top: 0.5rem;
+}
+.store-icon {
+  width: 64px;
+  height: calc(64px + 27px);
+  padding: 0;
+  background-repeat: no-repeat;
+  background-size: contain;
+  position: relative;
+  margin-right: 0.5rem;
+}
+.inventory-icon {
+  width: 64px;
+  height: 64px;;
+  padding: 0;
+  background-repeat: no-repeat;
+  background-size: contain;
+  position: relative;
+  margin-right: 0.5rem;
+}
 .store-actions {
 .store-actions {
-  width: 75px;
-  margin: 0.3rem;
-  align-items: center;
-  display: flex;
-  flex-direction: column;
+  width: 100%;
+  position: absolute;
+  bottom: 0;
 }
 .store-actions button {
 }
 .store-actions button {
-  width: 75px;
+  width: 100%;
+  padding: 0.3rem 0.5rem;
+}
+.inventory-actions {
+  width: 74px;
+}
+.inventory-actions button {
+  width: 100%;
   padding: 0.3rem 0.5rem;
 }
 
   padding: 0.3rem 0.5rem;
 }
 
diff --git a/public/assets/img/icons/equipment/adventurers_sword.png b/public/assets/img/icons/equipment/adventurers_sword.png
new file mode 100755 (executable)
index 0000000..b5e7cf6
Binary files /dev/null and b/public/assets/img/icons/equipment/adventurers_sword.png differ
diff --git a/public/assets/img/icons/equipment/arm_t_02.PNG b/public/assets/img/icons/equipment/arm_t_02.PNG
deleted file mode 100755 (executable)
index be71a7c..0000000
Binary files a/public/assets/img/icons/equipment/arm_t_02.PNG and /dev/null differ
diff --git a/public/assets/img/icons/equipment/boot_t_02.png b/public/assets/img/icons/equipment/boot_t_02.png
deleted file mode 100755 (executable)
index 0134c45..0000000
Binary files a/public/assets/img/icons/equipment/boot_t_02.png and /dev/null differ
diff --git a/public/assets/img/icons/equipment/dagger.png b/public/assets/img/icons/equipment/dagger.png
new file mode 100755 (executable)
index 0000000..c358111
Binary files /dev/null and b/public/assets/img/icons/equipment/dagger.png differ
diff --git a/public/assets/img/icons/equipment/gl_t_07.png b/public/assets/img/icons/equipment/gl_t_07.png
deleted file mode 100755 (executable)
index 90ffe1d..0000000
Binary files a/public/assets/img/icons/equipment/gl_t_07.png and /dev/null differ
diff --git a/public/assets/img/icons/equipment/heavy_hammer.png b/public/assets/img/icons/equipment/heavy_hammer.png
new file mode 100755 (executable)
index 0000000..d99f9fb
Binary files /dev/null and b/public/assets/img/icons/equipment/heavy_hammer.png differ
diff --git a/public/assets/img/icons/equipment/hlm_t_02.png b/public/assets/img/icons/equipment/hlm_t_02.png
deleted file mode 100755 (executable)
index 23e8073..0000000
Binary files a/public/assets/img/icons/equipment/hlm_t_02.png and /dev/null differ
diff --git a/public/assets/img/icons/equipment/leather/armour.png b/public/assets/img/icons/equipment/leather/armour.png
new file mode 100755 (executable)
index 0000000..e339aef
Binary files /dev/null and b/public/assets/img/icons/equipment/leather/armour.png differ
diff --git a/public/assets/img/icons/equipment/leather/boots.png b/public/assets/img/icons/equipment/leather/boots.png
new file mode 100755 (executable)
index 0000000..2a22a0f
Binary files /dev/null and b/public/assets/img/icons/equipment/leather/boots.png differ
diff --git a/public/assets/img/icons/equipment/leather/gloves.png b/public/assets/img/icons/equipment/leather/gloves.png
new file mode 100755 (executable)
index 0000000..7a99541
Binary files /dev/null and b/public/assets/img/icons/equipment/leather/gloves.png differ
diff --git a/public/assets/img/icons/equipment/leather/helm.png b/public/assets/img/icons/equipment/leather/helm.png
new file mode 100755 (executable)
index 0000000..836f7a4
Binary files /dev/null and b/public/assets/img/icons/equipment/leather/helm.png differ
diff --git a/public/assets/img/icons/equipment/leather/pants.png b/public/assets/img/icons/equipment/leather/pants.png
new file mode 100755 (executable)
index 0000000..5213caf
Binary files /dev/null and b/public/assets/img/icons/equipment/leather/pants.png differ
diff --git a/public/assets/img/icons/equipment/magic/firebolt_1.png b/public/assets/img/icons/equipment/magic/firebolt_1.png
new file mode 100755 (executable)
index 0000000..d2ee08b
Binary files /dev/null and b/public/assets/img/icons/equipment/magic/firebolt_1.png differ
diff --git a/public/assets/img/icons/equipment/magic/heal_1.png b/public/assets/img/icons/equipment/magic/heal_1.png
new file mode 100755 (executable)
index 0000000..d4fb6a0
Binary files /dev/null and b/public/assets/img/icons/equipment/magic/heal_1.png differ
diff --git a/public/assets/img/icons/equipment/magic/icebolt_1.png b/public/assets/img/icons/equipment/magic/icebolt_1.png
new file mode 100755 (executable)
index 0000000..63552f5
Binary files /dev/null and b/public/assets/img/icons/equipment/magic/icebolt_1.png differ
diff --git a/public/assets/img/icons/equipment/padded/boots.png b/public/assets/img/icons/equipment/padded/boots.png
new file mode 100755 (executable)
index 0000000..4f79834
Binary files /dev/null and b/public/assets/img/icons/equipment/padded/boots.png differ
diff --git a/public/assets/img/icons/equipment/padded/gloves.png b/public/assets/img/icons/equipment/padded/gloves.png
new file mode 100755 (executable)
index 0000000..8ca3231
Binary files /dev/null and b/public/assets/img/icons/equipment/padded/gloves.png differ
diff --git a/public/assets/img/icons/equipment/padded/greaves.png b/public/assets/img/icons/equipment/padded/greaves.png
new file mode 100755 (executable)
index 0000000..91b2431
Binary files /dev/null and b/public/assets/img/icons/equipment/padded/greaves.png differ
diff --git a/public/assets/img/icons/equipment/padded/helm.png b/public/assets/img/icons/equipment/padded/helm.png
new file mode 100755 (executable)
index 0000000..120d4e7
Binary files /dev/null and b/public/assets/img/icons/equipment/padded/helm.png differ
diff --git a/public/assets/img/icons/equipment/padded/tunic.png b/public/assets/img/icons/equipment/padded/tunic.png
new file mode 100755 (executable)
index 0000000..a546049
Binary files /dev/null and b/public/assets/img/icons/equipment/padded/tunic.png differ
diff --git a/public/assets/img/icons/equipment/plain/boots.png b/public/assets/img/icons/equipment/plain/boots.png
new file mode 100755 (executable)
index 0000000..9029757
Binary files /dev/null and b/public/assets/img/icons/equipment/plain/boots.png differ
diff --git a/public/assets/img/icons/equipment/plain/gloves.png b/public/assets/img/icons/equipment/plain/gloves.png
new file mode 100755 (executable)
index 0000000..90ffe1d
Binary files /dev/null and b/public/assets/img/icons/equipment/plain/gloves.png differ
diff --git a/public/assets/img/icons/equipment/plain/helm.png b/public/assets/img/icons/equipment/plain/helm.png
new file mode 100755 (executable)
index 0000000..23e8073
Binary files /dev/null and b/public/assets/img/icons/equipment/plain/helm.png differ
diff --git a/public/assets/img/icons/equipment/plain/pants.png b/public/assets/img/icons/equipment/plain/pants.png
new file mode 100755 (executable)
index 0000000..c8a4785
Binary files /dev/null and b/public/assets/img/icons/equipment/plain/pants.png differ
diff --git a/public/assets/img/icons/equipment/plain/tunic.png b/public/assets/img/icons/equipment/plain/tunic.png
new file mode 100755 (executable)
index 0000000..71b2469
Binary files /dev/null and b/public/assets/img/icons/equipment/plain/tunic.png differ
diff --git a/public/assets/img/icons/equipment/pn_t_06.png b/public/assets/img/icons/equipment/pn_t_06.png
deleted file mode 100644 (file)
index 9a3fca9..0000000
Binary files a/public/assets/img/icons/equipment/pn_t_06.png and /dev/null differ
diff --git a/public/assets/img/icons/equipment/well_used_sword.png b/public/assets/img/icons/equipment/well_used_sword.png
new file mode 100755 (executable)
index 0000000..15912f6
Binary files /dev/null and b/public/assets/img/icons/equipment/well_used_sword.png differ
index e2efaa05e3ceb66c18fb48d9abe33e50dbd8e2a6..746e2c36d2326f54fbecc2f850948bd87b5498e8 100644 (file)
@@ -66,7 +66,7 @@
       </div>
 
       <section id="chat">
       </div>
 
       <section id="chat">
-        <div id="chat-messages" hx-trigger="load delay:1s" hx-get="/chat/history" hx-swap="afterend"></div>
+        <div id="chat-messages" hx-trigger="load delay:1s" hx-get="/chat/history" hx-swap="innerHTML"></div>
         <form id="chat-form" hx-post="/chat">
           <input type="text" id="message" name="message" autocomplete="off"><button type="submit">Send</button>
         </form>
         <form id="chat-form" hx-post="/chat">
           <input type="text" id="message" name="message" autocomplete="off"><button type="submit">Send</button>
         </form>
index 35ba7e34c03d362b19b6b23b067725b6f3e1045d..8a7eec80dc29f03b1363e194597a55b4839a6abe 100644 (file)
@@ -16,7 +16,7 @@ import {clearFight, createFight, getMonsterList, getMonsterLocation, getRandomMo
 import {FightRound} from '../shared/fight';
 import {addInventoryItem, deleteInventoryItem, getEquippedItems, getInventory, getInventoryItem, updateAp} from './inventory';
 import { getItemFromPlayer, getItemFromShop, getPlayersItems, getShopItems, givePlayerItem, updateItemCount } from './items';
 import {FightRound} from '../shared/fight';
 import {addInventoryItem, deleteInventoryItem, getEquippedItems, getInventory, getInventoryItem, updateAp} from './inventory';
 import { getItemFromPlayer, getItemFromShop, getPlayersItems, getShopItems, givePlayerItem, updateItemCount } from './items';
-import {FightTrigger, Monster, MonsterForFight, MonsterWithFaction} from '../shared/monsters';
+import {Fight, FightTrigger, Monster, MonsterForFight, MonsterWithFaction} from '../shared/monsters';
 import {getShopEquipment, listShopItems } from './shopEquipment';
 import {EquippedItemDetails} from '../shared/equipped';
 import {ArmourEquipmentSlot, EquipmentSlot} from '../shared/inventory';
 import {getShopEquipment, listShopItems } from './shopEquipment';
 import {EquippedItemDetails} from '../shared/equipped';
 import {ArmourEquipmentSlot, EquipmentSlot} from '../shared/inventory';
@@ -466,7 +466,7 @@ app.get('/player/inventory', authEndpoint, async (req: AuthRequest, res: Respons
   res.send(renderInventoryPage(inventory, items));
 });
 
   res.send(renderInventoryPage(inventory, items));
 });
 
-app.post('/player/equip/:item_id/:slot', authEndpoint, async (req: AuthRequest, res: Response) => {
+app.post('/player/equip/:item_id/:slot', authEndpoint, blockPlayerInFight, async (req: AuthRequest, res: Response) => {
   const inventoryItem = await getInventoryItem(req.player.id, req.params.item_id);
   const equippedItems = await getEquippedItems(req.player.id);
   const requestedSlot = req.params.slot;
   const inventoryItem = await getInventoryItem(req.player.id, req.params.item_id);
   const equippedItems = await getEquippedItems(req.player.id);
   const requestedSlot = req.params.slot;
@@ -518,7 +518,7 @@ app.post('/player/equip/:item_id/:slot', authEndpoint, async (req: AuthRequest,
   res.send(renderInventoryPage(inventory, items, inventoryItem.type) + renderPlayerBar(req.player, inventory));
 });
 
   res.send(renderInventoryPage(inventory, items, inventoryItem.type) + renderPlayerBar(req.player, inventory));
 });
 
-app.post('/player/unequip/:item_id', authEndpoint, async (req: AuthRequest, res: Response) => {
+app.post('/player/unequip/:item_id', authEndpoint, blockPlayerInFight, async (req: AuthRequest, res: Response) => {
   const [item, ] = await Promise.all([
     getInventoryItem(req.player.id, req.params.item_id),
     unequip(req.player.id, req.params.item_id)
   const [item, ] = await Promise.all([
     getInventoryItem(req.player.id, req.params.item_id),
     unequip(req.player.id, req.params.item_id)
@@ -532,13 +532,27 @@ app.post('/player/unequip/:item_id', authEndpoint, async (req: AuthRequest, res:
   res.send(renderInventoryPage(inventory, items, item.type) + renderPlayerBar(req.player, inventory));
 });
 
   res.send(renderInventoryPage(inventory, items, item.type) + renderPlayerBar(req.player, inventory));
 });
 
+async function blockPlayerInFight(req: AuthRequest, res: Response, next) {
+  const fight = await loadMonsterFromFight(req.player.id);
+  if(!fight) {
+    next();
+    return;
+  }
+
+  res.send(Alert.ErrorAlert(`You are currently in a fight with a ${fight.name}`));
+}
+
 app.get('/player/explore', authEndpoint, async (req: AuthRequest, res: Response) => {
   const fight = await loadMonsterFromFight(req.player.id);
 app.get('/player/explore', authEndpoint, async (req: AuthRequest, res: Response) => {
   const fight = await loadMonsterFromFight(req.player.id);
+  const travelPlan = await getTravelPlan(req.player.id);
   let closestTown = req.player.city_id;
 
   let closestTown = req.player.city_id;
 
+  if(travelPlan) {
+      closestTown = (travelPlan.current_position / travelPlan.total_distance) > 0.5 ? travelPlan.destination_id : travelPlan.source_id;
+  }
+
   const equippedItems = await getEquippedItems(req.player.id);
   if(fight) {
   const equippedItems = await getEquippedItems(req.player.id);
   if(fight) {
-    // ok lets display the fight screen!
     const data: MonsterForFight = {
       id: fight.id,
       hp: fight.hp,
     const data: MonsterForFight = {
       id: fight.id,
       hp: fight.hp,
@@ -549,20 +563,16 @@ app.get('/player/explore', authEndpoint, async (req: AuthRequest, res: Response)
     };
     const location = await getMonsterLocation(fight.ref_id);
 
     };
     const location = await getMonsterLocation(fight.ref_id);
 
-    res.send(renderPlayerBar(req.player, equippedItems) + renderFightPreRound(data, true, location));
+
+    res.send(renderPlayerBar(req.player, equippedItems) + renderFightPreRound(data, true, location, closestTown));
   }
   else {
   }
   else {
-    const travelPlan = await getTravelPlan(req.player.id);
     if(travelPlan) {
       // traveling!
     if(travelPlan) {
       // traveling!
-      const travelPlan = await getTravelPlan(req.player.id);
-
-      const closest: number = (travelPlan.current_position / travelPlan.total_distance) > 0.5 ? travelPlan.destination_id : travelPlan.source_id;
-
       const chanceToSeeMonster = random(0, 100);
       const things: any[] = [];
       if(chanceToSeeMonster <= 30) {
       const chanceToSeeMonster = random(0, 100);
       const things: any[] = [];
       if(chanceToSeeMonster <= 30) {
-        const monster = await getRandomMonster([closest]);
+        const monster = await getRandomMonster([closestTown]);
         things.push(monster);
       }
 
         things.push(monster);
       }
 
@@ -572,7 +582,7 @@ app.get('/player/explore', authEndpoint, async (req: AuthRequest, res: Response)
       res.send(renderPlayerBar(req.player, equippedItems) + renderTravel({
         things,
         nextAction,
       res.send(renderPlayerBar(req.player, equippedItems) + renderTravel({
         things,
         nextAction,
-        closestTown: closest,
+        closestTown: closestTown,
         walkingText: '',
         travelPlan
       }));
         walkingText: '',
         travelPlan
       }));
@@ -893,7 +903,7 @@ app.post('/fight', authEndpoint, async (req: AuthRequest, res: Response) => {
     fight_trigger: fight.fight_trigger
   };
 
     fight_trigger: fight.fight_trigger
   };
 
-  res.send(renderFightPreRound(data, true, location));
+  res.send(renderFightPreRound(data, true, location, location.city_id));
 });
 
 app.post('/travel/step', authEndpoint, async (req: AuthRequest, res: Response) => {
 });
 
 app.post('/travel/step', authEndpoint, async (req: AuthRequest, res: Response) => {
index 1995d9a326ccea8a247610354577cf411ecb8d6b..400a7d82520d19f3ffa9dae9fa5231ed7ecd8509 100644 (file)
@@ -19,8 +19,9 @@ export function renderRoundDetails(roundData: FightRound): string {
       }
     break;
     case 'monster':
       }
     break;
     case 'monster':
-      // prompt to return to town and don't let them do anything
-      html.push(`<p>You were killed...</p>`);
+      if(roundData.player.hp === 0) {
+        html.push(`<p>You were killed...</p>`);
+      }
       html.push('<p><button hx-get="/player/explore" hx-target="#explore">Back to Town</button></p>');
     break;
     case 'in-progress':
       html.push('<p><button hx-get="/player/explore" hx-target="#explore">Back to Town</button></p>');
     break;
     case 'in-progress':
@@ -68,10 +69,11 @@ export function renderFight(monster: MonsterForFight, results: string = '', disp
   return html;
 }
 
   return html;
 }
 
-export function renderFightPreRound(monster: MonsterForFight,  displayFightActions: boolean = true, location: LocationWithCity) {
+export function renderFightPreRound(monster: MonsterForFight,  displayFightActions: boolean = true, location: LocationWithCity, closestTown: number) {
   const hpPercent = Math.floor((monster.hp / monster.maxHp) * 100);
 
   let html = `
   const hpPercent = Math.floor((monster.hp / monster.maxHp) * 100);
 
   let html = `
+<section id="explore" class="tab active" style="background-image: url('/assets/img/map/${closestTown}.jpeg')" hx-swap-oob="true">
   <div class="city-title-wrapper">
     <div class="city-title">${location.city_name}</div>
   </div>
   <div class="city-title-wrapper">
     <div class="city-title">${location.city_name}</div>
   </div>
@@ -105,7 +107,9 @@ export function renderFightPreRound(monster: MonsterForFight,  displayFightActio
       </div>
     <div id="fight-results"></div>
   </div>
       </div>
     <div id="fight-results"></div>
   </div>
-</div>`;
+</div>
+</section>
+`;
 
   return html;
 }
 
   return html;
 }
index c027dd01d199196ac95251b483ae02b64124c8f0..adf4105c11ebff58565b82d9cb18beefac5f7907 100644 (file)
@@ -93,8 +93,7 @@ function generateProgressBar(current: number, max: number, color: string, displa
 
 function renderInventoryItem(item: EquippedItemDetails , action: (item: EquippedItemDetails) => string): string {
   return `<div class="store-list">
 
 function renderInventoryItem(item: EquippedItemDetails , action: (item: EquippedItemDetails) => string): string {
   return `<div class="store-list">
-    <div>
-      <img src="${icon(item.icon)}">
+    <div class="inventory-icon" style="background-image: url('${icon(item.icon)}')">
     </div>
     <div class="details">
       <div class="name">${item.name}</div>
     </div>
     <div class="details">
       <div class="name">${item.name}</div>
@@ -117,7 +116,7 @@ function renderInventoryItem(item: EquippedItemDetails , action: (item: Equipped
       </div>
       ${item.hasOwnProperty('id') ? `<div>${item.cost.toLocaleString()}G</div>` : ''}
       </div>
       </div>
       ${item.hasOwnProperty('id') ? `<div>${item.cost.toLocaleString()}G</div>` : ''}
       </div>
-      <div class="store-actions">
+      <div class="inventory-actions">
         ${action(item)}
       </div>
     </div>`;
         ${action(item)}
       </div>
     </div>`;
index 76a546b9914dbf38b0d26c86f2f2faa92a11f644..e432ebd31a0e49b6f8ab29ed2bb05de6d79242fc 100644 (file)
@@ -39,6 +39,7 @@ export async function renderMap(data: { city: City, locations: Location[], paths
     </div>
   </div>
 </div>
     </div>
   </div>
 </div>
+</section>
   `;
 
   return html;
   `;
 
   return html;
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)"
   }
 
   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 {
 }
 
 export function renderPlayerBar(player: Player, inventory: EquippedItemDetails[]): string {
index 08745f70b24d74e93c825762093055a2d7075f04..81b227373b4aaff559de06b1e2f4c378a785eae2 100644 (file)
@@ -22,18 +22,15 @@ function renderRequirement(name: string, val: number | string, currentVal?: numb
 
 function renderShopItem(item: (ShopItem & Item), action: (item: (ShopItem & Item)) => string): string {
     return `<div class="store-list">
 
 function renderShopItem(item: (ShopItem & Item), action: (item: (ShopItem & Item)) => string): string {
     return `<div class="store-list">
-    <div>
-      <img src="/assets/img/icons/items/${item.icon_name}" title="${item.name}">
+    <div class="store-icon">
+      <img src="/assets/img/icons/items/${item.icon_name}" title="${item.name}"><div class="store-actions">${action(item)}</div>
     </div>
     <div class="details">
       <div class="name">${item.name}</div>
       <div class="requirements">
         ${item.description}
       </div>
     </div>
     <div class="details">
       <div class="name">${item.name}</div>
       <div class="requirements">
         ${item.description}
       </div>
-      ${item.hasOwnProperty('id') ? `<div>${item.price_per_unit.toLocaleString()}G</div>` : ''}
-    </div>
-    <div class="store-actions">
-      ${action(item)}
+      ${item.hasOwnProperty('id') ? `<div class="store-cost">${item.price_per_unit.toLocaleString()}G</div>` : ''}
     </div>
     </div>`;
 }
     </div>
     </div>`;
 }
@@ -59,7 +56,7 @@ export function renderEquipmentDetails(item: ShopEquipment, player: Player): str
       ${item.boosts.damage_mitigation ? renderStatBoost('MIT', item.boosts.damage_mitigation.toString())+'%' : ''}
       ${['WEAPON','SPELL'].includes(item.type) ? '' : renderStatBoost('AP', item.maxAp.toString())}
       </div>
       ${item.boosts.damage_mitigation ? renderStatBoost('MIT', item.boosts.damage_mitigation.toString())+'%' : ''}
       ${['WEAPON','SPELL'].includes(item.type) ? '' : renderStatBoost('AP', item.maxAp.toString())}
       </div>
-      ${item.hasOwnProperty('id') ? `<div>${item.cost.toLocaleString()}G</div>` : ''}
+      ${item.hasOwnProperty('id') ? `<div class="store-cost">${item.cost.toLocaleString()}G</div>` : ''}
     </div>
 `
 
     </div>
 `
 
@@ -67,13 +64,10 @@ export function renderEquipmentDetails(item: ShopEquipment, player: Player): str
 
 function renderShopEquipment(item: ShopEquipment, action: (item: ShopEquipment) => string, player: Player): string {
     return `<div class="store-list">
 
 function renderShopEquipment(item: ShopEquipment, action: (item: ShopEquipment) => string, player: Player): string {
     return `<div class="store-list">
-    <div>
-      <img src="${item.icon ? `/assets/img/icons/equipment/${item.icon}` : 'https://via.placeholder.com/64x64'}">
+    <div class="store-icon" style="background-image: url('${item.icon ? `/assets/img/icons/equipment/${item.icon}` : 'https://via.placeholder.com/64x64'}')">
+      <div class="store-actions">${action(item)}</div>
     </div>
     ${renderEquipmentDetails(item, player)}
     </div>
     ${renderEquipmentDetails(item, player)}
-    <div class="store-actions">
-      ${action(item)}
-    </div>
     </div>`;
 }
 
     </div>`;
 }
 
index 7762a41549fb1077840e40a95c725aaa4b6579e1..ca94496dc7216f55e32c3bf2bac58ba2d7be4f8f 100644 (file)
@@ -26,7 +26,7 @@ export type PlayerWithSkills = Player & {
 }
 
 export function maxHp(constitution: number, playerLevel: number): number {
 }
 
 export function maxHp(constitution: number, playerLevel: number): number {
-  return Math.ceil((constitution + playerLevel) * 1.3);
+  return Math.ceil((constitution * 1.7) + (playerLevel * 1.3));
 }
 
 export function expToLevel(level: number): number {
 }
 
 export function expToLevel(level: number): number {