fixed the vpn detection plugin method signature call

added some fixes for stats/ac
This commit is contained in:
RaidMax 2018-10-06 15:31:05 -05:00
parent de902a58ac
commit c8366a22e5
11 changed files with 36 additions and 24 deletions

View File

@ -5,7 +5,7 @@
<TargetFramework>netcoreapp2.1</TargetFramework>
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
<Version>2.1.9.2</Version>
<Version>2.1.9.4</Version>
<Authors>RaidMax</Authors>
<Company>Forever None</Company>
<Product>IW4MAdmin</Product>
@ -30,7 +30,8 @@
<PropertyGroup>
<ServerGarbageCollection>true</ServerGarbageCollection>
<TieredCompilation>true</TieredCompilation>
<AssemblyVersion>2.1.9.3</AssemblyVersion>
<AssemblyVersion>2.1.9.4</AssemblyVersion>
<FileVersion>2.1.9.4</FileVersion>
</PropertyGroup>
<ItemGroup>

View File

@ -82,10 +82,13 @@ if "%CurrentConfiguration" == "Release" (
echo PR-RT
move "%SolutionDir%Publish\WindowsPrerelease\runtimes" "%SolutionDir%Publish\WindowsPrerelease\Lib\runtimes"
if exist "%SolutionDir%Publish\WindowsPrerelease\refs" move "%SolutionDir%Publish\WindowsPrerelease\refs" "%SolutionDir%Publish\WindowsPrerelease\Lib\refs"
if "%CurrentConfiguration" == "Release" (
echo R-RT
rem move "%SolutionDir%Publish\Windows\runtimes" "%SolutionDir%Publish\Windows\Lib\runtimes"
move "%SolutionDir%Publish\Windows\runtimes" "%SolutionDir%Publish\Windows\Lib\runtimes"
if exist "%SolutionDir%Publish\Windows\refs" move "%SolutionDir%Publish\Windows\refs" "%SolutionDir%Publish\Windows\Lib\refs"
)
echo making start scripts

View File

@ -383,11 +383,10 @@ namespace IW4MAdmin.Application
await Plugin.OnLoadAsync(this);
}
catch (Exception e)
catch (Exception ex)
{
Logger.WriteError($"{Utilities.CurrentLocalization.LocalizationIndex["SERVER_ERROR_PLUGIN"]} {Plugin.Name}");
Logger.WriteDebug($"Exception: {e.Message}");
Logger.WriteDebug($"Stack Trace: {e.StackTrace}");
Logger.WriteDebug(ex.GetExceptionInfo());
}
}
#endregion

View File

