Item Ratio Calculations

Item Quality is determined by first calculating the roll chance for a specific Quality. Then the game will attempt a random roll for that Item Quality. If that roll fails, then the game will calculate for the next lower Item Quality. The order of Item Quality calculations is the following: Unique > Set > Rare > Magic > High Quality (Superior) > Normal > Low Quality

The following information details how the game uses the Data Fields in its calculations.

Step 1: Calculate the Base Probability

The first part of the calculations is to obtain the base probability for rolling the item quality with the following formula:

Probability = ( Quality - ( mlvl - ilvl ) / Divisor ) * 128

This probability value is a ratio divisor, meaning that there is a 1 in probability chance of the game choosing that Item Quality, so the lower the probability value, then the better the chance the item will successfully roll that Item Quality. The multiplication with 128 is for decreasing rounding errors. The Quality value is the itemratio#Rarity Data Field. The mlvl value is the Monster Level, which depends on the current area level and game difficulty (this can also be the level for the chest drop). The ilvl value is the Base Item Level (See armor#level, weapons#level, misc#level, UniqueItems#lvl, or SetItems#lvl). The Divisor value is the itemratio#Divisor Data Field.

Step 2: Calculate Magic Find

The game will then obtain the character's magic find bonus from items. If the current calculation is for Unique/Set/Rare Quality items and the magic find item bonus exceeds 110%, then the character's magic find will be modified with diminishing returns:

MagicFind = 100 + MF * dim / (MF + dim)

The MF value is the character's magic find bonus percentage value plus the baseline default 100 value (See the "item_magicbonus" entry in ItemStatCost). The dim value is a special modifier for adding diminishing returns to the magic find bonus, which differs based on the Item Quality being calculated (Unique = 250, Set = 500, Rare = 600)

After calculating the proper magic find value, the probability value is modified with the following formula:

Probability = Probability * 100 / MagicFind

This will reduce the Probability value, giving the Item Quality a higher chance to be successfully rolled.

Step 3: Calculate Probability with Treasure Class

After calculating the baseline probability with the magic find bonus, the game will then compare this value with the minimum value for the Item Quality to cap it from reducing any further (See itemratio#Min Data Fields). High Quality (Superior) and Normal Quality do not have a minimum value.

The game will then modify the probability with the value from the related Treasure Class:

Probability = Probability - Probability * TreasureClass / 1024

The TreasureClass value is a modifier for this Item Quality based on the Treasure Class being used (See the TreasureClassEx#Rarity Data Field)

Step 4: Roll for the Item Quality

Finally, after calculating the overall value of the probability for the Item Quality, the game will then find a random number between 0 and the probability value. If that random value is between 0 and 128, then the item has successfully rolled that specific Item Quality. Otherwise, the calculations will move on to checking for the next lower Item Quality.