[1.10 & 1.13c] Item affix selection misconception and maxlevel column bug - solution

This forum is for discussions on how to edit what can not be edited through the txt files, needless to say this isn't about battle net hacking.

Moderators: Nefarius, Havvoric

Post Reply
User avatar
Nizari
Senior Moderator
Crusader
Posts: 96
Joined: Fri Feb 16, 2018 11:39 pm
Poland

[1.10 & 1.13c] Item affix selection misconception and maxlevel column bug - solution

Post by Nizari » Fri Nov 29, 2019 2:58 pm

Soo, some days ago I have discovered that MaxLevel column of MagixSuffix.txt and MagicPrefix.txt isn't working at all. Additionally, if you don't use 'magic lvl' column (left it blank, in vanilla it's used for circlets), your items will roll affixes based on it's required spawn level ('level' column of armor/weapons/misc) instead of item level (level of monster or object that spawned it).

A quick note before I continue, according to Necrolis, this is something that Adhin has found many years ago, however, I did it completly independently and so here you may find description of the exact problem and solution of it.

Now, according to our txt files guides:
MaxLevel - An extremely powerful but badly underused field. This controls the point at which this affix will no longer appear on items. Say we have a Level of 10 and a MaxLevel of 15, then the affix will only appear on items with a iLvl of 10-15, whereas it will never appear on items with iLvls 1-9 and 16-99. This is the easiest way to get those crappy low-level affixes of higher level drops to ensure that those are useful.
This is how it's supposed to work. Unroftunately, it does nothing.
Here is a piece of code I have received from Necrolis, which shows how affix level is selected:

Code: Select all

  if ( nLevelBonus )
  {
    nAdjustedItemLevel = nLevelBonus + nItemLevel;
  }
  else
  {
    nHalfSpawn = nSpawnLevel / 2;
    nInverseHalfSpawn = 99 - nSpawnLevel / 2;
    if ( nItemLevel >= nInverseHalfSpawn )
      nAdjustedItemLevel = 2 * nItemLevel - nHalfSpawn - nInverseHalfSpawn;
    else
      nAdjustedItemLevel = nItemLevel - nHalfSpawn;
  }
  if ( nAdjustedItemLevel > 1 )
  {
    if ( nAdjustedItemLevel >= 99 )
      nAffixSelectionLevel = 99;
    else
      nAffixSelectionLevel = nAdjustedItemLevel;
  }
  else
  {
    nAffixSelectionLevel = 1;
  }
Additionally:
Necrolis wrote:If your item has a magic lvl ('magic lvl' column field) bonus set in weapons/armor/misc, the affix selection level is the item level + the bonus. If there is no bonus, the affix level is wonderfully gimped by the following:

Code: Select all

    nHalfSpawn = nRequiredSpawnLevel / 2;
    nInverseHalfSpawn = 99 - nRequiredSpawnLevel / 2;
    if ( nItemLevel >= nInverseHalfSpawn )
      nAffixSelectionLevel = 2 * nItemLevel - nHalfSpawn - nInverseHalfSpawn;
    else
      nAffixSelectionLevel  = nItemLevel - nHalfSpawn;
Which produces this graph of affixes
Image
TL;DR: the 'magic lvl' is OP at pretty much any level.
Also, for the purposes of picking affixes, if the items required spawn level is greater than its item level, the required spawn level is used instead of the item level.
Explaination is done, how do we fix it then? (EDIT: in case of anyone wondering about it, it's in d2game.dll)

1.10:

Code: Select all

6FC52D70	|. /74 04		JE SHORT D2Game.6FC52D76
TO:

Code: Select all

6FC52D70	90		NOP
_______________________________________________________________________________________________

1.13c:

Code: Select all

6FC34617	|. /74 04		JE SHORT D2Game.6FC3461D
TO:

Code: Select all

6FC34617	90		NOP
Thanks to this, MaxLevel field wil work exactly as intended, additionally, affixes of your items will ALWAYS be rolled based on item level. It gives you much bigger freedom in designing your magic and rare items and absolute control over them.

Big thanks to Necrolis for helping me with this.

Gobo
Posts: 3
Joined: Tue Mar 12, 2019 10:00 pm

Re: [1.10 & 1.13c] Item affix selection misconception and maxlevel column bug - solution

Post by Gobo » Mon Dec 09, 2019 5:04 pm

Hi - Thanks for this. If I am NOP'ing out 74 04 bytes should I be replacing with double 90 90? Or should it remain 90 04
Thanks

User avatar
Darkquake
Posts: 65
Joined: Tue Feb 20, 2018 3:38 pm
Australia

Re: [1.10 & 1.13c] Item affix selection misconception and maxlevel column bug - solution

Post by Darkquake » Mon Dec 09, 2019 6:10 pm

Does this fix apply to suffix/prefix only or does it also solve "magic lvl" in item.txts?
I make things? I make things.
Image
https://www.moddb.com/mods/darkquake

User avatar
Necrolis
Site Admin
Throne
Posts: 9041
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
Contact:
South Africa

Hand-picked

Re: [1.10 & 1.13c] Item affix selection misconception and maxlevel column bug - solution

Post by Necrolis » Tue Dec 10, 2019 2:13 pm

Darkquake wrote:
Mon Dec 09, 2019 6:10 pm
Does this fix apply to suffix/prefix only or does it also solve "magic lvl" in item.txts?
They are the same selection routine, however magic level will use item level + magic level as the affix selection level, but an item without magic level gets the weird down scaling applied instead. Not sure what you mean by solve "magic lvl" however.
Gobo wrote:
Mon Dec 09, 2019 5:04 pm
Hi - Thanks for this. If I am NOP'ing out 74 04 bytes should I be replacing with double 90 90? Or should it remain 90 04
Thanks
you want to replace both bytes with 90
Image
Netiquette, Do you USE it?!?! | Nefarius' Fixed TXT Files | Terms Of Service
Blackened | Day of Death | D2GFEx
"What was yours is mine. Your land, your people, and now your life." - Lim-Dul, the Necromancer
Judgement is Final, Death is Eternal

User avatar
Darkquake
Posts: 65
Joined: Tue Feb 20, 2018 3:38 pm
Australia

Re: [1.10 & 1.13c] Item affix selection misconception and maxlevel column bug - solution

Post by Darkquake » Tue Dec 10, 2019 3:00 pm

Necrolis wrote:
Tue Dec 10, 2019 2:13 pm
They are the same selection routine, however magic level will use item level + magic level as the affix selection level, but an item without magic level gets the weird down scaling applied instead. Not sure what you mean by solve "magic lvl" however.
I miss understood how this bug was related to magic lvl. Thanks for the clarification.
I make things? I make things.
Image
https://www.moddb.com/mods/darkquake

Post Reply

Return to “Code Editing”