about summary refs log tree commit diff
path: root/dropcalc/mxl_types/item_ratio.py
blob: 7a783c3aeb1d36bae0a33a5ba2419a49ec4b8291 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from sqlalchemy.orm import Mapped, mapped_column

from .dao import BaseDAO


class ItemRatio(BaseDAO):
	filename = "ItemRatio_mp.txt"
	__csv_to_db__ = {"Class_Specific": "Class Specific"}
	__tablename__ = "item_ratio"

	id: Mapped[int] = mapped_column(primary_key=True)

	# D2Fileguide goes into more detail about how these are used
	# the gist is 1 in (Quality - (mlvl-ilvl) / Divisor) * 128 of rolling each of these
	# in the order unique, set, rare, magic, hiq, normal (and falling back on loq)
	# further modified by MF after diminishing returns value (250 uni, 500 set, 600 rar) - which I believe is hardcoded
	# and then the TC values
	Unique: Mapped[int]
	UniqueDivisor: Mapped[int]
	UniqueMin: Mapped[int]
	Rare: Mapped[int]
	RareDivisor: Mapped[int]
	RareMin: Mapped[int]
	Set: Mapped[int]
	SetDivisor: Mapped[int]
	SetMin: Mapped[int]
	Magic: Mapped[int]
	MagicDivisor: Mapped[int]
	MagicMin: Mapped[int]
	HiQuality: Mapped[int]
	HiQualityDivisor: Mapped[int]
	Normal: Mapped[int]
	NormalDivisor: Mapped[int]

	Uber: Mapped[int]  # exceptional/elite as decided by normcode, ubercode, ultracode in Weapons.txt / Armor.txt
	Class_Specific: Mapped[int]  # class specifics as decided by Class in Itemtypes.txt

	def is_valid(self):
		return self.Version == "1"