The Player Panel will now list out the player's Player Ranks (#23621)

* Displays the player ranks into the player panel

* Player ranks can now be checked without considering the admin bypass
This commit is contained in:
GoldenAlpharex
2023-09-10 20:56:15 -04:00
committed by GitHub
parent 40fab1eb86
commit 4086fda4c9
3 changed files with 35 additions and 8 deletions
+14
View File
@@ -32,6 +32,20 @@
if(M.client)
body += "<br>\[<b>First Seen:</b> [M.client.player_join_date]\]\[<b>Byond account registered on:</b> [M.client.account_join_date]\]"
// SKYRAT EDIT ADDITION START - Player Ranks
var/list/player_ranks = list()
if(SSplayer_ranks.is_donator(M.client, admin_bypass = FALSE))
player_ranks += "Donator"
if(SSplayer_ranks.is_mentor(M.client, admin_bypass = FALSE))
player_ranks += "Mentor"
if(SSplayer_ranks.is_veteran(M.client, admin_bypass = FALSE))
player_ranks += "Veteran"
body += "<br><br><b>Player Ranks: </b>[length(player_ranks) ? player_ranks.Join(", ") : "None"]"
// SKYRAT EDIT END
body += "<br><br><b>CentCom Galactic Ban DB: </b> "
if(CONFIG_GET(string/centcom_ban_db))
body += "<a href='?_src_=holder;[HrefToken()];centcomlookup=[M.client.ckey]'>Search</a>"
@@ -44,6 +44,13 @@
cmd_mentor_dementor()
/client/proc/is_mentor() // admins are mentors too.
if(mentor_datum || check_rights_for(src, R_ADMIN))
/**
* Returns whether or not the user is qualified as a mentor.
*
* Arguments:
* * admin_bypass - Whether or not admins can succeed this check, even if they
* do not actually possess the role. Defaults to `TRUE`.
*/
/client/proc/is_mentor(admin_bypass = TRUE)
if(mentor_datum || (admin_bypass && check_rights_for(src, R_ADMIN)))
return TRUE
@@ -46,15 +46,17 @@ SUBSYSTEM_DEF(player_ranks)
*
* Arguments:
* * user - The client to verify the donator status of.
* * admin_bypass - Whether or not admins can succeed this check, even if they
* do not actually possess the role. Defaults to `TRUE`.
*/
/datum/controller/subsystem/player_ranks/proc/is_donator(client/user)
/datum/controller/subsystem/player_ranks/proc/is_donator(client/user, admin_bypass = TRUE)
if(!istype(user))
CRASH("Invalid user type provided to is_donator(), expected 'client' and obtained '[user ? user.type : "null"]'.")
if(GLOB.donator_list[user.ckey])
return TRUE
if(is_admin(user))
if(admin_bypass && is_admin(user))
return TRUE
return FALSE
@@ -66,12 +68,14 @@ SUBSYSTEM_DEF(player_ranks)
*
* Arguments:
* * user - The client to verify the mentor status of.
* * admin_bypass - Whether or not admins can succeed this check, even if they
* do not actually possess the role. Defaults to `TRUE`.
*/
/datum/controller/subsystem/player_ranks/proc/is_mentor(client/user)
/datum/controller/subsystem/player_ranks/proc/is_mentor(client/user, admin_bypass = TRUE)
if(!istype(user))
CRASH("Invalid user type provided to is_mentor(), expected 'client' and obtained '[user ? user.type : "null"]'.")
return user.is_mentor()
return user.is_mentor(admin_bypass)
/**
@@ -79,15 +83,17 @@ SUBSYSTEM_DEF(player_ranks)
*
* Arguments:
* * user - The client to verify the veteran status of.
* * admin_bypass - Whether or not admins can succeed this check, even if they
* do not actually possess the role. Defaults to `TRUE`.
*/
/datum/controller/subsystem/player_ranks/proc/is_veteran(client/user)
/datum/controller/subsystem/player_ranks/proc/is_veteran(client/user, admin_bypass = TRUE)
if(!istype(user))
CRASH("Invalid user type provided to is_veteran(), expected 'client' and obtained '[user ? user.type : "null"]'.")
if(GLOB.veteran_list[user.ckey])
return TRUE
if(is_admin(user))
if(admin_bypass && is_admin(user))
return TRUE
return FALSE