From 8ebf92f71069396e88f5f02246e5e9ddade79387 Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Mon, 5 Jul 2021 06:02:30 +0300 Subject: [PATCH] wip --- YAS/Classes/CustomRanks.uc | 37 ++ YAS/Classes/DynamicStateColor.uc | 48 -- YAS/Classes/GUIStyleBase.uc | 36 ++ YAS/Classes/KFScoreBoard.uc | 287 ++++++---- YAS/Classes/PlayerRankRelations.uc | 24 + YAS/Classes/ScoreboardStyle.uc | 540 ++++++++++++++---- YAS/Classes/SettingsArmor.uc | 58 ++ YAS/Classes/SettingsHealth.uc | 58 ++ ...{DynamicLevelColor.uc => SettingsLevel.uc} | 44 +- .../{DynamicPingColor.uc => SettingsPing.uc} | 29 +- YAS/Classes/SteamGroupRankRelations.uc | 19 + YAS/Classes/SystemAdminRank.uc | 17 +- YAS/Classes/SystemPlayerRank.uc | 17 +- YAS/Classes/Types.uc | 309 +++++++--- YAS/Classes/YASMut.uc | 71 +-- 15 files changed, 1145 insertions(+), 449 deletions(-) delete mode 100644 YAS/Classes/DynamicStateColor.uc create mode 100644 YAS/Classes/SettingsArmor.uc create mode 100644 YAS/Classes/SettingsHealth.uc rename YAS/Classes/{DynamicLevelColor.uc => SettingsLevel.uc} (56%) rename YAS/Classes/{DynamicPingColor.uc => SettingsPing.uc} (63%) diff --git a/YAS/Classes/CustomRanks.uc b/YAS/Classes/CustomRanks.uc index 85cab44..d20e3c9 100644 --- a/YAS/Classes/CustomRanks.uc +++ b/YAS/Classes/CustomRanks.uc @@ -6,3 +6,40 @@ class CustomRanks extends Object `include(Logger.uci) var config array Rank; + +public static function InitConfig(int ConfigVersion) +{ + local RankInfo ExampleRank; + + `callstack_static("InitConfig"); + + switch (ConfigVersion) + { + case 0: + // Example rank for player(s) + ExampleRank.ID = 0; + ExampleRank.Rank = "YAS Creator"; + ExampleRank.TextColor.R = 130; + ExampleRank.TextColor.G = 250; + ExampleRank.TextColor.B = 235; + ExampleRank.OverrideAdminRank = false; + default.Rank.AddItem(ExampleRank); + + // Example rank for steam group members + ExampleRank.ID = 1; + ExampleRank.Rank = "MSK-GS"; + ExampleRank.TextColor.R = 130; + ExampleRank.TextColor.G = 250; + ExampleRank.TextColor.B = 130; + ExampleRank.OverrideAdminRank = false; + default.Rank.AddItem(ExampleRank); + + case 2147483647: + StaticSaveConfig(); + } +} + +DefaultProperties +{ + +} \ No newline at end of file diff --git a/YAS/Classes/DynamicStateColor.uc b/YAS/Classes/DynamicStateColor.uc deleted file mode 100644 index 96703ef..0000000 --- a/YAS/Classes/DynamicStateColor.uc +++ /dev/null @@ -1,48 +0,0 @@ -class DynamicStateColor extends Object - dependson(Types) - config(YAS); - -`include(Build.uci) -`include(Logger.uci) - -var config bool bEnabled; -var config int Low; -var config int High; - -public static function YASSettingsState DefaultSettings() -{ - local YASSettingsState Settings; - - `callstack_static("DefaultSettings"); - - return Settings; -} - -public static function YASSettingsState Settings() -{ - local YASSettingsState Settings; - - `callstack_static("Settings"); - - Settings.Dynamic = default.bEnabled; - Settings.Low = default.Low; - Settings.High = default.High; - - return Settings; -} - -public static function WriteSettings(YASSettingsState Settings) -{ - `callstack_static("WriteSettings"); - - default.bEnabled = Settings.Dynamic; - default.Low = Settings.Low; - default.High = Settings.High; - - StaticSaveConfig(); -} - -DefaultProperties -{ - -} \ No newline at end of file diff --git a/YAS/Classes/GUIStyleBase.uc b/YAS/Classes/GUIStyleBase.uc index ddaa149..172327e 100644 --- a/YAS/Classes/GUIStyleBase.uc +++ b/YAS/Classes/GUIStyleBase.uc @@ -1146,6 +1146,42 @@ final function DrawRectBox(float X, float Y, float Width, float Height, int Edge ); break; + case 250: + DrawRectBoxSmart(X, Y, Width, Height, Edge, + ECS_BeveledCorner, // TopLeft + ECS_BeveledCorner, // TopRight + ECS_Corner, // BottomLeft + ECS_Corner // BottomRight + ); + break; + + case 251: + DrawRectBoxSmart(X, Y, Width, Height, Edge, + ECS_BeveledCorner, // TopLeft + ECS_Corner, // TopRight + ECS_BeveledCorner, // BottomLeft + ECS_Corner // BottomRight + ); + break; + + case 252: + DrawRectBoxSmart(X, Y, Width, Height, Edge, + ECS_Corner, // TopLeft + ECS_Corner, // TopRight + ECS_BeveledCorner, // BottomLeft + ECS_BeveledCorner // BottomRight + ); + break; + + case 253: + DrawRectBoxSmart(X, Y, Width, Height, Edge, + ECS_Corner, // TopLeft + ECS_BeveledCorner, // TopRight + ECS_Corner, // BottomLeft + ECS_BeveledCorner // BottomRight + ); + break; + default: // 0 // ______ // / \ diff --git a/YAS/Classes/KFScoreBoard.uc b/YAS/Classes/KFScoreBoard.uc index 16d492d..c0909ba 100644 --- a/YAS/Classes/KFScoreBoard.uc +++ b/YAS/Classes/KFScoreBoard.uc @@ -4,9 +4,10 @@ class KFScoreBoard extends KFGUI_Page `include(Build.uci) `include(Logger.uci) -var transient float RankXPos, LevelXPos, PerkXPos, PlayerXPos, HealthXPos, TimeXPos, KillsXPos, AssistXPos, CashXPos, DeathXPos, PingXPos; -var transient float StatusWBox, PlayerWBox, LevelWBox, PerkWBox, CashWBox, KillsWBox, AssistWBox, HealthWBox, PingWBox; +var transient float HealthXPos, ArmorXPos, RankXPos, PlayerXPos, LevelXPos, PerkXPos, DoshXPos, KillsXPos, AssistXPos, PingXPos; +var transient float HealthWBox, ArmorWBox, RankWBox, PlayerWBox, LevelWBox, PerkWBox, DoshWBox, KillsWBox, AssistWBox, PingWBox; var transient float NextScoreboardRefresh; +var transient int NumPlayer; var int PlayerIndex; var KFGUI_List PlayersList; @@ -22,6 +23,7 @@ var float PingBars; // Cache var array PerkNames; +var array StateVariants; // Ranks var array CustomRanks; @@ -48,6 +50,7 @@ function InitMenu() PlayersList = KFGUI_List(FindComponentID('PlayerList')); OwnerPC = KFPlayerController(GetPlayer()); + // TODO: Remove this crunch if (PerkNames.Length == 0) { PerkNames.AddItem(class'KFGFxMenu_Inventory'.default.PerkFilterString); @@ -62,6 +65,16 @@ function InitMenu() PerkNames.AddItem(class'KFPerk_SWAT'.default.PerkName); PerkNames.AddItem(class'KFPerk_Survivalist'.default.PerkName); } + + if (StateVariants.Length == 0) + { + StateVariants.AddItem(State); + StateVariants.AddItem(Ready); + StateVariants.AddItem(NotReady); + StateVariants.AddItem(Unknown); + StateVariants.AddItem(Dead); + StateVariants.AddItem("ABCDABCD"); + } } static function CheckAvatar(KFPlayerReplicationInfo KFPRI, KFPlayerController PC) @@ -129,9 +142,10 @@ function DrawMenu() local PlayerController PC; local KFPlayerReplicationInfo KFPRI; local PlayerReplicationInfo PRI; - local float XPos, YPos, YL, XL, FontScalar, XPosCenter, BoxW, BoxX, BoxH, MinBoxW, DoshSize; - local int i, j, NumSpec, NumPlayer, NumAlivePlayer, Width; + local float XPos, YPos, YL, XL, FontScalar, XPosCenter, BoxW, BoxX, BoxH, MinBoxW, DoshSize, ScrollBarWidth; + local int i, j, NumSpec, NumAlivePlayer, Width; local float BorderSize; + local ColorRGBA ColorTmp; PC = GetPlayer(); if (KFGRI == None) @@ -271,7 +285,7 @@ function DrawMenu() YPos += YL; BoxH = YL + BorderSize; SetDrawColor(Canvas, Settings.Style.ListHeaderBoxColor); - Owner.CurrentStyle.DrawRectBox( XPos - BorderSize * 2, + Owner.CurrentStyle.DrawRectBox( XPos - BorderSize * 2, YPos, Width + BorderSize * 4, BoxH, @@ -281,24 +295,44 @@ function DrawMenu() // Calc X offsets MinBoxW = Width * 0.07; // minimum width for column - RankXPos = Owner.HUDOwner.ScaledBorderSize * 8 + Settings.Style.EdgeSize; - PlayerXPos = Width * 0.20; + // Health + HealthXPos = 0; + BoxW = 0; + foreach StateVariants(S) + { + Canvas.TextSize(S, XL, YL, FontScalar, FontScalar); + if (XL > BoxW) BoxW = XL; + } + HealthWBox = (BoxW < MinBoxW ? MinBoxW : BoxW) * 0.5 + BorderSize * 2; + + // Armor + ArmorXPos = HealthXPos + HealthWBox; + ArmorWBox = HealthWBox; + + RankXPos = ArmorXPos + ArmorWBox + Settings.Style.EdgeSize; + + PlayerXPos = Width * 0.30; // TODO Canvas.TextSize(class'KFGFxHUD_ScoreboardWidget'.default.PingString$" ", XL, YL, FontScalar, FontScalar); - PingXPos = Width - (XL < MinBoxW ? MinBoxW : XL); - - Canvas.TextSize(State$" ", XL, YL, FontScalar, FontScalar); - HealthXPos = PingXPos - (XL < MinBoxW ? MinBoxW : XL); + PingWBox = XL < MinBoxW ? MinBoxW : XL; + if (NumPlayer <= 16) // TODO: Replace hardcoded 16 + ScrollBarWidth = 0; + else + ScrollBarWidth = BorderSize * 8; + PingXPos = Width - PingWBox - ScrollBarWidth; Canvas.TextSize(class'KFGFxHUD_ScoreboardWidget'.default.AssistsString$" ", XL, YL, FontScalar, FontScalar); - AssistXPos = HealthXPos - (XL < MinBoxW ? MinBoxW : XL); + AssistWBox = XL < MinBoxW ? MinBoxW : XL; + AssistXPos = PingXPos - AssistWBox; Canvas.TextSize(class'KFGFxHUD_ScoreboardWidget'.default.KillsString$" ", XL, YL, FontScalar, FontScalar); - KillsXPos = AssistXPos - (XL < MinBoxW ? MinBoxW : XL); + KillsWBox = XL < MinBoxW ? MinBoxW : XL; + KillsXPos = AssistXPos - KillsWBox; Canvas.TextSize(class'KFGFxHUD_ScoreboardWidget'.default.DoshString$" ", XL, YL, FontScalar, FontScalar); Canvas.TextSize("999999", DoshSize, YL, FontScalar, FontScalar); - CashXPos = KillsXPos - (XL < DoshSize ? DoshSize : XL); + DoshWBox = XL < DoshSize ? DoshSize : XL; + DoshXPos = KillsXPos - DoshWBox; BoxW = 0; foreach PerkNames(S) @@ -306,21 +340,13 @@ function DrawMenu() Canvas.TextSize(S$"A", XL, YL, FontScalar, FontScalar); if (XL > BoxW) BoxW = XL; } - PerkXPos = CashXPos - (BoxW < MinBoxW ? MinBoxW : BoxW); + PerkWBox = BoxW < MinBoxW ? MinBoxW : BoxW; + PerkXPos = DoshXPos - PerkWBox; Canvas.TextSize("000", XL, YL, FontScalar, FontScalar); - LevelXPos = PerkXPos - XL; + LevelWBox = XL; + LevelXPos = PerkXPos - LevelWBox; - StatusWBox = PlayerXPos - RankXPos; - PlayerWBox = LevelXPos - PlayerXPos; - LevelWBox = PerkXPos - LevelXPos; - PerkWBox = CashXPos - PerkXPos; - CashWBox = KillsXPos - CashXPos; - KillsWBox = AssistXPos - KillsXPos; - AssistWBox = HealthXPos - AssistXPos; - HealthWBox = PingXPos - HealthXPos; - PingWBox = Width - PingXPos; - // Header texts SetDrawColor(Canvas, Settings.Style.ListHeaderTextColor); DrawTextShadowHLeftVCenter(Rank, XPos + RankXPos, YPos, FontScalar); @@ -328,9 +354,15 @@ function DrawMenu() DrawTextShadowHLeftVCenter(class'KFGFxMenu_Inventory'.default.PerkFilterString, XPos + PerkXPos, YPos, FontScalar); DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.KillsString, XPos + KillsXPos, YPos, KillsWBox, FontScalar); DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.AssistsString, XPos + AssistXPos, YPos, AssistWBox, FontScalar); - DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.DoshString, XPos + CashXPos, YPos, CashWBox, FontScalar); - DrawTextShadowHVCenter(State, XPos + HealthXPos, YPos, HealthWBox, FontScalar); + DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.DoshString, XPos + DoshXPos, YPos, DoshWBox, FontScalar); DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.PingString, XPos + PingXPos, YPos, PingWBox, FontScalar); + + ColorTmp = Settings.Style.ListHeaderTextColor; + ColorTmp.A = 150; + SetDrawColor(Canvas, ColorTmp); + + DrawHealthIcon(XPos + HealthXPos, YPos, HealthWBox, BoxH); + DrawArmorIcon(XPos + ArmorXPos, YPos, ArmorWBox, BoxH); PlayersList.XPosition = ((Canvas.ClipX - Width) * 0.5) / InputPos[2]; PlayersList.YPosition = (YPos + YL + BorderSize * 4) / InputPos[3]; @@ -339,6 +371,39 @@ function DrawMenu() PlayersList.ChangeListSize(KFPRIArray.Length); } +function DrawHealthIcon(float X, float Y, float W, float H) +{ + local float XPos, YPos, Size, Part; + + Size = H * 0.65; + Part = Size / 3; + + XPos = X + (W * 0.5 - Part * 0.5); + YPos = Y + (H * 0.5 - Size * 0.5); + Owner.CurrentStyle.DrawRectBox(XPos, YPos, Part, Part, 4, 100); + + XPos = X + (W * 0.5 - Size * 0.5); + YPos = Y + (H * 0.5 - Part * 0.5); + Owner.CurrentStyle.DrawRectBox(XPos, YPos, Size, Part, 4, 100); + + XPos = X + (W * 0.5 - Part * 0.5); + YPos = Y + (H * 0.5 + Part * 0.5); + Owner.CurrentStyle.DrawRectBox(XPos, YPos, Part, Part, 4, 100); +} + +function DrawArmorIcon(float X, float Y, float W, float H) +{ + local float XPos, YPos, Size; + local int Edge; + + Edge = 6; + Size = H * 0.65; + + XPos = X + (W * 0.5 - Size * 0.5); + YPos = Y + (H * 0.5 - Size * 0.5); + Owner.CurrentStyle.DrawRectBox(XPos, YPos, Size, Size, Edge, 252); +} + function DrawTextShadowHVCenter(string Str, float XPos, float YPos, float BoxWidth, float FontScalar) { local float TextWidth; @@ -375,6 +440,8 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float local float FontScalar, TextYOffset, XL, YL, PerkIconPosX, PerkIconPosY, PerkIconSize, PrestigeIconScale; local float XPos, BoxWidth, RealPlayerWBox; local KFPlayerReplicationInfo KFPRI; + local KFPlayerController KFPC; + local KFPawn_Human KFPH; local byte Level, PrestigeLevel; local bool bIsZED; local int Ping; @@ -383,6 +450,10 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float local bool HasRank; local int PlayerInfoIndex, PlayerRankIndex; local int Shape; + local float BorderSize; + local int Armor, MaxArmor; + + BorderSize = Owner.HUDOwner.ScaledBorderSize; YOffset *= 1.05; KFPRI = KFPRIArray[Index]; @@ -420,7 +491,6 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float HasRank = true; } } - // Now all players belongs to 'Rank' if (KFGRI.bVersusGame) bIsZED = KFTeamInfo_Zeds(KFPRI.Team) != None; @@ -430,6 +500,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float C.Font = Owner.CurrentStyle.PickFont(FontScalar); Canvas.TextSize("ABC", XL, YL, FontScalar, FontScalar); + TextYOffset = YOffset + (Height * 0.5f) - (YL * 0.5f); // change rect color by HP if (!KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun) @@ -458,9 +529,6 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float SetDrawColor(C, Settings.Style.LeftStateBoxColorLow); } - if (!Settings.State.Dynamic) - SetDrawColor(C, Settings.Style.LeftStateBoxColor); - if (KFPRIArray.Length > 1 && Index == 0) Shape = Settings.Style.ShapeLeftStateBoxTopPlayer; else if (KFPRIArray.Length > 1 && Index == KFPRIArray.Length - 1) @@ -468,17 +536,92 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float else Shape = Settings.Style.ShapeLeftStateBoxMidPlayer; - BoxWidth = Owner.HUDOwner.ScaledBorderSize * 8; - Owner.CurrentStyle.DrawRectBox( XPos, + // Health + Owner.CurrentStyle.DrawRectBox(XPos, YOffset, - BoxWidth, + HealthWBox, + Height, + Settings.Style.EdgeSize, + Shape); + + if (!KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun) + { + SetDrawColor(C, Settings.Style.StateTextColorLobby); + S = class'KFGFxMenu_ServerBrowser'.default.InLobbyString;; + } + else if (!KFGRI.bMatchHasBegun) + { + if (KFPRI.bReadyToPlay) + { + SetDrawColor(C, Settings.Style.StateTextColorReady); + S = Ready; + } + else + { + SetDrawColor(C, Settings.Style.StateTextColorNotReady); + S = NotReady; + } + } + else if (bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None) + { + SetDrawColor(C, Settings.Style.StateTextColor); + S = Unknown; + } + else if (KFPRI.PlayerHealth <= 0 || KFPRI.PlayerHealthPercent <= 0) + { + if (KFPRI.bOnlySpectator) + { + SetDrawColor(C, Settings.Style.StateTextColorSpectator); + S = class'KFCommon_LocalizedStrings'.default.SpectatorString; + } + else + { + SetDrawColor(C, Settings.Style.StateTextColorDead); + S = Dead; + } + } + else + { + if (ByteToFloat(KFPRI.PlayerHealthPercent) >= float(Settings.State.High) / 100.0) + SetDrawColor(C, Settings.Style.StateTextColorHighHP); + else if (ByteToFloat(KFPRI.PlayerHealthPercent) >= float(Settings.State.Low) / 100.0) + SetDrawColor(C, Settings.Style.StateTextColorMidHP); + else + SetDrawColor(C, Settings.Style.StateTextColorLowHP); + S = String(KFPRI.PlayerHealth); + } + + if (CurrentRank.ApplyColorToFields.Health) + SetDrawColor(C, CurrentRank.TextColor); + DrawTextShadowHVCenter(S, HealthXPos, TextYOffset, HealthWBox, FontScalar); + + XPos += HealthWBox; + + // Armor + C.SetDrawColor(0, 0, 200, 200); + Owner.CurrentStyle.DrawRectBox(XPos, + YOffset, + ArmorWBox, Height, Settings.Style.EdgeSize, Shape); - XPos += BoxWidth; + KFPC = KFPlayerController(KFPRI.Owner); + if (KFPC != None) + { + KFPH = KFPawn_Human(KFPC.Pawn); + if (KFPH != None) + { + Armor = int(KFPH.Armor); + MaxArmor = int(KFPH.MaxArmor); + } + } + C.SetDrawColor(250, 250, 250, 250); + S = String(Armor); + DrawTextShadowHVCenter(S, ArmorXPos, TextYOffset, HealthWBox, FontScalar); + XPos += ArmorWBox; - TextYOffset = YOffset + (Height * 0.5f) - (YL * 0.5f); + // PlayerBox if (PlayerIndex == Index) SetDrawColor(C, Settings.Style.PlayerOwnerBoxColor); else @@ -491,7 +634,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float else Shape = Settings.Style.ShapePlayerBoxMidPlayer; - BoxWidth = CashXPos - BoxWidth - Owner.HUDOwner.ScaledBorderSize * 2; + BoxWidth = DoshXPos - (HealthWBox + ArmorWBox) - BorderSize * 2; Owner.CurrentStyle.DrawRectBox(XPos, YOffset, BoxWidth, Height, Settings.Style.EdgeSize, Shape); XPos += BoxWidth; @@ -543,9 +686,9 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float PrestigeLevel = KFPRI.GetActivePerkPrestigeLevel(); Level = KFPRI.GetActivePerkLevel(); - PerkIconPosY = YOffset + (Owner.HUDOwner.ScaledBorderSize * 2); - PerkIconSize = Height-(Owner.HUDOwner.ScaledBorderSize * 4); - PerkIconPosX = LevelXPos - PerkIconSize - (Owner.HUDOwner.ScaledBorderSize*2); + PerkIconPosY = YOffset + (BorderSize * 2); + PerkIconSize = Height-(BorderSize * 4); + PerkIconPosX = LevelXPos - PerkIconSize - (BorderSize*2); PrestigeIconScale = 0.6625f; RealPlayerWBox = PerkIconPosX - PlayerXPos; @@ -567,8 +710,6 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float if (CurrentRank.ApplyColorToFields.Level) SetDrawColor(C, CurrentRank.TextColor); - else if (!Settings.Level.Dynamic) - SetDrawColor(C, Settings.Style.LevelTextColor); else { if (Level < Settings.Level.Low[KFGRI.GameDifficulty]) @@ -642,7 +783,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float SetDrawColor(C, Settings.Style.AssistsTextColor); DrawTextShadowHVCenter(string (KFPRI.Assists), AssistXPos, TextYOffset, AssistWBox, FontScalar); - // Cash + // Dosh if (bIsZED) { SetDrawColor(C, Settings.Style.ZedTextColor); @@ -656,61 +797,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float SetDrawColor(C, Settings.Style.DoshTextColor); StrValue = String(int(KFPRI.Score)); //StrValue = GetNiceSize(int(KFPRI.Score)); } - DrawTextShadowHVCenter(StrValue, CashXPos, TextYOffset, CashWBox, FontScalar); - - // State - if (!KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun) - { - SetDrawColor(C, Settings.Style.StateTextColorLobby); - S = class'KFGFxMenu_ServerBrowser'.default.InLobbyString;; - } - else if (!KFGRI.bMatchHasBegun) - { - if (KFPRI.bReadyToPlay) - { - SetDrawColor(C, Settings.Style.StateTextColorReady); - S = Ready; - } - else - { - SetDrawColor(C, Settings.Style.StateTextColorNotReady); - S = NotReady; - } - } - else if (bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None) - { - SetDrawColor(C, Settings.Style.StateTextColor); - S = Unknown; - } - else if (KFPRI.PlayerHealth <= 0 || KFPRI.PlayerHealthPercent <= 0) - { - if (KFPRI.bOnlySpectator) - { - SetDrawColor(C, Settings.Style.StateTextColorSpectator); - S = class'KFCommon_LocalizedStrings'.default.SpectatorString; - } - else - { - SetDrawColor(C, Settings.Style.StateTextColorDead); - S = Dead; - } - } - else - { - if (ByteToFloat(KFPRI.PlayerHealthPercent) >= float(Settings.State.High) / 100.0) - SetDrawColor(C, Settings.Style.StateTextColorHighHP); - else if (ByteToFloat(KFPRI.PlayerHealthPercent) >= float(Settings.State.Low) / 100.0) - SetDrawColor(C, Settings.Style.StateTextColorMidHP); - else - SetDrawColor(C, Settings.Style.StateTextColorLowHP); - S = string(KFPRI.PlayerHealth)@"HP"; - } - - if (CurrentRank.ApplyColorToFields.Health) - SetDrawColor(C, CurrentRank.TextColor); - else if (!Settings.State.Dynamic) - SetDrawColor(C, Settings.Style.StateTextColor); - DrawTextShadowHVCenter(S, HealthXPos, TextYOffset, HealthWBox, FontScalar); + DrawTextShadowHVCenter(StrValue, DoshXPos, TextYOffset, DoshWBox, FontScalar); // Ping if (KFPRI.bBot) @@ -738,7 +825,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float DrawTextShadowHVCenter(S, PingXPos, TextYOffset, Settings.Ping.ShowPingBars ? PingWBox/2 : PingWBox, FontScalar); C.SetDrawColor(250, 250, 250, 255); if (Settings.Ping.ShowPingBars) - DrawPingBars(C, YOffset + (Height/2) - ((Height*0.5)/2), Width - (Height*0.5) - (Owner.HUDOwner.ScaledBorderSize*2), Height*0.5, Height*0.5, float(Ping)); + DrawPingBars(C, YOffset + (Height/2) - ((Height*0.5)/2), Width - (Height*0.5) - (BorderSize*2), Height*0.5, Height*0.5, float(Ping)); } final function DrawPingBars(Canvas C, float YOffset, float XOffset, float W, float H, float Ping) diff --git a/YAS/Classes/PlayerRankRelations.uc b/YAS/Classes/PlayerRankRelations.uc index f47f2ef..2b7bf50 100644 --- a/YAS/Classes/PlayerRankRelations.uc +++ b/YAS/Classes/PlayerRankRelations.uc @@ -6,3 +6,27 @@ class PlayerRankRelations extends Object `include(Logger.uci) var config array Relation; + +public static function InitConfig(int ConfigVersion) +{ + local RankRelation ExamplePlayer; + + `callstack_static("InitConfig"); + + switch (ConfigVersion) + { + case 0: + // Example player + ExamplePlayer.ObjectID = "76561198001617867"; // GenZmeY SteamID64 + ExamplePlayer.RankID = 0; + default.Relation.AddItem(ExamplePlayer); + + case 2147483647: + StaticSaveConfig(); + } +} + +DefaultProperties +{ + +} \ No newline at end of file diff --git a/YAS/Classes/ScoreboardStyle.uc b/YAS/Classes/ScoreboardStyle.uc index ff7b29d..f058db4 100644 --- a/YAS/Classes/ScoreboardStyle.uc +++ b/YAS/Classes/ScoreboardStyle.uc @@ -5,6 +5,7 @@ class ScoreboardStyle extends Object `include(Build.uci) `include(Logger.uci) +// Box shapes var config int EdgeSize; var config int ShapeServerNameBox; var config int ShapeGameInfoBox; @@ -20,46 +21,189 @@ var config int ShapePlayerBoxBottomPlayer; var config int ShapeStatsBoxTopPlayer; var config int ShapeStatsBoxMidPlayer; var config int ShapeStatsBoxBottomPlayer; + +// Server box var config ColorRGBA ServerNameBoxColor; var config ColorRGBA ServerNameTextColor; + +// Game info box var config ColorRGBA GameInfoBoxColor; var config ColorRGBA GameInfoTextColor; + +// Wave info box var config ColorRGBA WaveBoxColor; var config ColorRGBA WaveTextColor; + +// Player count box var config ColorRGBA PlayerCountBoxColor; var config ColorRGBA PlayerCountTextColor; + +// Header box var config ColorRGBA ListHeaderBoxColor; var config ColorRGBA ListHeaderTextColor; -var config ColorRGBA LeftStateBoxColor; -var config ColorRGBA LeftStateBoxColorDead; -var config ColorRGBA LeftStateBoxColorLow; -var config ColorRGBA LeftStateBoxColorMid; -var config ColorRGBA LeftStateBoxColorHigh; + +// State box +var config ColorRGBA StateBoxColorLobby; +var config ColorRGBA StateBoxColorReady; +var config ColorRGBA StateBoxColorNotReady; +var config ColorRGBA StateBoxColorSpectator; +var config ColorRGBA StateBoxColorDead; +var config ColorRGBA StateBoxColorHPLow; +var config ColorRGBA StateBoxColorHPMid; +var config ColorRGBA StateBoxColorHPHigh; +var config ColorRGBA StateBoxColorArmorLow; +var config ColorRGBA StateBoxColorArmorMid; +var config ColorRGBA StateBoxColorArmorHigh; + +// Player box var config ColorRGBA PlayerOwnerBoxColor; var config ColorRGBA PlayerBoxColor; + +// Stats box +var config ColorRGBA StatsOwnerBoxColor; var config ColorRGBA StatsBoxColor; -var config ColorRGBA RankTextColor; -var config ColorRGBA ZedTextColor; -var config ColorRGBA PerkTextColor; -var config ColorRGBA LevelTextColor; -var config ColorRGBA PlayerNameTextColor; -var config ColorRGBA KillsTextColor; -var config ColorRGBA AssistsTextColor; -var config ColorRGBA DoshTextColor; + +// State text var config ColorRGBA StateTextColorLobby; var config ColorRGBA StateTextColorReady; var config ColorRGBA StateTextColorNotReady; -var config ColorRGBA StateTextColor; var config ColorRGBA StateTextColorSpectator; var config ColorRGBA StateTextColorDead; -var config ColorRGBA StateTextColorLowHP; -var config ColorRGBA StateTextColorMidHP; -var config ColorRGBA StateTextColorHighHP; -var config ColorRGBA PingTextColor; +var config ColorRGBA StateTextColorHPLow; +var config ColorRGBA StateTextColorHPMid; +var config ColorRGBA StateTextColorHPHigh; +var config ColorRGBA StateTextColorArmorLow; +var config ColorRGBA StateTextColorArmorMid; +var config ColorRGBA StateTextColorArmorHigh; + +// Rank text +var config ColorRGBA RankTextColor; + +// Player text +var config ColorRGBA PlayerNameTextColor; + +// Level text +var config ColorRGBA LevelTextColorLow; +var config ColorRGBA LevelTextColorMid; +var config ColorRGBA LevelTextColorHigh; + +// Perk text +var config ColorRGBA ZedTextColor; +var config ColorRGBA PerkNoneTextColor; +var config ColorRGBA PerkBerserkerTextColor; +var config ColorRGBA PerkCommandoTextColor; +var config ColorRGBA PerkSupportTextColor; +var config ColorRGBA PerkFieldMedicTextColor; +var config ColorRGBA PerkDemolitionistTextColor; +var config ColorRGBA PerkFirebugTextColor; +var config ColorRGBA PerkGunslingerTextColor; +var config ColorRGBA PerkSharpshooterTextColor; +var config ColorRGBA PerkSwatTextColor; +var config ColorRGBA PerkSurvivalistTextColor; + +// Dosh text +var config ColorRGBA DoshTextColorLow; +var config ColorRGBA DoshTextColorMid; +var config ColorRGBA DoshTextColorHigh; + +// Kills text +var config ColorRGBA KillsTextColorLow; +var config ColorRGBA KillsTextColorMid; +var config ColorRGBA KillsTextColorHigh; + +// Assists text +var config ColorRGBA AssistsTextColorLow; +var config ColorRGBA AssistsTextColorMid; +var config ColorRGBA AssistsTextColorHigh; + +// Ping text var config ColorRGBA PingTextColorLow; var config ColorRGBA PingTextColorMid; var config ColorRGBA PingTextColorHigh; +// Other settings +var config bool bShowPingBars; +var config bool bHealthBoxSmoothColorChange; +var config bool bArmorBoxSmoothColorChange; +var config bool bHealthTextSmoothColorChange; +var config bool bArmorTextSmoothColorChange; +var config bool bLevelTextSmoothColorChange; +var config bool bDoshTextSmoothColorChange; +var config bool bKillsTextSmoothColorChange; +var config bool bAssistsTextSmoothColorChange; +var config bool bPingTextSmoothColorChange; + +public static function InitConfig(int ConfigVersion) +{ + local YASStyle DefaultStyle; + + `callstack_static("InitConfig"); + + switch (ConfigVersion) + { + case 0: + WriteSettings(DefaultSettings()); + + case 1: + default.AssistsTextColorHigh = DefaultStyle.AssistsTextColorHigh; + default.AssistsTextColorLow = DefaultStyle.AssistsTextColorLow; + default.AssistsTextColorMid = DefaultStyle.AssistsTextColorMid; + default.bArmorBoxSmoothColorChange = DefaultStyle.bArmorBoxSmoothColorChange; + default.bArmorTextSmoothColorChange = DefaultStyle.bArmorTextSmoothColorChange; + default.bAssistsTextSmoothColorChange = DefaultStyle.bAssistsTextSmoothColorChange; + default.bDoshTextSmoothColorChange = DefaultStyle.bDoshTextSmoothColorChange; + default.bHealthBoxSmoothColorChange = DefaultStyle.bHealthBoxSmoothColorChange; + default.bHealthTextSmoothColorChange = DefaultStyle.bHealthTextSmoothColorChange; + default.bKillsTextSmoothColorChange = DefaultStyle.bKillsTextSmoothColorChange; + default.bLevelTextSmoothColorChange = DefaultStyle.bLevelTextSmoothColorChange; + default.bPingTextSmoothColorChange = DefaultStyle.bPingTextSmoothColorChange; + default.bShowPingBars = DefaultStyle.bShowPingBars; + default.DoshTextColorHigh = DefaultStyle.DoshTextColorHigh; + default.DoshTextColorLow = DefaultStyle.DoshTextColorLow; + default.DoshTextColorMid = DefaultStyle.DoshTextColorMid; + default.KillsTextColorHigh = DefaultStyle.KillsTextColorHigh; + default.KillsTextColorLow = DefaultStyle.KillsTextColorLow; + default.KillsTextColorMid = DefaultStyle.KillsTextColorMid; + default.LevelTextColorHigh = DefaultStyle.LevelTextColorHigh; + default.LevelTextColorLow = DefaultStyle.LevelTextColorLow; + default.LevelTextColorMid = DefaultStyle.LevelTextColorMid; + default.PerkBerserkerTextColor = DefaultStyle.PerkBerserkerTextColor; + default.PerkCommandoTextColor = DefaultStyle.PerkCommandoTextColor; + default.PerkDemolitionistTextColor = DefaultStyle.PerkDemolitionistTextColor; + default.PerkFieldMedicTextColor = DefaultStyle.PerkFieldMedicTextColor; + default.PerkFirebugTextColor = DefaultStyle.PerkFirebugTextColor; + default.PerkGunslingerTextColor = DefaultStyle.PerkGunslingerTextColor; + default.PerkNoneTextColor = DefaultStyle.PerkNoneTextColor; + default.PerkSharpshooterTextColor = DefaultStyle.PerkSharpshooterTextColor; + default.PerkSupportTextColor = DefaultStyle.PerkSupportTextColor; + default.PerkSurvivalistTextColor = DefaultStyle.PerkSurvivalistTextColor; + default.PerkSwatTextColor = DefaultStyle.PerkSwatTextColor; + default.StateBoxColorArmorHigh = DefaultStyle.StateBoxColorArmorHigh; + default.StateBoxColorArmorLow = DefaultStyle.StateBoxColorArmorLow; + default.StateBoxColorArmorMid = DefaultStyle.StateBoxColorArmorMid; + default.StateBoxColorDead = DefaultStyle.StateBoxColorDead; + default.StateBoxColorHPHigh = DefaultStyle.StateBoxColorHPHigh; + default.StateBoxColorHPLow = DefaultStyle.StateBoxColorHPLow; + default.StateBoxColorHPMid = DefaultStyle.StateBoxColorHPMid; + default.StateBoxColorLobby = DefaultStyle.StateBoxColorLobby; + default.StateBoxColorNotReady = DefaultStyle.StateBoxColorNotReady; + default.StateBoxColorReady = DefaultStyle.StateBoxColorReady; + default.StateBoxColorSpectator = DefaultStyle.StateBoxColorSpectator; + default.StateTextColorArmorHigh = DefaultStyle.StateTextColorArmorHigh; + default.StateTextColorArmorLow = DefaultStyle.StateTextColorArmorLow; + default.StateTextColorArmorMid = DefaultStyle.StateTextColorArmorMid; + default.StateTextColorHPHigh = DefaultStyle.StateTextColorHPHigh; + default.StateTextColorHPLow = DefaultStyle.StateTextColorHPLow; + default.StateTextColorHPMid = DefaultStyle.StateTextColorHPMid; + default.StatsOwnerBoxColor = DefaultStyle.StatsOwnerBoxColor; + + WriteSettings(Settings()); + + case 2147483647: + StaticSaveConfig(); + } +} + public static function YASStyle DefaultSettings() { local YASStyle Settings; @@ -75,60 +219,133 @@ public static function YASStyle Settings() `callstack_static("Settings"); - Settings.EdgeSize = default.EdgeSize; - Settings.ShapeServerNameBox = default.ShapeServerNameBox; - Settings.ShapeGameInfoBox = default.ShapeGameInfoBox; - Settings.ShapeWaveInfoBox = default.ShapeWaveInfoBox; - Settings.ShapePlayersCountBox = default.ShapePlayersCountBox; - Settings.ShapeHeaderBox = default.ShapeHeaderBox; - Settings.ShapeLeftStateBoxTopPlayer = default.ShapeLeftStateBoxTopPlayer; - Settings.ShapeLeftStateBoxMidPlayer = default.ShapeLeftStateBoxMidPlayer; + // Box shapes + Settings.EdgeSize = default.EdgeSize; + Settings.ShapeServerNameBox = default.ShapeServerNameBox; + Settings.ShapeGameInfoBox = default.ShapeGameInfoBox; + Settings.ShapeWaveInfoBox = default.ShapeWaveInfoBox; + Settings.ShapePlayersCountBox = default.ShapePlayersCountBox; + Settings.ShapeHeaderBox = default.ShapeHeaderBox; + Settings.ShapeLeftStateBoxTopPlayer = default.ShapeLeftStateBoxTopPlayer; + Settings.ShapeLeftStateBoxMidPlayer = default.ShapeLeftStateBoxMidPlayer; Settings.ShapeLeftStateBoxBottomPlayer = default.ShapeLeftStateBoxBottomPlayer; - Settings.ShapePlayerBoxTopPlayer = default.ShapePlayerBoxTopPlayer; - Settings.ShapePlayerBoxMidPlayer = default.ShapePlayerBoxMidPlayer; - Settings.ShapePlayerBoxBottomPlayer = default.ShapePlayerBoxBottomPlayer; - Settings.ShapeStatsBoxTopPlayer = default.ShapeStatsBoxTopPlayer; - Settings.ShapeStatsBoxMidPlayer = default.ShapeStatsBoxMidPlayer; - Settings.ShapeStatsBoxBottomPlayer = default.ShapeStatsBoxBottomPlayer; - Settings.ServerNameBoxColor = default.ServerNameBoxColor; - Settings.ServerNameTextColor = default.ServerNameTextColor; - Settings.GameInfoBoxColor = default.GameInfoBoxColor; - Settings.GameInfoTextColor = default.GameInfoTextColor; - Settings.WaveBoxColor = default.WaveBoxColor; - Settings.WaveTextColor = default.WaveTextColor; - Settings.PlayerCountBoxColor = default.PlayerCountBoxColor; - Settings.PlayerCountTextColor = default.PlayerCountTextColor; - Settings.ListHeaderBoxColor = default.ListHeaderBoxColor; - Settings.ListHeaderTextColor = default.ListHeaderTextColor; - Settings.LeftStateBoxColor = default.LeftStateBoxColor; - Settings.LeftStateBoxColorDead = default.LeftStateBoxColorDead; - Settings.LeftStateBoxColorLow = default.LeftStateBoxColorLow; - Settings.LeftStateBoxColorMid = default.LeftStateBoxColorMid; - Settings.LeftStateBoxColorHigh = default.LeftStateBoxColorHigh; - Settings.PlayerOwnerBoxColor = default.PlayerOwnerBoxColor; - Settings.PlayerBoxColor = default.PlayerBoxColor; - Settings.StatsBoxColor = default.StatsBoxColor; - Settings.RankTextColor = default.RankTextColor; - Settings.ZedTextColor = default.ZedTextColor; - Settings.PerkTextColor = default.PerkTextColor; - Settings.LevelTextColor = default.LevelTextColor; - Settings.PlayerNameTextColor = default.PlayerNameTextColor; - Settings.KillsTextColor = default.KillsTextColor; - Settings.AssistsTextColor = default.AssistsTextColor; - Settings.DoshTextColor = default.DoshTextColor; - Settings.StateTextColorLobby = default.StateTextColorLobby; - Settings.StateTextColorReady = default.StateTextColorReady; - Settings.StateTextColorNotReady = default.StateTextColorNotReady; - Settings.StateTextColor = default.StateTextColor; - Settings.StateTextColorSpectator = default.StateTextColorSpectator; - Settings.StateTextColorDead = default.StateTextColorDead; - Settings.StateTextColorLowHP = default.StateTextColorLowHP; - Settings.StateTextColorMidHP = default.StateTextColorMidHP; - Settings.StateTextColorHighHP = default.StateTextColorHighHP; - Settings.PingTextColor = default.PingTextColor; - Settings.PingTextColorLow = default.PingTextColorLow; - Settings.PingTextColorMid = default.PingTextColorMid; - Settings.PingTextColorHigh = default.PingTextColorHigh; + Settings.ShapePlayerBoxTopPlayer = default.ShapePlayerBoxTopPlayer; + Settings.ShapePlayerBoxMidPlayer = default.ShapePlayerBoxMidPlayer; + Settings.ShapePlayerBoxBottomPlayer = default.ShapePlayerBoxBottomPlayer; + Settings.ShapeStatsBoxTopPlayer = default.ShapeStatsBoxTopPlayer; + Settings.ShapeStatsBoxMidPlayer = default.ShapeStatsBoxMidPlayer; + Settings.ShapeStatsBoxBottomPlayer = default.ShapeStatsBoxBottomPlayer; + + // Server box + Settings.ServerNameBoxColor = default.ServerNameBoxColor; + Settings.ServerNameTextColor = default.ServerNameTextColor; + + // Game info box + Settings.GameInfoBoxColor = default.GameInfoBoxColor; + Settings.GameInfoTextColor = default.GameInfoTextColor; + + // Wave info box + Settings.WaveBoxColor = default.WaveBoxColor; + Settings.WaveTextColor = default.WaveTextColor; + + // Player count box + Settings.PlayerCountBoxColor = default.PlayerCountBoxColor; + Settings.PlayerCountTextColor = default.PlayerCountTextColor; + + // Header box + Settings.ListHeaderBoxColor = default.ListHeaderBoxColor; + Settings.ListHeaderTextColor = default.ListHeaderTextColor; + + // State box + Settings.StateBoxColorLobby = default.StateBoxColorLobby; + Settings.StateBoxColorReady = default.StateBoxColorReady; + Settings.StateBoxColorNotReady = default.StateBoxColorNotReady; + Settings.StateBoxColorSpectator = default.StateBoxColorSpectator; + Settings.StateBoxColorDead = default.StateBoxColorDead; + Settings.StateBoxColorHPLow = default.StateBoxColorHPLow; + Settings.StateBoxColorHPMid = default.StateBoxColorHPMid; + Settings.StateBoxColorHPHigh = default.StateBoxColorHPHigh; + Settings.StateBoxColorArmorLow = default.StateBoxColorArmorLow; + Settings.StateBoxColorArmorMid = default.StateBoxColorArmorMid; + Settings.StateBoxColorArmorHigh = default.StateBoxColorArmorHigh; + + // Player box + Settings.PlayerOwnerBoxColor = default.PlayerOwnerBoxColor; + Settings.PlayerBoxColor = default.PlayerBoxColor; + + // Stats box + Settings.StatsOwnerBoxColor = default.StatsOwnerBoxColor; + Settings.StatsBoxColor = default.StatsBoxColor; + + // State text + Settings.StateTextColorLobby = default.StateTextColorLobby; + Settings.StateTextColorReady = default.StateTextColorReady; + Settings.StateTextColorNotReady = default.StateTextColorNotReady; + Settings.StateTextColorSpectator = default.StateTextColorSpectator; + Settings.StateTextColorDead = default.StateTextColorDead; + Settings.StateTextColorHPLow = default.StateTextColorHPLow; + Settings.StateTextColorHPMid = default.StateTextColorHPMid; + Settings.StateTextColorHPHigh = default.StateTextColorHPHigh; + Settings.StateTextColorArmorLow = default.StateTextColorArmorLow; + Settings.StateTextColorArmorMid = default.StateTextColorArmorMid; + Settings.StateTextColorArmorHigh = default.StateTextColorArmorHigh; + + // Rank text + Settings.RankTextColor = default.RankTextColor; + + // Player text + Settings.PlayerNameTextColor = default.PlayerNameTextColor; + + // Level text + Settings.LevelTextColorLow = default.LevelTextColorLow; + Settings.LevelTextColorMid = default.LevelTextColorMid; + Settings.LevelTextColorHigh = default.LevelTextColorHigh; + + // Perk text + Settings.ZedTextColor = default.ZedTextColor; + Settings.PerkNoneTextColor = default.PerkNoneTextColor; + Settings.PerkBerserkerTextColor = default.PerkBerserkerTextColor; + Settings.PerkCommandoTextColor = default.PerkCommandoTextColor; + Settings.PerkSupportTextColor = default.PerkSupportTextColor; + Settings.PerkFieldMedicTextColor = default.PerkFieldMedicTextColor; + Settings.PerkDemolitionistTextColor = default.PerkDemolitionistTextColor; + Settings.PerkFirebugTextColor = default.PerkFirebugTextColor; + Settings.PerkGunslingerTextColor = default.PerkGunslingerTextColor; + Settings.PerkSharpshooterTextColor = default.PerkSharpshooterTextColor; + Settings.PerkSwatTextColor = default.PerkSwatTextColor; + Settings.PerkSurvivalistTextColor = default.PerkSurvivalistTextColor; + + // Dosh text + Settings.DoshTextColorLow = default.DoshTextColorLow; + Settings.DoshTextColorMid = default.DoshTextColorMid; + Settings.DoshTextColorHigh = default.DoshTextColorHigh; + + // Kills text + Settings.KillsTextColorLow = default.KillsTextColorLow; + Settings.KillsTextColorMid = default.KillsTextColorMid; + Settings.KillsTextColorHigh = default.KillsTextColorHigh; + + // Assists text + Settings.AssistsTextColorLow = default.AssistsTextColorLow; + Settings.AssistsTextColorMid = default.AssistsTextColorMid; + Settings.AssistsTextColorHigh = default.AssistsTextColorHigh; + + // Ping text + Settings.PingTextColorLow = default.PingTextColorLow; + Settings.PingTextColorMid = default.PingTextColorMid; + Settings.PingTextColorHigh = default.PingTextColorHigh; + + // Other settings + Settings.bShowPingBars = default.bShowPingBars; + Settings.bHealthBoxSmoothColorChange = default.bHealthBoxSmoothColorChange; + Settings.bArmorBoxSmoothColorChange = default.bArmorBoxSmoothColorChange; + Settings.bHealthTextSmoothColorChange = default.bHealthTextSmoothColorChange; + Settings.bArmorTextSmoothColorChange = default.bArmorTextSmoothColorChange; + Settings.bLevelTextSmoothColorChange = default.bLevelTextSmoothColorChange; + Settings.bDoshTextSmoothColorChange = default.bDoshTextSmoothColorChange; + Settings.bKillsTextSmoothColorChange = default.bKillsTextSmoothColorChange; + Settings.bAssistsTextSmoothColorChange = default.bAssistsTextSmoothColorChange; + Settings.bPingTextSmoothColorChange = default.bPingTextSmoothColorChange; return Settings; } @@ -137,62 +354,133 @@ public static function WriteSettings(YASStyle Settings) { `callstack_static("WriteSettings"); - default.EdgeSize = Settings.EdgeSize; - default.ShapeServerNameBox = Settings.ShapeServerNameBox; - default.ShapeGameInfoBox = Settings.ShapeGameInfoBox; - default.ShapeWaveInfoBox = Settings.ShapeWaveInfoBox; - default.ShapePlayersCountBox = Settings.ShapePlayersCountBox; - default.ShapeHeaderBox = Settings.ShapeHeaderBox; - default.ShapeLeftStateBoxTopPlayer = Settings.ShapeLeftStateBoxTopPlayer; - default.ShapeLeftStateBoxMidPlayer = Settings.ShapeLeftStateBoxMidPlayer; - default.ShapeLeftStateBoxBottomPlayer = Settings.ShapeLeftStateBoxBottomPlayer; - default.ShapePlayerBoxTopPlayer = Settings.ShapePlayerBoxTopPlayer; - default.ShapePlayerBoxMidPlayer = Settings.ShapePlayerBoxMidPlayer; - default.ShapePlayerBoxBottomPlayer = Settings.ShapePlayerBoxBottomPlayer; - default.ShapeStatsBoxTopPlayer = Settings.ShapeStatsBoxTopPlayer; - default.ShapeStatsBoxMidPlayer = Settings.ShapeStatsBoxMidPlayer; - default.ShapeStatsBoxBottomPlayer = Settings.ShapeStatsBoxBottomPlayer; - default.ServerNameBoxColor = Settings.ServerNameBoxColor; - default.ServerNameTextColor = Settings.ServerNameTextColor; - default.GameInfoBoxColor = Settings.GameInfoBoxColor; - default.GameInfoTextColor = Settings.GameInfoTextColor; - default.WaveBoxColor = Settings.WaveBoxColor; - default.WaveTextColor = Settings.WaveTextColor; - default.PlayerCountBoxColor = Settings.PlayerCountBoxColor; - default.PlayerCountTextColor = Settings.PlayerCountTextColor; - default.ListHeaderBoxColor = Settings.ListHeaderBoxColor; - default.ListHeaderTextColor = Settings.ListHeaderTextColor; - default.LeftStateBoxColor = Settings.LeftStateBoxColor; - default.LeftStateBoxColorDead = Settings.LeftStateBoxColorDead; - default.LeftStateBoxColorLow = Settings.LeftStateBoxColorLow; - default.LeftStateBoxColorMid = Settings.LeftStateBoxColorMid; - default.LeftStateBoxColorHigh = Settings.LeftStateBoxColorHigh; - default.PlayerOwnerBoxColor = Settings.PlayerOwnerBoxColor; - default.PlayerBoxColor = Settings.PlayerBoxColor; - default.StatsBoxColor = Settings.StatsBoxColor; - default.RankTextColor = Settings.RankTextColor; - default.ZedTextColor = Settings.ZedTextColor; - default.PerkTextColor = Settings.PerkTextColor; - default.LevelTextColor = Settings.LevelTextColor; - default.PlayerNameTextColor = Settings.PlayerNameTextColor; - default.KillsTextColor = Settings.KillsTextColor; - default.AssistsTextColor = Settings.AssistsTextColor; - default.DoshTextColor = Settings.DoshTextColor; - default.StateTextColorLobby = Settings.StateTextColorLobby; - default.StateTextColorReady = Settings.StateTextColorReady; - default.StateTextColorNotReady = Settings.StateTextColorNotReady; - default.StateTextColor = Settings.StateTextColor; - default.StateTextColorSpectator = Settings.StateTextColorSpectator; - default.StateTextColorDead = Settings.StateTextColorDead; - default.StateTextColorLowHP = Settings.StateTextColorLowHP; - default.StateTextColorMidHP = Settings.StateTextColorMidHP; - default.StateTextColorHighHP = Settings.StateTextColorHighHP; - default.PingTextColor = Settings.PingTextColor; - default.PingTextColorLow = Settings.PingTextColorLow; - default.PingTextColorMid = Settings.PingTextColorMid; - default.PingTextColorHigh = Settings.PingTextColorHigh; + // Box shapes + default.EdgeSize = Settings.EdgeSize; + default.ShapeServerNameBox = Settings.ShapeServerNameBox; + default.ShapeGameInfoBox = Settings.ShapeGameInfoBox; + default.ShapeWaveInfoBox = Settings.ShapeWaveInfoBox; + default.ShapePlayersCountBox = Settings.ShapePlayersCountBox; + default.ShapeHeaderBox = Settings.ShapeHeaderBox; + default.ShapeLeftStateBoxTopPlayer = Settings.ShapeLeftStateBoxTopPlayer; + default.ShapeLeftStateBoxMidPlayer = Settings.ShapeLeftStateBoxMidPlayer; + default.ShapeLeftStateBoxBottomPlayer = Settings.ShapeLeftStateBoxBottomPlayer; + default.ShapePlayerBoxTopPlayer = Settings.ShapePlayerBoxTopPlayer; + default.ShapePlayerBoxMidPlayer = Settings.ShapePlayerBoxMidPlayer; + default.ShapePlayerBoxBottomPlayer = Settings.ShapePlayerBoxBottomPlayer; + default.ShapeStatsBoxTopPlayer = Settings.ShapeStatsBoxTopPlayer; + default.ShapeStatsBoxMidPlayer = Settings.ShapeStatsBoxMidPlayer; + default.ShapeStatsBoxBottomPlayer = Settings.ShapeStatsBoxBottomPlayer; + + // Server box + default.ServerNameBoxColor = Settings.ServerNameBoxColor; + default.ServerNameTextColor = Settings.ServerNameTextColor; + + // Game info box + default.GameInfoBoxColor = Settings.GameInfoBoxColor; + default.GameInfoTextColor = Settings.GameInfoTextColor; + + // Wave info box + default.WaveBoxColor = Settings.WaveBoxColor; + default.WaveTextColor = Settings.WaveTextColor; + + // Player count box + default.PlayerCountBoxColor = Settings.PlayerCountBoxColor; + default.PlayerCountTextColor = Settings.PlayerCountTextColor; + + // Header box + default.ListHeaderBoxColor = Settings.ListHeaderBoxColor; + default.ListHeaderTextColor = Settings.ListHeaderTextColor; + + // State box + default.StateBoxColorLobby = Settings.StateBoxColorLobby; + default.StateBoxColorReady = Settings.StateBoxColorReady; + default.StateBoxColorNotReady = Settings.StateBoxColorNotReady; + default.StateBoxColorSpectator = Settings.StateBoxColorSpectator; + default.StateBoxColorDead = Settings.StateBoxColorDead; + default.StateBoxColorHPLow = Settings.StateBoxColorHPLow; + default.StateBoxColorHPMid = Settings.StateBoxColorHPMid; + default.StateBoxColorHPHigh = Settings.StateBoxColorHPHigh; + default.StateBoxColorArmorLow = Settings.StateBoxColorArmorLow; + default.StateBoxColorArmorMid = Settings.StateBoxColorArmorMid; + default.StateBoxColorArmorHigh = Settings.StateBoxColorArmorHigh; + + // Player box + default.PlayerOwnerBoxColor = Settings.PlayerOwnerBoxColor; + default.PlayerBoxColor = Settings.PlayerBoxColor; + + // Stats box + default.StatsOwnerBoxColor = Settings.StatsOwnerBoxColor; + default.StatsBoxColor = Settings.StatsBoxColor; + + // State text + default.StateTextColorLobby = Settings.StateTextColorLobby; + default.StateTextColorReady = Settings.StateTextColorReady; + default.StateTextColorNotReady = Settings.StateTextColorNotReady; + default.StateTextColorSpectator = Settings.StateTextColorSpectator; + default.StateTextColorDead = Settings.StateTextColorDead; + default.StateTextColorHPLow = Settings.StateTextColorHPLow; + default.StateTextColorHPMid = Settings.StateTextColorHPMid; + default.StateTextColorHPHigh = Settings.StateTextColorHPHigh; + default.StateTextColorArmorLow = Settings.StateTextColorArmorLow; + default.StateTextColorArmorMid = Settings.StateTextColorArmorMid; + default.StateTextColorArmorHigh = Settings.StateTextColorArmorHigh; + + // Rank text + default.RankTextColor = Settings.RankTextColor; + + // Player text + default.PlayerNameTextColor = Settings.PlayerNameTextColor; + + // Level text + default.LevelTextColorLow = Settings.LevelTextColorLow; + default.LevelTextColorMid = Settings.LevelTextColorMid; + default.LevelTextColorHigh = Settings.LevelTextColorHigh; + + // Perk text + default.ZedTextColor = Settings.ZedTextColor; + default.PerkNoneTextColor = Settings.PerkNoneTextColor; + default.PerkBerserkerTextColor = Settings.PerkBerserkerTextColor; + default.PerkCommandoTextColor = Settings.PerkCommandoTextColor; + default.PerkSupportTextColor = Settings.PerkSupportTextColor; + default.PerkFieldMedicTextColor = Settings.PerkFieldMedicTextColor; + default.PerkDemolitionistTextColor = Settings.PerkDemolitionistTextColor; + default.PerkFirebugTextColor = Settings.PerkFirebugTextColor; + default.PerkGunslingerTextColor = Settings.PerkGunslingerTextColor; + default.PerkSharpshooterTextColor = Settings.PerkSharpshooterTextColor; + default.PerkSwatTextColor = Settings.PerkSwatTextColor; + default.PerkSurvivalistTextColor = Settings.PerkSurvivalistTextColor; + + // Dosh text + default.DoshTextColorLow = Settings.DoshTextColorLow; + default.DoshTextColorMid = Settings.DoshTextColorMid; + default.DoshTextColorHigh = Settings.DoshTextColorHigh; + + // Kills text + default.KillsTextColorLow = Settings.KillsTextColorLow; + default.KillsTextColorMid = Settings.KillsTextColorMid; + default.KillsTextColorHigh = Settings.KillsTextColorHigh; + + // Assists text + default.AssistsTextColorLow = Settings.AssistsTextColorLow; + default.AssistsTextColorMid = Settings.AssistsTextColorMid; + default.AssistsTextColorHigh = Settings.AssistsTextColorHigh; + + // Ping text + default.PingTextColorLow = Settings.PingTextColorLow; + default.PingTextColorMid = Settings.PingTextColorMid; + default.PingTextColorHigh = Settings.PingTextColorHigh; - StaticSaveConfig(); + // Other settings + default.bShowPingBars = Settings.bShowPingBars; + default.bHealthBoxSmoothColorChange = Settings.bHealthBoxSmoothColorChange; + default.bArmorBoxSmoothColorChange = Settings.bArmorBoxSmoothColorChange; + default.bHealthTextSmoothColorChange = Settings.bHealthTextSmoothColorChange; + default.bArmorTextSmoothColorChange = Settings.bArmorTextSmoothColorChange; + default.bLevelTextSmoothColorChange = Settings.bLevelTextSmoothColorChange; + default.bDoshTextSmoothColorChange = Settings.bDoshTextSmoothColorChange; + default.bKillsTextSmoothColorChange = Settings.bKillsTextSmoothColorChange; + default.bAssistsTextSmoothColorChange = Settings.bAssistsTextSmoothColorChange; + default.bPingTextSmoothColorChange = Settings.bPingTextSmoothColorChange; } defaultProperties diff --git a/YAS/Classes/SettingsArmor.uc b/YAS/Classes/SettingsArmor.uc new file mode 100644 index 0000000..e1fd454 --- /dev/null +++ b/YAS/Classes/SettingsArmor.uc @@ -0,0 +1,58 @@ +class SettingsArmor extends Object + dependson(Types) + config(YAS); + +`include(Build.uci) +`include(Logger.uci) + +var config int Low; +var config int High; + +public static function InitConfig(int ConfigVersion) +{ + `callstack_static("InitConfig"); + + switch (ConfigVersion) + { + case 0: + case 1: + WriteSettings(DefaultSettings()); + + case 2147483647: + StaticSaveConfig(); + } +} + +public static function YASSettingsArmor DefaultSettings() +{ + local YASSettingsArmor Settings; + + `callstack_static("DefaultSettings"); + + return Settings; +} + +public static function YASSettingsArmor Settings() +{ + local YASSettingsArmor Settings; + + `callstack_static("Settings"); + + Settings.Low = default.Low; + Settings.High = default.High; + + return Settings; +} + +public static function WriteSettings(YASSettingsArmor Settings) +{ + `callstack_static("WriteSettings"); + + default.Low = Settings.Low; + default.High = Settings.High; +} + +DefaultProperties +{ + +} \ No newline at end of file diff --git a/YAS/Classes/SettingsHealth.uc b/YAS/Classes/SettingsHealth.uc new file mode 100644 index 0000000..e4418df --- /dev/null +++ b/YAS/Classes/SettingsHealth.uc @@ -0,0 +1,58 @@ +class SettingsHealth extends Object + dependson(Types) + config(YAS); + +`include(Build.uci) +`include(Logger.uci) + +var config int Low; +var config int High; + +public static function InitConfig(int ConfigVersion) +{ + `callstack_static("InitConfig"); + + switch (ConfigVersion) + { + case 0: + case 1: + WriteSettings(DefaultSettings()); + + case 2147483647: + StaticSaveConfig(); + } +} + +public static function YASSettingsHealth DefaultSettings() +{ + local YASSettingsHealth Settings; + + `callstack_static("DefaultSettings"); + + return Settings; +} + +public static function YASSettingsHealth Settings() +{ + local YASSettingsHealth Settings; + + `callstack_static("Settings"); + + Settings.Low = default.Low; + Settings.High = default.High; + + return Settings; +} + +public static function WriteSettings(YASSettingsHealth Settings) +{ + `callstack_static("WriteSettings"); + + default.Low = Settings.Low; + default.High = Settings.High; +} + +DefaultProperties +{ + +} \ No newline at end of file diff --git a/YAS/Classes/DynamicLevelColor.uc b/YAS/Classes/SettingsLevel.uc similarity index 56% rename from YAS/Classes/DynamicLevelColor.uc rename to YAS/Classes/SettingsLevel.uc index 6202e51..02cad51 100644 --- a/YAS/Classes/DynamicLevelColor.uc +++ b/YAS/Classes/SettingsLevel.uc @@ -1,11 +1,10 @@ -class DynamicLevelColor extends Object +class SettingsLevel extends Object dependson(Types) config(YAS); `include(Build.uci) `include(Logger.uci) -var config bool bEnabled; var config int Normal_Low; var config int Normal_High; var config int Hard_Low; @@ -15,6 +14,21 @@ var config int Suicide_High; var config int HellOnEarth_Low; var config int HellOnEarth_High; +public static function InitConfig(int ConfigVersion) +{ + `callstack_static("InitConfig"); + + switch (ConfigVersion) + { + case 0: + case 1: + WriteSettings(DefaultSettings()); + + case 2147483647: + StaticSaveConfig(); + } +} + public static function YASSettingsLevel DefaultSettings() { local YASSettingsLevel Settings; @@ -30,14 +44,13 @@ public static function YASSettingsLevel Settings() `callstack_static("Settings"); - Settings.Dynamic = default.bEnabled; - Settings.Low[0] = default.Normal_Low; + Settings.Low [0] = default.Normal_Low; Settings.High[0] = default.Normal_High; - Settings.Low[1] = default.Hard_Low; + Settings.Low [1] = default.Hard_Low; Settings.High[1] = default.Hard_High; - Settings.Low[2] = default.Suicide_Low; + Settings.Low [2] = default.Suicide_Low; Settings.High[2] = default.Suicide_High; - Settings.Low[3] = default.HellOnEarth_Low; + Settings.Low [3] = default.HellOnEarth_Low; Settings.High[3] = default.HellOnEarth_High; return Settings; @@ -47,17 +60,14 @@ public static function WriteSettings(YASSettingsLevel Settings) { `callstack_static("WriteSettings"); - default.bEnabled = Settings.Dynamic; - default.Normal_Low = Settings.Low[0]; - default.Normal_High = Settings.High[0]; - default.Hard_Low = Settings.Low[1]; - default.Hard_High = Settings.High[1]; - default.Suicide_Low = Settings.Low[2]; - default.Suicide_High = Settings.High[2]; - default.HellOnEarth_Low = Settings.Low[3]; + default.Normal_Low = Settings.Low [0]; + default.Normal_High = Settings.High[0]; + default.Hard_Low = Settings.Low [1]; + default.Hard_High = Settings.High[1]; + default.Suicide_Low = Settings.Low [2]; + default.Suicide_High = Settings.High[2]; + default.HellOnEarth_Low = Settings.Low [3]; default.HellOnEarth_High = Settings.High[3]; - - StaticSaveConfig(); } DefaultProperties diff --git a/YAS/Classes/DynamicPingColor.uc b/YAS/Classes/SettingsPing.uc similarity index 63% rename from YAS/Classes/DynamicPingColor.uc rename to YAS/Classes/SettingsPing.uc index d8b3d19..31356d9 100644 --- a/YAS/Classes/DynamicPingColor.uc +++ b/YAS/Classes/SettingsPing.uc @@ -1,14 +1,27 @@ -class DynamicPingColor extends Object +class SettingsPing extends Object dependson(Types) config(YAS); `include(Build.uci) `include(Logger.uci) -var config bool bEnabled; var config int Low; var config int High; -var config bool bShowPingBars; + +public static function InitConfig(int ConfigVersion) +{ + `callstack_static("InitConfig"); + + switch (ConfigVersion) + { + case 0: + case 1: + WriteSettings(DefaultSettings()); + + case 2147483647: + StaticSaveConfig(); + } +} public static function YASSettingsPing DefaultSettings() { @@ -25,10 +38,8 @@ public static function YASSettingsPing Settings() `callstack_static("Settings"); - Settings.Dynamic = default.bEnabled; - Settings.Low = default.Low; + Settings.Low = default.Low; Settings.High = default.High; - Settings.ShowPingBars = default.bShowPingBars; return Settings; } @@ -37,12 +48,8 @@ public static function WriteSettings(YASSettingsPing Settings) { `callstack_static("WriteSettings"); - default.bEnabled = Settings.Dynamic; - default.Low = Settings.Low; + default.Low = Settings.Low; default.High = Settings.High; - default.bShowPingBars = Settings.ShowPingBars; - - StaticSaveConfig(); } DefaultProperties diff --git a/YAS/Classes/SteamGroupRankRelations.uc b/YAS/Classes/SteamGroupRankRelations.uc index 9905067..ae656ea 100644 --- a/YAS/Classes/SteamGroupRankRelations.uc +++ b/YAS/Classes/SteamGroupRankRelations.uc @@ -7,6 +7,25 @@ class SteamGroupRankRelations extends Object var config array Relation; +public static function InitConfig(int ConfigVersion) +{ + local RankRelation ExampleSteamGroup; + + `callstack_static("InitConfig"); + + switch (ConfigVersion) + { + case 0: + // Example steam group + ExampleSteamGroup.ObjectID = "103582791465384046"; // MSK-GS SteamID64 + ExampleSteamGroup.RankID = 1; + default.Relation.AddItem(ExampleSteamGroup); + + case 2147483647: + StaticSaveConfig(); + } +} + DefaultProperties { diff --git a/YAS/Classes/SystemAdminRank.uc b/YAS/Classes/SystemAdminRank.uc index 769e401..5af53ca 100644 --- a/YAS/Classes/SystemAdminRank.uc +++ b/YAS/Classes/SystemAdminRank.uc @@ -9,6 +9,21 @@ var config string Rank; var config ColorRGBA TextColor; var config Fields ApplyColorToFields; +public static function InitConfig(int ConfigVersion) +{ + `callstack_static("InitConfig"); + + switch (ConfigVersion) + { + case 0: + case 1: + WriteSettings(DefaultSettings()); + + case 2147483647: + StaticSaveConfig(); + } +} + public static function YASSettingsAdmin DefaultSettings() { local YASSettingsAdmin Settings; @@ -38,8 +53,6 @@ public static function WriteSettings(YASSettingsAdmin Settings) default.Rank = Settings.Rank; default.TextColor = Settings.TextColor; default.ApplyColorToFields = Settings.ApplyColorToFields; - - StaticSaveConfig(); } DefaultProperties diff --git a/YAS/Classes/SystemPlayerRank.uc b/YAS/Classes/SystemPlayerRank.uc index 9503c00..5e81ea2 100644 --- a/YAS/Classes/SystemPlayerRank.uc +++ b/YAS/Classes/SystemPlayerRank.uc @@ -9,6 +9,21 @@ var config string Rank; var config ColorRGBA TextColor; var config Fields ApplyColorToFields; +public static function InitConfig(int ConfigVersion) +{ + `callstack_static("InitConfig"); + + switch (ConfigVersion) + { + case 0: + case 1: + WriteSettings(DefaultSettings()); + + case 2147483647: + StaticSaveConfig(); + } +} + public static function YASSettingsPlayer DefaultSettings() { local YASSettingsPlayer Settings; @@ -38,8 +53,6 @@ public static function WriteSettings(YASSettingsPlayer Settings) default.Rank = Settings.Rank; default.TextColor = Settings.TextColor; default.ApplyColorToFields = Settings.ApplyColorToFields; - - StaticSaveConfig(); } DefaultProperties diff --git a/YAS/Classes/Types.uc b/YAS/Classes/Types.uc index 2c3d64d..0e08332 100644 --- a/YAS/Classes/Types.uc +++ b/YAS/Classes/Types.uc @@ -101,40 +101,45 @@ struct YASSettingsPlayer } }; -struct YASSettingsState +struct YASSettingsHealth { - var bool Dynamic; var int Low; var int High; StructDefaultProperties { - Dynamic = True - Low = 40 - High = 80 + Low = 40 + High = 80 + } +}; + +struct YASSettingsArmor +{ + var int Low; + var int High; + + StructDefaultProperties + { + Low = 40 + High = 80 } }; struct YASSettingsPing { - var bool Dynamic; var int Low; var int High; - var bool ShowPingBars; StructDefaultProperties { - Dynamic = True - Low = 60 - High = 120 - ShowPingBars = True + Low = 60 + High = 120 } }; struct YASSettingsLevel { - var bool Dynamic; - var int Low[4]; + var int Low [4]; var int High[4]; StructDefaultProperties @@ -153,6 +158,7 @@ struct YASSettingsLevel struct YASStyle { + // Box shapes var int EdgeSize; var int ShapeServerNameBox; var int ShapeGameInfoBox; @@ -168,64 +174,123 @@ struct YASStyle var int ShapeStatsBoxTopPlayer; var int ShapeStatsBoxMidPlayer; var int ShapeStatsBoxBottomPlayer; - + + // Server box var ColorRGBA ServerNameBoxColor; var ColorRGBA ServerNameTextColor; - + + // Game info box var ColorRGBA GameInfoBoxColor; var ColorRGBA GameInfoTextColor; - + + // Wave info box var ColorRGBA WaveBoxColor; var ColorRGBA WaveTextColor; - + + // Player count box var ColorRGBA PlayerCountBoxColor; var ColorRGBA PlayerCountTextColor; - + + // Header box var ColorRGBA ListHeaderBoxColor; var ColorRGBA ListHeaderTextColor; - - var ColorRGBA LeftStateBoxColor; - var ColorRGBA LeftStateBoxColorDead; - var ColorRGBA LeftStateBoxColorLow; - var ColorRGBA LeftStateBoxColorMid; - var ColorRGBA LeftStateBoxColorHigh; - + + // State box + var ColorRGBA StateBoxColorLobby; + var ColorRGBA StateBoxColorReady; + var ColorRGBA StateBoxColorNotReady; + var ColorRGBA StateBoxColorSpectator; + var ColorRGBA StateBoxColorDead; + var ColorRGBA StateBoxColorHPLow; + var ColorRGBA StateBoxColorHPMid; + var ColorRGBA StateBoxColorHPHigh; + var ColorRGBA StateBoxColorArmorLow; + var ColorRGBA StateBoxColorArmorMid; + var ColorRGBA StateBoxColorArmorHigh; + + // Player box var ColorRGBA PlayerOwnerBoxColor; var ColorRGBA PlayerBoxColor; - var ColorRGBA StatsBoxColor; - - var ColorRGBA RankTextColor; - var ColorRGBA ZedTextColor; - var ColorRGBA PerkTextColor; - var ColorRGBA LevelTextColor; - var ColorRGBA PlayerNameTextColor; - var ColorRGBA KillsTextColor; - var ColorRGBA AssistsTextColor; - var ColorRGBA DoshTextColor; - var ColorRGBA StateTextColor; - var ColorRGBA PingTextColor; - - var ColorRGBA LevelTextColorLow; - var ColorRGBA LevelTextColorMid; - var ColorRGBA LevelTextColorHigh; + // Stats box + var ColorRGBA StatsOwnerBoxColor; + var ColorRGBA StatsBoxColor; + + // State text var ColorRGBA StateTextColorLobby; var ColorRGBA StateTextColorReady; var ColorRGBA StateTextColorNotReady; var ColorRGBA StateTextColorSpectator; var ColorRGBA StateTextColorDead; - var ColorRGBA StateTextColorLowHP; - var ColorRGBA StateTextColorMidHP; - var ColorRGBA StateTextColorHighHP; - + var ColorRGBA StateTextColorHPLow; + var ColorRGBA StateTextColorHPMid; + var ColorRGBA StateTextColorHPHigh; + var ColorRGBA StateTextColorArmorLow; + var ColorRGBA StateTextColorArmorMid; + var ColorRGBA StateTextColorArmorHigh; + + // Rank text + var ColorRGBA RankTextColor; + + // Player text + var ColorRGBA PlayerNameTextColor; + + // Level text + var ColorRGBA LevelTextColorLow; + var ColorRGBA LevelTextColorMid; + var ColorRGBA LevelTextColorHigh; + + // Perk text + var ColorRGBA ZedTextColor; + var ColorRGBA PerkNoneTextColor; + var ColorRGBA PerkBerserkerTextColor; + var ColorRGBA PerkCommandoTextColor; + var ColorRGBA PerkSupportTextColor; + var ColorRGBA PerkFieldMedicTextColor; + var ColorRGBA PerkDemolitionistTextColor; + var ColorRGBA PerkFirebugTextColor; + var ColorRGBA PerkGunslingerTextColor; + var ColorRGBA PerkSharpshooterTextColor; + var ColorRGBA PerkSwatTextColor; + var ColorRGBA PerkSurvivalistTextColor; + + // Dosh text + var ColorRGBA DoshTextColorLow; + var ColorRGBA DoshTextColorMid; + var ColorRGBA DoshTextColorHigh; + + // Kills text + var ColorRGBA KillsTextColorLow; + var ColorRGBA KillsTextColorMid; + var ColorRGBA KillsTextColorHigh; + + // Assists text + var ColorRGBA AssistsTextColorLow; + var ColorRGBA AssistsTextColorMid; + var ColorRGBA AssistsTextColorHigh; + + // Ping text var ColorRGBA PingTextColorLow; var ColorRGBA PingTextColorMid; var ColorRGBA PingTextColorHigh; + + // Other settings + var bool bShowPingBars; + var bool bHealthBoxSmoothColorChange; + var bool bArmorBoxSmoothColorChange; + var bool bHealthTextSmoothColorChange; + var bool bArmorTextSmoothColorChange; + var bool bLevelTextSmoothColorChange; + var bool bDoshTextSmoothColorChange; + var bool bKillsTextSmoothColorChange; + var bool bAssistsTextSmoothColorChange; + var bool bPingTextSmoothColorChange; StructDefaultProperties { EdgeSize = 8 + // Box shapes ShapeServerNameBox = 150 ShapeGameInfoBox = 151 ShapeWaveInfoBox = 0 @@ -241,68 +306,128 @@ struct YASStyle ShapeStatsBoxMidPlayer = 153 ShapeStatsBoxBottomPlayer = 153 - ServerNameBoxColor = (R=75, G=0, B=0, A=200) - ServerNameTextColor = (R=250, G=250, B=250, A=255) + // Server box + ServerNameBoxColor = (R=75, G=0, B=0, A=200) + ServerNameTextColor = (R=250, G=250, B=250, A=255) - GameInfoBoxColor = (R=30, G=30, B=30, A=200) - GameInfoTextColor = (R=250, G=250, B=250, A=255) + // Game info box + GameInfoBoxColor = (R=30, G=30, B=30, A=200) + GameInfoTextColor = (R=250, G=250, B=250, A=255) - WaveBoxColor = (R=10, G=10, B=10, A=200) - WaveTextColor = (R=250, G=250, B=250, A=255) + // Wave info box + WaveBoxColor = (R=10, G=10, B=10, A=200) + WaveTextColor = (R=250, G=250, B=250, A=255) - PlayerCountBoxColor = (R=75, G=0, B=0, A=200) - PlayerCountTextColor = (R=250, G=250, B=250, A=255) + // Player count box + PlayerCountBoxColor = (R=75, G=0, B=0, A=200) + PlayerCountTextColor = (R=250, G=250, B=250, A=255) - ListHeaderBoxColor = (R=10, G=10, B=10, A=200) - ListHeaderTextColor = (R=250, G=250, B=250, A=255) + // Header box + ListHeaderBoxColor = (R=10, G=10, B=10, A=200) + ListHeaderTextColor = (R=250, G=250, B=250, A=255) - LeftStateBoxColor = (R=150, G=150, B=150, A=150) - LeftStateBoxColorDead = (R=200, G=0, B=0, A=150) - LeftStateBoxColorLow = (R=200, G=50, B=50, A=150) - LeftStateBoxColorMid = (R=200, G=200, B=0, A=150) - LeftStateBoxColorHigh = (R=0, G=200, B=0, A=150) + // State box + StateBoxColorLobby = (R=150, G=150, B=150, A=150) + StateBoxColorReady = (R=150, G=150, B=150, A=150) + StateBoxColorNotReady = (R=150, G=150, B=150, A=150) + StateBoxColorSpectator = (R=150, G=150, B=150, A=150) + StateBoxColorDead = (R=200, G=0, B=0, A=150) + StateBoxColorHPLow = (R=200, G=50, B=50, A=150) + StateBoxColorHPMid = (R=200, G=200, B=0, A=150) + StateBoxColorHPHigh = (R=0, G=200, B=0, A=150) + StateBoxColorArmorLow = (R=0, G=0, B=150, A=150) + StateBoxColorArmorMid = (R=0, G=0, B=150, A=150) + StateBoxColorArmorHigh = (R=0, G=0, B=150, A=150) - PlayerOwnerBoxColor = (R=100, G=10, B=10, A=150) - PlayerBoxColor = (R=30, G=30, B=30, A=150) - StatsBoxColor = (R=10, G=10, B=10, A=150) + // Player box + PlayerOwnerBoxColor = (R=100, G=10, B=10, A=150) + PlayerBoxColor = (R=30, G=30, B=30, A=150) - RankTextColor = (R=250, G=250, B=250, A=255) - ZedTextColor = (R=255, G=0, B=0, A=255) - PerkTextColor = (R=250, G=250, B=250, A=255) - LevelTextColor = (R=250, G=250, B=250, A=255) - PlayerNameTextColor = (R=250, G=250, B=250, A=255) - KillsTextColor = (R=250, G=250, B=250, A=255) - AssistsTextColor = (R=250, G=250, B=250, A=255) - DoshTextColor = (R=250, G=250, B=100, A=255) - StateTextColor = (R=150, G=150, B=150, A=150) - PingTextColor = (R=250, G=250, B=250, A=255) + // Stats box + StatsOwnerBoxColor = (R=10, G=10, B=10, A=150) + StatsBoxColor = (R=10, G=10, B=10, A=150) - LevelTextColorLow = (R=250, G=100, B=100, A=255) - LevelTextColorMid = (R=250, G=250, B=0, A=255) - LevelTextColorHigh = (R=0, G=250, B=0, A=255) + // State text + StateTextColorLobby = (R=150, G=150, B=150, A=150) + StateTextColorReady = (R=150, G=150, B=150, A=150) + StateTextColorNotReady = (R=150, G=150, B=150, A=150) + StateTextColorSpectator = (R=150, G=150, B=150, A=150) + StateTextColorDead = (R=250, G=0, B=0, A=255) + StateTextColorLowHP = (R=250, G=250, B=250, A=255) + StateTextColorMidHP = (R=250, G=250, B=250, A=255) + StateTextColorHighHP = (R=250, G=250, B=250, A=255) + StateTextColorArmorLow = (R=250, G=250, B=250, A=255) + StateTextColorArmorMid = (R=250, G=250, B=250, A=255) + StateTextColorArmorHigh = (R=250, G=250, B=250, A=255) - StateTextColorLobby = (R=150, G=150, B=150, A=150) - StateTextColorReady = (R=150, G=150, B=150, A=150) - StateTextColorNotReady = (R=150, G=150, B=150, A=150) - StateTextColorSpectator = (R=150, G=150, B=150, A=150) - StateTextColorDead = (R=250, G=0, B=0, A=255) - StateTextColorLowHP = (R=250, G=100, B=100, A=255) - StateTextColorMidHP = (R=250, G=250, B=0, A=255) - StateTextColorHighHP = (R=0, G=250, B=0, A=255) + // Rank text + RankTextColor = (R=250, G=250, B=250, A=255) - PingTextColorLow = (R=0, G=250, B=0, A=255) - PingTextColorMid = (R=250, G=250, B=0, A=255) - PingTextColorHigh = (R=250, G=0, B=0, A=255) + // Player text + PlayerNameTextColor = (R=250, G=250, B=250, A=255) + + // Level text + LevelTextColorLow = (R=250, G=100, B=100, A=255) + LevelTextColorMid = (R=250, G=250, B=0, A=255) + LevelTextColorHigh = (R=0, G=250, B=0, A=255) + + // Perk text + ZedTextColor = (R=255, G=0, B=0, A=255) + PerkNoneTextColor = (R=250, G=250, B=250, A=255) + PerkBerserkerTextColor = (R=250, G=250, B=250, A=255) + PerkCommandoTextColor = (R=250, G=250, B=250, A=255) + PerkSupportTextColor = (R=250, G=250, B=250, A=255) + PerkFieldMedicTextColor = (R=250, G=250, B=250, A=255) + PerkDemolitionistTextColor = (R=250, G=250, B=250, A=255) + PerkFirebugTextColor = (R=250, G=250, B=250, A=255) + PerkGunslingerTextColor = (R=250, G=250, B=250, A=255) + PerkSharpshooterTextColor = (R=250, G=250, B=250, A=255) + PerkSwatTextColor = (R=250, G=250, B=250, A=255) + PerkSurvivalistTextColor = (R=250, G=250, B=250, A=255) + + // Dosh text + DoshTextColorLow = (R=250, G=250, B=100, A=255) + DoshTextColorMid = (R=250, G=250, B=100, A=255) + DoshTextColorHigh = (R=250, G=250, B=100, A=255) + + // Kills text + KillsTextColorLow = (R=250, G=250, B=250, A=255) + KillsTextColorMid = (R=250, G=250, B=250, A=255) + KillsTextColorHigh = (R=250, G=250, B=250, A=255) + + // Assists text + AssistsTextColorLow = (R=250, G=250, B=250, A=255) + AssistsTextColorMid = (R=250, G=250, B=250, A=255) + AssistsTextColorHigh = (R=250, G=250, B=250, A=255) + + // Ping text + PingTextColorNone = (R=250, G=250, B=250, A=255) + PingTextColorLow = (R=0, G=250, B=0, A=255) + PingTextColorMid = (R=250, G=250, B=0, A=255) + PingTextColorHigh = (R=250, G=0, B=0, A=255) + + // Other settings + bShowPingBars = true + bHealthBoxSmoothColorChange = true + bArmorBoxSmoothColorChange = true + bHealthTextSmoothColorChange = false + bArmorTextSmoothColorChange = false + bLevelTextSmoothColorChange = false + bDoshTextSmoothColorChange = false + bKillsTextSmoothColorChange = false + bAssistsTextSmoothColorChange = false + bPingTextSmoothColorChange = false } }; struct YASSettings { - var YASStyle Style; - var YASSettingsAdmin Admin; + var YASStyle Style; + var YASSettingsAdmin Admin; var YASSettingsPlayer Player; - var YASSettingsState State; - var YASSettingsPing Ping; - var YASSettingsLevel Level; + var YASSettingsPing Ping; + var YASSettingsLevel Level; + var YASSettingsHealth Health; + var YASSettingsArmor Armor; }; diff --git a/YAS/Classes/YASMut.uc b/YAS/Classes/YASMut.uc index 58c82ef..01b2643 100644 --- a/YAS/Classes/YASMut.uc +++ b/YAS/Classes/YASMut.uc @@ -5,7 +5,7 @@ class YASMut extends KFMutator `include(Build.uci) `include(Logger.uci) -const CurrentVersion = 1; +const CurrentVersion = 2; var config int ConfigVersion; @@ -39,9 +39,10 @@ function PostBeginPlay() Settings.Style = class'ScoreboardStyle'.static.Settings(); Settings.Admin = class'SystemAdminRank'.static.Settings(); Settings.Player = class'SystemPlayerRank'.static.Settings(); - Settings.State = class'DynamicStateColor'.static.Settings(); - Settings.Ping = class'DynamicPingColor'.static.Settings(); - Settings.Level = class'DynamicLevelColor'.static.Settings(); + Settings.Health = class'SettingsHealth'.static.Settings(); + Settings.Armor = class'SettingsArmor'.static.Settings(); + Settings.Ping = class'SettingsPing'.static.Settings(); + Settings.Level = class'SettingsLevel'.static.Settings(); } function NotifyLogin(Controller C) @@ -69,57 +70,25 @@ private function bool IsUID(String ID) private function InitConfig() { - local RankInfo ExampleRank; - local RankRelation ExamplePlayer; - local RankRelation ExampleSteamGroup; - `callstack(); - // Update from config version to current version if needed + if (ConfigVersion == 0) SaveConfig(); // because I want the main settings to be at the beginning of the config :) + + class'ScoreboardStyle'.static.InitConfig(ConfigVersion); + class'SystemAdminRank'.static.InitConfig(ConfigVersion); + class'SystemPlayerRank'.static.InitConfig(ConfigVersion); + class'SettingsHealth'.static.InitConfig(ConfigVersion); + class'SettingsArmor'.static.InitConfig(ConfigVersion); + class'SettingsPing'.static.InitConfig(ConfigVersion); + class'SettingsLevel'.static.InitConfig(ConfigVersion); + class'CustomRanks'.static.InitConfig(ConfigVersion); + class'PlayerRankRelations'.static.InitConfig(ConfigVersion); + class'SteamGroupRankRelations'.static.InitConfig(ConfigVersion); + switch (ConfigVersion) { - case 0: // which means there is no config right now - SaveConfig(); // because I want the main settings to be at the beginning of the config :) - - class'SystemAdminRank'.static.WriteSettings(class'SystemAdminRank'.static.DefaultSettings()); - class'SystemPlayerRank'.static.WriteSettings(class'SystemPlayerRank'.static.DefaultSettings()); - class'ScoreboardStyle'.static.WriteSettings(class'ScoreboardStyle'.static.DefaultSettings()); - class'DynamicStateColor'.static.WriteSettings(class'DynamicStateColor'.static.DefaultSettings()); - class'DynamicPingColor'.static.WriteSettings(class'DynamicPingColor'.static.DefaultSettings()); - class'DynamicLevelColor'.static.WriteSettings(class'DynamicLevelColor'.static.DefaultSettings()); - - // Example rank for player(s) - ExampleRank.ID = 0; - ExampleRank.Rank = "YAS Creator"; - ExampleRank.TextColor.R = 130; - ExampleRank.TextColor.G = 250; - ExampleRank.TextColor.B = 235; - ExampleRank.OverrideAdminRank = true; - class'CustomRanks'.default.Rank.AddItem(ExampleRank); - - // Example player - ExamplePlayer.ObjectID = "76561198001617867"; // GenZmeY SteamID64 - ExamplePlayer.RankID = ExampleRank.ID; - class'PlayerRankRelations'.default.Relation.AddItem(ExamplePlayer); - - // Example rank for steam group members - ExampleRank.ID = 1; - ExampleRank.Rank = "MSK-GS"; - ExampleRank.TextColor.R = 130; - ExampleRank.TextColor.G = 250; - ExampleRank.TextColor.B = 130; - ExampleRank.OverrideAdminRank = false; - class'CustomRanks'.default.Rank.AddItem(ExampleRank); - - // Example steam group - ExampleSteamGroup.ObjectID = "103582791465384046"; // MSK-GS SteamID64 - ExampleSteamGroup.RankID = ExampleRank.ID; - class'SteamGroupRankRelations'.default.Relation.AddItem(ExampleSteamGroup); - - class'CustomRanks'.static.StaticSaveConfig(); - class'PlayerRankRelations'.static.StaticSaveConfig(); - class'SteamGroupRankRelations'.static.StaticSaveConfig(); - + case 0: + case 1: case 2147483647: `info("Config updated to version"@CurrentVersion); break;