AdminType vars replaced with enum

This commit is contained in:
GenZmeY 2022-08-30 07:42:20 +03:00
parent 4ff4e092a9
commit 32febe3c41
4 changed files with 57 additions and 46 deletions

View File

@ -18,10 +18,6 @@ static final function name GetUnlockedEmote(int ItemId, ExtPlayerController PC)
if (PRI == None) if (PRI == None)
return Anim; return Anim;
/*
if (InStr(string(Anim), "Deluxe") != INDEX_NONE && PRI.AdminType == 255)
return 'NONE';
*/
else return Anim; else return Anim;
} }

View File

@ -27,20 +27,24 @@ struct FCustomTraderItem
var bool bIsMuted,bInitialPT,bIsDev,bHiddenUser,bClientUseCustom,bClientFirstChar,bClientCharListDone,bClientInitChars; var bool bIsMuted,bInitialPT,bIsDev,bHiddenUser,bClientUseCustom,bClientFirstChar,bClientCharListDone,bClientInitChars;
enum E_AdminType
{
AT_Global,
AT_Admin,
AT_Mod,
AT_TMem,
AT_VIP,
AT_Booster,
AT_Player
};
var E_AdminType AdminType;
var int RespawnCounter; var int RespawnCounter;
var byte AdminType;
var class<Ext_PerkBase> ECurrentPerk; var class<Ext_PerkBase> ECurrentPerk;
var Ext_PerkBase FCurrentPerk; var Ext_PerkBase FCurrentPerk;
var int ECurrentPerkLevel,ECurrentPerkPrestige; var int ECurrentPerkLevel,ECurrentPerkPrestige;
var ExtPerkManager PerkManager; var ExtPerkManager PerkManager;
/* AdminTypes:
0 - Super Admin (server owner)
1 - Admin
2 - Moderator
3 - Trusted member
4 - VIP
*/
var string TaggedPlayerName; var string TaggedPlayerName;
var repnotify string NameTag; var repnotify string NameTag;
var repnotify byte RepLevelProgress; var repnotify byte RepLevelProgress;
@ -327,24 +331,26 @@ simulated function RecheckGRI()
simulated final function bool ShowAdminName() simulated final function bool ShowAdminName()
{ {
return (bAdmin || AdminType<255); return (bAdmin || AdminType < AT_Player);
} }
simulated function string GetAdminName() simulated function string GetAdminName()
{ {
switch (AdminType) switch (AdminType)
{ {
case 0: case AT_Global:
return "Super Admin"; return "Super Admin";
case 1: case AT_Admin:
case 255: case AT_Player: // TODO: Admin is the same as player? WTF? #1
return "Admin"; return "Admin";
case 2: case AT_Mod:
return "Mod"; return "Mod";
case 3: case AT_TMem:
return "Trusted Member"; return "Trusted Member";
case 4: case AT_VIP:
return "VIP"; return "VIP";
case AT_Booster:
return "Booster";
} }
} }
@ -352,17 +358,19 @@ simulated function string GetAdminNameAbr()
{ {
switch (AdminType) switch (AdminType)
{ {
case 0: case AT_Global:
return "S"; return "S";
case 1: case AT_Admin:
case 255: case AT_Player: // TODO: Admin is the same as player? WTF? #2
return "A"; return "A";
case 2: case AT_Mod:
return "M"; return "M";
case 3: case AT_TMem:
return "T"; return "T";
case 4: case AT_VIP:
return "V"; return "V";
case AT_Booster:
return "B";
} }
} }
@ -370,17 +378,19 @@ simulated function string GetAdminColor()
{ {
switch (AdminType) switch (AdminType)
{ {
case 0: case AT_Global:
return "FF6600"; return "FF6600";
case 1: case AT_Admin:
case 255: case AT_Player: // TODO: Admin is the same as player? WTF? #3
return "40FFFF"; return "40FFFF";
case 2: case AT_Mod:
return "FF33FF"; return "FF33FF";
case 3: case AT_TMem:
return "FF0000"; return "FF0000";
case 4: case AT_VIP:
return "FFD700"; return "FFD700";
case AT_Booster:
return "32A852";
} }
} }
@ -388,17 +398,19 @@ simulated function color GetAdminColorC()
{ {
switch (AdminType) switch (AdminType)
{ {
case 0: case AT_Global:
return MakeColor(255,102,0,255); return MakeColor(255,102,0,255);
case 1: case AT_Admin:
case 255: case AT_Player: // TODO: Admin is the same as player? WTF? #4
return MakeColor(64,255,255,255); return MakeColor(64,255,255,255);
case 2: case AT_Mod:
return MakeColor(255,51,255,255); return MakeColor(255,51,255,255);
case 3: case AT_TMem:
return MakeColor(255,0,0,255); return MakeColor(255,0,0,255);
case 4: case AT_VIP:
return MakeColor(255,215,0,255); return MakeColor(255,215,0,255);
case AT_Booster:
return MakeColor(50,168,82,255);
} }
} }
@ -804,22 +816,25 @@ event BeginState(Name N)
switch (N) switch (N)
{ {
case 'Global': case 'Global':
AdminType = 0; AdminType = AT_Global;
break; break;
case 'Admin': case 'Admin':
AdminType = 1; AdminType = AT_Admin;
break; break;
case 'Mod': case 'Mod':
AdminType = 2; AdminType = AT_Mod;
break; break;
case 'TMem': case 'TMem':
AdminType = 3; AdminType = AT_TMem;
break; break;
case 'VIP': case 'VIP':
AdminType = 4; AdminType = AT_VIP;
break;
case 'Booster':
AdminType = AT_Booster;
break; break;
case 'User': case 'User':
AdminType = 255; AdminType = AT_Player;
break; break;
} }
} }

View File

@ -298,7 +298,7 @@ event PostRender()
EPRI = ExtPlayerReplicationInfo(KFPlayerOwner.PlayerReplicationInfo); EPRI = ExtPlayerReplicationInfo(KFPlayerOwner.PlayerReplicationInfo);
else if (EPRI.RespawnCounter>0) else if (EPRI.RespawnCounter>0)
DrawRespawnCounter(); DrawRespawnCounter();
bMeAdmin = (EPRI!=None && EPRI.AdminType<=1); bMeAdmin = (EPRI != None && EPRI.AdminType <= AT_Admin);
if (KillMessages.Length>0) if (KillMessages.Length>0)
RenderKillMsg(); RenderKillMsg();
if (DeathMessages.Length>0) if (DeathMessages.Length>0)

View File

@ -125,7 +125,7 @@ function DrawMenu()
if (KFGRI==None) if (KFGRI==None)
return; return;
} }
bMeAdmin = (PC.WorldInfo.NetMode!=NM_Client || (ExtPlayerReplicationInfo(PC.PlayerReplicationInfo)!=None && ExtPlayerReplicationInfo(PC.PlayerReplicationInfo).AdminType<=1)); bMeAdmin = (PC.WorldInfo.NetMode!=NM_Client || (ExtPlayerReplicationInfo(PC.PlayerReplicationInfo) != None && ExtPlayerReplicationInfo(PC.PlayerReplicationInfo).AdminType <= AT_Admin));
// Sort player list. // Sort player list.
for (i=(KFGRI.PRIArray.Length-1); i>0; --i) for (i=(KFGRI.PRIArray.Length-1); i>0; --i)