+app.post('/travel/return-to-source', authEndpoint, async (req: AuthRequest, res: Response) => {
+ // puts the player back in their starting town
+ // doesn't matter if they don't have one
+ // redirect them!
+ await clearTravelPlan(req.player.id);
+ const equippedItems = await getEquippedItems(req.player.id);
+
+ const fight = await loadMonsterFromFight(req.player.id);
+ if(fight) {
+ // go to the fight screen
+ const data: MonsterForFight = {
+ id: fight.id,
+ hp: fight.hp,
+ maxHp: fight.maxHp,
+ name: fight.name,
+ level: fight.level,
+ fight_trigger: fight.fight_trigger
+ };
+ const location = await getMonsterLocation(fight.ref_id);
+
+ res.send(renderPlayerBar(req.player, equippedItems) + renderFightPreRound(data, true, location, req.player.city_id));
+ }
+ else {
+ const [city, locations, paths] = await Promise.all([
+ getCityDetails(req.player.city_id),
+ getAllServices(req.player.city_id),
+ getAllPaths(req.player.city_id)
+ ]);
+
+ res.send(renderPlayerBar(req.player, equippedItems) + await renderMap({city, locations, paths}, req.player.city_id));
+
+ }
+
+});
+