@ -42,6 +42,7 @@ var plugin = {
var library = importNamespace('SharedLibraryCore');
var kickOrigin = new library.Objects.Player();
kickOrigin.ClientId = 1;
kickOrigin.CurrentServer = origin.CurrentServer;
origin.Kick(_localization.LocalizationIndex["SERVER_KICK_VPNS_NOTALLOWED"], kickOrigin);
}
},
@ -55,7 +56,7 @@ var plugin = {
onLoadAsync: function (manager) {
this.manager = manager;
this.logger = manager.GetLogger();
this.logger = manager.GetLogger(0);
},
onUnloadAsync: function () {

View File

@ -26,8 +26,8 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
Dictionary<IW4Info.HitLocation, int> HitLocationCount;
double AngleDifferenceAverage;
EFClientStatistics ClientStats;
DateTime LastHit;
long LastOffset;
IW4Info.WeaponName LastWeapon;
ILogger Log;
Strain Strain;
readonly DateTime ConnectionTime = DateTime.UtcNow;
@ -53,16 +53,16 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
if ((kill.DeathType != IW4Info.MeansOfDeath.MOD_PISTOL_BULLET &&
kill.DeathType != IW4Info.MeansOfDeath.MOD_RIFLE_BULLET &&
kill.DeathType != IW4Info.MeansOfDeath.MOD_HEAD_SHOT) ||
kill.HitLoc == IW4Info.HitLocation.none || kill.TimeOffset - LastOffset < 0)
kill.HitLoc == IW4Info.HitLocation.none || kill.TimeOffset - LastOffset < 0 ||
// hack: prevents false positives
(LastWeapon != kill.Weapon && (kill.TimeOffset - LastOffset) == 50))
return new DetectionPenaltyResult()
{
ClientPenalty = Penalty.PenaltyType.Any,
};
DetectionPenaltyResult result = null;
if (LastHit == DateTime.MinValue)
LastHit = DateTime.UtcNow;
LastWeapon = kill.Weapon;
HitLocationCount[kill.HitLoc]++;
if (!isDamage)

View File

@ -147,7 +147,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
});
#if DEBUG == true
var statsInfoSql = iqStatsInfo.ToSql();
var statsInfoSql = iqStatsInfo.ToSql();
#endif
var topPlayers = await iqStatsInfo.ToListAsync();
@ -406,6 +406,14 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
string fraction, string visibilityPercentage, string snapAngles)
{
var statsSvc = ContextThreads[serverId];
// incase the add palyer event get delayed
if (!Servers[serverId].PlayerStats.ContainsKey(attacker.ClientId))
{
await AddPlayer(attacker);
}
Vector3 vDeathOrigin = null;
Vector3 vKillOrigin = null;
Vector3 vViewAngles = null;
@ -675,7 +683,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
}
#if DEBUG
Log.WriteDebug("Calculating standard kill");
Log.WriteDebug("Calculating standard kill");
#endif
// update the total stats
@ -727,7 +735,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
#if !DEBUG
if ((DateTime.UtcNow - attackerStats.LastStatHistoryUpdate).TotalMinutes >= 2.5)
#else
if ((DateTime.UtcNow - attackerStats.LastStatHistoryUpdate).TotalMinutes >= 0.1)
if ((DateTime.UtcNow - attackerStats.LastStatHistoryUpdate).TotalMinutes >= 0.1)
#endif
{
attackerStats.LastStatHistoryUpdate = DateTime.UtcNow;

View File

@ -1126,7 +1126,7 @@ namespace SharedLibraryCore.Commands
{
}
public override Task ExecuteAsync(GameEvent E)
public override async Task ExecuteAsync(GameEvent E)
{
var gameserverProcesses = System.Diagnostics.Process.GetProcessesByName("iw4x");
@ -1180,12 +1180,12 @@ namespace SharedLibraryCore.Commands
E.Origin.Tell("Could not kill server process");
E.Owner.Logger.WriteDebug("Unable to kill process");
E.Owner.Logger.WriteDebug($"Exception: {e.Message}");
return Task.CompletedTask;
return;
}
}
}
return Task.CompletedTask;
return;
}
}

View File

@ -37,7 +37,7 @@ namespace SharedLibraryCore.Configuration
public Task Save()
{
var appConfigJSON = JsonConvert.SerializeObject(_configuration, Formatting.Indented);
return File.WriteAllTextAsync(Path.Join(AppDomain.CurrentDomain.BaseDirectory, "Configuration", $"{Filename}.json"), appConfigJSON);
return File.WriteAllTextAsync(Path.Join(Utilities.OperatingDirectory, "Configuration", $"{Filename}.json"), appConfigJSON);
}
public T Configuration() => _configuration;

View File

@ -39,7 +39,7 @@ namespace SharedLibraryCore.RCon
/// <summary>
/// timeout in seconds to wait for a socket send or receive before giving up
/// </summary>
public static readonly int SocketTimeout = 1000;
public static readonly int SocketTimeout = 7500;
/// <summary>
/// interval in milliseconds to wait before sending the next RCon request
/// </summary>

View File

@ -30,7 +30,7 @@ namespace WebfrontCore
#if DEBUG
.UseContentRoot(Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), @"..\..\..\..\", "WebfrontCore")))
#else
.UseContentRoot(Path.Join(Directory.GetCurrentDirectory(), "..\\"))
.UseContentRoot(SharedLibraryCore.Utilities.OperatingDirectory)
#endif
.UseUrls(Manager.GetApplicationSettings().Configuration().WebfrontBindUrl)
.UseKestrel()

View File

@ -20,7 +20,7 @@ namespace WebfrontCore
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
// .SetBasePath(SharedLibraryCore.Utilities.OperatingDirectory)
.AddEnvironmentVariables();
Configuration = builder.Build();
@ -32,10 +32,10 @@ namespace WebfrontCore
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
var mvcBulder = services.AddMvc();
var mvcBuilder = services.AddMvc();
foreach (var asm in Program.Manager.GetPluginAssemblies())
mvcBulder.AddApplicationPart(asm);
mvcBuilder.AddApplicationPart(asm);
services.Configure<RazorViewEngineOptions>(o =>
{