diff --git a/zone/string_ids.h b/zone/string_ids.h index 8f44cb48c..a8ab5a58b 100644 --- a/zone/string_ids.h +++ b/zone/string_ids.h @@ -383,8 +383,9 @@ #define FORAGE_MASTERY 6012 //Your forage mastery has enabled you to find something else! #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. #define GUILD_BANK_FULL 6098 // There is no more room in the Guild Bank. -#define GUILD_BANK_TRANSFERRED 6100 // '%1' transferred to Guild Bank from Deposits. -#define GUILD_BANK_EMPTY_HANDS 6108 // You must empty your hands to withdraw from the Guild Bank. +#define GUILD_BANK_TRANSFERRED 6100 // '%1' transferred to Guild Bank from Deposits. +#define GUILD_BANK_EMPTY_HANDS 6108 // You must empty your hands to withdraw from the Guild Bank. +#define TRADESKILL_COMBINE_LORE 6199 // Combine would result in a LORE item (%1) you already possess. #define TRANSFORM_FAILED 6326 //This mold cannot be applied to your %1. #define TRANSFORM_COMPLETE 6327 //You have successfully transformed your %1. #define DETRANSFORM_FAILED 6341 //%1 has no transformation that can be removed. diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 2f3a2b7f3..5ef5963ce 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -253,6 +253,9 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob { if (!user || !in_combine) { LogError("Client or NewCombine_Struct not set in Object::HandleCombine"); + auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); + user->QueuePacket(outapp); + safe_delete(outapp); return; } @@ -278,6 +281,9 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob Chat::Red, "Error: Server is not aware of the tradeskill container you are attempting to use" ); + auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); + user->QueuePacket(outapp); + safe_delete(outapp); return; } c_type = worldo->m_type; @@ -304,6 +310,9 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob if (!inst || !inst->IsType(EQ::item::ItemClassBag)) { user->Message(Chat::Red, "Error: Server does not recognize specified tradeskill container"); + auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); + user->QueuePacket(outapp); + safe_delete(outapp); return; } @@ -427,22 +436,50 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob if (spec.tradeskill == EQ::skills::SkillAlchemy) { if (user_pp.class_ != SHAMAN) { user->Message(Chat::Red, "This tradeskill can only be performed by a shaman."); + auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); + user->QueuePacket(outapp); + safe_delete(outapp); return; } else if (user_pp.level < MIN_LEVEL_ALCHEMY) { user->Message(Chat::Red, "You cannot perform alchemy until you reach level %i.", MIN_LEVEL_ALCHEMY); + auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); + user->QueuePacket(outapp); + safe_delete(outapp); return; } } else if (spec.tradeskill == EQ::skills::SkillTinkering) { if (user_pp.race != GNOME) { user->Message(Chat::Red, "Only gnomes can tinker."); + auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); + user->QueuePacket(outapp); + safe_delete(outapp); return; } } else if (spec.tradeskill == EQ::skills::SkillMakePoison) { if (user_pp.class_ != ROGUE) { user->Message(Chat::Red, "Only rogues can mix poisons."); + auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); + user->QueuePacket(outapp); + safe_delete(outapp); + return; + } + } + + // Check if Combine would result in Lore conflict + for (const auto& e : spec.onsuccess) { + auto success_item_inst = database.GetItem(e.first); + if (user->CheckLoreConflict(success_item_inst)) { + EQ::SayLinkEngine linker; + linker.SetLinkType(EQ::saylink::SayLinkItemData); + linker.SetItemData(success_item_inst); + auto item_link = linker.GenerateLink(); + user->MessageString(Chat::Red, TRADESKILL_COMBINE_LORE, item_link.c_str()); + auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); + user->QueuePacket(outapp); + safe_delete(outapp); return; } } @@ -687,6 +724,22 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac } } + DBTradeskillRecipe_Struct recipe_struct; + + // Check if Combine would result in Lore conflict + for (const auto& e : recipe_struct.onsuccess) { + auto success_item_inst = database.GetItem(e.first); + if (user->CheckLoreConflict(success_item_inst)) { + EQ::SayLinkEngine linker; + linker.SetLinkType(EQ::saylink::SayLinkItemData); + linker.SetItemData(success_item_inst); + auto item_link = linker.GenerateLink(); + user->MessageString(Chat::Red, TRADESKILL_COMBINE_LORE, item_link.c_str()); + user->QueuePacket(outapp); + safe_delete(outapp); + return; + } + } //otherwise, we found it all... outp->reply_code = 0x00000000; //success for finding it... user->QueuePacket(outapp);