Implemented LUA counterpart of EVENT_ENVIRONMENTAL_DAMAGE

This commit is contained in:
Akkadius 2015-01-30 23:15:48 -06:00
parent 8229a578ee
commit 39a47ceb93
5 changed files with 20 additions and 1 deletions

View File

@ -10,6 +10,7 @@ Akkadius: Implemented event type "EVENT_ENVIRONMENTAL_DAMAGE"
quest::debug("env_final_damage is " . $env_final_damage);
}
Result: (Test falling in Velks): http://i.imgur.com/tPRL7yL.png
- Implemented LUA counterpart of this same implementation above
== 01/29/2015 ==
Trevius: Added more information to Mercenary Logging.

View File

@ -1612,6 +1612,7 @@ luabind::scope lua_register_events() {
luabind::value("cast_on", static_cast<int>(EVENT_CAST_ON)),
luabind::value("task_accepted", static_cast<int>(EVENT_TASK_ACCEPTED)),
luabind::value("task_stage_complete", static_cast<int>(EVENT_TASK_STAGE_COMPLETE)),
luabind::value("environmental_damage", static_cast<int>(EVENT_ENVIRONMENTAL_DAMAGE)),
luabind::value("task_update", static_cast<int>(EVENT_TASK_UPDATE)),
luabind::value("task_complete", static_cast<int>(EVENT_TASK_COMPLETE)),
luabind::value("task_fail", static_cast<int>(EVENT_TASK_FAIL)),

View File

@ -35,13 +35,14 @@
#include "zone.h"
#include "lua_parser.h"
const char *LuaEvents[_LargestEventID] = {
const char *LuaEvents[_LargestEventID] = {
"event_say",
"event_trade",
"event_death",
"event_spawn",
"event_attack",
"event_combat",
"event_environmental_damage",
"event_aggro",
"event_slay",
"event_npc_slay",
@ -164,6 +165,7 @@ LuaParser::LuaParser() {
NPCArgumentDispatch[EVENT_LEAVE_AREA] = handle_npc_area;
PlayerArgumentDispatch[EVENT_SAY] = handle_player_say;
PlayerArgumentDispatch[EVENT_ENVIRONMENTAL_DAMAGE] = handle_player_environmental_damage;
PlayerArgumentDispatch[EVENT_DEATH] = handle_player_death;
PlayerArgumentDispatch[EVENT_DEATH_COMPLETE] = handle_player_death;
PlayerArgumentDispatch[EVENT_TIMER] = handle_player_timer;

View File

@ -246,6 +246,19 @@ void handle_player_say(QuestInterface *parse, lua_State* L, Client* client, std:
lua_setfield(L, -2, "language");
}
void handle_player_environmental_damage(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
std::vector<EQEmu::Any> *extra_pointers){
Seperator sep(data.c_str());
lua_pushinteger(L, std::stoi(sep.arg[0]));
lua_setfield(L, -2, "env_damage");
lua_pushinteger(L, std::stoi(sep.arg[1]));
lua_setfield(L, -2, "env_damage_type");
lua_pushinteger(L, std::stoi(sep.arg[2]));
lua_setfield(L, -2, "env_final_damage");
}
void handle_player_death(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
std::vector<EQEmu::Any> *extra_pointers) {
Seperator sep(data.c_str());

View File

@ -44,6 +44,8 @@ void handle_npc_null(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, s
//Player
void handle_player_say(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
std::vector<EQEmu::Any> *extra_pointers);
void handle_player_environmental_damage(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
std::vector<EQEmu::Any> *extra_pointers)
void handle_player_death(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
std::vector<EQEmu::Any> *extra_pointers);
void handle_player_timer(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,