From ffd0623a527753ac973ab9609cdc816949cc2992 Mon Sep 17 00:00:00 2001 From: Dawid Bepierszcz <41084667+daffyyyy@users.noreply.github.com> Date: Sat, 19 Oct 2024 02:05:15 +0200 Subject: [PATCH 1/2] 2.8a - Pins menu added --- Commands.cs | 1180 +++++++++++++++++++++----------------- Config.cs | 3 + README.md | 2 + Utility.cs | 14 + VERSION | 2 +- Variables.cs | 1 + WeaponAction.cs | 10 +- WeaponPaints.cs | 32 +- WeaponSynchronization.cs | 22 +- lang/en.json | 3 + lang/lv.json | 3 + lang/pl.json | 3 + lang/pt-BR.json | 3 + lang/pt-PT.json | 3 + lang/ru.json | 3 + lang/tr.json | 3 + lang/ua.json | 3 + lang/zh-cn.json | 3 + 18 files changed, 743 insertions(+), 550 deletions(-) diff --git a/Commands.cs b/Commands.cs index fcf7ebed..fcee55aa 100644 --- a/Commands.cs +++ b/Commands.cs @@ -1,383 +1,494 @@ using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Modules.Commands; using CounterStrikeSharp.API.Modules.Menu; +using CounterStrikeSharp.API.Modules.Timers; using Newtonsoft.Json.Linq; -namespace WeaponPaints +namespace WeaponPaints; + +public partial class WeaponPaints { - public partial class WeaponPaints + private void OnCommandRefresh(CCSPlayerController? player, CommandInfo command) { - private void OnCommandRefresh(CCSPlayerController? player, CommandInfo command) - { - if (!Config.Additional.CommandWpEnabled || !Config.Additional.SkinEnabled || !_gBCommandsAllowed) return; - if (!Utility.IsPlayerValid(player)) return; + if (!Config.Additional.CommandWpEnabled || !Config.Additional.SkinEnabled || !_gBCommandsAllowed) return; + if (!Utility.IsPlayerValid(player)) return; - if (player == null || !player.IsValid || player.UserId == null || player.IsBot) return; + if (player == null || !player.IsValid || player.UserId == null || player.IsBot) return; - PlayerInfo? playerInfo = new PlayerInfo + PlayerInfo? playerInfo = new PlayerInfo + { + UserId = player.UserId, + Slot = player.Slot, + Index = (int)player.Index, + SteamId = player?.SteamID.ToString(), + Name = player?.PlayerName, + IpAddress = player?.IpAddress?.Split(":")[0] + }; + + try + { + if (player != null && !CommandsCooldown.TryGetValue(player.Slot, out var cooldownEndTime) || + player != null && DateTime.UtcNow >= (CommandsCooldown.TryGetValue(player.Slot, out cooldownEndTime) ? cooldownEndTime : DateTime.UtcNow)) { - UserId = player.UserId, - Slot = player.Slot, - Index = (int)player.Index, - SteamId = player?.SteamID.ToString(), - Name = player?.PlayerName, - IpAddress = player?.IpAddress?.Split(":")[0] - }; + CommandsCooldown[player.Slot] = DateTime.UtcNow.AddSeconds(Config.CmdRefreshCooldownSeconds); - try - { - if (player != null && !CommandsCooldown.TryGetValue(player.Slot, out var cooldownEndTime) || - player != null && DateTime.UtcNow >= (CommandsCooldown.TryGetValue(player.Slot, out cooldownEndTime) ? cooldownEndTime : DateTime.UtcNow)) + if (WeaponSync != null) { - CommandsCooldown[player.Slot] = DateTime.UtcNow.AddSeconds(Config.CmdRefreshCooldownSeconds); + _ = Task.Run(async () => await WeaponSync.GetPlayerData(playerInfo)); - if (WeaponSync != null) - { - _ = Task.Run(async () => await WeaponSync.GetPlayerData(playerInfo)); - - GivePlayerGloves(player); - RefreshWeapons(player); - GivePlayerAgent(player); - GivePlayerMusicKit(player); - AddTimer(0.15f, () => GivePlayerPin(player)); - } - - if (!string.IsNullOrEmpty(Localizer["wp_command_refresh_done"])) - { - player.Print(Localizer["wp_command_refresh_done"]); - } - return; + GivePlayerGloves(player); + RefreshWeapons(player); + GivePlayerAgent(player); + GivePlayerMusicKit(player); + AddTimer(0.15f, () => GivePlayerPin(player)); } - if (!string.IsNullOrEmpty(Localizer["wp_command_cooldown"])) + + if (!string.IsNullOrEmpty(Localizer["wp_command_refresh_done"])) { - player!.Print(Localizer["wp_command_cooldown"]); + player.Print(Localizer["wp_command_refresh_done"]); } + return; + } + if (!string.IsNullOrEmpty(Localizer["wp_command_cooldown"])) + { + player!.Print(Localizer["wp_command_cooldown"]); } - catch (Exception) { } } + catch (Exception) { } + } - private void OnCommandWS(CCSPlayerController? player, CommandInfo command) + private void OnCommandWS(CCSPlayerController? player, CommandInfo command) + { + if (!Config.Additional.SkinEnabled) return; + if (!Utility.IsPlayerValid(player)) return; + + if (!string.IsNullOrEmpty(Localizer["wp_info_website"])) { - if (!Config.Additional.SkinEnabled) return; - if (!Utility.IsPlayerValid(player)) return; + player!.Print(Localizer["wp_info_website", Config.Website]); + } + if (!string.IsNullOrEmpty(Localizer["wp_info_refresh"])) + { + player!.Print(Localizer["wp_info_refresh"]); + } - if (!string.IsNullOrEmpty(Localizer["wp_info_website"])) + if (Config.Additional.GloveEnabled) + if (!string.IsNullOrEmpty(Localizer["wp_info_glove"])) { - player!.Print(Localizer["wp_info_website", Config.Website]); + player!.Print(Localizer["wp_info_glove"]); } - if (!string.IsNullOrEmpty(Localizer["wp_info_refresh"])) + + if (Config.Additional.AgentEnabled) + if (!string.IsNullOrEmpty(Localizer["wp_info_agent"])) { - player!.Print(Localizer["wp_info_refresh"]); + player!.Print(Localizer["wp_info_agent"]); } - if (Config.Additional.GloveEnabled) - if (!string.IsNullOrEmpty(Localizer["wp_info_glove"])) - { - player!.Print(Localizer["wp_info_glove"]); - } - - if (Config.Additional.AgentEnabled) - if (!string.IsNullOrEmpty(Localizer["wp_info_agent"])) - { - player!.Print(Localizer["wp_info_agent"]); - } - - if (Config.Additional.MusicEnabled) - if (!string.IsNullOrEmpty(Localizer["wp_info_music"])) - { - player!.Print(Localizer["wp_info_music"]); - } - - if (!Config.Additional.KnifeEnabled) return; - if (!string.IsNullOrEmpty(Localizer["wp_info_knife"])) + if (Config.Additional.MusicEnabled) + if (!string.IsNullOrEmpty(Localizer["wp_info_music"])) + { + player!.Print(Localizer["wp_info_music"]); + } + + if (Config.Additional.PinsEnabled) + if (!string.IsNullOrEmpty(Localizer["wp_info_pin"])) { - player!.Print(Localizer["wp_info_knife"]); + player!.Print(Localizer["wp_info_pin"]); } + + if (!Config.Additional.KnifeEnabled) return; + if (!string.IsNullOrEmpty(Localizer["wp_info_knife"])) + { + player!.Print(Localizer["wp_info_knife"]); } + } - private void RegisterCommands() + private void RegisterCommands() + { + _config.Additional.CommandSkin.ForEach(c => { - _config.Additional.CommandSkin.ForEach(c => + AddCommand($"css_{c}", "Skins info", (player, info) => { - AddCommand($"css_{c}", "Skins info", (player, info) => - { - if (!Utility.IsPlayerValid(player)) return; - OnCommandWS(player, info); - }); + if (!Utility.IsPlayerValid(player)) return; + OnCommandWS(player, info); }); + }); - _config.Additional.CommandRefresh.ForEach(c => + _config.Additional.CommandRefresh.ForEach(c => + { + AddCommand($"css_{c}", "Skins refresh", (player, info) => { - AddCommand($"css_{c}", "Skins refresh", (player, info) => - { - if (!Utility.IsPlayerValid(player)) return; - OnCommandRefresh(player, info); - }); + if (!Utility.IsPlayerValid(player)) return; + OnCommandRefresh(player, info); }); + }); - if (Config.Additional.CommandKillEnabled) + if (Config.Additional.CommandKillEnabled) + { + _config.Additional.CommandKill.ForEach(c => { - _config.Additional.CommandKill.ForEach(c => + AddCommand($"css_{c}", "kill yourself", (player, _) => { - AddCommand($"css_{c}", "kill yourself", (player, _) => - { - if (player == null || !Utility.IsPlayerValid(player) || player.PlayerPawn.Value == null || !player.PlayerPawn.IsValid) return; + if (player == null || !Utility.IsPlayerValid(player) || player.PlayerPawn.Value == null || !player.PlayerPawn.IsValid) return; - player.PlayerPawn.Value.CommitSuicide(true, false); - }); + player.PlayerPawn.Value.CommitSuicide(true, false); }); - } + }); } + } - private void SetupKnifeMenu() - { - if (!Config.Additional.KnifeEnabled || !_gBCommandsAllowed) return; + private void SetupKnifeMenu() + { + if (!Config.Additional.KnifeEnabled || !_gBCommandsAllowed) return; - var knivesOnly = WeaponList - .Where(pair => pair.Key.StartsWith("weapon_knife") || pair.Key.StartsWith("weapon_bayonet")) - .ToDictionary(pair => pair.Key, pair => pair.Value); + var knivesOnly = WeaponList + .Where(pair => pair.Key.StartsWith("weapon_knife") || pair.Key.StartsWith("weapon_bayonet")) + .ToDictionary(pair => pair.Key, pair => pair.Value); - var giveItemMenu = MenuApi?.NewMenu(Localizer["wp_knife_menu_title"]); + var giveItemMenu = MenuApi?.NewMenu(Localizer["wp_knife_menu_title"]); - var handleGive = (CCSPlayerController player, ChatMenuOption option) => - { - if (!Utility.IsPlayerValid(player)) return; + var handleGive = (CCSPlayerController player, ChatMenuOption option) => + { + if (!Utility.IsPlayerValid(player)) return; - var knifeName = option.Text; - var knifeKey = knivesOnly.FirstOrDefault(x => x.Value == knifeName).Key; - if (string.IsNullOrEmpty(knifeKey)) return; - if (!string.IsNullOrEmpty(Localizer["wp_knife_menu_select"])) - { - player.Print(Localizer["wp_knife_menu_select", knifeName]); - } + var knifeName = option.Text; + var knifeKey = knivesOnly.FirstOrDefault(x => x.Value == knifeName).Key; + if (string.IsNullOrEmpty(knifeKey)) return; + if (!string.IsNullOrEmpty(Localizer["wp_knife_menu_select"])) + { + player.Print(Localizer["wp_knife_menu_select", knifeName]); + } - if (!string.IsNullOrEmpty(Localizer["wp_knife_menu_kill"]) && Config.Additional.CommandKillEnabled) - { - player.Print(Localizer["wp_knife_menu_kill"]); - } + if (!string.IsNullOrEmpty(Localizer["wp_knife_menu_kill"]) && Config.Additional.CommandKillEnabled) + { + player.Print(Localizer["wp_knife_menu_kill"]); + } - PlayerInfo playerInfo = new PlayerInfo - { - UserId = player.UserId, - Slot = player.Slot, - Index = (int)player.Index, - SteamId = player.SteamID.ToString(), - Name = player.PlayerName, - IpAddress = player.IpAddress?.Split(":")[0] - }; + PlayerInfo playerInfo = new PlayerInfo + { + UserId = player.UserId, + Slot = player.Slot, + Index = (int)player.Index, + SteamId = player.SteamID.ToString(), + Name = player.PlayerName, + IpAddress = player.IpAddress?.Split(":")[0] + }; - GPlayersKnife[player.Slot] = knifeKey; + GPlayersKnife[player.Slot] = knifeKey; - if (_gBCommandsAllowed && (LifeState_t)player.LifeState == LifeState_t.LIFE_ALIVE) - RefreshWeapons(player); + if (_gBCommandsAllowed && (LifeState_t)player.LifeState == LifeState_t.LIFE_ALIVE) + RefreshWeapons(player); - if (WeaponSync != null) - _ = Task.Run(async () => await WeaponSync.SyncKnifeToDatabase(playerInfo, knifeKey)); - }; - foreach (var knifePair in knivesOnly) - { - giveItemMenu?.AddMenuOption(knifePair.Value, handleGive); - } - _config.Additional.CommandKnife.ForEach(c => + if (WeaponSync != null) + _ = Task.Run(async () => await WeaponSync.SyncKnifeToDatabase(playerInfo, knifeKey)); + }; + foreach (var knifePair in knivesOnly) + { + giveItemMenu?.AddMenuOption(knifePair.Value, handleGive); + } + _config.Additional.CommandKnife.ForEach(c => + { + AddCommand($"css_{c}", "Knife Menu", (player, _) => { - AddCommand($"css_{c}", "Knife Menu", (player, _) => - { - if (giveItemMenu == null) return; - if (!Utility.IsPlayerValid(player) || !_gBCommandsAllowed) return; + if (giveItemMenu == null) return; + if (!Utility.IsPlayerValid(player) || !_gBCommandsAllowed) return; - if (player == null || player.UserId == null) return; + if (player == null || player.UserId == null) return; - if (!CommandsCooldown.TryGetValue(player.Slot, out var cooldownEndTime) || - DateTime.UtcNow >= (CommandsCooldown.TryGetValue(player.Slot, out cooldownEndTime) ? cooldownEndTime : DateTime.UtcNow)) - { - CommandsCooldown[player.Slot] = DateTime.UtcNow.AddSeconds(Config.CmdRefreshCooldownSeconds); - giveItemMenu.PostSelectAction = PostSelectAction.Close; + if (!CommandsCooldown.TryGetValue(player.Slot, out var cooldownEndTime) || + DateTime.UtcNow >= (CommandsCooldown.TryGetValue(player.Slot, out cooldownEndTime) ? cooldownEndTime : DateTime.UtcNow)) + { + CommandsCooldown[player.Slot] = DateTime.UtcNow.AddSeconds(Config.CmdRefreshCooldownSeconds); + giveItemMenu.PostSelectAction = PostSelectAction.Close; - giveItemMenu.Open(player); + giveItemMenu.Open(player); - return; - } - if (!string.IsNullOrEmpty(Localizer["wp_command_cooldown"])) - { - player.Print(Localizer["wp_command_cooldown"]); - } - }); + return; + } + if (!string.IsNullOrEmpty(Localizer["wp_command_cooldown"])) + { + player.Print(Localizer["wp_command_cooldown"]); + } }); - } + }); + } - private void SetupSkinsMenu() - { - // var classNamesByWeapon = WeaponList.ToDictionary(kvp => kvp.Value, kvp => kvp.Key); - var classNamesByWeapon = WeaponList - .Except([new KeyValuePair("weapon_knife", "Default Knife")]) - .ToDictionary(kvp => kvp.Value, kvp => kvp.Key); + private void SetupSkinsMenu() + { + // var classNamesByWeapon = WeaponList.ToDictionary(kvp => kvp.Value, kvp => kvp.Key); + var classNamesByWeapon = WeaponList + .Except([new KeyValuePair("weapon_knife", "Default Knife")]) + .ToDictionary(kvp => kvp.Value, kvp => kvp.Key); - var weaponSelectionMenu = MenuApi?.NewMenu(Localizer["wp_skin_menu_weapon_title"]); + var weaponSelectionMenu = MenuApi?.NewMenu(Localizer["wp_skin_menu_weapon_title"]); - // Function to handle skin selection for a specific weapon - var handleWeaponSelection = (CCSPlayerController? player, ChatMenuOption option) => - { - if (!Utility.IsPlayerValid(player)) return; + // Function to handle skin selection for a specific weapon + var handleWeaponSelection = (CCSPlayerController? player, ChatMenuOption option) => + { + if (!Utility.IsPlayerValid(player)) return; - var selectedWeapon = option.Text; + var selectedWeapon = option.Text; - if (!classNamesByWeapon.TryGetValue(selectedWeapon, out var selectedWeaponClassname)) return; - var skinsForSelectedWeapon = SkinsList?.Where(skin => - skin.TryGetValue("weapon_name", out var weaponName) && - weaponName?.ToString() == selectedWeaponClassname - )?.ToList(); + if (!classNamesByWeapon.TryGetValue(selectedWeapon, out var selectedWeaponClassname)) return; + var skinsForSelectedWeapon = SkinsList?.Where(skin => + skin.TryGetValue("weapon_name", out var weaponName) && + weaponName?.ToString() == selectedWeaponClassname + )?.ToList(); - var skinSubMenu = MenuApi?.NewMenu(Localizer["wp_skin_menu_skin_title", selectedWeapon]); + var skinSubMenu = MenuApi?.NewMenu(Localizer["wp_skin_menu_skin_title", selectedWeapon]); - // Function to handle skin selection for the chosen weapon - var handleSkinSelection = (CCSPlayerController p, ChatMenuOption opt) => + // Function to handle skin selection for the chosen weapon + var handleSkinSelection = (CCSPlayerController p, ChatMenuOption opt) => + { + if (!Utility.IsPlayerValid(p)) return; + + var steamId = p.SteamID.ToString(); + var firstSkin = SkinsList?.FirstOrDefault(skin => { - if (!Utility.IsPlayerValid(p)) return; + if (skin.TryGetValue("weapon_name", out var weaponName)) + { + return weaponName?.ToString() == selectedWeaponClassname; + } + return false; + }); - var steamId = p.SteamID.ToString(); - var firstSkin = SkinsList?.FirstOrDefault(skin => + var selectedSkin = opt.Text; + var selectedPaintId = selectedSkin[(selectedSkin.LastIndexOf('(') + 1)..].Trim(')'); + + if (firstSkin == null || + !firstSkin.TryGetValue("weapon_defindex", out var weaponDefIndexObj) || + !int.TryParse(weaponDefIndexObj.ToString(), out var weaponDefIndex) || + !int.TryParse(selectedPaintId, out var paintId)) return; + { + if (Config.Additional.ShowSkinImage && SkinsList != null) { - if (skin.TryGetValue("weapon_name", out var weaponName)) - { - return weaponName?.ToString() == selectedWeaponClassname; - } - return false; - }); + var foundSkin = SkinsList.FirstOrDefault(skin => + ((int?)skin?["weapon_defindex"] ?? 0) == weaponDefIndex && + ((int?)skin?["paint"] ?? 0) == paintId && + skin?["image"] != null + ); + var image = foundSkin?["image"]?.ToString() ?? ""; + _playerWeaponImage[p.Slot] = image; + AddTimer(2.0f, () => _playerWeaponImage.Remove(p.Slot), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); + } - var selectedSkin = opt.Text; - var selectedPaintId = selectedSkin[(selectedSkin.LastIndexOf('(') + 1)..].Trim(')'); + p.Print(Localizer["wp_skin_menu_select", selectedSkin]); - if (firstSkin == null || - !firstSkin.TryGetValue("weapon_defindex", out var weaponDefIndexObj) || - !int.TryParse(weaponDefIndexObj.ToString(), out var weaponDefIndex) || - !int.TryParse(selectedPaintId, out var paintId)) return; + if (!GPlayerWeaponsInfo[p.Slot].TryGetValue(weaponDefIndex, out var value)) { - if (Config.Additional.ShowSkinImage && SkinsList != null) - { - var foundSkin = SkinsList.FirstOrDefault(skin => - ((int?)skin?["weapon_defindex"] ?? 0) == weaponDefIndex && - ((int?)skin?["paint"] ?? 0) == paintId && - skin?["image"] != null - ); - var image = foundSkin?["image"]?.ToString() ?? ""; - _playerWeaponImage[p.Slot] = image; - AddTimer(2.0f, () => _playerWeaponImage.Remove(p.Slot), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); - } + value = new WeaponInfo(); + GPlayerWeaponsInfo[p.Slot][weaponDefIndex] = value; + } - p.Print(Localizer["wp_skin_menu_select", selectedSkin]); + value.Paint = paintId; + value.Wear = 0.01f; + value.Seed = 0; - if (!GPlayerWeaponsInfo[p.Slot].TryGetValue(weaponDefIndex, out var value)) - { - value = new WeaponInfo(); - GPlayerWeaponsInfo[p.Slot][weaponDefIndex] = value; - } + PlayerInfo playerInfo = new PlayerInfo + { + UserId = p.UserId, + Slot = p.Slot, + Index = (int)p.Index, + SteamId = p.SteamID.ToString(), + Name = p.PlayerName, + IpAddress = p.IpAddress?.Split(":")[0] + }; - value.Paint = paintId; - value.Wear = 0.01f; - value.Seed = 0; + if (!_gBCommandsAllowed || (LifeState_t)p.LifeState != LifeState_t.LIFE_ALIVE || + WeaponSync == null) return; + RefreshWeapons(player); - PlayerInfo playerInfo = new PlayerInfo - { - UserId = p.UserId, - Slot = p.Slot, - Index = (int)p.Index, - SteamId = p.SteamID.ToString(), - Name = p.PlayerName, - IpAddress = p.IpAddress?.Split(":")[0] - }; - - if (!_gBCommandsAllowed || (LifeState_t)p.LifeState != LifeState_t.LIFE_ALIVE || - WeaponSync == null) return; - RefreshWeapons(player); - - try - { - _ = Task.Run(async () => await WeaponSync.SyncWeaponPaintsToDatabase(playerInfo)); - } - catch (Exception ex) - { - Utility.Log($"Error syncing weapon paints: {ex.Message}"); - } + try + { + _ = Task.Run(async () => await WeaponSync.SyncWeaponPaintsToDatabase(playerInfo)); } - }; - - // Add skin options to the submenu for the selected weapon - if (skinsForSelectedWeapon != null) - { - foreach (var skin in skinsForSelectedWeapon) + catch (Exception ex) { - if (!skin.TryGetValue("paint_name", out var paintNameObj) || - !skin.TryGetValue("paint", out var paintObj)) continue; - var paintName = paintNameObj?.ToString(); - var paint = paintObj?.ToString(); - - if (!string.IsNullOrEmpty(paintName) && !string.IsNullOrEmpty(paint)) - { - skinSubMenu?.AddMenuOption($"{paintName} ({paint})", handleSkinSelection); - } + Utility.Log($"Error syncing weapon paints: {ex.Message}"); } } - if (player != null && Utility.IsPlayerValid(player)) - skinSubMenu?.Open(player); }; - // Add weapon options to the weapon selection menu - foreach (var weaponName in WeaponList - .Where(kvp => kvp.Key != "weapon_knife") - .Select(kvp => kvp.Value)) - { - weaponSelectionMenu?.AddMenuOption(weaponName, handleWeaponSelection); + // Add skin options to the submenu for the selected weapon + if (skinsForSelectedWeapon != null) + { + foreach (var skin in skinsForSelectedWeapon) + { + if (!skin.TryGetValue("paint_name", out var paintNameObj) || + !skin.TryGetValue("paint", out var paintObj)) continue; + var paintName = paintNameObj?.ToString(); + var paint = paintObj?.ToString(); + + if (!string.IsNullOrEmpty(paintName) && !string.IsNullOrEmpty(paint)) + { + skinSubMenu?.AddMenuOption($"{paintName} ({paint})", handleSkinSelection); + } + } } - // Command to open the weapon selection menu for players + if (player != null && Utility.IsPlayerValid(player)) + skinSubMenu?.Open(player); + }; + + // Add weapon options to the weapon selection menu + foreach (var weaponName in WeaponList + .Where(kvp => kvp.Key != "weapon_knife") + .Select(kvp => kvp.Value)) + { + weaponSelectionMenu?.AddMenuOption(weaponName, handleWeaponSelection); + } + // Command to open the weapon selection menu for players - _config.Additional.CommandSkinSelection.ForEach(c => + _config.Additional.CommandSkinSelection.ForEach(c => + { + AddCommand($"css_{c}", "Skins selection menu", (player, _) => { - AddCommand($"css_{c}", "Skins selection menu", (player, _) => + if (!Utility.IsPlayerValid(player)) return; + + if (player == null || player.UserId == null) return; + + if (!CommandsCooldown.TryGetValue(player.Slot, out var cooldownEndTime) || + DateTime.UtcNow >= (CommandsCooldown.TryGetValue(player.Slot, out cooldownEndTime) ? cooldownEndTime : DateTime.UtcNow)) + { + CommandsCooldown[player.Slot] = DateTime.UtcNow.AddSeconds(Config.CmdRefreshCooldownSeconds); + weaponSelectionMenu?.Open(player); + return; + } + if (!string.IsNullOrEmpty(Localizer["wp_command_cooldown"])) { - if (!Utility.IsPlayerValid(player)) return; + player.Print(Localizer["wp_command_cooldown"]); + } + }); + }); + } - if (player == null || player.UserId == null) return; + private void SetupGlovesMenu() + { + var glovesSelectionMenu = MenuApi?.NewMenu(Localizer["wp_glove_menu_title"]); + if (glovesSelectionMenu == null) return; + glovesSelectionMenu.PostSelectAction = PostSelectAction.Close; + + var handleGloveSelection = (CCSPlayerController? player, ChatMenuOption option) => + { + if (!Utility.IsPlayerValid(player) || player is null) return; + + var selectedPaintName = option.Text; + + var selectedGlove = GlovesList.FirstOrDefault(g => g.ContainsKey("paint_name") && g["paint_name"]?.ToString() == selectedPaintName); + var image = selectedGlove?["image"]?.ToString() ?? ""; + if (selectedGlove == null || + !selectedGlove.ContainsKey("weapon_defindex") || + !selectedGlove.ContainsKey("paint") || + !int.TryParse(selectedGlove["weapon_defindex"]?.ToString(), out var weaponDefindex) || + !int.TryParse(selectedGlove["paint"]?.ToString(), out var paint)) return; + if (Config.Additional.ShowSkinImage) + { + _playerWeaponImage[player.Slot] = image; + AddTimer(2.0f, () => _playerWeaponImage.Remove(player.Slot), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); + } - if (!CommandsCooldown.TryGetValue(player.Slot, out var cooldownEndTime) || - DateTime.UtcNow >= (CommandsCooldown.TryGetValue(player.Slot, out cooldownEndTime) ? cooldownEndTime : DateTime.UtcNow)) - { - CommandsCooldown[player.Slot] = DateTime.UtcNow.AddSeconds(Config.CmdRefreshCooldownSeconds); - weaponSelectionMenu?.Open(player); - return; - } - if (!string.IsNullOrEmpty(Localizer["wp_command_cooldown"])) + PlayerInfo playerInfo = new PlayerInfo + { + UserId = player.UserId, + Slot = player.Slot, + Index = (int)player.Index, + SteamId = player.SteamID.ToString(), + Name = player.PlayerName, + IpAddress = player.IpAddress?.Split(":")[0] + }; + + if (paint != 0) + { + GPlayersGlove[player.Slot] = (ushort)weaponDefindex; + + if (!GPlayerWeaponsInfo[player.Slot].ContainsKey(weaponDefindex)) + { + WeaponInfo weaponInfo = new() { - player.Print(Localizer["wp_command_cooldown"]); - } - }); + Paint = paint + }; + GPlayerWeaponsInfo[player.Slot][weaponDefindex] = weaponInfo; + } + } + else + { + GPlayersGlove.TryRemove(player.Slot, out _); + } + + if (!string.IsNullOrEmpty(Localizer["wp_glove_menu_select"])) + { + player.Print(Localizer["wp_glove_menu_select", selectedPaintName]); + } + + if (WeaponSync == null) return; + + _ = Task.Run(async () => + { + await WeaponSync.SyncGloveToDatabase(playerInfo, weaponDefindex); + + if (!GPlayerWeaponsInfo[playerInfo.Slot].TryGetValue(weaponDefindex, out var value)) + { + value = new WeaponInfo(); + GPlayerWeaponsInfo[playerInfo.Slot][weaponDefindex] = value; + } + + value.Paint = paint; + value.Wear = 0.00f; + value.Seed = 0; + + await WeaponSync.SyncWeaponPaintsToDatabase(playerInfo); }); + + AddTimer(0.1f, () => GivePlayerGloves(player)); + AddTimer(0.25f, () => GivePlayerGloves(player)); + }; + + // Add weapon options to the weapon selection menu + foreach (var paintName in GlovesList.Select(gloveObject => gloveObject["paint_name"]?.ToString() ?? "").Where(paintName => paintName.Length > 0)) + { + glovesSelectionMenu.AddMenuOption(paintName, handleGloveSelection); } - private void SetupGlovesMenu() + // Command to open the weapon selection menu for players + _config.Additional.CommandGlove.ForEach(c => { - var glovesSelectionMenu = MenuApi?.NewMenu(Localizer["wp_glove_menu_title"]); - if (glovesSelectionMenu == null) return; - glovesSelectionMenu.PostSelectAction = PostSelectAction.Close; - - var handleGloveSelection = (CCSPlayerController? player, ChatMenuOption option) => + AddCommand($"css_{c}", "Gloves selection menu", (player, info) => { - if (!Utility.IsPlayerValid(player) || player is null) return; + if (!Utility.IsPlayerValid(player) || !_gBCommandsAllowed) return; - var selectedPaintName = option.Text; + if (player == null || player.UserId == null) return; - var selectedGlove = GlovesList.FirstOrDefault(g => g.ContainsKey("paint_name") && g["paint_name"]?.ToString() == selectedPaintName); - var image = selectedGlove?["image"]?.ToString() ?? ""; - if (selectedGlove == null || - !selectedGlove.ContainsKey("weapon_defindex") || - !selectedGlove.ContainsKey("paint") || - !int.TryParse(selectedGlove["weapon_defindex"]?.ToString(), out var weaponDefindex) || - !int.TryParse(selectedGlove["paint"]?.ToString(), out var paint)) return; - if (Config.Additional.ShowSkinImage) + if (!CommandsCooldown.TryGetValue(player.Slot, out var cooldownEndTime) || + DateTime.UtcNow >= (CommandsCooldown.TryGetValue(player.Slot, out cooldownEndTime) ? cooldownEndTime : DateTime.UtcNow)) { - _playerWeaponImage[player.Slot] = image; - AddTimer(2.0f, () => _playerWeaponImage.Remove(player.Slot), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); + CommandsCooldown[player.Slot] = DateTime.UtcNow.AddSeconds(Config.CmdRefreshCooldownSeconds); + glovesSelectionMenu?.Open(player); + return; + } + if (!string.IsNullOrEmpty(Localizer["wp_command_cooldown"])) + { + player.Print(Localizer["wp_command_cooldown"]); } + }); + }); + } + + private void SetupAgentsMenu() + { + var handleAgentSelection = (CCSPlayerController? player, ChatMenuOption option) => + { + if (!Utility.IsPlayerValid(player) || player is null) return; + + var selectedPaintName = option.Text; + var selectedAgent = AgentsList.FirstOrDefault(g => + g.ContainsKey("agent_name") && + g["agent_name"] != null && g["agent_name"]!.ToString() == selectedPaintName && + g["team"] != null && (int)(g["team"]!) == player.TeamNum); + + if (selectedAgent == null) return; + if ( + selectedAgent.ContainsKey("model") + ) + { PlayerInfo playerInfo = new PlayerInfo { UserId = player.UserId, @@ -388,313 +499,330 @@ private void SetupGlovesMenu() IpAddress = player.IpAddress?.Split(":")[0] }; - if (paint != 0) + if (Config.Additional.ShowSkinImage) { - GPlayersGlove[player.Slot] = (ushort)weaponDefindex; - - if (!GPlayerWeaponsInfo[player.Slot].ContainsKey(weaponDefindex)) - { - WeaponInfo weaponInfo = new() - { - Paint = paint - }; - GPlayerWeaponsInfo[player.Slot][weaponDefindex] = weaponInfo; - } + var image = selectedAgent["image"]?.ToString() ?? ""; + _playerWeaponImage[player.Slot] = image; + AddTimer(2.0f, () => _playerWeaponImage.Remove(player.Slot), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); } - else + + if (!string.IsNullOrEmpty(Localizer["wp_agent_menu_select"])) { - GPlayersGlove.TryRemove(player.Slot, out _); + player.Print(Localizer["wp_agent_menu_select", selectedPaintName]); } - if (!string.IsNullOrEmpty(Localizer["wp_glove_menu_select"])) + if (player.TeamNum == 3) { - player.Print(Localizer["wp_glove_menu_select", selectedPaintName]); + GPlayersAgent.AddOrUpdate(player.Slot, + key => (selectedAgent["model"]!.ToString().Equals("null") ? null : selectedAgent["model"]!.ToString(), null), + (key, oldValue) => (selectedAgent["model"]!.ToString().Equals("null") ? null : selectedAgent["model"]!.ToString(), oldValue.T)); } - - if (WeaponSync == null) return; - - _ = Task.Run(async () => + else { - await WeaponSync.SyncGloveToDatabase(playerInfo, weaponDefindex); + GPlayersAgent.AddOrUpdate(player.Slot, + key => (null, selectedAgent["model"]!.ToString().Equals("null") ? null : selectedAgent["model"]!.ToString()), + (key, oldValue) => (oldValue.CT, selectedAgent["model"]!.ToString().Equals("null") ? null : selectedAgent["model"]!.ToString()) + ); + } - if (!GPlayerWeaponsInfo[playerInfo.Slot].TryGetValue(weaponDefindex, out var value)) + if (WeaponSync != null) + { + _ = Task.Run(async () => { - value = new WeaponInfo(); - GPlayerWeaponsInfo[playerInfo.Slot][weaponDefindex] = value; - } - - value.Paint = paint; - value.Wear = 0.00f; - value.Seed = 0; - - await WeaponSync.SyncWeaponPaintsToDatabase(playerInfo); - }); - - AddTimer(0.1f, () => GivePlayerGloves(player)); - AddTimer(0.25f, () => GivePlayerGloves(player)); + await WeaponSync.SyncAgentToDatabase(playerInfo); + }); + } }; + }; - // Add weapon options to the weapon selection menu - foreach (var paintName in GlovesList.Select(gloveObject => gloveObject["paint_name"]?.ToString() ?? "").Where(paintName => paintName.Length > 0)) + // Command to open the weapon selection menu for players + _config.Additional.CommandAgent.ForEach(c => + { + AddCommand($"css_{c}", "Agents selection menu", (player, info) => { - glovesSelectionMenu.AddMenuOption(paintName, handleGloveSelection); - } + if (!Utility.IsPlayerValid(player) || !_gBCommandsAllowed) return; - // Command to open the weapon selection menu for players - _config.Additional.CommandGlove.ForEach(c => - { - AddCommand($"css_{c}", "Gloves selection menu", (player, info) => - { - if (!Utility.IsPlayerValid(player) || !_gBCommandsAllowed) return; + if (player == null || player.UserId == null) return; - if (player == null || player.UserId == null) return; + if (!CommandsCooldown.TryGetValue(player.Slot, out DateTime cooldownEndTime) || + DateTime.UtcNow >= (CommandsCooldown.TryGetValue(player.Slot, out cooldownEndTime) ? cooldownEndTime : DateTime.UtcNow)) + { + var agentsSelectionMenu = MenuApi?.NewMenu(Localizer["wp_agent_menu_title"]); + if (agentsSelectionMenu == null) return; + agentsSelectionMenu.PostSelectAction = PostSelectAction.Close; - if (!CommandsCooldown.TryGetValue(player.Slot, out var cooldownEndTime) || - DateTime.UtcNow >= (CommandsCooldown.TryGetValue(player.Slot, out cooldownEndTime) ? cooldownEndTime : DateTime.UtcNow)) + var filteredAgents = AgentsList.Where(agentObject => { - CommandsCooldown[player.Slot] = DateTime.UtcNow.AddSeconds(Config.CmdRefreshCooldownSeconds); - glovesSelectionMenu?.Open(player); - return; - } - if (!string.IsNullOrEmpty(Localizer["wp_command_cooldown"])) + if (agentObject["team"]?.Value() is { } teamNum) + { + return teamNum == player.TeamNum; + } + else + { + return false; + } + }); + + // Add weapon options to the weapon selection menu + + foreach (var agentObject in filteredAgents) { - player.Print(Localizer["wp_command_cooldown"]); + var paintName = agentObject["agent_name"]?.ToString() ?? ""; + + if (paintName.Length > 0) + agentsSelectionMenu.AddMenuOption(paintName, handleAgentSelection); } - }); + + CommandsCooldown[player.Slot] = DateTime.UtcNow.AddSeconds(Config.CmdRefreshCooldownSeconds); + agentsSelectionMenu.Open(player); + return; + } + if (!string.IsNullOrEmpty(Localizer["wp_command_cooldown"])) + { + player.Print(Localizer["wp_command_cooldown"]); + } }); - } + }); + } - private void SetupAgentsMenu() - { - var handleAgentSelection = (CCSPlayerController? player, ChatMenuOption option) => - { - if (!Utility.IsPlayerValid(player) || player is null) return; + private void SetupMusicMenu() + { + var musicSelectionMenu = MenuApi?.NewMenu(Localizer["wp_music_menu_title"]); + if (musicSelectionMenu == null) return; + musicSelectionMenu.PostSelectAction = PostSelectAction.Close; - var selectedPaintName = option.Text; - var selectedAgent = AgentsList.FirstOrDefault(g => - g.ContainsKey("agent_name") && - g["agent_name"] != null && g["agent_name"]!.ToString() == selectedPaintName && - g["team"] != null && (int)(g["team"]!) == player.TeamNum); + var handleMusicSelection = (CCSPlayerController? player, ChatMenuOption option) => + { + if (!Utility.IsPlayerValid(player) || player is null) return; - if (selectedAgent == null) return; + var selectedPaintName = option.Text; - if ( - selectedAgent.ContainsKey("model") - ) + var selectedMusic = MusicList.FirstOrDefault(g => g.ContainsKey("name") && g["name"]?.ToString() == selectedPaintName); + if (selectedMusic != null) + { + if (!selectedMusic.ContainsKey("id") || + !selectedMusic.ContainsKey("name") || + !int.TryParse(selectedMusic["id"]?.ToString(), out var paint)) return; + var image = selectedMusic["image"]?.ToString() ?? ""; + if (Config.Additional.ShowSkinImage) { - PlayerInfo playerInfo = new PlayerInfo - { - UserId = player.UserId, - Slot = player.Slot, - Index = (int)player.Index, - SteamId = player.SteamID.ToString(), - Name = player.PlayerName, - IpAddress = player.IpAddress?.Split(":")[0] - }; + _playerWeaponImage[player.Slot] = image; + AddTimer(2.0f, () => _playerWeaponImage.Remove(player.Slot), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); + } - if (Config.Additional.ShowSkinImage) - { - var image = selectedAgent["image"]?.ToString() ?? ""; - _playerWeaponImage[player.Slot] = image; - AddTimer(2.0f, () => _playerWeaponImage.Remove(player.Slot), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); - } + PlayerInfo playerInfo = new PlayerInfo + { + UserId = player.UserId, + Slot = player.Slot, + Index = (int)player.Index, + SteamId = player.SteamID.ToString(), + Name = player.PlayerName, + IpAddress = player.IpAddress?.Split(":")[0] + }; - if (!string.IsNullOrEmpty(Localizer["wp_agent_menu_select"])) - { - player.Print(Localizer["wp_agent_menu_select", selectedPaintName]); - } + if (paint != 0) + { + GPlayersMusic[player.Slot] = (ushort)paint; + } + else + { + GPlayersMusic[player.Slot] = 0; + } - if (player.TeamNum == 3) - { - GPlayersAgent.AddOrUpdate(player.Slot, - key => (selectedAgent["model"]!.ToString().Equals("null") ? null : selectedAgent["model"]!.ToString(), null), - (key, oldValue) => (selectedAgent["model"]!.ToString().Equals("null") ? null : selectedAgent["model"]!.ToString(), oldValue.T)); - } - else - { - GPlayersAgent.AddOrUpdate(player.Slot, - key => (null, selectedAgent["model"]!.ToString().Equals("null") ? null : selectedAgent["model"]!.ToString()), - (key, oldValue) => (oldValue.CT, selectedAgent["model"]!.ToString().Equals("null") ? null : selectedAgent["model"]!.ToString()) - ); - } + if (!string.IsNullOrEmpty(Localizer["wp_music_menu_select"])) + { + player.Print(Localizer["wp_music_menu_select", selectedPaintName]); + } - if (WeaponSync != null) + if (WeaponSync != null) + { + _ = Task.Run(async () => { - _ = Task.Run(async () => - { - await WeaponSync.SyncAgentToDatabase(playerInfo); - }); - } - }; - }; + await WeaponSync.SyncMusicToDatabase(playerInfo, (ushort)paint); + }); + } - // Command to open the weapon selection menu for players - _config.Additional.CommandAgent.ForEach(c => + //RefreshGloves(player); + } + else { - AddCommand($"css_{c}", "Agents selection menu", (player, info) => + PlayerInfo playerInfo = new PlayerInfo { - if (!Utility.IsPlayerValid(player) || !_gBCommandsAllowed) return; - - if (player == null || player.UserId == null) return; + UserId = player.UserId, + Slot = player.Slot, + Index = (int)player.Index, + SteamId = player.SteamID.ToString(), + Name = player.PlayerName, + IpAddress = player.IpAddress?.Split(":")[0] + }; - if (!CommandsCooldown.TryGetValue(player.Slot, out DateTime cooldownEndTime) || - DateTime.UtcNow >= (CommandsCooldown.TryGetValue(player.Slot, out cooldownEndTime) ? cooldownEndTime : DateTime.UtcNow)) - { - var agentsSelectionMenu = MenuApi?.NewMenu(Localizer["wp_agent_menu_title"]); - if (agentsSelectionMenu == null) return; - agentsSelectionMenu.PostSelectAction = PostSelectAction.Close; + GPlayersMusic[player.Slot] = 0; - var filteredAgents = AgentsList.Where(agentObject => - { - if (agentObject["team"]?.Value() is { } teamNum) - { - return teamNum == player.TeamNum; - } - else - { - return false; - } - }); - - // Add weapon options to the weapon selection menu - - foreach (var agentObject in filteredAgents) - { - var paintName = agentObject["agent_name"]?.ToString() ?? ""; - - if (paintName.Length > 0) - agentsSelectionMenu.AddMenuOption(paintName, handleAgentSelection); - } + if (!string.IsNullOrEmpty(Localizer["wp_music_menu_select"])) + { + player.Print(Localizer["wp_music_menu_select", Localizer["None"]]); + } - CommandsCooldown[player.Slot] = DateTime.UtcNow.AddSeconds(Config.CmdRefreshCooldownSeconds); - agentsSelectionMenu.Open(player); - return; - } - if (!string.IsNullOrEmpty(Localizer["wp_command_cooldown"])) + if (WeaponSync != null) + { + _ = Task.Run(async () => { - player.Print(Localizer["wp_command_cooldown"]); - } - }); - }); - } + await WeaponSync.SyncMusicToDatabase(playerInfo, 0); + }); + } + } + }; - private void SetupMusicMenu() + musicSelectionMenu.AddMenuOption(Localizer["None"], handleMusicSelection); + // Add weapon options to the weapon selection menu + foreach (var paintName in MusicList.Select(musicObject => musicObject["name"]?.ToString() ?? "").Where(paintName => paintName.Length > 0)) { - var musicSelectionMenu = MenuApi?.NewMenu(Localizer["wp_music_menu_title"]); - if (musicSelectionMenu == null) return; - musicSelectionMenu.PostSelectAction = PostSelectAction.Close; + musicSelectionMenu.AddMenuOption(paintName, handleMusicSelection); + } - var handleMusicSelection = (CCSPlayerController? player, ChatMenuOption option) => + // Command to open the weapon selection menu for players + _config.Additional.CommandMusic.ForEach(c => + { + AddCommand($"css_{c}", "Music selection menu", (player, info) => { - if (!Utility.IsPlayerValid(player) || player is null) return; + if (!Utility.IsPlayerValid(player) || !_gBCommandsAllowed) return; - var selectedPaintName = option.Text; + if (player == null || player.UserId == null) return; - var selectedMusic = MusicList.FirstOrDefault(g => g.ContainsKey("name") && g["name"]?.ToString() == selectedPaintName); - if (selectedMusic != null) + if (!CommandsCooldown.TryGetValue(player.Slot, out var cooldownEndTime) || + DateTime.UtcNow >= (CommandsCooldown.TryGetValue(player.Slot, out cooldownEndTime) ? cooldownEndTime : DateTime.UtcNow)) { - if (!selectedMusic.ContainsKey("id") || - !selectedMusic.ContainsKey("name") || - !int.TryParse(selectedMusic["id"]?.ToString(), out var paint)) return; - var image = selectedMusic["image"]?.ToString() ?? ""; - if (Config.Additional.ShowSkinImage) - { - _playerWeaponImage[player.Slot] = image; - AddTimer(2.0f, () => _playerWeaponImage.Remove(player.Slot), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); - } + CommandsCooldown[player.Slot] = DateTime.UtcNow.AddSeconds(Config.CmdRefreshCooldownSeconds); + musicSelectionMenu.Open(player); + return; + } + if (!string.IsNullOrEmpty(Localizer["wp_command_cooldown"])) + { + player.Print(Localizer["wp_command_cooldown"]); + } + }); + }); + } + + private void SetupPinsMenu() + { + var pinsSelectionMenu = MenuApi?.NewMenu(Localizer["wp_pins_menu_title"]); + if (pinsSelectionMenu == null) return; + pinsSelectionMenu.PostSelectAction = PostSelectAction.Close; - PlayerInfo playerInfo = new PlayerInfo - { - UserId = player.UserId, - Slot = player.Slot, - Index = (int)player.Index, - SteamId = player.SteamID.ToString(), - Name = player.PlayerName, - IpAddress = player.IpAddress?.Split(":")[0] - }; + var handlePinsSelection = (CCSPlayerController? player, ChatMenuOption option) => + { + if (!Utility.IsPlayerValid(player) || player is null) return; - if (paint != 0) - { - GPlayersMusic[player.Slot] = (ushort)paint; - } - else - { - GPlayersMusic[player.Slot] = 0; - } + var selectedPaintName = option.Text; - if (!string.IsNullOrEmpty(Localizer["wp_music_menu_select"])) - { - player.Print(Localizer["wp_music_menu_select", selectedPaintName]); - } + var selectedPin = PinsList.FirstOrDefault(g => g.ContainsKey("name") && g["name"]?.ToString() == selectedPaintName); + if (selectedPin != null) + { + if (!selectedPin.ContainsKey("id") || + !selectedPin.ContainsKey("name") || + !int.TryParse(selectedPin["id"]?.ToString(), out var paint)) return; + var image = selectedPin["image"]?.ToString() ?? ""; + if (Config.Additional.ShowSkinImage) + { + _playerWeaponImage[player.Slot] = image; + AddTimer(2.0f, () => _playerWeaponImage.Remove(player.Slot), TimerFlags.STOP_ON_MAPCHANGE); + } - if (WeaponSync != null) - { - _ = Task.Run(async () => - { - await WeaponSync.SyncMusicToDatabase(playerInfo, (ushort)paint); - }); - } + PlayerInfo playerInfo = new PlayerInfo + { + UserId = player.UserId, + Slot = player.Slot, + Index = (int)player.Index, + SteamId = player.SteamID.ToString(), + Name = player.PlayerName, + IpAddress = player.IpAddress?.Split(":")[0] + }; - //RefreshGloves(player); + if (paint != 0) + { + GPlayersPin[player.Slot] = (ushort)paint; } else { - PlayerInfo playerInfo = new PlayerInfo + GPlayersPin[player.Slot] = 0; + } + + if (!string.IsNullOrEmpty(Localizer["wp_pins_menu_select"])) + { + player.Print(Localizer["wp_pins_menu_select", selectedPaintName]); + } + + GivePlayerPin(player); + + if (WeaponSync != null) + { + _ = Task.Run(async () => { - UserId = player.UserId, - Slot = player.Slot, - Index = (int)player.Index, - SteamId = player.SteamID.ToString(), - Name = player.PlayerName, - IpAddress = player.IpAddress?.Split(":")[0] - }; + await WeaponSync.SyncPinToDatabase(playerInfo, (ushort)paint); + }); + } + } + else + { + PlayerInfo playerInfo = new PlayerInfo + { + UserId = player.UserId, + Slot = player.Slot, + Index = (int)player.Index, + SteamId = player.SteamID.ToString(), + Name = player.PlayerName, + IpAddress = player.IpAddress?.Split(":")[0] + }; - GPlayersMusic[player.Slot] = 0; + GPlayersPin[player.Slot] = 0; - if (!string.IsNullOrEmpty(Localizer["wp_music_menu_select"])) - { - player.Print(Localizer["wp_music_menu_select", Localizer["None"]]); - } + if (!string.IsNullOrEmpty(Localizer["wp_pins_menu_select"])) + { + player.Print(Localizer["wp_pins_menu_select", Localizer["None"]]); + } + + GivePlayerPin(player); - if (WeaponSync != null) + if (WeaponSync != null) + { + _ = Task.Run(async () => { - _ = Task.Run(async () => - { - await WeaponSync.SyncMusicToDatabase(playerInfo, 0); - }); - } + await WeaponSync.SyncPinToDatabase(playerInfo, 0); + }); } - }; - - musicSelectionMenu.AddMenuOption(Localizer["None"], handleMusicSelection); - // Add weapon options to the weapon selection menu - foreach (var paintName in MusicList.Select(musicObject => musicObject["name"]?.ToString() ?? "").Where(paintName => paintName.Length > 0)) - { - musicSelectionMenu.AddMenuOption(paintName, handleMusicSelection); } + }; - // Command to open the weapon selection menu for players - _config.Additional.CommandMusic.ForEach(c => + pinsSelectionMenu.AddMenuOption(Localizer["None"], handlePinsSelection); + // Add weapon options to the weapon selection menu + foreach (var paintName in PinsList.Select(musicObject => musicObject["name"]?.ToString() ?? "").Where(paintName => paintName.Length > 0)) + { + pinsSelectionMenu.AddMenuOption(paintName, handlePinsSelection); + } + + // Command to open the weapon selection menu for players + _config.Additional.CommandPin.ForEach(c => + { + AddCommand($"css_{c}", "Pin selection menu", (player, info) => { - AddCommand($"css_{c}", "Music selection menu", (player, info) => - { - if (!Utility.IsPlayerValid(player) || !_gBCommandsAllowed) return; + if (!Utility.IsPlayerValid(player) || !_gBCommandsAllowed) return; - if (player == null || player.UserId == null) return; + if (player == null || player.UserId == null) return; - if (!CommandsCooldown.TryGetValue(player.Slot, out var cooldownEndTime) || - DateTime.UtcNow >= (CommandsCooldown.TryGetValue(player.Slot, out cooldownEndTime) ? cooldownEndTime : DateTime.UtcNow)) - { - CommandsCooldown[player.Slot] = DateTime.UtcNow.AddSeconds(Config.CmdRefreshCooldownSeconds); - musicSelectionMenu.Open(player); - return; - } - if (!string.IsNullOrEmpty(Localizer["wp_command_cooldown"])) - { - player.Print(Localizer["wp_command_cooldown"]); - } - }); + if (!CommandsCooldown.TryGetValue(player.Slot, out var cooldownEndTime) || + DateTime.UtcNow >= (CommandsCooldown.TryGetValue(player.Slot, out cooldownEndTime) ? cooldownEndTime : DateTime.UtcNow)) + { + CommandsCooldown[player.Slot] = DateTime.UtcNow.AddSeconds(Config.CmdRefreshCooldownSeconds); + pinsSelectionMenu.Open(player); + return; + } + + if (!string.IsNullOrEmpty(Localizer["wp_command_cooldown"])) + { + player.Print(Localizer["wp_command_cooldown"]); + } }); - } + }); } } \ No newline at end of file diff --git a/Config.cs b/Config.cs index be606645..d17082e3 100644 --- a/Config.cs +++ b/Config.cs @@ -34,6 +34,9 @@ public class Additional [JsonPropertyName("CommandMusic")] public List CommandMusic { get; set; } = ["music"]; + + [JsonPropertyName("CommandPin")] + public List CommandPin { get; set; } = ["pins"]; [JsonPropertyName("CommandGlove")] public List CommandGlove { get; set; } = ["gloves"]; diff --git a/README.md b/README.md index bcfddeb3..d6fc6f6f 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ Unfinished, unoptimized and not fully functional ugly demo weapon paints plugin - Added command **`!knife`** to show menu with knives - Added command **`!gloves`** to show menu with gloves - Added command **`!agents`** to show menu with agents +- Added command **`!pins`** to show menu with pins +- Added command **`!music`** to show menu with music - Translations support, submit a PR if you want to share your translation ## ⚙️ Requirements diff --git a/Utility.cs b/Utility.cs index 0a59459b..e519aabf 100644 --- a/Utility.cs +++ b/Utility.cs @@ -118,6 +118,20 @@ internal static void LoadSkinsFromFile(string filePath, ILogger logger) logger?.LogError("Not found \"skins.json\" file"); } } + + internal static void LoadPinsFromFile(string filePath, ILogger logger) + { + var json = File.ReadAllText(filePath); + try + { + var deserializedPins = JsonConvert.DeserializeObject>(json); + WeaponPaints.PinsList = deserializedPins ?? []; + } + catch (FileNotFoundException) + { + logger?.LogError("Not found \"pins.json\" file"); + } + } internal static void LoadGlovesFromFile(string filePath, ILogger logger) { diff --git a/VERSION b/VERSION index 4818b1b8..d4223c5d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.7a \ No newline at end of file +2.8a \ No newline at end of file diff --git a/Variables.cs b/Variables.cs index 7df322a1..bfc21672 100644 --- a/Variables.cs +++ b/Variables.cs @@ -79,6 +79,7 @@ public partial class WeaponPaints public static readonly ConcurrentDictionary GPlayersAgent = new(); internal static readonly ConcurrentDictionary> GPlayerWeaponsInfo = new(); internal static List SkinsList = []; + internal static List PinsList = []; internal static List GlovesList = []; internal static List AgentsList = []; internal static List MusicList = []; diff --git a/WeaponAction.cs b/WeaponAction.cs index 6724cd82..db830391 100644 --- a/WeaponAction.cs +++ b/WeaponAction.cs @@ -463,14 +463,10 @@ private static void GivePlayerMusicKit(CCSPlayerController player) private static void GivePlayerPin(CCSPlayerController player) { if (!GPlayersPin.TryGetValue(player.Slot, out var pin)) return; - if (player.InventoryServices == null) return; - - for (var index = 0; index < player.InventoryServices.Rank.Length; index++) - { - player.InventoryServices.Rank[index] = index == 5 ? (MedalRank_t)pin : MedalRank_t.MEDAL_RANK_NONE; - Utilities.SetStateChanged(player, "CCSPlayerController", "m_pInventoryServices"); - } + + player.InventoryServices.Rank[5] = pin > 0 ? (MedalRank_t)pin : MedalRank_t.MEDAL_RANK_NONE; + Utilities.SetStateChanged(player, "CCSPlayerController", "m_pInventoryServices"); } private void GiveOnItemPickup(CCSPlayerController player) diff --git a/WeaponPaints.cs b/WeaponPaints.cs index 9bb28247..9fb18b75 100644 --- a/WeaponPaints.cs +++ b/WeaponPaints.cs @@ -16,7 +16,7 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig "Nereziel & daffyy"; public override string ModuleDescription => "Skin, gloves, agents and knife selector, standalone and web-based"; public override string ModuleName => "WeaponPaints"; - public override string ModuleVersion => "2.7a"; + public override string ModuleVersion => "2.8a"; public override void Load(bool hotReload) { @@ -53,28 +53,15 @@ public override void Load(bool hotReload) if (WeaponSync != null) await WeaponSync.GetPlayerData(playerInfo); }); } - - AddTimer(2.0f, () => OnAllPluginsLoaded(hotReload)); } Utility.LoadSkinsFromFile(ModuleDirectory + $"/data/skins_{_config.SkinsLanguage}.json", Logger); Utility.LoadGlovesFromFile(ModuleDirectory + $"/data/gloves_{_config.SkinsLanguage}.json", Logger); Utility.LoadAgentsFromFile(ModuleDirectory + $"/data/agents_{_config.SkinsLanguage}.json", Logger); Utility.LoadMusicFromFile(ModuleDirectory + $"/data/music_{_config.SkinsLanguage}.json", Logger); - - if (Config.Additional.KnifeEnabled) - SetupKnifeMenu(); - if (Config.Additional.SkinEnabled) - SetupSkinsMenu(); - if (Config.Additional.GloveEnabled) - SetupGlovesMenu(); - if (Config.Additional.AgentEnabled) - SetupAgentsMenu(); - if (Config.Additional.MusicEnabled) - SetupMusicMenu(); + Utility.LoadPinsFromFile(ModuleDirectory + $"/data/collectibles_{_config.SkinsLanguage}.json", Logger); RegisterListeners(); - RegisterCommands(); } public void OnConfigParsed(WeaponPaintsConfig config) @@ -122,6 +109,21 @@ public override void OnAllPluginsLoaded(bool hotReload) try { MenuApi = MenuCapability.Get(); + + if (Config.Additional.KnifeEnabled) + SetupKnifeMenu(); + if (Config.Additional.SkinEnabled) + SetupSkinsMenu(); + if (Config.Additional.GloveEnabled) + SetupGlovesMenu(); + if (Config.Additional.AgentEnabled) + SetupAgentsMenu(); + if (Config.Additional.MusicEnabled) + SetupMusicMenu(); + if (Config.Additional.PinsEnabled) + SetupPinsMenu(); + + RegisterCommands(); } catch (Exception) { diff --git a/WeaponSynchronization.cs b/WeaponSynchronization.cs index 801bdc8e..81c04f8f 100644 --- a/WeaponSynchronization.cs +++ b/WeaponSynchronization.cs @@ -131,6 +131,8 @@ private void GetWeaponPaintsFromDatabase(PlayerInfo? player, MySqlConnection con float weaponWear = row?.weapon_wear ?? 0f; int weaponSeed = row?.weapon_seed ?? 0; string weaponNameTag = row?.weapon_nametag ?? ""; + bool weaponStatTrak = row?.weapon_stattrak ?? false; + int weaponStatTrakCount = row?.weapon_stattrak_count ?? 0; string[]? keyChainParts = row?.weapon_keychain?.ToString().Split(';'); @@ -167,7 +169,9 @@ private void GetWeaponPaintsFromDatabase(PlayerInfo? player, MySqlConnection con Seed = weaponSeed, Wear = weaponWear, Nametag = weaponNameTag, - KeyChain = keyChainInfo + KeyChain = keyChainInfo, + StatTrak = weaponStatTrak, + StatTrakCount = weaponStatTrakCount, }; // Retrieve and parse sticker data (up to 5 slots) @@ -371,6 +375,22 @@ internal async Task SyncMusicToDatabase(PlayerInfo player, ushort music) { Utility.Log($"Error syncing music kit to database: {e.Message}"); } + } + + internal async Task SyncPinToDatabase(PlayerInfo player, ushort pin) + { + if (!_config.Additional.PinsEnabled || string.IsNullOrEmpty(player.SteamId)) return; + + try + { + await using var connection = await _database.GetConnectionAsync(); + const string query = "INSERT INTO `wp_player_pins` (`steamid`, `id`) VALUES(@steamid, @newPin) ON DUPLICATE KEY UPDATE `id` = @newPin"; + await connection.ExecuteAsync(query, new { steamid = player.SteamId, newPin = pin }); + } + catch (Exception e) + { + Utility.Log($"Error syncing pin to database: {e.Message}"); + } } internal async Task SyncStatTrakToDatabase(PlayerInfo player, ConcurrentDictionary weaponInfos) diff --git a/lang/en.json b/lang/en.json index b0f91dd9..7aa58373 100644 --- a/lang/en.json +++ b/lang/en.json @@ -6,6 +6,7 @@ "wp_info_glove": "Type {lime}!gloves{default} to open gloves menu", "wp_info_agent": "Type {lime}!agents{default} to open agents menu", "wp_info_music": "Type {lime}!music{default} to open music menu", + "wp_info_pin": "Type {lime}!pins{default} to open pins menu", "wp_command_cooldown": "{lightred}You can't refresh weapon paints right now", "wp_command_refresh_done": "{lime}Refreshing weapon paints", "wp_knife_menu_select": "You have chosen {lime}{0}{default} as your knife", @@ -17,6 +18,8 @@ "wp_agent_menu_title": "Agents Menu", "wp_music_menu_title": "Music Menu", "wp_music_menu_select": "You have chosen {lime}{0}{default} as your music kit", + "wp_pins_menu_title": "Pins Menu", + "wp_pins_menu_select": "You have chosen {lime}{0}{default} as your pin", "wp_skin_menu_weapon_title": "Weapon Menu", "wp_skin_menu_skin_title": "Select skin for {lime}{0}{default}", "wp_skin_menu_select": "You have chosen {lime}{0}{default} as your skin", diff --git a/lang/lv.json b/lang/lv.json index 7daeeea7..c81b071e 100644 --- a/lang/lv.json +++ b/lang/lv.json @@ -6,6 +6,7 @@ "wp_info_glove": "Ievadiet {lime}!gloves{default}, lai atvērtu cimdi izvēlni", "wp_info_agent": "Ievadiet {lime}!agents{default}, lai atvērtu aģentu izvēlni", "wp_info_music": "Ievadiet {lime}!music{default}, lai atvērtu mūzikas izvēlni", + "wp_info_pin": "Ierakstiet {lime}!pins{default}, lai atvērtu piespraudes izvēlni", "wp_command_cooldown": "{lightred}Šobrīd nevarat atsvaidzināt ieroča krāsas", "wp_command_refresh_done": "{lime}Atsvaidzinot ieroča krāsas", "wp_knife_menu_select": "Jūs esat izvēlējies {lime}{0}{default} kā savu nazi", @@ -17,6 +18,8 @@ "wp_agent_menu_title": "Aģentu Izvēlne", "wp_music_menu_title": "Mūzikas Izvēlne", "wp_music_menu_select": "Jūs esat izvēlējies {lime}{0}{default} kā savu mūzikas komplektu", + "wp_pins_menu_title": "Piespraužu izvēlne", + "wp_pins_menu_select": "Jūs esat izvēlējies {lime}{0}{default} kā savu piespraudi", "wp_skin_menu_weapon_title": "Ieroču Izvēlne", "wp_skin_menu_skin_title": "Izvēlieties ādu priekš {lime}{0}{default}", "wp_skin_menu_select": "Jūs esat izvēlējies {lime}{0}{default} kā savu ādu", diff --git a/lang/pl.json b/lang/pl.json index 22e2f55a..c1a4cd49 100644 --- a/lang/pl.json +++ b/lang/pl.json @@ -6,6 +6,7 @@ "wp_info_glove": "Wpisz {lime}!gloves{default}, aby otworzyć menu rękawic", "wp_info_agent": "Wpisz {lime}!agents{default}, aby otworzyć menu agentów", "wp_info_music": "Wpisz {lime}!music{default}, aby otworzyć menu muzyczne", + "wp_info_pin": "Wpisz {lime}!pins{default}, aby otworzyć menu pinów", "wp_command_cooldown": "{lightred}Nie możesz teraz odświeżyć kolorów broni", "wp_command_refresh_done": "{lime}Odświeżanie kolorów broni", "wp_knife_menu_select": "Wybrałeś {lime}{0}{default} jako swój nóż", @@ -17,6 +18,8 @@ "wp_agent_menu_title": "Menu Agentów", "wp_music_menu_title": "Menu Muzyczne", "wp_music_menu_select": "Wybrałeś {lime}{0}{default} jako swój zestaw muzyczny", + "wp_pins_menu_title": "Menu Pinów", + "wp_pins_menu_select": "Wybrałeś {lime}{0}{default} jako swój pin", "wp_skin_menu_weapon_title": "Menu Broni", "wp_skin_menu_skin_title": "Wybierz skórkę dla {lime}{0}{default}", "wp_skin_menu_select": "Wybrałeś {lime}{0}{default} jako swoją skórkę", diff --git a/lang/pt-BR.json b/lang/pt-BR.json index f7921f8c..c7c43608 100644 --- a/lang/pt-BR.json +++ b/lang/pt-BR.json @@ -6,6 +6,7 @@ "wp_info_glove": "Digite {lime}!gloves{default} para abrir o menu de luvas", "wp_info_agent": "Digite {lime}!agents{default} para abrir o menu de agentes", "wp_info_music": "Digite {lime}!music{default} para abrir o menu de música", + "wp_info_pin": "Digite {lime}!pins{default} para abrir o menu de pins", "wp_command_cooldown": "{lightred}Você não pode atualizar as skins de armas agora", "wp_command_refresh_done": "{lime}Atualizando as skins de armas", "wp_knife_menu_select": "Você escolheu {lime}{0}{default} como sua faca", @@ -17,6 +18,8 @@ "wp_agent_menu_title": "Menu de Agentes", "wp_music_menu_title": "Menu de Música", "wp_music_menu_select": "Você escolheu {lime}{0}{default} como seu kit de música", + "wp_pins_menu_title": "Menu de Pins", + "wp_pins_menu_select": "Escolheu {lime}{0}{default} como o seu pin", "wp_skin_menu_weapon_title": "Menu de Armas", "wp_skin_menu_skin_title": "Selecione a skin para {lime}{0}{default}", "wp_skin_menu_select": "Você escolheu {lime}{0}{default} como sua skin", diff --git a/lang/pt-PT.json b/lang/pt-PT.json index 36f32e1c..28c9674b 100644 --- a/lang/pt-PT.json +++ b/lang/pt-PT.json @@ -6,6 +6,7 @@ "wp_info_glove": "Digite {lime}!gloves{default} para abrir o menu de luvas", "wp_info_agent": "Digite {lime}!agents{default} para abrir o menu de agentes", "wp_info_music": "Digite {lime}!music{default} para abrir o menu de música", + "wp_info_pin": "Escreva {lime}!pins{default} para abrir o menu de pins", "wp_command_cooldown": "{lightred}Não pode atualizar as skins de armas de momento", "wp_command_refresh_done": "{lime}Atualizando as skins de armas", "wp_knife_menu_select": "Escolheu {lime}{0}{default} como a sua faca", @@ -17,6 +18,8 @@ "wp_agent_menu_title": "Menu de Agentes", "wp_music_menu_title": "Menu de Música", "wp_music_menu_select": "Escolheu {lime}{0}{default} como o seu kit de música", + "wp_pins_menu_title": "Menu de Pins", + "wp_pins_menu_select": "Escolheu {lime}{0}{default} como o seu pin", "wp_skin_menu_weapon_title": "Menu de Armas", "wp_skin_menu_skin_title": "Selecione a skin para {lime}{0}{default}", "wp_skin_menu_select": "Escolheu {lime}{0}{default} como a sua skin", diff --git a/lang/ru.json b/lang/ru.json index 034f60a5..81d770bc 100644 --- a/lang/ru.json +++ b/lang/ru.json @@ -6,6 +6,7 @@ "wp_info_glove": "Введите {lime}!gloves{default}, чтобы открыть меню перчаток", "wp_info_agent": "Введите {lime}!agents{default}, чтобы открыть меню агентов", "wp_info_music": "Введите {lime}!music{default}, чтобы открыть меню музыки", + "wp_info_pin": "Введите {lime}!pins{default}, чтобы открыть меню пинов", "wp_command_cooldown": "{lightred}Вы не можете обновить раскраску оружия сейчас", "wp_command_refresh_done": "{lime}Обновление раскраски оружия", "wp_knife_menu_select": "Вы выбрали {lime}{0}{default} в качестве вашего ножа", @@ -17,6 +18,8 @@ "wp_agent_menu_title": "Меню Агентов", "wp_music_menu_title": "Меню Музыки", "wp_music_menu_select": "Вы выбрали {lime}{0}{default} в качестве вашего музыкального набора", + "wp_pins_menu_title": "Меню пинов", + "wp_pins_menu_select": "Вы выбрали {lime}{0}{default} в качестве своего пина", "wp_skin_menu_weapon_title": "Меню Оружия", "wp_skin_menu_skin_title": "Выберите скин для {lime}{0}{default}", "wp_skin_menu_select": "Вы выбрали {lime}{0}{default} в качестве вашего скина", diff --git a/lang/tr.json b/lang/tr.json index 7f1737e1..43d36ba3 100644 --- a/lang/tr.json +++ b/lang/tr.json @@ -6,6 +6,7 @@ "wp_info_glove": "Handskar menüsünü açmak için {lime}!gloves{default} yazın", "wp_info_agent": "Ajan menüsünü açmak için {lime}!agents{default} yazın", "wp_info_music": "Müzik menüsünü açmak için {lime}!music{default} yazın", + "wp_info_pin": "{lime}!pins{default} yazarak pinler menüsünü açın", "wp_command_cooldown": "{lightred}Şu anda silah boyalarını yenileyemezsiniz", "wp_command_refresh_done": "{lime}Silah boyaları yenileniyor", "wp_knife_menu_select": "{lime}{0}{default} olarak bıçağınızı seçtiniz", @@ -17,6 +18,8 @@ "wp_agent_menu_title": "Ajanlar Menüsü", "wp_music_menu_title": "Müzik Menüsü", "wp_music_menu_select": "{lime}{0}{default} olarak müzik setinizi seçtiniz", + "wp_pins_menu_title": "Pinler Menüsü", + "wp_pins_menu_select": "{lime}{0}{default} pinini seçtiniz", "wp_skin_menu_weapon_title": "Silah Menüsü", "wp_skin_menu_skin_title": "{lime}{0}{default} için cilt seçin", "wp_skin_menu_select": "{lime}{0}{default} olarak cildinizi seçtiniz", diff --git a/lang/ua.json b/lang/ua.json index 17367faa..34aa3309 100644 --- a/lang/ua.json +++ b/lang/ua.json @@ -6,6 +6,7 @@ "wp_info_glove": "Введіть {lime}!gloves{default}, щоб відкрити меню рукавичок", "wp_info_agent": "Введіть {lime}!agents{default}, щоб відкрити меню агентів", "wp_info_music": "Введіть {lime}!music{default}, щоб відкрити меню музики", + "wp_info_pin": "Введіть {lime}!pins{default}, щоб відкрити меню пінів", "wp_command_cooldown": "{lightred}Ви не можете оновити фарби зброї зараз", "wp_command_refresh_done": "{lime}Оновлення фарби зброї", "wp_knife_menu_select": "Ви обрали {lime}{0}{default} як свій ніж", @@ -17,6 +18,8 @@ "wp_agent_menu_title": "Меню Агентів", "wp_music_menu_title": "Меню Музики", "wp_music_menu_select": "Ви обрали {lime}{0}{default} як свій набір музики", + "wp_pins_menu_title": "Меню пінів", + "wp_pins_menu_select": "Ви вибрали {lime}{0}{default} як свій пін", "wp_skin_menu_weapon_title": "Меню Зброї", "wp_skin_menu_skin_title": "Виберіть шкіру для {lime}{0}{default}", "wp_skin_menu_select": "Ви обрали {lime}{0}{default} як свою шкіру", diff --git a/lang/zh-cn.json b/lang/zh-cn.json index 4b3dc5f8..4e82faaf 100644 --- a/lang/zh-cn.json +++ b/lang/zh-cn.json @@ -6,6 +6,7 @@ "wp_info_glove": "输入 {lime}!gloves{default} 打开手套菜单", "wp_info_agent": "输入 {lime}!agents{default} 打开代理菜单", "wp_info_music": "输入 {lime}!music{default} 打开音乐菜单", + "wp_info_pin": "输入 {lime}!pins{default} 来打开固定项菜单", "wp_command_cooldown": "{lightred}您现在无法刷新武器涂装", "wp_command_refresh_done": "{lime}正在刷新武器涂装", "wp_knife_menu_select": "您选择了 {lime}{0}{default} 作为您的刀具", @@ -17,6 +18,8 @@ "wp_agent_menu_title": "代理菜单", "wp_music_menu_title": "音乐菜单", "wp_music_menu_select": "您选择了 {lime}{0}{default} 作为您的音乐包", + "wp_pins_menu_title": "固定项菜单", + "wp_pins_menu_select": "您已选择 {lime}{0}{default} 作为您的固定项", "wp_skin_menu_weapon_title": "武器菜单", "wp_skin_menu_skin_title": "选择 {lime}{0}{default} 的皮肤", "wp_skin_menu_select": "您选择了 {lime}{0}{default} 作为您的皮肤", From ff095198a1e64f1c16ccb39330235e91b048c1b0 Mon Sep 17 00:00:00 2001 From: Dawid Bepierszcz <41084667+daffyyyy@users.noreply.github.com> Date: Sat, 19 Oct 2024 02:10:08 +0200 Subject: [PATCH 2/2] Update Config.cs --- Config.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Config.cs b/Config.cs index d17082e3..0c8b29b4 100644 --- a/Config.cs +++ b/Config.cs @@ -36,7 +36,7 @@ public class Additional public List CommandMusic { get; set; } = ["music"]; [JsonPropertyName("CommandPin")] - public List CommandPin { get; set; } = ["pins"]; + public List CommandPin { get; set; } = ["pin", "pins", "coin", "coins"]; [JsonPropertyName("CommandGlove")] public List CommandGlove { get; set; } = ["gloves"]; @@ -68,7 +68,7 @@ public class Additional public class WeaponPaintsConfig : BasePluginConfig { - [JsonPropertyName("ConfigVersion")] public override int Version { get; set; } = 8; + [JsonPropertyName("ConfigVersion")] public override int Version { get; set; } = 9; [JsonPropertyName("SkinsLanguage")] public string SkinsLanguage { get; set; } = "en";