mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 02:11:30 +00:00
[Quest API] Export $item and $corpse to EVENT_LOOT and EVENT_LOOT_ZONE in Perl (#2878)
* [Quest API] Export $item and $corpse to EVENT_LOOT and EVENT_LOOT_ZONE in Perl # Notes - Exports `$item` and `$corpse` to `EVENT_LOOT` in Perl. - Exports `$item` and `$corpse` to `EVENT_LOOT_ZONE` in Perl. * Optional parsing. * Update corpse.cpp * Cleanup * Export changes --------- Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
parent
384de31989
commit
5ef8f8c3a8
@ -1420,28 +1420,41 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
|
||||
}
|
||||
}
|
||||
|
||||
std::string export_string = fmt::format(
|
||||
"{} {} {} {}",
|
||||
inst->GetItem()->ID,
|
||||
inst->GetCharges(),
|
||||
EntityList::RemoveNumbers(corpse_name),
|
||||
GetID()
|
||||
);
|
||||
std::vector<std::any> args;
|
||||
args.push_back(inst);
|
||||
args.push_back(this);
|
||||
bool prevent_loot = false;
|
||||
auto prevent_loot = false;
|
||||
|
||||
if (RuleB(Zone, UseZoneController)) {
|
||||
auto controller = entity_list.GetNPCByNPCTypeID(ZONE_CONTROLLER_NPC_ID);
|
||||
if (controller){
|
||||
if (parse->EventNPC(EVENT_LOOT_ZONE, controller, client, export_string, 0, &args) != 0) {
|
||||
prevent_loot = true;
|
||||
if (controller) {
|
||||
if (parse->HasQuestSub(ZONE_CONTROLLER_NPC_ID, EVENT_LOOT_ZONE)) {
|
||||
const auto& export_string = fmt::format(
|
||||
"{} {} {} {}",
|
||||
inst->GetItem()->ID,
|
||||
inst->GetCharges(),
|
||||
EntityList::RemoveNumbers(corpse_name),
|
||||
GetID()
|
||||
);
|
||||
|
||||
std::vector<std::any> args = { inst, this };
|
||||
if (parse->EventNPC(EVENT_LOOT_ZONE, controller, client, export_string, 0, &args) != 0) {
|
||||
prevent_loot = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parse->EventPlayer(EVENT_LOOT, client, export_string, 0, &args) != 0) {
|
||||
prevent_loot = true;
|
||||
if (parse->PlayerHasQuestSub(EVENT_LOOT)) {
|
||||
const auto& export_string = fmt::format(
|
||||
"{} {} {} {}",
|
||||
inst->GetItem()->ID,
|
||||
inst->GetCharges(),
|
||||
EntityList::RemoveNumbers(corpse_name),
|
||||
GetID()
|
||||
);
|
||||
|
||||
std::vector<std::any> args = { inst, this };
|
||||
if (parse->EventPlayer(EVENT_LOOT, client, export_string, 0, &args) != 0) {
|
||||
prevent_loot = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (player_event_logs.IsEventEnabled(PlayerEvent::LOOT_ITEM) && !IsPlayerCorpse()) {
|
||||
@ -1468,9 +1481,19 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
|
||||
}
|
||||
}
|
||||
|
||||
// do we want this to have a fail option too? Sure?
|
||||
if (parse->EventItem(EVENT_LOOT, client, inst, this, export_string, 0) != 0) {
|
||||
prevent_loot = true;
|
||||
if (parse->ItemHasQuestSub(inst, EVENT_LOOT)) {
|
||||
const auto& export_string = fmt::format(
|
||||
"{} {} {} {}",
|
||||
inst->GetItem()->ID,
|
||||
inst->GetCharges(),
|
||||
EntityList::RemoveNumbers(corpse_name),
|
||||
GetID()
|
||||
);
|
||||
|
||||
std::vector<std::any> args = { inst, this };
|
||||
if (parse->EventItem(EVENT_LOOT, client, inst, this, export_string, 0, &args) != 0) {
|
||||
prevent_loot = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (prevent_loot) {
|
||||
|
||||
@ -1614,8 +1614,17 @@ void PerlembParser::ExportEventVariables(
|
||||
Seperator sep(data);
|
||||
ExportVar(package_name.c_str(), "looted_id", sep.arg[0]);
|
||||
ExportVar(package_name.c_str(), "looted_charges", sep.arg[1]);
|
||||
ExportVar(package_name.c_str(), "corpse", sep.arg[2]);
|
||||
ExportVar(package_name.c_str(), "corpse_name", sep.arg[2]);
|
||||
ExportVar(package_name.c_str(), "corpse_id", 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(), "corpse", "Corpse", std::any_cast<Corpse*>(extra_pointers->at(1)));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user