import { formatQuantity } from "../definitions/items.js"; /** @param {number} copper */ export function formatBountyCopper (copper) { const amount = Math.max(0, Math.floor(Number(copper) || 0)); return formatQuantity(amount); } /** * @param {{ killerName: string, victimName: string, amountCopper: number }} opts */ export function bountyPayoutLetterBody ({ killerName, victimName, amountCopper }) { const killer = String(killerName ?? "Adventurer").trim() || "Adventurer"; const victim = String(victimName ?? "someone").trim() || "someone"; const amount = formatBountyCopper(amountCopper); return [ `Dear ${killer},`, "", `For defeating ${victim}, a bounty of ${amount} has been paid into your bank vault.` ].join("\n"); }