API Reference

As of v2.0.0, this module comes with an API to communicate with TibiaWiki or with the elements of the generated database.

TibiaWiki

The following are classes used to communicate with TibiaWiki through its MediaWiki API.

WikiClient

class tibiawikisql.WikiClient[source]

Contains methods to communicate with TibiaWiki’s API.

classmethod get_category_members(name, skip_index=True)[source]

Generator that obtains entries in a certain category.

Parameters
  • name (str) – The category’s name. Category: prefix is not necessary.

  • skip_index (bool) – Whether to skip index articles or not.

Yields

WikiEntry – Articles in this category.

classmethod get_category_members_titles(name, skip_index=True)[source]

Generator that obtains a list of article titles in a category.

Parameters
  • name (str) – The category’s name. Category: prefix is not necessary.

  • skip_index (bool) – Whether to skip index articles or not.

Yields

str – Titles of articles in this category.

classmethod get_image_info(name)[source]

Gets an image’s info.

It is not required to prefix the name with File:, but the extension is required.

Parameters

name (str) – The name of the image.

Returns

The image’s information.

Return type

Image

classmethod get_images_info(names)[source]

Gets the information of a list of image names.

It is not required to prefix the name with File:, but the extension is required.

Warning

The order of the returned articles might not match the order of the provided names due to an API limitation.

Parameters

names (list[str]) – A list of names of images to get the info of.

Yields

Image – An image’s information.

classmethod get_articles(names)[source]

Generator that obtains a list of articles given their titles.

Warning

The order of the returned articles might not match the order of the provided names due to an API limitation.

Parameters

names (list[str]) – A list of names of articles to get the info of.

Yields

Article – An article in the list of names.

classmethod get_article(name)[source]

Gets an article’s info.

Parameters

name (str) – The name of the Article.

Returns

The article matching the title.

Return type

Article

WikiEntry

class tibiawikisql.WikiEntry[source]

A TibiaWiki entry.

This is a partial object that is obtained when fetching category members.

The following classes implement this:

article_id

int – The entry’s id.

title

str – The entry’s title.

timestamp

int – The date of the entry’s last edit, represented as a unix timestamp.

url

str – The URL to the article’s display page.

Article

class tibiawikisql.Article[source]

Represents a text article.

article_id

int – The article’s internal id.

title

str – The article’s title.

timestamp

int – The date of the entry’s last edit, represented as a unix timestamp.

content

str – The article’s source content.

url

str – The URL to the article’s display page.

Image

class tibiawikisql.Image[source]

Represents an image info

article_id

int – The image’s internal id.

title

str – The image’s title.

timestamp

int – The date of the entry’s last edit, represented as a unix timestamp.

file_url

str – The image’s url.

extension

str – The image’s file extension.

file_name

str – The image’s file name.

clean_name

str – The image’s name without extension and prefix.

url

str – The URL to the article’s display page.

Abstract Base Classes

This classes are used to implemenent common functionality among different classes.

Row

class tibiawikisql.models.Row[source]

An abstract base class implemented to indicate that the Model represents a SQL row.

table

database.Table – The SQL table where this model is stored.

insert(c)[source]

Inserts the current model into its respective database table.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod from_row(row)[source]

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod get_by_field(c, field, value, use_like=False)[source]

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)[source]

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

Parseable

class tibiawikisql.models.Parseable[source]

An abstract base class with the common parsing operations.

This class is inherited by Models that are parsed directly from a TibiaWiki article.

Classes implementing this must override map

article_id

int – The id of the containing article.

title

str – The title of the containing article.

timestamp

int – The last time the containing article was edited.

classmethod from_article(article)[source]

Parses an article into a TibiaWiki model.

Parameters

article (Article) – The article from where the model is parsed.

Returns

An inherited model object for the current article.

Return type

Type[abc.Parseable]

url

str – The URL to the article’s display page.

Models

Achievement

class tibiawikisql.models.Achievement[source]

Represents an Achievement.

article_id

int – The id of the containing article.

title

