mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
[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.
This commit is contained in:
parent
5ee2856133
commit
99e49cb2ec
@ -385,6 +385,7 @@
|
||||
#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 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.
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user