Skip to content

bank

Opens the players' bank boxes, as a banker does.

Source: src/Moongate.Server.Ultima/Modules/BankModule.cs

bank.attend(player) -> boolean

Whether the caller is the one that serves the player now: true for the first that asks, false for whoever asks again within half a second. Several bankers behind one counter hear the same words in the same moment: each asks, one answers, and the gold moves once. False for an NPC or a player not in the world.

ParameterTypeDefault
playerinteger

Returns boolean.

bank.balance(player) -> integer?

The gold in the player's bank: the coins anywhere inside its bank box, bags included, and what the bank checks there are worth; 0 for a player who never opened its bank; nil for an NPC or a player not in the world. The box need not be open.

ParameterTypeDefault
playerinteger

Returns integer?.

bank.cash(player, check) -> BankResultType

Turns a bank check lying inside the player's bank box, in the box or in a bag of it, into coins of the box: the gold piles there are topped up and piles of 60000 are made. Gives a BankResultType: Ok when gold went in, all of it and the check is gone, or what the box had room for and the check keeps the rest (bank.worth before and after tells how much went in); BankFull when nothing fits; NotInBank for an item that is not a check or is not inside that player's bank box; NoBank, Busy or NoPlayer. It does not ask whether the box is open: an item script's on_use is not called for an item of a closed bank.

ParameterTypeDefault
playerinteger
checkinteger

Returns BankResultType.

bank.check(player, amount) -> BankResultType

Writes a bank check worth amount, paid with the coins of the player's bank and put in its bank box, and gives a BankResultType: Ok, BadAmount (not a whole number above 0), CheckTooSmall (below ultima.bank.min_check), CheckTooBig (above ultima.bank.max_check), NoBank (the player never opened its bank), NotEnoughGold (coins only: another check does not pay a check), BankFull (the box holds ultima.bank.max_items and no gold pile is used up to leave its place), Busy (try again in a moment) or NoPlayer. All or nothing. The check is an item of the template bank_check; bank.worth reads what it is worth.

ParameterTypeDefault
playerinteger
amountnumber

Returns BankResultType.

bank.deposit(player, amount) -> BankResultType

Moves amount coins from the player's backpack and its bags to its bank box, topping up the gold piles of the box and then making piles of 60000, and gives a BankResultType: Ok, BadAmount (not a whole number above 0), NoBank (the player never opened its bank: bank.open makes it), NotEnoughGold, BankFull (the box holds ultima.bank.max_items), Busy (try again in a moment) or NoPlayer (an NPC or a player not in the world). All or nothing: a refusal moves no coin. The box need not be open.

ParameterTypeDefault
playerinteger
amountnumber

Returns BankResultType.

bank.deposit_item(player, item) -> BankResultType

Puts a gold pile or a bank check into the player's bank box, as a banker does with what is dropped on it (on_drag_drop): the gold tops up the piles of the box and what is left is a pile of its own, a check goes in worth the same. Gives a BankResultType: Ok (the item handed over is gone: return true from on_drag_drop), NotMoney (not gold nor a bank check, not there, worn, on a cursor or carried by someone else), NoBank (the player never opened its bank: bank.open makes it), BankFull (the box holds ultima.bank.max_items), Busy (try again in a moment) or NoPlayer. All or nothing. bank.balance before and after tells how much went in. The box need not be open.

ParameterTypeDefault
playerinteger
iteminteger

Returns BankResultType.

bank.is_open(player) -> boolean

Whether the player's bank box is open: the player has not moved since it opened; false for an NPC or a player not in the world.

ParameterTypeDefault
playerinteger

Returns boolean.

bank.open(player) -> boolean

Opens the player's bank box, made the first time; it stays open while the player stands still. False for an NPC or a player not in the world.

ParameterTypeDefault
playerinteger

Returns boolean.

bank.withdraw(player, amount) -> BankResultType

Moves amount coins from the player's bank to its backpack, onto a gold pile already there when it fits; the coins of the bank go first and the bank checks give the rest, one used up is gone and the last keeps what is left. Gives a BankResultType: Ok, BadAmount (not a whole number above 0), TooMuch (more than ultima.bank.max_withdraw), NoBank (the player never opened its bank: bank.open makes it), NotEnoughGold, BackpackFull (no backpack, no room for a new pile, or a backpack already at its weight: one that is not takes the gold whatever it weighs, and the player may walk away overloaded), Busy (try again in a moment) or NoPlayer (an NPC or a player not in the world). All or nothing: a refusal moves no coin. The box need not be open, and the function does not check where the player stands or who it is: a banker script checks the distance and mobile.criminal first.

ParameterTypeDefault
playerinteger
amountnumber

Returns BankResultType.

bank.worth(item) -> integer?

What a bank check is worth in gold; nil for an item that is not a bank check, or is not there.

ParameterTypeDefault
iteminteger

Returns integer?.

Made with ❤️ by Tom

Buy me a coffee