Item
tibiawikisql.models.item
¶
Classes:
| Name | Description |
|---|---|
ItemAttribute |
Represents an Item's attribute. |
ItemOffer |
Represents an offer to buy or sell the item. |
ItemStoreOffer |
Represents an offer for an item on the Tibia Store. |
ItemDrop |
Represents a creature that drops the item. |
ItemQuestReward |
A quest where the item is awarded. |
Item |
Represents an Item. |
Book |
Represents a book or written document in Tibia. |
Key |
Represents a key item. |
ItemAttribute
pydantic-model
¶
Bases: BaseModel
Represents an Item's attribute.
Show JSON schema:
Fields:
ItemOffer
pydantic-model
¶
Bases: BaseModel
Represents an offer to buy or sell the item.
Show JSON schema:
{
"description": "Represents an offer to buy or sell the item.",
"properties": {
"npc_id": {
"title": "Npc Id",
"type": "integer"
},
"npc_title": {
"title": "Npc Title",
"type": "string"
},
"currency_id": {
"title": "Currency Id",
"type": "integer"
},
"currency_title": {
"title": "Currency Title",
"type": "string"
},
"value": {
"title": "Value",
"type": "integer"
}
},
"required": [
"npc_id",
"npc_title",
"currency_id",
"currency_title",
"value"
],
"title": "ItemOffer",
"type": "object"
}
Fields:
-
npc_id(int) -
npc_title(str) -
currency_id(int) -
currency_title(str) -
value(int)
ItemStoreOffer
pydantic-model
¶
Bases: BaseModel
Represents an offer for an item on the Tibia Store.
Show JSON schema:
{
"description": "Represents an offer for an item on the Tibia Store.",
"properties": {
"price": {
"title": "Price",
"type": "integer"
},
"amount": {
"title": "Amount",
"type": "integer"
},
"currency": {
"title": "Currency",
"type": "string"
}
},
"required": [
"price",
"amount",
"currency"
],
"title": "ItemStoreOffer",
"type": "object"
}
Fields:
ItemDrop
pydantic-model
¶
Bases: BaseModel
Represents a creature that drops the item.
Show JSON schema:
{
"description": "Represents a creature that drops the item.",
"properties": {
"creature_id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Creature Id"
},
"creature_title": {
"title": "Creature Title",
"type": "string"
},
"min": {
"title": "Min",
"type": "integer"
},
"max": {
"title": "Max",
"type": "integer"
},
"chance": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"title": "Chance"
}
},
"required": [
"creature_title",
"min",
"max"
],
"title": "ItemDrop",
"type": "object"
}
Fields:
-
creature_id(int | None) -
creature_title(str) -
min(int) -
max(int) -
chance(float | None)
ItemQuestReward
pydantic-model
¶
Bases: BaseModel
A quest where the item is awarded.
Show JSON schema:
Fields:
-
quest_id(int) -
quest_title(str)
Item
pydantic-model
¶
Bases: WikiEntry, WithVersion, WithStatus, WithImage, RowModel
Represents an Item.
Show JSON schema:
{
"$defs": {
"ItemAttribute": {
"description": "Represents an Item's attribute.",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"value": {
"title": "Value",
"type": "string"
}
},
"required": [
"name",
"value"
],
"title": "ItemAttribute",
"type": "object"
},
"ItemDrop": {
"description": "Represents a creature that drops the item.",
"properties": {
"creature_id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Creature Id"
},
"creature_title": {
"title": "Creature Title",
"type": "string"
},
"min": {
"title": "Min",
"type": "integer"
},
"max": {
"title": "Max",
"type": "integer"
},
"chance": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"title": "Chance"
}
},
"required": [
"creature_title",
"min",
"max"
],
"title": "ItemDrop",
"type": "object"
},
"ItemOffer": {
"description": "Represents an offer to buy or sell the item.",
"properties": {
"npc_id": {
"title": "Npc Id",
"type": "integer"
},
"npc_title": {
"title": "Npc Title",
"type": "string"
},
"currency_id": {
"title": "Currency Id",
"type": "integer"
},
"currency_title": {
"title": "Currency Title",
"type": "string"
},
"value": {
"title": "Value",
"type": "integer"
}
},
"required": [
"npc_id",
"npc_title",
"currency_id",
"currency_title",
"value"
],
"title": "ItemOffer",
"type": "object"
},
"ItemQuestReward": {
"description": "A quest where the item is awarded.",
"properties": {
"quest_id": {
"title": "Quest Id",
"type": "integer"
},
"quest_title": {
"title": "Quest Title",
"type": "string"
}
},
"required": [
"quest_id",
"quest_title"
],
"title": "ItemQuestReward",
"type": "object"
},
"ItemStoreOffer": {
"description": "Represents an offer for an item on the Tibia Store.",
"properties": {
"price": {
"title": "Price",
"type": "integer"
},
"amount": {
"title": "Amount",
"type": "integer"
},
"currency": {
"title": "Currency",
"type": "string"
}
},
"required": [
"price",
"amount",
"currency"
],
"title": "ItemStoreOffer",
"type": "object"
}
},
"description": "Represents an Item.",
"properties": {
"image": {
"anyOf": [
{
"format": "binary",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Image"
},
"status": {
"title": "Status",
"type": "string"
},
"version": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Version"
},
"article_id": {
"title": "Article Id",
"type": "integer"
},
"title": {
"title": "Title",
"type": "string"
},
"timestamp": {
"format": "date-time",
"title": "Timestamp",
"type": "string"
},
"name": {
"title": "Name",
"type": "string"
},
"actual_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Actual Name"
},
"plural": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Plural"
},
"article": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Article"
},
"is_marketable": {
"title": "Is Marketable",
"type": "boolean"
},
"is_stackable": {
"title": "Is Stackable",
"type": "boolean"
},
"is_pickupable": {
"title": "Is Pickupable",
"type": "boolean"
},
"is_immobile": {
"title": "Is Immobile",
"type": "boolean"
},
"value_sell": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Value Sell"
},
"value_buy": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Value Buy"
},
"weight": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"title": "Weight"
},
"item_class": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Item Class"
},
"item_type": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Item Type"
},
"type_secondary": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Type Secondary"
},
"flavor_text": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Flavor Text"
},
"light_color": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Light Color"
},
"light_radius": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Light Radius"
},
"client_id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Client Id"
},
"attributes": {
"items": {
"$ref": "#/$defs/ItemAttribute"
},
"title": "Attributes",
"type": "array"
},
"dropped_by": {
"items": {
"$ref": "#/$defs/ItemDrop"
},
"title": "Dropped By",
"type": "array"
},
"sold_by": {
"items": {
"$ref": "#/$defs/ItemOffer"
},
"title": "Sold By",
"type": "array"
},
"bought_by": {
"items": {
"$ref": "#/$defs/ItemOffer"
},
"title": "Bought By",
"type": "array"
},
"awarded_in": {
"items": {
"$ref": "#/$defs/ItemQuestReward"
},
"title": "Awarded In",
"type": "array"
},
"sounds": {
"items": {
"type": "string"
},
"title": "Sounds",
"type": "array"
},
"store_offers": {
"items": {
"$ref": "#/$defs/ItemStoreOffer"
},
"title": "Store Offers",
"type": "array"
}
},
"required": [
"status",
"version",
"article_id",
"title",
"timestamp",
"name",
"actual_name",
"plural",
"article",
"is_marketable",
"is_stackable",
"is_pickupable",
"is_immobile",
"value_sell",
"value_buy",
"weight",
"item_class",
"item_type",
"type_secondary",
"flavor_text",
"light_radius",
"client_id"
],
"title": "Item",
"type": "object"
}
Fields:
-
image(bytes | None) -
status(str) -
version(str | None) -
article_id(int) -
title(str) -
timestamp(datetime) -
name(str) -
actual_name(str | None) -
plural(str | None) -
article(str | None) -
is_marketable(bool) -
is_stackable(bool) -
is_pickupable(bool) -
is_immobile(bool) -
value_sell(int | None) -
value_buy(int | None) -
weight(float | None) -
item_class(str | None) -
item_type(str | None) -
type_secondary(str | None) -
flavor_text(str | None) -
light_color(int | None) -
light_radius(int | None) -
client_id(int | None) -
attributes(list[ItemAttribute]) -
dropped_by(list[ItemDrop]) -
sold_by(list[ItemOffer]) -
bought_by(list[ItemOffer]) -
awarded_in(list[ItemQuestReward]) -
sounds(list[str]) -
store_offers(list[ItemStoreOffer])
actual_name
pydantic-field
¶
actual_name: str | None
The name of the item as it appears in game when looked at.
article
pydantic-field
¶
article: str | None
The article that goes before the name when looking at the item.
is_marketable
pydantic-field
¶
is_marketable: bool
Whether the item can be traded on the Market or not.
flavor_text
pydantic-field
¶
flavor_text: str | None
The extra text that is displayed when some items are looked at.
light_color
pydantic-field
¶
light_color: int | None = None
The color of the light emitted by this item in RGB, if any.
light_radius
pydantic-field
¶
light_radius: int | None
The radius of the light emitted by this item, if any.
dropped_by
pydantic-field
¶
List of creatures that drop this item, with the chances.
awarded_in
pydantic-field
¶
awarded_in: list[ItemQuestReward]
List of quests that give this item as reward.
attributes_dict
property
¶
A mapping of the attributes this item has.
resistances
property
¶
A mapping of the elemental resistances of this item.
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/item.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. |
Source code in tibiawikisql/models/item.py
Book
pydantic-model
¶
Bases: WikiEntry, WithStatus, WithVersion, RowModel
Represents a book or written document in Tibia.
Show JSON schema:
{
"description": "Represents a book or written document in Tibia.",
"properties": {
"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"
},
"name": {
"title": "Name",
"type": "string"
},
"book_type": {
"title": "Book Type",
"type": "string"
},
"item_id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Item Id"
},
"location": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Location"
},
"blurb": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Blurb"
},
"author": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Author"
},
"prev_book": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Prev Book"
},
"next_book": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Next Book"
},
"text": {
"title": "Text",
"type": "string"
}
},
"required": [
"version",
"status",
"article_id",
"title",
"timestamp",
"name",
"book_type",
"location",
"blurb",
"author",
"prev_book",
"next_book",
"text"
],
"title": "Book",
"type": "object"
}
Fields:
-
version(str | None) -
status(str) -
article_id(int) -
title(str) -
timestamp(datetime) -
name(str) -
book_type(str) -
item_id(int | None) -
location(str | None) -
blurb(str | None) -
author(str | None) -
prev_book(str | None) -
next_book(str | None) -
text(str)
prev_book
pydantic-field
¶
prev_book: str | None
If the book is part of a series, the book that precedes this one.
next_book
pydantic-field
¶
next_book: str | None
If the book is part of a series, the book that follows this one.
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/item.py
Key
pydantic-model
¶
Bases: WikiEntry, WithStatus, WithVersion, RowModel
Represents a key item.
Show JSON schema:
{
"description": "Represents a key item.",
"properties": {
"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"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"number": {
"title": "Number",
"type": "integer"
},
"item_id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Item Id"
},
"material": {
"title": "Material",
"type": "string"
},
"location": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Location"
},
"notes": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Notes"
},
"origin": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Origin"
}
},
"required": [
"version",
"status",
"article_id",
"title",
"timestamp",
"number",
"material",
"location",
"notes",
"origin"
],
"title": "Key",
"type": "object"
}
Fields:
-
version(str | None) -
status(str) -
article_id(int) -
title(str) -
timestamp(datetime) -
name(str | None) -
number(int) -
item_id(int | None) -
material(str) -
location(str | None) -
notes(str | None) -
origin(str | None)
item_id
pydantic-field
¶
item_id: int | None = None
The article id of the item this key is based on.
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 |