diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua index 7ec978d3b..8be7cc9fc 100644 --- a/Server/Plugins/APIDump/APIDesc.lua +++ b/Server/Plugins/APIDump/APIDesc.lua @@ -12070,593 +12070,8 @@ a_Player:OpenWindow(Window); }, }, Inherits = "cPawn", - }, - cRankManager = - { - Desc = [[ - Manages the players' permissions. The players are assigned a single rank, which contains groups of - permissions. The functions in this class query or modify these.
-
- All the functions are static, call them using the cRankManager:Function()
convention.
- The players are identified by their UUID, to support player renaming.
-- The rank also contains specific "mesage visuals" - bits that are used for formatting messages from the - players. There's a message prefix, which is put in front of every message the player sends, and the - message suffix that is appended to each message. There's also a PlayerNameColorCode, which holds the - color that is used for the player's name in the messages.
-- Each rank can contain any number of permission groups. These groups allow for an easier setup of the - permissions - you can share groups among ranks, so the usual approach is to group similar permissions - together and add that group to any rank that should use those permissions.
-- Permissions are added to individual groups. Each group can support unlimited permissions. Note that - adding a permission to a group will make the permission available to all the ranks that contain that - permission group.
-- One rank is reserved as the Default rank. All players that don't have an explicit rank assigned to them - will behave as if assigned to this rank. The default rank can be changed to any other rank at any time. - Note that the default rank cannot be removed from the RankManager - RemoveRank() will change the default - rank to the replacement rank, if specified, and fail if no replacement rank is specified. Renaming the - default rank using RenameRank() will change the default rank to the new name. - ]], - Functions = - { - AddGroup = - { - Params = - { - { - Name = "GroupName", - Type = "string", - }, - }, - Notes = "Adds the group of the specified name. Logs a warning and does nothing if the group already exists.", - }, - AddGroupToRank = - { - Params = - { - { - Name = "GroupName", - Type = "string", - }, - { - Name = "RankName", - Type = "string", - }, - }, - Returns = - { - { - Type = "boolean", - }, - }, - Notes = "Adds the specified group to the specified rank. Returns true on success, false on failure - if the group name or the rank name is not found.", - }, - AddPermissionToGroup = - { - Params = - { - { - Name = "Permission", - Type = "string", - }, - { - Name = "GroupName", - Type = "string", - }, - }, - Returns = - { - { - Type = "boolean", - }, - }, - Notes = "Adds the specified permission to the specified group. Returns true on success, false on failure - if the group name is not found.", - }, - AddRank = - { - Params = - { - { - Name = "RankName", - Type = "string", - }, - { - Name = "MsgPrefix", - Type = "string", - }, - { - Name = "MsgSuffix", - Type = "string", - }, - { - Name = "MsgNameColorCode", - Type = "string", - }, - }, - Notes = "Adds a new rank of the specified name and with the specified message visuals. Logs an info message and does nothing if the rank already exists.", - }, - ClearPlayerRanks = - { - Notes = "Removes all player ranks from the database. Note that this doesn't change the cPlayer instances for the already connected players, you need to update all the instances manually.", - }, - GetAllGroups = - { - Returns = - { - { - Type = "table", - }, - }, - Notes = "Returns an array-table containing the names of all the groups that are known to the manager.", - }, - GetAllPermissions = - { - Returns = - { - { - Type = "table", - }, - }, - Notes = "Returns an array-table containing all the permissions that are known to the manager.", - }, - GetAllPlayerUUIDs = - { - Returns = - { - { - Type = "table", - }, - }, - Notes = "Returns the short uuids of all players stored in the rank DB, sorted by the players' names (case insensitive).", - }, - GetAllRanks = - { - Returns = - { - { - Type = "table", - }, - }, - Notes = "Returns an array-table containing the names of all the ranks that are known to the manager.", - }, - GetDefaultRank = - { - Returns = - { - { - Type = "string", - }, - }, - Notes = "Returns the name of the default rank. ", - }, - GetGroupPermissions = - { - Params = - { - { - Name = "GroupName", - Type = "string", - }, - }, - Returns = - { - { - Type = "table", - }, - }, - Notes = "Returns an array-table containing the permissions that the specified group contains.", - }, - GetPlayerGroups = - { - Params = - { - { - Name = "PlayerUUID", - Type = "string", - }, - }, - Returns = - { - { - Type = "table", - }, - }, - Notes = "Returns an array-table of the names of the groups that are assigned to the specified player through their rank. Returns an empty table if the player is not known or has no rank or groups assigned to them.", - }, - GetPlayerMsgVisuals = - { - Params = - { - { - Name = "PlayerUUID", - Type = "string", - }, - }, - Returns = - { - { - Name = "MsgPrefix", - Type = "string", - }, - { - Name = "MsgSuffix", - Type = "string", - }, - { - Name = "MsgNameColorCode", - Type = "string", - }, - }, - Notes = "Returns the message visuals assigned to the player. If the player is not explicitly assigned a rank, the default rank's visuals are returned. If there is an error, no value is returned at all.", - }, - GetPlayerName = - { - Params = - { - { - Name = "PlayerUUID", - Type = "string", - }, - }, - Returns = - { - { - Name = "PlayerName", - Type = "string", - }, - }, - Notes = "Returns the last name that the specified player has, for a player in the ranks database. An empty string is returned if the player isn't in the database.", - }, - GetPlayerPermissions = - { - Params = - { - { - Name = "PlayerUUID", - Type = "string", - }, - }, - Returns = - { - { - Type = "table", - }, - }, - Notes = "Returns an array-table containing all permissions that the specified player is assigned through their rank. Returns the default rank's permissions if the player has no explicit rank assigned to them. Returns an empty array on error.", - }, - GetPlayerRankName = - { - Params = - { - { - Name = "PlayerUUID", - Type = "string", - }, - }, - Returns = - { - { - Name = "RankName", - Type = "string", - }, - }, - Notes = "Returns the name of the rank that is assigned to the specified player. An empty string (NOT the default rank) is returned if the player has no rank assigned to them.", - }, - GetRankGroups = - { - Params = - { - { - Name = "RankName", - Type = "string", - }, - }, - Returns = - { - { - Type = "table", - }, - }, - Notes = "Returns an array-table of the names of all the groups that are assigned to the specified rank. Returns an empty table if there is no such rank.", - }, - GetRankPermissions = - { - Params = - { - { - Name = "RankName", - Type = "string", - }, - }, - Returns = - { - { - Type = "table", - }, - }, - Notes = "Returns an array-table of all the permissions that are assigned to the specified rank through its groups. Returns an empty table if there is no such rank.", - }, - GetRankVisuals = - { - Params = - { - { - Name = "RankName", - Type = "string", - }, - }, - Returns = - { - { - Name = "MsgPrefix", - Type = "string", - }, - { - Name = "MsgSuffix", - Type = "string", - }, - { - Name = "MsgNameColorCode", - Type = "string", - }, - }, - Notes = "Returns the message visuals for the specified rank. Returns no value if the specified rank does not exist.", - }, - GroupExists = - { - Params = - { - { - Name = "GroupName", - Type = "string", - }, - }, - Returns = - { - { - Type = "boolean", - }, - }, - Notes = "Returns true iff the specified group exists.", - }, - IsGroupInRank = - { - Params = - { - { - Name = "GroupName", - Type = "string", - }, - { - Name = "RankName", - Type = "string", - }, - }, - Returns = - { - { - Type = "boolean", - }, - }, - Notes = "Returns true iff the specified group is assigned to the specified rank.", - }, - IsPermissionInGroup = - { - Params = - { - { - Name = "Permission", - Type = "string", - }, - { - Name = "GroupName", - Type = "string", - }, - }, - Returns = - { - { - Type = "boolean", - }, - }, - Notes = "Returns true iff the specified permission is assigned to the specified group.", - }, - IsPlayerRankSet = - { - Params = - { - { - Name = "PlayerUUID", - Type = "string", - }, - }, - Returns = - { - { - Type = "boolean", - }, - }, - Notes = "Returns true iff the specified player has a rank assigned to them.", - }, - RankExists = - { - Params = - { - { - Name = "RankName", - Type = "string", - }, - }, - Returns = - { - { - Type = "boolean", - }, - }, - Notes = "Returns true iff the specified rank exists.", - }, - RemoveGroup = - { - Params = - { - { - Name = "GroupName", - Type = "string", - }, - }, - Notes = "Removes the specified group completely. The group will be removed from all the ranks using it and then erased from the manager. Logs an info message and does nothing if the group doesn't exist.", - }, - RemoveGroupFromRank = - { - Params = - { - { - Name = "GroupName", - Type = "string", - }, - { - Name = "RankName", - Type = "string", - }, - }, - Notes = "Removes the specified group from the specified rank. The group will still exist, even if it isn't assigned to any rank. Logs an info message and does nothing if the group or rank doesn't exist.", - }, - RemovePermissionFromGroup = - { - Params = - { - { - Name = "Permission", - Type = "string", - }, - { - Name = "GroupName", - Type = "string", - }, - }, - Notes = "Removes the specified permission from the specified group. Logs an info message and does nothing if the group doesn't exist.", - }, - RemovePlayerRank = - { - Params = - { - { - Name = "PlayerUUID", - Type = "string", - }, - }, - Notes = "Removes the player's rank; the player's left without a rank. Note that this doesn't change the {{cPlayer}} instances for the already connected players, you need to update all the instances manually. No action if the player has no rank assigned to them already.", - }, - RemoveRank = - { - Params = - { - { - Name = "RankName", - Type = "string", - }, - { - Name = "ReplacementRankName", - Type = "string", - IsOptional = true, - }, - }, - Notes = "Removes the specified rank. If ReplacementRankName is given, the players that have RankName will get their rank set to ReplacementRankName. If it isn't given, or is an invalid rank, the players will be removed from the manager, their ranks will be unset completely. Logs an info message and does nothing if the rank is not found.", - }, - RenameGroup = - { - Params = - { - { - Name = "OldName", - Type = "string", - }, - { - Name = "NewName", - Type = "string", - }, - }, - Notes = "Renames the specified group. Logs an info message and does nothing if the group is not found or the new name is already used.", - }, - RenameRank = - { - Params = - { - { - Name = "OldName", - Type = "string", - }, - { - Name = "NewName", - Type = "string", - }, - }, - Notes = "Renames the specified rank. Logs an info message and does nothing if the rank is not found or the new name is already used.", - }, - SetDefaultRank = - { - Params = - { - { - Name = "RankName", - Type = "string", - }, - }, - Returns = - { - { - Type = "boolean", - }, - }, - Notes = "Sets the specified rank as the default rank. Returns true on success, false on failure (rank doesn't exist).", - }, - SetPlayerRank = - { - Params = - { - { - Name = "PlayerUUID", - Type = "string", - }, - { - Name = "PlayerName", - Type = "string", - }, - { - Name = "RankName", - Type = "string", - }, - }, - Notes = "Updates the rank for the specified player. The player name is provided for reference, the UUID is used for identification. Logs a warning and does nothing if the rank is not found.", - }, - SetRankVisuals = - { - Params = - { - { - Name = "RankName", - Type = "string", - }, - { - Name = "MsgPrefix", - Type = "string", - }, - { - Name = "MsgSuffix", - Type = "string", - }, - { - Name = "MsgNameColorCode", - Type = "string", - }, - }, - Notes = "Updates the rank's message visuals. Logs an info message and does nothing if rank not found.", - }, - }, - }, + }, -- cPlayer + cRoot = { Desc = [[ diff --git a/Server/Plugins/APIDump/Classes/RankManager.lua b/Server/Plugins/APIDump/Classes/RankManager.lua new file mode 100644 index 000000000..9695117a6 --- /dev/null +++ b/Server/Plugins/APIDump/Classes/RankManager.lua @@ -0,0 +1,725 @@ +-- Describes the cRankManager class API + +return +{ + cRankManager = + { + Desc = [[ + Manages the players' permissions. The players are assigned a single rank, which contains groups of + permissions and restrictions. The functions in this class query or modify these.
+
+ All the functions are static, call them using the cRankManager:Function()
convention.
+ The players are identified by their UUID, to support player renaming.
++ The rank also contains specific "mesage visuals" - bits that are used for formatting messages from the + players. There's a message prefix, which is put in front of every message the player sends, and the + message suffix that is appended to each message. There's also a PlayerNameColorCode, which holds the + color that is used for the player's name in the messages.
++ Each rank can contain any number of permission groups. These groups allow for an easier setup of the + permissions - you can share groups among ranks, so the usual approach is to group similar permissions + together and add that group to any rank that should use those permissions.
++ Permissions are added to individual groups. Each group can support unlimited permissions. Note that + adding a permission to a group will make the permission available to all the ranks that contain that + permission group.
++ One rank is reserved as the Default rank. All players that don't have an explicit rank assigned to them + will behave as if assigned to this rank. The default rank can be changed to any other rank at any time. + Note that the default rank cannot be removed from the RankManager - RemoveRank() will change the default + rank to the replacement rank, if specified, and fail if no replacement rank is specified. Renaming the + default rank using RenameRank() will change the default rank to the new name. + ]], + Functions = + { + AddGroup = + { + IsStatic = true, + Params = + { + { + Name = "GroupName", + Type = "string", + }, + }, + Notes = "Adds the group of the specified name. Logs a warning and does nothing if the group already exists.", + }, + AddGroupToRank = + { + IsStatic = true, + Params = + { + { + Name = "GroupName", + Type = "string", + }, + { + Name = "RankName", + Type = "string", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Adds the specified group to the specified rank. Returns true on success, false on failure - if the group name or the rank name is not found.", + }, + AddPermissionToGroup = + { + IsStatic = true, + Params = + { + { + Name = "Permission", + Type = "string", + }, + { + Name = "GroupName", + Type = "string", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Adds the specified permission to the specified group. Returns true on success, false on failure - if the group name is not found.", + }, + AddRank = + { + IsStatic = true, + Params = + { + { + Name = "RankName", + Type = "string", + }, + { + Name = "MsgPrefix", + Type = "string", + }, + { + Name = "MsgSuffix", + Type = "string", + }, + { + Name = "MsgNameColorCode", + Type = "string", + }, + }, + Notes = "Adds a new rank of the specified name and with the specified message visuals. Logs an info message and does nothing if the rank already exists.", + }, + AddRestrictionToGroup = + { + IsStatic = true, + Params = + { + { + Name = "Permission", + Type = "string", + }, + { + Name = "GroupName", + Type = "string", + }, + }, + Returns = + { + { Type = "boolean" }, + }, + Notes = "Adds a new restriction to the specified group. Returns true if successful, false if it fails (no such group). No action if the group already has the restriction.", + }, + ClearPlayerRanks = + { + IsStatic = true, + Notes = "Removes all player ranks from the database. Note that this doesn't change the cPlayer instances for the already connected players, you need to update all the instances manually.", + }, + GetAllGroups = + { + IsStatic = true, + Returns = + { + { + Type = "table", + }, + }, + Notes = "Returns an array-table containing the names of all the groups that are known to the manager.", + }, + GetAllPermissions = + { + IsStatic = true, + Returns = + { + { + Type = "table", + }, + }, + Notes = "Returns an array-table containing all the permissions that are known to the manager.", + }, + GetAllPermissionsRestrictions = + { + IsStatic = true, + Returns = + { + { + Type = "table", + }, + }, + Notes = "Returns an array-table containing all the permissions and restrictions (intermixed together) that are known to the manager.", + }, + GetAllPlayerUUIDs = + { + IsStatic = true, + Returns = + { + { + Type = "table", + }, + }, + Notes = "Returns the short uuids of all players stored in the rank DB, sorted by the players' names (case insensitive).", + }, + GetAllRanks = + { + IsStatic = true, + Returns = + { + { + Type = "table", + }, + }, + Notes = "Returns an array-table containing the names of all the ranks that are known to the manager.", + }, + GetAllRestrictions = + { + IsStatic = true, + Returns = + { + { + Type = "table", + }, + }, + Notes = "Returns an array-table containing all the restrictions that are known to the manager.", + }, + GetDefaultRank = + { + IsStatic = true, + Returns = + { + { + Type = "string", + }, + }, + Notes = "Returns the name of the default rank. ", + }, + GetGroupPermissions = + { + IsStatic = true, + Params = + { + { + Name = "GroupName", + Type = "string", + }, + }, + Returns = + { + { + Type = "table", + }, + }, + Notes = "Returns an array-table containing the permissions that the specified group contains.", + }, + GetGroupRestrictions = + { + IsStatic = true, + Params = + { + { + Name = "GroupName", + Type = "string", + }, + }, + Returns = + { + { + Type = "table", + }, + }, + Notes = "Returns an array-table containing the restrictions that the specified group contains.", + }, + GetPlayerGroups = + { + IsStatic = true, + Params = + { + { + Name = "PlayerUUID", + Type = "string", + }, + }, + Returns = + { + { + Type = "table", + }, + }, + Notes = "Returns an array-table of the names of the groups that are assigned to the specified player through their rank. Returns an empty table if the player is not known or has no rank or groups assigned to them.", + }, + GetPlayerMsgVisuals = + { + IsStatic = true, + Params = + { + { + Name = "PlayerUUID", + Type = "string", + }, + }, + Returns = + { + { + Name = "MsgPrefix", + Type = "string", + }, + { + Name = "MsgSuffix", + Type = "string", + }, + { + Name = "MsgNameColorCode", + Type = "string", + }, + }, + Notes = "Returns the message visuals assigned to the player. If the player is not explicitly assigned a rank, the default rank's visuals are returned. If there is an error, no value is returned at all.", + }, + GetPlayerName = + { + IsStatic = true, + Params = + { + { + Name = "PlayerUUID", + Type = "string", + }, + }, + Returns = + { + { + Name = "PlayerName", + Type = "string", + }, + }, + Notes = "Returns the last name that the specified player has, for a player in the ranks database. An empty string is returned if the player isn't in the database.", + }, + GetPlayerPermissions = + { + IsStatic = true, + Params = + { + { + Name = "PlayerUUID", + Type = "string", + }, + }, + Returns = + { + { + Type = "table", + }, + }, + Notes = "Returns an array-table containing all permissions that the specified player is assigned through their rank. Returns the default rank's permissions if the player has no explicit rank assigned to them. Returns an empty array on error.", + }, + GetPlayerRankName = + { + IsStatic = true, + Params = + { + { + Name = "PlayerUUID", + Type = "string", + }, + }, + Returns = + { + { + Name = "RankName", + Type = "string", + }, + }, + Notes = "Returns the name of the rank that is assigned to the specified player. An empty string (NOT the default rank) is returned if the player has no rank assigned to them.", + }, + GetRankGroups = + { + IsStatic = true, + Params = + { + { + Name = "RankName", + Type = "string", + }, + }, + Returns = + { + { + Type = "table", + }, + }, + Notes = "Returns an array-table of the names of all the groups that are assigned to the specified rank. Returns an empty table if there is no such rank.", + }, + GetRankPermissions = + { + IsStatic = true, + Params = + { + { + Name = "RankName", + Type = "string", + }, + }, + Returns = + { + { + Type = "table", + }, + }, + Notes = "Returns an array-table of all the permissions that are assigned to the specified rank through its groups. Returns an empty table if there is no such rank.", + }, + GetRankRestrictions = + { + IsStatic = true, + Params = + { + { + Name = "RankName", + Type = "string", + }, + }, + Returns = + { + { + Type = "table", + }, + }, + Notes = "Returns an array-table of all the restrictions that are assigned to the specified rank through its groups. Returns an empty table if there is no such rank.", + }, + GetRankVisuals = + { + IsStatic = true, + Params = + { + { + Name = "RankName", + Type = "string", + }, + }, + Returns = + { + { + Name = "MsgPrefix", + Type = "string", + }, + { + Name = "MsgSuffix", + Type = "string", + }, + { + Name = "MsgNameColorCode", + Type = "string", + }, + }, + Notes = "Returns the message visuals for the specified rank. Returns no value if the specified rank does not exist.", + }, + GroupExists = + { + IsStatic = true, + Params = + { + { + Name = "GroupName", + Type = "string", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true iff the specified group exists.", + }, + IsGroupInRank = + { + IsStatic = true, + Params = + { + { + Name = "GroupName", + Type = "string", + }, + { + Name = "RankName", + Type = "string", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true iff the specified group is assigned to the specified rank.", + }, + IsPermissionInGroup = + { + IsStatic = true, + Params = + { + { + Name = "Permission", + Type = "string", + }, + { + Name = "GroupName", + Type = "string", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true iff the specified permission is assigned to the specified group.", + }, + IsPlayerRankSet = + { + IsStatic = true, + Params = + { + { + Name = "PlayerUUID", + Type = "string", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true iff the specified player has a rank assigned to them.", + }, + IsRestrictionInGroup = + { + IsStatic = true, + Params = + { + { + Name = "Restriction", + Type = "string", + }, + { + Name = "GroupName", + Type = "string", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true iff the specified restriction is assigned to the specified group.", + }, + RankExists = + { + IsStatic = true, + Params = + { + { + Name = "RankName", + Type = "string", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true iff the specified rank exists.", + }, + RemoveGroup = + { + IsStatic = true, + Params = + { + { + Name = "GroupName", + Type = "string", + }, + }, + Notes = "Removes the specified group completely. The group will be removed from all the ranks using it and then erased from the manager. Logs an info message and does nothing if the group doesn't exist.", + }, + RemoveGroupFromRank = + { + IsStatic = true, + Params = + { + { + Name = "GroupName", + Type = "string", + }, + { + Name = "RankName", + Type = "string", + }, + }, + Notes = "Removes the specified group from the specified rank. The group will still exist, even if it isn't assigned to any rank. Logs an info message and does nothing if the group or rank doesn't exist.", + }, + RemovePermissionFromGroup = + { + IsStatic = true, + Params = + { + { + Name = "Permission", + Type = "string", + }, + { + Name = "GroupName", + Type = "string", + }, + }, + Notes = "Removes the specified permission from the specified group. Logs an info message and does nothing if the group doesn't exist.", + }, + RemovePlayerRank = + { + IsStatic = true, + Params = + { + { + Name = "PlayerUUID", + Type = "string", + }, + }, + Notes = "Removes the player's rank; the player's left without a rank. Note that this doesn't change the {{cPlayer}} instances for the already connected players, you need to update all the instances manually. No action if the player has no rank assigned to them already.", + }, + RemoveRank = + { + IsStatic = true, + Params = + { + { + Name = "RankName", + Type = "string", + }, + { + Name = "ReplacementRankName", + Type = "string", + IsOptional = true, + }, + }, + Notes = "Removes the specified rank. If ReplacementRankName is given, the players that have RankName will get their rank set to ReplacementRankName. If it isn't given, or is an invalid rank, the players will be removed from the manager, their ranks will be unset completely. Logs an info message and does nothing if the rank is not found.", + }, + RenameGroup = + { + IsStatic = true, + Params = + { + { + Name = "OldName", + Type = "string", + }, + { + Name = "NewName", + Type = "string", + }, + }, + Notes = "Renames the specified group. Logs an info message and does nothing if the group is not found or the new name is already used.", + }, + RenameRank = + { + IsStatic = true, + Params = + { + { + Name = "OldName", + Type = "string", + }, + { + Name = "NewName", + Type = "string", + }, + }, + Notes = "Renames the specified rank. Logs an info message and does nothing if the rank is not found or the new name is already used.", + }, + SetDefaultRank = + { + IsStatic = true, + Params = + { + { + Name = "RankName", + Type = "string", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Sets the specified rank as the default rank. Returns true on success, false on failure (rank doesn't exist).", + }, + SetPlayerRank = + { + IsStatic = true, + Params = + { + { + Name = "PlayerUUID", + Type = "string", + }, + { + Name = "PlayerName", + Type = "string", + }, + { + Name = "RankName", + Type = "string", + }, + }, + Notes = "Updates the rank for the specified player. The player name is provided for reference, the UUID is used for identification. Logs a warning and does nothing if the rank is not found.", + }, + SetRankVisuals = + { + IsStatic = true, + Params = + { + { + Name = "RankName", + Type = "string", + }, + { + Name = "MsgPrefix", + Type = "string", + }, + { + Name = "MsgSuffix", + Type = "string", + }, + { + Name = "MsgNameColorCode", + Type = "string", + }, + }, + Notes = "Updates the rank's message visuals. Logs an info message and does nothing if rank not found.", + }, + }, + }, +} diff --git a/src/Bindings/ManualBindings_RankManager.cpp b/src/Bindings/ManualBindings_RankManager.cpp index 7871c26ef..84ca67c4e 100644 --- a/src/Bindings/ManualBindings_RankManager.cpp +++ b/src/Bindings/ManualBindings_RankManager.cpp @@ -100,35 +100,6 @@ static int tolua_cRankManager_AddPermissionToGroup(lua_State * L) -/** Binds cRankManager::AddRestrictionToGroup */ -static int tolua_cRankManager_AddRestrictionToGroup(lua_State * L) -{ - // Function signature: - // cRankManager:AddRestrictionToGroup(Permission, GroupName) -> bool - - cLuaState S(L); - if ( - !S.CheckParamUserTable(1, "cRankManager") || - !S.CheckParamString(2, 3) || - !S.CheckParamEnd(4) - ) - { - return 0; - } - - // Read the params: - AString GroupName, Permission; - S.GetStackValues(2, Permission, GroupName); - - // Add the group to the rank: - S.Push(cRoot::Get()->GetRankManager()->AddRestrictionToGroup(Permission, GroupName)); - return 1; -} - - - - - /** Binds cRankManager::AddRank */ static int tolua_cRankManager_AddRank(lua_State * L) { @@ -158,6 +129,35 @@ static int tolua_cRankManager_AddRank(lua_State * L) +/** Binds cRankManager::AddRestrictionToGroup */ +static int tolua_cRankManager_AddRestrictionToGroup(lua_State * L) +{ + // Function signature: + // cRankManager:AddRestrictionToGroup(Restriction, GroupName) -> bool + + cLuaState S(L); + if ( + !S.CheckParamUserTable(1, "cRankManager") || + !S.CheckParamString(2, 3) || + !S.CheckParamEnd(4) + ) + { + return 0; + } + + // Read the params: + AString GroupName, Restriction; + S.GetStackValues(2, Restriction, GroupName); + + // Add the group to the rank: + S.Push(cRoot::Get()->GetRankManager()->AddRestrictionToGroup(Restriction, GroupName)); + return 1; +} + + + + + /** Binds cRankManager::ClearPlayerRanks */ static int tolua_cRankManager_ClearPlayerRanks(lua_State * L) { @@ -233,38 +233,11 @@ static int tolua_cRankManager_GetAllPermissions(lua_State * L) -/** Binds cRankManager::GetAllPermissions */ -static int tolua_cRankManager_GetAllRestrictions(lua_State * L) -{ - // Function signature: - // cRankManager:GetAllRestrictions() -> arraytable of Permissions - - cLuaState S(L); - if ( - !S.CheckParamUserTable(1, "cRankManager") || - !S.CheckParamEnd(2) - ) - { - return 0; - } - - // Get the permissions: - AStringVector Permissions = cRoot::Get()->GetRankManager()->GetAllRestrictions(); - - // Push the results: - S.Push(Permissions); - return 1; -} - - - - - /** Binds cRankManager::GetAllPermissionsRestrictions */ static int tolua_cRankManager_GetAllPermissionsRestrictions(lua_State * L) { // Function signature: - // cRankManager:GetAllPermissionsRestrictions() -> arraytable of Permissions and Restrictions + // cRankManager:GetAllPermissionsRestrictions() -> arraytable of Permissions and Restrictions together cLuaState S(L); if ( @@ -275,11 +248,9 @@ static int tolua_cRankManager_GetAllPermissionsRestrictions(lua_State * L) return 0; } - // Get the permissions: - AStringVector Permissions = cRoot::Get()->GetRankManager()->GetAllPermissionsRestrictions(); - // Push the results: - S.Push(Permissions); + S.Push(cRoot::Get()->GetRankManager()->GetAllPermissionsRestrictions()); + return 1; } @@ -329,11 +300,33 @@ static int tolua_cRankManager_GetAllRanks(lua_State * L) return 0; } - // Get the ranks: - AStringVector Ranks = cRoot::Get()->GetRankManager()->GetAllRanks(); + // Push the results: + S.Push(cRoot::Get()->GetRankManager()->GetAllRanks()); + return 1; +} + + + + + +/** Binds cRankManager::GetAllRestrictions */ +static int tolua_cRankManager_GetAllRestrictions(lua_State * L) +{ + // Function signature: + // cRankManager:GetAllRestrictions() -> arraytable of Restrictions + + cLuaState S(L); + if ( + !S.CheckParamUserTable(1, "cRankManager") || + !S.CheckParamEnd(2) + ) + { + return 0; + } // Push the results: - S.Push(Ranks); + S.Push(cRoot::Get()->GetRankManager()->GetAllRestrictions()); + return 1; }