UNPKG

osrs-tools

Version:

A comprehensive TypeScript library for Old School RuneScape (OSRS) data and utilities, including quest data, skill requirements, and game item information

24 lines 712 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NpcDrop = void 0; class NpcDrop { constructor(item, quantity, // single or range rarity) { this.item = item; this.quantity = quantity; this.rarity = rarity; this.rarityFraction = NpcDrop.parseRarity(rarity); } static parseRarity(rarity) { if (rarity.toLowerCase() === 'always') return 1; const match = rarity.match(/^(\d+)\/(\d+)$/); if (match) { const [, num, denom] = match; return Number(num) / Number(denom); } return undefined; } } exports.NpcDrop = NpcDrop; //# sourceMappingURL=NpcDrop.js.map