aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_localplayer.cpp
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-08-15 15:45:28 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-08-15 15:45:28 +0200
commit3bed0981d058b512bfb8aeeeeed235c9ee9385af (patch)
tree8f3b06e1ac849fecf684af1ba7bb2e72eaed4b5d /src/script/lua_api/l_localplayer.cpp
parent622d547262ee6800810b228d9641edff63848e0c (diff)
downloaddragonfireclient-3bed0981d058b512bfb8aeeeeed235c9ee9385af.tar.xz
UI Update; Added AutoTool
Diffstat (limited to 'src/script/lua_api/l_localplayer.cpp')
-rw-r--r--src/script/lua_api/l_localplayer.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/script/lua_api/l_localplayer.cpp b/src/script/lua_api/l_localplayer.cpp
index bde120c1d..2644893f9 100644
--- a/src/script/lua_api/l_localplayer.cpp
+++ b/src/script/lua_api/l_localplayer.cpp
@@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common/c_content.h"
#include "client/client.h"
#include "client/content_cao.h"
+#include "client/game.h"
LuaLocalPlayer::LuaLocalPlayer(LocalPlayer *m) : m_localplayer(m)
{
@@ -86,6 +87,17 @@ int LuaLocalPlayer::l_get_wield_index(lua_State *L)
return 1;
}
+// set_wield_index(self)
+int LuaLocalPlayer::l_set_wield_index(lua_State *L)
+{
+ LocalPlayer *player = getobject(L, 1);
+ u32 index = luaL_checkinteger(L, 2);
+
+ player->setWieldIndex(index);
+ g_game->processItemSelection(&g_game->runData.new_playeritem);
+ return 0;
+}
+
// get_wielded_item(self)
int LuaLocalPlayer::l_get_wielded_item(lua_State *L)
{
@@ -468,6 +480,7 @@ const luaL_Reg LuaLocalPlayer::methods[] = {
luamethod(LuaLocalPlayer, get_hp),
luamethod(LuaLocalPlayer, get_name),
luamethod(LuaLocalPlayer, get_wield_index),
+ luamethod(LuaLocalPlayer, set_wield_index),
luamethod(LuaLocalPlayer, get_wielded_item),
luamethod(LuaLocalPlayer, is_attached),
luamethod(LuaLocalPlayer, is_touching_ground),