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.
- classmethod get_category_members_titles(name, skip_index=True)[source]¶
Generator that obtains a list of article titles in a 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.
- 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 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.
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.
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
- 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 immune_to: List[str]¶
Gets a list of the elements the creature is immune to.
- 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]¶
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
- 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]¶
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.
CreatureDrop¶
- class tibiawikisql.models.CreatureDrop[source]¶
Represents an item dropped by a 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)¶
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.
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.
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.
ImbuementMaterial¶
- class tibiawikisql.models.ImbuementMaterial[source]¶
Representes 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.
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.
- 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.
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.
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.
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
NpcSellOffer
- 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Utility Functions¶
- tibiawikisql.utils.clean_question_mark(content)[source]¶
Removes question mark strings, turning them to nulls.
- tibiawikisql.utils.clean_links(content)[source]¶
Removes any links from the string, changing them for their plan version.
- 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.
- 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
- 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]¶
Parses an integer from a string. Extra characters are ignored.
- 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
- 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