Skip to content

Outfit

tibiawikisql.models.outfit

Classes:

Name Description
UnlockQuest

A quest that unlocks the outfit and/or its addons.

OutfitQuest

Represents a quest that grants an outfit or it's addon.

OutfitImage

Represents an outfit image.

Outfit

Represents an outfit.

UnlockQuest pydantic-model

Bases: BaseModel

A quest that unlocks the outfit and/or its addons.

Show JSON schema:
{
  "description": "A quest that unlocks the outfit and/or its addons.",
  "properties": {
    "quest_id": {
      "default": null,
      "title": "Quest Id",
      "type": "integer"
    },
    "quest_title": {
      "title": "Quest Title",
      "type": "string"
    },
    "unlock_type": {
      "title": "Unlock Type",
      "type": "string"
    }
  },
  "required": [
    "quest_title",
    "unlock_type"
  ],
  "title": "UnlockQuest",
  "type": "object"
}

Fields:

quest_id pydantic-field
quest_id: int = None

The article id of the quest that gives the outfit or its addons.

quest_title pydantic-field
quest_title: str

The title of the quest.

unlock_type pydantic-field
unlock_type: str

Whether the quest is for the outfit or addons.

OutfitQuest pydantic-model

Bases: RowModel

Represents a quest that grants an outfit or it's addon.

Show JSON schema:
{
  "description": "Represents a quest that grants an outfit or it's addon.",
  "properties": {
    "outfit_id": {
      "title": "Outfit Id",
      "type": "integer"
    },
    "outfit_title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Outfit Title"
    },
    "quest_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Quest Id"
    },
    "quest_title": {
      "title": "Quest Title",
      "type": "string"
    },
    "unlock_type": {
      "title": "Unlock Type",
      "type": "string"
    }
  },
  "required": [
    "outfit_id",
    "quest_title",
    "unlock_type"
  ],
  "title": "OutfitQuest",
  "type": "object"
}

Fields:

outfit_id pydantic-field
outfit_id: int

The article id of the outfit given.

outfit_title pydantic-field
outfit_title: str | None = None

The title of the outfit given.

quest_id pydantic-field
quest_id: int | None = None

The article id of the quest that gives the outfit or its addons.

quest_title pydantic-field
quest_title: str

The title of the quest.

unlock_type pydantic-field
unlock_type: str

Whether the quest is for the outfit or addons.

OutfitImage pydantic-model

Bases: RowModel, WithImage

Represents an outfit image.

Show JSON schema:
{
  "description": "Represents an outfit image.",
  "properties": {
    "image": {
      "anyOf": [
        {
          "format": "binary",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Image"
    },
    "outfit_id": {
      "title": "Outfit Id",
      "type": "integer"
    },
    "outfit_name": {
      "title": "Outfit Name",
      "type": "string"
    },
    "sex": {
      "title": "Sex",
      "type": "string"
    },
    "addon": {
      "title": "Addon",
      "type": "integer"
    }
  },
  "required": [
    "outfit_id",
    "outfit_name",
    "sex",
    "addon"
  ],
  "title": "OutfitImage",
  "type": "object"
}

Fields:

outfit_id pydantic-field
outfit_id: int

The article id of the outfit the image belongs to.

outfit_name pydantic-field
outfit_name: str

The name of the outfit.

sex pydantic-field
sex: str

The sex the outfit is for.

addon pydantic-field
addon: int

The addons represented by the image. 0 for no addons, 1 for first addon, 2 for second addon and 3 for both addons.

Outfit pydantic-model

Bases: WikiEntry, WithStatus, WithVersion, RowModel

Represents an outfit.

Show JSON schema:
{
  "$defs": {
    "OutfitImage": {
      "description": "Represents an outfit image.",
      "properties": {
        "image": {
          "anyOf": [
            {
              "format": "binary",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Image"
        },
        "outfit_id": {
          "title": "Outfit Id",
          "type": "integer"
        },
        "outfit_name": {
          "title": "Outfit Name",
          "type": "string"
        },
        "sex": {
          "title": "Sex",
          "type": "string"
        },
        "addon": {
          "title": "Addon",
          "type": "integer"
        }
      },
      "required": [
        "outfit_id",
        "outfit_name",
        "sex",
        "addon"
      ],
      "title": "OutfitImage",
      "type": "object"
    },
    "UnlockQuest": {
      "description": "A quest that unlocks the outfit and/or its addons.",
      "properties": {
        "quest_id": {
          "default": null,
          "title": "Quest Id",
          "type": "integer"
        },
        "quest_title": {
          "title": "Quest Title",
          "type": "string"
        },
        "unlock_type": {
          "title": "Unlock Type",
          "type": "string"
        }
      },
      "required": [
        "quest_title",
        "unlock_type"
      ],
      "title": "UnlockQuest",
      "type": "object"
    }
  },
  "description": "Represents an outfit.",
  "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"
    },
    "outfit_type": {
      "title": "Outfit Type",
      "type": "string"
    },
    "is_premium": {
      "title": "Is Premium",
      "type": "boolean"
    },
    "is_bought": {
      "title": "Is Bought",
      "type": "boolean"
    },
    "is_tournament": {
      "title": "Is Tournament",
      "type": "boolean"
    },
    "full_price": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Full Price"
    },
    "achievement": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Achievement"
    },
    "images": {
      "items": {
        "$ref": "#/$defs/OutfitImage"
      },
      "title": "Images",
      "type": "array"
    },
    "quests": {
      "items": {
        "$ref": "#/$defs/UnlockQuest"
      },
      "title": "Quests",
      "type": "array"
    }
  },
  "required": [
    "version",
    "status",
    "article_id",
    "title",
    "timestamp",
    "name",
    "outfit_type",
    "is_premium",
    "is_bought",
    "is_tournament",
    "full_price",
    "achievement"
  ],
  "title": "Outfit",
  "type": "object"
}

Fields:

name pydantic-field
name: str

The name of the outfit.

outfit_type pydantic-field
outfit_type: str

The type of outfit. Basic, Quest, Special, Premium.

is_premium pydantic-field
is_premium: bool

Whether the outfit requires a premium account or not.

is_bought pydantic-field
is_bought: bool

Whether the outfit can be bought from the Store or not.

is_tournament pydantic-field
is_tournament: bool

Whether the outfit can be bought with Tournament coins or not.

full_price pydantic-field
full_price: int | None

The full price of this outfit in the Tibia Store.

achievement pydantic-field
achievement: str | None

The achievement obtained for acquiring this full outfit.

images pydantic-field
images: list[OutfitImage]

The outfit's images.

quests pydantic-field
quests: list[UnlockQuest]

Quests that grant the outfit or its addons.

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/outfit.py
def insert(self, conn: Connection | Cursor) -> None:
    super().insert(conn)
    for quest in self.quests:
        quest.insert(conn, self.article_id)
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 LIKE as a comparator instead of =.

False

Returns:

Type Description
Self | None

The object found, or None if no entries match.

Raises:

Type Description
ValueError

The specified field doesn't exist in the table.

Source code in tibiawikisql/models/outfit.py
@classmethod
def get_one_by_field(cls, conn: Connection | Cursor, field: str, value: Any, use_like: bool = False) -> Self | None:
    outfit: Self = super().get_one_by_field(conn, field, value, use_like)
    if outfit is None:
        return None
    outfit.quests = [UnlockQuest(**dict(r)) for r in OutfitQuestTable.get_list_by_outfit_id(conn, outfit.article_id)]
    return outfit