Compare commits

...

10 Commits

Author SHA1 Message Date
Dawid Bepierszcz
c418de1e17 Merge pull request #349 from daffyyyy/main
3.1c
2024-10-28 21:15:27 +01:00
Dawid Bepierszcz
82e73e764e Merge branch 'Nereziel:main' into main 2024-10-28 21:13:38 +01:00
Dawid Bepierszcz
ad6c7df357 3.1c
- Fix for custom weapons
2024-10-28 21:13:12 +01:00
Dawid Bepierszcz
a1fa8f37c7 Merge pull request #345 from daffyyyy/main
Website fix
2024-10-24 21:06:49 +02:00
Dawid Bepierszcz
475e91e779 Merge branch 'main' of https://github.com/daffyyyy/cs2-WeaponPaints 2024-10-24 21:00:59 +02:00
Dawid Bepierszcz
a136f5472e Website fix
- Website fix (still missing new features)
2024-10-24 21:00:44 +02:00
Dawid Bepierszcz
b5d7f12024 Merge pull request #344 from daffyyyy/main
3.2b
2024-10-24 18:04:32 +02:00
Dawid Bepierszcz
9ec64e346f Merge branch 'Nereziel:main' into main 2024-10-24 18:02:40 +02:00
Dawid Bepierszcz
b4dc20523c Merge branch 'main' of https://github.com/daffyyyy/cs2-WeaponPaints 2024-10-24 18:02:28 +02:00
Dawid Bepierszcz
8891ce815e 3.2b
- Schema for stickers when using custom coords
- Fixed some not found team key
2024-10-24 18:02:25 +02:00
1744 changed files with 119 additions and 110 deletions

View File

