Implementing: Tradeskills

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Implementing: Tradeskills

Post by John Adams » Sat Feb 19, 2011 11:02 pm

Trying to nudge some interest here, I'd like to know how to go about implementing an entirely new system into EQ2Emu. Scatman did Guilds, and while I can read his code, I do not think it's the same animal as implementing a system like Tradeskilling/crafting. I believe tradeskilling is more like Combat, no?

Click the machine, pick a recipe, add components, and start your melee/spell attacks and defenses?

We have tons of data collected with crafting going on, so I'm sure we could get a rudimentary system implemented if nothing more than to say we've done something in 18 mos since LE left ;)

What do you think?

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Implementing Tradeskills

Post by Scatman » Sun Feb 20, 2011 3:49 pm

Yeah it'll probably be a little more difficult than guilds. First thing first, we need to make sure we have our opcodes correct because if they are wrong then there's no way we can do it. I implement a new system through trial and error usually. If you do something on EQ2Emu for which we don't have a response for, you'll see the opcode show up in the console that says the server doesn't know what to do with. So given that, you could look through the logs and find the opcode, build the packet, and start playing around with the data in the packet to see what changes in game.

Maybe we could all try and do this one together (who ever is still around), so everyone can learn everything?

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Implementing Tradeskills

Post by John Adams » Sun Feb 20, 2011 5:25 pm

I'll send another note to EQ2Emu Devs and see if we cannot get everyone involved in this thread, make this a team project to implement a rudimentary Tradeskill system.

This will include:
-- the basic interface with the tables
-- recipes
-- saving/retrieving recipes in the player books including filters
-- required components
-- skill books
-- actions/reactions
-- ?

Zcoretri, we could probably use your finesse at identifying any opcodes/structs that go along with this functionality. We have many logs, I believe. Let me know if you need help finding specific packets.

Ilythor, if you want to get your feet wet with development, this is a golden opportunity to do so. Jump on in if you have the time, otherwise just keep an eye on us ;)


Am I missing anything? Let's brainstorm. We've been on vacation long enough. :)

User avatar
Gilraak
Posts: 107
Joined: Thu Sep 09, 2010 9:33 pm

Re: Implementing Tradeskills

Post by Gilraak » Sun Feb 20, 2011 8:16 pm

I can work on the database side? Building that content for us when the time comes.
Gilraak - Level 28 / Amari - Level 10

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Implementing Tradeskills

Post by John Adams » Sun Feb 20, 2011 8:33 pm

Scat,

I started out as you suggested. Built a woodworking table, added the primary command to it, and clicked "create" to see what it would say in World debug, and of course, it says "[Status] Unhandled command: create". I went to add this handler to Combat.*, and I see that you have a "hack" in place for Guild Create (/create guild) so until we re-assign that, I am not sure I can make a handler for this... going to try using the one you have already tho, 256, because without the sub-command, "create" itself has no handler in the code.

I'll let you know how it goes ;)

User avatar
Sylaei
Retired
Posts: 57
Joined: Mon Jul 05, 2010 1:40 pm

Re: Implementing Tradeskills

Post by Sylaei » Sun Feb 20, 2011 9:27 pm

Ok, I'm in. Not sure where to start so let me know what you need done. I start looking at the code for combat and guilds just to get an idea.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Implementing Tradeskills

Post by John Adams » Sun Feb 20, 2011 10:23 pm

I started looking through captured data for leveling up a tradeskiller (back from 2009) and of course, I can't make heads or tails of the packets. Gonna need a more skilled eye on that to at least break it open for us - and hopefully, tell us how it's done here ;) (the point of this whole exercise... )

I searched the Structs xmls, too... and sadly, there is nothing in there that I can see relating to crafting or tradeskills - so we're starting from absolute zero here ;) wee!

User avatar
Zcoretri
Team Member
Posts: 1642
Joined: Fri Jul 27, 2007 12:55 pm
Location: SoCal

Re: Implementing Tradeskills

Post by Zcoretri » Sun Feb 20, 2011 11:27 pm

Scatman wrote: Maybe we could all try and do this one together (who ever is still around), so everyone can learn everything?
Sounds like an awesome idea...would like to learn more C++ :mrgreen:

User avatar
Zcoretri
Team Member
Posts: 1642
Joined: Fri Jul 27, 2007 12:55 pm
Location: SoCal

Re: Implementing Tradeskills

Post by Zcoretri » Mon Feb 21, 2011 12:14 am

Well...it's a start anyway :mrgreen: :mrgreen:
Tradeskill.png
You do not have the required permissions to view the files attached to this post.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Implementing Tradeskills

Post by John Adams » Mon Feb 21, 2011 12:18 am

Woo hoo! Exciting, Z!

I committed the handler work + command for 'create' on the table, so once Zcoretri comes up with a struct, we can pop that window by right-clicking a table. :)

Then comes the fun part of filling in all the actual functionality around it, which is what I'm anxious to learn.

I also committed 2 new files to the project: Tradeskills.h / Tradeskills.cpp, but did not commit my vcproj due to custom stuff I have going on here. So when you get those 2 new files from SVN, you'll have to Add->Existing Item in your Headers and Source folders of the solution.

