diff --git a/CMakeLists.txt b/CMakeLists.txt index b1d644b70..95f21acee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,7 @@ IF(MSVC) SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x64") SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x64") SET(LUA_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/luaj_x64") + SET(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/openssl_x64") SET(SODIUM_INCLUDE_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/include") IF(MSVC_VERSION GREATER 1800) SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/x64/Release/v140/dynamic") @@ -77,6 +78,7 @@ IF(MSVC) SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x86") SET(LUA_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/luaj_x86") SET(SODIUM_INCLUDE_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/include") + SET(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/openssl_x64") IF(MSVC_VERSION GREATER 1800) SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/Win32/Release/v140/dynamic") ELSEIF(MSVC_VERSION EQUAL 1800) diff --git a/zone/lua_client.cpp b/zone/lua_client.cpp index 2e83c5625..dde90988c 100644 --- a/zone/lua_client.cpp +++ b/zone/lua_client.cpp @@ -1340,6 +1340,80 @@ void Lua_Client::QuestReward(Lua_Mob target, uint32 copper, uint32 silver, uint3 self->QuestReward(target, copper, silver, gold, platinum, itemid, exp, faction); } +void Lua_Client::QuestReward(Lua_Mob target, luabind::adl::object reward) { + Lua_Safe_Call_Void(); + + if (luabind::type(reward) != LUA_TTABLE) { + return; + } + + uint32 copper = 0; + uint32 silver = 0; + uint32 gold = 0; + uint32 platinum = 0; + uint32 itemid = 0; + uint32 exp = 0; + bool faction = false; + + auto cur = reward["copper"]; + if (luabind::type(cur) != LUA_TNIL) { + try { + copper = luabind::object_cast(cur); + } catch (luabind::cast_failed) { + } + } + + cur = reward["silver"]; + if (luabind::type(cur) != LUA_TNIL) { + try { + silver = luabind::object_cast(cur); + } catch (luabind::cast_failed) { + } + } + + cur = reward["gold"]; + if (luabind::type(cur) != LUA_TNIL) { + try { + gold = luabind::object_cast(cur); + } catch (luabind::cast_failed) { + } + } + + cur = reward["platinum"]; + if (luabind::type(cur) != LUA_TNIL) { + try { + platinum = luabind::object_cast(cur); + } catch (luabind::cast_failed) { + } + } + + cur = reward["itemid"]; + if (luabind::type(cur) != LUA_TNIL) { + try { + itemid = luabind::object_cast(cur); + } catch (luabind::cast_failed) { + } + } + + cur = reward["exp"]; + if (luabind::type(cur) != LUA_TNIL) { + try { + exp = luabind::object_cast(cur); + } catch (luabind::cast_failed) { + } + } + + cur = reward["faction"]; + if (luabind::type(cur) != LUA_TNIL) { + try { + faction = luabind::object_cast(cur); + } catch (luabind::cast_failed) { + } + } + + self->QuestReward(target, copper, silver, gold, platinum, itemid, exp, faction); +} + uint32 Lua_Client::GetMoney(uint8 type, uint8 subtype) { Lua_Safe_Call_Int(); return self->GetMoney(type, subtype); @@ -1612,6 +1686,7 @@ luabind::scope lua_register_client() { .def("QuestReward", (void(Lua_Client::*)(Lua_Mob, uint32, uint32, uint32, uint32, uint32))&Lua_Client::QuestReward) .def("QuestReward", (void(Lua_Client::*)(Lua_Mob, uint32, uint32, uint32, uint32, uint32, uint32))&Lua_Client::QuestReward) .def("QuestReward", (void(Lua_Client::*)(Lua_Mob, uint32, uint32, uint32, uint32, uint32, uint32, bool))&Lua_Client::QuestReward) + .def("QuestReward", (void(Lua_Client::*)(Lua_Mob, luabind::adl::object))&Lua_Client::QuestReward) .def("GetMoney", (uint32(Lua_Client::*)(uint8, uint8))&Lua_Client::GetMoney); } diff --git a/zone/lua_client.h b/zone/lua_client.h index a0a5a9083..d7cf4f75f 100644 --- a/zone/lua_client.h +++ b/zone/lua_client.h @@ -296,6 +296,7 @@ public: void QuestReward(Lua_Mob target, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, uint32 itemid); void QuestReward(Lua_Mob target, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, uint32 itemid, uint32 exp); void QuestReward(Lua_Mob target, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, uint32 itemid, uint32 exp, bool faction); + void QuestReward(Lua_Mob target, luabind::adl::object reward); }; #endif