Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Development

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 12-30-2003, 03:01 AM
Muuss
Dragon
 
Join Date: May 2003
Posts: 539
Default tradeskillrecipe table

in table 'tradeskillrecipe', the field named 'product' (smallint(6)) is set to 'unique'. If you wanna create 2 recipes with the same product as result, it leads you to use product2 instead of product to set the recipe's result. If you have more than 2 recipes returning both the same product and product2, you're blocked.

Returning several items from tradeskill recipes happens quite a lot when you start using tools, like knives in tailoring or hammers in smithing, and you need to use the failproduct field for the tool in case the combine fails.

So the question is :
Is there an alternate way for those situations or do we really need that 'unique' statement on that field?

L8rs
__________________
Muuss - [PEQGC] Dobl, the ogre that counts for 2 !
http://www.vilvert.fr/page.php?id=10
Reply With Quote
  #2  
Old 12-30-2003, 03:19 AM
Muuss
Dragon
 
Join Date: May 2003
Posts: 539
Default

i m quoting a (very) old post, from Lurker_005, some of those functionnalities has been implemented, but not all and some seem to remain quite important to my eyes

http://www.everquestserver.com/forum...pic.php?t=3802

Quote:
I would like to improve the trade skill functions.

return multiple items
- 5 arrows
- product and a tool used making it
return an item on failure
quest combines that the container becomes the item made
zero failure combines
container type check
Edit: found a recipie that returns 2 items on failure.... nother column needed in the table

returning an item and a tool is possible, but not one item and 2 tools (Velious tradeskill quests do that quite often).

So basically, we could still need :

- more products
- alwaysreturn products (2, 3, more ?)
- a 'no fail' flag
- several failproducts
- a 'transform container to [items.id]' field


Table structure as it is now:
+--------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------+----------------+
| id | int(11) | | PRI | NULL | auto_increment |
| tradeskill | smallint(6) | | | 0 | |
| skillneeded | smallint(6) | | | 0 | |
| trivial | smallint(6) | | | 0 | |
| product | smallint(6) | | UNI | 0 | |
| product2 | smallint(6) | | | 0 | |
| failproduct | smallint(6) | | | 0 | |
| productcount | smallint(6) | | | 0 | |
| i1 | smallint(6) | | | 0 | |
| i2 | smallint(6) | | | 0 | |
| i3 | smallint(6) | | | 0 | |
| i4 | smallint(6) | | | 0 | |
| i5 | smallint(6) | | | 0 | |
| i6 | smallint(6) | | | 0 | |
| i7 | smallint(6) | | | 0 | |
| i8 | smallint(6) | | | 0 | |
| i9 | smallint(6) | | | 0 | |
| i10 | smallint(6) | | | 0 | |
| notes | text | YES | | NULL | |
+--------------+-------------+------+-----+---------+----------------+
[/b]
__________________
Muuss - [PEQGC] Dobl, the ogre that counts for 2 !
http://www.vilvert.fr/page.php?id=10
Reply With Quote
  #3  
Old 12-30-2003, 07:59 PM
Lurker_005
Demi-God
 
Join Date: Jan 2002
Location: Tourist town USA
Posts: 1,671
Default Re: tradeskillrecipe table

Quote:
Originally Posted by Muuss
So the question is :
Is there an alternate way for those situations or do we really need that 'unique' statement on that field?
There are no ill affects from removing the unique flag on the product field. Not sure why the CSV DB hasn't had that changed...

The rest you could ask Trumpcard to look at, he helped impliment the last tradeskill table change.
I suggest you make a proposed new table with what seems needed, with reasons/uses for each change and post them here.
__________________
Please read the forum rules and look at reacent messages before posting.
Reply With Quote
  #4  
Old 12-31-2003, 12:00 AM
Muuss
Dragon
 
Join Date: May 2003
Posts: 539
Default

Ok Lurker, i ll work on this.
I noticed some recipes with trivial and neededskill set to -1 or some set to 255, i ll have to look at the source code to see what's the goal.
__________________
Muuss - [PEQGC] Dobl, the ogre that counts for 2 !
http://www.vilvert.fr/page.php?id=10
Reply With Quote
  #5  
