mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
[Quest API] Export $item and $augment to augment events in Perl (#2895)
* [Quest API] Export $item and $augment to augment events in Perl # Notes - Exports `$item` and `$augment` to `EVENT_AUGMENT_INSERT_CLIENT` in Perl. - Exports `$item` and `$augment` to `EVENT_AUGMENT_REMOVE_CLIENT` in Perl. - Allows operators to use item and augment reference instead of just item IDs. * Cleanup
This commit is contained in:
parent
fd0764d4cb
commit
e8f01fb6ac
@ -3138,13 +3138,36 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
|
||||
|
||||
std::vector<std::any> 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(
|
||||
if (parse->ItemHasQuestSub(old_aug, EVENT_AUGMENT_REMOVE)) {
|
||||
parse->EventItem(
|
||||
EVENT_AUGMENT_REMOVE,
|
||||
this,
|
||||
old_aug,
|
||||
nullptr,
|
||||
"",
|
||||
in_augment->augment_index,
|
||||
&args
|
||||
);
|
||||
}
|
||||
|
||||
if (parse->PlayerHasQuestSub(EVENT_AUGMENT_REMOVE_CLIENT)) {
|
||||
const auto& export_string = fmt::format(
|
||||
"{} {} {} {} {}",
|
||||
tobe_auged->GetID(),
|
||||
item_slot,
|
||||
@ -3157,6 +3180,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
|
||||
|
||||
parse->EventPlayer(EVENT_AUGMENT_REMOVE_CLIENT, this, export_string, 0, &args);
|
||||
}
|
||||
}
|
||||
|
||||
tobe_auged->PutAugment(in_augment->augment_index, *new_aug);
|
||||
tobe_auged->UpdateOrnamentationInfo();
|
||||
@ -3165,14 +3189,37 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
|
||||
if (aug) {
|
||||
std::vector<std::any> 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(
|
||||
if (parse->PlayerHasQuestSub(EVENT_AUGMENT_INSERT_CLIENT)) {
|
||||
const auto& export_string = fmt::format(
|
||||
"{} {} {} {}",
|
||||
tobe_auged->GetID(),
|
||||
item_slot,
|
||||
@ -3181,6 +3228,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
|
||||
);
|
||||
|
||||
parse->EventPlayer(EVENT_AUGMENT_INSERT_CLIENT, this, export_string, 0, &args);
|
||||
}
|
||||
} else {
|
||||
Message(
|
||||
Chat::Red,
|
||||
@ -3233,15 +3281,38 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
|
||||
if (aug) {
|
||||
std::vector<std::any> 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(
|
||||
if (parse->PlayerHasQuestSub(EVENT_AUGMENT_REMOVE_CLIENT)) {
|
||||
const auto& export_string = fmt::format(
|
||||
"{} {} {} {} {}",
|
||||
tobe_auged->GetID(),
|
||||
item_slot,
|
||||
@ -3251,6 +3322,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
|
||||
);
|
||||
|
||||
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,15 +3369,38 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
|
||||
if (aug) {
|
||||
std::vector<std::any> 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(
|
||||
if (parse->PlayerHasQuestSub(EVENT_AUGMENT_REMOVE_CLIENT)) {
|
||||
const auto& export_string = fmt::format(
|
||||
"{} {} {} {} {}",
|
||||
tobe_auged->GetID(),
|
||||
item_slot,
|
||||
@ -3315,6 +3410,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
|
||||
);
|
||||
|
||||
parse->EventPlayer(EVENT_AUGMENT_REMOVE_CLIENT, this, export_string, 0, &args);
|
||||
}
|
||||
} else {
|
||||
Message(
|
||||
Chat::Red,
|
||||
|
||||
@ -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<EQ::ItemInstance*>(extra_pointers->at(0)));
|
||||
}
|
||||
|
||||
if (extra_pointers && extra_pointers->size() >= 2) {
|
||||
ExportVar(package_name.c_str(), "augment", "QuestItem", std::any_cast<EQ::ItemInstance*>(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]);
|
||||
|
||||
if (extra_pointers && extra_pointers->size() >= 1) {
|
||||
ExportVar(package_name.c_str(), "item", "QuestItem", std::any_cast<EQ::ItemInstance*>(extra_pointers->at(0)));
|
||||
}
|
||||
|
||||
if (extra_pointers && extra_pointers->size() >= 3) {
|
||||
ExportVar(package_name.c_str(), "augment", "QuestItem", std::any_cast<EQ::ItemInstance*>(extra_pointers->at(2)));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -140,14 +140,21 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
|
||||
if(aug) {
|
||||
std::vector<std::any> args;
|
||||
args.push_back(aug);
|
||||
|
||||
if (parse->ItemHasQuestSub(tobe_auged, EVENT_AUGMENT_ITEM)) {
|
||||
parse->EventItem(EVENT_AUGMENT_ITEM, user, tobe_auged, nullptr, "", slot, &args);
|
||||
}
|
||||
|
||||
args.assign(1, tobe_auged);
|
||||
|
||||
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(
|
||||
if (parse->PlayerHasQuestSub(EVENT_AUGMENT_INSERT_CLIENT)) {
|
||||
const auto& export_string = fmt::format(
|
||||
"{} {} {} {}",
|
||||
tobe_auged->GetID(),
|
||||
-1,
|
||||
@ -157,6 +164,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
|
||||
|
||||
parse->EventPlayer(EVENT_AUGMENT_INSERT_CLIENT, user, export_string, 0, &args);
|
||||
}
|
||||
}
|
||||
|
||||
item_one_to_push = tobe_auged->Clone();
|
||||
delete_items = true;
|
||||
@ -182,13 +190,18 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
|
||||
}
|
||||
std::vector<std::any> args;
|
||||
args.push_back(aug);
|
||||
|
||||
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);
|
||||
|
||||
if (parse->ItemHasQuestSub(aug, EVENT_AUGMENT_REMOVE)) {
|
||||
parse->EventItem(EVENT_AUGMENT_REMOVE, user, aug, nullptr, "", slot, &args);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_solvent) {
|
||||
tobe_auged->DeleteAugment(in_augment->augment_slot);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user