INNER CODE UNIT · JavaScript
canUseMoreQuestOrbs
nyxxbit/discord-quest-completer · index.js:219
const canUseMoreQuestOrbs = () => {
try {
const user = Mods.UserStore?.getCurrentUser?.();
return user != null && Mods.Premium?.canUseMoreQuestOrbs?.(user) === true;
} catch {
return false;
}
};
// The figure the account will receive, so a total built from these sits on the same side
// as the per-quest numbers it sums.
const orbPayout = (reward, boosted) => (reward ? (boosted ? reward.premium : reward.orbs) : 0);
const fmtOrbs = (reward, boosted) => (reward ? `${orbPayout(reward, boosted)} Orbs` : '');
// The Orb balance Discord reports for the account, or null for anything that is not a whole
// non-negative number. Zero is a real balance and is kept, unlike a payout of zero.
const orbBalance = v => (typeof v === 'number' && Number.isInteger(v) && v >= 0 ? v : null);