[Quest API] Add EVENT_CONSIDER to Perl and Lua. (#1531)

* [Quest API] Add EVENT_CONSIDER to Perl and Lua.
- Exports $entity_id in Perl.
- Exports e.entity_id in Lua.

Allows you to perform events on consider for server operators.

* Missing comma.

* Formatting.

* Add return capability to EVENT_CONSIDER and EVENT_CONSIDER_CORPSE so operators can break out of consider functions.
This commit is contained in:
Kinglykrab
2021-09-13 15:30:17 -04:00
committed by GitHub
parent 9589bf6bf8
commit 6e76f89ca2
7 changed files with 30 additions and 2 deletions
+12 -2
View File
@@ -4854,6 +4854,10 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app)
if (tmob == 0)
return;
if (parse->EventPlayer(EVENT_CONSIDER, this, fmt::format("{}", conin->targetid), 0) == 1) {
return;
}
if (tmob->GetClass() == LDON_TREASURE)
{
Message(Chat::Yellow, "%s", tmob->GetCleanName());
@@ -4977,7 +4981,10 @@ void Client::Handle_OP_ConsiderCorpse(const EQApplicationPacket *app)
Consider_Struct* conin = (Consider_Struct*)app->pBuffer;
Corpse* tcorpse = entity_list.GetCorpseByID(conin->targetid);
if (tcorpse && tcorpse->IsNPCCorpse()) {
parse->EventPlayer(EVENT_CONSIDER_CORPSE, this, fmt::format("{}", conin->targetid), 0);
if (parse->EventPlayer(EVENT_CONSIDER_CORPSE, this, fmt::format("{}", conin->targetid), 0) == 1) {
return;
}
uint32 min; uint32 sec; uint32 ttime;
if ((ttime = tcorpse->GetDecayTime()) != 0) {
sec = (ttime / 1000) % 60; // Total seconds
@@ -4991,7 +4998,10 @@ void Client::Handle_OP_ConsiderCorpse(const EQApplicationPacket *app)
}
}
else if (tcorpse && tcorpse->IsPlayerCorpse()) {
parse->EventPlayer(EVENT_CONSIDER_CORPSE, this, fmt::format("{}", conin->targetid), 0);
if (parse->EventPlayer(EVENT_CONSIDER_CORPSE, this, fmt::format("{}", conin->targetid), 0) == 1) {
return;
}
uint32 day, hour, min, sec, ttime;
if ((ttime = tcorpse->GetDecayTime()) != 0) {
sec = (ttime / 1000) % 60; // Total seconds