str – The title of the containing article.

timestamp

int – The last time the containing article was edited.

name

str – The achievement’s name.

grade

int – The achievement’s grade, from 1 to 3. Also know as ‘stars’.

points

int – The amount of points given by this achievement.

description

str – The official description shown for the achievement.

spoiler

str – Instructions or information on how to obtain the achievement.

secret

bool – Whether the achievement is secret or not.

version

str – The client version where this was first implemented.

classmethod from_article(article)

Parses an article into a TibiaWiki model.

Parameters

article (Article) – The article from where the model is parsed.

Returns

An inherited model object for the current article.

Return type

Type[abc.Parseable]

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod get_by_field(c, field, value, use_like=False)

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

insert(c)

Inserts the current model into its respective database table.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

url

str – The URL to the article’s display page.

Creature

class tibiawikisql.models.Creature[source]

Represents a creature.

article_id

int – The id of the containing article.

title

str – The title of the containing article.

timestamp

int – The last time the containing article was edited.

article

str – The article that goes before the name when looking at the creature.

name

str – The name of the creature, as displayed in-game.

class

str – The creature’s classification.

type

str – The creature’s type.

bestiary_class

str – The creature’s bestiary class, if applicable.

bestiary_level

str – The creature’s bestiary level, from ‘Trivial’ to ‘Hard’

bestiary_occurrence

str – The creature’s bestiary occurrence, from ‘Common’ to ‘Very Rare’.

hitpoints

int – The creature’s hitpoints, may be None if unknown.

experience

int – Experience points yielded by the creature. Might be None if unknown.

armor

int – The creature’s armor value.

speed

int – The creature’s speed value.

max_damage

int – The maximum amount of damage the creature can do in a single turn.

summon_cost

int – The mana needed to summon this creature. 0 if not summonable.

convince_cost

int – The mana needed to convince this creature. 0 if not convincible.

illusionable

bool – Whether the creature can be illusioned into using Creature Illusion.

pushable

bool – Whether the creature can be pushed or not.

sees_invisible

bool – Whether the creature can see invisible players or not.

paralysable

bool – Whether the creature can be paralyzed or not.

boss

bool – Whether the creature is a boss or not.

modifier_physical

int – The percentage of damage received of physical damage. None if unknown.

modifier_earth

int – The percentage of damage received of earth damage. None if unknown.

modifier_fire

int – The percentage of damage received of fire damage. None if unknown.

modifier_energy

int – The percentage of damage received of energy damage. None if unknown.

modifier_ice

int – The percentage of damage received of ice damage. None if unknown.

modifier_death

int – The percentage of damage received of death damage. None if unknown.

modifier_holy

int – The percentage of damage received of holy damage. None if unknown.

modifier_drown

int – The percentage of damage received of drown damage. None if unknown.

modifier_lifedrain

int – The percentage of damage received of life drain damage. None if unknown.

abilities

str – A brief description of the creature’s abilities.

walks_through

str – The field types the creature will walk through, separated by commas.

walks_around

str – The field types the creature will walk around, separated by commas.

version

str – The client version where this creature was first implemented.

image

bytes – The creature’s image in bytes.

loot

list of CreatureDrop – The items dropped by this creature.

classmethod from_article(article)[source]

Parses an article into a TibiaWiki model.

This method is overridden to parse extra attributes like loot.

Parameters

article (api.Article) – The article from where the model is parsed.

Returns

The creature represented by the current article.

Return type

Creature

insert(c)[source]

Inserts the current model into its respective database.

This method is overridden to insert elements of child rows.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod get_by_field(c, field, value, use_like=False)[source]

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

url

str – The URL to the article’s display page.

CreatureDrop

class tibiawikisql.models.CreatureDrop[source]

Represents an item dropped by a creature.

creature_id

int – The article id of the creature the drop belongs to.

creature_title

str – The title of the creature that drops the item.

item_id

int – The article id of the item.

item_title

str – The title of the dropped item.

min

int – The minimum possible amount of the dropped item.

max

