As you might know, NPCs will at times refuse to sell certain items, or sell items you have no specified in any way,
I've decided to look into this, here are the current test results.
This test was done by making 99 dummy items, with qlvls between 1 and 99.
I have done the test with chars at different levels to see whenever cLvl has an effect on what NPCs sell (this has been rumored for a while - but how exactly it effects the items was not defined anywhere AFAIK)
EDIT:
ForcedItemLevel = VendorMinMagicLevel columns
AffixLevelBonus = iLvl independant bonus (the items generate with modifiers of their iLvl + this)
qLvl = base level defined in the level column of ITEMS.bin
ITEMS.bin (internal table built from armor/weapons/misc)
Indeed, cLvl influences what NPCs can sell, basically, the max qLvl an NPC can sell (independant of the Act qLvl limit) is cLvl + 5. This is the same on all difficulty levels in all acts. There is no "difficulty based min qLvl bonus". There might have been in 1.09 and earlier, but I do not intend to verify if this exists on those versions or not.
Thus, a cLvl 1 char, can buy items with qLvls 1-6, a cLvl 2 char can buy items with qLvls 1-7 and so on.
Code: Select all
Act Norm Night Hell
1 12 99 99
2 20 99 99
3 28 99 99
4 36 99 99
5 45 99 99
These limits ALSO apply to the ForcedItemLevel, if an NPC on Act 1 Normal sells an item with ForcedItemLevel above 12, this item will never appear in his inventory. The maximum ForcedItemLevel is equal to the maximum qLvl possible on the act in question (thus it doesn't exist outside of normal!), the same cLvl + 5 rule applies here too.
Now, what does ForcedItemLevel actually do, normally the iLvl is defined by the same rules as the maximum qLvl is (note: the higher the qLvl, the lower the maximum iLvl possible for the item in question) - But generally, the same cLvl + 5 rule applies here as with the other limits. ForcedItemLevel however allows you to force-spawn an item at that specific iLvl, thus avoiding the iLvl degradation based on qLvl.
Another interesting aspect, the items with the highest qLvl seam to spawn with the lowest iLvl always (aka "The Wirt Syndrom"*), this applies only to normal however. According to Ulmos post below, this is iLvl=qLvl/2. If ForcedItemLevel has been used, however that does not apply, and the iLvl is set to the specified value, if this is too high for the difficulty (or for your cLvl+5 limit) - then the item will not spawn.
Now, the AffixLevelBonus column added in the expansion for use with circlets, circumvents all this checking In fact, it adds the base qLvl to the AffixLevelBonus, so a cLvl 1 char, that goes to a shop selling a Magic Lvl 18 item will get items level 23 modifiers. YES - even level 99 modifiers can be sold in Act 1 shops this way (...)**
Another wierd behaviour is that having too many items spawning in NPC shops will mess up other, not related tabs.
Furthermore, should you ever spawn an invalid code in the npc inventory (>4 characters), they will pick items at random from above that line (not always the first line)
Prior to 1.07 the game crashed with an unhandled exception if NPCs attempted to sell over max-inv-spaces items at once.
* If you didn't play D1: Wirt was notorious for spewing out the best modifiers on the worst base items and the worst modifiers on the best base items.
** Internally iLvl is ranging between 0 and 255 - but iLvl > 99 is being set to 99 post generation, prior to 1.07 iLvl was actually also _saved_ as a whole byte, so you could have items with iLvl > 99 (that was a quite simple way to detect items created with a seed-generator, because those, by default, set the iLvl to 255).
Why can't I get my misc items to be sold
People seam to have problems with MISC.txt ever since the changes done in 1.04 (or was it 1.03 ).
Normally, misc items cannot be sold outside of Act 1-2 normal if you don't enable PermStoreItem, now, after diging into this further, I found the reason for this behaviour. It is neither related to qLvl, nor to some hardcoded check.
Now, you can use the overflow glitch (*) to bypass this, which I do not recommend, because the nature of glitches like these is unpredictable and they lead to instability. Now, how can you enable 1.00-1.03 misc.txt style (potions are not sold "infinitly" but there is a limited stock) without them vanishing past Act 2 Normal? - All you need to do (at least this worked for me). Set BITFIELD to 1 and set PermStoreItem + MultiBuy to 0. Apparently items with BitField of 0 cannot be sold without using PermStoreItem for reasons only Blizzard knows (but I doubt they do ) - and finally, in ItemTypes.txt remove every reference of the "misc" itemtype from the equiv columns. But heck! whats that? hp4,hp5,mp4 and mp5 will ALWAYS use PermStoreItem - even if you set it to 0! Read on (**).
* If you make an item "spawn" at the shop with minimum and maximum set to 99 in either armor/weapons.txt, it will carryover to the misc tab and thus PREVENT the PermStoreOnly lock - but this is not recomended.
**Blizzard wen't way overboard on this one, there are multiple checks in D2Game.dll that handle selling and bzying of hp4/hp5/mp4/mp5.
Code: Select all
6FCC78DF 3D 68703420 CMP EAX,20347068
6FCC78E4 0F84 90020000 JE D2GAME.6FCC7B7A
6FCC78EA 3D 68703520 CMP EAX,20357068
6FCC78EF 0F84 85020000 JE D2GAME.6FCC7B7A
6FCC78F5 3D 6D703420 CMP EAX,2034706D
6FCC78FA 0F84 7A020000 JE D2GAME.6FCC7B7A
6FCC7900 3D 6D703520 CMP EAX,2035706D
6FCC7905 0F84 6F020000 JE D2GAME.6FCC7B7A
Code: Select all
6FCC7EBF 3D 68703420 CMP EAX,20347068
6FCC7EC4 74 3D JE SHORT D2GAME.6FCC7F03
6FCC7EC6 3D 68703520 CMP EAX,20357068
6FCC7ECB 74 36 JE SHORT D2GAME.6FCC7F03
6FCC7ECD 3D 6D703420 CMP EAX,2034706D
6FCC7ED2 74 2F JE SHORT D2GAME.6FCC7F03
6FCC7ED4 3D 6D703520 CMP EAX,2035706D
6FCC7ED9 74 28 JE SHORT D2GAME.6FCC7F03
Code: Select all
6FCC8A70 3D 68703420 CMP EAX,20347068
6FCC8A75 74 39 JE SHORT D2GAME.6FCC8AB0
6FCC8A77 3D 68703520 CMP EAX,20357068
6FCC8A7C 74 32 JE SHORT D2GAME.6FCC8AB0
6FCC8A7E 3D 6D703420 CMP EAX,2034706D
6FCC8A83 74 2B JE SHORT D2GAME.6FCC8AB0
6FCC8A85 3D 6D703520 CMP EAX,2035706D
6FCC8A8A 74 24 JE SHORT D2GAME.6FCC8AB0
These are ran thru whenever you buy/sell an item, if the item code matches mp4,mp5,hp4 or hp5 - it will jump to a different handler.
Nopping out the jumps will disable permstoreitem on these four items. This will also break multibuy auto-multibuy.
Quick 1.00-1.02 Misc.txt Re-enable
1. Set BITFIELD to 1 for all misc items
2. Set PermStoreItem and MultiBuy to 0 for all the items you need
3. In ItemTypes.txt remove "misc" from the equiv columns of the chosen items (poti for potions etc)
4. NOP the jumps in d2game.dll
5. Enjoy