Item Generation Tutorial

maxicek

Moderator
Staff member
Dec 24, 2019
270
188
43
Originally posted by Warrior of Light

Item Generation Tutorial for Patch 1.11


The Table of Contents

1. Basics
2. Terminology
3. Short Explanation of Drop Process
4. Game data files
4.1. TreasureClassEx.txt
4.2. Monstats.txt
4.3. MagicPrefix.txt and MagicSuffix.txt
4.4. Weapons.txt
4.5. Armor.txt
4.6. Misc.txt
4.7. ItemTypes.txt
4.8. Itemratio.txt
5. Area, monster and item levels
6. TC selection and number of dropped items
7. Item type selection
8. Item quality selection
9. Set and unique item selection
10. Sockets' number selection
11. Affix selection
12. Item generation at shops
13. Gambling
14. Ethereal items
15. Rune and charm generation
16. Quest drop and Andariel bug
17. Object drops
18. Countess
19. Crafting
20. Imbue
21. Cubing
22. Circlets and Magic Level
23. Runes in Hell Forge
24. Magic Find
25. 1.11 Drop Changes
26. Thanks


1. Basics

The goal of most players in Diablo II is to kill enemies while staying alive. This trivial concept is based on three things that determine your effectiveness: 1) your tactics, 2) the build of your character, 3) the items that you use. All these things have great impact on gameplay, you'll quickly die at hell difficulty if you play without any tactics, you'll be killing slowly without wise skill distribution, but many people find that the most important aspect of Diablo II is its unique item system. Almost any character reckon on its items, for example a Mage becomes very powerful after doubling his skill levels, using items, and a Warrior almost completely cannot be separated from his weapon. Many people spend a lot of hours trying to find certain items, and most dedicated players make item hunting the goal of their playing.
This guide is trying to answer the most popular question about item generation, most aspects of item creation in the game.
If you have any other questions, feel free to post them in the Single Player Forum.


2. Terminology

Item Type - it is a kind of item, e.c. a cap, a gem, a short sword, a ring.
Item Quality - it is a kind of item properties: low quality, normal, superior, magic, rare, set, unique.
Affixes - it is item magic properties: prefixes and suffixes. Note, that not all item properties are affixes. For example: stuffmods, pre-defined properties of crafted items and some special mods of set and unique items. E.c. "+60 to Mana" on a magic ring is an affix, "+20% crushing blow" isn't an affix.
Qlvl - Quality level. 1) A level of item type. All these levels are stored in weapons.txt, armor.txt and misc.txt data files. 2) A level of set or unique item. All these levels are stored in UniqueItems.txt and SetItems.txt data files.
Ilvl - Item Level. All items in the game have levels that are generated when it is created. For some strange reason Blizzard decided to hide it from players. Don't confuse Item Level with Required Level, - it is different things.
Mlvl - Monster Level. All monsters in the game have levels as well as players.
Area Level - Area Level. All areas in the game also have levels.
Alvl - Affix Level. It is a level of prefix or suffix. They are stored in MagicPrefix.txt and MagicSuffix.txt in the "Level" column. The name "Affix Level" is used to differentiate them from other "Levels".
TC - Treasure Class. All item types in the game are organised in the game into treasure classes. They are recursive. This means that one treasure class may include another treasure class. E.c. Hell Baal drops all his items from "Baal (H)" treasure class, which consists of "Act 5 (H) Equip B", "Act 5 (H) Junk" and "Act 5 (H) Good" treasure classes. Each of them consists of several other treasure classes.
Clvl- Character Level. It is one of few levels that you can actually see in the game. :)
Rarity - it is a value, assigned to every set and unique item in the game. Higher the rarity of an item, more common it is in the game. So you may see that "Rarity" is quite a bad name. E.c. Stone of Jordan has Rarity=1, Manald Heal has Rarity=15.
SP - Single Player mode.


3. Short Explanation of Drop Process

When you kill a monster or open a chest the game may generate items to reward you. Their properties are also generated at the same moment. The item may be unidentified, however if it is dropped it already has certain properties, that doesn't depend on who will identify it or when.
The game creates dropped items with algorithm of such kind:

1) At the beginning it finds treasure class (TC), that describes all drops of the monster you killed or a chest, you opened, rock, you touched, etc. All drop sources have treasure classes.
2) Then it makes one or several iterations, that are called "Picks", when it selects one chosen from several possibilities.
2.1) One of these possibilities often is so called "NoDrop", when it simply no drop items at all. However, note that the game may do several picks, so one of them may select NoDrop, but all others select some items. Most normal monsters have only one pick, though.
2.2) If it selects to pick from another TC, then it starts another cycle of picks from the selected TC, which may again contain several picks from different TCs and may also have NoDrop chance.
3) At some iteration the game may eventually select a certain item type. If this item may have several qualities, the game starts with an algorithm of quality determination. E.c. Keys, runes, potions may only be normal quality, but rings, short swords, helms, bucklers may have different qualities like magic or unique. Note that Magic Finding works only here.
4) For every selected item it calculates item level.
5) If it selects unique or set quality, the game creates the list of all such items according to item level. Then it selects one of the items from the list randomly according to rarity. If there are no items in the list, then it will create double durability magic or triple durability rare item.
6) After it selects item type and item quality, it generates item affixes if needed. Also it generates all other properties of an item, that may vary. E.c. El runes, mana potions, identify scrolls don't have variable properties, but magic rings, rare kite shields, cracked sashes need property generation.

You may find this algorithm a bit complicated, but it is actually quite simple. I'll show you it in the next chapters, when I'll explain every step in detail.
If you want, I'll simplify it even more. When, say you kill Mephisto, the game:
  • calculates the number of items to drop;
  • selects item types;
  • selects item qualities;
  • selects certain unique or set items if needed;
  • selects item properties.


4.Game data files

In this chapter I'll explain several data files that are used in the item generation process.
Many parameters of drops are stored in txt files, that are packed to MPQ files in your Diablo II directory. If you have installed ATMA you may find that files unpacked in its data folder.
This file is stored in CSV format, it is plain text tables, you may open them in Excel or OpenOffice.org.
You don't need to know everything about them to be effective in item hunting, that files are a bit complicated. However it would be better to know their structure.
If you are a crazy dedicated item hunter like me, I suggest you look at Diablo II 1.10 file guides, which are published at Phrozen Keep.
Note, that I will not explain the fields that are not needed for item generation.
 
Last edited:

maxicek

Moderator
Staff member
Dec 24, 2019
270
188
43
4.1. TreasureClassEx.txt

This is the most important file that organizes all items, that drop, into a system of Treasure Classes (TC).
Each source of items in the game, except NPCs drop items from Treasure Classes, so pay attention.
We'll start with a description of all fields of TreasureClassEx.txt table.

Treasure Class - a name of a TC, the game usually refers to it.
group - an identification number of similar TCs, that is used in TC upgrade process according to Mlvl.
level - a level of TC. It is also used in the TC upgrade process.
Picks - a quantity of iterations of the selection process.
Unique - a modification number for chance to drop unique item from given TC (more is better).
Set - a modification number for set chance.
Rare - a modification number for rare chance.
Magic - a modification number for magic chance.
NoDrop - a rate of skipping drops from the TC (the higher NoDrop, the less items the TC will generate).
Item1-Item10 - a code of item to drop or a name of TC to drop from (item codes are stored in weapons.txt, armor.txt and misc.txt data files).
Prob1-Prob10 - a rate of selecting respective Item1-Item10 (more is better).
SumItems, TotalProb, DropChance, Term - unimportant fields for item drop routine.

TreasureClassEx.txt file doesn't contain all treasure classes. At run time the game adds quite a few additional TCs. Their names are ArmoXX and WeapXX, where XX is a two digit number. The game creates them from armor.txt and wepons.txt files, looking at quality levels. The first TC of armors, Armo03, contains all armor items with levels from 1 to 3: Cap, Quilted Armor, Leather Armor, Buckler, Gloves, Boots and Sash. The next armor TC, Armo06 contains all armor items with levels from 4 to 6, and so on. The last armor TC, Armo87, contains all armor items with levels from 85 to 87.
Weapons are organized in their TCs, Weap03-Weap87 in the same manner.
In this TCs Prob1-Prob10 values are equal to 3 for all normal items, 1 for all class specific items, 2 for assassin claws, and 1 for wands, staves and sceptres. These probabilities may be found in ItemTypes.txt file.

Now you know what all these columns mean, but how all this works?
Let's look at the process of item selection from a given TC.

All monsters have treasure classes, written in monstats.txt file. When you kill a monster in normal difficulty the game simply uses his TC to drop items. However in Nightmare and Hell difficulty the given TC may be upgraded. Determining TC for monster the game selects the highest level TC in the group, that is equal or lower than Mlvl. If there is no group for TC of this monster, then it doesn't upgrade TC. Treasure classes that are included in selected TC aren't upgraded.

Selecting from a TC the game makes one or several attempts of dropping according to Picks field. Each pick choses from several possibilities, that include NoDrop, if it is not empty, and each non-empty entry from Item1-Item10 fields. The chance of every choice is equal to X/Sum, where X is respective value from Prob1-Prob10 fields for Item1-Item10, or NoDrop value for NoDrop choice, and Sum is the sum of all that values (NoDrop+Prob1+Prob2+...+Prob10).

If the game selects another TC during this process it will initiate the same cycle for it, then another cycle for newly selected TC, then another and another until it selects an item or NoDrop.

In multiplayer games NoDrop value is reduced.
NewNoDrop=int( ProbSum/(1/((NoDrop/(NoDrop+ProbSum))^N)-1) ),
where N=int(1+AdditionalPlayers/2+ClosePartiedPlayers/2),
AdditionalPlayers - the number of all additional players in the game, where the monster is killed,
ClosePartiedPlayers - the number of players in your party near you (not far than two screens away),
ProbSum=Prob1+Prob2+Prob3+...+Prob10,
int - operation of truncating fractional part of a number.

In SP /playersX command sets the number of NON-partied players, e.c. /players8 command sets N=4.

Let's take an example. Say you kill non-boss Devilkin in The Pit level 1 in Hell in /players8 mode (or in the full game in Battle.net). It has Mlvl=85. In the monstats.txt file Devilkin is figured under "fallen3" name. Non-unique fallen3 drop items from "Act 1 (H) H2H B" TC in Hell difficulty.
In TreasureClassEx.txt file "Act 1 (H) H2H B" TC has group=7 and level=66. Because Mlvl=85 the TC is upgraded to "Act 5 (H) H2H C" TC, which has level=85 (less or equal to mlvl).
So Devilkins in The Pit drop items from "Act 5 (H) H2H C" TC.
It has 1 pick from following possibilities:
* NoDrop (100);
* gld (21);
* Act 5 (H) Equip C (16);
* Act 1 (H) Junk (21);
* Act 5 (H) Good (2).
The numbers in parances are probabilities.
Let's calculate NewNoDrop:
ProbSum=21+16+21+2=60.
NoDrop=100.
N=4.
NewNoDrop=int( 60/(1/((100/(100+60))^4)-1) )=11.

So The Pit Devilkin has following chances:
* 11/71 for no dropping at all;
* 21/71 for dropping gold;
* 16/71 for dropping from Act 5 (H) Equip C;
* 21/71 for dropping from Act 1 (H) Junk;
* 2/71 for dropping from Act 5 (H) Good.

Let's assume that the game decided to drop from "Act 5 (H) Equip C" TC. Here it is: Picks=1, NoDrop=0, Item1="weap81", Prob1=2, Item2="armo81", Prob2=1, Item3="weap84", Prob3=6, Item4="armo84", Prob4=3, Item5="weap87", Prob5=14, Item6="armo87", Prob6=7, Item7="weap87", Prob7=1, Item8="armo87", Prob8=1, Item9="Act 5 (H) Equip B", Prob9=1530. Note, that weap87 and armo87 TCs are mentioned twice, it is not a error.

So this TC has fallowing chances:
* 2/1565 for dropping from weap81;
* 1/1565 for dropping from armo81;
* 6/1565 for dropping from weap84;
* 3/1565 for dropping from armo84;
* 15/1565 for dropping from weap87;
* 8/1565 for dropping from armo87;
* 1530/1565 for dropping from "Act 5 (H) Equip B".

Let's assume that the game decided to drop from armo87. This TC has picks=1, NoDrop=0, Item1="Diadem", Prob1=3, Item2="Corona", Prob2=3, Item3="Sacred Armor", Prob3=3, Item4="Ogre Gauntlets", Prob4=3, Item5="Myrmidon Greaves", Prob5=3, Item6="Colossus Girdle", Prob6=3, Item7="Dream Spirit", Prob7=1, Item8="Guardian Crown", Prob8=1, Item9="Vortex Shield", Prob9=1, Item10="Bloodlord Skull", Prob10=1.
So armo87 has following chances:
* 3/22 for Diadem;
* 3/22 for Corona;
* 3/22 for Sacred Armor;
* 3/22 for Ogre Gauntlets;
* 3/22 for Myrmidon Greaves;
* 3/22 for Colossus Girdle;
* 1/22 for Dream Spirit;
* 1/22 for Guardian Crown;
* 1/22 for Vortex Shield;
* 1/22 for Bloodlord Skull.
 
Last edited:

maxicek

Moderator
Staff member
Dec 24, 2019
270
188
43
4.2 Monstats.txt

This file holds a lot of information about monsters. I will describe fields that you need to know for better understanding of item generation.

Id - internal name of a monster type, the game refers to a monster using this field.
NameStr - it is either the actual name of the monster or a reference to the name table for names with spaces.
rangedtype - 1 for monsters with ranged attack, blank for others.
minion1 and minion2 - type of minions for the monster, e.c. normal fallen shamans usually have normal fallens as minions.
PartyMin-PartyMax - the range for the quantity of minions.
MinGrp-MaxGrp - the range for the quantity of normal monsters in one group.
Velocity - walk speed.
Run - run speed.
Level - monster level in Normal difficulty.
Level (N) - Only for bosses. Monster level in Nightmare difficulty
Level (H) - Only for bosses. Monster level in Hell difficulty.
lUndead - 1 for melee undeads.
hUndead - 1 for ranged undeads.
demon - 1 for demons.
boss - 1 for bosses. They save their mlvl in Nightmare and Hell difficulties.
Drain, Drain(N), Drain(H) - life and mana leech effectiveness in Normal, Nightmare and Hell difficulties (percents).
coldeffect, coldeffect(N), coldeffect(H) - chill and freeze effectiveness in Normal, Nightmare and Hell difficulties (percents).
ResDm, ResDm(N), ResDm(H) - damage resistance in Normal, Nightmare and Hell difficulties (percents).
ResMa, ResMa(N), ResMa(H) - magic resistance.
ResFi, ResFi(N), ResFi(H) - fire resistance.
ResLi, ResLi(N), ResLi(H) - lightning resistance.
ResCo, ResCo(N), ResCo(H) - cold resistance.
ResPo, ResPo(N), ResPo(H) - poison resistance.
ToBlock, ToBlock(N), ToBlock(H) - chance to block.
Crit - critical hit chance (5% for everyone ATM).
TreasureClass1 - TC of normal monster in Normal difficulty.
TreasureClass2 - TC of champion monster in Normal difficulty.
TreasureClass3 - TC of unique monster in Normal difficulty (non-quest drop).
TreasureClass4 - TC of unique monster in Normal difficulty (quest drop).
TreasureClass1(N) - TC of normal monster in Nightmare difficulty.
TreasureClass2(N) - TC of champion monster in Nightmare difficulty.
TreasureClass3(N) - TC of unique monster in Nightmare difficulty (non-quest drop).
TreasureClass4(N) - TC of unique monster in Nightmare difficulty (quest drop).
TreasureClass1(H) - TC of normal monster in Hell difficulty.
TreasureClass2(H) - TC of champion monster in Hell difficulty.
TreasureClass3(H) - TC of unique monster in Hell difficulty (non-quest drop).
TreasureClass4(H) - TC of unique monster in Hell difficulty (quest drop).
TCQuestId and TCQuestCP - values for special quest drops like Mephisto's Solestone.

The most important part for item drops is Treasure Classes of the monster and his level. I also included some other interesting fields.


4.3 Magicprefix.txt and Magicsuffix.txt

These two files contain all affixes, available in the game. They have almost the same field, that is why I put them in the same chapter.

Name - the name of the affix as it appears in the game.
version - 0 for Classic, 100 for LoD.
spawnable - 1 for available affixes, 0 for affixes, that cannot appear in the game.
rare - 1 for affixes, that can appear on rare items, 0 for magic only affixes.
level - minimum Affix Level of item, that may have this affix.
maxlevel - maximum Affix Level of item, that may have this affix.
levelreq - minimum required character level for using an item with this affix.
classspecific - the class, for which this affix will work, - ama, sor, nec, pal, bar, dru or ***. E.c. "Arch-Angel's" prefix will only add skills for sorceress.
classlevelreq - minimum required character level for using an item with this affix. Although it usually is overkilled by levelreq.
frequency - the rate of appearance in the game of this affix (0 for items, that cannot be selected at all).
group - group Id for selecting affixes for rare and crafted items. They cannot have more than one affix per group.
mod1code, mod2code, mod3code - the codes of effects of this affix. These codes refer to internal game functions, however all of them are quite self-explanation, e.c. "ac%" is Armor Class increase, "dmg%" is Damage increase, "res-all" is resist all.
mod1param, mod2param, mod3param - parameters for the affix function. E.c. poison duration in frames, skill index, cold duration in frames.
mod1min, mod2min, mod3min - min parameters for affix function. E.c. minim of life range, given by +life affix.
mod1max, mod2max, mod3max - max parameters for affix function. E.c. maximum of life range, given by +life affix.
transform - 1 for affixes that do color shift on base item.
transformcolor - color code for affixes that do color shift on base item. E.c. "dgld" is dark gold, "lpur" is light purple.
itype1, itype2, itype3, itype4, itype5, itype6, itype7 - Include Type, item type codes of items, on which this affix may occur. These codes are stored in armor.txt, weapon.txt, misc.txt and ItemTypes.txt files.
etype1, etype2, etype3, etype4, etype5, etype6, etype7 - Exclude Type, item type codes of items, on which this affix may NOT occur.
divide, multiply, add - values for modifying item price.

I'll explain usage of this file in detail later, when I'll talk about affix generation, in chapter 11.
 
Last edited:

maxicek

Moderator
Staff member
Dec 24, 2019
270
188
43
4.4 Weapons.txt

This file is used to store information about weapon item types.

name - the name of the weapon as it appears in the game.
type, type2 - item type code, the index of respective raw in itemtypes.txt file.
code - internal item name.
alternateGfx - item code for choosing animation. Unimportant for item generation.
namestr - reference to the table, contained correct name of the item.
version - 0 for Classic, 100 for Lod.
compactsave - empty. Unimportant for item generation.
rarity - the rate of dropping the weapon from weapon racks.
spawnable - 0 for items, that cannot be generated (except special cases like quests), 1 for others.
mindam-maxdam - one-handed damage.
1or2handed - 1 for two-handed weapons, that may be held in one hand by a Barbarian.
2handed - 1 for two-handed weapons.
2handmindam-2handmaxdam - two-handed damage.
minmisdam-maxmisdam - ranged damage.
rangeadder - weapon range adder. Weapon range=1+rangeadder.
speed - base weapon attack speed.
StrBonus - strange bonus for weapon damage. Enhanced damage percent=Strength*StrBonus/100.
DexBonus - dexterity bonus for weapon damage. Enhanced damage percent=Dexterity*DexBonus/100.
reqstr - strength required.
reqdex - dexterity required.
durability - base durability.
nodurability - 1 for indestructible weapons.
level - Quality Level.
levelreq - character level required.
cost - base weapon cost.
gamble cost - gambling cost.
magic lvl - Magic Level (see chapter 11 and chapter 22).
auto prefix - the code number of prefix, that always occurs on the weapon (like +mana on orbs).
OpenBetaGfx - Unimportant for item generation.
normcode - code of normal version of the weapon.
ubercode - code of exceptional version of the weapon.
ultracode - code of elite version of the weapon.
wclass, 2handedwclass - weapon class for animation. Unimportant for item generation.
component - Unimportant for item generation.
hit class - Unimportant for item generation.
invwidth - width of the item in the inventory.
invheight - height of the item in the inventory.
stackable - 1 for stackable weapons (throwing).
minstack-maxstack - the range of quantity of items of this type in on stack.
spawnstack - quantity of items of this type in on stack upon founding.
flippyfile, invfile, uniqueinvfile, setinvfile - graphics files for the weapon.
hasinv - 1 for socketable weapons.
gemsockets - maximum possible number of sockets in the weapon.
gemapplytype - item class for gems and runes. 0 for all weapons.
special - Unimportant for item generation.
useable - 1 for items that you may use (e.c. town portal scroll). 0 for all weapons.
dropsound, dropsfxframe, usesound - sound-related information. Unimportant for item generation.
unique - 1 for special quest items.
transparent, transtbl - not used.
quivered - 1 for weapons, that need ammo.
lightradius, belt, quest, questdiffcheck, missiletype - Unimportant for item generation.
durwarning - Id of low durability warning icon.
qntwarning - Id of low quantity warning icon.
gemoffset - Unimportant for item generation.
bitfield1 - weapon material code (is used in golem creation and rack drop checks).
CharsiMin (and all other *Min fields) - should be minimal quantity of the item in the vendor's price list, but isn't used (see chapter 12).
CharsiMax (and all other *Max fields) - if CharsiMax>0 then she can sell this item (see chapter 12).
CharsiMagicMin (and all other *MagicMin fields) - should be minimal quantity of the item in the vendor's price list, but isn't used (see chapter 12).
CharsiMagicMax (and all other *MagicMax fields) - if CharsiMagicMax>0 then she can sell this item (see chapter 12).
CharsiMagicLvl (and all other *MagicLvl fields) - if ilvl>=CharsiMagicLvl then she can sell this item (see chapter 12).
Source Art, Game Art, Transform, InvTrans, SkipName - Unimportant for item generation.
NightmareUpgrade - item code for selling by Nightmare difficulty vendors, "xxx" for items that don't get upgraded (see Chapter 12).
HellUpgrade - item code for selling by Hell difficulty vendors, "xxx" for items that don't get upgraded (see Chapter 12).
Nameable - 1 for items that may be personalized.
PermStoreItem - Unimportant for item generation.


4.5 armor.txt

This is a similar file to weapons.txt.

name - the name of the weapon as it appears in the game.
version - 0 for Classic, 100 for Lod.
compactsave - Unimportant for item generation.
rarity - the rate of dropping the armor from weapon racks.
spawnable - 0 for items, that cannot be generated (except special cases like quests), 1 for others.
minac-maxac - defence range.
absorbs - not used. Unimportant for item generation.
speed - run/walk speed penalty.
reqstr - strength required.
block - base chance to block.
durability - base durability.
nodurability - 1 for indestructible armors.
level - Quality Level.
levelreq - character level required.
cost - base weapon cost.
gamble cost - gambling cost.
code - internal item name.
namestr - reference to the table, contained correct name of the item.
magic lvl - Magic Level (see chapter 11 and chapter 22).
auto prefix - the code number of prefix, that always occurs on the armor (like poison damage on heads).
alternategfx, OpenBetaGfx - Unimportant for item generation.
normcode - code of normal version of the armor.
ubercode - code of exceptional version of the armor.
ultracode - code of elite version of the armor.
spelloffset, component - Unimportant for item generation.
invwidth - width of the item in the inventory.
invheight - height of the item in the inventory.
hasinv - 1 for socketable armors.
gemsockets - maximum possible number of sockets in the armor.
gemapplytype - item class for gems and runes. 1 for headgear and body armor, 2 for shields.
flippyfile, invfile, uniqueinvfile, setinvfile - graphics files for the armor.
rArm, lArm, Torso, Legs, rSPad, lSPad - types of used graphics files.
useable - 1 for items that you may use (e.c. Town portal scroll). 0 for all armors.
throwable - not used.
stackable - 1 for stackable items (not used for armors).
minstack-maxstack - the range of quantity of items of this type in on stack (not used for armors).
type, type2 - item type code, the index of respective raw in itemtypes.txt file.
dropsound, dropsfxframe, usesound - sound-related information. Unimportant for item generation.
unique - 1 for special quest items.
transparent, transtbl - not used.
quivered - 1 for weapons, that need ammo (not used for armors).
lightradius, belt, quest, questdiffcheck, missiletype - Unimportant for item generation.
durwarning - Id of low durability warning icon.
qntwarning - Id of low quantity warning icon (not used for armors).
mindam-maxdam - damage range for smite or kick.
StrBonus - strange bonus for kick damage. Enhanced damage percent=Strength*StrBonus/100.
DexBonus - dexterity bonus for kick damage. Enhanced damage percent=Dexterity*DexBonus/100.
gemoffset - Unimportant for item generation.
bitfield1 - armor material code (is used in golem creation and rack drop checks).
CharsiMin (and all other *Min fields) - should be minimal quantity of the item in the vendor's price list, but isn't used (see chapter 12).
CharsiMax (and all other *Max fields) - if CharsiMax>0 then she can sell this item (see chapter 12).
CharsiMagicMin (and all other *MagicMin fields) - should be minimal quantity of the item in the vendor's price list, but isn't used (see chapter 12).
CharsiMagicMax (and all other *MagicMax fields) - if CharsiMagicMax>0 then she can sell this item (see chapter 12).
CharsiMagicLvl (and all other *MagicLvl fields) - if ilvl>=CharsiMagicLvl then she can sell this item (see chapter 12).
Source Art, Game Art, Transform, InvTrans, SkipName - Unimportant for item generation.
NightmareUpgrade - item code for selling by Nightmare difficulty vendors, "xxx" for items that don't get upgraded (see Chapter 12).
HellUpgrade - item code for selling by Hell difficulty vendors, "xxx" for items that don't get upgraded (see Chapter 12).
mindam, maxdam - not used.
Nameable - 1 for items that may be personalized.


