@lucent/consumables
Buy finished potions or craft consumables.
Documented version: 0.0.1.
const consumables = require("@lucent/consumables");
Exports
ensure()
Gets the requested quantities of potions and scrolls, using banked stock first.
consumables.ensure(requests: readonly ConsumableRequest[], options?: ConsumableOptions | undefined): ScriptGenerator<void>
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
requests |
readonly ConsumableRequest[] |
Consumables and inventory targets, including existing banked stock. | ||
options |
ConsumableOptions | undefined |
Acquisition methods and limits shared across the entire call. |
Returns: void
Example
const consumables = require("@lucent/consumables");
module.exports = function* run() {
yield* consumables.ensure([{ item: "Potent Honor Potion", quantity: 50 }]);
};
potionNames
All supported potion names.
consumables.potionNames: readonly PotionName[]
Returns: readonly PotionName[]
scrollNames
All supported scroll names.
consumables.scrollNames: readonly ScrollName[]
Returns: readonly ScrollName[]
Types
ConsumableOptions
Acquisition methods and limits shared across all requested consumables.
interface ConsumableOptions {
/** Buy finished potions or craft with alchemy. Defaults to buy. Scroll quests are unchanged. */
readonly potionMethod?: "buy" | "craft";
/** How to obtain ingredients. Defaults to farm. */
readonly mode?: "farm" | "buy";
/** Gold spending limit shared across the entire call. Defaults to 1,000,000. */
readonly maxGold?: number;
/** Total alchemy attempt limit, including other potion outcomes. Defaults to 100. */
readonly maxCrafts?: number;
}
ConsumableRequest
A consumable and the total quantity to have in inventory.
interface ConsumableRequest {
/** A supported potion or scroll. */
readonly item: PotionName | ScrollName;
/** Inventory target, including banked stock; capped at the item stack limit. */
readonly quantity: number;
}
PotionName
Potion names accepted by ensure and listed in potionNames.
type PotionName =
| "Judgment Tonic"
| "Fortitude Tonic"
| "Fate Tonic"
| "Sage Tonic"
| "Potent Battle Elixir"
| "Potent Malevolence Elixir"
| "Potent Honor Potion"
| "Unstable Divine Elixir"
| "Potent Revitalize Elixir"
| "Potent Destruction Elixir"
| "Body Tonic"
| "Soul Potion"
| "Unstable Battle Elixir"
| "Unstable Body Tonic"
| "Unstable Fate Tonic"
| "Unstable Keen Elixir"
| "Unstable Mastery Tonic"
| "Unstable Might Tonic"
| "Unstable Wise Tonic"
| "Might Tonic"
| "Malice Potion"
| "Potent Life Potion"
| "Endurance Draught"
| "Felicitous Philtre";
ScrollName
Scroll names accepted by ensure and listed in scrollNames.
type ScrollName =
| "Scroll of Fireball"
| "Scroll of Shadowburn"
| "Scroll of Plasma Bolt"
| "Scroll of Dark Energy"
| "Scroll of Ssikari's Breath"
| "Scroll of Shadow Bolt"
| "Scroll of Diamond Cage"
| "Scroll of Exorcise"
| "Scroll of Acid Rain"
| "Scroll of Heartbeat"
| "Scroll of Corrosion"
| "Scroll of Crushing Wave"
| "Scroll of Wind Strike"
| "Scroll of Arc Lightning"
| "Scroll of Spirit Rend"
| "Scroll of Dark Arc"
| "Scroll of Chains"
| "Scroll of Eclipse"
| "Scroll of Purge"
| "Scroll of Scorched Steel"
| "Scroll of Firebolt"
| "Scroll of Holy Bolt"
| "Scroll of Blessed Shard"
| "Scroll of Frostbite"
| "Scroll of Geyser"
| "Scroll of Fire Flare"
| "Scroll of Frost Flare"
| "Scroll of Plague Flare"
| "Scroll of Charged Flare"
| "Scroll of Doom Flare"
| "Scroll of Holy Flare"
| "Scroll of Blinding Light"
| "Scroll of Guardian Blast"
| "Scroll of Shadowblade"
| "Scroll of Furious Gale"
| "Scroll of Enrage"
| "Scroll of Decay"
| "Scroll of Death Pact"
| "Scroll of Cantor's Lament"
| "Scroll of Pulse Compression"
| "Scroll of Dissonance"
| "Scroll of Soul Crush"
| "Scroll of Void Strike"
| "Scroll of Psychic Wave"
| "Scroll of Chaos Fog"
| "Scroll of Torment"
| "Scroll of Shiftburn"
| "Scroll of Freezing Flame"
| "Scroll of Fire Storm"
| "Scroll of Mystify"
| "Scroll of Wither"
| "Scroll of Underworld"
| "Scroll of Ethereal Slumber"
| "Scroll of Ethereal Curse"
| "Scroll of Dark Grip"
| "Scroll of Weaken"
| "Scroll of Bane"
| "Scroll of Petrify"
| "Scroll of Cripple"
| "Scroll of Life Steal";