From 55bdfd4155dbe35452e96c27e33ecfc89f3e3e12 Mon Sep 17 00:00:00 2001 From: Zbizu Date: Sat, 18 Sep 2021 01:40:31 +0200 Subject: [PATCH] new method: itemType:getRuneSpellName() --- src/luascript.cpp | 13 +++++++++++++ src/luascript.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/luascript.cpp b/src/luascript.cpp index ae90d88032..d2357e1e8c 100644 --- a/src/luascript.cpp +++ b/src/luascript.cpp @@ -2711,6 +2711,7 @@ void LuaScriptInterface::registerFunctions() registerMethod("ItemType", "getWieldInfo", LuaScriptInterface::luaItemTypeGetWieldInfo); registerMethod("ItemType", "getDuration", LuaScriptInterface::luaItemTypeGetDuration); registerMethod("ItemType", "getLevelDoor", LuaScriptInterface::luaItemTypeGetLevelDoor); + registerMethod("ItemType", "getRuneSpellName", LuaScriptInterface::luaItemTypeGetRuneSpellName); registerMethod("ItemType", "getVocationString", LuaScriptInterface::luaItemTypeGetVocationString); registerMethod("ItemType", "getMinReqLevel", LuaScriptInterface::luaItemTypeGetMinReqLevel); registerMethod("ItemType", "getMinReqMagicLevel", LuaScriptInterface::luaItemTypeGetMinReqMagicLevel); @@ -12115,6 +12116,18 @@ int LuaScriptInterface::luaItemTypeGetLevelDoor(lua_State* L) return 1; } +int LuaScriptInterface::luaItemTypeGetRuneSpellName(lua_State* L) +{ + // itemType:getRuneSpellName() + const ItemType* itemType = getUserdata(L, 1); + if (itemType && itemType->isRune()) { + pushString(L, itemType->runeSpellName); + } else { + lua_pushnil(L); + } + return 1; +} + int LuaScriptInterface::luaItemTypeGetVocationString(lua_State* L) { // itemType:getVocationString() diff --git a/src/luascript.h b/src/luascript.h index 6a1ec5bc12..b3f3bc1a33 100644 --- a/src/luascript.h +++ b/src/luascript.h @@ -1207,6 +1207,7 @@ class LuaScriptInterface static int luaItemTypeGetWieldInfo(lua_State* L); static int luaItemTypeGetDuration(lua_State* L); static int luaItemTypeGetLevelDoor(lua_State* L); + static int luaItemTypeGetRuneSpellName(lua_State* L); static int luaItemTypeGetVocationString(lua_State* L); static int luaItemTypeGetMinReqLevel(lua_State* L); static int luaItemTypeGetMinReqMagicLevel(lua_State* L);