4.6 Misc.txt

This file is similar to weapons.txt and armor.txt, but contains information about all items, that are neither weapons nor armor.

name, *name - the name of the item as it appears in the game.
szFlavorText, compactsave - Unimportant for item generation.
version - 0 for Classic, 100 for Lod.
level - Quality Level.
levelreq - character level required.
rarity - the rate of dropping the item from different objects (e.c. book shelves).
spawnable - 0 for items, that cannot be generated (except special cases like quests), 1 for others.
speed - not used for misc items.
nodurability - 1 for indestructible items.
cost - base item cost.
gamble cost - gambling cost.
code - internal item name.
alternategfx - Unimportant for item generation.
namestr - reference to the table, contained correct name of the item.
component - Unimportant for item generation.
invwidth - width of the item in the inventory.
invheight - height of the item in the inventory.
hasinv - 1 for socketable items.
gemsockets - maximum possible number of sockets in the item (not used for misc items).
gemapplytype - item class for gems and runes (not used for misc items).
flippyfile, invfile, uniqueinvfile - grephics files for the item.
special - not used.
Transmogrify, TMogType, TMogMin, TMogMax - Unimportant for item generation.
useable - 1 for items, that you may use (e.c. Town portal scroll). 0 for all others.
throwable - not used.
type, type2 - item type code, the index of respective raw in itemtypes.txt file.
dropsound, dropsfxframe, usesound - sound-related information. Unimportant for item generation.
unique - 1 for special quest items.
transparent, transtbl - not used.
lightradius, belt - Unimportant for item generation.
autobelt - 1 for items that automatically get placed on the belt.
stackable - 1 for stackable items.
minstack-maxstack - the range of quantity of items of this type in on stack.
spawnstack - quantity of items of this type in on stack upon founding.
quest - >0 for quest items. Unimportant for item generation.
questdiffcheck - Unimportant for item generation.
missiletype, spellicon - not used.
pSpell, state, cstate1, cstate2, len - Unimportant for item generation.
stat1, stat2, stat3 - effect of usable item. E.c. life restore for life potion.
calc1, calc2, calc3 - the value for effect of usable item. E.e. 100% life and mana for full rejuvenation potion.
spelldesc, spelldescstr, spelldesccalc - used to refer to description of item effect.
durwarning - Id of low durability warning icon.
qntwarning - Id of low quantity warning icon.
gemoffset - Unimportant for item generation.
BetterGem - the code of gem for upgrade with cube or shrine.
bitfield1 - item material code (is used in golem creation and rack drop checks).
CharsiMin (and all other *Min fields) - should be minimal quantity of the item in the vendor's price list, but isn't used (see chapter 12).
CharsiMax (and all other *Max fields) - if CharsiMax>0 then she can sell this item (see chapter 12).
CharsiMagicMin (and all other *MagicMin fields) - should be minimal quantity of the item in the vendor's price list, but isn't used (see chapter 12).
CharsiMagicMax (and all other *MagicMax fields) - if CharsiMagicMax>0 then she can sell this item (see chapter 12).
CharsiMagicLvl (and all other *MagicLvl fields) - if ilvl>=CharsiMagicLvl then she can sell this item (see chapter 12).
Source Art, Game Art, Transform, InvTrans, SkipName - Unimportant for item generation.
NightmareUpgrade - item code for selling by Nightmare difficulty vendors, "xxx" for items that don't get upgraded (see Chapter 12).
HellUpgrade - item code for selling by Hell difficulty vendors, "xxx" for items that don't get upgraded (see Chapter 12).
mindam, maxdam - not used.
PermStoreItem - 1 for items that are always available in stores.
multibuy - 1 for items that may be bought with Shift+Click (Multiple Buy function).
Nameable - 1 for items that may be personalized.
*eol - not used (however "eol" is usually End Of Line in programming).
 
Last edited:

maxicek

Moderator
Staff member
Dec 24, 2019
270
188
43
4.7. ItemTypes.txt

This file describes basic item types, like a ring, a melee weapon, a bow.

ItemType - the name of the item type for users.
Code - the name of the item type for references from other files.
Equiv1, Equiv2 - equivalent item types, i.e. codes of types, that include this item type. E.c. Throwing Knife is included in Knife item type.
Repair - 1 for types, whose items may be repaired.
Body, BodyLoc1, BodyLoc2 - Location on player body. Unimportant.
Shoots - ammo type for weapons, that need them.
Quiver - type of ammo for item types, that are ammo.
Throwable - 1 for throwable item types.
Reload - 1 for item types, that reloads ammo from inventory (like crossbows and bows).
ReEquip - 1 for item types that are automatically equipped from inventory after running out (like throwing potions).
AutoStack - 1 for stackable items that are automatically organized in stacks when you pick them (like keys).
Magic - 1 for items that can be magic.
Rare - 1 for items that can be rare.
Normal - 1 for items that can be normal quality.
Charm - 1 for charms.
Gem - 1 for gems.
Beltable - 1 for items that you may put on your belt.
MaxSock1 - maximum socket number for Ilvl<=25.
MaxSock25 - maximum socket number for Ilvl<=40.
MaxSock40 - maximum socket number for Ilvl>40.
TreasureClass - 1 for item types, that gets automatic Treasure Classes. E.e. Weap87, Armo03.
Rarity - item drop probability. It is used for automatic Treasure Classes (see TreasureClassEx.txt description in chapter 4.1).
StaffMods - the type of staffmods that are generated on the item type (see chapter 11 for description of staffmods).
CostFormula - Unimportant.
Class - class requirement.
VarInvGfx, InvGfx1, InvGfx2, InvGfx3, InvGfx4, InvGfx5, InvGfx6 - some unimportant graphics information.
StorePage - the type of page in stores for selling this item type.
*eol - not used (however "eol" is usually End Of Line).


4.8. itemratio.txt

This is the most important file for determining the quality of an item. First I'll briefly explain it's fields, then I'll explain quality calculation mechanics.

Function - the description of the line.
Version - 0 for Classic, 1 for Lod.
Uber - 1 for exceptional and elite items, 0 for normal items.
Class Specific - 1 for class specific items, 0 for all others.
Unique - basic chance for unique items (1:Unique).
UniqueDivisor - the value for modifying basic chance for unique items (see description below).
UniqueMin - minimum value in calculating unique chance.
Rare - basic chance for rare items.
RareDivisor - the value for modifying basic chance for rare items.
RareMin - minimum value in calculating rare chance.
Set - basic chance for set items.
SetDivisor - the value for modifying basic chance for set items.
SetMin - minimum value in calculating set chance.
Magic - basic chance for magic items.
MagicDivisor - the value for modifying basic chance for magic items.
MagicMin - minimum value in calculating magic chance.
HiQuality - basic chance for high quality items.
HiQualityDivisor - the value for modifying basic chance for high quality items.
Normal - basic chance for normal quality items.
NormalDivisor - the value for modifying basic chance for normal quality items.

As you see the itemratio.txt file contains two rows for Classic mode and four rows for LoD mode in this order. The two rows for Classic mode include the raw for normal and the raw for exceptional items in this order. Four rows for LoD mode includes: 1) the raw for non-class specific normal items, 2) the raw for non-class specific exceptional and elite items, 3) the raw for class specific normal items and 4) the raw for class specific exceptional and elite items in this order.
The game selects correct raw using Version, Uber and Class Specific fields before starting the calculations.

The game selects quality for an item only when it already knows its item level and item type. It does the check for unique quality first. If it is successful it stops the algorithm and generates unique item or triple durability rare (or magic/normal item if this item type cannot be rare). If a unique check is failed, the game makes a set check by the same manner, then rare check, then magic check, then normal check, until some check will show success. If all checks fall it will generate a low quality item.

Here is quality check algorithm:

1) Find the proper line in itemratio.txt.
2) Chance = (BaseChance - ((ilvl-qlvl)/Divisor)) * 128
3) if (we check for unique, set or rare quality) EffectiveMF=MF*Factor/(MF+Factor)
else EffectiveMF=MF
4) Chance= Chance* 100/(100+ EffectiveMF).
5) if (Chance<MinChance) Chance=MinChance
6) FinalChance=Chance-(Chance*QualityFactor/1024)
7) If (RND[ FinalChance ]<128) return Success
else return Fail

BaseChance - The value from Unique, Rare, Set, Magic, HiQuality and Normal fields of itemratio.txt.
ilvl - Item Level, usually ilvl=mlvl.
qlvl - quality level of item type.
Divisor - The value from UniqueDivisor, RareDivisor, SetDivisor, MagicDivisor, HiQualityDivisor and NormalDivisor fields of itemratio.txt.
MinChance - The value from UniqueMin, RareMin, SetMin, MagicMin fields of itemratio.txt. For high quality and Normal items MinChance=0.
QualityFactor - The value from Unique, Set, Rare, Magic fields of TreasureClassEx.txt file for TC of the monster that dropped this item.

I'll discuss quality selection mechanics more in chapter 8.
 
Last edited:

maxicek

Moderator
Staff member
Dec 24, 2019
270
188
43
5. Area, monster and item levels

I'm sorry if you find the above information a bit hard and huge, - it is needed for you if you want to know everything about the item drop process. Now we will learn something more interesting.

How does the game calculate levels of monsters when it creates the map?
In normal difficulty all normal monsters have fixed levels, that may be found in monstats.txt file. In Nightmare and Hell difficulties all normal monsters have levels equal to area levels, where they are placed.
Area levels can be found in the Levels.txt file. Facts & Formulae Archive also has area levels list.
Champions get +2 bonus to their levels. Unique monsters and their minions get +3 bonus to their levels.
There are a few exceptions from this rule, though. Bosses, monsters that have boss=1 in monstats.txt file, have fixed level, stated in monstats.txt file, and don't get level upgrades.
Here is their full list:

Code:
Id               NameStr           Level   Level(N)   Level(H)

andariel         Andariel             12      49         75
duriel           Duriel               22      55         88
radament         Radament             16      49         83
mephisto         Mephisto             26      59         87
diablo           Diablo               40      62         94
summoner         Summoner             18      55         80
izual            Izual                29      60         86
bloodraven       Bloodraven           10      43         88
griswold         Griswold              5      39         84
nihlathakboss    Nihlathak            65      70         92
baalcrab         Baal                 60      75         99
putriddefiler1   Putrid Defiler       35      61         80
putriddefiler2   Wretched Defiler     37      62         81
putriddefiler3   Fetid Defiler        38      63         82
putriddefiler4   Rancid Defiler       39      64         83
putriddefiler5   Rank Defiler         40      65         84
All Uber Bosses are level 110.

Items that are dropped by monsters have Item Levels equal to Monster Levels.


