Skip to content

Imbuement

tibiawikisql.models.imbuement

Classes:

Name Description
Material

A material needed to use this imbuement.

ImbuementMaterial

Represents an item material for an imbuement.

Imbuement

Represents an imbuement type.

Material pydantic-model

Bases: BaseModel

A material needed to use this imbuement.

Show JSON schema:
{
  "description": "A material needed to use this imbuement.",
  "properties": {
    "item_id": {
      "default": 0,
      "title": "Item Id",
      "type": "integer"
    },
    "item_title": {
      "title": "Item Title",
      "type": "string"
    },
    "amount": {
      "title": "Amount",
      "type": "integer"
    }
  },
  "required": [
    "item_title",
    "amount"
  ],
  "title": "Material",
  "type": "object"
}

Fields:

item_id pydantic-field
item_id: int = 0

The article ID of the item material.

item_title pydantic-field
item_title: str

The title of the item material.

amount pydantic-field
amount: int

The amount of items required.

ImbuementMaterial pydantic-model

Bases: RowModel

Represents an item material for an imbuement.

Show JSON schema:
{
  "description": "Represents an item material for an imbuement.",
  "properties": {
    "imbuement_id": {
      "title": "Imbuement Id",
      "type": "integer"
    },
    "imbuement_title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Imbuement Title"
    },
    "item_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Item Id"
    },
    "item_title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Item Title"
    },
    "amount": {
      "title": "Amount",
      "type": "integer"
    }
  },
  "required": [
    "imbuement_id",
    "amount"
  ],
  "title": "ImbuementMaterial",
  "type": "object"
}

Fields:

imbuement_id pydantic-field
imbuement_id: int

The article id of the imbuement this material belongs to.

imbuement_title pydantic-field
imbuement_title: str | None = None

The title of the imbuement this material belongs to.

item_id pydantic-field
item_id: int | None = None

The article id of the item material.

item_title pydantic-field
item_title: str | None = None

The title of the item material.

amount pydantic-field
amount: int

The amount of items required.

Imbuement pydantic-model

Bases: WikiEntry, WithStatus, WithVersion, WithImage, RowModel

Represents an imbuement type.

Show JSON schema:
{
  "$defs": {
    "Material": {
      "description": "A material needed to use this imbuement.",
      "properties": {
        "item_id": {
          "default": 0,
          "title": "Item Id",
          "type": "integer"
        },
        "item_title": {
          "title": "Item Title",
          "type": "string"
        },
        "amount": {
          "title": "Amount",
          "type": "integer"
        }
      },
      "required": [
        "item_title",
        "amount"
      ],
      "title": "Material",
      "type": "object"
    }
  },
  "description": "Represents an imbuement type.",
  "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"
    },
    "name": {
      "title": "Name",
      "type": "string"
    },
    "tier": {
      "title": "Tier",
      "type": "string"
    },
    "type": {
      "title": "Type",
      "type": "string"
    },
    "category": {
      "title": "Category",
      "type": "string"
    },
    "effect": {
      "title": "Effect",
      "type": "string"
    },
    "slots": {
      "title": "Slots",
      "type": "string"
    },
    "materials": {
      "items": {
        "$ref": "#/$defs/Material"
      },
      "title": "Materials",
      "type": "array"
    }
  },
  "required": [
    "version",
    "status",
    "article_id",
    "title",
    "timestamp",
    "name",
    "tier",
    "type",
    "category",
    "effect",
    "slots"
  ],
  "title": "Imbuement",
  "type": "object"
}

Fields:

name pydantic-field
name: str

The name of the imbuement.

tier pydantic-field
tier: str

The tier of the imbuement.

type pydantic-field
type: str

The imbuement's type.

category pydantic-field
category: str

The imbuement's category.

effect pydantic-field
effect: str

The effect given by the imbuement.

slots pydantic-field
slots: str

The type of items this imbuement may be applied on.

materials pydantic-field
materials: list[Material]

The materials needed for the imbuement.

insert
insert(conn)

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/imbuement.py
def insert(self, conn):
    super().insert(conn)
    for material in self.materials:
        material.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/imbuement.py
@classmethod
def get_one_by_field(cls, conn: Connection | Cursor, field: str, value: Any, use_like: bool = False) -> Self | None:
    imbuement: Self = super().get_one_by_field(conn, field, value, use_like)
    if imbuement is None:
        return None
    imbuement.materials = [Material(**dict(r)) for r in ImbuementMaterialTable.get_by_imbuement_id(conn, imbuement.article_id)]
    return imbuement