Quest
tibiawikisql.models.quest
¶
Classes:
| Name | Description |
|---|---|
ItemReward |
An item awarded in the quest. |
QuestReward |
Represents an item obtained in the quest. |
QuestCreature |
Represents a creature found in the quest. |
QuestDanger |
Represents a creature found in the quest. |
Quest |
Represents a quest. |
ItemReward
pydantic-model
¶
Bases: BaseModel
An item awarded in the quest.
Show JSON schema:
Fields:
-
item_id(int) -
item_title(str)
QuestReward
pydantic-model
¶
Bases: RowModel
Represents an item obtained in the quest.
Show JSON schema:
{
"description": "Represents an item obtained in the quest.",
"properties": {
"quest_id": {
"title": "Quest Id",
"type": "integer"
},
"quest_title": {
"title": "Quest Title",
"type": "string"
},
"item_id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Item Id"
},
"item_title": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Item Title"
}
},
"required": [
"quest_id",
"quest_title"
],
"title": "QuestReward",
"type": "object"
}
Fields:
-
quest_id(int) -
quest_title(str) -
item_id(int | None) -
item_title(str | None)
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/quest.py
QuestCreature
pydantic-model
¶
Bases: BaseModel
Represents a creature found in the quest.
Show JSON schema:
{
"description": "Represents a creature found in the quest.",
"properties": {
"creature_id": {
"default": 0,
"title": "Creature Id",
"type": "integer"
},
"creature_title": {
"title": "Creature Title",
"type": "string"
}
},
"required": [
"creature_title"
],
"title": "QuestCreature",
"type": "object"
}
Fields:
QuestDanger
pydantic-model
¶
Bases: RowModel
Represents a creature found in the quest.
Show JSON schema:
{
"description": "Represents a creature found in the quest.",
"properties": {
"quest_id": {
"title": "Quest Id",
"type": "integer"
},
"quest_title": {
"title": "Quest Title",
"type": "string"
},
"creature_id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Creature Id"
},
"creature_title": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Creature Title"
}
},
"required": [
"quest_id",
"quest_title"
],
"title": "QuestDanger",
"type": "object"
}
Fields:
-
quest_id(int) -
quest_title(str) -
creature_id(int | None) -
creature_title(str | None)
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/quest.py
Quest
pydantic-model
¶
Bases: WikiEntry, WithStatus, WithVersion, RowModel
Represents a quest.
Show JSON schema:
{
"$defs": {
"ItemReward": {
"description": "An item awarded in the quest.",
"properties": {
"item_id": {
"default": 0,
"title": "Item Id",
"type": "integer"
},
"item_title": {
"title": "Item Title",
"type": "string"
}
},
"required": [
"item_title"
],
"title": "ItemReward",
"type": "object"
},
"QuestCreature": {
"description": "Represents a creature found in the quest.",
"properties": {
"creature_id": {
"default": 0,
"title": "Creature Id",
"type": "integer"
},
"creature_title": {
"title": "Creature Title",
"type": "string"
}
},
"required": [
"creature_title"
],
"title": "QuestCreature",
"type": "object"
}
},
"description": "Represents a quest.",
"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"
},
"location": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Location"
},
"is_rookgaard_quest": {
"title": "Is Rookgaard Quest",
"type": "boolean"
},
"is_premium": {
"title": "Is Premium",
"type": "boolean"
},
"type": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Type"
},
"quest_log": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "Quest Log"
},
"legend": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Legend"
},
"level_required": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Level Required"
},
"level_recommended": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Level Recommended"
},
"active_time": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Active Time"
},
"estimated_time": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Estimated Time"
},
"dangers": {
"items": {
"$ref": "#/$defs/QuestCreature"
},
"title": "Dangers",
"type": "array"
},
"rewards": {
"items": {
"$ref": "#/$defs/ItemReward"
},
"title": "Rewards",
"type": "array"
}
},
"required": [
"version",
"status",
"article_id",
"title",
"timestamp",
"name",
"location",
"is_rookgaard_quest",
"is_premium",
"type",
"quest_log",
"legend",
"level_required",
"level_recommended",
"active_time",
"estimated_time"
],
"title": "Quest",
"type": "object"
}
Fields:
-
version(str | None) -
status(str) -
article_id(int) -
title(str) -
timestamp(datetime) -
name(str) -
location(str | None) -
is_rookgaard_quest(bool) -
is_premium(bool) -
type(str | None) -
quest_log(bool | None) -
legend(str | None) -
level_required(int | None) -
level_recommended(int | None) -
active_time(str | None) -
estimated_time(str | None) -
dangers(list[QuestCreature]) -
rewards(list[ItemReward])
is_rookgaard_quest
pydantic-field
¶
is_rookgaard_quest: bool
Whether this quest is in Rookgaard or not.
quest_log
pydantic-field
¶
quest_log: bool | None
Whether this quest is registered in the quest log or not.
level_recommended
pydantic-field
¶
level_recommended: int | None
The recommended level to finish the quest.
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 |
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. |