TreasureClassEx.txt tab-separated Picks Unique, Set, Rare, Magic NoDrop Item{1-10} : can be a TC name, Weapons/Armor/Misc/Gems code, UniqueItems index, maybe even SetItems index Prob{1-10} group/level can upgrade tc but that's skippable for now until we need to deal with monsters for generic TCs: read Weapons.txt, Armor.txt code, rarity use name for now, deal with namestr & string tbls later NoDrop adjustment: fundamentally it just retries once per (close, partied) player until an item is hit. far and/or unpartied players count half item quality: ItemRatio.txt Unique, UniqueDivisor, UniqueMin... etc chance = 128 * (Unique - (ilvl-qlvl)/Divisor) eMF = (MF * factor) / (MF + Factor) like basically all diminishing returns chance = chance * eMF cap to minChance chance = chance - (chance * tcUnique / 1024) roll 0 to chance-1, if less than 128 then success which means lower "chance" is better unique is picked with rarity / total rarity of uniques for base that have the right ilvl as expected game rolls unique - set - rare - magic - superior - normal in order affixes the fuckening: rares have 2+d4 affixes, 50/50 for each to be prefix or suffix until 3 crafts have 4 affixes (or 0.4/0.2/0.2/0.2 for 1-4 at ilvl 1), otherwise the same generate in order, exclude by group alvl of item is: tmplvl = min(ilvl, 99) tmplvl = max(qlvl, tmplvl) if magic_level: alvl = tmplvl + magic_level else if tmplvl < (99 - qlvl/2): alvl = tmplvl - qlvl/2 else: alvl = 2 * tmplvl - 99 return min(alvl, 99) should likely monte carlo simulate crafts rather than try and calculate them need to fuck around with Itemtypes, MagicPrefix, MagicSuffix to get all the possible affixes