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]¶
Create a generator that obtains entries in a certain category.
- classmethod get_category_members_titles(name, skip_index=True)[source]¶
Create a generator that obtains a list of article titles in a category.
- classmethod get_image_info(name)[source]¶
Get an image’s info.
It is not required to prefix the name with
File:
, but the extension is required.
- classmethod get_images_info(names)[source]¶
Get 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 images might not match the order of the provided names due to an API limitation.
WikiEntry¶
Image¶
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¶
The SQL table where this model is stored.
- Type:
database.Table
- insert(c)[source]¶
Insert 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]¶
Return 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]¶
Get 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 useLIKE
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]¶
Find 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 useLIKE
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
Models¶
Achievement¶
- class tibiawikisql.models.Achievement[source]¶
Represents an Achievement.
Whether a premium account is required to get this achievement.
- Type:
- classmethod from_article(article)¶
Parse 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:
- classmethod from_row(row)¶
Return 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)¶
Get 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 useLIKE
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)¶
Insert 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)¶
Find 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 useLIKE
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.
- table¶
alias of
Achievement
Book¶
- class tibiawikisql.models.Book[source]¶
Represents a book or written document in Tibia.
- Parameters:
article_id (
int
) – The ID of the article that contains this book.title (
str
) – The title of the article containing this book.name (:class:´str´) – The name of the book.
book_type (
str
) – The type of item this book can be found in.item_id (
int
) – The ID of the item this book is written in.location (
str
) – Where the book can be found.blurb (
str
) – A short introduction text of the book.author (
str
) – The person that wrote the book, if known.prev_book (
str
) – If the book is part of a series, the book that precedes this one.next_book (
str
) – If the book is part of a series, the book that follows this one.text (
str
) – The content of the book.version (
str
) – The client version where this item was first implemented.status (
str
) – The status of this item in the game.timestamp (
int
) – The last time the containing article was edited.
- insert(c)[source]¶
Insert 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)¶
Parse 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:
- classmethod from_row(row)¶
Return 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)¶
Get 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 useLIKE
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)¶
Find 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 useLIKE
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.
- table¶
alias of
Book
Charm¶
- class tibiawikisql.models.Charm[source]¶
Represents a charm.
- classmethod from_article(article)¶
Parse 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:
- classmethod from_row(row)¶
Return 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)¶
Get 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 useLIKE
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)¶
Insert 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)¶
Find 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 useLIKE
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.
- table¶
alias of
Charm
Creature¶
- class tibiawikisql.models.Creature[source]¶
Represents a creature.
- runs_at¶
The amount of hitpoints when the creature starts to run away. 0 means it won’t run away.
- Type:
- modifier_lifedrain¶
The percentage of damage received of life drain damage.
None
if unknown.- Type:
- abilities¶
A list of the creature abilities.
- Type:
list of
CreatureAbility
- max_damage¶
The maximum damage the creature can make.
- Type:
- loot¶
The items dropped by this creature.
- Type:
list of
CreatureDrop
- property bestiary_kills: Optional[int]¶
Total kills needed to complete the bestiary entry if applicable.
- Type:
int
, optional
- property charm_points: Optional[int]¶
Charm points awarded for completing the creature’s bestiary entry, if applicable.
- Type:
int
, optional
- property elemental_modifiers¶
Returns a dictionary containing all elemental modifiers, sorted in descending order.
- Type:
OrderedDict
- property weak_to¶
Dictionary containing the elements the creature is weak to and modifier.
- Type:
OrderedDict
- property resistant_to¶
Dictionary containing the elements the creature is resistant to and modifier.
- Type:
OrderedDict
- classmethod from_article(article)[source]¶
Parse 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:
- insert(c)[source]¶
Insert 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]¶
Get 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 useLIKE
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)¶
Return 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)¶
Find 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 useLIKE
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.
- table¶
alias of
Creature
CreatureAbility¶
- class tibiawikisql.models.CreatureAbility[source]¶
Represents a creature’s ability.
- element¶
The element of damage type of the ability. This could also be a status condition instead. For abilities that are just plain text,
plain_text
is set. For abilities that are not using the abilities templates in TibiaWiki, they are saved as a single entry with element:no_template
.- Type:
- insert(c)[source]¶
Insert 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)¶
Return 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)¶
Get 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 useLIKE
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)¶
Find 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 useLIKE
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.
- table¶
alias of
CreatureAbility
CreatureMaxDamage¶
- class tibiawikisql.models.CreatureMaxDamage[source]¶
Represent a creature’s max damage, broke down by damage type.
- physical¶
The maximum physical damage dealt by the creature. If it is unknown, but the creature does deal damage, it will be -1.
- Type:
int
, optional
- fire¶
The maximum fire damage dealt by the creature. If it is unknown, but the creature does deal damage, it will be -1.
- Type:
int
, optional
- ice¶
The maximum ice damage dealt by the creature. If it is unknown, but the creature does deal damage, it will be -1.
- Type:
int
, optional
- earth¶
The maximum earth damage dealt by the creature. If it is unknown, but the creature does deal damage, it will be -1.
- Type:
int
, optional
- energy¶
The maximum energy damage dealt by the creature. If it is unknown, but the creature does deal damage, it will be -1.
- Type:
int
, optional
- holy¶
The maximum holy damage dealt by the creature. If it is unknown, but the creature does deal damage, it will be -1.
- Type:
int
, optional
- death¶
The maximum death damage dealt by the creature. If it is unknown, but the creature does deal damage, it will be -1.
- Type:
int
, optional
- drown¶
The maximum drown damage dealt by the creature. If it is unknown, but the creature does deal damage, it will be -1.
- Type:
int
, optional
- lifedrain¶
The maximum life drain damage dealt by the creature. If it is unknown, but the creature does deal damage, it will be -1.
- Type:
int
, optional
- manadrain¶
The maximum mana drain damage dealt by the creature. This is not counted as part of the total. If it is unknown, but the creature does deal damage, it will be -1.
- Type:
int
, optional
- summons¶
The maximum damage dealt by the creature’s summons. If it is unknown, but the creature does deal damage, it will be -1.
- Type:
int
, optional
- total¶
The maximum damage the creature can deal in a single turn. This doesn’t count manadrain and summon damage. In most cases, this is simply the sum of the other damages, but in some cases, the amount may be different. If it is unknown, but the creature does deal damage, it will be -1.
- Type:
int
, optional
- insert(c)[source]¶
Insert 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)¶
Return 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)¶
Get 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 useLIKE
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)¶
Find 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 useLIKE
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.
- table¶
alias of
CreatureMaxDamage
CreatureSound¶
- class tibiawikisql.models.CreatureSound[source]¶
Represents a sound made by a creature.
- insert(c)[source]¶
Insert 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)¶
Return 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)¶
Get 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 useLIKE
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)¶
Find 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 useLIKE
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.
- table¶
alias of
CreatureSound
House¶
- class tibiawikisql.models.House[source]¶
Represents a house or guildhall.
- classmethod from_article(article)¶
Parse 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:
- classmethod from_row(row)¶
Return 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)¶
Get 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 useLIKE
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)¶
Insert 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)¶
Find 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 useLIKE
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.
- table¶
alias of
House
Imbuement¶
- class tibiawikisql.models.Imbuement[source]¶
Represents an imbuement type.
- materials¶
The materials needed for the imbuement.
- Type:
list of
ImbuementMaterial
- classmethod from_article(article)[source]¶
Parse 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:
- insert(c)[source]¶
Insert 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]¶
Get 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 useLIKE
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)¶
Return 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)¶
Find 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 useLIKE
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.
- table¶
alias of
Imbuement
ImbuementMaterial¶
- class tibiawikisql.models.ImbuementMaterial[source]¶
Represents a item material for an imbuement.
- insert(c)[source]¶
Insert 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)¶
Return 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)¶
Get 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 useLIKE
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)¶
Find 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 useLIKE
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.
- table¶
alias of
ImbuementMaterial
Item¶
- class tibiawikisql.models.Item[source]¶
Represents an Item.
- attributes¶
The item’s attributes.
- Type:
list of
ItemAttribute
- dropped_by¶
List of creatures that drop this item, with the chances.
- Type:
list of
CreatureDrop
- sold_by¶
List of NPCs that sell this item.
- Type:
list of
NpcSellOffer
- bought_by¶
List of NPCs that buy this item.
- Type:
list of
NpcBuyOffer
- awarded_in¶
List of quests that give this item as reward.
- Type:
list of
QuestReward
- sounds¶
List of sounds made when using the item.
- Type:
list of
ItemSound
.
- property resistances¶
A mapping of the elemental resistances of this item.
- Type:
- classmethod from_article(article)[source]¶
Parse 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:
- insert(c)[source]¶
Insert 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]¶
Get 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 useLIKE
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)¶
Return 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)¶
Find 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 useLIKE
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.
- table¶
alias of
Item
ItemAttribute¶
- class tibiawikisql.models.ItemAttribute[source]¶
Represents an Item’s attribute.
- insert(c)[source]¶
Insert 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)¶
Return 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)¶
Get 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 useLIKE
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)¶
Find 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 useLIKE
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.
- table¶
alias of
ItemAttribute
ItemStoreOffer¶
- class tibiawikisql.models.ItemStoreOffer[source]¶
Represents an offer for an item on the Tibia Store.
- insert(c)[source]¶
Insert 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)¶
Return 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)¶
Get 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 useLIKE
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)¶
Find 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 useLIKE
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.
- table¶
alias of
ItemStoreOffer
Key¶
- class tibiawikisql.models.Key[source]¶
Represents a key item.
- insert(c)[source]¶
Insert 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)¶
Parse 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:
- classmethod from_row(row)¶
Return 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)¶
Get 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 useLIKE
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)¶
Find 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 useLIKE
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.
- table¶
alias of
ItemKey
Npc¶
- class tibiawikisql.models.Npc[source]¶
Represents a non-playable character.
- sell_offers¶
Items sold by the NPC.
- Type:
list of
NpcSellOffer
- buy_offers¶
Items bought by the NPC.
- Type:
list of
NpcBuyOffer
- destinations¶
Places where the NPC can travel to.
- Type:
list of
NpcDestination
- classmethod from_article(article)[source]¶
Parse 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:
- insert(c)[source]¶
Insert 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]¶
Get 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 useLIKE
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)¶
Return 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)¶
Find 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 useLIKE
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.
- table¶
alias of
Npc
NpcDestination¶
- class tibiawikisql.models.NpcDestination[source]¶
Represents a NPC’s travel destination.
- classmethod from_row(row)¶
Return 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)¶
Get 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 useLIKE
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)¶
Insert 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)¶
Find 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 useLIKE
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.
- table¶
alias of
NpcDestination
NpcBuyOffer¶
- class tibiawikisql.models.NpcBuyOffer[source]¶
Represents an item buyable by an NPC.
- insert(c)[source]¶
Insert 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)¶
Return 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)¶
Get 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 useLIKE
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)¶
Find 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 useLIKE
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.
- table¶
alias of
NpcBuying
NpcSellOffer¶
- class tibiawikisql.models.NpcSellOffer[source]¶
Represents an item sellable by an NPC.
- insert(c)[source]¶
Insert 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)¶
Return 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)¶
Get 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 useLIKE
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)¶
Find 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 useLIKE
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.
- table¶
alias of
NpcSelling
NpcSpell¶
- class tibiawikisql.models.NpcSpell[source]¶
Represents a spell that a NPC can teach.
- insert(c)[source]¶
Insert 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)¶
Return 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)¶
Get 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 useLIKE
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)¶
Find 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 useLIKE
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.
- table¶
alias of
NpcSpell
Outfit¶
- class tibiawikisql.models.Outfit[source]¶
Represents an outfit.
Whether the outfit requires a premium account or not.
- Type:
- images¶
The outfit’s images.
- Type:
list of
OutfitImage
- quests¶
Quests that grant the outfit or its addons.
- Type:
list of
OutfitQuest
- classmethod from_article(article)[source]¶
Parse 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:
- insert(c)[source]¶
Insert 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]¶
Get 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 useLIKE
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)¶
Return 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)¶
Find 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 useLIKE
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.
- table¶
alias of
Outfit
OutfitImage¶
- class tibiawikisql.models.OutfitImage[source]¶
Represents an outfit image.
- addon¶
The addons represented by the image. 0 for no addons, 1 for first addon, 2 for second addon and 3 for both addons.
- Type:
- classmethod from_row(row)¶
Return 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)¶
Get 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 useLIKE
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)¶
Insert 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)¶
Find 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 useLIKE
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.
- table¶
alias of
OutfitImage
OutfitQuest¶
- class tibiawikisql.models.OutfitQuest[source]¶
Represents a quest that grants an outfit or it’s addon.
- insert(c)[source]¶
Insert 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)¶
Return 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)¶
Get 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 useLIKE
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)¶
Find 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 useLIKE
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.
- table¶
alias of
OutfitQuest
Quest¶
- class tibiawikisql.models.Quest[source]¶
Represents a quest.
- dangers¶
Creatures found in the quest.
- Type:
list of
QuestDanger
- rewards¶
Items rewarded in the quest.
- Type:
list of
QuestReward
- classmethod from_article(article)[source]¶
Parse 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:
- insert(c)[source]¶
Insert 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]¶
Get 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 useLIKE
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)¶
Return 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)¶
Find 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 useLIKE
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.
- table¶
alias of
Quest
QuestDanger¶
- class tibiawikisql.models.QuestDanger[source]¶
Represents a creature found in the quest.
- insert(c)[source]¶
Insert 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)¶
Return 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)¶
Get 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 useLIKE
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)¶
Find 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 useLIKE
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.
- table¶
alias of
QuestDanger
QuestReward¶
- class tibiawikisql.models.QuestReward[source]¶
Represents an item obtained in the quest.
- insert(c)[source]¶
Insert 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)¶
Return 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)¶
Get 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 useLIKE
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)¶
Find 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 useLIKE
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.
- table¶
alias of
QuestReward
RashidPosition¶
- class tibiawikisql.models.RashidPosition[source]¶
Represents a Rashid position.
- classmethod from_row(row)¶
Return 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)¶
Get 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 useLIKE
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)¶
Insert 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)¶
Find 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 useLIKE
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.
- table¶
alias of
RashidPosition
Spell¶
- class tibiawikisql.models.Spell[source]¶
Represents a Spell.
- cooldown_group¶
The spell’s group cooldown in seconds. The time you have to wait before casting another spell in the same group.
- Type:
Whether the spell is premium only or not.
- Type:
- classmethod from_article(article)[source]¶
Parse 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:
- classmethod get_by_field(c, field, value, use_like=False)[source]¶
Get 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 useLIKE
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)¶
Return 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)¶
Insert 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)¶
Find 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 useLIKE
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.
- table¶
alias of
Spell
Update¶
- class tibiawikisql.models.Update[source]¶
Represents a game update.
- classmethod from_article(article)¶
Parse 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:
- classmethod from_row(row)¶
Return 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)¶
Get 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 useLIKE
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)¶
Insert 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)¶
Find 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 useLIKE
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.
- table¶
alias of
Update
World¶
- class tibiawikisql.models.World[source]¶
Represents a Game World.
- battleye_type¶
The type of BattlEye protection the world has. Can be either green or yellow.
- Type:
- protected_since¶
Date when the world started being protected by BattlEye, in ISO 8601 format.
- Type:
- classmethod from_article(article)¶
Parse 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:
- classmethod from_row(row)¶
Return 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)¶
Get 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 useLIKE
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)¶
Insert 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)¶
Find 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 useLIKE
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.
- table¶
alias of
World
Utility Functions¶
- tibiawikisql.utils.clean_question_mark(content)[source]¶
Remove question mark strings, turning them to nulls.
- tibiawikisql.utils.clean_links(content, strip_question_mark=False)[source]¶
Remove any links from the string, changing them for their plan version.
- tibiawikisql.utils.convert_tibiawiki_position(pos)[source]¶
Convert from TibiaWiki position system to regular numeric coordinates.
TibiaWiki takes the coordinates and splits in two bytes, represented in decimal, separated by a period.
- tibiawikisql.utils.find_template(content: str, template_name, partial=False, recursive=False)[source]¶
Find a template in a string containing wiki code.
If there are multiple matches, the first one will be returned.
- Parameters:
content (
str
) – A string containing wiki code.template_name (
str
) – The name of the template to match. Case insensitive.partial (
bool
) –Whether to match the entire template name or just a substring of it.
e.g. match “Loot Table” when searching for “Loot”
recursive (
bool
) – Whether to search for templates recursively, by going inside nested templates.
- Returns:
The first template found in the content, if any. Otherwise
None
is returned.- Return type:
Template
- tibiawikisql.utils.find_templates(content: str, template_name, partial=False, recursive=False)[source]¶
Create a generator to find templates a wikicode string.
- Parameters:
content (
str
) – A string containing wiki code.template_name (
str
) – The name of the template to match. Case insensitive.partial (
bool
) –Whether to match the entire template name or just a substring of it.
e.g. match “Loot Table” when searching for “Loot”
recursive (
bool
) – Whether to search for templates recursively, by going inside nested templates.
- Yields:
Template
– Templates matching provided string.
- tibiawikisql.utils.parse_boolean(value: str, default=False, invert=False)[source]¶
Parse a boolean value from a string.
String must contain “yes” to be considered True.
- Parameters:
- Returns:
The boolean value parsed in the string, or default if it doesn’t match yes or no.
- Return type:
- tibiawikisql.utils.parse_date(value)[source]¶
Parse a date from the formats used in TibiaWiki.
June 28, 2019
Aug 21, 2014
- Parameters:
value (
str
) – The string containing the date.- Returns:
The date represented by the string.
- Return type:
- tibiawikisql.utils.parse_integer(value, default=0)[source]¶
Parse an integer from a string. Extra characters are ignored.
- tibiawikisql.utils.parse_loot_statistics(value)[source]¶
Get every dropped item from a creature’s loot statistics.
- tibiawikisql.utils.parse_min_max(value)[source]¶
Parse the mininum and maximum amounts of a loot drop.
They consist of two numbers separated by a hyphen, e.g.
0-40
- tibiawikisql.utils.client_color_to_rgb(value: int)[source]¶
Convert a color number from Tibia’s client data to a RGB value.