fix bug with AC failing to ban because of EF issue.

This commit is contained in:
RaidMax 2018-07-05 21:04:34 -05:00
parent 16d7ccd590
commit 6071ad8653
3 changed files with 9 additions and 3 deletions

View File

@ -180,6 +180,10 @@ namespace IW4MAdmin
{ {
client.CurrentAlias = existingAlias; client.CurrentAlias = existingAlias;
client.CurrentAliasId = existingAlias.AliasId; client.CurrentAliasId = existingAlias.AliasId;
// we need to update their new ip and name to the virtual property
client.Name = polledPlayer.Name;
client.IPAddress = polledPlayer.IPAddress;
client = await Manager.GetClientService().Update(client); client = await Manager.GetClientService().Update(client);
} }

View File

@ -152,7 +152,8 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
} }
// ban // ban
if (currentStrain > Thresholds.MaxStrainBan) if (currentStrain > Thresholds.MaxStrainBan &&
HitCount > 15)
{ {
result = new DetectionPenaltyResult() result = new DetectionPenaltyResult()
{ {

View File

@ -427,7 +427,8 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
{ {
using (var ctx = new DatabaseContext()) using (var ctx = new DatabaseContext())
{ {
foreach (var change in clientDetection.Tracker.GetChanges()) // todo: why does this cause duplicate primary key
foreach (var change in clientDetection.Tracker.GetChanges().Distinct())
{ {
ctx.Add(change); ctx.Add(change);
} }
@ -440,7 +441,6 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
case Penalty.PenaltyType.Ban: case Penalty.PenaltyType.Ban:
if (attacker.Level == Player.Permission.Banned) if (attacker.Level == Player.Permission.Banned)
break; break;
await saveLog();
await attacker.Ban(Utilities.CurrentLocalization.LocalizationIndex["PLUGIN_STATS_CHEAT_DETECTED"], new Player() await attacker.Ban(Utilities.CurrentLocalization.LocalizationIndex["PLUGIN_STATS_CHEAT_DETECTED"], new Player()
{ {
ClientId = 1, ClientId = 1,
@ -454,6 +454,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
} }
} }
}); });
await saveLog();
break; break;
case Penalty.PenaltyType.Flag: case Penalty.PenaltyType.Flag:
if (attacker.Level != Player.Permission.User) if (attacker.Level != Player.Permission.User)