Old 12-31-2003, 07:57 AM
Lurker_005
Demi-God
 
Join Date: Jan 2002
Location: Tourist town USA
Posts: 1,671
Default

Quote:
Originally Posted by Muuss
I noticed some recipes with trivial and neededskill set to -1 or some set to 255
I don't think it got put in the code, but when making the table, -1 was used to denote nofail combines and 255 (or was it 251)trivial was for stuff that at the time never became trivial.

see http://www.everquestserver.com/forum...pic.php?t=3801 Unfortunatly none of the links work anymore, but all the tradeskils done were put into the AddonDBs and that is on sourceforge
__________________
Please read the forum rules and look at reacent messages before posting.
Reply With Quote
  #6  
Old 01-01-2004, 04:09 AM
Muuss
Dragon
 
Join Date: May 2003
Posts: 539
Default

I worked on the table structure. I found more simple to build 3 new tables than modifying the existing one. I built a table describing the recipe and another one for the components/products, the last one implements limits on the combines, mainly for cultural tradeskills. Below the 3 tables and a few words commenting the fields :


first table

Code:
mysql> show columns from tradeskill_recipe;
+--------------+-------------+------+-----+---------+----------------+
| Field        | Type        | Null | Key | Default | Extra          |
+--------------+-------------+------+-----+---------+----------------+
| id           | int(11)     |      | PRI | NULL    | auto_increment |
| name         | varchar(64) |      |     |         |                |
| tradeskill   | smallint(6) |      |     | 0       |                |
| skillneeded  | smallint(6) |      |     | 0       |                |
| trivial      | smallint(6) |      |     | 0       |                |
| nofail       | tinyint(4)  |      |     | 0       |                |
| container_id | smallint(6) |      |     | -1      |                |
| notes        | tinytext    | YES  |     | NULL    |                |
+--------------+-------------+------+-----+---------+----------------+

tradeskil,skillneeded,trivial,notes are same as before.
the 'name' field is only designed for world builders.
i added a nofail flag (0/1)
container_id permits to add quest recipes combinable on particular bags/boxes/chests, that container is destroyed when combining


second table


Code:
mysql> show columns from tradeskill_recipe_entries;
+----------------+-------------+------+-----+---------+----------------+
| Field          | Type        | Null | Key | Default | Extra          |
+----------------+-------------+------+-----+---------+----------------+
| id             | int(11)     |      | PRI | NULL    | auto_increment |
| recipe_id      | smallint(6) |      |     | 0       |                |
| item_id        | smallint(6) |      |     | 0       |                |
| successcount   | tinyint(4)  |      |     | 0       |                |
| failcount      | tinyint(4)  |      |     | 0       |                |
| componentcount | tinyint(4)  |      |     | 1       |                |
+----------------+-------------+------+-----+---------+----------------+
recipe_id <=> tradeskill_recipe.id
item_id <=> items.id
successcount -> number returned on success
failcount -> number returned on failure
componentcount -> number needed for the combine

doing that way, we can :

-we won't have to change the table again is VI starts to create recipes with 12 components or more.

- use as many tools as needed that will be returned on failure/success : component=1, successcount=1, failcount=1

- have products returned on success : component=0, successcount=1 (or more), failcount=0

- have products returned on failure : component=0, successcount=0, failcount=1 (or more)

- have components, destroyed when combining : component=1 (or more), successcount=0, failcount=0


For a combine that transforms the original container in a new one :
tradeskill_recipe :
id=auto_increment
nofail=1
container_id = original container
tradeskill=[whatever, since its nofail]

tradeskill_recipe_entries :
item_id=item returned on the combine
successcount=1
failcount=0
componentcount=0

tradeskill_recipe_entries :
components needed for the combine.


third table