6. TC selection and number of dropped items

I explained everything about this question in chapter 4.1, TreasureClassEx.txt. However Thrugg have posted much simpler description of it:

Thrugg said:
First is to know what TC a creature is supposed to drop from. For that you need to look up monstats.txt. This lists every monster in the game. Find the one you want (can be non trivial because they use tags which are not the same as the display names in game). Moon Lords are bloodlord5, as it happens. Scroll way over to the right end of the row, and you will see a whole bunch of TCs listed. These are, respectively, the TCs dropped by regular, champion and unique versions of the monster in each of normal, NM and Hell.

That's step 1 :) Next, back to TreasureClassEx.txt we go. In normal you just look up directly at the TC and off you go, but in NM and Hell we have "TC upgrades". This is what the two columns that I haven't explained yet are for - "group" and "level". In NM or Hell, if a monster's level is higher than the level of his base TC, and there is another TC in the same group which is higher level but still equal to or less than his monster level, it will upgrade to that TC.

After you found the line in TreasureClassEx.txt file, that describes the drops of that monster you may calculate the number of his drops and types of dropped items. The game takes several picks from given TC. The number of picks stored in the Picks column of TreasureClassEx.txt file. Typically all normal monsters have one pick. Every pick has a chance for no dropping item at all.

When you play a multiplayer game, you have the total number of people in the game, say N.

All monsters get HP and exp multiplied by (N+1)/2. This is well known and also doesn't matter whether the players are partied, close by, whatever.

If you are playing off-realm you can also use /players X to raise the number of players to X > N. Then the HP and exp will scale up further to (X+1)/2 as you would expect.

Drops, however, are not the same. When you kill a monster in a multiplayer game, the game calculates a number to use as the nodrop exponent. This is not simply N.
It counts 1 for you, the killing player.
It counts 1 more for each player that is (a) partied with you and (b) within two screens of you.
It counts 0.5 for each other player, either unpartied or far away.
It rounds the final total down.

So, if you sneak into a full public game on the realms and don't party up but go MFing on your own, you actually only get a nodrop exponent of 4 (1 for you, 3 for the 7 unpartied players rounded down), while the other partied guys are getting an exponent of 7 (7 people in their party, and you rounded down to 0). Even though all of you are killing p8 monsters with their 4.5x HP. It is one of Blizzard's many measures to encourage party play.

You have your nodrop number (e.g. for Meph, this is 15) and your total of other drops (for Meph this is 65). This means the total ratio of nodrops in solo play is 15/(15+65) = 15/80 = ~19%.

You then apply your nodrop exponent (call it n) like this:
new nodrop rate = (base nodrop rate)^n
new nodrop number = new nodrop rate / (1 - new nodrop rate) * total drops, rounded down.

For example, Meph, nodrop exponent = 1
new nodrop rate = (15/80)^1 = 15/80
new nodrop number = 15/80 / (1 - 15/80) * 65 = 15/65 * 65 = 15 (just showing you that it works even for n=1)

Meph, nodrop exp = 2
new nodrop rate = (15/80)^2 = 0.03515625
new nodrop number = 0.03515625 / (1 - 0.03515625) * 65 = 0.036437 * 65 = 2 after rounding.
So with exponent = 2, Meph is already only missing drops 2/67 of the time.

Meph, nodrop exp = 3
new nodrop rate = (15/80)^3 = 0.00659
new nodrop number = 0.00659 / (1 - 0.00659) * 65 = 0.00664 * 65 = 0 after rounding.
So with exponent = 3, Meph is always dropping in full.

It is unfortunately extremely hard to test this empirically. Enough weird stuff happens that also seems to hide drops, plus Meph gets 7 drop chances and only 6 items can drop, that it is too hard to tell 2/67 apart from 0. So it could actually be that all this time we've been running Meph at players3 in SP to get full drops when really we are just getting exp=2 drops - you'd need to run him at players5 to get guaranteed full drops.

Extra players added using the /players command only count as unpartied players.

This makes no difference to what we already knew for monster HP and XP.

It does change what we thought was happening with drops. Unpartied players count as halves rounded down.

So, when using the Atma drop calculator, you need to translate your /players setting into the number you put into the Players field:

1 or 2 -> 1
3 or 4 -> 2
5 or 6 -> 3
7 or 8 -> 4

This affects all monsters, not just Mephisto, although for unique monsters like Pindle and random bosses that have fixed drops, it won't actually change any numbers.

It should also be noted that the things you "know" are still mostly true. You can keep running Meph on p3. In retrospect I always wondered why people ran him on p3 instead of p2, when the difference in drops is so tiny. Well, it turns out that running at p3 is actually what I thought was p2, and p2 is no different than p1, so now it makes sense. You may still see a 5 drop every now and then at p3, but not often enough that it is worth going higher.

Ultimately, if you are MFing, there is rarely a reason to use an even number setting. The only difference between an even number and the number one lower is slightly more exp, but only one-for-one with the increased HP. So your drops per HP are lower and exp per HP is the same.
For fast levelling, when all you care about is the most exp per monster you can get, p8 is still worthwhile.
 
Last edited:

maxicek

Moderator
Staff member
Dec 24, 2019
270
188
43
7. Item type selection

Again I refer you to Chapter 4.1 where I described this process in all details. Here I will include another Thrugg's explanation, because he did it perfectly.

Thrugg said:
The TCs are like a giant tree, and it is all defined in TreasureClassEx.txt. Each row in that file defines a TC, and lists the sub TCs it can drop from. You roll to see which sub TC you go to, then look at that row, then roll again and so on until you get down to an actual item.

Each sub TC is not equal. For example, Hell Mephisto's TC is
Mephisto (H) 7 983 983 983 1024 15 "gld,mul=2048" 5 "Act 4 (H) Equip A" 52 "Act 4 (H) Junk" 5 "Act 4 (H) Good" 3
This says he gets 7 drops, bonuses of 983 to U/S/R, 1024 bonus to Magic which is why he always drops at least magic.
Next is 15 no-drop.
Then 5 gold with a 2048 multiplier (means decent sized stacks).
Then 52 Act 4 (H) Equip A, which contains equipment items appropriate for the early part of Act 4 Hell.
Then 5 Act 4 (H) Junk, which contains a bunch of crap.
Then 3 Act 4 (H) Good, which contains good non-equipment items appropriate for Act 4 Hell. This is gems, runes, jewels, charms, rings, amulets.

The numbers (15, 5, 52, 5, 3) are the chances of going to each subTC with each drop. They add up to 80. So you have a 15/80 chance of going to no-drop and getting nothing - but that is with each drop. You can go there once and still get your full 6 drops (he gets 7 chances but every monster can drop at most 6 items). 52/80 equipment is why he drops quite so much of that. 3/80 good is kind of low, which is why bosses aren't much good for runes.

Let's have a look at Act 4 (H) Equip A.
Act 4 (H) Equip A 1 weap69 2 armo69 1 weap72 6 armo72 3 weap75 14 armo75 7 weap78 2 armo78 1 Act 3 (H) Equip B 1530
This means you get 1 item, with 2 chances of weap69 and 1 chance of armo69, etc. You also have 1530 chances (!) of dropping down to Act 3 (H) Equip B.
Several things to note here. First, weapons are always twice as common as armour.
Also, while this is why Mephisto can drop from TC78, he really isn't likely to (especially armour in TC78). Only 1/1566 of Meph's equipment drops will be from armo78, while he is 7 times more likely to drop from armo75.
It looks like he is unlikely to drop from TC69 also, however he drops down to A3(H)EqB almost all the time, and that has a similar TC window shifted one back, i.e. TC66 up to TC75. So he actually gets quite a few chances to drop TC69 further down the tree.

The main reason why TC3s are so rare is that this rolling window stops when it hits the bottom, so you just get that one very last chance at TC3s.

Suppose you are lucky and you get your 1/1566 chance of armo78 from Meph. This is called an "atomic TC" and it is not defined in TCEx.txt. Instead, it is defined by armor.txt, also in your Atma directory. It contains all armours which have level (often called qlvl) 76, 77 or 78. You can also see base item qlvls at d2data.net. Armo78 contains Balrog Skin, Hellforge Plate, Troll Nest, Crusader Gauntlets and Earth Spirit in 1.10. As always when D2 makes a list, it has rarities associated too. Rarities at this level are pretty simple. All items have rarity 3 except class-specific items have rarity 1, assassin claws have rarity 2, and wands, staves and sceptres (rods) have rarity 1. Armo78 has total rarity 3+3+3+3+1=13, so you have a 3/13 chance of getting a Balrog Skin, and a 1/13 chance of getting an Earth Spirit. Meph is not your ideal source for a Spirit Keeper.

You'll note we split off from runes and rings and amulets a long way back. The game decides if you are getting an equipment item or something else very early on.

By now, we have decided the base item you are getting. Next, the MF process starts, to decide what quality it will be.

8. Item quality selection

The explanation here is given for monster drops. Most chests and other objects use the same algorithm of quality determination, however special chests have also fixed chances for unique, set, rare and magic items, see chapter 17.

The exact mechanics of quality determination can be found in the chapter 4.8, itemratio.txt. Here I will describe it even more and will give an example.

After the game has calculated item level and selected an item type to drop, it selects item quality. It is done by performing a row of tests for unique, set, rare, magic, high and normal quality. If some test return success it will cancel all other tests, if all tests return fail it will generate low quality items.

The test is calculating a Value and generates a random number in 0-(Value-1) range. If this random number is less than 128 then the test will return success. So we have 128/Value chance to get that quality.

Here is quality check algorithm:

1) Find the proper line in itemratio.txt.
2) Chance = (BaseChance - ((ilvl-qlvl)/Divisor)) * 128
3) if (we check for unique, set or rare quality) EffectiveMF=MF*Factor/(MF+Factor)
else EffectiveMF=MF
4) Chance= Chance* 100/(100+ EffectiveMF).
5) if (Chance<MinChance) Chance=MinChance
6) FinalChance=Chance-(Chance*QualityFactor/1024)
7) If (RND[ FinalChance ])<128 return Success
else return Fail

BaseChance - The value from Unique, Rare, Set, Magic, HiQuality and Normal fields of itemratio.txt.
ilvl - Item Level, usually ilvl=mlvl.
qlvl - quality level of item type.
Divisor - The value from UniqueDivisor, RareDivisor, SetDivisor, MagicDivisor, HiQualityDivisor and NormalDivisor fields of itemratio.txt.
MinChance - The value from UniqueMin, RareMin, SetMin, MagicMin fields of itemratio.txt. For high quality and Normal items MinChance=0.
QualityFactor - The value from Unique, Set, Rare, Magic fields of TreasureClassEx.txt file for TC of the monster that dropped this item.

Let's look at it more attentively.

At the first step the game finds a suitable line in itemratio.txt. As you know, there are separate lines for Classic/LoD games, class specific/non-class specific items and normal/exceptional and elite items.
After finding a proper line it has all the values that it needs for calculations: item level, quality level, base quality chance, quality divisor, minimum quality chance, MF%, MF diminishing returns factor and monster quality factor.
Let's repeat again where the game takes them.
Item level is just equal to monster level. Quality level is the level of item type. MF% are taken from players equipment. MF diminishing returns factor is 250 for unique, 500 for set and 600 for rare qualities. All other values are taken from itemratio.txt file, except monster quality factor. The last is the maximum value from Unique, Set, Rare, Magic fields of TreasureClassEx.txt file for all TCs that the game has scanned, searching for this item type.
At the last step we just have 128/FinalChance chance to get Success.

Let's take an example.

Say Hell Baal is dropping Unearthed Wand with 200% MF.
The check for unique:
1) Use line #5, "Uber".
2) ilvl=99 (from monstats.txt), qlvl=86 (from weapons.txt), BaseChance=400 (for unique from itemratio.txt), Divisor=1.
Chance = (BaseChance - ((ilvl-qlvl)/Divisor)) * 128=49536.
3) Factor=250 for unique quality.
EffectiveMF=MF*Factor/(MF+Factor)=111.
4) Chance= Chance* 100/(100+ EffectiveMF)=23476
5) Chance< MinChance (false, because 23476>6400).
6) QualityFactor=983 for Hell Baal (from TreasureClassEx.txt).
FinalChance=Chance-(Chance*QualityFactor/1024)=939.

If the game generates a random number in 0-(FinalChance-1) range (rnd[FinalChance] function), that will be less than 128, it will generate a unique Unearthed Wand. So you have 128:939 chance per Unearthed Wand pick to get unique.
If the game failed to generate a unique Unearthed Wand it will try to generate a set, then rare and so on.

For some item types and if the monster level is less than the quality level of a unique or set item, the game will generate a high durability item.

So if you find Bramble Mitts, the game will check to see if they are Unique (whether or not there is a Unique of a given item type doesn't matter at this point), if that fails then Set, if that fails then Rare, and so on. If the roll for Unique or Set succeeds and there is not one of that base item (which happens quite often with Elite Uniques, and can happen with Elite, Excep, or normal sets) a lower quality item with bonus durability will be generated. Details:

* If you roll a Unique when one of that type does not exist or from a monster not high enough to drop it, you'll get a Rare of that type item with 3x the normal durability.
* If you roll a Set when one of that type does not exist or from a monster not high enough to drop it, you'll get a Magical of that type item with 2x the normal durability.
* Both of these can also happen when monsters aren't high enough to drop the given set or unique.
* This also happens with Uniques, if the same one is selected to drop more than once in a game. Since it can only drop once, the 2nd, 3rd, etc times it will drop to a 3x durability Rare.


9. Set and unique items selection

Let's assume that after the previous steps the game has selected a certain item type and unique or set item quality. After that it completes the list of all possible items with this type and quality, that has quality level less or equal to Ilvl of the item. After that it has several possibilities:
1) If there is no item in that list the game generates a high durability item.
2) If there is only one item of that type it just selects it for dropping.
3) If there are several items in the list, it selects one of them randomly according to their rarity. The chance for an item to be dropped in this case is ItemRarity/TotalRarity, where TotalRarity is the sum of rarities of all items in the list.

I will give three examples, - one for every case.

Example #1. Hell Pindleskin decides to drop Spiderweb Sash. Then he rolls for unique item quality. The game creates a list of all unique Spiderweb Sashes, that have Qlvl less or equal to Ilvl (Qlvl<=86). The resulting list will be empty, because there are no such items in the game files, only unique Spiderweb Sash, Arachnid Mesh, has Qlvl=87, so it cannot be dropped by Mlvl=86 monster. So the list is empty, the game drops 3x durability rare Spiderweb Sash, and the poor player starts pulling hair from his back, blaming Pindleskin, The Game and Blizzard entirely. :)

Example #2. Hell Pindleskin decides to drop Sacred Armor. Then he rolls for unique item quality. The game creates a list of all unique Sacred Armors, that has Qlvl<=86. The result list will contain just one item, that meets all those restrictions. It is Templar's Might, another unique Sacred Armor, Tyrael's Might, cannot be dropped because it has higher Qlvl (87). So the list contains just one item, the game drops Templar's Might just to confuse the player a bit before he realises that he is running Pindle, not Baal. :)

Example #3. Hell Pindleskin decides to drop a Ring. Then he rolls for unique item quality. The game creates a list of all unique Rings that have Qlvl<=86. The result list will contain nine items, all unique rings have Qlvl<=86. So he needs to select one of them. He summarises rarities of all items in the list: 15+15+1+1+10+10+3+1+3=59 and generates a random number to select one of them. So Nature's Peace has 3/59 chance to drop, and SoJ has only 1/59. Our poor player more likely will get another Nagel, Manald's, Raven's or Dwarf's ring (they are 50/59 of all Pindle's unique rings). :)


10. Sockets' number selection

If the game creates a socketed item it must generate a number of sockets. You may find all information about sockets in armor.txt, weapons.txt and ItemTypes.txt data files. Misc items cannot have sockets. I will cover details later, but let me start with some basic information.

First of all you need to know what items may have sockets at all.
This items can have sockets:
* Any weapon except throwing
* Any body armor
* Any shields
* Any headgear
Other items cannot have sockets.

The most interesting information about socketed items is how many sockets they can have.
In the beginning I will discuss items that you find in battlefields or buy at shops.

Most Unique and Set items typically don't have sockets at all (originally). The number of sockets in unique or set items that still have them, either is fixed or randomly selected from a fixed range with equal probability. The information about their sockets are stored in UniqueItems.txt and SetItems.txt data files. For example Griswold's Heart (Set Ornate Plate) always has three sockets, Crown of Ages (Unique Corona) has one or two sockets with 1/2 chance of each.

Original Rare items have one or two sockets with 1/2 chance of each when they have Mechanist's affix. See chapter 11 about affix selection mechanics if you want to know how frequently this affix may appear. Note that not all rare items may have two sockets. If the maximum sockets cap for its base item is one, that Mechanist's rare item will always have one socket. An example of such an item is a rare buckler.

Original Magic items have sockets only if they have one of the following prefixes: Mechanist's (1 or 2 sockets with 1/2 chance of each), Artisan's (3 sockets) and Jeweler's (4 sockets). Socketed magic items cannot have more sockets than is allowed by its base item type.

1/3 of all normal and superior items are socketed. The number of sockets is generated randomly from the range, that is affected only by item type and item level. Minimum possible sockets number are always 1. Maximum sockets number can be found in armor.txt, weapon.txt and ItemTypes.txt data files for every item type. For example let me take Long Battle Bow. You can find "6" in "gemsockets" column and "bow" in "type" column of weapon.txt in its line. For "bow" type ItemTypes.txt has "3", "4" and "6" in "MaxSock1", "MaxSock25" and "MaxSock40" columns. That means that Long Battle Bow has maximum 3 sockets before Ilvl<=25, 4 sockets before Ilvl<=40 and 6 sockets after Ilvl=40.

Low quality items cannot originally have sockets.

If you are not happy with the number of sockets in your item you have several possibilities to change it. I will give the word on this question to Uzziah.

Uzziah said:
Normal items (grey colored), there are 3 basic methods to get normal socketed items:
a) Find it
b) Use the socketing quest
c) Use cube recipes

Using the socketing quest, throughout the game you get 3 quests that allow you to socket items. Since you only get 3 chances to do this you may want to use these chances wisely when playing untwinked. Typically one uses this quest on a normal item when they wish to use runewords. Runewords do not replace staffmods or superior affixes on an item, so having these affixes appear on a white item will encourage you to socket the item for using a runeword.

The quest always gives the maximum sockets allowed on a normal item. Maximum sockets allowed in an item are dependent on the item and the ilvl.

Using cube recipes this is used when you are out of quests and need sockets for runewords or when your runeword does not require the maximum sockets available to the item type.
Socketing recipes:
1.Tal, Thul, Ptopaz, normal body armor
2.Ral, Amn, PAmethyst normal weapon
3.Ral, Thul, PSaphire, normal Helm
4.Tal, Amn, PRuby, normal shield
Low quality to normal quality:
1.Eld, chippy, low quality weapon
2.El, Chippy, low quality armor

Using the low quality to normal quality recipes changes the ilvl of the item to 1. From the above comment about maximum sockets and how they are related to ilvl, one could use this to their advantage. They could get an elite item, such as a phase blade, and use the recipe to make it a normal item then socket it to only have 3 sockets. One would want to do this in order to create runewords needing a smaller number of sockets. "Malice" IthElEth would be an example of one such runeword that may be desired in a phaseblade, but 3 socketed phaseblades may be hard to come by. By finding a low quality one, using the recipe and then socketing with the quest someone could create the 3 socketed phase blade.

The socketing recipes for normal items give a random amount of sockets. Each recipe rolls a number from 1 to 6 and gives that number of socket(s) to the item. When items have less maximum sockets they have a better chance of getting the maximum number of sockets from these recipes.

An example, claws can get up to 3 sockets in them so if one would use the recipe for a claw they would have:
1/6 chance to get 1 socket.
1/6 chance to get 2 sockets
4/6 chance to get 3 sockets

Rare items, there are 4 methods to get rares with sockets:

1. Find a rare with mechanics prefix
2. Use socketing quests
3. Use recipes
4. Reroll (replace the affixes of the item, using a cube recipe)

Using quest is the same as above. Socketing rares using recipes is much more costly than socketing normal items using any method, using the quest here may be a wiser move. The quest will always give 1 socket to rare items. Unique items and set items will also only get 1 socket with the quest reward. Also unique items and set items can only be socketed by using this quest.

There is one recipe for socketing rares and it's expensive:

1. 3xPskulls, SOJ, rare item

The recipe only adds one socket to the rares exactly the same as the quest.

Rerolling is like getting another item with completely different affixes, but it shares the same item type and quality.

Magical items, there are 3 methods to socket magical items

1. Find them
2. Use quest
3. Reroll (replace the affixes of the item, using a cube recipe)


Using the quest on magical items will give that item 1-2 sockets, with equal chance of getting 1 or 2 sockets. This method can be used when desired affixes appear on magical items. Some affixes only appear on magical items and socketing such items will allow them to get more affixes from runes, gems, jewels. One such prefix is the +3 skill tree affixes.

Rerolling is like getting another item with completely different affixes, but it shares the same item type and quality. The magical rerolling recipes are kind of interesting and can be used creatively.
You may socket originally unsocketed unique and set items using Socketing Quests. It always adds just one socket.
 
Last edited:

maxicek

Moderator
Staff member
Dec 24, 2019
270
188
43
11. Affix selection

Magic, rare and crafted items have randomly generated affixes.

At the beginning of the affix generation process the game must decide how many affixes will have the given item.

When Magic Items are created the chances are:
Both Prefix and Suffix: 25%
Only a Prefix: 25%
Only a Suffix: 50%.

Rare Items are really just Magic Items with more than two Magical Prefix/Suffix with a special name.
The names of Rare Items are not connected to their stats, so their name is not helpful in describing what stats might be on a Rare Item. The names are randomly generated, however, some names will not appear with some prefixes and suffixes.
Rare Items have 3 to 6 magical properties or Magic Prefixes or Magic Suffixes. There is 1/4 chance for every affix number to be generated.
Each magical property picked will have a 1/2 chance of being a Prefix or a Suffix, but there will never be more than 3 Prefixes or 3 Suffixes on the same Rare Item.
A Prefix or Suffix will never be picked more than once.
Only one Prefix or Suffix will be picked per Prefix or Suffix group. This means for example, if the Prefix Wyrm (+41-60 Mana) is chosen, Dragon's (+31-40 Mana) will not also be chosen since it belongs to the same Prefix +Mana group. Prefixes and Suffixes of the same types (such as Magic Find, Light Radius, Attack Rating) can be chosen. Only members of the same group cannot be chosen.

Crafted Items have 1-4 Random Magical Prefixes/Suffixes
On top of those fixed properties, a Crafted Item can have from 1-4 standard Rare and Magic Prefix and Suffixes. These are generated pretty much the same way as a Rare item.

At ilvls 1-30, there's a 40% chance of 1 affix and a 20% chance each of 2, 3 or 4 affixes.
At ilvls 31-50, there's a 60% chance of 2 affixes and a 20% chance each of 3 or 4 affixes.
At ilvls 51-70, there's an 80% chance of 3 affixes and a 20% chance of 4 affixes.
At ilvls 71+, there's a 100% chance of 4 affixes.

Ruvanal said:
When an item is generated that has prefixes the alvl is calculated* from ilvl and qlvl as follows

If (ilvl>99) then {ilvl=99}
if (qlvl>ilvl) then {ilvl=qlvl} ;** see note below
if (magic_lvl>0) then {alvl=ilvl+magic_lvl}
else
{
if (ilvl<(99-qlvl/2))
then {alvl=ilvl-qlvl/2}
else {alvl=2*ilvl-99}
}
If (alvl>99) then {alvl=99}

*all calculations use integers so there are no fractions at any step.
** this new ilvl value is only used for the duration of this calculation. The ilvl value that is stored in the items data file will remain unchanged.

Now that the game has decided which prefixes are available for allocation, they will have to select their prefix from the multiple choices in the given group. These are done by the frequency column.

Frequency determines the probability that a prefix is selected, a higher frequency = a greater probability.

Assuming: Mod1freq=5, Mod2freq=3, Mod3freq=2, Mod4freq=1

and you can get only Mod1 & Mod2, then your probabilities would be:

chance to get Mod1 = 5 / (5+3) = 5/8 = 62.5%
chance to get Mod2 = 3 / (5+3) = 3/8 = 37.5%

