From b63354fe23df2145e8e6c4c15531ef7a9590157d Mon Sep 17 00:00:00 2001 From: xangelo Date: Mon, 18 Dec 2023 00:10:50 -0500 Subject: [PATCH] fix: refs to minLevel and maxLevel columns not being quoted in queries --- src/server/monster.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/monster.ts b/src/server/monster.ts index a0b7aac..ced4834 100644 --- a/src/server/monster.ts +++ b/src/server/monster.ts @@ -44,7 +44,7 @@ export async function loadMonsterWithFaction(player_id: string): Promise { - const res = await db.raw('select id,name,level from monsters where location_id in (select id from locations where city_id in (?)) order by random() limit 1', [city_id.join(',')]) + const res = await db.raw('select id,name,floor(random() * ("maxLevel"-"minLevel"+1) + 1) as level from monsters where location_id in (select id from locations where city_id in (?)) order by random() limit 1', [city_id.join(',')]) return res.rows[0] as MonsterForList; } -- 2.25.1