Skip to content

Commit

Permalink
Merge pull request #332 from daffyyyy/main
Browse files Browse the repository at this point in the history
3.0b
  • Loading branch information
daffyyyy authored Oct 20, 2024
2 parents a5397e3 + 7493ee4 commit 48b9679
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 15 deletions.
14 changes: 3 additions & 11 deletions Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
3 changes: 3 additions & 0 deletions Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0a
3.0b
2 changes: 2 additions & 0 deletions Variables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,6 @@ public partial class WeaponPaints

internal static IMenuApi? MenuApi;
private static readonly PluginCapability<IMenuApi> MenuCapability = new("menu:nfcore");

private int _fadeSeed;
}
13 changes: 11 additions & 2 deletions WeaponAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion WeaponPaints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig
public override string ModuleAuthor => "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)
{
Expand Down

0 comments on commit 48b9679

Please sign in to comment.