Log in

View Full Version : Clearing Merchant Inventory


provocating
10-24-2013, 04:23 PM
I could had sworn I used to be able to clear merchant inventory like this.

quest::merchantclear($npc->GetNPCTypeID());

But it does not appear to be working anymore. What am I doing wrong here?

joligario
10-24-2013, 06:38 PM
I don't see that command. Are you thinking the ClearMerchantTemp()?

provocating
10-24-2013, 07:00 PM
I am thinking a few years ago I may had created a custom command. Is that ClearMerchantTemp valid and working?

joligario
10-24-2013, 07:28 PM
It is in the code, but I don't think there is a perl export for it.

Kingly_Krab
10-24-2013, 08:20 PM
Would $npc->ClearItemList() not work?

provocating
10-24-2013, 08:26 PM
It is in the code, but I don't think there is a perl export for it.

That is probably what I did last time was modify the source.

Kingly_Krab
10-24-2013, 08:32 PM
That is probably what I did last time was modify the source.
Did you attempt what I said?

provocating
10-24-2013, 09:00 PM
Not yet, have not had a chance yet.

Kingly_Krab
10-24-2013, 09:01 PM
Not yet, have not had a chance yet.
Okay, just keep me posted.

joligario
10-24-2013, 09:46 PM
That looks like it is for loot only.

Kingly_Krab
10-24-2013, 09:49 PM
That looks like it is for loot only.
Okay, I was unsure, and my server was down, thanks for the information.

provocating
10-24-2013, 11:18 PM
It did not seem to work, I put a

$npc->ClearItemList();

in the script right before a shout, I heard the shout but the merchant still had the same items. I am doing a script that dumps random items on the merchant and indeed the random items get loaded during the initial run, but never get cleared out before the next item load.

provocating
10-24-2013, 11:22 PM
Did you attempt what I said?

Yeah definitely not working, the temp merchant list keeps getting larger.

rencro
10-25-2013, 09:24 AM
Is this what you are looking for? If not perhaps it can do what you need..



quest::MerchantSetItem(merchant's npc id, item id, quanity of item) - changes the number of the item that the merchant has available to sell
quest::MerchantCountItem(merchant npc id, item id) returns the number of that item in stock.

provocating
10-25-2013, 12:31 PM
I knew about those two, I need a simple clear inventory.

provocating
10-25-2013, 02:22 PM
I had to edit around 4~5 .cpp files but now it is working like a champ. I created a function in C++ to delete the table rows for that NPC and made the companion PERL function and it works like a champ. One step closer.

provocating
10-28-2013, 05:58 PM
Okay one last thing, I can clear the merchant's inventory in the database but it does not seem to reflect the change until the zone loads again. Is there some way to make the merchant reread the table?