From cf117b1a4df3acff5547f0451735df5f39afc356 Mon Sep 17 00:00:00 2001 From: Leere Date: Thu, 31 Oct 2013 17:55:04 +0100 Subject: [PATCH] Add the ability to disable a tradeskill recipe --- changelog.txt | 3 +++ utils/sql/git/required/2013_10_31_Recipe_disabling.sql | 1 + zone/client_packet.cpp | 4 ++-- zone/tradeskills.cpp | 7 ++++--- 4 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 utils/sql/git/required/2013_10_31_Recipe_disabling.sql diff --git a/changelog.txt b/changelog.txt index dfebe38c0..ee427415e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/31/2013 == +Leere: Add the ability to disable a tradeskill recipe + == 10/28/2013 == Uleat: Client patch prep work for extending usable skill range (no apparent issues with Ti through RoF[12-10-2012] testing - i.e., clients showed proper skills and they didn't crash) Uleat: This final patch aligns the existing server PlayerProfile_Struct with the previous changes. The pp_struct, as well as the character 'pp' blob, remains unchanged in size and alignment. The only difference is that the first trailing 100 bytes of the unknown array have been re-assigned to the skills array, and the unknown array decreased by the same amount. diff --git a/utils/sql/git/required/2013_10_31_Recipe_disabling.sql b/utils/sql/git/required/2013_10_31_Recipe_disabling.sql new file mode 100644 index 000000000..14bd7d7ff --- /dev/null +++ b/utils/sql/git/required/2013_10_31_Recipe_disabling.sql @@ -0,0 +1 @@ +ALTER TABLE `tradeskill_recipe` ADD `enabled` tinyint(1) NOT NULL DEFAULT '1'; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index df9d73849..f28008ae3 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -6021,7 +6021,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) " FROM tradeskill_recipe AS tr " " LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id=tre.recipe_id " " LEFT JOIN (SELECT recipe_id, madecount FROM char_recipe_list WHERE char_id = %u) AS crl ON tr.id=crl.recipe_id " - " WHERE tr.id IN (%s) " + " WHERE tr.enabled <> 0 AND tr.id IN (%s) " " AND tr.must_learn & 0x20 <> 0x20 AND ((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT NULL) OR (tr.must_learn & 0x3 = 0)) " " GROUP BY tr.id " " HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 " @@ -6076,7 +6076,7 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) " FROM tradeskill_recipe AS tr " " LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id=tre.recipe_id " " LEFT JOIN (SELECT recipe_id, madecount FROM char_recipe_list WHERE char_id = %u) AS crl ON tr.id=crl.recipe_id " - " WHERE %s tr.trivial >= %u AND tr.trivial <= %u " + " WHERE %s tr.trivial >= %u AND tr.trivial <= %u AND tr.enabled <> 0 " " AND tr.must_learn & 0x20 <> 0x20 AND((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT NULL) OR (tr.must_learn & 0x3 = 0)) " " GROUP BY tr.id " " HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 " diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index cb1104a2f..2534924ec 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1223,8 +1223,9 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 qlen = MakeAnyLenString(&query, "SELECT tre.recipe_id " " FROM tradeskill_recipe_entries AS tre" - " WHERE ( tre.item_id IN(%s) AND tre.componentcount>0 )" - " OR ( tre.item_id %s AND tre.iscontainer=1 )" + " INNER JOIN tradeskill_recipe AS tr ON (tre.recipe_id = tr.id) " + " WHERE tr.enabled AND (( tre.item_id IN(%s) AND tre.componentcount>0 )" + " OR ( tre.item_id %s AND tre.iscontainer=1 ))" " GROUP BY tre.recipe_id HAVING sum(tre.componentcount) = %u" " AND sum(tre.item_id * tre.componentcount) = %u", buf2, containers, count, sum); @@ -1387,7 +1388,7 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id " ON tr.id = tre.recipe_id" " LEFT JOIN (SELECT recipe_id, madecount from char_recipe_list WHERE char_id = %u) AS crl " " ON tr.id = crl.recipe_id " - " WHERE tr.id = %lu AND tre.item_id %s" + " WHERE tr.id = %lu AND tre.item_id %s AND tr.enabled " " GROUP BY tr.id", char_id, (unsigned long)recipe_id, containers); if (!RunQuery(query, qlen, errbuf, &result)) {