API:SendGuildVaultCommand
From RoR Wiki
UI Lua API · Guild functions
Version: WAR 1.4.8
Sends a guild vault command to the server: move an item, deposit or withdraw money, lock or unlock a slot, close the vault, or buy a vault expansion.
SendGuildVaultCommand(command, arg1, arg2, arg3, arg4, flag)
Arguments
- command
number– ASystemData.GuildVaultCommandsvalue:MOVE_ITEM(1),GIVE_COIN(2),TAKE_COIN(3),SLOT_LOCK(4),SLOT_UNLOCK(5),CLOSE(6),PURCHASE_EXPANSION(7).- arg1, arg2, arg3, arg4
number– Command arguments, see the table below. Unused ones must still be numbers (the stock UI passes 0).- flag
boolean– Only used byMOVE_ITEM, see below.
| Command | arg1 | arg2 | arg3 | arg4 |
|---|---|---|---|---|
MOVE_ITEM |
source | source slot | destination | destination slot |
GIVE_COIN, TAKE_COIN |
amount of money (in brass) | – | – | – |
SLOT_LOCK, SLOT_UNLOCK |
vault number | slot | – | – |
CLOSE |
– | – | – | – |
PURCHASE_EXPANSION |
vault number | expansion cost | – | – |
Returns
Nothing.
Details
- Every command also sends the guild NPC id that the client reads from the Lua variable
InteractionWindowGuildCreateForm.GuildNPC_ID. - Slots are passed 1-based, as the stock UI uses them; the client converts them before sending. For
PURCHASE_EXPANSIONthe second value is sent unchanged. MOVE_ITEMsources and destinations 1–5 are vault numbers. Other values refer to the player's backpacks: the stock UI passes 0 for the main backpack, or the backpack type plusGuildVaultWindow.MAX_VAULTS(5). The client turns these into inventory slot numbers.- For
MOVE_ITEMinto a vault (destination 1–5),flag = truesends the destination slot without the 1-based conversion. For other destinationsflagis ignored. - Any other
commandvalue sends nothing. - If there is no player object, or the Lua state is not available, nothing is sent.
- The function needs at least six arguments and only reads the last six.
flagmust be a real boolean.
Errors
None besides the generic Invalid Parameters message when an argument has the wrong type.
Example
From default/ea_guildvaultwindow/source/guildvaultwindow.lua:
function GuildVaultWindow.OnClose() -- Registered Event Trigger (User closed the window)
SendGuildVaultCommand(SystemData.GuildVaultCommands.CLOSE, 0, 0, 0, 0, false)
GuildVaultWindow.Hide()
end
Depositing money and locking a slot, from the same file:
SendGuildVaultCommand(SystemData.GuildVaultCommands.GIVE_COIN, money, 0, 0, 0, false) ... SendGuildVaultCommand(SystemData.GuildVaultCommands.SLOT_LOCK, GuildVaultWindow.SelectedVault, buttonIndex, 0, 0, false)
