Skip to content

CoreLib Actions

Once enabled, EmakiStorage appends 5 warehouse actions to the CoreLib action registry. They can be used in other modules' rewards, triggers, scripts or action templates to move items, grant slots or adjust the per-slot ceiling.

This page only documents the actions EmakiStorage registers; for CoreLib's own generic actions see CoreLib Action System.

Every Storage action uses the source emakistorage and the category storage.

Action Overview

Action IDDescription
storage-depositStores items into the acting player's warehouse.
storage-withdrawWithdraws items from the acting player's warehouse.
storage-grant-slotGrants or reclaims granted slots.
storage-unlock-slotAdds purchased slots without charging.
storage-set-stacklimitSets the player-level or entry-level per-slot ceiling.

All five act on the action context player and have no target parameter. All of them require that player's storage to be loaded in memory; otherwise they fail with EXECUTION_EXCEPTION and the message Storage data is not loaded for this player..

storage-deposit

Stores items into the warehouse without touching any inventory.

ParameterTypeRequiredDefaultDescription
itemSTRINGYesCoreLib ItemSource token.
amountINTEGERNo1Units to store; must be positive.

Returned data keys:

KeyDescription
storedHow many units were actually stored. May be less than requested (partial deposit).

Failure cases:

  • Storage data is not loaded.
  • item cannot be resolved into an ItemSource (INVALID_ARGUMENT, Unknown item source: ...).
  • amount is not positive (INVALID_ARGUMENT, amount must be positive).
  • The transaction was rejected: EXECUTION_EXCEPTION with the message Deposit rejected: <reasonKey>. Common reasonKey values are filtered (rejected by the deposit filter), unique_rejected (unique-marked item while allow_unique_items: false), no_free_slot (a new entry is needed but slots are full) and slot_full (the per-slot ceiling is reached).
yaml
actions:
  - 'storage-deposit item=diamond amount=64'

storage-withdraw

Withdraws items from the warehouse and hands them to the player. Entries are located by full ItemStack#equals.

ParameterTypeRequiredDefaultDescription
itemSTRINGYesCoreLib ItemSource token.
amountINTEGERNo1Units to withdraw; must be positive.

Returned data keys:

KeyDescription
withdrawnHow many units were actually withdrawn.

Failure cases:

  • Storage data is not loaded.
  • item cannot be resolved (INVALID_ARGUMENT).
  • amount is not positive (INVALID_ARGUMENT).
  • The transaction was rejected, with the message Withdrawal rejected: <reasonKey>. Common reasonKey values are entry_missing (no such entry in the warehouse) and inventory_full (the inventory refused the items and, with overflow_on_withdraw: return, the remainder was credited back).

Withdrawal debits storage before handing anything out. The reverse order would allow a successful hand-out followed by a failed debit, which is item duplication; in this order the worst case is the player receiving less than requested, and that surplus is credited straight back.

yaml
actions:
  - 'storage-withdraw item=diamond amount=16'

storage-grant-slot

Adjusts the granted slot pool, intended for level and codex reward flows.

ParameterTypeRequiredDefaultDescription
amountINTEGERYesSlots to grant. Negative values reclaim slots.

Returned data keys:

KeyDescription
granted_slotsThe granted slot total after the adjustment.

Failure cases:

  • Storage data is not loaded.
  • amount is 0 (INVALID_ARGUMENT, amount must be non-zero).

This action writes an ADMIN_GIVE flow record, which is always logged regardless of logging.enabled and logging.sources.

yaml
actions:
  - 'storage-grant-slot amount=10'
  - 'storage-grant-slot amount=-5'

storage-unlock-slot

Adds purchased slots without charging, for reward flows. Unlike storage-grant-slot, it increases the purchasedSlots pool, which shifts the starting ordinal for later per-slot pricing.

ParameterTypeRequiredDefaultDescription
amountINTEGERYesSlots to unlock; must be positive.

Returned data keys:

KeyDescription
purchased_slotsThe purchased slot total after the adjustment.

Failure cases:

  • Storage data is not loaded.
  • amount is not positive (INVALID_ARGUMENT, amount must be positive).

This action writes an UNLOCK flow record with the note cost=none.

yaml
actions:
  - 'storage-unlock-slot amount=5'

storage-set-stacklimit

Sets the player-level or entry-level per-slot ceiling.

ParameterTypeRequiredDefaultDescription
limitINTEGERYesThe new ceiling; must be >= 0. 0 inherits the next level.
slotINTEGERNo-1Logical slot index. -1 (or any negative value) sets the player-level default.

Returned data keys:

CaseKeyDescription
slot negativedefault_stack_limitThe player-level ceiling after the change.
slot non-negativeslotThe slot index that was changed.
slot non-negativestack_limitThe entry-level ceiling after the change.

Failure cases:

  • Storage data is not loaded.
  • limit is negative (INVALID_ARGUMENT, limit must be zero or positive).
  • slot is non-negative but that slot holds no entry (INVALID_ARGUMENT, No entry at slot <n>).

The meaning of 0 depends on the level: at entry and player level it inherits the next level, while 0 at the config level (capacity.default_stack_limit) means unlimited. The three-level inheritance rules are in Configuration.

This action writes an ADMIN_SET flow record, which is always logged.

yaml
actions:
  - 'storage-set-stacklimit limit=100000'
  - 'storage-set-stacklimit limit=5000 slot=3'
  - 'storage-set-stacklimit limit=0'
  • Configuration: three-level stackLimit, the deposit filter and per-slot pricing.
  • API and Integration: the code integration entry point for the same capabilities plus StorageResult statuses.