The daily gift
phantom.aj.dailyGiftThings you own
The daily gift and the spin wheel.
Scripts and plugins
A script has all of it, as phantom.aj.dailyGift, and so does a plugin, from ctx.phantom(): the SDK runs in the plugin's own frame. Each call is marked with what it needs: game:read for what the area knows and hears, which "game": "read" in the manifest grants, and game:act for doing things in it as the player, which needs "game": "act" (see Permissions).
Overview
| Member | What it does | Plugins |
|---|---|---|
close() | Closes the popup without answering it, as its X does, and resolves once it is down. | game:act |
closeWheel() | Closes the gem wheel, as its X does, and resolves once it is down. | game:act |
current() | The gift popup on screen, or null when none is up. | game:read |
keep() | Keeps what the popup shows, with the button the client shows for it, and resolves once the client has taken it: the popup down, or, after a day's extra diamond, the present behind it up (more). | game:act |
open() | Puts the gift popup up (GuiManager.openDailyGift) for day, today's by default, and resolves once it is on screen. | game:act |
openWheel() | Puts the gem wheel up (GuiManager.openGemBonusWheel), as the login does on a day with no gift, and resolves once it is ready to spin. | game:act |
reject() | Refuses the gift, as its reject button does, and resolves once the popup is down. | game:act |
spinWheel() | Spins the gem wheel, as its button does (GemBonusSpinWheel.onSpinBtn), and resolves with what it landed on once the server answered, while it is still turning. | game:act |
status() | Where the account stands: today's day, the days opened, what is owed and what is up. | game:read |
take() | Takes today's gift whole, as the player would: unwraps it and keeps every part of it, the extra diamond first. | game:act |
unwrap() | Opens the present on the popup, as clicking it does (DailyGiftManager.setupGiftPopup), and resolves with what it pays once the client shows it. | game:act |
onGift() | Hears a day's gift recorded as opened (stat 458 changing), with every day opened since. | game:read |
onReady() | Hears the daily gift become ready to answer, the present or the gem wheel, including one already up when this starts listening (told once, just after). | game:read |
onWheelSpin() | Hears the gem wheel spun, with what it landed on, once the server answered the spin. | game:read |
Methods
close
close(options?: ActOptions) => Promise<void>Closes the popup without answering it, as its X does, and resolves once it is down.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
closeWheel
closeWheel(options?: ActOptions) => Promise<void>Closes the gem wheel, as its X does, and resolves once it is down. Throws REFUSED while it spins (its X is off) and NOT_READY with no wheel up. Closing it unspun gives up the spin for this sitting.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
current
current() => Promise<OpenDailyGift | null>The gift popup on screen, or null when none is up.
Returns
Promise<OpenDailyGift \| null>
Types
keep
keep(options?: ActOptions) => Promise<DailyGiftKept>Keeps what the popup shows, with the button the client shows for it, and resolves once the client has taken it: the popup down, or, after a day's extra diamond, the present behind it up (more). Throws NOT_READY when there is no unwrapped gift.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<DailyGiftKept>
Types
open
open(options?: ActOptions & { day?: number | undefined; }) => Promise<OpenDailyGift>Puts the gift popup up (GuiManager.openDailyGift) for day, today's by default, and resolves once it is on screen. Whether a gift is really owed is the server's to say when it is kept.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions & { day?: number | undefined; } |
Returns
Promise<OpenDailyGift>
Types
openWheel
openWheel(options?: ActOptions) => Promise<void>Puts the gem wheel up (GuiManager.openGemBonusWheel), as the login does on a day with no gift, and resolves once it is ready to spin. Throws REFUSED when today's spin is not owed: a wheel spun then shows a win the server never pays.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
reject
reject(options?: ActOptions) => Promise<void>Refuses the gift, as its reject button does, and resolves once the popup is down.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
spinWheel
spinWheel(options?: ActOptions) => Promise<GemWheelSpin>Spins the gem wheel, as its button does (GemBonusSpinWheel.onSpinBtn), and resolves with what it landed on once the server answered, while it is still turning. Throws NOT_READY with no wheel up, REFUSED when it was already spun.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<GemWheelSpin>
Types
status
status() => Promise<DailyGiftStatus>Where the account stands: today's day, the days opened, what is owed and what is up.
Returns
Promise<DailyGiftStatus>
Types
take
take(options?: ActOptions) => Promise<DailyGiftTaken>Takes today's gift whole, as the player would: unwraps it and keeps every part of it, the extra diamond first. Throws NOT_READY when no gift popup is up.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<DailyGiftTaken>
Types
unwrap
unwrap(options?: ActOptions) => Promise<OpenDailyGift>Opens the present on the popup, as clicking it does (DailyGiftManager.setupGiftPopup), and resolves with what it pays once the client shows it.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<OpenDailyGift>
Types
Events
onGift
onGift(listener: (opened: number[]) => void) => () => voidHears a day's gift recorded as opened (stat 458 changing), with every day opened since.
Parameters
| Name | Type | |
|---|---|---|
listener | (opened: number[]) => void |
Returns
() => void. Call it to stop listening.
onReady
onReady(listener: (ready: DailyGiftReady) => void) => () => voidHears the daily gift become ready to answer, the present or the gem wheel, including one already up when this starts listening (told once, just after).
Parameters
| Name | Type | |
|---|---|---|
listener | (ready: DailyGiftReady) => void |
Returns
() => void. Call it to stop listening.
Types
onWheelSpin
onWheelSpin(listener: (spin: GemWheelSpin) => void) => () => voidHears the gem wheel spun, with what it landed on, once the server answered the spin.
Parameters
| Name | Type | |
|---|---|---|
listener | (spin: GemWheelSpin) => void |
Returns
() => void. Call it to stop listening.
Types
Types
The types the calls above take and give, with every field. Import any of them in a plugin from @phantomclient/plugin/sdk, or use them as they are in a script.
DailyGiftStatus
Where the account stands with the daily gift, in one read.
| Field | Type | |
|---|---|---|
today | number | null | Today's day of the run, from 0 (clientInfo.dailyGiftIndex); null on a day with none. |
daysInCycle | number | How many days the run is (GuiManager.DAILY_GIFT_NUM_DAYS). |
opened | number[] | The days of the run already opened, from 0 (stat 458, a bit a day). |
owed | boolean | Whether today's gift is still owed. |
wheelOwed | boolean | Whether today's gem wheel spin is still owed (stat 214 against clientInfo.jamaaDate). |
gift | OpenDailyGift | null | The gift popup on screen, or null. |
wheel | boolean | Whether the gem wheel is up. |
spin | GemWheelSpin | null | What the wheel on screen landed on, or null before a spin. |
OpenDailyGift
The gift popup as it stands on screen.
| Field | Type | |
|---|---|---|
day | number | Which day of the run it is for, from 0 (DailyGiftManager._giftIndex). |
kind | DailyGiftKind | null | What the present on screen pays; null before it is unwrapped. |
gems | number | The gems it pays; 0 when it pays something else. |
diamonds | number | The diamonds it pays, the extra diamond some days carry included; 0 when none. |
GemWheelSpin
What the gem wheel landed on, as GemBonusSpinWheel.setupValuesAndSpin works it out.
| Field | Type | |
|---|---|---|
kind | "gems" | "diamonds" | "gift" | gems, diamonds (the member's wheel), or gift, a present handed over with popups. |
landed | number | The number on the slot it stopped at: gems or diamonds, 0 for a gift. |
multiplier | number | The bonus for coming back day after day, from 1 to 3. |
total | number | What the player gets: the slot times the bonus, or the number of gifts. |
ActOptions
How long something that acts may take, and what may end it first.
| Field | Type | |
|---|---|---|
timeoutMs optional | number | undefined | 10 seconds by default. |
signal optional | AbortSignal | undefined |
DailyGiftKept
What one answer to the gift came to.
| Field | Type | |
|---|---|---|
kind | DailyGiftKind | What was kept. |
more | boolean | The gift has another part to answer: the present after a day's extra diamond. |
DailyGiftKind
What a gift on screen pays, as its GiftPopup._giftType says.
type DailyGiftKind = 'gems' | 'diamonds' | 'clothing' | 'den-item'DailyGiftTaken
Everything a day's gift paid, kept by take.
| Field | Type | |
|---|---|---|
day | number | |
kinds | DailyGiftKind[] | |
gems | number | |
diamonds | number |
DailyGiftReady
What the daily gift has ready: the present, or the gem wheel standing in for it.
| Field | Type | |
|---|---|---|
kind | "gift" | "wheel" |