The slot column in merchantlist on a given merchant has to be in order, with no gaps. If you have a have items in slots 1, 2, 3, and 5 let's say what happens is if a player sells an item to that merchant it uses the first available slot. In this case 4. The problem arises when the next player sells an item to the merchant. It'll go in slot 5, even though an item already exists there because the server knows 4 is home to a player sold item, via merchantlist_temp.
The code should probe merchantlist before assigning a slot to merchantlist_temp to make sure it isn't already in use. That will correct the issue. However, since the slots should be in order anyway that's a moot point.
|