View Single Post
  #1  
Old 01-18-2008, 01:38 PM
Knightly
Accomplished Programmer
 
Join Date: Nov 2006
Location: Honolulu, HI
Posts: 91
Default Fix for tradeskill fail bug

Right now, to return a tradeskill item you have to have two entries for that item in the tradeskill_recipe_entries table. The first entry tells the database how many to use and the second entry tells the database how many to return (and to use 0).

Obviously this is not the way that the schema was intended and it can easily be fixed in the code.

In zone\tradeskills.cpp find:
Code:
	//Pull the on-fail items...
	qlen = MakeAnyLenString(&query, "SELECT item_id,failcount FROM tradeskill_recipe_entries"
	 " WHERE failcount>0 AND componentcount=0 AND recipe_id=%u", recipe_id);
and change it to:
Code:
	//Pull the on-fail items...
	qlen = MakeAnyLenString(&query, "SELECT item_id,failcount FROM tradeskill_recipe_entries"
	 " WHERE failcount>0 AND componentcount>0 AND recipe_id=%u", recipe_id);
What this does is change the request from "Tell me all items and how many of this item I should return where I've used 0 of them" to "Tell me all items and how many of this item I should return where I've used at least one of them."

This is what I believe was intended by that line of code. The first code snippet says "I only want to return items that weren't required for the recipe." The second snippet says "I only want to return items that were required for the recipe."

HOWEVER, it is my feeling that I should be able to return any item I want, whether it was used in the recipe or not. For example: When I'm making Bear Fillet in Cream and I combine my Filleted Bear with my Creamy Fennel Sauce, I may not be paying attention and fail. Who's to say that my failure can't return a Sticky Brown Mess?

I vaguely remember something like this happening in EQ Live, on a failure neither of the items you put in are returned, but you get a separate item back. My wife tells me I am wrong and since I can't find the recipe, I may well be. But just in case I'm not, you could change the code to:
Code:
	//Pull the on-fail items...
	qlen = MakeAnyLenString(&query, "SELECT item_id,failcount FROM tradeskill_recipe_entries"
	 " WHERE failcount>0 AND recipe_id=%u", recipe_id);
Either way, the existing code should be fixed.

::WARNING1:: The first change above will require you to change your database in the case where you did not make the failcount match for the item where you added the 0 use component.

::WARNING2:: The second change above will require you to change your database in the case where you did make the failcount match for th eitem where you added the 0 use component.

::Hope:: I'm hoping someone else will update the databases themselves to fix this, but it may require double checking around 3500 recipies. It can be done programatically if your database is consistent (and you know exactly how it is consistent). If someone can tell me which of the above fixes should be merged into the code and how each database's recipies are done then I will start making database changes appropriately.
Reply With Quote