int – The maximum possible amount of the dropped item.

chance

float – The chance percentage of getting this item dropped by this creature.

insert(c)[source]

Inserts the current model into its respective database.

Overridden to insert using a subquery to get the item’s id from the name.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod get_by_field(c, field, value, use_like=False)

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

House

class tibiawikisql.models.House[source]

Represents a house or guildhall.

article_id

int – The id of the containing article.

title

str – The title of the containing article.

timestamp

int – The last time the containing article was edited.

house_id

int – The house’s id on tibia.com.

name

str – The name of the house.

guildhall

bool – Whether the house is a guildhall or not.

city

str – The city where the house is located.

street

str – The name of the street where the house is located.

beds

int – The number of beds in the house.

rent

int – The monthly rent of the house.

size

int – The number of tiles (SQM) of the house.

rooms

int – The number of rooms the house has.

floors

int – The number of floors the house has.

x

int – The x coordinate of the house.

y

int – The y coordinate of the house.

z

int – The z coordinate of the house.

version

str – The client version where this creature was first implemented.

classmethod from_article(article)

Parses an article into a TibiaWiki model.

Parameters

article (Article) – The article from where the model is parsed.

Returns

An inherited model object for the current article.

Return type

Type[abc.Parseable]

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod get_by_field(c, field, value, use_like=False)

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

insert(c)

Inserts the current model into its respective database table.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

url

str – The URL to the article’s display page.

Imbuement

class tibiawikisql.models.Imbuement[source]

Represents an imbuement type.

article_id

int – The id of the containing article.

title

str – The title of the containing article.

timestamp

int – The last time the containing article was edited.

name

str – The name of the imbuement.

tier

str – The tier of the imbuement.

type

str – The imbuement’s type.

effect

str – The effect given by the imbuement.

version

str – The client version where this imbuement was first implemented.

image

str – The bytes of the imbuement’s image.

materials

list of ImbuementMaterial – The materials needed for the imbuement.

classmethod from_article(article)[source]

Parses an article into a TibiaWiki model.

Parameters

article (Article) – The article from where the model is parsed.

Returns

An inherited model object for the current article.

Return type

Type[abc.Parseable]

insert(c)[source]

Inserts the current model into its respective database table.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod get_by_field(c, field, value, use_like=False)[source]

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

url

str – The URL to the article’s display page.

ImbuementMaterial

class tibiawikisql.models.ImbuementMaterial[source]

Representes a item material for an imbuement.

imbuement_id

int – The article id of the imbuement this material belongs to.

imbuement_title

str – The title of the imbuement this material belongs to.

item_id

int – The article id of the item material.

item_title

str – The title of the item material.

amount

int – The amount of items required.

insert(c)[source]

Inserts the current model into its respective database table.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod get_by_field(c, field, value, use_like=False)

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

Item

class tibiawikisql.models.Item[source]

Represents an Item.

id

int – The id of the containing article.

title

str – The title of the containing article.

timestamp

int – The last time the containing article was edited.

name

str – The in-game name of the item.

article

str – The article that goes before the name when looking at the item.

stackable

bool – Whether the item can be stacked or not.

value_sell

int – The highest price an NPC will buy this item for.

value_buy

int – The lowest price an NPC will sell this item for.

weight

float – The item’s weight in ounces.

class

str – The item class the item belongs to.

type

str – The item’s type

flavor_text

str – The extra text that is displayed when some items are looked at.

version

str – The client version where this item was first implemented.

image

bytes – The item’s image in bytes.

attributes

list of ItemAttribute – The item’s attributes.

dropped_by

list of CreatureDrop – List of creatures that drop this item, with the chances.

sold_by

list of NpcSellOffer – List of NPCs that sell this item.

bought_by

list of NpcBuyOffer – List of NPCs that buy this item.

awarded_in

list of QuestReward – List of quests that give this item as reward.

classmethod from_article(article)[source]

Parses an article into a TibiaWiki model.

Parameters

article (Article) – The article from where the model is parsed.

Returns

An inherited model object for the current article.

