Update to encounter timers so they can actually work from hooked events

This commit is contained in:
Russell Kinasz
2015-06-05 12:23:42 -07:00
parent dbd07106d7
commit 0b17dc73f1
7 changed files with 76 additions and 14 deletions
+6 -3
View File
@@ -34,6 +34,7 @@
#include "questmgr.h"
#include "zone.h"
#include "lua_parser.h"
#include "lua_encounter.h"
const char *LuaEvents[_LargestEventID] = {
"event_say",
@@ -610,10 +611,11 @@ int LuaParser::_EventEncounter(std::string package_name, QuestEventID evt, std::
lua_pushstring(L, encounter_name.c_str());
lua_setfield(L, -2, "name");
auto arg_function = EncounterArgumentDispatch[evt];
arg_function(this, L, data, extra_data, extra_pointers);
Encounter *enc = lua_encounters[encounter_name];
auto arg_function = EncounterArgumentDispatch[evt];
arg_function(this, L, enc, data, extra_data, extra_pointers);
quest_manager.StartQuest(enc, nullptr, nullptr, encounter_name);
if(lua_pcall(L, 1, 1, 0)) {
std::string error = lua_tostring(L, -1);
@@ -977,6 +979,7 @@ void LuaParser::MapFunctions(lua_State *L) {
lua_register_client_version(),
lua_register_appearance(),
lua_register_entity(),
lua_register_encounter(),
lua_register_mob(),
lua_register_special_abilities(),
lua_register_npc(),