Skip to content

Commit 99e49cb

Browse files
authored
[Tradeskills] Check if combine would result in lore conflict (#2932)
* [Tradeskills] Check if Combine would result in Lore Conflict. * formatting * Add Saylinks to lore message output. * Aknowledgement packets to prevent client issues.
1 parent 5ee2856 commit 99e49cb

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

zone/string_ids.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,9 @@
383383
#define FORAGE_MASTERY 6012 //Your forage mastery has enabled you to find something else!
384384
#define GUILD_BANK_CANNOT_DEPOSIT 6097 // Cannot deposit this item. Containers must be empty, and only one of each LORE and no NO TRADE or TEMPORARY items may be deposited.
385385
#define GUILD_BANK_FULL 6098 // There is no more room in the Guild Bank.
386-
#define GUILD_BANK_TRANSFERRED 6100 // '%1' transferred to Guild Bank from Deposits.
387-
#define GUILD_BANK_EMPTY_HANDS 6108 // You must empty your hands to withdraw from the Guild Bank.
386+
#define GUILD_BANK_TRANSFERRED 6100 // '%1' transferred to Guild Bank from Deposits.
387+
#define GUILD_BANK_EMPTY_HANDS 6108 // You must empty your hands to withdraw from the Guild Bank.
388+
#define TRADESKILL_COMBINE_LORE 6199 // Combine would result in a LORE item (%1) you already possess.
388389
#define TRANSFORM_FAILED 6326 //This mold cannot be applied to your %1.
389390
#define TRANSFORM_COMPLETE 6327 //You have successfully transformed your %1.
390391
#define DETRANSFORM_FAILED 6341 //%1 has no transformation that can be removed.

zone/tradeskills.cpp

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob
253253
{
254254
if (!user || !in_combine) {
255255
LogError("Client or NewCombine_Struct not set in Object::HandleCombine");
256+
auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
257+
user->QueuePacket(outapp);
258+
safe_delete(outapp);
256259
return;
257260
}
258261

@@ -278,6 +281,9 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob
278281
Chat::Red,
279282
"Error: Server is not aware of the tradeskill container you are attempting to use"
280283
);
284+
auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
285+
user->QueuePacket(outapp);
286+
safe_delete(outapp);
281287
return;
282288
}
283289
c_type = worldo->m_type;
@@ -304,6 +310,9 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob
304310

305311
if (!inst || !inst->IsType(EQ::item::ItemClassBag)) {
306312
user->Message(Chat::Red, "Error: Server does not recognize specified tradeskill container");
313+
auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
314+
user->QueuePacket(outapp);
315+
safe_delete(outapp);
307316
return;
308317
}
309318

@@ -427,22 +436,50 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob
427436
if (spec.tradeskill == EQ::skills::SkillAlchemy) {
428437
if (user_pp.class_ != SHAMAN) {
429438
user->Message(Chat::Red, "This tradeskill can only be performed by a shaman.");
439+
auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
440+
user->QueuePacket(outapp);
441+
safe_delete(outapp);
430442
return;
431443
}
432444
else if (user_pp.level < MIN_LEVEL_ALCHEMY) {
433445
user->Message(Chat::Red, "You cannot perform alchemy until you reach level %i.", MIN_LEVEL_ALCHEMY);
446+
auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
447+
user->QueuePacket(outapp);
448+
safe_delete(outapp);
434449
return;
435450
}
436451
}
437452
else if (spec.tradeskill == EQ::skills::SkillTinkering) {
438453
if (user_pp.race != GNOME) {
439454
user->Message(Chat::Red, "Only gnomes can tinker.");
455+
auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
456+
user->QueuePacket(outapp);
457+
safe_delete(outapp);
440458
return;
441459
}
442460
}
443461
else if (spec.tradeskill == EQ::skills::SkillMakePoison) {
444462
if (user_pp.class_ != ROGUE) {
445463
user->Message(Chat::Red, "Only rogues can mix poisons.");
464+
auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
465+
user->QueuePacket(outapp);
466+
safe_delete(outapp);
467+
return;
468+
}
469+
}
470+
471+
// Check if Combine would result in Lore conflict
472+
for (const auto& e : spec.onsuccess) {
473+
auto success_item_inst = database.GetItem(e.first);
474+
if (user->CheckLoreConflict(success_item_inst)) {
475+
EQ::SayLinkEngine linker;
476+
linker.SetLinkType(EQ::saylink::SayLinkItemData);
477+
linker.SetItemData(success_item_inst);
478+
auto item_link = linker.GenerateLink();
479+
user->MessageString(Chat::Red, TRADESKILL_COMBINE_LORE, item_link.c_str());
480+
auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
481+
user->QueuePacket(outapp);
482+
safe_delete(outapp);
446483
return;
447484
}
448485
}
@@ -687,6 +724,22 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac
687724
}
688725
}
689726

727+
DBTradeskillRecipe_Struct recipe_struct;
728+
729+
// Check if Combine would result in Lore conflict
730+
for (const auto& e : recipe_struct.onsuccess) {
731+
auto success_item_inst = database.GetItem(e.first);
732+
if (user->CheckLoreConflict(success_item_inst)) {
733+
EQ::SayLinkEngine linker;
734+
linker.SetLinkType(EQ::saylink::SayLinkItemData);
735+
linker.SetItemData(success_item_inst);
736+
auto item_link = linker.GenerateLink();
737+
user->MessageString(Chat::Red, TRADESKILL_COMBINE_LORE, item_link.c_str());
738+
user->QueuePacket(outapp);
739+
safe_delete(outapp);
740+
return;
741+
}
742+
}
690743
//otherwise, we found it all...
691744
outp->reply_code = 0x00000000; //success for finding it...
692745
user->QueuePacket(outapp);

0 commit comments

Comments
 (0)