summaryrefslogtreecommitdiffstats
path: root/src/Bindings
diff options
context:
space:
mode:
Diffstat (limited to 'src/Bindings')
-rw-r--r--src/Bindings/ManualBindings_RankManager.cpp85
1 files changed, 84 insertions, 1 deletions
diff --git a/src/Bindings/ManualBindings_RankManager.cpp b/src/Bindings/ManualBindings_RankManager.cpp
index 2e93ad264..6e623af0d 100644
--- a/src/Bindings/ManualBindings_RankManager.cpp
+++ b/src/Bindings/ManualBindings_RankManager.cpp
@@ -129,6 +129,27 @@ static int tolua_cRankManager_AddRank(lua_State * L)
+/** Binds cRankManager::ClearPlayerRanks */
+static int tolua_cRankManager_ClearPlayerRanks(lua_State * L)
+{
+ cLuaState S(L);
+ if (
+ !S.CheckParamUserTable(1, "cRankManager") ||
+ !S.CheckParamEnd(2)
+ )
+ {
+ return 0;
+ }
+
+ // Remove all players:
+ cRoot::Get()->GetRankManager().ClearPlayerRanks();
+ return 1;
+}
+
+
+
+
+
/** Binds cRankManager::GetAllGroups */
static int tolua_cRankManager_GetAllGroups(lua_State * L)
{
@@ -183,6 +204,33 @@ static int tolua_cRankManager_GetAllPermissions(lua_State * L)
+/** Binds cRankManager::GetAllPlayers */
+static int tolua_cRankManager_GetAllPlayers(lua_State * L)
+{
+ // Function signature:
+ // cRankManager:GetAllPlayers() -> arraytable of Player UUID's
+
+ cLuaState S(L);
+ if (
+ !S.CheckParamUserTable(1, "cRankManager") ||
+ !S.CheckParamEnd(2)
+ )
+ {
+ return 0;
+ }
+
+ // Get the player uuid's:
+ AStringVector Players = cRoot::Get()->GetRankManager().GetAllPlayers();
+
+ // Push the results:
+ S.Push(Players);
+ return 1;
+}
+
+
+
+
+
/** Binds cRankManager::GetAllRanks */
static int tolua_cRankManager_GetAllRanks(lua_State * L)
{
@@ -400,6 +448,38 @@ static int tolua_cRankManager_GetPlayerRankName(lua_State * L)
+/** Binds cRankManager::GetPlayerName */
+static int tolua_cRankManager_GetPlayerName(lua_State * L)
+{
+ // Function signature:
+ // cRankManager:GetPlayerName(PlayerUUID) -> string
+
+ cLuaState S(L);
+ if (
+ !S.CheckParamUserTable(1, "cRankManager") ||
+ !S.CheckParamString(2) ||
+ !S.CheckParamEnd(3)
+ )
+ {
+ return 0;
+ }
+
+ // Get the params:
+ AString PlayerUUID;
+ S.GetStackValue(2, PlayerUUID);
+
+ // Get the player name:
+ AString PlayerName = cRoot::Get()->GetRankManager().GetPlayerName(PlayerUUID);
+
+ // Push the result:
+ S.Push(PlayerName);
+ return 1;
+}
+
+
+
+
+
/** Binds cRankManager::GetRankGroups */
static int tolua_cRankManager_GetRankGroups(lua_State * L)
{
@@ -895,7 +975,7 @@ static int tolua_cRankManager_SetDefaultRank(lua_State * L)
// Set the rank, return the result:
S.Push(cRoot::Get()->GetRankManager().SetDefaultRank(RankName));
- return 0;
+ return 1;
}
@@ -972,8 +1052,10 @@ void ManualBindings::BindRankManager(lua_State * tolua_S)
tolua_function(tolua_S, "AddGroupToRank", tolua_cRankManager_AddGroupToRank);
tolua_function(tolua_S, "AddPermissionToGroup", tolua_cRankManager_AddPermissionToGroup);
tolua_function(tolua_S, "AddRank", tolua_cRankManager_AddRank);
+ tolua_function(tolua_S, "ClearPlayerRanks", tolua_cRankManager_ClearPlayerRanks);
tolua_function(tolua_S, "GetAllGroups", tolua_cRankManager_GetAllGroups);
tolua_function(tolua_S, "GetAllPermissions", tolua_cRankManager_GetAllPermissions);
+ tolua_function(tolua_S, "GetAllPlayers", tolua_cRankManager_GetAllPlayers);
tolua_function(tolua_S, "GetAllRanks", tolua_cRankManager_GetAllRanks);
tolua_function(tolua_S, "GetDefaultRank", tolua_cRankManager_GetDefaultRank);
tolua_function(tolua_S, "GetGroupPermissions", tolua_cRankManager_GetGroupPermissions);
@@ -981,6 +1063,7 @@ void ManualBindings::BindRankManager(lua_State * tolua_S)
tolua_function(tolua_S, "GetPlayerMsgVisuals", tolua_cRankManager_GetPlayerMsgVisuals);
tolua_function(tolua_S, "GetPlayerPermissions", tolua_cRankManager_GetPlayerPermissions);
tolua_function(tolua_S, "GetPlayerRankName", tolua_cRankManager_GetPlayerRankName);
+ tolua_function(tolua_S, "GetPlayerName", tolua_cRankManager_GetPlayerName);
tolua_function(tolua_S, "GetRankGroups", tolua_cRankManager_GetRankGroups);
tolua_function(tolua_S, "GetRankPermissions", tolua_cRankManager_GetRankPermissions);
tolua_function(tolua_S, "GetRankVisuals", tolua_cRankManager_GetRankVisuals);