Ok guys, I figured out all along I was confusing ilvl with affix level. The formula I posted only calculates the output ilvl, which I thought determined the alvl. This was wrong, however. I didn't want to play any more guessing games, so last night I went straight to the horse's mouth and reverse-engineered the
entire crafting function. As it turns out,
@Fruit's formula is damn near spot on. What's interesting is just like we suspected, the item level of the rune is used for crafting. I checked the 1.09 formula and it has a flag to prevent the ilvl from being overwritten. Also, the chances for affixes are different in 1.07 than 1.08+.
Here is our official crafting formula, reversed from D2Common.dll: (also applies to 1.08, except the unknown flag)
Code:
//From D2Common, calculate Affix level
if ( (unsigned WORD)v43 < 1 ) // unknown flag
{
affix_lv = ilvl + 2;
}
else
{
if ( ilvl < qlvl )
ilvl = qlvl;
if ( maglvl ) // set or > 0
affix_lv = maglvl + ilvl;
else if qlvl < 45
affix_lv = ilvl - (qlvl / 2)
else
affix_lv = (qlvl - 45) - (qlvl / 2) + ilvl
}
if ( affix_lv < 1 )
affix_lv = 1;
else if ( affix_lv > 99 )
affix_lv = 99;
This function calculates the ilvl, which is (ilvl*0.66)+(clvl*0.66). This is bugged since it uses the ilvl of the rune:
Code:
//from D2Game, calculate output item level
if ( pct_clvl ) // flag added here in 1.09 to prevent overwritting
{
v12 = (FLOAT_SEED * pct_clvl * D2Common_GetClvl(v30, 12)) >> 32) >> 5;
output_ilvl = (v12 >> 31) + v12; // round down
}
if ( pct_ilvl )
output_ilvl += pct_ilvl * ptCubeItem[5] / 100; // += pct_ilvl * ilvl
if ( output_ilvl <= 99 ) // output_ilvl = ilvl
{
if ( output_ilvl < 1 )
output_ilvl = 1;
}
else
output_ilvl = 99;
if ( fixed_lvl )
output_ilvl = fixed_lvl;
Notice how at the beginning, it checks some flag and if it is less than 1 it uses ilvl+2. However, this was always 100 in my testing, and I tested jewelry, amor, etc. This unknown flag was removed in 1.08, which implies it was a reminiscent of classic or the beta. It could possibly be the "amulets get magic bonus ilvl + 2".
Now the next part. The chance of getting a certain number of affixes are also different in 1.07. The standard "4 affixes at ilvl 71+" only applies to 1.08+. Here is the correct table for 1.07, again reversed from the code so I can assure you this is accurate and tested:
Code:
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-60, there's a 60% chance of 2 affixes and a 20% chance each of 3 or 4 affixes.
At ilvls 61-90, there's an 80% chance of 3 affixes and a 20% chance of 4 affixes.
At ilvls 91+, there's a 100% chance of 4 affixes.
What this means is, you actually need to be clvl 93 to force 3 affixes. Obviously, it isn't possible to get lvl 91 but neither was 71. In 1.08 this was changed from (30-60-90) to (30-50-70).