Jump to content
  • 0

Vendor Mix Up


Uccello

Question

Hello!!

Having a bit of an issue while creating items in a vendor. I have created quiet a few items into vendors and put them into the sql so that the items remain in the order i want them to be in. I recently made a vendor that i went back and removed some of the items, since doing so any vendor i make items for the items are switched up from the order I place them in. Is this a common issue?

Thank you very much for any information : ) Or if there is anything i can add to help I'd be more than happy to add!

-Uccello

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

Almost certainly an error with the query returning the items to the vendor window.

The query needs to specify the correct sort order.

If needs be, I can explain why it is initially correct, then broken once it is changed

Thank you very much for your reply!

What would a sort query look like to use for this kind of situation ? I really appreciate your response : )

Thank you again its good to see someone knows!

-Uccello

Link to comment
Share on other sites

I think the function LoadVendors in ObjectMgr.cpp is responsible for the vendoritems.

As you can see the query fetches the data without any parameter for a sort oder. By defult the table isn't sorted at all and with mangos optimization it's sorted by itemid ascending (ironically the npc_vendor_template is only sorted by guid not itemid). But it doesn't matter, because as written earlier sorting of the data hasn't any effect on the appearance in the vendor-window.

Add a sort order condtion to the query would probably nothing change. I think the sort order of the items in the vendor-window is defined somewhere else.

However I think a custom order isn't possible (at the moment), because how would the core know which order it supposed to be, when the sort order is never saved to the database.

Link to comment
Share on other sites

Before i deleted items from one of my vendors, it put the items in the vendor in the order i put the sql. I had a large text i put in with everything in order. I did probably 20 vendors this way with no issues of items going out of order :) As i said it was only until i removed a few items from a vendor that it now no longer goes in order. For now i have a semi fix for it but I was hoping for something that could be done in the sql to fix future vendors.

Thanks again :)

Link to comment
Share on other sites

Uccello, if you'd like you could try changing https://github.com/mangosone/server/blob/master/src/game/ObjectMgr.cpp#L8362 to the following:

 QueryResult* result = WorldDatabase.PQuery("SELECT entry, item, maxcount, incrtime, ExtendedCost, condition_id FROM %s ORDER BY entry", tableName);

and see if that does anything to the order of your items :)

Link to comment
Share on other sites

I can confirm this behaviour.

After applying a sql file the order from the items in the vendor was identically with the file. When changing positions of some items in the sql file, removing the entire itemlist from the vendor (so the vendor is empty) and applying the sql file again, the order was reversed. It means if the order was initially from top to bottom it was afterwards from bottom to top.

A glance on the sorting of the npc_vendor table shows it is sorted by entry and item ascending. But this is not the reason of the changed order, because in game it's not sorted by id.

I don't think you have an influence on the item order.

Maybe someone has a better view on this mechanics and can explain how and why.

Link to comment
Share on other sites

Thank you for your post : ) I'm not sure why this is either, up until this point I've had no issues, and the items have been in the order i put the sql in, but since removing some items from another vendor , every single Vendor NPC I create items for in sql are always out of order in the game.

Thanks again if anyone happens to know why this is : ) or if there is even anything that can be done once youve made changes other than starting fresh, or going back in time with the database :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use