Creature
tibiawikisql.models.creature
¶
Classes:
| Name | Description |
|---|---|
CreatureAbility |
Represents a creature's ability. |
CreatureDrop |
Represents an item dropped by a creature. |
CreatureMaxDamage |
Represent a creature's max damage, broke down by damage type. |
Creature |
Represents a creature. |
CreatureAbility
pydantic-model
¶
Bases: BaseModel
Represents a creature's ability.
Show JSON schema:
{
"description": "Represents a creature's ability.",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"effect": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Effect"
},
"element": {
"title": "Element",
"type": "string"
}
},
"required": [
"name",
"element"
],
"title": "CreatureAbility",
"type": "object"
}
Fields:
element
pydantic-field
¶
element: str
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.
CreatureDrop
pydantic-model
¶
Bases: BaseModel
Represents an item dropped by a creature.
Show JSON schema:
{
"description": "Represents an item dropped by a creature.",
"properties": {
"item_id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Item Id"
},
"item_title": {
"title": "Item Title",
"type": "string"
},
"min": {
"title": "Min",
"type": "integer"
},
"max": {
"title": "Max",
"type": "integer"
},
"chance": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"title": "Chance"
}
},
"required": [
"item_title",
"min",
"max"
],
"title": "CreatureDrop",
"type": "object"
}
Fields:
CreatureMaxDamage
pydantic-model
¶
Bases: BaseModel
Represent a creature's max damage, broke down by damage type.
Show JSON schema:
{
"description": "Represent a creature's max damage, broke down by damage type.",
"properties": {
"physical": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Physical"
},
"fire": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Fire"
},
"ice": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Ice"
},
"earth": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Earth"
},
"energy": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Energy"
},
"holy": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Holy"
},
"death": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Death"
},
"drown": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Drown"
},
"lifedrain": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Lifedrain"
},
"manadrain": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Manadrain"
},
"summons": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Summons"
},
"total": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Total"
}
},
"title": "CreatureMaxDamage",
"type": "object"
}
Fields:
-
physical(int | None) -
fire(int | None) -
ice(int | None) -
earth(int | None) -
energy(int | None) -
holy(int | None) -
death(int | None) -
drown(int | None) -
lifedrain(int | None) -
manadrain(int | None) -
summons(int | None) -
total(int | None)
physical
pydantic-field
¶
physical: int | None = None
The maximum physical damage dealt by the creature. If it is unknown, but the creature does deal damage, it will be -1.
fire
pydantic-field
¶
fire: int | None = None
The maximum fire damage dealt by the creature. If it is unknown, but the creature does deal damage, it will be -1.
ice
pydantic-field
¶
ice: int | None = None
The maximum ice damage dealt by the creature. If it is unknown, but the creature does deal damage, it will be -1.
earth
pydantic-field
¶
earth: int | None = None
The maximum earth damage dealt by the creature. If it is unknown, but the creature does deal damage, it will be -1.
energy
pydantic-field
¶
energy: int | None = None
The maximum energy damage dealt by the creature. If it is unknown, but the creature does deal damage, it will be -1.
holy
pydantic-field
¶
holy: int | None = None
The maximum holy damage dealt by the creature. If it is unknown, but the creature does deal damage, it will be -1.
death
pydantic-field
¶
death: int | None = None
The maximum death damage dealt by the creature. If it is unknown, but the creature does deal damage, it will be -1.
drown
pydantic-field
¶
drown: int | None = None
The maximum drown damage dealt by the creature. If it is unknown, but the creature does deal damage, it will be -1.
lifedrain
pydantic-field
¶
lifedrain: int | None = None
The maximum life drain damage dealt by the creature. If it is unknown, but the creature does deal damage, it will be -1.
manadrain
pydantic-field
¶
manadrain: int | None = None
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.
summons
pydantic-field
¶
summons: int | None = None
The maximum damage dealt by the creature's summons. If it is unknown, but the creature does deal damage, it will be -1.
total
pydantic-field
¶
total: int | None = None
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.
Creature
pydantic-model
¶
Bases: WikiEntry, WithStatus, WithVersion, WithImage, RowModel
Represents a creature.
Show JSON schema:
{
"$defs": {
"CreatureAbility": {
"description": "Represents a creature's ability.",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"effect": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Effect"
},
"element": {
"title": "Element",
"type": "string"
}
},
"required": [
"name",
"element"
],
"title": "CreatureAbility",
"type": "object"
},
"CreatureDrop": {
"description": "Represents an item dropped by a creature.",
"properties": {
"item_id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Item Id"
},
"item_title": {
"title": "Item Title",
"type": "string"
},
"min": {
"title": "Min",
"type": "integer"
},
"max": {
"title": "Max",
"type": "integer"
},
"chance": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"title": "Chance"
}
},
"required": [
"item_title",
"min",
"max"
],
"title": "CreatureDrop",
"type": "object"
},
"CreatureMaxDamage": {
"description": "Represent a creature's max damage, broke down by damage type.",
"properties": {
"physical": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Physical"
},
"fire": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Fire"
},
"ice": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Ice"
},
"earth": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Earth"
},
"energy": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Energy"
},
"holy": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Holy"
},
"death": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Death"
},
"drown": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Drown"
},
"lifedrain": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Lifedrain"
},
"manadrain": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Manadrain"
},
"summons": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Summons"
},
"total": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Total"
}
},
"title": "CreatureMaxDamage",
"type": "object"
}
},
"description": "Represents a creature.",
"properties": {
"image": {
"anyOf": [
{
"format": "binary",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Image"
},
"version": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Version"
},
"status": {
"title": "Status",
"type": "string"
},
"article_id": {
"title": "Article Id",
"type": "integer"
},
"title": {
"title": "Title",
"type": "string"
},
"timestamp": {
"format": "date-time",
"title": "Timestamp",
"type": "string"
},
"article": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Article"
},
"name": {
"title": "Name",
"type": "string"
},
"plural": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Plural"
},
"library_race": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Library Race"
},
"creature_class": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Creature Class"
},
"type_primary": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Type Primary"
},
"type_secondary": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Type Secondary"
},
"bestiary_class": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Bestiary Class"
},
"bestiary_level": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Bestiary Level"
},
"bestiary_occurrence": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Bestiary Occurrence"
},
"bosstiary_class": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Bosstiary Class"
},
"hitpoints": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Hitpoints"
},
"experience": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Experience"
},
"armor": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Armor"
},
"mitigation": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Mitigation"
},
"speed": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Speed"
},
"runs_at": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Runs At"
},
"summon_cost": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Summon Cost"
},
"convince_cost": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Convince Cost"
},
"illusionable": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "Illusionable"
},
"pushable": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "Pushable"
},
"push_objects": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "Push Objects"
},
"sees_invisible": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "Sees Invisible"
},
"paralysable": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "Paralysable"
},
"spawn_type": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Spawn Type"
},
"is_boss": {
"title": "Is Boss",
"type": "boolean"
},
"cooldown": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"title": "Cooldown"
},
"modifier_physical": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Modifier Physical"
},
"modifier_earth": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Modifier Earth"
},
"modifier_fire": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Modifier Fire"
},
"modifier_energy": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Modifier Energy"
},
"modifier_ice": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Modifier Ice"
},
"modifier_death": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Modifier Death"
},
"modifier_holy": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Modifier Holy"
},
"modifier_drown": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Modifier Drown"
},
"modifier_lifedrain": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Modifier Lifedrain"
},
"modifier_healing": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Modifier Healing"
},
"abilities": {
"default": [],
"items": {
"$ref": "#/$defs/CreatureAbility"
},
"title": "Abilities",
"type": "array"
},
"max_damage": {
"anyOf": [
{
"$ref": "#/$defs/CreatureMaxDamage"
},
{
"type": "null"
}
],
"default": null
},
"walks_through": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Walks Through"
},
"walks_around": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Walks Around"
},
"sounds": {
"default": [],
"items": {
"type": "string"
},
"title": "Sounds",
"type": "array"
},
"location": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Location"
},
"loot": {
"default": [],
"items": {
"$ref": "#/$defs/CreatureDrop"
},
"title": "Loot",
"type": "array"
}
},
"required": [
"version",
"status",
"article_id",
"title",
"timestamp",
"article",
"name",
"plural",
"library_race",
"creature_class",
"type_primary",
"type_secondary",
"bestiary_class",
"bestiary_level",
"bestiary_occurrence",
"bosstiary_class",
"hitpoints",
"experience",
"armor",
"mitigation",
"speed",
"runs_at",
"summon_cost",
"convince_cost",
"illusionable",
"pushable",
"push_objects",
"sees_invisible",
"paralysable",
"spawn_type",
"is_boss",
"cooldown",
"modifier_physical",
"modifier_earth",
"modifier_fire",
"modifier_energy",
"modifier_ice",
"modifier_death",
"modifier_holy",
"modifier_drown",
"modifier_lifedrain",
"modifier_healing",
"walks_through",
"walks_around",
"location"
],
"title": "Creature",
"type": "object"
}
Fields:
-
image(bytes | None) -
version(str | None) -
status(str) -
article_id(int) -
title(str) -
timestamp(datetime) -
article(str | None) -
name(str) -
plural(str | None) -
library_race(str | None) -
creature_class(str | None) -
type_primary(str | None) -
type_secondary(str | None) -
bestiary_class(str | None) -
bestiary_level(str | None) -
bestiary_occurrence(str | None) -
bosstiary_class(str | None) -
hitpoints(int | None) -
experience(int | None) -
armor(int | None) -
mitigation(int | None) -
speed(int | None) -
runs_at(int | None) -
summon_cost(int | None) -
convince_cost(int | None) -
illusionable(bool | None) -
pushable(bool | None) -
push_objects(bool | None) -
sees_invisible(bool | None) -
paralysable(bool | None) -
spawn_type(str | None) -
is_boss(bool) -
cooldown(float | None) -
modifier_physical(int | None) -
modifier_earth(int | None) -
modifier_fire(int | None) -
modifier_energy(int | None) -
modifier_ice(int | None) -
modifier_death(int | None) -
modifier_holy(int | None) -
modifier_drown(int | None) -
modifier_lifedrain(int | None) -
modifier_healing(int | None) -
abilities(list[CreatureAbility]) -
max_damage(CreatureMaxDamage | None) -
walks_through(str | None) -
walks_around(str | None) -
sounds(list[str]) -
location(str | None) -
loot(list[CreatureDrop])
article
pydantic-field
¶
article: str | None
The article that goes before the name when looking at the creature.
library_race
pydantic-field
¶
library_race: str | None
The race name of the creature in Tibia.com's library.
bestiary_class
pydantic-field
¶
bestiary_class: str | None
The creature's bestiary class, if applicable.
bestiary_level
pydantic-field
¶
bestiary_level: str | None
The creature's bestiary level, from 'Trivial' to 'Hard'
bestiary_occurrence
pydantic-field
¶
bestiary_occurrence: str | None
The creature's bestiary occurrence, from 'Common' to 'Very Rare'.
bosstiary_class
pydantic-field
¶
bosstiary_class: str | None
The creature's bosstiary class, if applicable.
experience
pydantic-field
¶
experience: int | None
Experience points yielded by the creature. Might be None if unknown.
runs_at
pydantic-field
¶
runs_at: int | None
The amount of hitpoints when the creature starts to run away. 0 means it won't run away.
summon_cost
pydantic-field
¶
summon_cost: int | None
The mana needed to summon this creature. 0 if not summonable.
convince_cost
pydantic-field
¶
convince_cost: int | None
The mana needed to convince this creature. 0 if not convincible.
illusionable
pydantic-field
¶
illusionable: bool | None
Whether the creature can be illusioned into using Creature Illusion.
push_objects
pydantic-field
¶
push_objects: bool | None
Whether the creature can push objects or not.
sees_invisible
pydantic-field
¶
sees_invisible: bool | None
Whether the creature can see invisible players or not.
modifier_physical
pydantic-field
¶
modifier_physical: int | None
The percentage of damage received of physical damage. None if unknown.
modifier_earth
pydantic-field
¶
modifier_earth: int | None
The percentage of damage received of earth damage. None if unknown.
modifier_fire
pydantic-field
¶
modifier_fire: int | None
The percentage of damage received of fire damage. None if unknown.
modifier_energy
pydantic-field
¶
modifier_energy: int | None
The percentage of damage received of energy damage. None if unknown.
modifier_ice
pydantic-field
¶
modifier_ice: int | None
The percentage of damage received of ice damage. None if unknown.
modifier_death
pydantic-field
¶
modifier_death: int | None
The percentage of damage received of death damage. None if unknown.
modifier_holy
pydantic-field
¶
modifier_holy: int | None
The percentage of damage received of holy damage. None if unknown.
modifier_drown
pydantic-field
¶
modifier_drown: int | None
The percentage of damage received of drown damage. None if unknown.
modifier_lifedrain
pydantic-field
¶
modifier_lifedrain: int | None
The percentage of damage received of life drain damage. None if unknown.
modifier_healing
pydantic-field
¶
modifier_healing: int | None
The healing modifier. None if unknown.
max_damage
pydantic-field
¶
max_damage: CreatureMaxDamage | None = None
The maximum damage the creature can make.
walks_through
pydantic-field
¶
walks_through: str | None
The field types the creature will walk through, separated by commas.
walks_around
pydantic-field
¶
walks_around: str | None
The field types the creature will walk around, separated by commas.
bestiary_kills
property
¶
bestiary_kills: int | None
Get the total kills needed to complete the bestiary entry if applicable.
charm_points
property
¶
charm_points: int | None
Get the charm points awarded for completing the creature's bestiary entry, if applicable.
elemental_modifiers
property
¶
Get a dictionary containing all elemental modifiers, sorted in descending order.
weak_to
property
¶
Get a dictionary containing the elements the creature is weak to and modifier.
resistant_to
property
¶
Get a dictionary containing the elements the creature is resistant to and modifier.
insert
¶
insert(conn: Connection | Cursor) -> None
Insert the model into its respective database table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conn
|
Connection | Cursor
|
A cursor or connection to the database. |
required |
Source code in tibiawikisql/models/creature.py
get_one_by_field
classmethod
¶
get_one_by_field(
conn: Connection | Cursor,
field: str,
value: Any,
use_like: bool = False,
) -> Self | None
Get a single element matching the field's value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conn
|
Connection | Cursor
|
A connection or cursor of the database. |
required |
field
|
str
|
The field to filter with. |
required |
value
|
Any
|
The value to look for. |
required |
use_like
|
bool
|
Whether to use |
False
|
Returns:
| Type | Description |
|---|---|
Self | None
|
The object found, or |
Raises:
| Type | Description |
|---|---|
ValueError
|
The specified field doesn't exist in the table. |