Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1fa8f37c7 | ||
|
|
475e91e779 | ||
|
|
a136f5472e | ||
|
|
b5d7f12024 | ||
|
|
9ec64e346f | ||
|
|
b4dc20523c | ||
|
|
8891ce815e |
@@ -20,8 +20,10 @@ namespace WeaponPaints
|
||||
|
||||
bool isKnife = weapon.DesignerName.Contains("knife") || weapon.DesignerName.Contains("bayonet");
|
||||
|
||||
if (isKnife && !GPlayersKnife.ContainsKey(player.Slot) ||
|
||||
isKnife && GPlayersKnife[player.Slot][player.Team] == "weapon_knife") return;
|
||||
if (isKnife && (!GPlayersKnife.ContainsKey(player.Slot) ||
|
||||
!GPlayersKnife[player.Slot].ContainsKey(player.Team) ||
|
||||
GPlayersKnife[player.Slot][player.Team] == "weapon_knife"))
|
||||
return;
|
||||
|
||||
if (isKnife)
|
||||
{
|
||||
@@ -52,7 +54,9 @@ namespace WeaponPaints
|
||||
bool isLegacyModel;
|
||||
|
||||
if (_config.Additional.GiveRandomSkin &&
|
||||
!GPlayerWeaponsInfo[player.Slot][player.Team].ContainsKey(weaponDefIndex))
|
||||
GPlayerWeaponsInfo.ContainsKey(player.Slot) &&
|
||||
(!GPlayerWeaponsInfo[player.Slot].ContainsKey(player.Team) ||
|
||||
!GPlayerWeaponsInfo[player.Slot][player.Team].ContainsKey(weaponDefIndex)))
|
||||
{
|
||||
// Random skins
|
||||
weapon.FallbackPaintKit = GetRandomPaint(weaponDefIndex);
|
||||
@@ -103,14 +107,7 @@ namespace WeaponPaints
|
||||
weapon.AttributeManager.Item.CustomName = weaponInfo.Nametag;
|
||||
weapon.FallbackPaintKit = weaponInfo.Paint;
|
||||
|
||||
if (weaponInfo is { Paint: 38, Seed: 0 })
|
||||
{
|
||||
weapon.FallbackSeed = _fadeSeed++;
|
||||
}
|
||||
else
|
||||
{
|
||||
weapon.FallbackSeed = weaponInfo.Seed;
|
||||
}
|
||||
weapon.FallbackSeed = weaponInfo is { Paint: 38, Seed: 0 } ? _fadeSeed++ : weaponInfo.Seed;
|
||||
|
||||
weapon.FallbackWear = weaponInfo.Wear;
|
||||
CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle, "set item texture prefab", weapon.FallbackPaintKit);
|
||||
@@ -186,15 +183,13 @@ namespace WeaponPaints
|
||||
|
||||
CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle,
|
||||
$"sticker slot {stickerSlot} id", ViewAsFloat(sticker.Id));
|
||||
// CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle,
|
||||
// $"sticker slot {stickerSlot} schema", stickerSlot);
|
||||
// if (stickerSlot == 5)
|
||||
// {
|
||||
if (sticker.OffsetX != 0 || sticker.OffsetY != 0)
|
||||
CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle,
|
||||
$"sticker slot {stickerSlot} schema", 0);
|
||||
CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle,
|
||||
$"sticker slot {stickerSlot} offset x", sticker.OffsetX);
|
||||
CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle,
|
||||
$"sticker slot {stickerSlot} offset y", sticker.OffsetY);
|
||||
// }
|
||||
CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle,
|
||||
$"sticker slot {stickerSlot} wear", sticker.Wear);
|
||||
CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle,
|
||||
@@ -217,8 +212,11 @@ namespace WeaponPaints
|
||||
int weaponDefIndex = weapon.AttributeManager.Item.ItemDefinitionIndex;
|
||||
|
||||
if (!GPlayerWeaponsInfo.TryGetValue(player.Slot, out var playerWeaponsInfo) ||
|
||||
!playerWeaponsInfo[player.Team].TryGetValue(weaponDefIndex, out var value) ||
|
||||
value.KeyChain == null) return;
|
||||
!playerWeaponsInfo.TryGetValue(player.Team, out var teamWeaponsInfo) ||
|
||||
!teamWeaponsInfo.TryGetValue(weaponDefIndex, out var value) ||
|
||||
value.KeyChain == null)
|
||||
return;
|
||||
|
||||
var keyChain = value.KeyChain;
|
||||
|
||||
CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle,
|
||||
@@ -406,9 +404,12 @@ namespace WeaponPaints
|
||||
return;
|
||||
|
||||
if (!GPlayersGlove.TryGetValue(player.Slot, out var gloveInfo) ||
|
||||
!gloveInfo.TryGetValue(player.Team, out var gloveId) || gloveId == 0) return;
|
||||
|
||||
WeaponInfo weaponInfo = GPlayerWeaponsInfo[player.Slot][player.Team][gloveId];
|
||||
!gloveInfo.TryGetValue(player.Team, out var gloveId) ||
|
||||
gloveId == 0 ||
|
||||
!GPlayerWeaponsInfo.TryGetValue(player.Slot, out var playerWeaponsInfo) ||
|
||||
!playerWeaponsInfo.TryGetValue(player.Team, out var teamWeaponsInfo) ||
|
||||
!teamWeaponsInfo.TryGetValue(gloveId, out var weaponInfo))
|
||||
return;
|
||||
|
||||
item.ItemDefinitionIndex = gloveId;
|
||||
item.ItemIDLow = 16384 & 0xFFFFFFFF;
|
||||
|
||||
@@ -17,7 +17,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.1a";
|
||||
public override string ModuleVersion => "3.1b";
|
||||
|
||||
public override void Load(bool hotReload)
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ internal class WeaponSynchronization
|
||||
if (!_config.Additional.KnifeEnabled || string.IsNullOrEmpty(player?.SteamId))
|
||||
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
|
||||
|
||||
foreach (var row in rows)
|
||||
@@ -60,9 +60,9 @@ internal class WeaponSynchronization
|
||||
// Determine the weapon team based on the query result
|
||||
CsTeam weaponTeam = (int)row.weapon_team switch
|
||||
{
|
||||
0 => CsTeam.None,
|
||||
2 => CsTeam.Terrorist,
|
||||
_ => CsTeam.CounterTerrorist
|
||||
3 => CsTeam.CounterTerrorist,
|
||||
_ => CsTeam.None,
|
||||
};
|
||||
|
||||
// Get or create entries for the player’s slot
|
||||
@@ -94,7 +94,7 @@ internal class WeaponSynchronization
|
||||
if (!_config.Additional.GloveEnabled || string.IsNullOrEmpty(player?.SteamId))
|
||||
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
|
||||
|
||||
foreach (var row in rows)
|
||||
@@ -105,9 +105,9 @@ internal class WeaponSynchronization
|
||||
var playerGloves = WeaponPaints.GPlayersGlove.GetOrAdd(player.Slot, _ => new ConcurrentDictionary<CsTeam, ushort>());
|
||||
CsTeam weaponTeam = (int)row.weapon_team switch
|
||||
{
|
||||
0 => CsTeam.None,
|
||||
2 => CsTeam.Terrorist,
|
||||
_ => CsTeam.CounterTerrorist
|
||||
3 => CsTeam.CounterTerrorist,
|
||||
_ => CsTeam.None,
|
||||
};
|
||||
|
||||
// Get or create entries for the player’s slot
|
||||
@@ -171,28 +171,27 @@ internal class WeaponSynchronization
|
||||
|
||||
// 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 });
|
||||
|
||||
foreach (var row in playerSkins)
|
||||
{
|
||||
int weaponDefIndex = row?.weapon_defindex ?? 0;
|
||||
int weaponPaintId = row?.weapon_paint_id ?? 0;
|
||||
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;
|
||||
int weaponDefIndex = row.weapon_defindex ?? 0;
|
||||
int weaponPaintId = row.weapon_paint_id ?? 0;
|
||||
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;
|
||||
|
||||
CsTeam weaponTeam = row?.weapon_team switch
|
||||
CsTeam weaponTeam = row.weapon_team switch
|
||||
{
|
||||
null => CsTeam.None,
|
||||
0 => CsTeam.None,
|
||||
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();
|
||||
|
||||
@@ -302,7 +301,7 @@ internal class WeaponSynchronization
|
||||
if (!_config.Additional.MusicEnabled || string.IsNullOrEmpty(player?.SteamId))
|
||||
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
|
||||
|
||||
foreach (var row in rows)
|
||||
@@ -313,9 +312,9 @@ internal class WeaponSynchronization
|
||||
// Determine the weapon team based on the query result
|
||||
CsTeam weaponTeam = (int)row.weapon_team switch
|
||||
{
|
||||
0 => CsTeam.None,
|
||||
2 => CsTeam.Terrorist,
|
||||
_ => CsTeam.CounterTerrorist
|
||||
3 => CsTeam.CounterTerrorist,
|
||||
_ => CsTeam.None,
|
||||
};
|
||||
|
||||
// Get or create entries for the player’s slot
|
||||
@@ -347,7 +346,7 @@ internal class WeaponSynchronization
|
||||
if (string.IsNullOrEmpty(player?.SteamId))
|
||||
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
|
||||
|
||||
foreach (var row in rows)
|
||||
@@ -358,9 +357,9 @@ internal class WeaponSynchronization
|
||||
// Determine the weapon team based on the query result
|
||||
CsTeam weaponTeam = (int)row.weapon_team switch
|
||||
{
|
||||
0 => CsTeam.None,
|
||||
2 => CsTeam.Terrorist,
|
||||
_ => CsTeam.CounterTerrorist
|
||||
3 => CsTeam.CounterTerrorist,
|
||||
_ => CsTeam.None,
|
||||
};
|
||||
|
||||
// Get or create entries for the player’s slot
|
||||
|
||||
|
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 93 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 85 KiB |
BIN
website/img/skins/weapon_ak47-113.png
Normal file
|
After Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
BIN
website/img/skins/weapon_ak47-1179.png
Normal file
|
After Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 95 KiB |
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
BIN
website/img/skins/weapon_ak47-142.png
Normal file
|
After Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 91 KiB |
|
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
|
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 90 KiB |
|
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 98 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 90 KiB |
BIN
website/img/skins/weapon_ak47-912.png
Normal file
|
After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 89 KiB |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 107 KiB |
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 112 KiB |
BIN
website/img/skins/weapon_aug-121.png
Normal file
|
After Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 123 KiB |
BIN
website/img/skins/weapon_aug-134.png
Normal file
|
After Width: | Height: | Size: 127 KiB |
BIN
website/img/skins/weapon_aug-173.png
Normal file
|
After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 109 KiB |
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 113 KiB |
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 107 KiB |
|
Before Width: | Height: | Size: 109 KiB After Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 119 KiB |
|
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 122 KiB |
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 117 KiB After Width: | Height: | Size: 119 KiB |
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 109 KiB |
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 117 KiB After Width: | Height: | Size: 118 KiB |
|
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 112 KiB |
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 118 KiB |
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 114 KiB |
|
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 70 KiB |