mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 07:38:36 +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:
+18
-22
@@ -1111,14 +1111,25 @@ void NPC::UpdateEquipmentLight()
|
||||
m_Light.Level[EQ::lightsource::LightEquipment] = EQ::lightsource::TypeToLevel(m_Light.Type[EQ::lightsource::LightEquipment]);
|
||||
}
|
||||
|
||||
void NPC::Depop(bool StartSpawnTimer) {
|
||||
uint32 emoteid = GetEmoteID();
|
||||
if(emoteid != 0)
|
||||
DoNPCEmote(EQ::constants::EmoteEventTypes::OnDespawn,emoteid);
|
||||
void NPC::Depop(bool start_spawn_timer) {
|
||||
const auto emote_id = GetEmoteID();
|
||||
if (emote_id) {
|
||||
DoNPCEmote(EQ::constants::EmoteEventTypes::OnDespawn, emoteid);
|
||||
}
|
||||
|
||||
if (IsNPC()) {
|
||||
parse->EventNPC(EVENT_DESPAWN, this, nullptr, "", 0);
|
||||
DispatchZoneControllerEvent(EVENT_DESPAWN_ZONE, this, "", 0, nullptr);
|
||||
#ifdef BOTS
|
||||
} else if (IsBot()) {
|
||||
parse->EventBot(EVENT_DESPAWN, CastToBot(), nullptr, "", 0);
|
||||
DispatchZoneControllerEvent(EVENT_DESPAWN_ZONE, this, "", 0, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
p_depop = true;
|
||||
if (respawn2)
|
||||
{
|
||||
if (StartSpawnTimer) {
|
||||
if (respawn2) {
|
||||
if (start_spawn_timer) {
|
||||
respawn2->DeathReset();
|
||||
} else {
|
||||
respawn2->Depop();
|
||||
@@ -3779,18 +3790,3 @@ int NPC::GetRolledItemCount(uint32 item_id)
|
||||
|
||||
return rolled_count;
|
||||
}
|
||||
|
||||
int NPC::DispatchZoneControllerEvent(QuestEventID evt, Mob* init,
|
||||
const std::string& data, uint32 extra, std::vector<std::any>* pointers)
|
||||
{
|
||||
int ret = 0;
|
||||
if (RuleB(Zone, UseZoneController) && GetNPCTypeID() != ZONE_CONTROLLER_NPC_ID)
|
||||
{
|
||||
auto controller = entity_list.GetNPCByNPCTypeID(ZONE_CONTROLLER_NPC_ID);
|
||||
if (controller)
|
||||
{
|
||||
ret = parse->EventNPC(evt, controller, init, data, extra, pointers);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user