and if you could get all four,

chance to get Mod1 = 5 / (5+3+2+1) = 5/11 = 45.5%
chance to get Mod2 = 3 / (5+3+2+1) = 3/11 = 27.3%
chance to get Mod3 = 2 / (5+3+2+1) = 2/11 = 18.2%
chance to get Mod4 = 1 / (5+3+2+1) = 1/11 = 9.1%

You can also use maxlevel to filter out the 'lower quality' prefixes at the higher level. By setting the maxlevel so that there is an overlap, you will always have that type of prefix available at all levels, while effectively keeping the prefix pool powerful.
Let me show you one example. Imagine that Normal difficulty Pindleskin has dropped Small Charm with a suffix only. What probabilities of what suffixes you have?

Set Ilvl=45 /* (Normal Pindleskin) */
Set Qlvl=28 /* (Small Charm) */
/*
Ilvl>Qlvl
Ilvl<99-Qlvl/2 (45<85)
*/
Alvl=Ilvl-Qlvl/2 /* Alvl=31 */
Select * from MagicSuffix.txt where itype1=scha, spawnable=1, level<=31

Here is the query result list (number in brackets is frequency):
of Dexterity (4),
of Dexterity (4),
of Greed (4),
of Fortune (3),
of Life (4),
of Substinence (4),
of Strength (4),
of Strength (4),
of Blight (2),
of Venom (1),
of Frost (2),
of the Icicle (1),
of Flame (2),
of Fire (1),
of Shock (2),
of Lightning (1).

There are two entries "of Dexterity" because they are different suffixes with the same name. One of them is "+1 dexterity", another -- "+2 dexterity". "of Strength" suffixes have the same particularity.

Total frequency is 43. It means that our charm has 4/43 chance to have "of Dexterity +1" suffix and 1/43 -- "of Venom".

Now, let me describe here another interesting property of items, that gives you bonuses to a skill or even to a skill tree. They are often called "Staffmods". They are neither prefixes nor suffixes. They are basic item properties like durability.

The best explanation of Staffmods was made by Uzziah with help of Ruvanal. Here it is:

Uzziah said:
From the assassin forum a thread on why someone never saw +3 Tiger Strike.

Code:
Originally Posted by Ruvanal
 
. . .
Claws with staffmods are (itemtype=h2h2)
 
Hand Scythe
Greater Claws
Greater Talons
Scissors Quhab
Suwayyah
Wrist Sword
War Fist
Battle Cestus
Feral Claws
Runic Talons
Scissors Suwayyah
 
 
1st tier skills
 
Fire Trauma (read fire blast: Uzziah)
Claw Mastery
Psychic Hammer
Tiger Strike
Dragon Talon
 
 
2nd tier skills
 
Shock Field (read shockweb: Uzziah)
Blade Sentinel
Quickness (read Boost of Speed: Uzziah)
Fists of Fire
Dragon Claw
 
 
3rd tier skills
 
Charged Bolt Sentry
Wake of Fire Sentry
Weapon Block
Cloak of Shadows
Cobra Strike
 
 
4th tier skills
 
Blade Fury
Fade
Shadow Warrior
Claws of Thunder
Dragon Tail
 
 
5th tier skills
 
Lightning Sentry
Inferno Sentry
Mind Blast
Blades of Ice
Dragon Flight
 
 
6th tier skills
 
Death Sentry
Blade Shield
Venom
Shadow Master
Royal Strike (read Phoenix Strike: Uzziah)
 
 
Base tier to use for an item is determined by the ilvl as
tier: ilvl range
1: 1-11
2: 12-18
3: 19-24
4: 25-36
5: 37+
then there is a random adjustment made for which tier to actually use when selecting the actual skill:
20% chance to add 1
50% chance to stay unmodified
20% chance to subtract 1
10% chance to subtract 2
 
Low quality items have their max tier capped at 4.
 
The game will then randomly select among the 5 skills at that tier.
 
The +X bonus is set by a RND[100] (this will give a range of values from 0 to 99) and if the item is an imbue it will add ilvl/2 (drop fractions).
If 90 or above, +3
Between 60 and 89: +2
Lower than 60: +1
 
The total skills on the item will have been set by a RND[100] and if an imbue add ilvl to that random number.
If 91 or above: 3 skills
Between 71 and 90: 2 skills
70 or lower: 1 skill
This is an example from the assassins point of view but it very fully explains staffmods.

Staffmods are broken into tiers, each tier is typically all skills available at a given level.
All staffmods are randomly created by a function of RND[100]. Basically a number is generated between 0-99 then the if and certain rules apply to determine if and when +skills are given. Then another RND[100] is run to determine the magnitude of the +skills given. Imbuing increases the RND[100] number so you have a better chance of getting the +3, 3 different skills.

The following item types can get staffmods:
wands
scepters
staves
claws (only as listed above, lower claws can not have staffmods)
class specific items (claws separated because not all of them can have staffmods)

Of these items all but druid pelts, barb helms, paladin shields, necro heads appear on weapons. This will intuitively make one think I can reroll using the chippy and such recipes. You can and it will set your ilvl to 25 or 30 respectively that means a base tier of 4.

Wait a minute a base tier of 4 with the chippy recipe but that means that you can get tier 2 staffmods from the subtract 2 clause. But what about the tier 1 staffmods like tiger strike.

Before I mentioned that some staffmods are extremely hard to get. Low level assassin staffmods are the prime example. You can not get a low ilvl/qlvl claw to drop with low level staffmods, you also can not drop the ilvl low enough with magical rerolls. But you can get the rare reroll to drop your item down to ilvl 1 using a character level 1 muling character.

Note this means that you can not get these staffmods as an untwinked character.

12. Items generation at shops

Here I will talk about normal shops, where you can see item properties. Gambling will be described in the next chapter.
Almost all trading information is stored in weapons.txt and armor.txt files. Remember the long chapter 4 in the beginning of the guide? It is there for a reason!

All items at shops have ilvl=clvl+5. In normal difficulty there are ilvl caps for every Act: 12 for act 1, 20 for act 2, 28 for act 3, 36 for act 4 and 45 for act 5. In Nightmare and Hell item levels are not capped.

After the game has calculated ilvl it selects item types to spawn using following algorithm. All ilvl>=25 items will spawn with magic quality.

Normal difficulty:
1) Create item type list with all normal items, that have positive number in *Max field or in *MagicMax field of respective vendor in wepons.txt, armor.txt and misc.txt files (e.c. CharsiMax, GheedMax, CharsiMagicMax), except items that have qlvl higher than ilvl.
2) Exclude all magic items, that have ilvl<*MagicLvl (e.c. CharsiMagicLvl).

Nightmare difficulty:
1) Create item type list with all normal items, that have positive number in *Max field or in *MagicMax field of respective vendor and NightmareUpgrade="xxx", except items that have qlvl higher than ilvl.
2) For all items, that have positive number in *Max field or in *MagicMax field and NightmareUpgrade="xxx", there is (ilvl*64+4000)/100000 chance to be upgraded to exceptional and be added to the list.
3) For all normal items, that have positive number in *Max field or in *MagicMax field of respective vendor, add to the list items, whose codes are in NightmareUpgrade field, except those with NightmareUpgrade="xxx".
4) Exclude all magic items, that have ilvl<*MagicLvl (e.c. CharsiMagicLvl).

Hell difficulty:
1) Create item type list with all normal items, that have positive number in *Max field or in *MagicMax field of respective vendor and HellUpgrade="xxx", except items that have qlvl higher than ilvl.
2) For all items, that have positive number in *Max field or in *MagicMax field and HellUpgrade="xxx", there is (ilvl*128+5000)/100000 chance to be upgraded to exceptional and be added to the list.
3) For all items, that have positive number in *Max field or in *MagicMax field and HellUpgrade="xxx", there is (ilvl*16+1000)/100000 chance to be upgraded to elite and be added to the list.
4) For all normal items, that have positive number in *Max field or in *MagicMax field of respective vendor, add to the list items, whose codes are in HellUpgrade field, except those with HellUpgrade="xxx".
5) Exclude all magic items, that have ilvl<*MagicLvl (e.c. CharsiMagicLvl).

The game will not spawn exceptional or elite items if clvl<25.

Note 1. In nightmare and hell you will not see items that have item type code in NightmareUpgrade and HellUpgrade fields, e.c. Large Axe, Club, Wand.
Note 2. After clvl>=20 all items will spawn with magic quality. However most vendors have MagicLvl=255 for many items. So that items will not be spawned.

Here is a nice algorithm of the game's mechanic, posted by St0rmie.

St0rmie said:
Pseudocode for determining whether a vendor/item combination is available:

__if vendorMax > 0 and qlvl <= 24 and ilvl_cap >= qlvl
____Normal range = qlvl -> 24

__if (vendorMax > 0 or vendorMagicMax > 0) and vendorMagicLvl is not 255
____if vendorMagicMax > 0
______Magic range = max(qlvl,vendorMagicLvl) -> 99
____else
______Magic range = max(qlvl,vendorMagicLvl,25) -> 99

__if normal range and magic range both exist
____if ilvl is in either range
______item is available
____else
______item not available because we're too low level, highlight it

__if only a normal range exists
____if ilvl is in range
______item is available
____else
______item not available, maybe because we're too low level, maybe because we're too high level, highlight it appropriately

__if only a magic range exists
____if ilvl is in either range
______item is available
____else
______item not available because we're too low level, highlight it

__if neither range exists
____item not available, don't even list it
The calculation of magic affixes in shops is the same as when an item is dropped by a monster. Look at the previous chapter.

Now it's time for a casino! :)
 
Last edited:

maxicek

Moderator
Staff member
Dec 24, 2019
270
188
43
13. Gambling

Item types that are available for gambling, directly determined by your clvl. You can find the list of available items at The Arreat Summit: http://www.battle.net/diablo2exp/basics/gambling.shtml.

Item levels are determined by an equation:
ilvl = clvl + rnd[10] - 5
(i.e. from clvl-5 to clvl+4)

The chances for every quality are:
Unique: 1/2000
Set: 1/1000
Rare: 1/10
Magical: 1797/2000

Here are the equations used to determine whether or not the item will become exceptional or elite:
exceptional = 1 + (ilvl - excep qlvl) * 90 / 100
elite = 1 + (ilvl - elite qlvl) * 33 / 100

Magic Find in no way affects gambling.

Affixes are generated as always. See chapter 11 for details.


14. Ethereal items

This is quite simple. Armor or weapons have 5% chance to be ethereal. Indestructible items cannot be ethereal, except items, socketed by Zod rune and unique items, that are always ethereal and indestructible.
Set items cannot be ethereal.
Shopped and cubed items cannot be ethereal too.
Imbued items will maintain their original ethereal or non-ethereal state.


15. Runes and charms generation

I created a separate chapter about this question, because it is very interesting for many people, however runes, charms and gems are not special items, — they are generated as others. All information about their odds are stored in our favorite TreasureClassEx.txt file.

The reason of the fact that jewelry, runes and gems are a bit "special" is that all that items usually combined together into one treasure class, for example Hell Baal drops all his rings, amulets, jewels, runes, charms and gems from "Act 5 (H) Good" TC.

This chapter is organized into several examples about rune, charm and gem generation.

Example 1. Hell Mephisto.

Let me show you how he is good at jewelry, rune and gem drops, or why he drops them quite rarely.
As we see in TreasureClassEx.txt Hell Mephisto makes 7 picks from "Mephisto (H)" TC. For every pick he has a 3/80 chance (~3.75%) to drop from "Act 4 (H) Good" TC, that contains all runes, charms and gems, that he can drop.
"Act 4 (H) Good" TC has 1 pick from following TCs:

60/130 chance to drop from "Jewelry C" TC,
4/130 - from "Chipped Gem" TC,
10/130 - "Flawed Gem",
14/130 - "Normal Gem",
28/130 - "Flawless Gem",
14/130 - "Runes 16".

"Runes 16" TC has 2/47274 chance to drop r32 item (Cham Rune), 3/47274 chance to drop r31 item (Jah Rune) and 47269/47274 chance to drop from "Runes 15" TC (other runes).

Got it? I'll summarize the chances for better understanding.