Return type

Type[abc.Parseable]

insert(c)[source]

Inserts the current model into its respective database table.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod get_by_field(c, field, value, use_like=False)[source]

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

url

str – The URL to the article’s display page.

ItemAttribute

class tibiawikisql.models.ItemAttribute[source]

Represents an Item’s attribute

item_id

int – The id of the item the attribute belongs to

name

str – The name of the attribute.

value

str – The value of the attribute.

insert(c)[source]

Inserts the current model into its respective database table.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod get_by_field(c, field, value, use_like=False)

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

Key

class tibiawikisql.models.Key[source]

Represents a key item.

article_id

int – The id of the containing article.

title

str – The title of the containing article.

timestamp

int – The last time the containing article was edited.

name

str – The name of the creature, as displayed in-game.

number

int – The key’s number.

item_id

int – The article id of the item this key is based on.

material

str – The key’s material.

location

str – The key’s location.

notes

str – Notes about the key.

origin

str – Notes about the origin of the key.

version

str – The client version where this creature was first implemented.

insert(c)[source]

Inserts the current model into its respective database table.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod from_article(article)

Parses an article into a TibiaWiki model.

Parameters

article (Article) – The article from where the model is parsed.

Returns

An inherited model object for the current article.

Return type

Type[abc.Parseable]

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod get_by_field(c, field, value, use_like=False)

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

url

str – The URL to the article’s display page.

Npc

class tibiawikisql.models.Npc[source]

Represents a non-playable character.

article_id

int – The id of the containing article.

title

str – The title of the containing article.

timestamp

int – The last time the containing article was edited.

name

str – The in-game name of the NPC.

gender

str – The gender of the NPC.

race

str – The race of the NPC.

job

str – The NPC’s job.

location

str – The location of the NPC.

city

str – The city where the NPC is located.

x

int – The x coordinates of the NPC.

y

int – The y coordinates of the NPC.

z

int – The z coordinates of the NPC.

version

str – The client version where the NPC was implemented.

image

bytes – The NPC’s image in bytes.

sell_offers

list of NpcSellOffer – Items sold by the NPC.

buy_offers

list of NpcBuyOffer – Items bought by the NPC.

destinations

list of NpcSellOffer – Places where the NPC can travel to.

teaches

list of NpcSpell – Spells this NPC can teach.

classmethod from_article(article)[source]

Parses an article into a TibiaWiki model.

Parameters

article (Article) – The article from where the model is parsed.

Returns

An inherited model object for the current article.

Return type

Type[abc.Parseable]

insert(c)[source]

Inserts the current model into its respective database table.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod get_by_field(c, field, value, use_like=False)[source]

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

url

str – The URL to the article’s display page.

NpcDestination

class tibiawikisql.models.NpcDestination[source]

Represents a NPC’s travel destination

npc_id

int – The article id of the NPC.

name

str – The name of the destination

price

int – The price in gold to travel.

notes

str – Notes about the destination, such as requirements.

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod get_by_field(c, field, value, use_like=False)

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

insert(c)

Inserts the current model into its respective database table.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

NpcBuyOffer

class tibiawikisql.models.NpcBuyOffer[source]

Represents an item buyable by an NPC.

npc_id

int – The article id of the npc that buys the item.

npc_title

str – The title of the npc that buys the item.

npc_city

str – The city where the NPC is located.

item_id

int – The id of the item bought by the npc.

item_title

str – The title of the item bought by the npc.

currency_id

int – The item id of the currency used to sell the item.

currency_title

str – The title of the currency used to sell the item

value

str – The value of the item in the specified currency.

insert(c)[source]

Inserts the current model into its respective database table.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod get_by_field(c, field, value, use_like=False)

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

NpcSellOffer

class tibiawikisql.models.NpcSellOffer[source]

Represents an item sellable by an NPC.

npc_id

int – The article id of the npc that sells the item.

npc_title

str – The title of the npc that sells the item.

npc_city

str – The city where the NPC is located.

item_id

int – The id of the item sold by the npc.