Code:
mysql> show columns from tradeskill_recipe_limits; 
+-----------+-------------+------+-----+---------+----------------+
| Field     | Type        | Null | Key | Default | Extra          |
+-----------+-------------+------+-----+---------+----------------+
| id        | int(11)     |      | PRI | NULL    | auto_increment |
| recipe_id | smallint(6) |      |     | 0       |                |
| class     | smallint(6) |      |     | 0       |                |
| race      | smallint(6) |      |     | 0       |                |
| god       | smallint(6) |      |     | 0       |                |
+-----------+-------------+------+-----+---------+----------------+
fields speaks by themselves i think.
Adding that table allows to limit combines to any combination of race/class/god possible.



If the tradeskill's table changes, i could write a convertor from actual design to whatever it ll become
__________________
Muuss - [PEQGC] Dobl, the ogre that counts for 2 !
http://www.vilvert.fr/page.php?id=10
Reply With Quote
  #7  
Old 01-01-2004, 04:12 AM
Muuss
Dragon
 
Join Date: May 2003
Posts: 539
Default

forgot this )

CREATE TABLE tradeskill_recipe (
id int(11) NOT NULL auto_increment,
name varchar(64) NOT NULL default '',
tradeskill smallint(6) NOT NULL default '0',
skillneeded smallint(6) NOT NULL default '0',
trivial smallint(6) NOT NULL default '0',
nofail tinyint(4) NOT NULL default '0',
container_id smallint(6) NOT NULL default '-1',
notes tinytext,
PRIMARY KEY (id)
) TYPE=MyISAM;

CREATE TABLE tradeskill_recipe_entries (
id int(11) NOT NULL auto_increment,
recipe_id smallint(6) NOT NULL default '0',
item_id smallint(6) NOT NULL default '0',
successcount tinyint(4) NOT NULL default '0',
failcount tinyint(4) NOT NULL default '0',
componentcount tinyint(4) NOT NULL default '1',
PRIMARY KEY (id)
) TYPE=MyISAM;

CREATE TABLE tradeskill_recipe_limits (
id int(11) NOT NULL auto_increment,
recipe_id smallint(6) NOT NULL default '0',
class smallint(6) NOT NULL default '0',
race smallint(6) NOT NULL default '0',
god smallint(6) NOT NULL default '0',
PRIMARY KEY (id)
) TYPE=MyISAM;
__________________
Muuss - [PEQGC] Dobl, the ogre that counts for 2 !
http://www.vilvert.fr/page.php?id=10
Reply With Quote
  #8  
Old 01-01-2004, 06:53 AM
krich
Hill Giant
 
Join Date: May 2003
Location: The Great Northwest
Posts: 150
Default

Good stuff Muus! I hope this change goes in as it will allow much more flexibility in tradeskill recipes.

As part of the overall project, the Mwnpcmovdb team is working on a tradeskill database that is based on the EQTraders.com database. If you have any interest in assisting, please let me know. We could use the help (especially if your recommendations are adopted)

Regards,

krich
Reply With Quote
  #9  
Old 01-01-2004, 07:09 AM
Muuss
Dragon
 
Join Date: May 2003
Posts: 539
Default

I m kinda busy ATM with the spawn editor i wanna finish. If you use the recipe editor and need changes, i m totally open to make them.
and thx for the job done on the DBs
__________________
Muuss - [PEQGC] Dobl, the ogre that counts for 2 !
http://www.vilvert.fr/page.php?id=10
Reply With Quote
  #10  
Old 01-01-2004, 11:06 PM
Muuss
Dragon
 
Join Date: May 2003
Posts: 539
Default

I could be usefull to add a field in the tradeskill_recipe_limits table, with the birthtown. Agnostic humans have different cultural skills on live, from freeport or qeynos.
__________________
Muuss - [PEQGC] Dobl, the ogre that counts for 2 !
http://www.vilvert.fr/page.php?id=10
Reply With Quote
  #11  
Old 01-01-2004, 11:13 PM
Lurker_005
Demi-God
 
Join Date: Jan 2002
Location: Tourist town USA
Posts: 1,671
Default