The chance that Mephisto will drop at least one Cham in p1 game is
1-(1-((3/80)*(14/130)*(2/47274)))^7= ~0.0001196%
(Well, actually this calculation is a bit simplified and a bit incorrect, because Mephisto may have 6 picks, the last seventh pick will be skipped if he will generate 6 items for 6 picks.)

Example 2. Hell Cow

Normal Hell Bovine has Mlvl=81 at Hell difficulty and drops from "Cow (H)" TC.
"Cow (H)" TC contains 1 pick from "Act 5 (H) Good" TC with 3/160 chance in players1 mode (~1.88%).
I'll not show here chances for players8 mode to keep the example simpler.
"Act 5 (H) Good" TC has 1 pick from following TCs with following chances:

60/130 - "Jewelry C" TC,
4/130 - "Chipped Gem" TC,
10/130 - "Flawed Gem",
14/130 - "Normal Gem",
28/130 - "Flawless Gem",
14/130 - "Runes 17".

Accordingly, Hell Cow has around 0.87% (it is (3/160)*(60/130)) chance to drop Jewelry (a ring, an amulet, a jewel or a charm), 0.4% to drop flawless gem and 0.2% to drop a rune.

Example 3. Specter in Hell Worldstone Keep Level 3

Wraith type monsters drop more jewelry, gems and runes then any other monster.
Specter in Hell Worldstone Keep Level 3 has Mlvl=85 and drops from "Act 1 (H) Wraith B", which is upgraded to "Act 5 (H) Wraith C" TC.
"Act 5 (H) Wraith C" TC has 1 pick from "Act 5 (H) Good" TC with 4/104 chance (~3.85%).
The contents of this TC you may see in the previous example.

Example 4. Death Lord in Hell Worldstone Keep Level 3.

Death Lords aren't good at runes. I included him just to compare his drops with Cow's and Wraith's ones.
Death Lord in Hell Worldstone Keep Level 3 (bloodlord5) has Mlvl=85 and drops from "Act 5 (H) H2H C" TC. It has 1 pick from the same TC as in previous examples, "Act 5 (H) Good", but only with 2/160 chance (~1.25%). As you see, it is much lower.

I could include here description of other popular sources of runes, gems and miscellaneous jewelry, but the goal of this guide is not to describe all of them, but to show how you may calculate the drop chances by yourself.


16. Quest drops and Andariel bug

If you look into the monstats.txt file attentively, you'll find that for every monster there are four TC columns for every difficulty of the game. For Hell they are TreasureClass1(H), TreasureClass2(H), TreasureClass3(H) and TreasureClass4(H). It is so because normal monsters, champions, uniques and Act Bosses drop from different TC. For example Dark Stalkers in The Pit level 1 at Hell difficulty have "Act 1 (H) H2H C" base TC when they are normal, "Act 1 (H) Champ C'' when they are champions and "Act 1 (H) Unique C" when they are unique (don't forget that the TCs are upgraded according to their Mlvl).

TreasureClass4(*) column is filled only for Act Bosses. When you kill them, completing their quest, it means at very first time at this difficulty, they drop from TreasureClass4(*) TC. After that they drop from TreasureClass3(*) TC, that usually has slightly worse chances of good items.

In patch 1.10 there is an interesting bug. After you kill Andariel and talk to any NPC (as everyone usually does), she begins to drop items from her quest TC after every following kill. The bug was fixed at Realms, though.


17. Object drops

We start from simple things and will go to more complicated.

From what TC do objects drop items? In TreasureClassEx.txt file there is a group 6, that stores all information about object drops. The name of that TCs is like "Act 5 (H) Chest C".

The TC of the objects, presented in a given area, is calculated using Area Id. Please don't confuse this number with Alvl, - it is a different value. Area Id is also stored in Levels.txt file, though.

Chest drops don't get TC upgrades.

Hammerman said:
This is the table used to get highest/lowest id for acts:

2 = act 1 (low)
37 = act 1 (high), actual highest is 39
41 = act 2 (low)
73 = act 2 (high), actual highest is 74
76 = act 3 (low)
102 = act 3 (high)
104 = act 4 (low)
108 = act 4 (high)
109 = act 5 (low)
132 = act 5 (high)

Then it uses this formula to determine the A/B/C class for the tc:

value = (highest - lowest + 1) / 3

if levelid is < lowest+value, A
if levelid is < lowest+(value*2), B
else C
UPDATE: Hrus did some testing and determined that the previous info by Hammerman isn't entirely accurate. Apparently a different formula is used. Link: http://diablo.incgamers.com/forums/showthread.php?t=724317

