Shopkeeper Code
Been doing some adds to the code - based off 0.2.0 , added lots of stuff for merchant interaction, but it's far from complete. I coulnd't figure out how to do the database stuff right, so basicly the item list is hardcoded for all merchants, they all sell the same 2 items, and no matter what you buy, you get grapes. You can sell stuff and get money though.. and the client no longer locks up when you try to interact with a merchant.
Had to figure out a lot of this stuff out on my own because nobody else has done it before.. the opCodes were not even in showEQ. Anyway - someone else will have to do the database portion of this -- I also included some sample sql of how this can be done without having to modify the npc_types table. Have to split code into seperate posts ;/ code for eq_opcodes.h Code:
// Darvik: for shopkeepers Code:
case OP_ShopRequest: |
Rest of the OpCodes , the structs, and the SQL..
Yes, code is a little sloppy, can be cleaned up a bit when databse stuff is implemented :) Code:
case OP_ShopPlayerBuy: Code:
// Darvik: shopkeeper structs SQL stuff: Code:
# |
Good job looks great :)
|
WOW! Nice job!
|
me getting feeling that .2.1 will be *ahem* a m*th*rf*ck*r =)
|
Graar.. I was working on these structs too. hehe... Good job, i'll see if we've found anything different.
|
Wow, great work!
Will this code be included in the next release of the emulator? This is just my personal opinion, but I think it might be better to have a merchant_id or similar value in npc_types, rather than a npc_type value in the merchant data. This is just from the point of view of adding merchant info to my spawn data, since my npc_type data is output by a parser program rather than written by hand, the ID of a particular NPC might change from version to version depending on what I add. Just my opinion though. Unless you're brewing a lot of wine, however, it might be good if database merchant lists can be added so you can buy something other than grapes :) |
Yeah, I agree, the merchant_id idea was just something to avoid having to edit the npc tables and stuff .. really all you need to add into the npc_type table is probably just a merchant_table_id which refrences the list of items they sell (since multiple merchants may sell the same stuff - like a general merchant) - you can still use the table that I listed for merchant items though - I'm pretty sure I didn't miss anything required there.. although I haven't figured out what tells a merchant how many of a particular item they have.. like when a player sells something, and then you buy it back .. it's probably server-side , and there's an opcode that I missed that tells the client to delete the item from the list.. maybe I'll check into that tonight..
|
From what I have seen, items are set as X for infinite amount, or # with some regen time. At least, that's how it always seemed to me.
-Ukyo |
I will get these into the next release...
|
I hope this isn't too much bother, but could you post the database table structs that you are going to use? That way I can start work on merchant data before the next emulator release.
Will you be using a merchant list with NPC IDs, or a merchant ID in the npc_types struct? |
I am currently working on the database code.
|
All times are GMT -4. The time now is 07:46 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.