Skip to content

Commit

Permalink
Added new method "vocation:getBaseAttackSpeed" for offline training a…
Browse files Browse the repository at this point in the history
…nd exercise training script (#217)
  • Loading branch information
Rechdan authored Feb 15, 2022
1 parent 6b23e6f commit 8315cf5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lua/functions/creatures/player/vocation_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,17 @@ int VocationFunctions::luaVocationGetSoulGainTicks(lua_State* L) {
return 1;
}

int VocationFunctions::luaVocationGetBaseAttackSpeed(lua_State* L) {
// vocation:getBaseAttackSpeed()
Vocation* vocation = getUserdata<Vocation>(L, 1);
if (vocation) {
lua_pushnumber(L, vocation->getBaseAttackSpeed());
} else {
lua_pushnil(L);
}
return 1;
}

int VocationFunctions::luaVocationGetAttackSpeed(lua_State* L) {
// vocation:getAttackSpeed()
Vocation* vocation = getUserdata<Vocation>(L, 1);
Expand Down
2 changes: 2 additions & 0 deletions src/lua/functions/creatures/player/vocation_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class VocationFunctions final : LuaScriptInterface {
registerMethod(L, "Vocation", "getMaxSoul", VocationFunctions::luaVocationGetMaxSoul);
registerMethod(L, "Vocation", "getSoulGainTicks", VocationFunctions::luaVocationGetSoulGainTicks);

registerMethod(L, "Vocation", "getBaseAttackSpeed", VocationFunctions::luaVocationGetBaseAttackSpeed);
registerMethod(L, "Vocation", "getAttackSpeed", VocationFunctions::luaVocationGetAttackSpeed);
registerMethod(L, "Vocation", "getBaseSpeed", VocationFunctions::luaVocationGetBaseSpeed);

Expand Down Expand Up @@ -82,6 +83,7 @@ class VocationFunctions final : LuaScriptInterface {
static int luaVocationGetMaxSoul(lua_State* L);
static int luaVocationGetSoulGainTicks(lua_State* L);

static int luaVocationGetBaseAttackSpeed(lua_State* L);
static int luaVocationGetAttackSpeed(lua_State* L);
static int luaVocationGetBaseSpeed(lua_State* L);

Expand Down

0 comments on commit 8315cf5

Please sign in to comment.