mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-02-26 05:04:47 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db20e2eef9 | ||
|
|
536cea96d6 | ||
|
|
84684f4a26 | ||
|
|
48b9679236 | ||
|
|
7493ee4c7f | ||
|
|
027a547052 | ||
|
|
686c225f4f |
14
Commands.cs
14
Commands.cs
@@ -164,17 +164,9 @@ public partial class WeaponPaints
|
|||||||
if (!teamWeapons.TryGetValue(weapon.AttributeManager.Item.ItemDefinitionIndex, out var teamWeapon))
|
if (!teamWeapons.TryGetValue(weapon.AttributeManager.Item.ItemDefinitionIndex, out var teamWeapon))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (teamWeapon.StatTrak)
|
teamWeapon.StatTrak = !teamWeapon.StatTrak;
|
||||||
{
|
RefreshWeapons(player);
|
||||||
teamWeapon.StatTrak = false;
|
|
||||||
RefreshWeapons(player);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
teamWeapon.StatTrak = true;
|
|
||||||
RefreshWeapons(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Localizer["wp_stattrak_action"]))
|
if (!string.IsNullOrEmpty(Localizer["wp_stattrak_action"]))
|
||||||
{
|
{
|
||||||
player.Print(Localizer["wp_stattrak_action"]);
|
player.Print(Localizer["wp_stattrak_action"]);
|
||||||
|
|||||||
@@ -121,6 +121,9 @@ namespace WeaponPaints
|
|||||||
|
|
||||||
if (Database != null)
|
if (Database != null)
|
||||||
WeaponSync = new WeaponSynchronization(Database, Config);
|
WeaponSync = new WeaponSynchronization(Database, Config);
|
||||||
|
|
||||||
|
_fadeSeed = 0;
|
||||||
|
_nextItemId = MinimumCustomItemId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private HookResult OnPlayerSpawn(EventPlayerSpawn @event, GameEventInfo info)
|
private HookResult OnPlayerSpawn(EventPlayerSpawn @event, GameEventInfo info)
|
||||||
|
|||||||
@@ -165,4 +165,6 @@ public partial class WeaponPaints
|
|||||||
|
|
||||||
internal static IMenuApi? MenuApi;
|
internal static IMenuApi? MenuApi;
|
||||||
private static readonly PluginCapability<IMenuApi> MenuCapability = new("menu:nfcore");
|
private static readonly PluginCapability<IMenuApi> MenuCapability = new("menu:nfcore");
|
||||||
|
|
||||||
|
private int _fadeSeed;
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ namespace WeaponPaints
|
|||||||
UpdatePlayerEconItemId(weapon.AttributeManager.Item);
|
UpdatePlayerEconItemId(weapon.AttributeManager.Item);
|
||||||
|
|
||||||
int weaponDefIndex = weapon.AttributeManager.Item.ItemDefinitionIndex;
|
int weaponDefIndex = weapon.AttributeManager.Item.ItemDefinitionIndex;
|
||||||
int fallbackPaintKit = 0;
|
int fallbackPaintKit;
|
||||||
|
|
||||||
weapon.AttributeManager.Item.AccountID = (uint)player.SteamID;
|
weapon.AttributeManager.Item.AccountID = (uint)player.SteamID;
|
||||||
|
|
||||||
@@ -85,7 +85,11 @@ namespace WeaponPaints
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GPlayerWeaponsInfo[player.Slot][player.Team].TryGetValue(weaponDefIndex, out var value) || value.Paint == 0) return;
|
if (!GPlayerWeaponsInfo.TryGetValue(player.Slot, out var teamInfo) ||
|
||||||
|
!teamInfo.TryGetValue(player.Team, out var teamWeapons) )
|
||||||
|
return;
|
||||||
|
if (!teamWeapons.TryGetValue(weaponDefIndex, out var value))
|
||||||
|
return;
|
||||||
|
|
||||||
var weaponInfo = value;
|
var weaponInfo = value;
|
||||||
//Log($"Apply on {weapon.DesignerName}({weapon.AttributeManager.Item.ItemDefinitionIndex}) paint {gPlayerWeaponPaints[steamId.SteamId64][weapon.AttributeManager.Item.ItemDefinitionIndex]} seed {gPlayerWeaponSeed[steamId.SteamId64][weapon.AttributeManager.Item.ItemDefinitionIndex]} wear {gPlayerWeaponWear[steamId.SteamId64][weapon.AttributeManager.Item.ItemDefinitionIndex]}");
|
//Log($"Apply on {weapon.DesignerName}({weapon.AttributeManager.Item.ItemDefinitionIndex}) paint {gPlayerWeaponPaints[steamId.SteamId64][weapon.AttributeManager.Item.ItemDefinitionIndex]} seed {gPlayerWeaponSeed[steamId.SteamId64][weapon.AttributeManager.Item.ItemDefinitionIndex]} wear {gPlayerWeaponWear[steamId.SteamId64][weapon.AttributeManager.Item.ItemDefinitionIndex]}");
|
||||||
@@ -98,7 +102,16 @@ namespace WeaponPaints
|
|||||||
weapon.AttributeManager.Item.ItemIDHigh = weapon.AttributeManager.Item.ItemIDLow >> 32;
|
weapon.AttributeManager.Item.ItemIDHigh = weapon.AttributeManager.Item.ItemIDLow >> 32;
|
||||||
weapon.AttributeManager.Item.CustomName = weaponInfo.Nametag;
|
weapon.AttributeManager.Item.CustomName = weaponInfo.Nametag;
|
||||||
weapon.FallbackPaintKit = weaponInfo.Paint;
|
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;
|
weapon.FallbackWear = weaponInfo.Wear;
|
||||||
CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle, "set item texture prefab", weapon.FallbackPaintKit);
|
CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle, "set item texture prefab", weapon.FallbackPaintKit);
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig
|
|||||||
public override string ModuleAuthor => "Nereziel & daffyy";
|
public override string ModuleAuthor => "Nereziel & daffyy";
|
||||||
public override string ModuleDescription => "Skin, gloves, agents and knife selector, standalone and web-based";
|
public override string ModuleDescription => "Skin, gloves, agents and knife selector, standalone and web-based";
|
||||||
public override string ModuleName => "WeaponPaints";
|
public override string ModuleName => "WeaponPaints";
|
||||||
public override string ModuleVersion => "3.0a";
|
public override string ModuleVersion => "3.0b";
|
||||||
|
|
||||||
public override void Load(bool hotReload)
|
public override void Load(bool hotReload)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user