[Quest API] Export $item to Fishing and Forage Events in Perl (#2876)

* [Quest API] Export $item to Fishing and Forage Events in Perl

# Notes
- Exports `$item` to `EVENT_FISH_SUCCESS` in Perl.
- Exports `$item` to `EVENT_FORAGE_SUCCESS` in Perl.

* Add optional parsing to fish/forage events.

* Update forage.cpp

* Fix missing event param

---------

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
Alex King
2023-02-13 00:50:21 -05:00
committed by GitHub
parent 4a1d026215
commit 5b24d38d1e
4 changed files with 27 additions and 12 deletions
+17 -10
View File
@@ -378,10 +378,6 @@ void Client::GoFish()
}
if (inst) {
std::vector<std::any> args;
args.push_back(inst);
parse->EventPlayer(EVENT_FISH_SUCCESS, this, "", inst->GetID(), &args);
if (player_event_logs.IsEventEnabled(PlayerEvent::FISH_SUCCESS)) {
auto e = PlayerEvent::FishSuccessEvent{
.item_id = inst->GetItem()->ID,
@@ -390,6 +386,11 @@ void Client::GoFish()
RecordPlayerEventLog(PlayerEvent::FISH_SUCCESS, e);
}
if (parse->PlayerHasQuestSub(EVENT_FISH_SUCCESS)) {
std::vector<std::any> args = { inst };
parse->EventPlayer(EVENT_FISH_SUCCESS, this, "", inst->GetID(), &args);
}
}
}
}
@@ -408,8 +409,10 @@ void Client::GoFish()
MessageString(Chat::Skills, FISHING_FAILED); //You didn't catch anything.
}
parse->EventPlayer(EVENT_FISH_FAILURE, this, "", 0);
RecordPlayerEventLog(PlayerEvent::FISH_FAILURE, PlayerEvent::EmptyEvent{});
if (parse->PlayerHasQuestSub(EVENT_FISH_FAILURE)) {
parse->EventPlayer(EVENT_FISH_FAILURE, this, "", 0);
}
}
//chance to break fishing pole...
@@ -508,10 +511,6 @@ void Client::ForageItem(bool guarantee) {
}
if (inst) {
std::vector<std::any> args;
args.push_back(inst);
parse->EventPlayer(EVENT_FORAGE_SUCCESS, this, "", inst->GetID(), &args);
if (player_event_logs.IsEventEnabled(PlayerEvent::FORAGE_SUCCESS)) {
auto e = PlayerEvent::ForageSuccessEvent{
.item_id = inst->GetItem()->ID,
@@ -519,6 +518,11 @@ void Client::ForageItem(bool guarantee) {
};
RecordPlayerEventLog(PlayerEvent::FORAGE_SUCCESS, e);
}
if (parse->PlayerHasQuestSub(EVENT_FORAGE_SUCCESS)) {
std::vector<std::any> args = { inst };
parse->EventPlayer(EVENT_FORAGE_SUCCESS, this, "", inst->GetID(), &args);
}
}
}
@@ -529,8 +533,11 @@ void Client::ForageItem(bool guarantee) {
}
} else {
MessageString(Chat::Skills, FORAGE_FAILED);
parse->EventPlayer(EVENT_FORAGE_FAILURE, this, "", 0);
RecordPlayerEventLog(PlayerEvent::FORAGE_FAILURE, PlayerEvent::EmptyEvent{});
if (parse->PlayerHasQuestSub(EVENT_FORAGE_FAILURE)) {
parse->EventPlayer(EVENT_FORAGE_FAILURE, this, "", 0);
}
}
CheckIncreaseSkill(EQ::skills::SkillForage, nullptr, 5);