about summary refs log tree commit diff
path: root/dropcalc/mxl_types/unique.py
blob: 49c4e39fbbe7c3dcfe914f4f43ffb947b72efa40 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from sqlalchemy import ForeignKey
from sqlalchemy.orm import Mapped, mapped_column

from . import BaseDAO


class UniqueItem(BaseDAO):
	filename = "UniqueItems.txt"
	__tablename__ = "unique_item"

	id: Mapped[int] = mapped_column(primary_key=True)
	index: Mapped[str]   # string reference, often also human-readable
	code = mapped_column(ForeignKey("base.code"))
	rarity: Mapped[int]  # drop frequency, relative to other uniques on this base
	lvl: Mapped[int]     # minimum drop level

	def is_valid(self):
		return self.enabled == "1"  # TODO: can we create fixed drop but not randomly available uniques by setting this to 0?