@@ -153,18 +153,15 @@ public partial class WeaponPaints
{ {
if (player == null || !player.IsValid) return; if (player == null || !player.IsValid) return;
if (!GPlayerWeaponsInfo.TryGetValue(player.Slot, out var teamInfo) ||
!teamInfo.TryGetValue(player.Team, out var teamWeapons) )
return;
var weapon = player.PlayerPawn.Value?.WeaponServices?.ActiveWeapon.Value; var weapon = player.PlayerPawn.Value?.WeaponServices?.ActiveWeapon.Value;
if (weapon == null || !weapon.IsValid) if (weapon == null || !weapon.IsValid)
return; return;
if (!teamWeapons.TryGetValue(weapon.AttributeManager.Item.ItemDefinitionIndex, out var teamWeapon))
return;
teamWeapon.StatTrak = !teamWeapon.StatTrak; if (!HasChangedPaint(player, weapon.AttributeManager.Item.ItemDefinitionIndex, out var weaponInfo) || weaponInfo == null)
return;
weaponInfo.StatTrak = !weaponInfo.StatTrak;
RefreshWeapons(player); RefreshWeapons(player);
if (!string.IsNullOrEmpty(Localizer["wp_stattrak_action"])) if (!string.IsNullOrEmpty(Localizer["wp_stattrak_action"]))
@@ -337,7 +334,7 @@ public partial class WeaponPaints
value.Seed = 0; value.Seed = 0;
} }
PlayerInfo playerInfo = new PlayerInfo var playerInfo = new PlayerInfo
{ {
UserId = p.UserId, UserId = p.UserId,
Slot = p.Slot, Slot = p.Slot,

View File

@@ -2,7 +2,6 @@
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration; using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Entities; using CounterStrikeSharp.API.Modules.Entities;
using CounterStrikeSharp.API.Modules.Entities.Constants;
using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions; using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
@@ -194,7 +193,7 @@ namespace WeaponPaints
return HookResult.Continue; return HookResult.Continue;
} }
public HookResult OnGiveNamedItemPost(DynamicHook hook) private HookResult OnGiveNamedItemPost(DynamicHook hook)
{ {
try try
{ {
@@ -206,15 +205,7 @@ namespace WeaponPaints
var player = GetPlayerFromItemServices(itemServices); var player = GetPlayerFromItemServices(itemServices);
if (player != null) if (player != null)
{ {
var weaponServices = player.PlayerPawn.Value?.WeaponServices;
GivePlayerWeaponSkin(player, weapon); GivePlayerWeaponSkin(player, weapon);
if (weaponServices is { MyWeapons.Count: 1 })
{
// player.GiveNamedItem(CsItem.Healthshot);
// newWeapon.AddEntityIOEvent("Kill", newWeapon, null, "", 0.1f);
}
} }
} }
catch { } catch { }
@@ -222,7 +213,7 @@ namespace WeaponPaints
return HookResult.Continue; return HookResult.Continue;
} }
public void OnEntityCreated(CEntityInstance entity) private void OnEntityCreated(CEntityInstance entity)
{ {
var designerName = entity.DesignerName; var designerName = entity.DesignerName;
@@ -289,9 +280,15 @@ namespace WeaponPaints
{ {
// if (!IsWindows) return HookResult.Continue; // if (!IsWindows) return HookResult.Continue;
var player = @event.Userid; var player = @event.Userid;
if (player == null || !player.IsValid || player.IsBot) return HookResult.Continue;
if (!@event.Item.Contains("knife")) return HookResult.Continue; if (!@event.Item.Contains("knife")) return HookResult.Continue;
var weaponDefIndex = (int)@event.Defindex;
if (!HasChangedKnife(player, out var _) || !HasChangedPaint(player, weaponDefIndex, out var _))
return HookResult.Continue;
if (player != null && player is { IsValid: true, Connected: PlayerConnectedState.PlayerConnected, PawnIsAlive: true, PlayerPawn.IsValid: true }) if (player is { Connected: PlayerConnectedState.PlayerConnected, PawnIsAlive: true, PlayerPawn.IsValid: true })
{ {
GiveOnItemPickup(player); GiveOnItemPickup(player);
} }
@@ -309,20 +306,16 @@ namespace WeaponPaints
if (victim == null || !victim.IsValid || victim == player) if (victim == null || !victim.IsValid || victim == player)
return HookResult.Continue; return HookResult.Continue;
if (!GPlayerWeaponsInfo.TryGetValue(player.Slot, out var teamInfo) ||
!teamInfo.TryGetValue(player.Team, out var teamWeapons) )
return HookResult.Continue;
CBasePlayerWeapon? weapon = player.PlayerPawn.Value?.WeaponServices?.ActiveWeapon.Value; CBasePlayerWeapon? weapon = player.PlayerPawn.Value?.WeaponServices?.ActiveWeapon.Value;
if (weapon == null) return HookResult.Continue; if (weapon == null) return HookResult.Continue;
int weaponDefIndex = weapon.AttributeManager.Item.ItemDefinitionIndex; int weaponDefIndex = weapon.AttributeManager.Item.ItemDefinitionIndex;
if (!teamWeapons.TryGetValue(weaponDefIndex, out var weaponInfo) || weaponInfo.Paint == 0) if (!HasChangedPaint(player, weaponDefIndex, out var weaponInfo) || weaponInfo == null)
return HookResult.Continue; return HookResult.Continue;
if (!weaponInfo.StatTrak) return HookResult.Continue; if (!weaponInfo.StatTrak) return HookResult.Continue;
weaponInfo.StatTrakCount += 1; weaponInfo.StatTrakCount += 1;

View File

@@ -1 +1 @@
3.1a 3.1c

View File

@@ -78,7 +78,6 @@ public partial class WeaponPaints
internal static readonly ConcurrentDictionary<int, ConcurrentDictionary<CsTeam, ushort>> GPlayersMusic = new(); internal static readonly ConcurrentDictionary<int, ConcurrentDictionary<CsTeam, ushort>> GPlayersMusic = new();
internal static readonly ConcurrentDictionary<int, ConcurrentDictionary<CsTeam, ushort>> GPlayersPin = new(); internal static readonly ConcurrentDictionary<int, ConcurrentDictionary<CsTeam, ushort>> GPlayersPin = new();
internal static readonly ConcurrentDictionary<int, (string? CT, string? T)> GPlayersAgent = new(); internal static readonly ConcurrentDictionary<int, (string? CT, string? T)> GPlayersAgent = new();
internal static readonly Dictionary<int, int> GPlayersKnivesPickup = [];
internal static readonly ConcurrentDictionary<int, ConcurrentDictionary<CsTeam, ConcurrentDictionary<int, WeaponInfo>>> GPlayerWeaponsInfo = new(); internal static readonly ConcurrentDictionary<int, ConcurrentDictionary<CsTeam, ConcurrentDictionary<int, WeaponInfo>>> GPlayerWeaponsInfo = new();
internal static List<JObject> SkinsList = []; internal static List<JObject> SkinsList = [];
internal static List<JObject> PinsList = []; internal static List<JObject> PinsList = [];

View File

@@ -20,27 +20,30 @@ namespace WeaponPaints
bool isKnife = weapon.DesignerName.Contains("knife") || weapon.DesignerName.Contains("bayonet"); bool isKnife = weapon.DesignerName.Contains("knife") || weapon.DesignerName.Contains("bayonet");
if (isKnife && !GPlayersKnife.ContainsKey(player.Slot) || switch (isKnife)
isKnife && GPlayersKnife[player.Slot][player.Team] == "weapon_knife") return;
if (isKnife)
{ {
var newDefIndex = WeaponDefindex.FirstOrDefault(x => x.Value == GPlayersKnife[player.Slot][player.Team]); case true when !HasChangedKnife(player, out var _):
if (newDefIndex.Key == 0) return; return;
if (weapon.AttributeManager.Item.ItemDefinitionIndex != newDefIndex.Key) case true:
{ {
SubclassChange(weapon, (ushort)newDefIndex.Key); var newDefIndex = WeaponDefindex.FirstOrDefault(x => x.Value == GPlayersKnife[player.Slot][player.Team]);
} if (newDefIndex.Key == 0) return;
weapon.AttributeManager.Item.ItemDefinitionIndex = (ushort)newDefIndex.Key; if (weapon.AttributeManager.Item.ItemDefinitionIndex != newDefIndex.Key)
weapon.AttributeManager.Item.EntityQuality = 3; {
SubclassChange(weapon, (ushort)newDefIndex.Key);
}
weapon.AttributeManager.Item.ItemDefinitionIndex = (ushort)newDefIndex.Key;
weapon.AttributeManager.Item.EntityQuality = 3;
break;
}
default:
weapon.AttributeManager.Item.EntityQuality = 0;
break;
} }
else
{
weapon.AttributeManager.Item.EntityQuality = 0;
}
UpdatePlayerEconItemId(weapon.AttributeManager.Item); UpdatePlayerEconItemId(weapon.AttributeManager.Item);
int weaponDefIndex = weapon.AttributeManager.Item.ItemDefinitionIndex; int weaponDefIndex = weapon.AttributeManager.Item.ItemDefinitionIndex;
@@ -52,7 +55,7 @@ namespace WeaponPaints
bool isLegacyModel; bool isLegacyModel;
if (_config.Additional.GiveRandomSkin && if (_config.Additional.GiveRandomSkin &&
!GPlayerWeaponsInfo[player.Slot][player.Team].ContainsKey(weaponDefIndex)) !HasChangedPaint(player, weaponDefIndex, out _))
{ {
// Random skins // Random skins
weapon.FallbackPaintKit = GetRandomPaint(weaponDefIndex); weapon.FallbackPaintKit = GetRandomPaint(weaponDefIndex);
@@ -85,13 +88,9 @@ namespace WeaponPaints
return; return;
} }
if (!GPlayerWeaponsInfo.TryGetValue(player.Slot, out var teamInfo) || if (!HasChangedPaint(player, weaponDefIndex, out var weaponInfo) || weaponInfo == null)
!teamInfo.TryGetValue(player.Team, out var teamWeapons) )
return;
if (!teamWeapons.TryGetValue(weaponDefIndex, out var value))
return; return;
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]}");
weapon.AttributeManager.Item.AttributeList.Attributes.RemoveAll(); weapon.AttributeManager.Item.AttributeList.Attributes.RemoveAll();
@@ -103,14 +102,7 @@ namespace WeaponPaints
weapon.AttributeManager.Item.CustomName = weaponInfo.Nametag; weapon.AttributeManager.Item.CustomName = weaponInfo.Nametag;
weapon.FallbackPaintKit = weaponInfo.Paint; weapon.FallbackPaintKit = weaponInfo.Paint;
if (weaponInfo is { Paint: 38, Seed: 0 }) weapon.FallbackSeed = weaponInfo is { Paint: 38, Seed: 0 } ? _fadeSeed++ : weaponInfo.Seed;
{
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);
@@ -149,9 +141,7 @@ namespace WeaponPaints
private void IncrementWearForWeaponWithStickers(CCSPlayerController player, CBasePlayerWeapon weapon) private void IncrementWearForWeaponWithStickers(CCSPlayerController player, CBasePlayerWeapon weapon)
{ {
int weaponDefIndex = weapon.AttributeManager.Item.ItemDefinitionIndex; int weaponDefIndex = weapon.AttributeManager.Item.ItemDefinitionIndex;
if (!GPlayerWeaponsInfo.TryGetValue(player.Slot, out var playerWeapons) || if (!HasChangedPaint(player, weaponDefIndex, out var weaponInfo) || weaponInfo == null ||
!playerWeapons.TryGetValue(player.Team, out var weaponInfoDict) ||
!weaponInfoDict.TryGetValue(weaponDefIndex, out var weaponInfo) ||
weaponInfo.Stickers.Count <= 0) return; weaponInfo.Stickers.Count <= 0) return;
float wearIncrement = 0.001f; float wearIncrement = 0.001f;
@@ -174,11 +164,8 @@ namespace WeaponPaints
int weaponDefIndex = weapon.AttributeManager.Item.ItemDefinitionIndex; int weaponDefIndex = weapon.AttributeManager.Item.ItemDefinitionIndex;
if (!GPlayerWeaponsInfo.TryGetValue(player.Slot, out var playerWeapons) || if (!HasChangedPaint(player ,weaponDefIndex, out var weaponInfo) || weaponInfo == null)
!playerWeapons[player.Team].TryGetValue(weaponDefIndex, out var weaponInfo))
{
return; return;
}
foreach (var sticker in weaponInfo.Stickers) foreach (var sticker in weaponInfo.Stickers)
{ {
@@ -186,15 +173,13 @@ namespace WeaponPaints
CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle, CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle,
$"sticker slot {stickerSlot} id", ViewAsFloat(sticker.Id)); $"sticker slot {stickerSlot} id", ViewAsFloat(sticker.Id));
// CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle, if (sticker.OffsetX != 0 || sticker.OffsetY != 0)
// $"sticker slot {stickerSlot} schema", stickerSlot); CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle,
// if (stickerSlot == 5) $"sticker slot {stickerSlot} schema", 0);
// {
CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle, CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle,
$"sticker slot {stickerSlot} offset x", sticker.OffsetX); $"sticker slot {stickerSlot} offset x", sticker.OffsetX);
CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle, CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle,
$"sticker slot {stickerSlot} offset y", sticker.OffsetY); $"sticker slot {stickerSlot} offset y", sticker.OffsetY);
// }
CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle, CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle,
$"sticker slot {stickerSlot} wear", sticker.Wear); $"sticker slot {stickerSlot} wear", sticker.Wear);
CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle, CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle,
@@ -216,9 +201,9 @@ namespace WeaponPaints
int weaponDefIndex = weapon.AttributeManager.Item.ItemDefinitionIndex; int weaponDefIndex = weapon.AttributeManager.Item.ItemDefinitionIndex;
if (!GPlayerWeaponsInfo.TryGetValue(player.Slot, out var playerWeaponsInfo) || if (!HasChangedPaint(player, weaponDefIndex, out var value) || value?.KeyChain == null)
!playerWeaponsInfo[player.Team].TryGetValue(weaponDefIndex, out var value) || return;
value.KeyChain == null) return;
var keyChain = value.KeyChain; var keyChain = value.KeyChain;
CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle, CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle,
@@ -406,9 +391,10 @@ namespace WeaponPaints
return; return;
if (!GPlayersGlove.TryGetValue(player.Slot, out var gloveInfo) || if (!GPlayersGlove.TryGetValue(player.Slot, out var gloveInfo) ||
!gloveInfo.TryGetValue(player.Team, out var gloveId) || gloveId == 0) return; !gloveInfo.TryGetValue(player.Team, out var gloveId) ||
gloveId == 0 ||
WeaponInfo weaponInfo = GPlayerWeaponsInfo[player.Slot][player.Team][gloveId]; !HasChangedPaint(player, gloveId, out var weaponInfo) || weaponInfo == null)
return;
item.ItemDefinitionIndex = gloveId; item.ItemDefinitionIndex = gloveId;
item.ItemIDLow = 16384 & 0xFFFFFFFF; item.ItemIDLow = 16384 & 0xFFFFFFFF;
@@ -582,6 +568,36 @@ namespace WeaponPaints
return viewModel.Value == null ? null : viewModel.Value; return viewModel.Value == null ? null : viewModel.Value;
} }
private static bool HasChangedKnife(CCSPlayerController player, out string? knifeValue)
{
knifeValue = null;
// Check if player has knife info for their slot and team
if (!GPlayersKnife.TryGetValue(player.Slot, out var knife) ||
!knife.TryGetValue(player.Team, out var value) ||
value == "weapon_knife") return false;
knifeValue = value; // Assign the knife value to the out parameter
return true;
}
private static bool HasChangedPaint(CCSPlayerController player, int weaponDefIndex, out WeaponInfo? weaponInfo)
{
weaponInfo = null;
// Check if player has weapons info for their slot and team
if (!GPlayerWeaponsInfo.TryGetValue(player.Slot, out var teamInfo) ||
!teamInfo.TryGetValue(player.Team, out var teamWeapons))
{
return false;
}
// Check if the specified weapon has a paint/skin change
if (!teamWeapons.TryGetValue(weaponDefIndex, out var value) || value.Paint <= 0) return false;
weaponInfo = value; // Assign the out variable when it exists
return true;
}
private static float ViewAsFloat(uint value) private static float ViewAsFloat(uint value)
{ {
return BitConverter.Int32BitsToSingle((int)value); return BitConverter.Int32BitsToSingle((int)value);

View File

@@ -1,7 +1,6 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes; using CounterStrikeSharp.API.Core.Attributes;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using MySqlConnector; using MySqlConnector;
@@ -17,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.1a"; public override string ModuleVersion => "3.1c";
public override void Load(bool hotReload) public override void Load(bool hotReload)
{ {
@@ -40,7 +39,6 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig
!string.IsNullOrEmpty(player.IpAddress) && player is !string.IsNullOrEmpty(player.IpAddress) && player is
{ IsBot: false, Connected: PlayerConnectedState.PlayerConnected })) { IsBot: false, Connected: PlayerConnectedState.PlayerConnected }))
{ {
GPlayersKnivesPickup[player.Slot] = 0;
var playerInfo = new PlayerInfo var playerInfo = new PlayerInfo
{ {
UserId = player.UserId, UserId = player.UserId,

View File

@@ -49,7 +49,7 @@ internal class WeaponSynchronization
if (!_config.Additional.KnifeEnabled || string.IsNullOrEmpty(player?.SteamId)) if (!_config.Additional.KnifeEnabled || string.IsNullOrEmpty(player?.SteamId))
return; return;
const string query = "SELECT `knife`, `weapon_team` FROM `wp_player_knife` WHERE `steamid` = @steamid"; const string query = "SELECT `knife`, `weapon_team` FROM `wp_player_knife` WHERE `steamid` = @steamid ORDER BY `weapon_team` ASC";
var rows = connection.Query<dynamic>(query, new { steamid = player.SteamId }); // Retrieve all records for the player var rows = connection.Query<dynamic>(query, new { steamid = player.SteamId }); // Retrieve all records for the player
foreach (var row in rows) foreach (var row in rows)
@@ -60,9 +60,9 @@ internal class WeaponSynchronization
// Determine the weapon team based on the query result // Determine the weapon team based on the query result
CsTeam weaponTeam = (int)row.weapon_team switch CsTeam weaponTeam = (int)row.weapon_team switch
{ {
0 => CsTeam.None,
2 => CsTeam.Terrorist, 2 => CsTeam.Terrorist,
_ => CsTeam.CounterTerrorist 3 => CsTeam.CounterTerrorist,
_ => CsTeam.None,
}; };
// Get or create entries for the players slot // Get or create entries for the players slot
@@ -94,7 +94,7 @@ internal class WeaponSynchronization
if (!_config.Additional.GloveEnabled || string.IsNullOrEmpty(player?.SteamId)) if (!_config.Additional.GloveEnabled || string.IsNullOrEmpty(player?.SteamId))
return; return;
const string query = "SELECT `weapon_defindex`, `weapon_team` FROM `wp_player_gloves` WHERE `steamid` = @steamid"; const string query = "SELECT `weapon_defindex`, `weapon_team` FROM `wp_player_gloves` WHERE `steamid` = @steamid ORDER BY `weapon_team` ASC";
var rows = connection.Query<dynamic>(query, new { steamid = player.SteamId }); // Retrieve all records for the player var rows = connection.Query<dynamic>(query, new { steamid = player.SteamId }); // Retrieve all records for the player
foreach (var row in rows) foreach (var row in rows)
@@ -105,9 +105,9 @@ internal class WeaponSynchronization
var playerGloves = WeaponPaints.GPlayersGlove.GetOrAdd(player.Slot, _ => new ConcurrentDictionary<CsTeam, ushort>()); var playerGloves = WeaponPaints.GPlayersGlove.GetOrAdd(player.Slot, _ => new ConcurrentDictionary<CsTeam, ushort>());
CsTeam weaponTeam = (int)row.weapon_team switch CsTeam weaponTeam = (int)row.weapon_team switch
{ {
0 => CsTeam.None,
2 => CsTeam.Terrorist, 2 => CsTeam.Terrorist,
_ => CsTeam.CounterTerrorist 3 => CsTeam.CounterTerrorist,
_ => CsTeam.None,
}; };
// Get or create entries for the players slot // Get or create entries for the players slot
@@ -171,28 +171,27 @@ internal class WeaponSynchronization
// var weaponInfos = new ConcurrentDictionary<int, WeaponInfo>(); // var weaponInfos = new ConcurrentDictionary<int, WeaponInfo>();
const string query = "SELECT * FROM `wp_player_skins` WHERE `steamid` = @steamid"; const string query = "SELECT * FROM `wp_player_skins` WHERE `steamid` = @steamid ORDER BY `weapon_team` ASC";
var playerSkins = connection.Query<dynamic>(query, new { steamid = player.SteamId }); var playerSkins = connection.Query<dynamic>(query, new { steamid = player.SteamId });
foreach (var row in playerSkins) foreach (var row in playerSkins)
{ {
int weaponDefIndex = row?.weapon_defindex ?? 0; int weaponDefIndex = row.weapon_defindex ?? 0;
int weaponPaintId = row?.weapon_paint_id ?? 0; int weaponPaintId = row.weapon_paint_id ?? 0;
float weaponWear = row?.weapon_wear ?? 0f; float weaponWear = row.weapon_wear ?? 0f;
int weaponSeed = row?.weapon_seed ?? 0; int weaponSeed = row.weapon_seed ?? 0;
string weaponNameTag = row?.weapon_nametag ?? ""; string weaponNameTag = row.weapon_nametag ?? "";
bool weaponStatTrak = row?.weapon_stattrak ?? false; bool weaponStatTrak = row.weapon_stattrak ?? false;
int weaponStatTrakCount = row?.weapon_stattrak_count ?? 0; int weaponStatTrakCount = row.weapon_stattrak_count ?? 0;
CsTeam weaponTeam = row?.weapon_team switch CsTeam weaponTeam = row.weapon_team switch
{ {
null => CsTeam.None,
0 => CsTeam.None,
2 => CsTeam.Terrorist, 2 => CsTeam.Terrorist,
_ => CsTeam.CounterTerrorist 3 => CsTeam.CounterTerrorist,
_ => CsTeam.None,
}; };
string[]? keyChainParts = row?.weapon_keychain?.ToString().Split(';'); string[]? keyChainParts = row.weapon_keychain?.ToString().Split(';');
KeyChainInfo keyChainInfo = new KeyChainInfo(); KeyChainInfo keyChainInfo = new KeyChainInfo();
@@ -302,7 +301,7 @@ internal class WeaponSynchronization
if (!_config.Additional.MusicEnabled || string.IsNullOrEmpty(player?.SteamId)) if (!_config.Additional.MusicEnabled || string.IsNullOrEmpty(player?.SteamId))
return; return;
const string query = "SELECT `music_id`, `weapon_team` FROM `wp_player_music` WHERE `steamid` = @steamid"; const string query = "SELECT `music_id`, `weapon_team` FROM `wp_player_music` WHERE `steamid` = @steamid ORDER BY `weapon_team` ASC";
var rows = connection.Query<dynamic>(query, new { steamid = player.SteamId }); // Retrieve all records for the player var rows = connection.Query<dynamic>(query, new { steamid = player.SteamId }); // Retrieve all records for the player
foreach (var row in rows) foreach (var row in rows)
@@ -313,9 +312,9 @@ internal class WeaponSynchronization
// Determine the weapon team based on the query result // Determine the weapon team based on the query result
CsTeam weaponTeam = (int)row.weapon_team switch CsTeam weaponTeam = (int)row.weapon_team switch
{ {
0 => CsTeam.None,
2 => CsTeam.Terrorist, 2 => CsTeam.Terrorist,
_ => CsTeam.CounterTerrorist 3 => CsTeam.CounterTerrorist,
_ => CsTeam.None,
}; };
// Get or create entries for the players slot // Get or create entries for the players slot
@@ -347,7 +346,7 @@ internal class WeaponSynchronization
if (string.IsNullOrEmpty(player?.SteamId)) if (string.IsNullOrEmpty(player?.SteamId))
return; return;
const string query = "SELECT `id`, `weapon_team` FROM `wp_player_pins` WHERE `steamid` = @steamid"; const string query = "SELECT `id`, `weapon_team` FROM `wp_player_pins` WHERE `steamid` = @steamid ORDER BY `weapon_team` ASC";
var rows = connection.Query<dynamic>(query, new { steamid = player.SteamId }); // Retrieve all records for the player var rows = connection.Query<dynamic>(query, new { steamid = player.SteamId }); // Retrieve all records for the player
foreach (var row in rows) foreach (var row in rows)
@@ -358,9 +357,9 @@ internal class WeaponSynchronization
// Determine the weapon team based on the query result // Determine the weapon team based on the query result
CsTeam weaponTeam = (int)row.weapon_team switch CsTeam weaponTeam = (int)row.weapon_team switch
{ {
0 => CsTeam.None,
2 => CsTeam.Terrorist, 2 => CsTeam.Terrorist,
_ => CsTeam.CounterTerrorist 3 => CsTeam.CounterTerrorist,
_ => CsTeam.None,
}; };
// Get or create entries for the players slot // Get or create entries for the players slot

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Some files were not shown because too many files have changed in this diff Show More