From bf952256b947e9ac1586382a97d5a161c98afb22 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Sun, 25 Jan 2009 20:33:23 +0100 Subject: Added lua script binding chr_get_rights for querying the account level of a character. --- src/scripting/lua.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/scripting/lua.cpp') diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index 5e66bd8a..b9f30f4e 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -878,6 +878,22 @@ static int chr_give_exp(lua_State *s) } +/** + * Returns the rights level of a character. + * tmw.chr_get_rights (being) + */ +static int chr_get_rights(lua_State *s) +{ + Character *c = getCharacter(s, 1); + if (!c) + { + raiseScriptError(s, "chr_get_rights called for nonexistent character."); + return 0; + } + lua_pushinteger(s, c->getAccountLevel()); + return 1; +} + /** * Returns the exp total necessary to reach a specific skill level. * tmw.exp_for_level (level) @@ -976,6 +992,7 @@ LuaScript::LuaScript(): { "chr_get_post", &chr_get_post }, { "chr_get_exp", &chr_get_exp }, { "chr_give_exp", &chr_give_exp }, + { "chr_get_rights", &chr_get_rights }, { "exp_for_level", &exp_for_level }, { "monster_create", &monster_create }, { "being_type", &being_type }, -- cgit v1.2.3-70-g09d2