Small fixes

This commit is contained in:
RaidMax 2018-12-17 13:45:16 -06:00
parent 8aa0d204f4
commit 8dca05a442
8 changed files with 18 additions and 13 deletions

View File

@ -940,7 +940,7 @@ namespace IW4MAdmin
await Manager.GetPenaltyService().Create(newPenalty);
}
override protected async Task Ban(string reason, EFClient targetClient, EFClient originClient, bool isEvade)
override protected async Task Ban(string reason, EFClient targetClient, EFClient originClient, bool isEvade = false)
{
// ensure player gets banned if command not performed on them in game
if (targetClient.ClientNumber < 0)

View File

@ -124,13 +124,14 @@ namespace IW4MAdmin.Application.RconParsers
IsBot = ip == null,
State = EFClient.ClientState.Connecting
};
StatusPlayers.Add(client);
// they've not fully connected yet
if (!client.IsBot && ping == 999)
{
continue;
}
StatusPlayers.Add(client);
}
}

View File

@ -618,8 +618,9 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
}
},
Level = EFClient.Permission.Console,
CurrentServer = attacker.CurrentServer
});
CurrentServer = attacker.CurrentServer,
}, false);
if (clientDetection.Tracker.HasChanges)
{
SaveTrackedSnapshots(clientDetection, ctx);

View File

@ -231,7 +231,7 @@ namespace SharedLibraryCore.Commands
public override async Task ExecuteAsync(GameEvent E)
{
var _ = !(await E.Target.Ban(E.Data, E.Origin).WaitAsync()).Failed ?
var _ = !(await E.Target.Ban(E.Data, E.Origin, false).WaitAsync()).Failed ?
E.Origin.Tell($"^5{E.Target} ^7{Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_BAN_SUCCESS"]}") :
E.Origin.Tell($"{Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_BAN_FAIL"]} {E.Target.Name}");
}

View File

@ -348,7 +348,7 @@ namespace SharedLibraryCore.Database.Models
/// </summary>
/// <param name="banReason">reason for the ban</param>
/// <param name="sender">client performing the ban</param>
public GameEvent Ban(String banReason, EFClient sender, bool isEvade = false)
public GameEvent Ban(String banReason, EFClient sender, bool isEvade)
{
var e = new GameEvent()
{

View File

@ -208,7 +208,7 @@ namespace SharedLibraryCore
/// <param name="Reason">The reason for the ban</param>
/// <param name="Target">The person to ban</param>
/// <param name="Origin">The person who banned the target</param>
abstract protected Task Ban(String Reason, EFClient Target, EFClient Origin, bool isEvade);
abstract protected Task Ban(String Reason, EFClient Target, EFClient Origin, bool isEvade = false);
abstract protected Task Warn(String Reason, EFClient Target, EFClient Origin);

View File

@ -66,7 +66,6 @@ namespace SharedLibraryCore.Services
public async Task<IList<EFPenalty>> Find(Func<EFPenalty, bool> expression)
{
throw await Task.FromResult(new Exception());
}
public Task<EFPenalty> Get(int entityID)
@ -96,7 +95,7 @@ namespace SharedLibraryCore.Services
.OrderByDescending(p => p.When)
.Skip(offset)
.Take(count)
.ToListAsync();
.ToListAsync();
}
}
@ -116,7 +115,7 @@ namespace SharedLibraryCore.Services
/// <summary>
/// Get a read-only copy of client penalties
/// </summary>
/// <param name="clientI"></param>
/// <param name="clientId"></param>
/// <param name="victim">Retreive penalties for clients receiving penalties, other wise given</param>
/// <returns></returns>
public async Task<List<ProfileMeta>> ReadGetClientPenaltiesAsync(int clientId, bool victim = true)

View File

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using SharedLibraryCore;
using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Dtos;
using SharedLibraryCore.Objects;
using System;
@ -12,6 +13,9 @@ namespace WebfrontCore.ViewComponents
{
public async Task<IViewComponentResult> InvokeAsync(int offset, Penalty.PenaltyType showOnly)
{
string showEvadeString(EFPenalty penalty) => penalty.IsEvadedOffense == true ?
$"({Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_PENALTY_EVADE"]}) " : "";
var penalties = await Program.Manager.GetPenaltyService().GetRecentPenalties(12, offset, showOnly);
var penaltiesDto = penalties.Select(p => new PenaltyInfo()
{
@ -25,9 +29,9 @@ namespace WebfrontCore.ViewComponents
#if DEBUG
Offense = !string.IsNullOrEmpty(p.AutomatedOffense) ? p.AutomatedOffense : p.Offense,
#else
Offense = User.Identity.IsAuthenticated && !string.IsNullOrEmpty(p.AutomatedOffense) ? (p.IsEvadedOffense ?
$"({Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_PENALTY_EVADE"]}) " : "") + p.AutomatedOffense :
$"({Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_PENALTY_EVADE"]}) " + p.Offense,
Offense = (User.Identity.IsAuthenticated && !string.IsNullOrEmpty(p.AutomatedOffense)) ?
$"{showEvadeString(p)}{p.AutomatedOffense}" :
$"{showEvadeString(p)}{p.Offense}",
#endif
Type = p.Type.ToString(),
TimePunished = Utilities.GetTimePassed(p.When, false),