mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 07:18:37 +00:00
[Quest API] Add Despawn Events to Perl/Lua. (#2707)
# Perl - Add `$bot->GetBotID()`. - Add `EVENT_DESPAWN`. - Add `EVENT_DESPAWN_ZONE`. # Lua - Add `bot:GetBotID()`. - Add `event_despawn`. - Add `event_despawn_zone`. # Notes - Allows operators to determine when a Bot or an NPC has been despawned via Depop. - Bots call NPC::Depop on ^camp so we just put the code there. - Adds the ability to get a bot's ID using their reference in case you're looping a list and need that value. - Moves `DispatchZoneControllerEvent` from NPC to Mob so it can be used by any type.
This commit is contained in:
+41
-2
@@ -166,6 +166,8 @@ const char *QuestEventSubroutines[_LargestEventID] = {
|
||||
"EVENT_PAYLOAD",
|
||||
"EVENT_LEVEL_DOWN",
|
||||
"EVENT_GM_COMMAND",
|
||||
"EVENT_DESPAWN",
|
||||
"EVENT_DESPAWN_ZONE",
|
||||
#ifdef BOTS
|
||||
"EVENT_SPELL_EFFECT_BOT",
|
||||
"EVENT_SPELL_EFFECT_BUFF_TIC_BOT",
|
||||
@@ -1838,7 +1840,18 @@ void PerlembParser::ExportEventVariables(
|
||||
NPC* killed = std::any_cast<NPC*>(extra_pointers->at(1));
|
||||
if (killed)
|
||||
{
|
||||
ExportVar(package_name.c_str(), "killed_npc_id", killed->GetNPCTypeID());
|
||||
ExportVar(package_name.c_str(), "killed_entity_id", killed->GetID());
|
||||
|
||||
if (killed->IsNPC()) {
|
||||
ExportVar(package_name.c_str(), "killed_bot_id", 0);
|
||||
ExportVar(package_name.c_str(), "killed_npc_id", killed->GetNPCTypeID());
|
||||
#ifdef BOTS
|
||||
} else if (killed->IsBot()) {
|
||||
ExportVar(package_name.c_str(), "killed_bot_id", killed->CastToBot()->GetBotID());
|
||||
ExportVar(package_name.c_str(), "killed_npc_id", 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
ExportVar(package_name.c_str(), "killed_x", killed->GetX());
|
||||
ExportVar(package_name.c_str(), "killed_y", killed->GetY());
|
||||
ExportVar(package_name.c_str(), "killed_z", killed->GetZ());
|
||||
@@ -1859,7 +1872,17 @@ void PerlembParser::ExportEventVariables(
|
||||
|
||||
case EVENT_SPAWN_ZONE: {
|
||||
ExportVar(package_name.c_str(), "spawned_entity_id", mob->GetID());
|
||||
ExportVar(package_name.c_str(), "spawned_npc_id", mob->GetNPCTypeID());
|
||||
|
||||
if (mob->IsNPC()) {
|
||||
ExportVar(package_name.c_str(), "spawned_bot_id", 0);
|
||||
ExportVar(package_name.c_str(), "spawned_npc_id", mob->GetNPCTypeID());
|
||||
#ifdef BOTS
|
||||
} else if (mob->IsBot()) {
|
||||
ExportVar(package_name.c_str(), "spawned_bot_id", mob->CastToBot()->GetBotID());
|
||||
ExportVar(package_name.c_str(), "spawned_npc_id", 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2013,6 +2036,22 @@ void PerlembParser::ExportEventVariables(
|
||||
break;
|
||||
}
|
||||
|
||||
case EVENT_DESPAWN_ZONE: {
|
||||
ExportVar(package_name.c_str(), "despawned_entity_id", mob->GetID());
|
||||
|
||||
if (mob->IsNPC()) {
|
||||
ExportVar(package_name.c_str(), "despawned_bot_id", 0);
|
||||
ExportVar(package_name.c_str(), "despawned_npc_id", mob->GetNPCTypeID());
|
||||
#ifdef BOTS
|
||||
} else if (mob->IsBot()) {
|
||||
ExportVar(package_name.c_str(), "despawned_bot_id", mob->CastToBot()->GetBotID());
|
||||
ExportVar(package_name.c_str(), "despawned_npc_id", 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user