Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
fix: Q.O.L. changes
Browse files Browse the repository at this point in the history
  • Loading branch information
K4ryuu committed Nov 13, 2023
1 parent 5c538a8 commit 04d1d61
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/CFG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ public partial class K4System

public void OnConfigParsed(MyConfig config)
{
if (config.Version == ModuleConfigVersion)
if (config.Version < ModuleConfigVersion)
{
throw new Exception($"A new config file version is available. Your version ({config.Version}), new version: ({ModuleConfigVersion})");
Log($"{config.GeneralSettings.Prefix} A new config file version is available. Your version ({config.Version}), new version: ({ModuleConfigVersion})", LogLevel.Warning);
}

config.GeneralSettings.Prefix = ModifyColorValue(config.GeneralSettings.Prefix);
Expand Down
29 changes: 20 additions & 9 deletions src/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using CounterStrikeSharp.API.Modules.Utils;
using Nexd.MySQL;
using CounterStrikeSharp.API.Modules.Admin;
using System.Reflection;

namespace K4ryuuSystem
{
Expand Down Expand Up @@ -41,14 +42,24 @@ public void OnCommandCheckRank(CCSPlayerController? player, CommandInfo command)
}
}

string modifiedValue = nextRankColor;
foreach (FieldInfo field in typeof(ChatColors).GetFields())
{
string pattern = $"{field.Name}";
if (nextRankColor.Contains(pattern, StringComparison.OrdinalIgnoreCase))
{
modifiedValue = modifiedValue.Replace(pattern, field.GetValue(null)!.ToString(), StringComparison.OrdinalIgnoreCase);
}
}

// Find the player's place in the top list
int playerPlace = GetPlayerPlaceInTopList(playerName);

player.PrintToChat($"{Config.GeneralSettings.Prefix} {PlayerSummaries[player].RankColor}{playerName}");
player.PrintToChat($"{ChatColors.Default}You have {ChatColors.Red}{playerPoints} {ChatColors.Default}points and is currently {ChatColors.Red}{PlayerSummaries[player].RankColor}{PlayerSummaries[player].Rank}.");
player.PrintToChat($"{ChatColors.Default}Next rank: {nextRankColor}{nextRank}");
player.PrintToChat($"{ChatColors.Default}Points until next rank: {ChatColors.Red}{pointsUntilNextRank}");
player.PrintToChat($"{ChatColors.Default}Place in top list: {ChatColors.Green}{playerPlace}");
player.PrintToChat($" {Config.GeneralSettings.Prefix} {PlayerSummaries[player].RankColor}{playerName}");
player.PrintToChat($" {ChatColors.Blue}You have {ChatColors.Gold}{playerPoints} {ChatColors.Blue}points and is currently {PlayerSummaries[player].RankColor}{PlayerSummaries[player].Rank}.");
player.PrintToChat($" {ChatColors.Blue}Next rank: {modifiedValue}{nextRank}");
player.PrintToChat($" {ChatColors.Blue}Points until next rank: {ChatColors.Gold}{pointsUntilNextRank}");
player.PrintToChat($" {ChatColors.Blue}Place in top list: {ChatColors.Gold}{playerPlace}");
}

[ConsoleCommand("resetmyrank", "Resets the player's own points to zero")]
Expand Down Expand Up @@ -282,10 +293,10 @@ public void OnCommandCheckK4(CCSPlayerController? player, CommandInfo command)
return;

command.ReplyToCommand($" {Config.GeneralSettings.Prefix} Available Commands:");
command.ReplyToCommand($" {ChatColors.Blue}PlayTime Commands: !time, !mytime, !playtime");
command.ReplyToCommand($" {ChatColors.Blue}Rank Commands: !rank, !resetmyrank");
command.ReplyToCommand($" {ChatColors.Blue}Statistic Commands: !stat, !statistics");
command.ReplyToCommand($" {ChatColors.Blue}Toplist Commands: !ranktop, !top, !top5, !top10");
command.ReplyToCommand($" {ChatColors.Blue}PlayTime Commands: {ChatColors.Gold}!time{ChatColors.Blue}, {ChatColors.Gold}!mytime{ChatColors.Blue}, {ChatColors.Gold}!playtime");
command.ReplyToCommand($" {ChatColors.Blue}Rank Commands: {ChatColors.Gold}!rank{ChatColors.Blue}, {ChatColors.Gold}!resetmyrank");
command.ReplyToCommand($" {ChatColors.Blue}Statistic Commands: {ChatColors.Gold}!stat{ChatColors.Blue}, {ChatColors.Gold}!statistics");
command.ReplyToCommand($" {ChatColors.Blue}Toplist Commands: {ChatColors.Gold}!ranktop{ChatColors.Blue}, {ChatColors.Gold}!top{ChatColors.Blue}, {ChatColors.Gold}!top5{ChatColors.Blue}, {ChatColors.Gold}!top10");
}
}
}
2 changes: 1 addition & 1 deletion src/K4-System.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace K4ryuuSystem
public partial class K4System : BasePlugin, IPluginConfig<MyConfig>
{
public override string ModuleName => "K4-System";
public override string ModuleVersion => "v1.0.2";
public override string ModuleVersion => "v1.1.0";
public override string ModuleAuthor => "K4ryuu";
public int ModuleConfigVersion => 1;

Expand Down

0 comments on commit 04d1d61

Please sign in to comment.