From 0f488d26c6666d04eec83ead2cc1bc7348e2888a Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Wed, 9 Jun 2021 02:43:00 +0300 Subject: [PATCH] fixes --- ScoreboardExt/Classes/KFScoreBoard.uc | 16 +- ScoreboardExt/Classes/ScoreboardExtMut.uc | 4 +- ScoreboardExt/Classes/ScoreboardExtRepInfo.uc | 42 +-- ScoreboardExt/Classes/Types.uc | 247 +++++++++--------- 4 files changed, 143 insertions(+), 166 deletions(-) diff --git a/ScoreboardExt/Classes/KFScoreBoard.uc b/ScoreboardExt/Classes/KFScoreBoard.uc index 10adbcf..365fb36 100644 --- a/ScoreboardExt/Classes/KFScoreBoard.uc +++ b/ScoreboardExt/Classes/KFScoreBoard.uc @@ -309,9 +309,9 @@ function DrawTextShadowHRightVCenter(string Str, float XPos, float YPos, float B Owner.CurrentStyle.DrawTextShadow(Str, XPos + BoxWidth - TextWidth, YPos, 1, FontScalar); } -function SetDrawColor(Canvas C, ColorRGBA Color) +function SetDrawColor(Canvas C, ColorRGBA RGBA) { - C.SetDrawColor(Color.R, Color.G, Color.B, Color.A); + C.SetDrawColor(RGBA.R, RGBA.G, RGBA.B, RGBA.A); } function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, float Width, bool bFocus ) @@ -347,9 +347,9 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa { if (!HasRank || (HasRank && !CurrentRank.OverrideAdminRank)) { - CurrentRank.Rank = SystemAdminRank; - CurrentRank.TextColor = SystemAdminColor; - CurrentRank.ApplyColorToFields = SystemAdminApplyColorToFields; + CurrentRank.Rank = Settings.SystemAdminRank; + CurrentRank.TextColor = Settings.SystemAdminColor; + CurrentRank.ApplyColorToFields = Settings.SystemAdminApplyColorToFields; HasRank = true; } } @@ -357,9 +357,9 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa { if (!HasRank) { - CurrentRank.Rank = SystemPlayerRank; - CurrentRank.TextColor = SystemPlayerColor; - CurrentRank.ApplyColorToFields = SystemPlayerApplyColorToFields; + CurrentRank.Rank = Settings.SystemPlayerRank; + CurrentRank.TextColor = Settings.SystemPlayerColor; + CurrentRank.ApplyColorToFields = Settings.SystemPlayerApplyColorToFields; HasRank = true; } } diff --git a/ScoreboardExt/Classes/ScoreboardExtMut.uc b/ScoreboardExt/Classes/ScoreboardExtMut.uc index 09c3b11..decc719 100644 --- a/ScoreboardExt/Classes/ScoreboardExtMut.uc +++ b/ScoreboardExt/Classes/ScoreboardExtMut.uc @@ -1,5 +1,5 @@ class ScoreboardExtMut extends KFMutator - dependson(CustomRanks, PlayerRankRelations) + dependson(Types) config(ScoreboardExt); const SteamIDLen = 17; @@ -157,12 +157,14 @@ function AddPlayer(Controller C) RepClient.RepInfo.PlayerRankRelations = UIDRelations; RepClient.RepInfo.CustomRanks = class'CustomRanks'.default.Rank; + /* RepClient.RepInfo.SystemAdminRank = class'SystemAdminRank'.default.Rank; RepClient.RepInfo.SystemAdminColor = class'SystemAdminRank'.default.TextColor; RepClient.RepInfo.SystemAdminApplyColorToFields = class'SystemAdminRank'.default.ApplyColorToFields; RepClient.RepInfo.SystemPlayerRank = class'SystemPlayerRank'.default.Rank; RepClient.RepInfo.SystemPlayerColor = class'SystemPlayerRank'.default.TextColor; RepClient.RepInfo.SystemPlayerApplyColorToFields = class'SystemPlayerRank'.default.ApplyColorToFields; + */ RepClient.RepInfo.ClientStartReplication(); } diff --git a/ScoreboardExt/Classes/ScoreboardExtRepInfo.uc b/ScoreboardExt/Classes/ScoreboardExtRepInfo.uc index ff7f41b..ae85f9a 100644 --- a/ScoreboardExt/Classes/ScoreboardExtRepInfo.uc +++ b/ScoreboardExt/Classes/ScoreboardExtRepInfo.uc @@ -3,13 +3,8 @@ class ScoreboardExtRepInfo extends ReplicationInfo; var public array PlayerRankRelations; var public array CustomRanks; -var public string SystemAdminRank; -var public ColorRGBA SystemAdminColor; -var public Fields SystemAdminApplyColorToFields; - -var public string SystemPlayerRank; -var public ColorRGBA SystemPlayerColor; -var public Fields SystemPlayerApplyColorToFields; +var public SCESettings Settings; +var public SCEStyle Style; var private bool InitFinished, RanksFinished, InfosFinished; var private int InfosReplicateProgress, RanksReplicateProgress; @@ -20,14 +15,7 @@ public function ClientStartReplication() { GetScoreboard(); - ClientInitSystem( - SystemAdminRank, - SystemAdminColor, - SystemAdminApplyColorToFields, - SystemPlayerRank, - SystemPlayerColor, - SystemPlayerApplyColorToFields); - + ClientInit(Settings, Style); SetTimer(0.01f, true, nameof(ClientReplicateRanks)); SetTimer(0.01f, true, nameof(ClientReplicateInfos)); } @@ -94,20 +82,10 @@ private reliable client function InfosReplicationFinished() ClientInfosApply(); } -private reliable client function ClientInitSystem( - string _SystemAdminRank, - ColorRGBA _SystemAdminColor, - Fields _SystemAdminApplyColorToFields, - string _SystemPlayerRank, - ColorRGBA _SystemPlayerColor, - Fields _SystemPlayerApplyColorToFields) +private reliable client function ClientInit(SCESettings _Settings, SCEStyle _Style) { - SystemAdminRank = _SystemAdminRank; - SystemAdminColor = _SystemAdminColor; - SystemAdminApplyColorToFields = _SystemAdminApplyColorToFields; - SystemPlayerRank = _SystemPlayerRank; - SystemPlayerColor = _SystemPlayerColor; - SystemPlayerApplyColorToFields = _SystemPlayerApplyColorToFields; + Settings = _Settings; + Style = _Style; ClientSystemApply(); } @@ -120,12 +98,8 @@ private reliable client function ClientSystemApply() return; } - SC.SystemAdminRank = SystemAdminRank; - SC.SystemAdminColor = SystemAdminColor; - SC.SystemAdminApplyColorToFields = SystemAdminApplyColorToFields; - SC.SystemPlayerRank = SystemPlayerRank; - SC.SystemPlayerColor = SystemPlayerColor; - SC.SystemPlayerApplyColorToFields = SystemPlayerApplyColorToFields; + SC.Settings = Settings; + SC.Style = Style; InitFinished = true; Finished(); diff --git a/ScoreboardExt/Classes/Types.uc b/ScoreboardExt/Classes/Types.uc index 79273ca..83b82d2 100644 --- a/ScoreboardExt/Classes/Types.uc +++ b/ScoreboardExt/Classes/Types.uc @@ -1,38 +1,102 @@ class Types extends Object; +struct ColorRGBA +{ + var byte R, G, B, A; + + StructDefaultProperties + { + R=250 + G=250 + B=250 + A=255 + } +}; + +struct Fields +{ + var bool Rank; + var bool Player; + var bool Perk; + var bool Dosh; + var bool Kills; + var bool Assists; + var bool Health; + var bool Ping; + + StructDefaultProperties + { + Rank = true; + Player = true; + Perk = false; + Dosh = false; + Kills = false; + Assists = false; + Health = false; + Ping = false; + } +}; + +struct RankInfo +{ + var int ID; + var string Rank; + var ColorRGBA TextColor; + var bool OverrideAdminRank; + var Fields ApplyColorToFields; +}; + +struct SteamGroupRankRelation +{ + var string SteamGroupID; + var int RankID; +}; + +struct PlayerRankRelation +{ + var string PlayerID; + var int RankID; +}; + +struct UIDRankRelation +{ + var UniqueNetId UID; + var int RankID; +}; + struct SCESettings { - string SystemAdminRank; - ColorRGBA SystemAdminColor; - Fields SystemAdminApplyColorToFields; + var string SystemAdminRank; + var ColorRGBA SystemAdminColor; + var Fields SystemAdminApplyColorToFields; - string SystemPlayerRank; - ColorRGBA SystemPlayerColor; - Fields SystemPlayerApplyColorToFields; + var string SystemPlayerRank; + var ColorRGBA SystemPlayerColor; + var Fields SystemPlayerApplyColorToFields; - int HP_Low; - int HP_High; + var int HP_Low; + var int HP_High; - int Ping_Low; - int Ping_High; + var int Ping_Low; + var int Ping_High; - int Normal_Low; - int Normal_High; - int Hard_Low; - int Hard_High; - int Suicide_Low; - int Suicide_High; - int HellOnEarth_Low; - int HellOnEarth_High; + var int Normal_Low; + var int Normal_High; + var int Hard_Low; + var int Hard_High; + var int Suicide_Low; + var int Suicide_High; + var int HellOnEarth_Low; + var int HellOnEarth_High; StructDefaultProperties { SystemAdminRank="Admin" - SystemAdminColor=(R=250,G=0,B=0) + SystemAdminColor=(R=250,G=0,B=0,A=255) SystemAdminApplyColorToFields=(Rank=True,Player=True,Perk=False,Dosh=False,Kills=False,Assists=False,Health=False,Ping=False) SystemPlayerRank="Player" - SystemPlayerColor=(R=250,G=250,B=250) + SystemPlayerColor=(R=250,G=250,B=250,A=255) SystemPlayerApplyColorToFields=(Rank=True,Player=True,Perk=False,Dosh=False,Kills=False,Assists=False,Health=False,Ping=False) HP_Low=40 @@ -54,55 +118,55 @@ struct SCESettings struct SCEStyle { - ColorRGBA ServerNameBoxColor; - ColorRGBA ServerNameTextColor + var ColorRGBA ServerNameBoxColor; + var ColorRGBA ServerNameTextColor; - ColorRGBA GameInfoBoxColor; - ColorRGBA GameInfoTextColor; + var ColorRGBA GameInfoBoxColor; + var ColorRGBA GameInfoTextColor; - ColorRGBA WaveBoxColor; - ColorRGBA WaveTextColor; + var ColorRGBA WaveBoxColor; + var ColorRGBA WaveTextColor; - ColorRGBA PlayerCountBoxColor; - ColorRGBA PlayerCountTextColor; + var ColorRGBA PlayerCountBoxColor; + var ColorRGBA PlayerCountTextColor; - ColorRGBA ListHeaderBoxColor; - ColorRGBA ListHeaderTextColor; + var ColorRGBA ListHeaderBoxColor; + var ColorRGBA ListHeaderTextColor; - ColorRGBA LeftHPBoxColorNone; - ColorRGBA LeftHPBoxColorDead; - ColorRGBA LeftHPBoxColorLow; - ColorRGBA LeftHPBoxColorMid; - ColorRGBA LeftHPBoxColorHigh; + var ColorRGBA LeftHPBoxColorNone; + var ColorRGBA LeftHPBoxColorDead; + var ColorRGBA LeftHPBoxColorLow; + var ColorRGBA LeftHPBoxColorMid; + var ColorRGBA LeftHPBoxColorHigh; - ColorRGBA PlayerOwnerBoxColor; - ColorRGBA PlayerBoxColor; - ColorRGBA StatsBoxColor; + var ColorRGBA PlayerOwnerBoxColor; + var ColorRGBA PlayerBoxColor; + var ColorRGBA StatsBoxColor; - ColorRGBA RankTextColor; - ColorRGBA ZedTextColor; - ColorRGBA PerkTextColor; - ColorRGBA LevelTextColor; - ColorRGBA AvatarBorderColor; - ColorRGBA PlayerNameTextColor; - ColorRGBA KillsTextColor; - ColorRGBA AssistsTextColor; - ColorRGBA DoshTextColor; + var ColorRGBA RankTextColor; + var ColorRGBA ZedTextColor; + var ColorRGBA PerkTextColor; + var ColorRGBA LevelTextColor; + var ColorRGBA AvatarBorderColor; + var ColorRGBA PlayerNameTextColor; + var ColorRGBA KillsTextColor; + var ColorRGBA AssistsTextColor; + var ColorRGBA DoshTextColor; - ColorRGBA StateTextColorLobby; - ColorRGBA StateTextColorReady; - ColorRGBA StateTextColorNotReady; - ColorRGBA StateTextColorNone; - ColorRGBA StateTextColorSpectator; - ColorRGBA StateTextColorDead; - ColorRGBA StateTextColorLowHP; - ColorRGBA StateTextColorMidHP; - ColorRGBA StateTextColorHighHP; + var ColorRGBA StateTextColorLobby; + var ColorRGBA StateTextColorReady; + var ColorRGBA StateTextColorNotReady; + var ColorRGBA StateTextColorNone; + var ColorRGBA StateTextColorSpectator; + var ColorRGBA StateTextColorDead; + var ColorRGBA StateTextColorLowHP; + var ColorRGBA StateTextColorMidHP; + var ColorRGBA StateTextColorHighHP; - ColorRGBA PingTextColorNone; - ColorRGBA PingTextColorLow; - ColorRGBA PingTextColorMid - ColorRGBA PingTextColorHigh; + var ColorRGBA PingTextColorNone; + var ColorRGBA PingTextColorLow; + var ColorRGBA PingTextColorMid; + var ColorRGBA PingTextColorHigh; StructDefaultProperties { @@ -156,68 +220,5 @@ struct SCEStyle PingTextColorMid=(R=250,G=250,B=0,A=255) PingTextColorHigh=(R=250,G=0,B=0,A=255) } -} - -struct ColorRGBA -{ - var byte R, G, B, A; - - StructDefaultProperties - { - R=250 - G=250 - B=250 - A=255 - } }; -struct Fields -{ - var bool Rank; - var bool Player; - var bool Perk; - var bool Dosh; - var bool Kills; - var bool Assists; - var bool Health; - var bool Ping; - - StructDefaultProperties - { - Rank = true; - Player = true; - Perk = false; - Dosh = false; - Kills = false; - Assists = false; - Health = false; - Ping = false; - } -}; - -struct RankInfo -{ - var int ID; - var string Rank; - var ColorRGB TextColor; - var bool OverrideAdminRank; - var Fields ApplyColorToFields; -}; - -struct SteamGroupRankRelation -{ - var string SteamGroupID; - var int RankID; -}; - -struct PlayerRankRelation -{ - var string PlayerID; - var int RankID; -}; - -struct UIDRankRelation -{ - var UniqueNetId UID; - var int RankID; -};