Skip to content

jail

The jail of data/jail.toml: its cells and who is in them, sending a player or an NPC to a cell for some days, and releasing it early. The module does not check who calls it: a script that is for the staff checks world.is_staff first.

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

jail.cells() -> table

The cells of the jail in file order, as an array of { number, x, y, z, map } (map is the MapType number of the jail, for mobile.teleport); a cell that holds a prisoner also has prisoner (its serial), name, seconds_left, reason (empty when none was given) and pending. pending is true for a cell kept for a player who was offline when it was jailed and has not logged in since: nobody is inside yet, and seconds_left is the whole sentence. An empty array when there is no data/jail.toml. A cell whose sentence is over is free, even while its prisoner is offline.

Returns table.

jail.max_days() -> integer

The longest sentence in days, from the setting ultima.jail.max_days.

Returns integer.

jail.release(serial) -> boolean

Ends the sentence of the mobile now, with no fine and no release note: a prisoner in the world goes back at once where it was arrested, a player who is offline at its next login. False when the mobile is not in jail.

ParameterTypeDefault
serialinteger

Returns boolean.

jail.send(serial, cell, days, by, reason?) -> JailResultType

Sends the mobile, a player or an NPC, to the cell for that many real days, in the name of by, and gives a JailResultType: Ok, Pending, Disabled (no data/jail.toml), NoSuchCell, CellOccupied, BadDays (not a whole number from 1 to jail.max_days()), NotInWorld (the mobile or by), Refused (by itself, or a player of by's rank or above) or MapNotLoaded. The optional reason is kept as one line of at most 100 characters, told to the mobile and written on its release note. The mobile is told the days, goes back where it was when they are over, pays the fine of ultima.jail.fine_gold and gets a release note. A mobile already in jail moves to the cell with a sentence that starts now. A player who is offline can be sent only after .jail <name> found it: the answer is Pending, the cell is kept for it, and at its next login it is taken there and its days start; any other serial that is not in the world is NotInWorld.

ParameterTypeDefault
serialinteger
cellnumber
daysnumber
byinteger
reason (optional)stringnil

Returns JailResultType.

jail.sentence(serial) -> table?

The sentence of the mobile as { cell, days, seconds_left, by, reason, pending }, by being the name of who jailed it and reason what it gave, empty for none; nil when it is not in jail. seconds_left is 0 for a sentence that is over and waits for its prisoner to come back. pending is true for a sentence given to a player who was offline and has not logged in since: its days have not started, and seconds_left is its whole length.

ParameterTypeDefault
serialinteger

Returns table?.

Made with ❤️ by Tom

Buy me a coffee