item_title

str – The title of the item sold by the npc.

currency_id

int – The item id of the currency used to buy the item.

currency_title

str – The title of the currency used to buy the item

value

str – The value of the item in the specified currency.

insert(c)[source]

Inserts the current model into its respective database table.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod get_by_field(c, field, value, use_like=False)

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

NpcSpell

class tibiawikisql.models.NpcSpell[source]

Represents a spell that a NPC can teach.

npc_id

int – The article id of the npc that teaches the spell.

npc_title

str – The title of the npc that teaches the spell.

spell_id

int – The article id of the spell taught by the npc.

spell_title

str – The title of the spell taught by the npc.

price

int – The price paid to have this spell taught.

npc_city

str – The city where the NPC is located.

knight

bool – If the spell is taught to knights.

paladin

bool – If the spell is taught to paladins.

druid

bool – If the spell is taught to druids.

sorcerer

bool – If the spell is taught to sorcerers.

insert(c)[source]

Inserts the current model into its respective database table.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod get_by_field(c, field, value, use_like=False)

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

Quest

class tibiawikisql.models.Quest[source]

Represents a quest

article_id

int – The id of the containing article.

title

str – The title of the containing article.

timestamp

int – The last time the containing article was edited.

name

str – The name of the quest.

location

str – The location of the quest.

legend

str – The legend of the quest.

level_required

int – The level required to finish the quest.

int – The recommended level to finish the quest.

version

str – The client version where this item was first implemented.

dangers

list of QuestDanger – Creatures found in the quest.

rewards

list of QuestReward – Items rewarded in the quest.

classmethod from_article(article)[source]

Parses an article into a TibiaWiki model.

Parameters

article (Article) – The article from where the model is parsed.

Returns

An inherited model object for the current article.

Return type

Type[abc.Parseable]

insert(c)[source]

Inserts the current model into its respective database table.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod get_by_field(c, field, value, use_like=False)[source]

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

url

str – The URL to the article’s display page.

QuestDanger

class tibiawikisql.models.QuestDanger[source]

Represents a creature found in the quest.

quest_id

int – The article id of the quest.

quest_title

str – The title of the quest.

creature_id

int – The article id of the found creature.

creature_title

str – The title of the found creature.

insert(c)[source]

Inserts the current model into its respective database table.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod get_by_field(c, field, value, use_like=False)

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

QuestReward

class tibiawikisql.models.QuestReward[source]

Represents an item obtained in the quest.

quest_id

int – The article id of the quest.

quest_title

str – The title of the quest.

item_id

int – The article id of the rewarded item.

item_title

str – The title of the rewarded item.

insert(c)[source]

Inserts the current model into its respective database table.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod get_by_field(c, field, value, use_like=False)

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

RashidPosition

class tibiawikisql.models.RashidPosition[source]

Represents a Rashid position.

day

int – Day of the week, Monday starts at 0.

x

int – The x coordinate of Rashid that day.

y

int – The y coordinate of Rashid that day.

z

int – The z coordinate of Rashid that day.

city

str – The city where Rashid is that day.

location

str – The location where Rashid is that day.

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

classmethod get_by_field(c, field, value, use_like=False)

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

insert(c)

Inserts the current model into its respective database table.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

Spell

class tibiawikisql.models.Spell[source]

Represents a Spell

article_id

int – The id of the containing article.

title

str – The title of the containing article.

timestamp

int – The last time the containing article was edited.

name

str – The name of the spell.

words

str – The spell’s invocation words.

effect

str – The effects of casting the spell.

type

str – The spell’s type.

class

str – The spell’s class.

element

str – The element of the damage made by the spell.

mana

int – The mana cost of the spell

soul

int – The soul cost of the spell.

price

int – The gold cost of the spell.

cooldown

int – The spell’s cooldown in seconds.

level

int – The level required to use the spell.

premium

bool – Whether the spell is premium only or not.

knight

bool – Whether the spell can be used by knights or not.

paladin

bool – Whether the spell can be used by paladins or not.

