From 686c225f4f9341ced0594aeebc27251be6b035e4 Mon Sep 17 00:00:00 2001 From: Dawid Bepierszcz <41084667+daffyyyy@users.noreply.github.com> Date: Sun, 20 Oct 2024 15:35:20 +0200 Subject: [PATCH] 3.0b - Fix for fade skins (same seed if 0 by default) --- Commands.cs | 14 +++----------- Events.cs | 3 +++ VERSION | 2 +- Variables.cs | 2 ++ WeaponAction.cs | 13 +++++++++++-- WeaponPaints.cs | 2 +- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Commands.cs b/Commands.cs index 3a3db02a..2420de64 100644 --- a/Commands.cs +++ b/Commands.cs @@ -164,17 +164,9 @@ private void OnCommandStattrak(CCSPlayerController? player, CommandInfo commandI if (!teamWeapons.TryGetValue(weapon.AttributeManager.Item.ItemDefinitionIndex, out var teamWeapon)) return; - if (teamWeapon.StatTrak) - { - teamWeapon.StatTrak = false; - RefreshWeapons(player); - } - else - { - teamWeapon.StatTrak = true; - RefreshWeapons(player); - } - + teamWeapon.StatTrak = !teamWeapon.StatTrak; + RefreshWeapons(player); + if (!string.IsNullOrEmpty(Localizer["wp_stattrak_action"])) { player.Print(Localizer["wp_stattrak_action"]); diff --git a/Events.cs b/Events.cs index 424ff64d..75ac4e34 100644 --- a/Events.cs +++ b/Events.cs @@ -121,6 +121,9 @@ private void OnMapStart(string mapName) if (Database != null) WeaponSync = new WeaponSynchronization(Database, Config); + + _fadeSeed = 0; + _nextItemId = MinimumCustomItemId; } private HookResult OnPlayerSpawn(EventPlayerSpawn @event, GameEventInfo info) diff --git a/VERSION b/VERSION index 4264043f..f4565539 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0a \ No newline at end of file +3.0b \ No newline at end of file diff --git a/Variables.cs b/Variables.cs index b901868f..e6de47d3 100644 --- a/Variables.cs +++ b/Variables.cs @@ -165,4 +165,6 @@ public partial class WeaponPaints internal static IMenuApi? MenuApi; private static readonly PluginCapability MenuCapability = new("menu:nfcore"); + + private int _fadeSeed; } \ No newline at end of file diff --git a/WeaponAction.cs b/WeaponAction.cs index 6a969c57..941bc64f 100644 --- a/WeaponAction.cs +++ b/WeaponAction.cs @@ -44,7 +44,7 @@ private void GivePlayerWeaponSkin(CCSPlayerController player, CBasePlayerWeapon UpdatePlayerEconItemId(weapon.AttributeManager.Item); int weaponDefIndex = weapon.AttributeManager.Item.ItemDefinitionIndex; - int fallbackPaintKit = 0; + int fallbackPaintKit; weapon.AttributeManager.Item.AccountID = (uint)player.SteamID; @@ -98,7 +98,16 @@ private void GivePlayerWeaponSkin(CCSPlayerController player, CBasePlayerWeapon weapon.AttributeManager.Item.ItemIDHigh = weapon.AttributeManager.Item.ItemIDLow >> 32; weapon.AttributeManager.Item.CustomName = weaponInfo.Nametag; weapon.FallbackPaintKit = weaponInfo.Paint; - weapon.FallbackSeed = weaponInfo.Seed; + + if (weaponInfo is { Paint: 38, Seed: 0 }) + { + weapon.FallbackSeed = _fadeSeed++; + } + else + { + weapon.FallbackSeed = weaponInfo.Seed; + } + weapon.FallbackWear = weaponInfo.Wear; CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle, "set item texture prefab", weapon.FallbackPaintKit); diff --git a/WeaponPaints.cs b/WeaponPaints.cs index adac6a71..4ff0d7c2 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 => "3.0a"; + public override string ModuleVersion => "3.0b"; public override void Load(bool hotReload) {