From 482794473972a1265308fcb89069066483bbdda0 Mon Sep 17 00:00:00 2001 From: Starfall Date: Wed, 7 Feb 2024 17:54:47 -0600 Subject: 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. --- dropcalc/mxl_types/base.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 dropcalc/mxl_types/base.py (limited to 'dropcalc/mxl_types/base.py') diff --git a/dropcalc/mxl_types/base.py b/dropcalc/mxl_types/base.py new file mode 100644 index 0000000..cd7e8be --- /dev/null +++ b/dropcalc/mxl_types/base.py @@ -0,0 +1,34 @@ +from sqlalchemy import ForeignKey, String +from sqlalchemy.orm import Mapped, mapped_column + +from .dao import BaseDAO + + +class BaseItem(BaseDAO): + __tablename__ = "base" + + code: Mapped[str] = mapped_column(String(4), primary_key=True) + name: Mapped[str] # internal name only, game actually looks up `code` in strings + type = mapped_column(ForeignKey("item_type.Code")) # can have two item_type... and all their parents + type2 = mapped_column(ForeignKey("item_type.Code")) # should really figure out a better way to store them + rarity: Mapped[int] + level: Mapped[int] # variously referred to as ilvl or qlvl + spawnable: Mapped[int] # items with spawnable=0 *can* be dropped directly from TCs, but shouldn't randomly drop + category: Mapped[str] + + __mapper_args__ = {'polymorphic_on': 'category'} + + +class Weapon(BaseItem): + filename = "Weapons.txt" + __mapper_args__ = {'polymorphic_identity': 'weap'} + + +class Armor(BaseItem): + filename = "Armor.txt" + __mapper_args__ = {'polymorphic_identity': 'armo'} + + +class Misc(BaseItem): + filename = "Misc.txt" + __mapper_args__ = {'polymorphic_identity': 'misc'} -- cgit