diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index f998d0902..7fdc2ede9 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3138,24 +3138,48 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) std::vector args; args.push_back(old_aug); - parse->EventItem(EVENT_UNAUGMENT_ITEM, this, tobe_auged, nullptr, "", in_augment->augment_index, &args); + + if (parse->ItemHasQuestSub(tobe_auged, EVENT_UNAUGMENT_ITEM)) { + parse->EventItem( + EVENT_UNAUGMENT_ITEM, + this, + tobe_auged, + nullptr, + "", + in_augment->augment_index, + &args + ); + } args.assign(1, tobe_auged); args.push_back(false); - parse->EventItem(EVENT_AUGMENT_REMOVE, this, old_aug, nullptr, "", in_augment->augment_index, &args); - const auto export_string = fmt::format( - "{} {} {} {} {}", - tobe_auged->GetID(), - item_slot, - old_aug->GetID(), - in_augment->augment_index, - false - ); + if (parse->ItemHasQuestSub(old_aug, EVENT_AUGMENT_REMOVE)) { + parse->EventItem( + EVENT_AUGMENT_REMOVE, + this, + old_aug, + nullptr, + "", + in_augment->augment_index, + &args + ); + } - args.push_back(old_aug); + if (parse->PlayerHasQuestSub(EVENT_AUGMENT_REMOVE_CLIENT)) { + const auto& export_string = fmt::format( + "{} {} {} {} {}", + tobe_auged->GetID(), + item_slot, + old_aug->GetID(), + in_augment->augment_index, + false + ); - parse->EventPlayer(EVENT_AUGMENT_REMOVE_CLIENT, this, export_string, 0, &args); + args.push_back(old_aug); + + parse->EventPlayer(EVENT_AUGMENT_REMOVE_CLIENT, this, export_string, 0, &args); + } } tobe_auged->PutAugment(in_augment->augment_index, *new_aug); @@ -3165,22 +3189,46 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) if (aug) { std::vector args; args.push_back(aug); - parse->EventItem(EVENT_AUGMENT_ITEM, this, tobe_auged, nullptr, "", in_augment->augment_index, &args); + + if (parse->ItemHasQuestSub(tobe_auged, EVENT_AUGMENT_ITEM)) { + parse->EventItem( + EVENT_AUGMENT_ITEM, + this, + tobe_auged, + nullptr, + "", + in_augment->augment_index, + &args + ); + } args.assign(1, tobe_auged); - parse->EventItem(EVENT_AUGMENT_INSERT, this, aug, nullptr, "", in_augment->augment_index, &args); + + if (parse->ItemHasQuestSub(aug, EVENT_AUGMENT_INSERT)) { + parse->EventItem( + EVENT_AUGMENT_INSERT, + this, + aug, + nullptr, + "", + in_augment->augment_index, + &args + ); + } args.push_back(aug); - const auto export_string = fmt::format( - "{} {} {} {}", - tobe_auged->GetID(), - item_slot, - aug->GetID(), - in_augment->augment_index - ); + if (parse->PlayerHasQuestSub(EVENT_AUGMENT_INSERT_CLIENT)) { + const auto& export_string = fmt::format( + "{} {} {} {}", + tobe_auged->GetID(), + item_slot, + aug->GetID(), + in_augment->augment_index + ); - parse->EventPlayer(EVENT_AUGMENT_INSERT_CLIENT, this, export_string, 0, &args); + parse->EventPlayer(EVENT_AUGMENT_INSERT_CLIENT, this, export_string, 0, &args); + } } else { Message( Chat::Red, @@ -3233,24 +3281,48 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) if (aug) { std::vector args; args.push_back(aug); - parse->EventItem(EVENT_UNAUGMENT_ITEM, this, tobe_auged, nullptr, "", in_augment->augment_index, &args); + + if (parse->ItemHasQuestSub(tobe_auged, EVENT_UNAUGMENT_ITEM)) { + parse->EventItem( + EVENT_UNAUGMENT_ITEM, + this, + tobe_auged, + nullptr, + "", + in_augment->augment_index, + &args + ); + } args.assign(1, tobe_auged); args.push_back(false); - parse->EventItem(EVENT_AUGMENT_REMOVE, this, aug, nullptr, "", in_augment->augment_index, &args); + + if (parse->ItemHasQuestSub(aug, EVENT_AUGMENT_REMOVE)) { + parse->EventItem( + EVENT_AUGMENT_REMOVE, + this, + aug, + nullptr, + "", + in_augment->augment_index, + &args + ); + } args.push_back(aug); - const auto export_string = fmt::format( - "{} {} {} {} {}", - tobe_auged->GetID(), - item_slot, - aug->GetID(), - in_augment->augment_index, - false - ); + if (parse->PlayerHasQuestSub(EVENT_AUGMENT_REMOVE_CLIENT)) { + const auto& export_string = fmt::format( + "{} {} {} {} {}", + tobe_auged->GetID(), + item_slot, + aug->GetID(), + in_augment->augment_index, + false + ); - parse->EventPlayer(EVENT_AUGMENT_REMOVE_CLIENT, this, export_string, 0, &args); + parse->EventPlayer(EVENT_AUGMENT_REMOVE_CLIENT, this, export_string, 0, &args); + } } else { Message(Chat::Red, "Error: Could not find augmentation to remove at index %i. Aborting.", in_augment->augment_index); return; @@ -3297,24 +3369,48 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) if (aug) { std::vector args; args.push_back(aug); - parse->EventItem(EVENT_UNAUGMENT_ITEM, this, tobe_auged, nullptr, "", in_augment->augment_index, &args); + + if (parse->ItemHasQuestSub(tobe_auged, EVENT_UNAUGMENT_ITEM)) { + parse->EventItem( + EVENT_UNAUGMENT_ITEM, + this, + tobe_auged, + nullptr, + "", + in_augment->augment_index, + &args + ); + } args.assign(1, tobe_auged); args.push_back(true); - parse->EventItem(EVENT_AUGMENT_REMOVE, this, aug, nullptr, "", in_augment->augment_index, &args); + + if (parse->ItemHasQuestSub(aug, EVENT_AUGMENT_REMOVE)) { + parse->EventItem( + EVENT_AUGMENT_REMOVE, + this, + aug, + nullptr, + "", + in_augment->augment_index, + &args + ); + } args.push_back(aug); - const auto export_string = fmt::format( - "{} {} {} {} {}", - tobe_auged->GetID(), - item_slot, - aug->GetID(), - in_augment->augment_index, - true - ); + if (parse->PlayerHasQuestSub(EVENT_AUGMENT_REMOVE_CLIENT)) { + const auto& export_string = fmt::format( + "{} {} {} {} {}", + tobe_auged->GetID(), + item_slot, + aug->GetID(), + in_augment->augment_index, + true + ); - parse->EventPlayer(EVENT_AUGMENT_REMOVE_CLIENT, this, export_string, 0, &args); + parse->EventPlayer(EVENT_AUGMENT_REMOVE_CLIENT, this, export_string, 0, &args); + } } else { Message( Chat::Red, diff --git a/zone/embparser.cpp b/zone/embparser.cpp index 8de5a835e..87c27d213 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -1951,16 +1951,40 @@ void PerlembParser::ExportEventVariables( break; } - case EVENT_AUGMENT_INSERT_CLIENT: + case EVENT_AUGMENT_INSERT_CLIENT: { + Seperator sep(data); + ExportVar(package_name.c_str(), "item_id", sep.arg[0]); + ExportVar(package_name.c_str(), "item_slot", sep.arg[1]); + ExportVar(package_name.c_str(), "augment_id", sep.arg[2]); + ExportVar(package_name.c_str(), "augment_slot", sep.arg[3]); + + if (extra_pointers && extra_pointers->size() >= 1) { + ExportVar(package_name.c_str(), "item", "QuestItem", std::any_cast(extra_pointers->at(0))); + } + + if (extra_pointers && extra_pointers->size() >= 2) { + ExportVar(package_name.c_str(), "augment", "QuestItem", std::any_cast(extra_pointers->at(1))); + } + + break; + } + case EVENT_AUGMENT_REMOVE_CLIENT: { Seperator sep(data); ExportVar(package_name.c_str(), "item_id", sep.arg[0]); ExportVar(package_name.c_str(), "item_slot", sep.arg[1]); ExportVar(package_name.c_str(), "augment_id", sep.arg[2]); ExportVar(package_name.c_str(), "augment_slot", sep.arg[3]); - if (sep.argnum >= 4) { - ExportVar(package_name.c_str(), "destroyed", sep.arg[4]); + ExportVar(package_name.c_str(), "destroyed", sep.arg[4]); + + if (extra_pointers && extra_pointers->size() >= 1) { + ExportVar(package_name.c_str(), "item", "QuestItem", std::any_cast(extra_pointers->at(0))); } + + if (extra_pointers && extra_pointers->size() >= 3) { + ExportVar(package_name.c_str(), "augment", "QuestItem", std::any_cast(extra_pointers->at(2))); + } + break; } diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index c2f9a3076..724a3b589 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -140,22 +140,30 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme if(aug) { std::vector args; args.push_back(aug); - parse->EventItem(EVENT_AUGMENT_ITEM, user, tobe_auged, nullptr, "", slot, &args); + + if (parse->ItemHasQuestSub(tobe_auged, EVENT_AUGMENT_ITEM)) { + parse->EventItem(EVENT_AUGMENT_ITEM, user, tobe_auged, nullptr, "", slot, &args); + } args.assign(1, tobe_auged); - parse->EventItem(EVENT_AUGMENT_INSERT, user, aug, nullptr, "", slot, &args); + + if (parse->ItemHasQuestSub(aug, EVENT_AUGMENT_INSERT)) { + parse->EventItem(EVENT_AUGMENT_INSERT, user, aug, nullptr, "", slot, &args); + } args.push_back(aug); - const auto export_string = fmt::format( - "{} {} {} {}", - tobe_auged->GetID(), - -1, - aug->GetID(), - slot - ); + if (parse->PlayerHasQuestSub(EVENT_AUGMENT_INSERT_CLIENT)) { + const auto& export_string = fmt::format( + "{} {} {} {}", + tobe_auged->GetID(), + -1, + aug->GetID(), + slot + ); - parse->EventPlayer(EVENT_AUGMENT_INSERT_CLIENT, user, export_string, 0, &args); + parse->EventPlayer(EVENT_AUGMENT_INSERT_CLIENT, user, export_string, 0, &args); + } } item_one_to_push = tobe_auged->Clone(); @@ -182,12 +190,17 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme } std::vector args; args.push_back(aug); - parse->EventItem(EVENT_UNAUGMENT_ITEM, user, tobe_auged, nullptr, "", slot, &args); + + if (parse->ItemHasQuestSub(tobe_auged, EVENT_UNAUGMENT_ITEM)) { + parse->EventItem(EVENT_UNAUGMENT_ITEM, user, tobe_auged, nullptr, "", slot, &args); + } args.assign(1, tobe_auged); args.push_back(&is_solvent); - parse->EventItem(EVENT_AUGMENT_REMOVE, user, aug, nullptr, "", slot, &args); + if (parse->ItemHasQuestSub(aug, EVENT_AUGMENT_REMOVE)) { + parse->EventItem(EVENT_AUGMENT_REMOVE, user, aug, nullptr, "", slot, &args); + } } if (is_solvent) {