mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-27 12:01:29 +00:00
Cleanup before we start gutting luabind
This commit is contained in:
parent
86f1cedf91
commit
d1aef18974
@ -325,6 +325,7 @@ IF(EQEMU_BUILD_LUA)
|
||||
FIND_PACKAGE(Boost REQUIRED)
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${LUA_INCLUDE_DIR}" "${Boost_INCLUDE_DIRS}")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/sol")
|
||||
|
||||
OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON)
|
||||
IF(EQEMU_SANITIZE_LUA_LIBS)
|
||||
|
||||
22014
libs/sol/sol.hpp
Normal file
22014
libs/sol/sol.hpp
Normal file
File diff suppressed because it is too large
Load Diff
366
libs/sol/sol_forward.hpp
Normal file
366
libs/sol/sol_forward.hpp
Normal file
@ -0,0 +1,366 @@
|
||||
// The MIT License (MIT)
|
||||
|
||||
// Copyright (c) 2013-2018 Rapptz, ThePhD and contributors
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
// this software and associated documentation files (the "Software"), to deal in
|
||||
// the Software without restriction, including without limitation the rights to
|
||||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
// the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// This file was generated with a script.
|
||||
// Generated 2018-06-16 11:58:58.882218 UTC
|
||||
// This header was generated with sol v2.20.3 (revision 968989b)
|
||||
// https://github.com/ThePhD/sol2
|
||||
|
||||
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
||||
#define SOL_SINGLE_INCLUDE_FORWARD_HPP
|
||||
|
||||
// beginning of sol/forward.hpp
|
||||
|
||||
// beginning of sol/feature_test.hpp
|
||||
|
||||
#if (defined(__cplusplus) && __cplusplus == 201703L) || (defined(_MSC_VER) && _MSC_VER > 1900 && ((defined(_HAS_CXX17) && _HAS_CXX17 == 1) || (defined(_MSVC_LANG) && (_MSVC_LANG > 201402L))))
|
||||
#ifndef SOL_CXX17_FEATURES
|
||||
#define SOL_CXX17_FEATURES 1
|
||||
#endif // C++17 features macro
|
||||
#endif // C++17 features check
|
||||
|
||||
#if defined(SOL_CXX17_FEATURES) && SOL_CXX17_FEATURES
|
||||
#if defined(__cpp_noexcept_function_type) || ((defined(_MSC_VER) && _MSC_VER > 1911) && (defined(_MSVC_LANG) && ((_MSVC_LANG >= 201403L))))
|
||||
#ifndef SOL_NOEXCEPT_FUNCTION_TYPE
|
||||
#define SOL_NOEXCEPT_FUNCTION_TYPE 1
|
||||
#endif // noexcept is part of a function's type
|
||||
#endif // compiler-specific checks
|
||||
#if defined(__clang__) && defined(__APPLE__)
|
||||
#if defined(__has_include)
|
||||
#if __has_include(<variant>)
|
||||
#define SOL_STD_VARIANT 1
|
||||
#endif // has include nonsense
|
||||
#endif // __has_include
|
||||
#else
|
||||
#define SOL_STD_VARIANT 1
|
||||
#endif // Clang screws up variant
|
||||
#endif // C++17 only
|
||||
|
||||
// beginning of sol/config.hpp
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_DEBUG) && !defined(NDEBUG)
|
||||
|
||||
#ifndef SOL_IN_DEBUG_DETECTED
|
||||
#define SOL_IN_DEBUG_DETECTED 1
|
||||
#endif
|
||||
|
||||
#endif // VC++ Debug macros
|
||||
|
||||
#ifndef _CPPUNWIND
|
||||
#ifndef SOL_NO_EXCEPTIONS
|
||||
#define SOL_NO_EXCEPTIONS 1
|
||||
#endif
|
||||
#endif // Automatic Exceptions
|
||||
|
||||
#ifndef _CPPRTTI
|
||||
#ifndef SOL_NO_RTTI
|
||||
#define SOL_NO_RTTI 1
|
||||
#endif
|
||||
#endif // Automatic RTTI
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
|
||||
#if !defined(NDEBUG) && !defined(__OPTIMIZE__)
|
||||
|
||||
#ifndef SOL_IN_DEBUG_DETECTED
|
||||
#define SOL_IN_DEBUG_DETECTED 1
|
||||
#endif
|
||||
|
||||
#endif // Not Debug && g++ optimizer flag
|
||||
|
||||
#ifndef __EXCEPTIONS
|
||||
#ifndef SOL_NO_EXCEPTIONS
|
||||
#define SOL_NO_EXCEPTIONS 1
|
||||
#endif
|
||||
#endif // No Exceptions
|
||||
|
||||
#ifndef __GXX_RTTI
|
||||
#ifndef SOL_NO_RTII
|
||||
#define SOL_NO_RTTI 1
|
||||
#endif
|
||||
#endif // No RTTI
|
||||
|
||||
#endif // vc++ || clang++/g++
|
||||
|
||||
#if defined(SOL_CHECK_ARGUMENTS) && SOL_CHECK_ARGUMENTS
|
||||
|
||||
// Checks low-level getter function
|
||||
// (and thusly, affects nearly entire framework)
|
||||
#if !defined(SOL_SAFE_GETTER)
|
||||
#define SOL_SAFE_GETTER 1
|
||||
#endif
|
||||
|
||||
// Checks access on usertype functions
|
||||
// local my_obj = my_type.new()
|
||||
// my_obj.my_member_function()
|
||||
// -- bad syntax and crash
|
||||
#if !defined(SOL_SAFE_USERTYPE)
|
||||
#define SOL_SAFE_USERTYPE 1
|
||||
#endif
|
||||
|
||||
// Checks sol::reference derived boundaries
|
||||
// sol::function ref(L, 1);
|
||||
// sol::userdata sref(L, 2);
|
||||
#if !defined(SOL_SAFE_REFERENCES)
|
||||
#define SOL_SAFE_REFERENCES 1
|
||||
#endif
|
||||
|
||||
// Changes all typedefs of sol::function to point to the
|
||||
// protected_function version, instead of unsafe_function
|
||||
#if !defined(SOL_SAFE_FUNCTION)
|
||||
#define SOL_SAFE_FUNCTION 1
|
||||
#endif
|
||||
|
||||
// Checks function parameters and
|
||||
// returns upon call into/from Lua
|
||||
// local a = 1
|
||||
// local b = "woof"
|
||||
// my_c_function(a, b)
|
||||
#if !defined(SOL_SAFE_FUNCTION_CALLS)
|
||||
#define SOL_SAFE_FUNCTION_CALLS 1
|
||||
#endif
|
||||
|
||||
// Checks conversions
|
||||
// int v = lua["bark"];
|
||||
// int v2 = my_sol_function();
|
||||
#if !defined(SOL_SAFE_PROXIES)
|
||||
#define SOL_SAFE_PROXIES 1
|
||||
#endif
|
||||
|
||||
// Check overflowing number conversions
|
||||
// for things like 64 bit integers that don't fit in a typical lua_Number
|
||||
// for Lua 5.1 and 5.2
|
||||
#if !defined(SOL_SAFE_NUMERICS)
|
||||
#define SOL_SAFE_NUMERICS 1
|
||||
#endif
|
||||
|
||||
// Turn off Number Precision Checks
|
||||
// if this is defined, we do not do range
|
||||
// checks on integers / unsigned integers that might
|
||||
// be bigger than what Lua can represent
|
||||
#if !defined(SOL_NO_CHECK_NUMBER_PRECISION)
|
||||
// off by default
|
||||
#define SOL_NO_CHECK_NUMBER_PRECISION 0
|
||||
#endif
|
||||
|
||||
#endif // Turn on Safety for all if top-level macro is defined
|
||||
|
||||
#if defined(SOL_IN_DEBUG_DETECTED) && SOL_IN_DEBUG_DETECTED
|
||||
|
||||
#if !defined(SOL_SAFE_REFERENCES)
|
||||
// Ensure that references are forcefully type-checked upon construction
|
||||
#define SOL_SAFE_REFERENCES 1
|
||||
#endif
|
||||
|
||||
// Safe usertypes checks for errors such as
|
||||
// obj = my_type.new()
|
||||
// obj.f() -- note the '.' instead of ':'
|
||||
// usertypes should be safe no matter what
|
||||
#if !defined(SOL_SAFE_USERTYPE)
|
||||
#define SOL_SAFE_USERTYPE 1
|
||||
#endif
|
||||
|
||||
#if !defined(SOL_SAFE_FUNCTION_CALLS)
|
||||
// Function calls from Lua should be automatically safe in debug mode
|
||||
#define SOL_SAFE_FUNCTION_CALLS 1
|
||||
#endif
|
||||
|
||||
// Print any exceptions / errors that occur
|
||||
// in debug mode to the default error stream / console
|
||||
#if !defined(SOL_PRINT_ERRORS)
|
||||
#define SOL_PRINT_ERRORS 1
|
||||
#endif
|
||||
|
||||
#endif // DEBUG: Turn on all debug safety features for VC++ / g++ / clang++ and similar
|
||||
|
||||
#if !defined(SOL_PRINT_ERRORS)
|
||||
#define SOL_PRINT_ERRORS 0
|
||||
#endif
|
||||
|
||||
#if !defined(SOL_DEFAULT_PASS_ON_ERROR)
|
||||
#define SOL_DEFAULT_PASS_ON_ERROR 0
|
||||
#endif
|
||||
|
||||
#if !defined(SOL_ENABLE_INTEROP)
|
||||
#define SOL_ENABLE_INTEROP 0
|
||||
#endif
|
||||
|
||||
#if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) || defined(__OBJC__) || defined(nil)
|
||||
#if !defined(SOL_NO_NIL)
|
||||
#define SOL_NO_NIL 1
|
||||
#endif
|
||||
#endif // avoiding nil defines / keywords
|
||||
|
||||
#if defined(SOL_USE_BOOST) && SOL_USE_BOOST
|
||||
#ifndef SOL_UNORDERED_MAP_COMPATIBLE_HASH
|
||||
#define SOL_UNORDERED_MAP_COMPATIBLE_HASH 1
|
||||
#endif // SOL_UNORDERED_MAP_COMPATIBLE_HASH
|
||||
#endif
|
||||
|
||||
#ifndef SOL_STACK_STRING_OPTIMIZATION_SIZE
|
||||
#define SOL_STACK_STRING_OPTIMIZATION_SIZE 1024
|
||||
#endif // Optimized conversion routines using a KB or so off the stack
|
||||
|
||||
// end of sol/config.hpp
|
||||
|
||||
// beginning of sol/config_setup.hpp
|
||||
|
||||
// end of sol/config_setup.hpp
|
||||
|
||||
// end of sol/feature_test.hpp
|
||||
|
||||
namespace sol {
|
||||
|
||||
template <bool b>
|
||||
class basic_reference;
|
||||
using reference = basic_reference<false>;
|
||||
using main_reference = basic_reference<true>;
|
||||
class stack_reference;
|
||||
|
||||
struct proxy_base_tag;
|
||||
template <typename Super>
|
||||
struct proxy_base;
|
||||
template <typename Table, typename Key>
|
||||
struct proxy;
|
||||
|
||||
template <typename T>
|
||||
class usertype;
|
||||
template <typename T>
|
||||
class simple_usertype;
|
||||
template <bool, typename T>
|
||||
class basic_table_core;
|
||||
template <bool b>
|
||||
using table_core = basic_table_core<b, reference>;
|
||||
template <bool b>
|
||||
using main_table_core = basic_table_core<b, main_reference>;
|
||||
template <bool b>
|
||||
using stack_table_core = basic_table_core<b, stack_reference>;
|
||||
template <typename T>
|
||||
using basic_table = basic_table_core<false, T>;
|
||||
typedef table_core<false> table;
|
||||
typedef table_core<true> global_table;
|
||||
typedef main_table_core<false> main_table;
|
||||
typedef main_table_core<true> main_global_table;
|
||||
typedef stack_table_core<false> stack_table;
|
||||
typedef stack_table_core<true> stack_global_table;
|
||||
template <typename base_t>
|
||||
struct basic_environment;
|
||||
using environment = basic_environment<reference>;
|
||||
using main_environment = basic_environment<main_reference>;
|
||||
using stack_environment = basic_environment<stack_reference>;
|
||||
template <typename T, bool>
|
||||
class basic_function;
|
||||
template <typename T, bool, typename H>
|
||||
class basic_protected_function;
|
||||
using unsafe_function = basic_function<reference, false>;
|
||||
using safe_function = basic_protected_function<reference, false, reference>;
|
||||
using main_unsafe_function = basic_function<main_reference, false>;
|
||||
using main_safe_function = basic_protected_function<main_reference, false, reference>;
|
||||
using stack_unsafe_function = basic_function<stack_reference, false>;
|
||||
using stack_safe_function = basic_protected_function<stack_reference, false, reference>;
|
||||
using stack_aligned_unsafe_function = basic_function<stack_reference, true>;
|
||||
using stack_aligned_safe_function = basic_protected_function<stack_reference, true, reference>;
|
||||
using protected_function = safe_function;
|
||||
using main_protected_function = main_safe_function;
|
||||
using stack_protected_function = stack_safe_function;
|
||||
using stack_aligned_protected_function = stack_aligned_safe_function;
|
||||
#if defined(SOL_SAFE_FUNCTION) && SOL_SAFE_FUNCTION
|
||||
using function = protected_function;
|
||||
using main_function = main_protected_function;
|
||||
using stack_function = stack_protected_function;
|
||||
#else
|
||||
using function = unsafe_function;
|
||||
using main_function = main_unsafe_function;
|
||||
using stack_function = stack_unsafe_function;
|
||||
#endif
|
||||
using stack_aligned_function = stack_aligned_unsafe_function;
|
||||
using stack_aligned_stack_handler_function = basic_protected_function<stack_reference, true, stack_reference>;
|
||||
|
||||
struct unsafe_function_result;
|
||||
struct protected_function_result;
|
||||
using safe_function_result = protected_function_result;
|
||||
#if defined(SOL_SAFE_FUNCTION) && SOL_SAFE_FUNCTION
|
||||
using function_result = safe_function_result;
|
||||
#else
|
||||
using function_result = unsafe_function_result;
|
||||
#endif
|
||||
|
||||
template <typename base_t>
|
||||
class basic_object;
|
||||
template <typename base_t>
|
||||
class basic_userdata;
|
||||
template <typename base_t>
|
||||
class basic_lightuserdata;
|
||||
template <typename base_t>
|
||||
class basic_coroutine;
|
||||
template <typename base_t>
|
||||
class basic_thread;
|
||||
|
||||
using object = basic_object<reference>;
|
||||
using userdata = basic_userdata<reference>;
|
||||
using lightuserdata = basic_lightuserdata<reference>;
|
||||
using thread = basic_thread<reference>;
|
||||
using coroutine = basic_coroutine<reference>;
|
||||
using main_object = basic_object<main_reference>;
|
||||
using main_userdata = basic_userdata<main_reference>;
|
||||
using main_lightuserdata = basic_lightuserdata<main_reference>;
|
||||
using main_coroutine = basic_coroutine<main_reference>;
|
||||
using stack_object = basic_object<stack_reference>;
|
||||
using stack_userdata = basic_userdata<stack_reference>;
|
||||
using stack_lightuserdata = basic_lightuserdata<stack_reference>;
|
||||
using stack_thread = basic_thread<stack_reference>;
|
||||
using stack_coroutine = basic_coroutine<stack_reference>;
|
||||
|
||||
struct stack_proxy_base;
|
||||
struct stack_proxy;
|
||||
struct variadic_args;
|
||||
struct variadic_results;
|
||||
struct stack_count;
|
||||
struct this_state;
|
||||
struct this_main_state;
|
||||
struct this_environment;
|
||||
|
||||
template <typename T>
|
||||
struct as_table_t;
|
||||
template <typename T>
|
||||
struct as_container_t;
|
||||
template <typename T>
|
||||
struct nested;
|
||||
template <typename T>
|
||||
struct light;
|
||||
template <typename T>
|
||||
struct user;
|
||||
template <typename T>
|
||||
struct as_args_t;
|
||||
template <typename T>
|
||||
struct protect_t;
|
||||
template <typename F, typename... Filters>
|
||||
struct filter_wrapper;
|
||||
|
||||
template <typename T>
|
||||
struct usertype_traits;
|
||||
template <typename T>
|
||||
struct unique_usertype_traits;
|
||||
} // namespace sol
|
||||
|
||||
// end of sol/forward.hpp
|
||||
|
||||
#endif // SOL_SINGLE_INCLUDE_FORWARD_HPP
|
||||
@ -128,6 +128,19 @@ const char *LuaEvents[_LargestEventID] = {
|
||||
|
||||
extern Zone *zone;
|
||||
|
||||
struct LuaParser::Implementation
|
||||
{
|
||||
std::map<std::string, std::string> vars;
|
||||
std::map<std::string, bool> loaded;
|
||||
std::vector<LuaMod> mods;
|
||||
lua_State *state;
|
||||
NPCArgumentHandler NPCArgumentDispatch[_LargestEventID];
|
||||
PlayerArgumentHandler PlayerArgumentDispatch[_LargestEventID];
|
||||
ItemArgumentHandler ItemArgumentDispatch[_LargestEventID];
|
||||
SpellArgumentHandler SpellArgumentDispatch[_LargestEventID];
|
||||
EncounterArgumentHandler EncounterArgumentDispatch[_LargestEventID];
|
||||
};
|
||||
|
||||
struct lua_registered_event {
|
||||
std::string encounter_name;
|
||||
luabind::adl::object lua_reference;
|
||||
@ -139,96 +152,98 @@ std::map<std::string, bool> lua_encounters_loaded;
|
||||
std::map<std::string, Encounter *> lua_encounters;
|
||||
|
||||
LuaParser::LuaParser() {
|
||||
mImpl.reset(new Implementation());
|
||||
|
||||
for(int i = 0; i < _LargestEventID; ++i) {
|
||||
NPCArgumentDispatch[i] = handle_npc_null;
|
||||
PlayerArgumentDispatch[i] = handle_player_null;
|
||||
ItemArgumentDispatch[i] = handle_item_null;
|
||||
SpellArgumentDispatch[i] = handle_spell_null;
|
||||
EncounterArgumentDispatch[i] = handle_encounter_null;
|
||||
mImpl->NPCArgumentDispatch[i] = handle_npc_null;
|
||||
mImpl->PlayerArgumentDispatch[i] = handle_player_null;
|
||||
mImpl->ItemArgumentDispatch[i] = handle_item_null;
|
||||
mImpl->SpellArgumentDispatch[i] = handle_spell_null;
|
||||
mImpl->EncounterArgumentDispatch[i] = handle_encounter_null;
|
||||
}
|
||||
|
||||
NPCArgumentDispatch[EVENT_SAY] = handle_npc_event_say;
|
||||
NPCArgumentDispatch[EVENT_AGGRO_SAY] = handle_npc_event_say;
|
||||
NPCArgumentDispatch[EVENT_PROXIMITY_SAY] = handle_npc_event_say;
|
||||
NPCArgumentDispatch[EVENT_TRADE] = handle_npc_event_trade;
|
||||
NPCArgumentDispatch[EVENT_HP] = handle_npc_event_hp;
|
||||
NPCArgumentDispatch[EVENT_TARGET_CHANGE] = handle_npc_single_mob;
|
||||
NPCArgumentDispatch[EVENT_CAST_ON] = handle_npc_cast;
|
||||
NPCArgumentDispatch[EVENT_KILLED_MERIT] = handle_npc_single_client;
|
||||
NPCArgumentDispatch[EVENT_SLAY] = handle_npc_single_mob;
|
||||
NPCArgumentDispatch[EVENT_ENTER] = handle_npc_single_client;
|
||||
NPCArgumentDispatch[EVENT_EXIT] = handle_npc_single_client;
|
||||
NPCArgumentDispatch[EVENT_TASK_ACCEPTED] = handle_npc_task_accepted;
|
||||
NPCArgumentDispatch[EVENT_POPUP_RESPONSE] = handle_npc_popup;
|
||||
NPCArgumentDispatch[EVENT_WAYPOINT_ARRIVE] = handle_npc_waypoint;
|
||||
NPCArgumentDispatch[EVENT_WAYPOINT_DEPART] = handle_npc_waypoint;
|
||||
NPCArgumentDispatch[EVENT_HATE_LIST] = handle_npc_hate;
|
||||
NPCArgumentDispatch[EVENT_COMBAT] = handle_npc_hate;
|
||||
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;
|
||||
NPCArgumentDispatch[EVENT_ENTER_AREA] = handle_npc_area;
|
||||
NPCArgumentDispatch[EVENT_LEAVE_AREA] = handle_npc_area;
|
||||
mImpl->NPCArgumentDispatch[EVENT_SAY] = handle_npc_event_say;
|
||||
mImpl->NPCArgumentDispatch[EVENT_AGGRO_SAY] = handle_npc_event_say;
|
||||
mImpl->NPCArgumentDispatch[EVENT_PROXIMITY_SAY] = handle_npc_event_say;
|
||||
mImpl->NPCArgumentDispatch[EVENT_TRADE] = handle_npc_event_trade;
|
||||
mImpl->NPCArgumentDispatch[EVENT_HP] = handle_npc_event_hp;
|
||||
mImpl->NPCArgumentDispatch[EVENT_TARGET_CHANGE] = handle_npc_single_mob;
|
||||
mImpl->NPCArgumentDispatch[EVENT_CAST_ON] = handle_npc_cast;
|
||||
mImpl->NPCArgumentDispatch[EVENT_KILLED_MERIT] = handle_npc_single_client;
|
||||
mImpl->NPCArgumentDispatch[EVENT_SLAY] = handle_npc_single_mob;
|
||||
mImpl->NPCArgumentDispatch[EVENT_ENTER] = handle_npc_single_client;
|
||||
mImpl->NPCArgumentDispatch[EVENT_EXIT] = handle_npc_single_client;
|
||||
mImpl->NPCArgumentDispatch[EVENT_TASK_ACCEPTED] = handle_npc_task_accepted;
|
||||
mImpl->NPCArgumentDispatch[EVENT_POPUP_RESPONSE] = handle_npc_popup;
|
||||
mImpl->NPCArgumentDispatch[EVENT_WAYPOINT_ARRIVE] = handle_npc_waypoint;
|
||||
mImpl->NPCArgumentDispatch[EVENT_WAYPOINT_DEPART] = handle_npc_waypoint;
|
||||
mImpl->NPCArgumentDispatch[EVENT_HATE_LIST] = handle_npc_hate;
|
||||
mImpl->NPCArgumentDispatch[EVENT_COMBAT] = handle_npc_hate;
|
||||
mImpl->NPCArgumentDispatch[EVENT_SIGNAL] = handle_npc_signal;
|
||||
mImpl->NPCArgumentDispatch[EVENT_TIMER] = handle_npc_timer;
|
||||
mImpl->NPCArgumentDispatch[EVENT_DEATH] = handle_npc_death;
|
||||
mImpl->NPCArgumentDispatch[EVENT_DEATH_COMPLETE] = handle_npc_death;
|
||||
mImpl->NPCArgumentDispatch[EVENT_CAST] = handle_npc_cast;
|
||||
mImpl->NPCArgumentDispatch[EVENT_CAST_BEGIN] = handle_npc_cast;
|
||||
mImpl->NPCArgumentDispatch[EVENT_FEIGN_DEATH] = handle_npc_single_client;
|
||||
mImpl->NPCArgumentDispatch[EVENT_ENTER_AREA] = handle_npc_area;
|
||||
mImpl->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;
|
||||
PlayerArgumentDispatch[EVENT_DISCOVER_ITEM] = handle_player_discover_item;
|
||||
PlayerArgumentDispatch[EVENT_FISH_SUCCESS] = handle_player_fish_forage_success;
|
||||
PlayerArgumentDispatch[EVENT_FORAGE_SUCCESS] = handle_player_fish_forage_success;
|
||||
PlayerArgumentDispatch[EVENT_CLICK_OBJECT] = handle_player_click_object;
|
||||
PlayerArgumentDispatch[EVENT_CLICK_DOOR] = handle_player_click_door;
|
||||
PlayerArgumentDispatch[EVENT_SIGNAL] = handle_player_signal;
|
||||
PlayerArgumentDispatch[EVENT_POPUP_RESPONSE] = handle_player_popup_response;
|
||||
PlayerArgumentDispatch[EVENT_PLAYER_PICKUP] = handle_player_pick_up;
|
||||
PlayerArgumentDispatch[EVENT_CAST] = handle_player_cast;
|
||||
PlayerArgumentDispatch[EVENT_CAST_BEGIN] = handle_player_cast;
|
||||
PlayerArgumentDispatch[EVENT_TASK_FAIL] = handle_player_task_fail;
|
||||
PlayerArgumentDispatch[EVENT_ZONE] = handle_player_zone;
|
||||
PlayerArgumentDispatch[EVENT_DUEL_WIN] = handle_player_duel_win;
|
||||
PlayerArgumentDispatch[EVENT_DUEL_LOSE] = handle_player_duel_loss;
|
||||
PlayerArgumentDispatch[EVENT_LOOT] = handle_player_loot;
|
||||
PlayerArgumentDispatch[EVENT_TASK_STAGE_COMPLETE] = handle_player_task_stage_complete;
|
||||
PlayerArgumentDispatch[EVENT_TASK_COMPLETE] = handle_player_task_update;
|
||||
PlayerArgumentDispatch[EVENT_TASK_UPDATE] = handle_player_task_update;
|
||||
PlayerArgumentDispatch[EVENT_COMMAND] = handle_player_command;
|
||||
PlayerArgumentDispatch[EVENT_COMBINE_SUCCESS] = handle_player_combine;
|
||||
PlayerArgumentDispatch[EVENT_COMBINE_FAILURE] = handle_player_combine;
|
||||
PlayerArgumentDispatch[EVENT_FEIGN_DEATH] = handle_player_feign;
|
||||
PlayerArgumentDispatch[EVENT_ENTER_AREA] = handle_player_area;
|
||||
PlayerArgumentDispatch[EVENT_LEAVE_AREA] = handle_player_area;
|
||||
PlayerArgumentDispatch[EVENT_RESPAWN] = handle_player_respawn;
|
||||
PlayerArgumentDispatch[EVENT_UNHANDLED_OPCODE] = handle_player_packet;
|
||||
PlayerArgumentDispatch[EVENT_USE_SKILL] = handle_player_use_skill;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_SAY] = handle_player_say;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_ENVIRONMENTAL_DAMAGE] = handle_player_environmental_damage;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_DEATH] = handle_player_death;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_DEATH_COMPLETE] = handle_player_death;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_TIMER] = handle_player_timer;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_DISCOVER_ITEM] = handle_player_discover_item;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_FISH_SUCCESS] = handle_player_fish_forage_success;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_FORAGE_SUCCESS] = handle_player_fish_forage_success;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_CLICK_OBJECT] = handle_player_click_object;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_CLICK_DOOR] = handle_player_click_door;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_SIGNAL] = handle_player_signal;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_POPUP_RESPONSE] = handle_player_popup_response;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_PLAYER_PICKUP] = handle_player_pick_up;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_CAST] = handle_player_cast;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_CAST_BEGIN] = handle_player_cast;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_TASK_FAIL] = handle_player_task_fail;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_ZONE] = handle_player_zone;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_DUEL_WIN] = handle_player_duel_win;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_DUEL_LOSE] = handle_player_duel_loss;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_LOOT] = handle_player_loot;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_TASK_STAGE_COMPLETE] = handle_player_task_stage_complete;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_TASK_COMPLETE] = handle_player_task_update;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_TASK_UPDATE] = handle_player_task_update;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_COMMAND] = handle_player_command;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_COMBINE_SUCCESS] = handle_player_combine;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_COMBINE_FAILURE] = handle_player_combine;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_FEIGN_DEATH] = handle_player_feign;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_ENTER_AREA] = handle_player_area;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_LEAVE_AREA] = handle_player_area;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_RESPAWN] = handle_player_respawn;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_UNHANDLED_OPCODE] = handle_player_packet;
|
||||
mImpl->PlayerArgumentDispatch[EVENT_USE_SKILL] = handle_player_use_skill;
|
||||
|
||||
ItemArgumentDispatch[EVENT_ITEM_CLICK] = handle_item_click;
|
||||
ItemArgumentDispatch[EVENT_ITEM_CLICK_CAST] = handle_item_click;
|
||||
ItemArgumentDispatch[EVENT_TIMER] = handle_item_timer;
|
||||
ItemArgumentDispatch[EVENT_WEAPON_PROC] = handle_item_proc;
|
||||
ItemArgumentDispatch[EVENT_LOOT] = handle_item_loot;
|
||||
ItemArgumentDispatch[EVENT_EQUIP_ITEM] = handle_item_equip;
|
||||
ItemArgumentDispatch[EVENT_UNEQUIP_ITEM] = handle_item_equip;
|
||||
ItemArgumentDispatch[EVENT_AUGMENT_ITEM] = handle_item_augment;
|
||||
ItemArgumentDispatch[EVENT_UNAUGMENT_ITEM] = handle_item_augment;
|
||||
ItemArgumentDispatch[EVENT_AUGMENT_INSERT] = handle_item_augment_insert;
|
||||
ItemArgumentDispatch[EVENT_AUGMENT_REMOVE] = handle_item_augment_remove;
|
||||
mImpl->ItemArgumentDispatch[EVENT_ITEM_CLICK] = handle_item_click;
|
||||
mImpl->ItemArgumentDispatch[EVENT_ITEM_CLICK_CAST] = handle_item_click;
|
||||
mImpl->ItemArgumentDispatch[EVENT_TIMER] = handle_item_timer;
|
||||
mImpl->ItemArgumentDispatch[EVENT_WEAPON_PROC] = handle_item_proc;
|
||||
mImpl->ItemArgumentDispatch[EVENT_LOOT] = handle_item_loot;
|
||||
mImpl->ItemArgumentDispatch[EVENT_EQUIP_ITEM] = handle_item_equip;
|
||||
mImpl->ItemArgumentDispatch[EVENT_UNEQUIP_ITEM] = handle_item_equip;
|
||||
mImpl->ItemArgumentDispatch[EVENT_AUGMENT_ITEM] = handle_item_augment;
|
||||
mImpl->ItemArgumentDispatch[EVENT_UNAUGMENT_ITEM] = handle_item_augment;
|
||||
mImpl->ItemArgumentDispatch[EVENT_AUGMENT_INSERT] = handle_item_augment_insert;
|
||||
mImpl->ItemArgumentDispatch[EVENT_AUGMENT_REMOVE] = handle_item_augment_remove;
|
||||
|
||||
SpellArgumentDispatch[EVENT_SPELL_EFFECT_CLIENT] = handle_spell_effect;
|
||||
SpellArgumentDispatch[EVENT_SPELL_BUFF_TIC_CLIENT] = handle_spell_tic;
|
||||
SpellArgumentDispatch[EVENT_SPELL_FADE] = handle_spell_fade;
|
||||
SpellArgumentDispatch[EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE] = handle_translocate_finish;
|
||||
mImpl->SpellArgumentDispatch[EVENT_SPELL_EFFECT_CLIENT] = handle_spell_effect;
|
||||
mImpl->SpellArgumentDispatch[EVENT_SPELL_BUFF_TIC_CLIENT] = handle_spell_tic;
|
||||
mImpl->SpellArgumentDispatch[EVENT_SPELL_FADE] = handle_spell_fade;
|
||||
mImpl->SpellArgumentDispatch[EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE] = handle_translocate_finish;
|
||||
|
||||
EncounterArgumentDispatch[EVENT_TIMER] = handle_encounter_timer;
|
||||
EncounterArgumentDispatch[EVENT_ENCOUNTER_LOAD] = handle_encounter_load;
|
||||
EncounterArgumentDispatch[EVENT_ENCOUNTER_UNLOAD] = handle_encounter_unload;
|
||||
mImpl->EncounterArgumentDispatch[EVENT_TIMER] = handle_encounter_timer;
|
||||
mImpl->EncounterArgumentDispatch[EVENT_ENCOUNTER_LOAD] = handle_encounter_load;
|
||||
mImpl->EncounterArgumentDispatch[EVENT_ENCOUNTER_UNLOAD] = handle_encounter_unload;
|
||||
|
||||
L = nullptr;
|
||||
mImpl->state = nullptr;
|
||||
}
|
||||
|
||||
LuaParser::~LuaParser() {
|
||||
@ -236,8 +251,8 @@ LuaParser::~LuaParser() {
|
||||
lua_encounters.clear();
|
||||
lua_encounter_events_registered.clear();
|
||||
lua_encounters_loaded.clear();
|
||||
if(L) {
|
||||
lua_close(L);
|
||||
if(mImpl->state) {
|
||||
lua_close(mImpl->state);
|
||||
}
|
||||
}
|
||||
|
||||
@ -282,55 +297,55 @@ int LuaParser::_EventNPC(std::string package_name, QuestEventID evt, NPC* npc, M
|
||||
std::vector<EQEmu::Any> *extra_pointers, luabind::adl::object *l_func) {
|
||||
const char *sub_name = LuaEvents[evt];
|
||||
|
||||
int start = lua_gettop(L);
|
||||
int start = lua_gettop(mImpl->state);
|
||||
|
||||
try {
|
||||
int npop = 1;
|
||||
if(l_func != nullptr) {
|
||||
l_func->push(L);
|
||||
l_func->push(mImpl->state);
|
||||
} else {
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, package_name.c_str());
|
||||
lua_getfield(L, -1, sub_name);
|
||||
lua_getfield(mImpl->state, LUA_REGISTRYINDEX, package_name.c_str());
|
||||
lua_getfield(mImpl->state, -1, sub_name);
|
||||
npop = 2;
|
||||
}
|
||||
|
||||
lua_createtable(L, 0, 0);
|
||||
lua_createtable(mImpl->state, 0, 0);
|
||||
//always push self
|
||||
Lua_NPC l_npc(npc);
|
||||
luabind::adl::object l_npc_o = luabind::adl::object(L, l_npc);
|
||||
l_npc_o.push(L);
|
||||
lua_setfield(L, -2, "self");
|
||||
luabind::adl::object l_npc_o = luabind::adl::object(mImpl->state, l_npc);
|
||||
l_npc_o.push(mImpl->state);
|
||||
lua_setfield(mImpl->state, -2, "self");
|
||||
|
||||
auto arg_function = NPCArgumentDispatch[evt];
|
||||
arg_function(this, L, npc, init, data, extra_data, extra_pointers);
|
||||
auto arg_function = mImpl->NPCArgumentDispatch[evt];
|
||||
arg_function(this, mImpl->state, npc, init, data, extra_data, extra_pointers);
|
||||
Client *c = (init && init->IsClient()) ? init->CastToClient() : nullptr;
|
||||
|
||||
quest_manager.StartQuest(npc, c, nullptr);
|
||||
if(lua_pcall(L, 1, 1, 0)) {
|
||||
std::string error = lua_tostring(L, -1);
|
||||
if(lua_pcall(mImpl->state, 1, 1, 0)) {
|
||||
std::string error = lua_tostring(mImpl->state, -1);
|
||||
AddError(error);
|
||||
quest_manager.EndQuest();
|
||||
return 0;
|
||||
}
|
||||
quest_manager.EndQuest();
|
||||
|
||||
if(lua_isnumber(L, -1)) {
|
||||
int ret = static_cast<int>(lua_tointeger(L, -1));
|
||||
lua_pop(L, npop);
|
||||
if(lua_isnumber(mImpl->state, -1)) {
|
||||
int ret = static_cast<int>(lua_tointeger(mImpl->state, -1));
|
||||
lua_pop(mImpl->state, npop);
|
||||
return ret;
|
||||
}
|
||||
|
||||
lua_pop(L, npop);
|
||||
lua_pop(mImpl->state, npop);
|
||||
} catch(std::exception &ex) {
|
||||
std::string error = "Lua Exception: ";
|
||||
error += std::string(ex.what());
|
||||
AddError(error);
|
||||
|
||||
//Restore our stack to the best of our ability
|
||||
int end = lua_gettop(L);
|
||||
int end = lua_gettop(mImpl->state);
|
||||
int n = end - start;
|
||||
if(n > 0) {
|
||||
lua_pop(L, n);
|
||||
lua_pop(mImpl->state, n);
|
||||
}
|
||||
}
|
||||
|
||||
@ -376,54 +391,54 @@ int LuaParser::EventGlobalPlayer(QuestEventID evt, Client *client, std::string d
|
||||
int LuaParser::_EventPlayer(std::string package_name, QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<EQEmu::Any> *extra_pointers, luabind::adl::object *l_func) {
|
||||
const char *sub_name = LuaEvents[evt];
|
||||
int start = lua_gettop(L);
|
||||
int start = lua_gettop(mImpl->state);
|
||||
|
||||
try {
|
||||
int npop = 1;
|
||||
if(l_func != nullptr) {
|
||||
l_func->push(L);
|
||||
l_func->push(mImpl->state);
|
||||
} else {
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, package_name.c_str());
|
||||
lua_getfield(L, -1, sub_name);
|
||||
lua_getfield(mImpl->state, LUA_REGISTRYINDEX, package_name.c_str());
|
||||
lua_getfield(mImpl->state, -1, sub_name);
|
||||
npop = 2;
|
||||
}
|
||||
|
||||
lua_createtable(L, 0, 0);
|
||||
lua_createtable(mImpl->state, 0, 0);
|
||||
//push self
|
||||
Lua_Client l_client(client);
|
||||
luabind::adl::object l_client_o = luabind::adl::object(L, l_client);
|
||||
l_client_o.push(L);
|
||||
lua_setfield(L, -2, "self");
|
||||
luabind::adl::object l_client_o = luabind::adl::object(mImpl->state, l_client);
|
||||
l_client_o.push(mImpl->state);
|
||||
lua_setfield(mImpl->state, -2, "self");
|
||||
|
||||
auto arg_function = PlayerArgumentDispatch[evt];
|
||||
arg_function(this, L, client, data, extra_data, extra_pointers);
|
||||
auto arg_function = mImpl->PlayerArgumentDispatch[evt];
|
||||
arg_function(this, mImpl->state, client, data, extra_data, extra_pointers);
|
||||
|
||||
quest_manager.StartQuest(client, client, nullptr);
|
||||
if(lua_pcall(L, 1, 1, 0)) {
|
||||
std::string error = lua_tostring(L, -1);
|
||||
if(lua_pcall(mImpl->state, 1, 1, 0)) {
|
||||
std::string error = lua_tostring(mImpl->state, -1);
|
||||
AddError(error);
|
||||
quest_manager.EndQuest();
|
||||
return 0;
|
||||
}
|
||||
quest_manager.EndQuest();
|
||||
|
||||
if(lua_isnumber(L, -1)) {
|
||||
int ret = static_cast<int>(lua_tointeger(L, -1));
|
||||
lua_pop(L, npop);
|
||||
if(lua_isnumber(mImpl->state, -1)) {
|
||||
int ret = static_cast<int>(lua_tointeger(mImpl->state, -1));
|
||||
lua_pop(mImpl->state, npop);
|
||||
return ret;
|
||||
}
|
||||
|
||||
lua_pop(L, npop);
|
||||
lua_pop(mImpl->state, npop);
|
||||
} catch(std::exception &ex) {
|
||||
std::string error = "Lua Exception: ";
|
||||
error += std::string(ex.what());
|
||||
AddError(error);
|
||||
|
||||
//Restore our stack to the best of our ability
|
||||
int end = lua_gettop(L);
|
||||
int end = lua_gettop(mImpl->state);
|
||||
int n = end - start;
|
||||
if(n > 0) {
|
||||
lua_pop(L, n);
|
||||
lua_pop(mImpl->state, n);
|
||||
}
|
||||
}
|
||||
|
||||
@ -454,59 +469,59 @@ int LuaParser::_EventItem(std::string package_name, QuestEventID evt, Client *cl
|
||||
std::string data, uint32 extra_data, std::vector<EQEmu::Any> *extra_pointers, luabind::adl::object *l_func) {
|
||||
const char *sub_name = LuaEvents[evt];
|
||||
|
||||
int start = lua_gettop(L);
|
||||
int start = lua_gettop(mImpl->state);
|
||||
|
||||
try {
|
||||
int npop = 1;
|
||||
if(l_func != nullptr) {
|
||||
l_func->push(L);
|
||||
l_func->push(mImpl->state);
|
||||
} else {
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, package_name.c_str());
|
||||
lua_getfield(L, -1, sub_name);
|
||||
lua_getfield(mImpl->state, LUA_REGISTRYINDEX, package_name.c_str());
|
||||
lua_getfield(mImpl->state, -1, sub_name);
|
||||
}
|
||||
|
||||
lua_createtable(L, 0, 0);
|
||||
lua_createtable(mImpl->state, 0, 0);
|
||||
//always push self
|
||||
Lua_ItemInst l_item(item);
|
||||
luabind::adl::object l_item_o = luabind::adl::object(L, l_item);
|
||||
l_item_o.push(L);
|
||||
lua_setfield(L, -2, "self");
|
||||
luabind::adl::object l_item_o = luabind::adl::object(mImpl->state, l_item);
|
||||
l_item_o.push(mImpl->state);
|
||||
lua_setfield(mImpl->state, -2, "self");
|
||||
|
||||
Lua_Client l_client(client);
|
||||
luabind::adl::object l_client_o = luabind::adl::object(L, l_client);
|
||||
l_client_o.push(L);
|
||||
lua_setfield(L, -2, "owner");
|
||||
luabind::adl::object l_client_o = luabind::adl::object(mImpl->state, l_client);
|
||||
l_client_o.push(mImpl->state);
|
||||
lua_setfield(mImpl->state, -2, "owner");
|
||||
|
||||
//redo this arg function
|
||||
auto arg_function = ItemArgumentDispatch[evt];
|
||||
arg_function(this, L, client, item, mob, data, extra_data, extra_pointers);
|
||||
auto arg_function = mImpl->ItemArgumentDispatch[evt];
|
||||
arg_function(this, mImpl->state, client, item, mob, data, extra_data, extra_pointers);
|
||||
|
||||
quest_manager.StartQuest(client, client, item);
|
||||
if(lua_pcall(L, 1, 1, 0)) {
|
||||
std::string error = lua_tostring(L, -1);
|
||||
if(lua_pcall(mImpl->state, 1, 1, 0)) {
|
||||
std::string error = lua_tostring(mImpl->state, -1);
|
||||
AddError(error);
|
||||
quest_manager.EndQuest();
|
||||
return 0;
|
||||
}
|
||||
quest_manager.EndQuest();
|
||||
|
||||
if(lua_isnumber(L, -1)) {
|
||||
int ret = static_cast<int>(lua_tointeger(L, -1));
|
||||
lua_pop(L, npop);
|
||||
if(lua_isnumber(mImpl->state, -1)) {
|
||||
int ret = static_cast<int>(lua_tointeger(mImpl->state, -1));
|
||||
lua_pop(mImpl->state, npop);
|
||||
return ret;
|
||||
}
|
||||
|
||||
lua_pop(L, npop);
|
||||
lua_pop(mImpl->state, npop);
|
||||
} catch(std::exception &ex) {
|
||||
std::string error = "Lua Exception: ";
|
||||
error += std::string(ex.what());
|
||||
AddError(error);
|
||||
|
||||
//Restore our stack to the best of our ability
|
||||
int end = lua_gettop(L);
|
||||
int end = lua_gettop(mImpl->state);
|
||||
int n = end - start;
|
||||
if(n > 0) {
|
||||
lua_pop(L, n);
|
||||
lua_pop(mImpl->state, n);
|
||||
}
|
||||
}
|
||||
|
||||
@ -533,61 +548,61 @@ int LuaParser::_EventSpell(std::string package_name, QuestEventID evt, NPC* npc,
|
||||
std::vector<EQEmu::Any> *extra_pointers, luabind::adl::object *l_func) {
|
||||
const char *sub_name = LuaEvents[evt];
|
||||
|
||||
int start = lua_gettop(L);
|
||||
int start = lua_gettop(mImpl->state);
|
||||
|
||||
try {
|
||||
int npop = 1;
|
||||
if(l_func != nullptr) {
|
||||
l_func->push(L);
|
||||
l_func->push(mImpl->state);
|
||||
} else {
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, package_name.c_str());
|
||||
lua_getfield(L, -1, sub_name);
|
||||
lua_getfield(mImpl->state, LUA_REGISTRYINDEX, package_name.c_str());
|
||||
lua_getfield(mImpl->state, -1, sub_name);
|
||||
npop = 2;
|
||||
}
|
||||
|
||||
lua_createtable(L, 0, 0);
|
||||
lua_createtable(mImpl->state, 0, 0);
|
||||
|
||||
//always push self even if invalid
|
||||
if(IsValidSpell(spell_id)) {
|
||||
Lua_Spell l_spell(&spells[spell_id]);
|
||||
luabind::adl::object l_spell_o = luabind::adl::object(L, l_spell);
|
||||
l_spell_o.push(L);
|
||||
luabind::adl::object l_spell_o = luabind::adl::object(mImpl->state, l_spell);
|
||||
l_spell_o.push(mImpl->state);
|
||||
} else {
|
||||
Lua_Spell l_spell(nullptr);
|
||||
luabind::adl::object l_spell_o = luabind::adl::object(L, l_spell);
|
||||
l_spell_o.push(L);
|
||||
luabind::adl::object l_spell_o = luabind::adl::object(mImpl->state, l_spell);
|
||||
l_spell_o.push(mImpl->state);
|
||||
}
|
||||
lua_setfield(L, -2, "self");
|
||||
lua_setfield(mImpl->state, -2, "self");
|
||||
|
||||
auto arg_function = SpellArgumentDispatch[evt];
|
||||
arg_function(this, L, npc, client, spell_id, extra_data, extra_pointers);
|
||||
auto arg_function = mImpl->SpellArgumentDispatch[evt];
|
||||
arg_function(this, mImpl->state, npc, client, spell_id, extra_data, extra_pointers);
|
||||
|
||||
quest_manager.StartQuest(npc, client, nullptr);
|
||||
if(lua_pcall(L, 1, 1, 0)) {
|
||||
std::string error = lua_tostring(L, -1);
|
||||
if(lua_pcall(mImpl->state, 1, 1, 0)) {
|
||||
std::string error = lua_tostring(mImpl->state, -1);
|
||||
AddError(error);
|
||||
quest_manager.EndQuest();
|
||||
return 0;
|
||||
}
|
||||
quest_manager.EndQuest();
|
||||
|
||||
if(lua_isnumber(L, -1)) {
|
||||
int ret = static_cast<int>(lua_tointeger(L, -1));
|
||||
lua_pop(L, npop);
|
||||
if(lua_isnumber(mImpl->state, -1)) {
|
||||
int ret = static_cast<int>(lua_tointeger(mImpl->state, -1));
|
||||
lua_pop(mImpl->state, npop);
|
||||
return ret;
|
||||
}
|
||||
|
||||
lua_pop(L, npop);
|
||||
lua_pop(mImpl->state, npop);
|
||||
} catch(std::exception &ex) {
|
||||
std::string error = "Lua Exception: ";
|
||||
error += std::string(ex.what());
|
||||
AddError(error);
|
||||
|
||||
//Restore our stack to the best of our ability
|
||||
int end = lua_gettop(L);
|
||||
int end = lua_gettop(mImpl->state);
|
||||
int n = end - start;
|
||||
if(n > 0) {
|
||||
lua_pop(L, n);
|
||||
lua_pop(mImpl->state, n);
|
||||
}
|
||||
}
|
||||
|
||||
@ -613,47 +628,47 @@ int LuaParser::_EventEncounter(std::string package_name, QuestEventID evt, std::
|
||||
std::vector<EQEmu::Any> *extra_pointers) {
|
||||
const char *sub_name = LuaEvents[evt];
|
||||
|
||||
int start = lua_gettop(L);
|
||||
int start = lua_gettop(mImpl->state);
|
||||
|
||||
try {
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, package_name.c_str());
|
||||
lua_getfield(L, -1, sub_name);
|
||||
lua_getfield(mImpl->state, LUA_REGISTRYINDEX, package_name.c_str());
|
||||
lua_getfield(mImpl->state, -1, sub_name);
|
||||
|
||||
lua_createtable(L, 0, 0);
|
||||
lua_pushstring(L, encounter_name.c_str());
|
||||
lua_setfield(L, -2, "name");
|
||||
lua_createtable(mImpl->state, 0, 0);
|
||||
lua_pushstring(mImpl->state, encounter_name.c_str());
|
||||
lua_setfield(mImpl->state, -2, "name");
|
||||
|
||||
Encounter *enc = lua_encounters[encounter_name];
|
||||
|
||||
auto arg_function = EncounterArgumentDispatch[evt];
|
||||
arg_function(this, L, enc, data, extra_data, extra_pointers);
|
||||
auto arg_function = mImpl->EncounterArgumentDispatch[evt];
|
||||
arg_function(this, mImpl->state, 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);
|
||||
if(lua_pcall(mImpl->state, 1, 1, 0)) {
|
||||
std::string error = lua_tostring(mImpl->state, -1);
|
||||
AddError(error);
|
||||
quest_manager.EndQuest();
|
||||
return 0;
|
||||
}
|
||||
quest_manager.EndQuest();
|
||||
|
||||
if(lua_isnumber(L, -1)) {
|
||||
int ret = static_cast<int>(lua_tointeger(L, -1));
|
||||
lua_pop(L, 2);
|
||||
if(lua_isnumber(mImpl->state, -1)) {
|
||||
int ret = static_cast<int>(lua_tointeger(mImpl->state, -1));
|
||||
lua_pop(mImpl->state, 2);
|
||||
return ret;
|
||||
}
|
||||
|
||||
lua_pop(L, 2);
|
||||
lua_pop(mImpl->state, 2);
|
||||
} catch(std::exception &ex) {
|
||||
std::string error = "Lua Exception: ";
|
||||
error += std::string(ex.what());
|
||||
AddError(error);
|
||||
|
||||
//Restore our stack to the best of our ability
|
||||
int end = lua_gettop(L);
|
||||
int end = lua_gettop(mImpl->state);
|
||||
int n = end - start;
|
||||
if(n > 0) {
|
||||
lua_pop(L, n);
|
||||
lua_pop(mImpl->state, n);
|
||||
}
|
||||
}
|
||||
|
||||
@ -782,12 +797,12 @@ void LuaParser::LoadEncounterScript(std::string filename, std::string encounter_
|
||||
}
|
||||
|
||||
void LuaParser::AddVar(std::string name, std::string val) {
|
||||
vars_[name] = val;
|
||||
mImpl->vars[name] = val;
|
||||
}
|
||||
|
||||
std::string LuaParser::GetVar(std::string name) {
|
||||
auto iter = vars_.find(name);
|
||||
if(iter != vars_.end()) {
|
||||
auto iter = mImpl->vars.find(name);
|
||||
if(iter != mImpl->vars.end()) {
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
@ -799,9 +814,9 @@ void LuaParser::Init() {
|
||||
}
|
||||
|
||||
void LuaParser::ReloadQuests() {
|
||||
loaded_.clear();
|
||||
mImpl->loaded.clear();
|
||||
errors_.clear();
|
||||
mods_.clear();
|
||||
mImpl->mods.clear();
|
||||
lua_encounter_events_registered.clear();
|
||||
lua_encounters_loaded.clear();
|
||||
|
||||
@ -814,53 +829,53 @@ void LuaParser::ReloadQuests() {
|
||||
// And there is situations where it wouldn't be :P
|
||||
entity_list.EncounterProcess();
|
||||
|
||||
if(L) {
|
||||
lua_close(L);
|
||||
if(mImpl->state) {
|
||||
lua_close(mImpl->state);
|
||||
}
|
||||
|
||||
L = luaL_newstate();
|
||||
luaL_openlibs(L);
|
||||
mImpl->state = luaL_newstate();
|
||||
luaL_openlibs(mImpl->state);
|
||||
|
||||
auto top = lua_gettop(L);
|
||||
auto top = lua_gettop(mImpl->state);
|
||||
|
||||
if(luaopen_bit(L) != 1) {
|
||||
std::string error = lua_tostring(L, -1);
|
||||
if(luaopen_bit(mImpl->state) != 1) {
|
||||
std::string error = lua_tostring(mImpl->state, -1);
|
||||
AddError(error);
|
||||
}
|
||||
|
||||
if(luaL_dostring(L, "math.randomseed(os.time())")) {
|
||||
std::string error = lua_tostring(L, -1);
|
||||
if(luaL_dostring(mImpl->state, "math.randomseed(os.time())")) {
|
||||
std::string error = lua_tostring(mImpl->state, -1);
|
||||
AddError(error);
|
||||
}
|
||||
|
||||
#ifdef SANITIZE_LUA_LIBS
|
||||
//io
|
||||
lua_pushnil(L);
|
||||
//lua_setglobal(L, "io");
|
||||
lua_pushnil(mImpl->state);
|
||||
//lua_setglobal(mImpl->state, "io");
|
||||
|
||||
//some os/debug are okay some are not
|
||||
lua_getglobal(L, "os");
|
||||
lua_pushnil(L);
|
||||
lua_setfield(L, -2, "exit");
|
||||
lua_pushnil(L);
|
||||
lua_setfield(L, -2, "execute");
|
||||
lua_pushnil(L);
|
||||
lua_setfield(L, -2, "getenv");
|
||||
lua_pushnil(L);
|
||||
lua_setfield(L, -2, "remove");
|
||||
lua_pushnil(L);
|
||||
lua_setfield(L, -2, "rename");
|
||||
lua_pushnil(L);
|
||||
lua_setfield(L, -2, "setlocale");
|
||||
lua_pushnil(L);
|
||||
lua_setfield(L, -2, "tmpname");
|
||||
lua_pop(L, 1);
|
||||
lua_getglobal(mImpl->state, "os");
|
||||
lua_pushnil(mImpl->state);
|
||||
lua_setfield(mImpl->state, -2, "exit");
|
||||
lua_pushnil(mImpl->state);
|
||||
lua_setfield(mImpl->state, -2, "execute");
|
||||
lua_pushnil(mImpl->state);
|
||||
lua_setfield(mImpl->state, -2, "getenv");
|
||||
lua_pushnil(mImpl->state);
|
||||
lua_setfield(mImpl->state, -2, "remove");
|
||||
lua_pushnil(mImpl->state);
|
||||
lua_setfield(mImpl->state, -2, "rename");
|
||||
lua_pushnil(mImpl->state);
|
||||
lua_setfield(mImpl->state, -2, "setlocale");
|
||||
lua_pushnil(mImpl->state);
|
||||
lua_setfield(mImpl->state, -2, "tmpname");
|
||||
lua_pop(mImpl->state, 1);
|
||||
|
||||
lua_pushnil(L);
|
||||
lua_setglobal(L, "collectgarbage");
|
||||
lua_pushnil(mImpl->state);
|
||||
lua_setglobal(mImpl->state, "collectgarbage");
|
||||
|
||||
lua_pushnil(L);
|
||||
lua_setglobal(L, "loadfile");
|
||||
lua_pushnil(mImpl->state);
|
||||
lua_setglobal(mImpl->state, "loadfile");
|
||||
|
||||
#endif
|
||||
|
||||
@ -880,32 +895,32 @@ void LuaParser::ReloadQuests() {
|
||||
const char libext[] = ".so";
|
||||
#endif
|
||||
|
||||
lua_getglobal(L, "package");
|
||||
lua_getfield(L, -1, "path");
|
||||
std::string module_path = lua_tostring(L,-1);
|
||||
lua_getglobal(mImpl->state, "package");
|
||||
lua_getfield(mImpl->state, -1, "path");
|
||||
std::string module_path = lua_tostring(mImpl->state,-1);
|
||||
module_path += ";./" + Config->LuaModuleDir + "?.lua;./" + Config->LuaModuleDir + "?/init.lua";
|
||||
// luarock paths using lua_modules as tree
|
||||
// to path it adds foo/share/lua/5.1/?.lua and foo/share/lua/5.1/?/init.lua
|
||||
module_path += ";./" + Config->LuaModuleDir + "share/lua/" + lua_version + "/?.lua";
|
||||
module_path += ";./" + Config->LuaModuleDir + "share/lua/" + lua_version + "/?/init.lua";
|
||||
lua_pop(L, 1);
|
||||
lua_pushstring(L, module_path.c_str());
|
||||
lua_setfield(L, -2, "path");
|
||||
lua_pop(L, 1);
|
||||
lua_pop(mImpl->state, 1);
|
||||
lua_pushstring(mImpl->state, module_path.c_str());
|
||||
lua_setfield(mImpl->state, -2, "path");
|
||||
lua_pop(mImpl->state, 1);
|
||||
|
||||
lua_getglobal(L, "package");
|
||||
lua_getfield(L, -1, "cpath");
|
||||
module_path = lua_tostring(L, -1);
|
||||
lua_getglobal(mImpl->state, "package");
|
||||
lua_getfield(mImpl->state, -1, "cpath");
|
||||
module_path = lua_tostring(mImpl->state, -1);
|
||||
module_path += ";./" + Config->LuaModuleDir + "?" + libext;
|
||||
// luarock paths using lua_modules as tree
|
||||
// luarocks adds foo/lib/lua/5.1/?.so for cpath
|
||||
module_path += ";./" + Config->LuaModuleDir + "lib/lua/" + lua_version + "/?" + libext;
|
||||
lua_pop(L, 1);
|
||||
lua_pushstring(L, module_path.c_str());
|
||||
lua_setfield(L, -2, "cpath");
|
||||
lua_pop(L, 1);
|
||||
lua_pop(mImpl->state, 1);
|
||||
lua_pushstring(mImpl->state, module_path.c_str());
|
||||
lua_setfield(mImpl->state, -2, "cpath");
|
||||
lua_pop(mImpl->state, 1);
|
||||
|
||||
MapFunctions(L);
|
||||
MapFunctions(mImpl->state);
|
||||
|
||||
//load init
|
||||
std::string path = Config->QuestDir;
|
||||
@ -917,8 +932,8 @@ void LuaParser::ReloadQuests() {
|
||||
if(f) {
|
||||
fclose(f);
|
||||
|
||||
if(luaL_dofile(L, path.c_str())) {
|
||||
std::string error = lua_tostring(L, -1);
|
||||
if(luaL_dofile(mImpl->state, path.c_str())) {
|
||||
std::string error = lua_tostring(mImpl->state, -1);
|
||||
AddError(error);
|
||||
}
|
||||
}
|
||||
@ -935,8 +950,8 @@ void LuaParser::ReloadQuests() {
|
||||
if(f) {
|
||||
fclose(f);
|
||||
|
||||
if(luaL_dofile(L, zone_script.c_str())) {
|
||||
std::string error = lua_tostring(L, -1);
|
||||
if(luaL_dofile(mImpl->state, zone_script.c_str())) {
|
||||
std::string error = lua_tostring(mImpl->state, -1);
|
||||
AddError(error);
|
||||
}
|
||||
}
|
||||
@ -949,8 +964,8 @@ void LuaParser::ReloadQuests() {
|
||||
if (f) {
|
||||
fclose(f);
|
||||
|
||||
if (luaL_dofile(L, zone_script.c_str())) {
|
||||
std::string error = lua_tostring(L, -1);
|
||||
if (luaL_dofile(mImpl->state, zone_script.c_str())) {
|
||||
std::string error = lua_tostring(mImpl->state, -1);
|
||||
AddError(error);
|
||||
}
|
||||
}
|
||||
@ -970,30 +985,30 @@ void LuaParser::ReloadQuests() {
|
||||
}
|
||||
|
||||
LoadScript("mods/" + std::string(file_name), file_name);
|
||||
mods_.push_back(LuaMod(L, this, file_name));
|
||||
mImpl->mods.push_back(LuaMod(mImpl->state, this, file_name));
|
||||
}
|
||||
|
||||
fclose(load_order);
|
||||
}
|
||||
|
||||
auto end = lua_gettop(L);
|
||||
auto end = lua_gettop(mImpl->state);
|
||||
int n = end - top;
|
||||
if (n > 0) {
|
||||
lua_pop(L, n);
|
||||
lua_pop(mImpl->state, n);
|
||||
}
|
||||
}
|
||||
|
||||
void LuaParser::LoadScript(std::string filename, std::string package_name) {
|
||||
auto iter = loaded_.find(package_name);
|
||||
if(iter != loaded_.end()) {
|
||||
auto iter = mImpl->loaded.find(package_name);
|
||||
if(iter != mImpl->loaded.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto top = lua_gettop(L);
|
||||
if(luaL_loadfile(L, filename.c_str())) {
|
||||
std::string error = lua_tostring(L, -1);
|
||||
auto top = lua_gettop(mImpl->state);
|
||||
if(luaL_loadfile(mImpl->state, filename.c_str())) {
|
||||
std::string error = lua_tostring(mImpl->state, -1);
|
||||
AddError(error);
|
||||
lua_pop(L, 1);
|
||||
lua_pop(mImpl->state, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1001,51 +1016,51 @@ void LuaParser::LoadScript(std::string filename, std::string package_name) {
|
||||
//And makes it so we can see the global table _G from it
|
||||
//Then sets it so this script is called from that table as an env
|
||||
|
||||
lua_createtable(L, 0, 0); // anon table
|
||||
lua_getglobal(L, "_G"); // get _G
|
||||
lua_setfield(L, -2, "__index"); //anon table.__index = _G
|
||||
lua_createtable(mImpl->state, 0, 0); // anon table
|
||||
lua_getglobal(mImpl->state, "_G"); // get _G
|
||||
lua_setfield(mImpl->state, -2, "__index"); //anon table.__index = _G
|
||||
|
||||
lua_pushvalue(L, -1); //copy table to top of stack
|
||||
lua_setmetatable(L, -2); //setmetatable(anon_table, copied table)
|
||||
lua_pushvalue(mImpl->state, -1); //copy table to top of stack
|
||||
lua_setmetatable(mImpl->state, -2); //setmetatable(anon_table, copied table)
|
||||
|
||||
lua_pushvalue(L, -1); //put the table we made into the registry
|
||||
lua_setfield(L, LUA_REGISTRYINDEX, package_name.c_str());
|
||||
lua_pushvalue(mImpl->state, -1); //put the table we made into the registry
|
||||
lua_setfield(mImpl->state, LUA_REGISTRYINDEX, package_name.c_str());
|
||||
|
||||
lua_setfenv(L, -2); //set the env to the table we made
|
||||
lua_setfenv(mImpl->state, -2); //set the env to the table we made
|
||||
|
||||
if(lua_pcall(L, 0, 0, 0)) {
|
||||
std::string error = lua_tostring(L, -1);
|
||||
if(lua_pcall(mImpl->state, 0, 0, 0)) {
|
||||
std::string error = lua_tostring(mImpl->state, -1);
|
||||
AddError(error);
|
||||
lua_pop(L, 1);
|
||||
lua_pop(mImpl->state, 1);
|
||||
}
|
||||
else {
|
||||
loaded_[package_name] = true;
|
||||
mImpl->loaded[package_name] = true;
|
||||
}
|
||||
|
||||
auto end = lua_gettop(L);
|
||||
auto end = lua_gettop(mImpl->state);
|
||||
int n = end - top;
|
||||
if (n > 0) {
|
||||
lua_pop(L, n);
|
||||
lua_pop(mImpl->state, n);
|
||||
}
|
||||
}
|
||||
|
||||
bool LuaParser::HasFunction(std::string subname, std::string package_name) {
|
||||
//std::transform(subname.begin(), subname.end(), subname.begin(), ::tolower);
|
||||
|
||||
auto iter = loaded_.find(package_name);
|
||||
if(iter == loaded_.end()) {
|
||||
auto iter = mImpl->loaded.find(package_name);
|
||||
if(iter == mImpl->loaded.end()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, package_name.c_str());
|
||||
lua_getfield(L, -1, subname.c_str());
|
||||
lua_getfield(mImpl->state, LUA_REGISTRYINDEX, package_name.c_str());
|
||||
lua_getfield(mImpl->state, -1, subname.c_str());
|
||||
|
||||
if(lua_isfunction(L, -1)) {
|
||||
lua_pop(L, 2);
|
||||
if(lua_isfunction(mImpl->state, -1)) {
|
||||
lua_pop(mImpl->state, 2);
|
||||
return true;
|
||||
}
|
||||
|
||||
lua_pop(L, 2);
|
||||
lua_pop(mImpl->state, 2);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1302,14 +1317,14 @@ QuestEventID LuaParser::ConvertLuaEvent(QuestEventID evt) {
|
||||
|
||||
void LuaParser::MeleeMitigation(Mob *self, Mob *attacker, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault)
|
||||
{
|
||||
for (auto &mod : mods_) {
|
||||
for (auto &mod : mImpl->mods) {
|
||||
mod.MeleeMitigation(self, attacker, hit, opts, ignoreDefault);
|
||||
}
|
||||
}
|
||||
|
||||
void LuaParser::ApplyDamageTable(Mob *self, DamageHitInfo &hit, bool &ignoreDefault)
|
||||
{
|
||||
for (auto &mod : mods_) {
|
||||
for (auto &mod : mImpl->mods) {
|
||||
mod.ApplyDamageTable(self, hit, ignoreDefault);
|
||||
}
|
||||
}
|
||||
@ -1317,7 +1332,7 @@ void LuaParser::ApplyDamageTable(Mob *self, DamageHitInfo &hit, bool &ignoreDefa
|
||||
bool LuaParser::AvoidDamage(Mob *self, Mob *other, DamageHitInfo &hit, bool & ignoreDefault)
|
||||
{
|
||||
bool retval = false;
|
||||
for (auto &mod : mods_) {
|
||||
for (auto &mod : mImpl->mods) {
|
||||
mod.AvoidDamage(self, other, hit, retval, ignoreDefault);
|
||||
}
|
||||
return retval;
|
||||
@ -1326,7 +1341,7 @@ bool LuaParser::AvoidDamage(Mob *self, Mob *other, DamageHitInfo &hit, bool & ig
|
||||
bool LuaParser::CheckHitChance(Mob *self, Mob *other, DamageHitInfo &hit, bool &ignoreDefault)
|
||||
{
|
||||
bool retval = false;
|
||||
for (auto &mod : mods_) {
|
||||
for (auto &mod : mImpl->mods) {
|
||||
mod.CheckHitChance(self, other, hit, retval, ignoreDefault);
|
||||
}
|
||||
return retval;
|
||||
@ -1334,14 +1349,14 @@ bool LuaParser::CheckHitChance(Mob *self, Mob *other, DamageHitInfo &hit, bool &
|
||||
|
||||
void LuaParser::TryCriticalHit(Mob *self, Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault)
|
||||
{
|
||||
for (auto &mod : mods_) {
|
||||
for (auto &mod : mImpl->mods) {
|
||||
mod.TryCriticalHit(self, defender, hit, opts, ignoreDefault);
|
||||
}
|
||||
}
|
||||
|
||||
void LuaParser::CommonOutgoingHitSuccess(Mob *self, Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault)
|
||||
{
|
||||
for (auto &mod : mods_) {
|
||||
for (auto &mod : mImpl->mods) {
|
||||
mod.CommonOutgoingHitSuccess(self, other, hit, opts, ignoreDefault);
|
||||
}
|
||||
}
|
||||
@ -1349,7 +1364,7 @@ void LuaParser::CommonOutgoingHitSuccess(Mob *self, Mob *other, DamageHitInfo &h
|
||||
uint32 LuaParser::GetRequiredAAExperience(Client *self, bool &ignoreDefault)
|
||||
{
|
||||
uint32 retval = 0;
|
||||
for (auto &mod : mods_) {
|
||||
for (auto &mod : mImpl->mods) {
|
||||
mod.GetRequiredAAExperience(self, retval, ignoreDefault);
|
||||
}
|
||||
return retval;
|
||||
@ -1358,7 +1373,7 @@ uint32 LuaParser::GetRequiredAAExperience(Client *self, bool &ignoreDefault)
|
||||
uint32 LuaParser::GetEXPForLevel(Client *self, uint16 level, bool &ignoreDefault)
|
||||
{
|
||||
uint32 retval = 0;
|
||||
for (auto &mod : mods_) {
|
||||
for (auto &mod : mImpl->mods) {
|
||||
mod.GetEXPForLevel(self, level, retval, ignoreDefault);
|
||||
}
|
||||
return retval;
|
||||
@ -1367,7 +1382,7 @@ uint32 LuaParser::GetEXPForLevel(Client *self, uint16 level, bool &ignoreDefault
|
||||
uint32 LuaParser::GetExperienceForKill(Client *self, Mob *against, bool &ignoreDefault)
|
||||
{
|
||||
uint32 retval = 0;
|
||||
for (auto &mod : mods_) {
|
||||
for (auto &mod : mImpl->mods) {
|
||||
mod.GetExperienceForKill(self, against, retval, ignoreDefault);
|
||||
}
|
||||
return retval;
|
||||
|
||||
@ -120,17 +120,8 @@ private:
|
||||
void MapFunctions(lua_State *L);
|
||||
QuestEventID ConvertLuaEvent(QuestEventID evt);
|
||||
|
||||
std::map<std::string, std::string> vars_;
|
||||
std::map<std::string, bool> loaded_;
|
||||
std::vector<LuaMod> mods_;
|
||||
lua_State *L;
|
||||
|
||||
NPCArgumentHandler NPCArgumentDispatch[_LargestEventID];
|
||||
PlayerArgumentHandler PlayerArgumentDispatch[_LargestEventID];
|
||||
ItemArgumentHandler ItemArgumentDispatch[_LargestEventID];
|
||||
SpellArgumentHandler SpellArgumentDispatch[_LargestEventID];
|
||||
EncounterArgumentHandler EncounterArgumentDispatch[_LargestEventID];
|
||||
|
||||
struct Implementation;
|
||||
std::unique_ptr<Implementation> mImpl;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user