From: xangelo Date: Fri, 18 Aug 2023 18:40:05 +0000 (-0400) Subject: chore(release): 0.2.10 X-Git-Tag: v0.2.10 X-Git-Url: https://git.xangelo.ca/?p=risinglegends.git;a=commitdiff_plain;h=v0.2.10;hp=v0.2.9;ds=sidebyside chore(release): 0.2.10 --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d97f81..3cdb4ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. +### [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) diff --git a/package-lock.json b/package-lock.json index 7aca8b6..5a38573 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rising-legends", - "version": "0.2.9", + "version": "0.2.10", "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", diff --git a/package.json b/package.json index 46fcf75..2a9e74b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "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", diff --git a/public/assets/css/game.css b/public/assets/css/game.css index b29a4ec..55a52fc 100644 --- a/public/assets/css/game.css +++ b/public/assets/css/game.css @@ -513,14 +513,10 @@ h3 { .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; @@ -530,19 +526,49 @@ h3 { .store-list .name { font-weight: bold; } +.requirements { + margin-top: 0.5rem; + line-height: 1.3rem; +} .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 { - width: 75px; - margin: 0.3rem; - align-items: center; - display: flex; - flex-direction: column; + width: 100%; + position: absolute; + bottom: 0; } .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; } diff --git a/public/assets/img/icons/equipment/adventurers_sword.png b/public/assets/img/icons/equipment/adventurers_sword.png new file mode 100755 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 index 0000000..15912f6 Binary files /dev/null and b/public/assets/img/icons/equipment/well_used_sword.png differ diff --git a/public/index.html b/public/index.html index e2efaa0..746e2c3 100644 --- a/public/index.html +++ b/public/index.html @@ -66,7 +66,7 @@
-
+
diff --git a/src/server/api.ts b/src/server/api.ts index 35ba7e3..8a7eec8 100644 --- a/src/server/api.ts +++ b/src/server/api.ts @@ -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 {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'; @@ -466,7 +466,7 @@ app.get('/player/inventory', authEndpoint, async (req: AuthRequest, res: Respons 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; @@ -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)); }); -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) @@ -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)); }); +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); + const travelPlan = await getTravelPlan(req.player.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) { - // ok lets display the fight screen! 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); - res.send(renderPlayerBar(req.player, equippedItems) + renderFightPreRound(data, true, location)); + + res.send(renderPlayerBar(req.player, equippedItems) + renderFightPreRound(data, true, location, closestTown)); } else { - const travelPlan = await getTravelPlan(req.player.id); 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 monster = await getRandomMonster([closest]); + const monster = await getRandomMonster([closestTown]); 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, - closestTown: closest, + closestTown: closestTown, walkingText: '', travelPlan })); @@ -893,7 +903,7 @@ app.post('/fight', authEndpoint, async (req: AuthRequest, res: Response) => { 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) => { diff --git a/src/server/views/fight.ts b/src/server/views/fight.ts index 1995d9a..400a7d8 100644 --- a/src/server/views/fight.ts +++ b/src/server/views/fight.ts @@ -19,8 +19,9 @@ export function renderRoundDetails(roundData: FightRound): string { } break; case 'monster': - // prompt to return to town and don't let them do anything - html.push(`

You were killed...

`); + if(roundData.player.hp === 0) { + html.push(`

You were killed...

`); + } html.push('

'); break; case 'in-progress': @@ -68,10 +69,11 @@ export function renderFight(monster: MonsterForFight, results: string = '', disp 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 = ` +
${location.city_name}
@@ -105,7 +107,9 @@ export function renderFightPreRound(monster: MonsterForFight, displayFightActio
-`; + +
+`; return html; } diff --git a/src/server/views/inventory.ts b/src/server/views/inventory.ts index c027dd0..adf4105 100644 --- a/src/server/views/inventory.ts +++ b/src/server/views/inventory.ts @@ -93,8 +93,7 @@ function generateProgressBar(current: number, max: number, color: string, displa function renderInventoryItem(item: EquippedItemDetails , action: (item: EquippedItemDetails) => string): string { return `
-
- +
${item.name}
@@ -117,7 +116,7 @@ function renderInventoryItem(item: EquippedItemDetails , action: (item: Equipped
${item.hasOwnProperty('id') ? `
${item.cost.toLocaleString()}G
` : ''}
-
+
${action(item)}
`; diff --git a/src/server/views/map.ts b/src/server/views/map.ts index 76a546b..e432ebd 100644 --- a/src/server/views/map.ts +++ b/src/server/views/map.ts @@ -39,6 +39,7 @@ export async function renderMap(data: { city: City, locations: Location[], paths
+
`; return html; diff --git a/src/server/views/player-bar.ts b/src/server/views/player-bar.ts index 3b57789..d02ea68 100644 --- a/src/server/views/player-bar.ts +++ b/src/server/views/player-bar.ts @@ -75,7 +75,7 @@ function progressBar(current: number, max: number, id: string, opts: ProgressBar } return `
${current}/${max} - ${percent}
`; +title="${percent}% - ${current}/${max}">${current}/${max} - ${percent}%`; } export function renderPlayerBar(player: Player, inventory: EquippedItemDetails[]): string { diff --git a/src/server/views/stores.ts b/src/server/views/stores.ts index 08745f7..81b2273 100644 --- a/src/server/views/stores.ts +++ b/src/server/views/stores.ts @@ -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 `
-
- +
+
${action(item)}
${item.name}
${item.description}
- ${item.hasOwnProperty('id') ? `
${item.price_per_unit.toLocaleString()}G
` : ''} -
-
- ${action(item)} + ${item.hasOwnProperty('id') ? `
${item.price_per_unit.toLocaleString()}G
` : ''}
`; } @@ -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())}
- ${item.hasOwnProperty('id') ? `
${item.cost.toLocaleString()}G
` : ''} + ${item.hasOwnProperty('id') ? `
${item.cost.toLocaleString()}G
` : ''} ` @@ -67,13 +64,10 @@ export function renderEquipmentDetails(item: ShopEquipment, player: Player): str function renderShopEquipment(item: ShopEquipment, action: (item: ShopEquipment) => string, player: Player): string { return `
-
- +
+
${action(item)}
${renderEquipmentDetails(item, player)} -
- ${action(item)} -
`; } diff --git a/src/shared/player.ts b/src/shared/player.ts index 7762a41..ca94496 100644 --- a/src/shared/player.ts +++ b/src/shared/player.ts @@ -26,7 +26,7 @@ export type PlayerWithSkills = Player & { } 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 {