Merchants not keeping items...
I'm still looking into the code for this merchant issue where they don't keep items sold to them regardless of the variable setting...
can't seem to find anything on it at all. someone had said that when items were sold to an npc they simply got added to the npc's loot table and then that loot table was added to the item list when browsed... i dont see any references in the source code to the merchantlist_temp table that exists, nor do i ever see any rows inserted into it... i thought this table was here specificly for saving items sold to merchants, but it seems like the table isnt even used... |
think i found the problem:
Code:
From: zone.cpp and the zone stores the temporary items like this: Code:
From: zone.h however... when an item is sold to the merchant it is added to the database... Code:
From: zonedb.cpp i'll be honest... i can mostly read and understand c++ but i'll be damned if i can write it very well... think of me as someone who took intro to french in high school... who is now trying to edit a french novel lol i can look through and find the problems, but i've not the slightest idea how to correct the grammatical errors in it :p |
Quote:
edit: Verified bug. Just tested this with a merchant I stuck in the guild hall. You are correct. I sold it a vial of dye, closed the window, reopened, and the vial was gone. Zoned out (dynamic zone) and back in, no sold items on merchant. However, the item IS in the merchantlist_temp table for this NPCid, slot, and item # (32557) |
yes i have just tested it myself and exactly what i said is what is happening.
When the world boots up it clears the entire merchantlist_temp table. Then loads the merchantlists from the merchantlist table and sets them into an array in the zone.exe file. When items are sold to the vendor they are inserted into the merchantlist_temp table, but not into the array. I posted the sections of code where the problem comes from, now if someone else could do us all a favor and fix it... lol cuz i've about exhausted my knowledge of c++ in just finding the issue :p |
After looking at this code i think we have a slightly larger problem on our hands...
The merchantlist information is being stored in an array... which means that presently, whenever a player accesses a merchant, that data comes out of the array and has nothing to do with the database. So we actually don't need to change anything with the way merchants handle items sold to them, instead what needs to happen is that the zone should only load the items in the merchantlist table at startup since they don't change. Then we need to modify the code for the function when a player accesses that merchant, and have it load the values from the merchantlist_temp table into the file... where this causes a problem is what happens when 2 players access the same merchant at the same time. if a merchant had 1 discordant scoriae on it... and 2 players accessed the merchant at the same time, they could both buy that item since the temp list would only be loaded at the time of browsing... thus creating a method of item duplication. |
I'm back at work! /argue on! j/k
If I can get on Live tonight, I will sell something to a vendor, and have 2 PCs open the same vendor and see what happens if they both try and buy the item. Something in the back of my mind tells me the merchant inventory list is dynamically updated live... but I could be dreaming. |
good luck with that lol
remember... merchants won't resell items that you sell to them because of this bug :p im just saying the code that needs changed is the code that actually executes when a player right clicks a merchant to browse, not the code i posted earlier in this thread :) |
This all works on EQLive, right? Selling something, then buying it back?
Screw it. I'm testing this. Ok, to end this senseless speculating... I am on Live right now, 2 chars, same merchant. I sold a Meat to the merchant, and without doing anything, it appeared magically on the second toons open merchant window - no closing, no reopening. That's what I expected to see. The guy who sold it can buy it back immediately. And, it vanishes from the second guys merchant window - dynamically, like I said. Furthermore, the second guy could buy it if he wanted, and it also vanishes from the first guys window immediately. So, no risk of dupe items - on LIVE. Now, Emu... This does NOT work this way. If player 1 sells something, it does not appear on the merchant immediately. Hmm. Actually, ever. I left the zone, restarted it, the item is still in the temp table, but the merchant does not show the Meat - on EMU. So, Aerewen, you are vindicated. :) Now, fix it. ~grin~ |
lol wish i knew how :p
even if i did find a way to fix it... i dont have a clue how to make those little add/subtract files that i see people posting... im not a cbase programmer... i do php/mysql/perl etc all the web based crap but never learned any actual programming :( |
GRRRRRRR i wish i learned c++ lol
i've been staring at the code now for like well... since i made the last post on here so an hour? as far as i can tell it should work :shock: from client_process.cpp... looks like it is pulling the items from the tmpmerchanttable[] array properly and sending them to the client when the merchant is browsed... Code:
void Client::BulkSendMerchantInventory(int merchant_id, int16 npcid) { from zone.cpp Code:
int Zone::SaveTempItem(int32 merchantid, int32 npcid, int32 item, sint32 charges, bool sold){ |
In response to:
"Ok, to end this senseless speculating... I am on Live right now, 2 chars, same merchant. I sold a Meat to the merchant, and without doing anything, it appeared magically on the second toons open merchant window - no closing, no reopening. That's what I expected to see. The guy who sold it can buy it back immediately. And, it vanishes from the second guys merchant window - dynamically, like I said. Furthermore, the second guy could buy it if he wanted, and it also vanishes from the first guys window immediately. So, no risk of dupe items - on LIVE." ------------------------------------------------------------- What this seems to infer in Live is that each NPC 'knows' which clients are looking at its inventory, and can push state changes in its inventory list out to those clients. Coupled with some rudimentary semaphore logic (a vendor handles only 1 transaction at a time), this prevents the possibility of a duplicated item. NOTE: This is all conjecture as I'm sitting at work, eating my lunch, browsing the forums... Can the Emu do this? I have no idea, as I haven't started delving into the emulator code yet... I'm still trying to make sense out of the database and the field definitions... but that's another forum... |
Welcome aboard, ArChron :)
It is my best guess that the Live servers do more of a polling cycle that updates the clients as things are added or subtracted. I am confident the Emulator does not do this for various reasons; one being bandwidth. Not sure the original designers wanted their servers spewing tons of updates per second for merchants. I also haven't looked directly at merchant code, but I am sure it could be done. There are plenty of other things in the Emu that send updates to the client when things happen (like your buddy dying). Maybe it's something we just haven't gotten to yet. |
Could be done fairly easy considering the opcodes...
theres an opcode for adding an item to a merchant, subtracting one, opening a merchant window and closing a merchant window. so the basic framework needed to track what clients are browsing what merchants is there. |
Just a thought, maybe it was there, and is now broken? I rarely see devs chiming in on our speculations. :)
|
Does it work yet???
Sooo...I would really love to have this feature. Has this been fixed yet/ Does the code posted work? Has anyone tried it(The code)?
If devs have already fixed..What version was it fixed? |
All times are GMT -4. The time now is 04:39 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.