User avatar
ilythor
Retired
Posts: 436
Joined: Sun Oct 14, 2007 3:44 am
EQ2Emu Server: TessEq2
Location: Australia, mate!
Contact:

Re: Implementing Tradeskills

Post by ilythor » Mon Feb 21, 2011 4:45 am

I've been keeping an eye on you guys, and I'd love to jump in.

I just glimpsed through the thread and my head exploded. Picking up bits and pieces here and there, found an eyeball in my drawer. Good shot if you ask me.
"Everytime you pull the trigger in space, you will ruin someone's day, somewhere, and eventually, some time."

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Implementing Tradeskills

Post by John Adams » Mon Feb 21, 2011 11:02 am

In an effort to convince everyone else to provide step-by-step how we're doing this, here's what I did to create a new command handler. First thing I did was log into my empty world, and create a woodworking table, and set some parameters. Here's a list of commands, with a short explanation of what this means.

First, we create the table object and commands needed to interact with it. This is all done in-game, except for adding the entity_commands directly to your EQ2DB --
Create the Table object

Code: Select all

/spawn create object 2346 1 1 'Woodworking Table'
Add it to the permanent spawns for the zone

Code: Select all

/spawn add new 'Woodworking Table'
...and reload spawns so you have a valid object to work with

Code: Select all

/reload spawns
Open your MySQL tool, whichever one you do, and run the following query:

Code: Select all

select * from entity_commands where command = 'create';
If you get 0 results, you have to create this entity_command (these are the commands that tie spawns to code handlers, explained later)
To create a new entity_command, run this query in your MySQL tool:

Code: Select all

insert into entity_commands (command_list_id, command_text, distance, command) values (12,'create',10,'create');
(NOTE: if command_list_id 12 is already assigned, choose another... it doesn't matter what this # is)

Once you verify your new entity_command is in the table, go back to your World and run

Code: Select all

/reload entity_commands
Then target the new object and run these commands with the new object targeted to set it up for interaction --

Code: Select all

/spawn set command_primary 12
/spawn set show_command_icon 1
/spawn set show_name 1
/reload spawns
This tells the server that when you right-click on the table, show the option "create".
And show the Hand icon on mouse-over
And show the object's name
And reload when done. You now have a new crafting station in your world.
Now we'll add the C++ code to handle the new "create" command assigned to this object. The handler ID we're adding is 256.

Why did I choose 256?
Mostly, it was just to keep things in an orderly, numeric fashion. COMMAND_CREATE_GUILD = 257, and there was no 256... so the logical choice was 256 since it didn't already exist.
In VS2008, load up the World.sln, and open Commands.h. Search for "COMMAND_CREATE_GUILD" and you will notice the handler ID of 257. Since we need a new handler for the "create" command we just made, we insert a line as follows:

Code: Select all

#define COMMAND_CREATE 256
Insert it between COMMAND_RELOAD_GUILDS and COMMAND_CREATE_GUILD so it looks like this:

Code: Select all

#define COMMAND_SET_GUILD_OFFICER_NOTE 254
#define COMMAND_RELOAD_GUILDS 255
#define COMMAND_CREATE 256	// JA: crafting table handler "create" command
#define COMMAND_CREATE_GUILD 257
#define COMMAND_GUILDS	 258
See the new one in the middle there? Save Commands.h

Open Commands.cpp, and search again for "case COMMAND_CLAIM". We're adding our new code below all the Guild stuff. Since right now this is simply to get code in place to handle the right-click / create commands, the code is generic:

Code: Select all

		// JA: Handler for starting Tradeskilling table
		case COMMAND_CREATE: {
			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You're trying to craft something, eh? TODO! :)");
			break;
Save Commands.cpp and compile! If you have no errors, your code is fine.
Now you can log into your world, right click the new table, select 'create' and you should see a message from your new command handler:
"You're trying to craft something, eh? TODO! :)"
As we move through this process, that Command will grow, as will other code added to the rest of the World to make crafting tables interactive.


To our coders: I do not expect everyone to be as ridiculous with "documentation" as I am... but please, for the sake of the community, tell us everything you're doing to get Tradeskills implemented. This is a learning process for us all. Thanks!

User avatar
Zcoretri
Team Member
Posts: 1642
Joined: Fri Jul 27, 2007 12:55 pm
Location: SoCal

Re: Implementing Tradeskills

Post by Zcoretri » Tue Feb 22, 2011 8:32 am

I have committed a few structs related to the tradeskills. This looks like a challenging implemenation.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Implementing Tradeskills

Post by John Adams » Tue Feb 22, 2011 9:00 am

It is indeed... I thought it would help force us all to learn more.

Now you'll need to tell us (or at least me) how you made those new structs, your processes, steps, whatever. I know enough to map an existing struct to a packet... but no idea how you conjure a new struct up from a pile of hex characters ;)

Let's talk, unless you want to write it up yourself here... :mrgreen:

User avatar
Zcoretri
Team Member
Posts: 1642
Joined: Fri Jul 27, 2007 12:55 pm
Location: SoCal

Re: Implementing Tradeskills

Post by Zcoretri » Sun Feb 27, 2011 8:07 pm

A little bit of progress...
Tradeskill_1.png
You can see the Recipe Name and Icon... :mrgreen:
You do not have the required permissions to view the files attached to this post.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests