From f46f7bd52857fb21bcf1a0acc302143b2574cba1 Mon Sep 17 00:00:00 2001 From: KimLS Date: Thu, 27 Jun 2013 15:07:28 -0700 Subject: [PATCH] event_death_complete --- zone/attack.cpp | 14 ++++++++++++++ zone/embparser.cpp | 3 ++- zone/event_codes.h | 1 + zone/lua_general.cpp | 3 ++- zone/lua_parser.cpp | 5 ++++- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index ca5ee2340..2ab8efdf6 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1697,6 +1697,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ GoToDeath(); } + parse->EventPlayer(EVENT_DEATH_COMPLETE, this, buffer, 0); return true; } @@ -2037,6 +2038,16 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski entity_list.MessageClose_StringID(this, false, 100, MT_NonMelee, HIT_NON_MELEE, killerMob->GetCleanName(), GetCleanName(), ConvertArray(damage, val1)); } + } else { + char buffer[32] = { 0 }; + snprintf(buffer, 31, "%d %d %d", damage, spell, static_cast(attack_skill)); + if(parse->EventNPC(EVENT_DEATH, this, nullptr, buffer, 0) != 0) + { + if(GetHP() < 0) { + SetHP(0); + } + return false; + } } if (IsEngaged()) @@ -2371,6 +2382,9 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski entity_list.UpdateFindableNPCState(this, true); + char buffer[32] = { 0 }; + snprintf(buffer, 31, "%d %d %d", damage, spell, static_cast(attack_skill)); + parse->EventNPC(EVENT_DEATH_COMPLETE, this, oos, buffer, 0); return true; } diff --git a/zone/embparser.cpp b/zone/embparser.cpp index 5081406b7..209d8ebcf 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -110,7 +110,8 @@ const char *QuestEventSubroutines[_LargestEventID] = { "EVENT_AUGMENT_REMOVE", "EVENT_ENTER_AREA", "EVENT_LEAVE_AREA", - "EVENT_RESPAWN" + "EVENT_RESPAWN", + "EVENT_DEATH_COMPLETE" }; PerlembParser::PerlembParser() : perl(nullptr), event_queue_in_use_(false) { diff --git a/zone/event_codes.h b/zone/event_codes.h index 2f6794e04..be332ca50 100644 --- a/zone/event_codes.h +++ b/zone/event_codes.h @@ -79,6 +79,7 @@ typedef enum { EVENT_ENTER_AREA, EVENT_LEAVE_AREA, EVENT_RESPAWN, + EVENT_DEATH_COMPLETE, _LargestEventID } QuestEventID; diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 55d155f96..72a5a5e8f 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -1195,7 +1195,8 @@ luabind::scope lua_register_events() { luabind::value("augment_insert", static_cast(EVENT_AUGMENT_INSERT)), luabind::value("augment_remove", static_cast(EVENT_AUGMENT_REMOVE)), luabind::value("enter_area", static_cast(EVENT_ENTER_AREA)), - luabind::value("leave_area", static_cast(EVENT_LEAVE_AREA)) + luabind::value("leave_area", static_cast(EVENT_LEAVE_AREA)), + luabind::value("death_complete", static_cast(EVENT_DEATH_COMPLETE)) ]; } diff --git a/zone/lua_parser.cpp b/zone/lua_parser.cpp index 319028d0c..518e2d4df 100644 --- a/zone/lua_parser.cpp +++ b/zone/lua_parser.cpp @@ -111,7 +111,8 @@ const char *LuaEvents[_LargestEventID] = { "event_augment_remove", "event_enter_area", "event_leave_area", - "event_respawn" + "event_respawn", + "event_death_complete" }; extern Zone *zone; @@ -152,6 +153,7 @@ LuaParser::LuaParser() { NPCArgumentDispatch[EVENT_SIGNAL] = handle_npc_signal; NPCArgumentDispatch[EVENT_TIMER] = handle_npc_timer; NPCArgumentDispatch[EVENT_DEATH] = handle_npc_death; + NPCArgumentDispatch[EVENT_DEATH_COMPLETE] = handle_npc_death; NPCArgumentDispatch[EVENT_CAST] = handle_npc_cast; NPCArgumentDispatch[EVENT_CAST_BEGIN] = handle_npc_cast; NPCArgumentDispatch[EVENT_FEIGN_DEATH] = handle_npc_single_client; @@ -160,6 +162,7 @@ LuaParser::LuaParser() { PlayerArgumentDispatch[EVENT_SAY] = handle_player_say; PlayerArgumentDispatch[EVENT_DEATH] = handle_player_death; + PlayerArgumentDispatch[EVENT_DEATH_COMPLETE] = handle_player_death; PlayerArgumentDispatch[EVENT_TIMER] = handle_player_timer; PlayerArgumentDispatch[EVENT_DISCOVER_ITEM] = handle_player_discover_item; PlayerArgumentDispatch[EVENT_FISH_SUCCESS] = handle_player_fish_forage_success;