For example, The Pit level 2 has AreaId=16, value=(37-2+1)/3=12, AreaId is not < lowest+value (16<2+12 isn't true), AreaId is < lowest+(value*2) (16<2+24). Pit's chest at level 2 drops from "Act 1 (H) Chest B" TC.

Each chest has a (monlvl1/2 + 8)/100 chance to have a lock. It is important, because locked chests usually drop more items (monlvl1 is a field from levels.txt file).

Chests drop items exactly like monsters, except they don't have a 6 items cap and they drop from their own TCs.
Items quality calculation is also the same with monster's one, except special chests, that have fixed bonuses for dropping unique, set, rare and magic items.

Sparkling chests have the most complicated drops. What is a "sparkling" chest? It is chests that have "sparkling" drop mechanics. You may recognize them in the game by quite a large quantity of items that they drop. Some sparkling chests are sparkling, like the chest in The Pit Level 2, but some sparkling chests are normal looking.

As Jarulf found, sparkling chests have six options with the following chances:

* 2% chance of option #1
* 4% chance of option #2
* 6% chance of option #3
* 20% chance of option #4
* 30% chance of option #5
* 38% chance of option #6

At option #1 it will do a drop from the respective chest TC trying to generate a unique item. However many items, like keys, arrows, gems, runes may only be normal quality. If the game didn't generate at least one magic quality item, it will make a second drop from the respective chest TC trying to generate a unique item. If it didn't generate at least one magic item it will go to option #6 process.

At option #2 it will do a drop from the respective chest TC trying to generate a set item. If the game didn't generate at least one magic quality item, it will make a second drop from the respective chest TC trying to generate a set item. If it will not generate at least magic item it will go to option #6 process.

At option #3 it will do a drop from the respective chest TC trying to generate a rare item. If the game didn't generate at least one magic quality item, it will make a second drop from the respective chest TC trying to generate a rare item. If it will not generate at least magic item it will go to option #6 process.

At option #4 it will do a drop from the respective chest TC trying to generate a magic item. It will repeat chest TC drop until 3 magic items will be generated or it will have 10 drop tries.

At option #5 it will do a drop from the respective chest TC trying to generate a magic item. It will repeat chest TC drop until 2 magic items will be generated or it will have 10 drop tries.

At option #6 it will do a drop from the respective chest TC trying to generate a magic item. It will repeat chest TC drop until 1 magic item will be generated or it will have 10 drop tries. Then it will make up to 4 drops from chest TC with no desired quality, so using normal quality selection algorithm (it means that it uses MF).

That is how sparkling chests generate items. As you see your MF is almost not working at all.

Now we will look at other chests, those that are normal. If a chest is locked it will drop two times, if not — just one time. Note that a chest TC has 4 picks and 100/142 chance for NoDrop.
For normal chests the game uses normal quality selection method.
Before NoDrop test the game will test the chest for dropping from its TC at all. There is a 25% chance for every chest to drop from its TC. Locked breasts always drop from their TC (although they still have NoDrop, so they still may don't drop any item).
After that test it will make two drops from chest TC for locked chests or one for non-locked. If it didn't generate at least magic item it will repeat the drops up to 10 times until it will generate at least magic item.

Crates, corpses, jugs, logs, boulders, stashes, cocoons, goo piles, dead guards, caskets, beds and sarcophaguses always drop from chest TC.

Urns, rock piles, baskets, jars, barrels have 21% chance to drop from chest TC.

Also in the game there is one more type of chests, special chests. They look normal, but usually drop more items. For example the special chests are located at the ends of Arcane Sanctuary. Such objects have fixed qualities. 95% of special chests drop magic items only, 5% of them drop only rare items. Of course this is applied only to items with variable quality, not potions and scrolls.


18. The Countess

There is no need to explain her drops in a separate chapter, she isn't special. However people usually focus their attention on her, because she is an excellent source of middle level runes.
That is why I decided to give her a special chapter. (I hope she will give me a Lo rune in return ;-) )

I'll give the word to Dr. Thrugg at the beginning.

Thrugg said:
"Ah, the Countess. Most complicated TC by far. You'll note she has a -2 in her TC row; that means she gets 2 drops but that they are not random, she drops left to right across her TC until she reaches 2. Since her TC contains only Countess Item 1 and Countess Rune 1, it means she drops once from each of those TCs.

Countess Item has 5 drops as you saw. It is otherwise not much different than the other special monster TCs. She has a no-drop of 19 (very important) and gold, equip, junk, good. She will do all 5 of these drop attempts first.

After the Item drop she moves on to the Countess Rune TC. This has 3 drop chances with a simple 5/20 no-drop and 15/20 direct from a Rune TC for those yummy runes. However, remember the 6 drop limit. This isn't a limit on drop chances, just on total drops. If she drops 5 items in her Item drop, she can only drop one more from the Rune (although she still gets 3 chances to do so). Best for us is if she drops less than 5 items from the Item drop so there is room for all 3 Rune drops. Complicated. Only monster where it is actually better to kill her on p1, so nodrop is higher, so Item drops are less etc."
Let me look at her drops more closely. She drops from her own TC, "Countess" in Normal, "Countess (N)" in Nightmare and "Countess (H)" in Hell.
I'll look at the most interesting TC, "Countess (H)", others are just similar.
"Countess (H)" ALWAYS do one drop from "Countess Item (H)" TC and another drop from "Countess Rune (H)" TC.
"Countess Item (H)" TC may do 5 picks from "Act 2 (H) Good" TC with 3/67 chance of each in /players1 mode.
"Act 2 (H) Good" TC may do one pick from "Runes 14" TC with 14/130 chance.
"Countess Rune (H)" TC may do 3 picks from "Runes 12" TC with 15/20 chance of each in /players1 mode.
"Runes 14" TC contains all runes up to Lo.
"Runes 12" TC contains all runes up to Ist.

So, Hell Countess has 1-(1-(3/67)*(14/130))^5=2.39% chance to drop at least one rune from El-Lo range, and (1-(5/20)^3)=98% to drop at least one rune from El-Ist range. That is why she is so popular.
 
Last edited:

maxicek

Moderator
Staff member
Dec 24, 2019
270
188
43
19. Crafting

Crafted items are always created in the cube using Rune+Jewel+Gem+Item recipe.

I'll directly quote Uzziah here.

Uzziah said:
Again I will refer you to the Arreat Summit for recipes (http://www.battle.net/diablo2exp/items/crafteditems.shtml).

I will explain here the most common mistakes made with crafting and a little background on how to get the # of affixes and requirement levels for your character.
Common Mistakes
Using the wrong recipe - often people can not get the recipe for the item type correct. Make sure that you look up or memorize recipes before you use them. The crafting recipes always follow this form: 1 Pgem, 1 Jewel, 1 rune, 1 magical item.
Using an item type other than magical - I see this all the time "why won't this rare chain glove work in this recipe?" You need to use blue items known as magical items when crafting that is a specific factor in crafting.
Using the wrong character to craft and getting upset at the results - In crafting character level is important as it gives the affix levels (alvl) possible with that craft. Using the character level you can control crafts to give a specific required level or less, chance at specific affixes, and # of affixes on the craft.
Expecting a craft to retain affixes - simply put some people expect a craft to just gain affixes. Like a reroll (see later section) crafts get rid of the affixes on an item and roll new affixes, a craft is specific in that it contains certain affixes and adds additional ones.
[*]Looking for Ethereal crafted items - Many as of late have been asking about getting Ethereal crafted items. As I have been informed they do not exist. If you use an ethereal item in a craft it loses its etherealness.

Character Level and affixes dealing with crafts
clvl effect how many affixes can spawn with a craft. This chart explains what chance you have of getting what number of affixes:
At ilvls 1-30, there's a 40% chance of 1 affix and a 20% chance each of 2, 3 or 4 affixes.
At ilvls 31-50, there's a 60% chance of 2 affixes and a 20% chance each of 3 or 4 affixes.
At ilvls 51-70, there's an 80% chance of 3 affixes and a 20% chance of 4 affixes.
At ilvls 71+, there's a 100% chance of 4 affixes.

clvl and ilvl control alvl of crafts by controlling the final ilvl that the craft receives. It follows this formula. ilvl = int(.5 * clvl) + int(.5 * ilvl).
the int() means that you round down before plugging through the equation.
Affixes control the required level of the craft. The formula is rlvl = rlvl(of highest affix) +10 +3x (#of other affixes). So if you have a craft with 3 affixes and the highest affix has a required level (rlvl) of 12 your required level for that craft is 12 + 10 + 3*2 = 28. Since character level controls affix level and the # of affixes that can spawn it also controls the rlvl of the craft.

Summary. With crafts you want to have a range of characters at different levels in order to control affixes. Work out what rlvl and affixes you would like and use an appropriate level character to craft your items. Gambling or buying items guarantees initial ilvl (within reason) so it is usually the best way to get your base item. Otherwise check ilvl with ATMA or any other method before crafting it. Doing this can save you some heart ache (crafted chain gloves with a rlvl of 80?). Crafts can not be rerolled and are pretty much an end result. They are treated as rares by the socketing quest. On a further note they can not be upgraded; at this time, perhaps in some future patch it will be possible, I speculate that if they become upgradeable they will use the rare upgrade recipe.
Again, see chapter 11 for algorithm of affix selection.


20. Imbuing

Written by Uzziah.

Uzziah said:
Imbuing is the act 1 quest reward that Charsi gives. It takes a normal quality item and makes it a rare quality item.
The imbue quest can not be used by a char with a level lower than 8
The imbue quest sets the ilvl to character level plus four. In equation form
clvl + 4 = ilvl

Once you get your item level you're not quite done. The alvl needs to be determined so that you can get your affixes. See chapter 11 about it.

There are varying views on the imbue quest do you just use it immediately or do you hold it. I have seen both ways used and have my own opinion of it but I don't feel its right to express that here.

Using it right away guarantees you a rare of your choice of item. This can be beneficial when playing untwinked. However, that item will be based on your current character level and thus the affixes allowed will be lower than they could be.
Saving the imbue quest for later allows you to get better affixes at the character level you desire. However, often people forget about the quest or they already found rare/unique/set items that can be greater than the imbue so they feel it's a waste to get the imbue.

On a personal note I like to use my imbue with exceptional belts such as demonhide sashes. I tend to find a lot of the normal quality exceptional belts in act 5 normal and tend to see a rare belt stay with my characters for a long time. I also use it to gain hard to get staffmods.

21. Cubing

Cubing is a process of creating items by player in The Horadric Cube.

Written by Uzziah.

Uzziah said:
Magical item rerolling recipes
3 chipped gems, 1 magical weapon = 1 magical weapon with 1-2 sockets; ilvl 25
3 regular gems, 1 socketed weapon = 1 magical weapon with 1-2 sockets; ilvl 30
3 flawless gems, 1 magical weapon = 1 magical weapon with 1-2 sockets; ilvl 30
3 Perfect gems, 1 magical item = 1 magical item; ilvl=ilvl (here the item level won't change.)

One look at the above list should be raising red flags in everyone's mind. What weapons only, does that mean that other magical items can not be rerolled? No it means that only weapons can be rerolled and have their item levels controlled by the reroll recipe. The perfect gem recipe is dependent on the initial ilvl. It is important to remember that 3 pgems is the only way to reroll magical items other than weapons and that the ilvl does not change. Since the ilvl and item type do not change the item will be able to get the affixes that it could get before the reroll only.

If one uses the 3 chippy recipe then the 3 pgem recipe they end up with a magical item with 0 sockets and an ilvl of 30. Yes the 3 pgem recipe does not carry over the sockets from the other recipes, that is why one should keep with the chippy recipe when rerolling weapons. That recipe always has 1-2 sockets in it, with a 50% chance of 1 or 2 sockets. The extra sockets can be filled with jewels in order to make the magical item a custom rare item.
Please notice that the regular gem recipe uses socketed weapons. It doesn't matter what type of weapon it is as long as it has sockets from any method of socketing. Even uniques and sets with sockets will be rerolled as base items with this recipe.

Grand charms often rerolled using the 3pgem recipe. The grand charms are typically rerolled to gain the +skill tree prefix. Since that prefix occurs when grand charms have an ilvl of 50 or more one should make sure that the grand charm they are rerolling has an ilvl of 50 or more. (ilvl=50+ grand charm has 1/28 chance to have +skills prefix as I practically tested, WoL)

Small charms are rerolled for all kinds of prefixes and suffixes, +life, +resist, MF, whatever desired. One should check the prefix/suffix required ilvl and make sure the small charm is that ilvl or greater. On a further note the qlvl of small charms is 28 which by the equations above that in general ilvl has to be 14 greater than alvl desired.

In general use the pgem recipe to reroll magical items and you get an item with the same ilvl. With the alvl you are able to spawn any affix that has an equal or lower alvl. Only those affixes will be able to spawn on your newly rerolled item. Using pskulls for this recipe is wasteful since pskulls are a required gem type in other recipes like the reroll for rare items.

A trick, you can use the chippy recipe with high qlvl items and still get alvl's in the 60 range for the +skill trees, cruel prefix, and other higher level affixes. Also with a set lower ilvl you can get low tier staffmods. With this information you can make some really powerful weapons for 4 out of 7 character classes, for the other 3 classes of characters you can use this to manufacture rares to your taste.

The reason this trick works is that when qlvl > ilvl the qlvl controls the equation. From the above equation set: "if (qlvl>ilvl) then {ilvl=qlvl}" this says that if the qlvl is greater than the ilvl used in the equation will be the qlvl. This is the whole reason you're able to find small charms of life in the blood moor. The small charms have a qlvl of 28 thus even with an ilvl of 1 they have an alvl of 14 after following the algorithm (see Chapter 11).

WARNING. A reroll recipe gets rid of all affixes on an item, this includes staffmods, placed gems, placed runes, and place jewels. Better be careful not to place your uberly manufactured rare (adjusted magical reroll with jewels) in with 3 gems of any type. The results can really make one upset.

Rare item rerolling recipes.

There are 2 recipes for rerolling rares. Both I consider expensive. One of which I have never been able to try due to not having the ingredients.

1 pskull, 1 SOJ, 1 rare item = 1 rare item; ilvl = 0.6 ilvl + 0.6 clvl
6 pskulls, 1 rare item = 1 rare item; ilvl = 0.4ilvl +0.4clvl

These recipes have their limits. The 6 pskull recipe after about 5 iterations will take the ilvl to 0.66 your characters level rounded down.

This can be used in your favor. Say you wish to have an ilvl of 1 you can mule the pskulls, the item you wish to be at ilvl and a cube to a newly made character. Within 30 pskulls you have a ilvl 1 item.

On the other hand the 1 skull 1 SOJ recipe will not always increase the ilvl of the item. In fact the function is quite odd. Take for example a ilvl 20 rare, if you have a clvl of 13 or less you end up lowering the ilvl of the rare. If you have a clvl of 60 your ilvl will max out at ilvl=90. So one general rule, the recipe will max out at 1.5 times the clvl value. This means constant rerolling with the pskull, SOJ recipe should be done with a character that is 2/3 the level of the desired ilvl range.

Again knowing how this formula works, you can control what ilvl the rare you create will be.

Overall rerolling rares can be expensive, so much so that most beginner players don't consider doing it. Even experienced players avoid relying on it. It can be the only way to get certain combinations of affixes and staffmods though which makes for an ideal use of this type of reroll. Like drops however, it is all a matter of luck. A simple equation for estimating amount of gems needed to reroll a specific affix is 3 * (the denominator of the chance to spawn a specific affix) = #of gems provided that the alvl will be high enough for that affix.

22. Circlets and Magic Level

In chapter 11 you may find the following algorithm of affix selection.

When an item is generated that has prefixes the alvl is calculated* from ilvl and qlvl as follows

If (ilvl>99) then {ilvl=99}
if (qlvl>ilvl) then {ilvl=qlvl} ;** see note below
if (magic_lvl>0) then {alvl=ilvl+magic_lvl}
else
{
if (ilvl<(99-qlvl/2))
then {alvl=ilvl-qlvl/2}
else {alvl=2*ilvl-99}
}
If (alvl>99) then {alvl=99}

*all calculations use integers so there are no fractions at any step.
** this new ilvl value is only used for the duration of this calculation. The ilvl value that is stored in the items data file will remain unchanged.

Let me attract your attention to lines number 2 and 3. They mean that 1) Ilvl for affixes cannot be lower than qlvl of a given item, 2) if the item has magic lvl, then it receives much higher alvl.

What is magic_lvl? It is Magic level, a special bonus for special items. It could be found in weapon.txt and armor.txt files. All Wands, Staffs and Orbs have magic_lvl=1. Circlets have magic_lvl=3, Coronets have magic_lvl=8, Tiaras have magic_lvl=13, Diadems have magic_lvl=18. Other items don't have it.

Look at Diadems. They have Qlvl=85 and magic_lvl=18. This means that they ALWAYS have Alvl=99. Refer to the above algorithm for details.

Look at Tiaras too. They have Qlvl=70 and magic_lvl=13. So Tiaras always have Alvl=83+.


23. Rune making in Hell Forge

The Hellforge is the second quest in Act IV. In Normal difficulty this quest rewards you with a rune from El-Amn range, in Nightmare - Sol-Um, in Hell - Hel-Gul. The chance for every rune to be dropped is 1/11.

Hellforge runs are popular in multiplayer games, where a fast teleporting character can level a new character to Hell Hellforge in a very short period of time.


24. Magic Finding

Magic Finding (MF) deserves a special chapter, because all you can do to increase your chances to find good items from certain monsters in players1 mode is only to increase your MF.

What is MF? It is the "+% Better Chance of Getting Magic Item" property that can be found on many items in the game, topazes are most popular of them.

What MF do? It increases your chances at magic, rare, set and unique items. 100% MF doesn't mean that all items that you find will be magic. It means that the chance of an item to be magic will be doubled. MF has diminishing returns for finding rare, set and unique items.

What is MF diminishing returns?
Effective MF=(MF*Factor)/(MF+Factor),
where Factor=250 for unique items, 500 for set items and 600 for rare items.

Is there a cap on MF? Yes, implicitly. When you stack up your MF you increase your chance to find unique, set, rare and magic items. There is a cap on this chance. For example the cap in unique item chances for Act bosses is 50% (calculates from itemratio.txt as 128/(6400-(6400*983/1024))). Practically you'll never reach this cap, so don't be afraid to increase your MF.

Will MF work on Runes? No. MF works only when item type is already selected. So with more MF you will NOT get more weapons and armors and less runes.

Will MF help getting better Items from Gambling? No.

Will MF work with Minions and Hirelings? Yes. When you make a kill, you get the MF% of yourself only. When a Hireling gets a kill, it uses the combined MF of the Hireling and you.

Does the number of players in the game increase the chances for an item to be unique? No, it just increases the number of dropped items and thus the number of unique items found. Only MF increases the chances for an item to be unique.

Does MF work on chests? Yes, MF DOES work on every object: chests, rocks, dead bodies, urns, etc. See chapter 17 for exact description of object drops. Special chests have fixed quality chances, though.

How exactly MF works? It increases the chances for an item to be unique/set/rare/magic by EffectiveMF/100 times. For example, Baal dropping an Unearthed Wand has 128/1984 chance to generate unique when you have 0% MF and 128/992 chance, when you have 167% MF.


25. 1.11 Drop Changes

As you know this patch didn't change much. Most updated was dedicated to new Uber bosses.
So the only things that changed in the game is:
- Fangskin no more drop items in Hell
- Countess, Summoner and Nihlathak drop keys that slightly reduce their other drop chances.


26. Thanks

I'd like to name here all who helped me to write this guide, in acknowledgement to their deeds, however their list is too long. :(
However I tried to name those whose material was used, in every chapter. I'm really sorry if I used someone's discovery and not figured his name, I didn't want to do so.

The BIGGEST thanks goes to Blizzard, that has created the games that gave us countless hours of fun and joy, Diablo and Diablo II!

Oh! Thank you for reading it!
Have fun,
Sincerely yours, Warrior of Light.
 
Last edited: