Fix for tradeskill query [skip ci]

This commit is contained in:
Akkadius 2020-04-04 03:55:53 -05:00
parent 58534dea16
commit bcef171cf9

View File

@ -11778,7 +11778,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app)
{
if (app->size != sizeof(TradeskillFavorites_Struct)) {
LogError("Invalid size for TradeskillFavorites_Struct: Expected: [{}], Got: [{}]",
sizeof(TradeskillFavorites_Struct), app->size);
sizeof(TradeskillFavorites_Struct), app->size);
return;
}
@ -11828,6 +11828,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app)
if (first) //no favorites....
return;
// TODO: Clean this up
const std::string query = StringFormat(
SQL (
SELECT
@ -11844,11 +11845,11 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app)
AND tr.id IN (%s)
AND tr.must_learn & 0x20 <> 0x20
AND (
(
tr.must_learn & 0x3 <> 0
)
OR (tr.must_learn & 0x3 = 0)
)
(
tr.must_learn & 0x3 <> 0
)
OR (tr.must_learn & 0x3 = 0)
)
GROUP BY
tr.id
HAVING
@ -11924,6 +11925,7 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app)
}
//arbitrary limit of 200 recipes, makes sense to me.
// TODO: Clean this up
std::string query = fmt::format(
SQL(
SELECT
@ -11931,37 +11933,19 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app)
tr.name,
tr.trivial,
SUM(tre.componentcount),
crl.madecount,
tr.tradeskill
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 = {}
) AS crl ON tr.id = crl.recipe_id
tradeskill_recipe AS tr
LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id = tre.recipe_id
WHERE
{} tr.trivial >= {}
{} tr.trivial >= {}
AND tr.trivial <= {}
AND tr.enabled <> 0
AND tr.must_learn & 0x20 <> 0x20
AND (
(
tr.must_learn & 0x3 <> 0
AND crl.madecount IS NOT NULL
)
(
tr.must_learn & 0x3 <> 0
)
OR (tr.must_learn & 0x3 = 0)
)
GROUP BY
@ -11979,7 +11963,6 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app)
LIMIT
200
),
CharacterID(),
search_clause,
p_recipes_search_struct->mintrivial,
p_recipes_search_struct->maxtrivial,