druid

bool – Whether the spell can be used by druids or not.

sorcerer

bool – Whether the spell can be used by sorcerers or not.

taught_by

list of NpcSpell – Npcs that teach this spell.

version

str – The client version where the spell was implemented.

image

bytes – The spell’s image in bytes.

classmethod from_article(article)[source]

Parses an article into a TibiaWiki model.

Parameters

article (Article) – The article from where the model is parsed.

Returns

An inherited model object for the current article.

Return type

Type[abc.Parseable]

classmethod get_by_field(c, field, value, use_like=False)[source]

Gets an element by a specific field’s value.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str) – The field to filter with.

  • value – The value to look for.

  • use_like (bool) – Whether to use LIKE as a comparator instead of =.

Returns

The object found, or None.

Return type

cls

Raises

ValueError – The specified field doesn’t exist in the table.

classmethod from_row(row)

Returns an instance of the model from a row or dictionary.

Parameters

row (dict, sqlite3.Row) – A dict representing a row or a Row object.

Returns

An instance of the class, based on the row.

Return type

cls

insert(c)

Inserts the current model into its respective database table.

Parameters

c (sqlite3.Cursor, sqlite3.Connection) – A cursor or connection of the database.

classmethod search(c, field=None, value=None, use_like=False, sort_by=None, ascending=True)

Finds elements matching the provided values.

If no values are provided, it will return all elements.

Note that this won’t get values found in child tables.

Parameters
  • c (sqlite3.Connection, sqlite3.Cursor) – A connection or cursor of the database.

  • field (str, optional) – The field to filter by.

  • value (optional) – The value to filter by.

  • use_like (bool, optional) – Whether to use LIKE as a comparator instead of =.

  • sort_by (str, optional) – The column to sort by.

  • ascending (bool, optional) – Whether to sort ascending or descending.

Returns

A list containing all matching objects.

Return type

list of cls

Raises

ValueError – The specified field doesn’t exist in the table.

url

str – The URL to the article’s display page.

Utility Functions

Removes any links from the string, changing them for their plan version.

Parameters

content (str) – The string to clean.

Returns

The clean string, with no links.

Return type

str

tibiawikisql.utils.convert_tibiawiki_position(pos)[source]

Converts from TibiaWiki position system to regular numeric coordinates

TibiaWiki takes the coordinates and splits in two bytes, represented in decimal, separated by a period.

Parameters

pos (str) – A string containing a coordinate.

Returns

The coordinate value.

Return type

int

tibiawikisql.utils.parse_boolean(value: str, default=False, invert=False)[source]

Parses a boolean value from a string. String must contain “yes” to be considered True.

Parameters
  • value (str) – The string containing an integer.

  • default (bool, optional) – The value to return if no boolean string is found.

  • invert (bool, optional) – Whether to invert the value or not.

Returns

The boolean value parsed in the string, or default if it doesn’t match yes or no.

Return type

bool

tibiawikisql.utils.parse_float(value, default=0)[source]

From a string, parses a floating value. :param value: The string containing the floating number. :type value: str :param default: The value to return if no float is found. :type default: float, optional

Returns

The floating number found, or the default value provided.

Return type

float

tibiawikisql.utils.parse_integer(value, default=0)[source]

Parses an integer from a string. Extra characters are ignored.

Parameters
  • value (str) – The string containing an integer.

  • default (int, optional) – The value to return if no integer is found.

Returns

The numeric value found, or the default value provided.

Return type

int

tibiawikisql.utils.parse_loot_statistics(value)[source]

Gets every dropped item from a creature’s loot statistics. :param value: A string containing a creature’s loot statistics. :type value: str

Returns

A tuple containing the total kills and a list of entries.

Return type

tuple

tibiawikisql.utils.parse_min_max(value)[source]

Parses the mininum and maximum amounts of a loot drop. They consist of two numbers separated by a hyphen, e.g. 0-40

Parameters

value (str) – A string containing minimum and maximum values.

Returns

The minimum and maximum amounts.

Return type

tuple