about summary refs log tree commit diff
path: root/dropcalc/mxl_types/unique.py
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2024-02-07 17:54:47 -0600
committerStarfall <us@starfall.systems>2024-02-07 17:56:03 -0600
commit482794473972a1265308fcb89069066483bbdda0 (patch)
tree5dc3ea5306a5a2648a4815442643ddf2ebf1571f /dropcalc/mxl_types/unique.py
parentf06167b79397b425272fd4843d599d5f5c372fb6 (diff)
dropcalc: Median XL .txt parser
Was intended to eventually become a drop calculator. Might work for
other Diablo II mods without changes, I don't think there are any
MXL-specific fields involved in this.

Abandoned due to lack of organizational structure on the project and ...
creative differences with one of the lead devs.
Diffstat (limited to 'dropcalc/mxl_types/unique.py')
-rw-r--r--dropcalc/mxl_types/unique.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/dropcalc/mxl_types/unique.py b/dropcalc/mxl_types/unique.py
new file mode 100644
index 0000000..49c4e39
--- /dev/null
+++ b/dropcalc/mxl_types/unique.py
@@ -0,0 +1,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?