Definatly more versatile. It is harder to follow/debug the raw SQL, but with a good editor that isn't an issue.
Will this cover all the needs for tradeskills? Any problems/missing features?

Anyone want to try and work out the code changes needed for this?
__________________
Please read the forum rules and look at reacent messages before posting.
Reply With Quote
  #12  
Old 01-01-2004, 11:20 PM
Muuss
Dragon
 
Join Date: May 2003
Posts: 539
Default

I ll update my recipe editor if needed (and if people judge it usefull).
Tho for the source code, i can try but it ll take me a lots of time since i m far of being a C++ coder
__________________
Muuss - [PEQGC] Dobl, the ogre that counts for 2 !
http://www.vilvert.fr/page.php?id=10
Reply With Quote
  #13  
Old 01-02-2004, 04:59 AM
krich
Hill Giant
 
Join Date: May 2003
Location: The Great Northwest
Posts: 150
Default

I was thinking about this enhancement over the last day or so. This new format works well when you know the product and you want to find the ingredients, but I can't come up with a proper SQL statement that will pull a recipe out of this structure given only the ingredients. (Of course it could be due to my relatively light SQL experience).

Consider a simple recipe: Tarnished Dagger
Ingredients: Rusty Dagger, Sharpening Stone

What would the SQL Statement(s)/C++ Code be to pull that out of the database? Remember, when the player clicks combine, all we know at that point are the ingredients.

Regards,

krich
Reply With Quote
  #14  
Old 01-02-2004, 06:33 AM
Muuss
Dragon
 
Join Date: May 2003
Posts: 539
Default

I think the question is : what is the MYsql statement to do this
it would be possible in 1 round if mysql would work with subselects (select into where clauses). Since its not, i think several passes will be needed to find the recipe.

like for example :

Code:
select tradeskill_recipe.id from tradeskill_recipe,tradeskill_recipe_entries where tradeskill_recipe.id=tradeskill_recipe_entries.recipe_id and item_id=[item1id] and componentcount=[item1nb]
-> returns the recipes which need item1nb of item1id

if there's more than 1 answer, we test them with the second item

point A
Code:
select tradeskill_recipe.id from tradeskill_recipe,tradeskill_recipe_entries where tradeskill_recipe.id=tradeskill_recipe_entries.recipe_id and tradeskill_recipe.id=[answer1] and item_id=[item1id] and componentcount=[item1nb]
if there's a result to this, we keep that recipe_id as a possible result, and process to the next previous answers.

At the end, if we have only 1 recipe_id left, we found the recipe, if no, 2 possibilities :
- our recipe has 2 components and both are a part of the components of another recipe (or there's 2 similar recipes, but this may consider as an error from the world builder)
- there are several recipes that match 1st and 2nd components, we have to test for the 3rd one and restart at point A.


That's not the only way to do this, another one would be to do a query, of the kind :

Code:
select distinct tradeskill_recipe.id 
from tradeskill_recipe,tradeskill_recipe_entries 
where tradeskill_recipe.id=tradeskill_recipe_entries.recipe_id and
(
(item_id=[item1id] and componentcount=[item1count]) 
or (item_id=[item2id] and componentcount=[item3count]) 
..
or (item_id=[itemnid] and componentcount=[itemncount]) 
)
that will return all the recipes containing each of our items (with the good componentcounts). Then process backway and test all the recipes found to see if they match the items from the combine container...


I ve tested this, its longer to describe than to do. Of course, its more time consuming than the queries on the previous table, but tradeskill combines arent that frequent... another possibility, wait till subselects are implemented into mysql


[/u]
__________________
Muuss - [PEQGC] Dobl, the ogre that counts for 2 !
http://www.vilvert.fr/page.php?id=10
Reply With Quote
  #15  
Old 01-04-2004, 02:53 PM
Trumpcard
Demi-God
 
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
Default

You guys get a concensus on how you want me to change it, and i'll merge it in.
__________________
Quitters never win, and winners never quit, but those who never win and never quit are idiots.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:20 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3