From: xangelo Date: Mon, 18 Dec 2023 05:10:50 +0000 (-0500) Subject: fix: refs to minLevel and maxLevel columns not being quoted in queries X-Git-Tag: v0.4.2~13 X-Git-Url: https://git.xangelo.ca/?a=commitdiff_plain;h=b63354fe23df2145e8e6c4c15531ef7a9590157d;p=risinglegends.git fix: refs to minLevel and maxLevel columns not being quoted in queries --- 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; }