-
-
Notifications
You must be signed in to change notification settings - Fork 53
/
WeaponSynchronization.cs
629 lines (539 loc) · 20.6 KB
/
WeaponSynchronization.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
using Dapper;
using MySqlConnector;
using System.Collections.Concurrent;
using CounterStrikeSharp.API.Modules.Utils;
namespace WeaponPaints;
internal class WeaponSynchronization
{
private readonly WeaponPaintsConfig _config;
private readonly Database _database;
internal WeaponSynchronization(Database database, WeaponPaintsConfig config)
{
_database = database;
_config = config;
}
internal async Task GetPlayerData(PlayerInfo? player)
{
try
{
await using var connection = await _database.GetConnectionAsync();
if (_config.Additional.KnifeEnabled)
GetKnifeFromDatabase(player, connection);
if (_config.Additional.GloveEnabled)
GetGloveFromDatabase(player, connection);
if (_config.Additional.AgentEnabled)
GetAgentFromDatabase(player, connection);
if (_config.Additional.MusicEnabled)
GetMusicFromDatabase(player, connection);
if (_config.Additional.SkinEnabled)
GetWeaponPaintsFromDatabase(player, connection);
if (_config.Additional.PinsEnabled)
GetPinsFromDatabase(player, connection);
}
catch (Exception ex)
{
// Log the exception or handle it appropriately
Console.WriteLine($"An error occurred: {ex.Message}");
}
}
private void GetKnifeFromDatabase(PlayerInfo? player, MySqlConnection connection)
{
try
{
if (!_config.Additional.KnifeEnabled || string.IsNullOrEmpty(player?.SteamId))
return;
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)
{
// Check if knife is null or empty
if (string.IsNullOrEmpty(row.knife)) continue;
// Determine the weapon team based on the query result
CsTeam weaponTeam = (int)row.weapon_team switch
{
2 => CsTeam.Terrorist,
3 => CsTeam.CounterTerrorist,
_ => CsTeam.None,
};
// Get or create entries for the player’s slot
var playerKnives = WeaponPaints.GPlayersKnife.GetOrAdd(player.Slot, _ => new ConcurrentDictionary<CsTeam, string>());
if (weaponTeam == CsTeam.None)
{
// Assign knife to both teams if weaponTeam is None
playerKnives[CsTeam.Terrorist] = row.knife;
playerKnives[CsTeam.CounterTerrorist] = row.knife;
}
else
{
// Assign knife to the specific team
playerKnives[weaponTeam] = row.knife;
}
}
}
catch (Exception ex)
{
Utility.Log($"An error occurred in GetKnifeFromDatabase: {ex.Message}");
}
}
private void GetGloveFromDatabase(PlayerInfo? player, MySqlConnection connection)
{
try
{
if (!_config.Additional.GloveEnabled || string.IsNullOrEmpty(player?.SteamId))
return;
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)
{
// Check if weapon_defindex is null
if (row.weapon_defindex == null) continue;
// Determine the weapon team based on the query result
var playerGloves = WeaponPaints.GPlayersGlove.GetOrAdd(player.Slot, _ => new ConcurrentDictionary<CsTeam, ushort>());
CsTeam weaponTeam = (int)row.weapon_team switch
{
2 => CsTeam.Terrorist,
3 => CsTeam.CounterTerrorist,
_ => CsTeam.None,
};
// Get or create entries for the player’s slot
if (weaponTeam == CsTeam.None)
{
// Assign glove ID to both teams if weaponTeam is None
playerGloves[CsTeam.Terrorist] = (ushort)row.weapon_defindex;
playerGloves[CsTeam.CounterTerrorist] = (ushort)row.weapon_defindex;
}
else
{
// Assign glove ID to the specific team
playerGloves[weaponTeam] = (ushort)row.weapon_defindex;
}
}
}
catch (Exception ex)
{
Utility.Log($"An error occurred in GetGlovesFromDatabase: {ex.Message}");
}
}
private void GetAgentFromDatabase(PlayerInfo? player, MySqlConnection connection)
{
try
{
if (!_config.Additional.AgentEnabled || string.IsNullOrEmpty(player?.SteamId))
return;
const string query = "SELECT `agent_ct`, `agent_t` FROM `wp_player_agents` WHERE `steamid` = @steamid";
var agentData = connection.QueryFirstOrDefault<(string, string)>(query, new { steamid = player.SteamId });
if (agentData == default) return;
var agentCT = agentData.Item1;
var agentT = agentData.Item2;
if (!string.IsNullOrEmpty(agentCT) || !string.IsNullOrEmpty(agentT))
{
WeaponPaints.GPlayersAgent[player.Slot] = (
agentCT,
agentT
);
}
}
catch (Exception ex)
{
Utility.Log($"An error occurred in GetAgentFromDatabase: {ex.Message}");
}
}
private void GetWeaponPaintsFromDatabase(PlayerInfo? player, MySqlConnection connection)
{
try
{
if (!_config.Additional.SkinEnabled || player == null || string.IsNullOrEmpty(player.SteamId))
return;
var playerWeapons = WeaponPaints.GPlayerWeaponsInfo.GetOrAdd(player.Slot,
_ => new ConcurrentDictionary<CsTeam, ConcurrentDictionary<int, WeaponInfo>>());
// var weaponInfos = new ConcurrentDictionary<int, WeaponInfo>();
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;
CsTeam weaponTeam = row.weapon_team switch
{
2 => CsTeam.Terrorist,
3 => CsTeam.CounterTerrorist,
_ => CsTeam.None,
};
string[]? keyChainParts = row.weapon_keychain?.ToString().Split(';');
KeyChainInfo keyChainInfo = new KeyChainInfo();
if (keyChainParts!.Length == 5 &&
uint.TryParse(keyChainParts[0], out uint keyChainId) &&
float.TryParse(keyChainParts[1], out float keyChainOffsetX) &&
float.TryParse(keyChainParts[2], out float keyChainOffsetY) &&
float.TryParse(keyChainParts[3], out float keyChainOffsetZ) &&
uint.TryParse(keyChainParts[4], out uint keyChainSeed))
{
// Successfully parsed the values
keyChainInfo.Id = keyChainId;
keyChainInfo.OffsetX = keyChainOffsetX;
keyChainInfo.OffsetY = keyChainOffsetY;
keyChainInfo.OffsetZ = keyChainOffsetZ;
keyChainInfo.Seed = keyChainSeed;
}
else
{
// Failed to parse the values, default to 0
keyChainInfo.Id = 0;
keyChainInfo.OffsetX = 0f;
keyChainInfo.OffsetY = 0f;
keyChainInfo.OffsetZ = 0f;
keyChainInfo.Seed = 0;
}
// Create the WeaponInfo object
WeaponInfo weaponInfo = new WeaponInfo
{
Paint = weaponPaintId,
Seed = weaponSeed,
Wear = weaponWear,
Nametag = weaponNameTag,
KeyChain = keyChainInfo,
StatTrak = weaponStatTrak,
StatTrakCount = weaponStatTrakCount,
};
// Retrieve and parse sticker data (up to 5 slots)
for (int i = 0; i <= 4; i++)
{
// Access the sticker data dynamically using reflection
string stickerColumn = $"weapon_sticker_{i}";
var stickerData = ((IDictionary<string, object>)row!)[stickerColumn]; // Safely cast row to a dictionary
if (string.IsNullOrEmpty(stickerData.ToString())) continue;
var parts = stickerData.ToString()!.Split(';');
//"id;schema;x;y;wear;scale;rotation"
if (parts.Length != 7 ||
!uint.TryParse(parts[0], out uint stickerId) ||
!uint.TryParse(parts[1], out uint stickerSchema) ||
!float.TryParse(parts[2], out float stickerOffsetX) ||
!float.TryParse(parts[3], out float stickerOffsetY) ||
!float.TryParse(parts[4], out float stickerWear) ||
!float.TryParse(parts[5], out float stickerScale) ||
!float.TryParse(parts[6], out float stickerRotation)) continue;
StickerInfo stickerInfo = new StickerInfo
{
Id = stickerId,
Schema = stickerSchema,
OffsetX = stickerOffsetX,
OffsetY = stickerOffsetY,
Wear = stickerWear,
Scale = stickerScale,
Rotation = stickerRotation
};
weaponInfo.Stickers.Add(stickerInfo);
}
if (weaponTeam == CsTeam.None)
{
// Get or create entries for both teams
var terroristWeapons = playerWeapons.GetOrAdd(CsTeam.Terrorist, _ => new ConcurrentDictionary<int, WeaponInfo>());
var counterTerroristWeapons = playerWeapons.GetOrAdd(CsTeam.CounterTerrorist, _ => new ConcurrentDictionary<int, WeaponInfo>());
// Add weaponInfo to both team weapon dictionaries
terroristWeapons[weaponDefIndex] = weaponInfo;
counterTerroristWeapons[weaponDefIndex] = weaponInfo;
}
else
{
// Add to the specific team
var teamWeapons = playerWeapons.GetOrAdd(weaponTeam, _ => new ConcurrentDictionary<int, WeaponInfo>());
teamWeapons[weaponDefIndex] = weaponInfo;
}
// weaponInfos[weaponDefIndex] = weaponInfo;
}
// WeaponPaints.GPlayerWeaponsInfo[player.Slot][weaponTeam] = weaponInfos;
}
catch (Exception ex)
{
Utility.Log($"An error occurred in GetWeaponPaintsFromDatabase: {ex.Message}");
}
}
private void GetMusicFromDatabase(PlayerInfo? player, MySqlConnection connection)
{
try
{
if (!_config.Additional.MusicEnabled || string.IsNullOrEmpty(player?.SteamId))
return;
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)
{
// Check if music_id is null
if (row.music_id == null) continue;
// Determine the weapon team based on the query result
CsTeam weaponTeam = (int)row.weapon_team switch
{
2 => CsTeam.Terrorist,
3 => CsTeam.CounterTerrorist,
_ => CsTeam.None,
};
// Get or create entries for the player’s slot
var playerMusic = WeaponPaints.GPlayersMusic.GetOrAdd(player.Slot, _ => new ConcurrentDictionary<CsTeam, ushort>());
if (weaponTeam == CsTeam.None)
{
// Assign music ID to both teams if weaponTeam is None
playerMusic[CsTeam.Terrorist] = (ushort)row.music_id;
playerMusic[CsTeam.CounterTerrorist] = (ushort)row.music_id;
}
else
{
// Assign music ID to the specific team
playerMusic[weaponTeam] = (ushort)row.music_id;
}
}
}
catch (Exception ex)
{
Utility.Log($"An error occurred in GetMusicFromDatabase: {ex.Message}");
}
}
private void GetPinsFromDatabase(PlayerInfo? player, MySqlConnection connection)
{
try
{
if (string.IsNullOrEmpty(player?.SteamId))
return;
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)
{
// Check if id is null
if (row.id == null) continue;
// Determine the weapon team based on the query result
CsTeam weaponTeam = (int)row.weapon_team switch
{
2 => CsTeam.Terrorist,
3 => CsTeam.CounterTerrorist,
_ => CsTeam.None,
};
// Get or create entries for the player’s slot
var playerPins = WeaponPaints.GPlayersPin.GetOrAdd(player.Slot, _ => new ConcurrentDictionary<CsTeam, ushort>());
if (weaponTeam == CsTeam.None)
{
// Assign pin ID to both teams if weaponTeam is None
playerPins[CsTeam.Terrorist] = (ushort)row.id;
playerPins[CsTeam.CounterTerrorist] = (ushort)row.id;
}
else
{
// Assign pin ID to the specific team
playerPins[weaponTeam] = (ushort)row.id;
}
}
}
catch (Exception ex)
{
Utility.Log($"An error occurred in GetPinsFromDatabase: {ex.Message}");
}
}
internal async Task SyncKnifeToDatabase(PlayerInfo player, string knife, CsTeam[] teams)
{
if (!_config.Additional.KnifeEnabled || string.IsNullOrEmpty(player.SteamId) || string.IsNullOrEmpty(knife) || teams.Length == 0) return;
const string query = "INSERT INTO `wp_player_knife` (`steamid`, `weapon_team`, `knife`) VALUES(@steamid, @team, @newKnife) ON DUPLICATE KEY UPDATE `knife` = @newKnife";
try
{
await using var connection = await _database.GetConnectionAsync();
// Loop through each team and insert/update accordingly
foreach (var team in teams)
{
await connection.ExecuteAsync(query, new { steamid = player.SteamId, team, newKnife = knife });
}
}
catch (Exception e)
{
Utility.Log($"Error syncing knife to database: {e.Message}");
}
}
internal async Task SyncGloveToDatabase(PlayerInfo player, ushort gloveDefIndex, CsTeam[] teams)
{
// Check if the necessary conditions are met
if (!_config.Additional.GloveEnabled || string.IsNullOrEmpty(player.SteamId) || teams.Length == 0)
return;
const string query = @"
INSERT INTO `wp_player_gloves` (`steamid`, `weapon_team`, `weapon_defindex`)
VALUES(@steamid, @team, @gloveDefIndex)
ON DUPLICATE KEY UPDATE `weapon_defindex` = @gloveDefIndex";
try
{
// Get a database connection
await using var connection = await _database.GetConnectionAsync();
// Loop through each team and insert/update accordingly
foreach (var team in teams)
{
// Execute the SQL command for each team
await connection.ExecuteAsync(query, new {
steamid = player.SteamId,
team = (int)team, // Cast the CsTeam enum to int for insertion
gloveDefIndex
});
}
}
catch (Exception e)
{
// Log any exceptions that occur
Utility.Log($"Error syncing glove to database: {e.Message}");
}
}
internal async Task SyncAgentToDatabase(PlayerInfo player)
{
if (!_config.Additional.AgentEnabled || string.IsNullOrEmpty(player.SteamId)) return;
const string query = """
INSERT INTO `wp_player_agents` (`steamid`, `agent_ct`, `agent_t`)
VALUES(@steamid, @agent_ct, @agent_t)
ON DUPLICATE KEY UPDATE
`agent_ct` = @agent_ct,
`agent_t` = @agent_t
""";
try
{
await using var connection = await _database.GetConnectionAsync();
await connection.ExecuteAsync(query, new { steamid = player.SteamId, agent_ct = WeaponPaints.GPlayersAgent[player.Slot].CT, agent_t = WeaponPaints.GPlayersAgent[player.Slot].T });
}
catch (Exception e)
{
Utility.Log($"Error syncing agents to database: {e.Message}");
}
}
internal async Task SyncWeaponPaintsToDatabase(PlayerInfo player)
{
if (string.IsNullOrEmpty(player.SteamId) || !WeaponPaints.GPlayerWeaponsInfo.TryGetValue(player.Slot, out var teamWeaponInfos))
return;
try
{
await using var connection = await _database.GetConnectionAsync();
// Loop through each team (Terrorist and CounterTerrorist)
foreach (var (teamId, weaponsInfo) in teamWeaponInfos)
{
foreach (var (weaponDefIndex, weaponInfo) in weaponsInfo)
{
var paintId = weaponInfo.Paint;
var wear = weaponInfo.Wear;
var seed = weaponInfo.Seed;
// Prepare the queries to check and update/insert weapon skin data
const string queryCheckExistence = "SELECT COUNT(*) FROM `wp_player_skins` WHERE `steamid` = @steamid AND `weapon_defindex` = @weaponDefIndex AND `weapon_team` = @weaponTeam";
var existingRecordCount = await connection.ExecuteScalarAsync<int>(
queryCheckExistence,
new { steamid = player.SteamId, weaponDefIndex, weaponTeam = teamId }
);
string query;
object parameters;
if (existingRecordCount > 0)
{
// Update existing record
query = "UPDATE `wp_player_skins` SET `weapon_paint_id` = @paintId, `weapon_wear` = @wear, `weapon_seed` = @seed " +
"WHERE `steamid` = @steamid AND `weapon_defindex` = @weaponDefIndex AND `weapon_team` = @weaponTeam";
parameters = new { steamid = player.SteamId, weaponDefIndex, weaponTeam = (int)teamId, paintId, wear, seed };
}
else
{
// Insert new record
query = "INSERT INTO `wp_player_skins` (`steamid`, `weapon_defindex`, `weapon_team`, `weapon_paint_id`, `weapon_wear`, `weapon_seed`) " +
"VALUES (@steamid, @weaponDefIndex, @weaponTeam, @paintId, @wear, @seed)";
parameters = new { steamid = player.SteamId, weaponDefIndex, weaponTeam = (int)teamId, paintId, wear, seed };
}
await connection.ExecuteAsync(query, parameters);
}
}
}
catch (Exception e)
{
Utility.Log($"Error syncing weapon paints to database: {e.Message}");
}
}
internal async Task SyncMusicToDatabase(PlayerInfo player, ushort music, CsTeam[] teams)
{
if (!_config.Additional.MusicEnabled || string.IsNullOrEmpty(player.SteamId)) return;
const string query = "INSERT INTO `wp_player_music` (`steamid`, `weapon_team`, `music_id`) VALUES(@steamid, @team, @newMusic) ON DUPLICATE KEY UPDATE `music_id` = @newMusic";
try
{
await using var connection = await _database.GetConnectionAsync();
// Loop through each team and insert/update accordingly
foreach (var team in teams)
{
await connection.ExecuteAsync(query, new { steamid = player.SteamId, team, newMusic = music });
}
}
catch (Exception e)
{
Utility.Log($"Error syncing music kit to database: {e.Message}");
}
}
internal async Task SyncPinToDatabase(PlayerInfo player, ushort pin, CsTeam[] teams)
{
if (!_config.Additional.PinsEnabled || string.IsNullOrEmpty(player.SteamId)) return;
const string query = "INSERT INTO `wp_player_pins` (`steamid`, `weapon_team`, `id`) VALUES(@steamid, @team, @newPin) ON DUPLICATE KEY UPDATE `id` = @newPin";
try
{
await using var connection = await _database.GetConnectionAsync();
// Loop through each team and insert/update accordingly
foreach (var team in teams)
{
await connection.ExecuteAsync(query, new { steamid = player.SteamId, team, newPin = pin });
}
}
catch (Exception e)
{
Utility.Log($"Error syncing pin to database: {e.Message}");
}
}
internal async Task SyncStatTrakToDatabase(PlayerInfo player)
{
if (WeaponPaints.WeaponSync == null || WeaponPaints.GPlayerWeaponsInfo.IsEmpty) return;
if (string.IsNullOrEmpty(player.SteamId))
return;
try
{
await using var connection = await _database.GetConnectionAsync();
await using var transaction = await connection.BeginTransactionAsync();
// Check if player's slot exists in GPlayerWeaponsInfo
if (!WeaponPaints.GPlayerWeaponsInfo.TryGetValue(player.Slot, out var teamWeaponsInfo))
return;
// Iterate through each team in the player's weapon info
foreach (var teamInfo in teamWeaponsInfo)
{
// Retrieve weaponInfos for the current team
var weaponInfos = teamInfo.Value;
// Get StatTrak weapons for the current team
var statTrakWeapons = weaponInfos
.ToDictionary(
w => w.Key,
w => (w.Value.StatTrak, w.Value.StatTrakCount) // Store both StatTrak and StatTrakCount in a tuple
);
// Check if there are StatTrak weapons to sync
if (statTrakWeapons.Count == 0) continue;
// Get the current team ID
int weaponTeam = (int)teamInfo.Key;
// Sync StatTrak values for the current team
foreach (var (defindex, (statTrak, statTrakCount)) in statTrakWeapons)
{
const string query = @"
UPDATE `wp_player_skins`
SET `weapon_stattrak` = @StatTrak,
`weapon_stattrak_count` = @StatTrakCount
WHERE `steamid` = @steamid
AND `weapon_defindex` = @weaponDefIndex
AND `weapon_team` = @weaponTeam";
var parameters = new
{
steamid = player.SteamId,
weaponDefIndex = defindex,
StatTrak = statTrak,
StatTrakCount = statTrakCount,
weaponTeam
};
await connection.ExecuteAsync(query, parameters, transaction);
}
}
await transaction.CommitAsync();
}
catch (Exception e)
{
Utility.Log($"Error syncing stattrak to database: {e.Message}");
}
}
}