INNER CODE UNIT · JavaScript
amount
nyxxbit/discord-quest-completer · index.js:202
const amount = v => (typeof v === 'number' && Number.isFinite(v) && v > 0 ? v : 0);
let orbs = 0, premium = 0;
for (const r of rewards) {
const base = amount(r?.orbQuantity);
if (!base) continue;
orbs += base;
premium += amount(r?.premiumOrbQuantity) || base;
}
return orbs > 0 ? { orbs, premium } : null;
};
// Whether Discord pays this account the premium figure. Discord's own quest card decides
// with canUseMoreQuestOrbs on its premium feature module, which covers Nitro and Xbox Game
// Pass alike, so the same function is called with the signed-in user. When the module is
// missing or the call throws the answer is false and the base figure is shown, since
// under-promising is the safe side for a number used to pick what to farm.
const canUseMoreQuestOrbs = () => {