diff options
-rw-r--r-- | scripts/lua/libmana-constants.lua | 4 | ||||
-rw-r--r-- | src/game-server/mapcomposite.h | 4 | ||||
-rw-r--r-- | src/scripting/lua.cpp | 13 |
3 files changed, 19 insertions, 2 deletions
diff --git a/scripts/lua/libmana-constants.lua b/scripts/lua/libmana-constants.lua index 08d26c5c..9638588f 100644 --- a/scripts/lua/libmana-constants.lua +++ b/scripts/lua/libmana-constants.lua @@ -121,3 +121,7 @@ LOG_ERROR = 1 LOG_WARN = 2 LOG_INFO = 3 LOG_DEBUG = 4 + +-- PvP +PVP_NONE = 0 +PVP_FREE = 1 diff --git a/src/game-server/mapcomposite.h b/src/game-server/mapcomposite.h index 355f0f46..54334663 100644 --- a/src/game-server/mapcomposite.h +++ b/src/game-server/mapcomposite.h @@ -42,8 +42,8 @@ struct MapZone; enum PvPRules { - PVP_NONE, // no PvP on this map - PVP_FREE // unrestricted PvP on this map + PVP_NONE = 0, // no PvP on this map + PVP_FREE // unrestricted PvP on this map // [space for additional PvP modes] }; diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index bdbb3110..1c32c4fd 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -1970,6 +1970,18 @@ static int is_walkable(lua_State *s) return 1; } +static int map_get_pvp(lua_State *s) +{ + MapComposite *m = getScript(s)->getMap(); + if (!m) + { + raiseScriptError(s, "map_get_pvp called outside a map."); + return 0; + } + lua_pushinteger(s, m->getPvP()); + return 1; +} + static int item_class_on(lua_State *s) { ItemClass *itemClass = LuaItemClass::check(s, 1); @@ -2320,6 +2332,7 @@ LuaScript::LuaScript(): { "get_map_id", &get_map_id }, { "get_map_property", &get_map_property }, { "is_walkable", &is_walkable }, + { "map_get_pvp", &map_get_pvp }, { "item_drop", &item_drop }, { "item_get_name", &item_get_name }, { "npc_ask_integer", &npc_ask_integer }, |