1 import { max } from "lodash";
2 import { LocationWithCity } from "../../shared/map";
3 import { Monster, MonsterForFight } from "../../shared/monsters";
4 import { BackToTown } from "./components/button";
6 export function renderOnlyMonsterSelector(monsters: Monster[] | MonsterForFight[], activeMonsterId: number = 0, location?: LocationWithCity): string {
8 <div class="city-title-wrapper">
9 <div class="city-title">${location?.city_name}</div>
11 <div class="city-details">
12 <h3 class="location-name"><span>${location?.name}</span></h3>
13 ${renderMonsterSelector(monsters, activeMonsterId, location)}
20 export function renderMonsterSelector(monsters: Monster[] | MonsterForFight[], activeMonsterId: number = 0, location?: LocationWithCity): string {
22 <div class="service-in-town"><form id="fight-selector" hx-post="/fight" hx-target="#explore">
23 <input type="hidden" name="fightTrigger" value="explore">
24 <select id="monsterId" name="monsterId">
25 ${monsters.map((monster: (any)) => {
26 const range = [monster?.minLevel, monster?.maxLevel];
27 return `<option value="${monster.id}" ${monster.id === activeMonsterId ? 'selected': ''}>${monster.name} (LVL ${range[0]} - ${range[1]})</option>`;
29 </select> <button type="submit" class="red">Fight</button></form>