fixed initialization error when no map set exists in config
fixed discord link showing when no invite specified OpenGraph image set to absolute url more changes to killcallback and logging fixed some angle conversion stuff
This commit is contained in:
parent
77bf0710df
commit
979b1f2310
@ -15,6 +15,8 @@ namespace StatsPlugin.Cheat
|
|||||||
int Kills;
|
int Kills;
|
||||||
int AboveThresholdCount;
|
int AboveThresholdCount;
|
||||||
double AverageKillTime;
|
double AverageKillTime;
|
||||||
|
double AverageHitOffset;
|
||||||
|
int avgcnt;
|
||||||
Dictionary<IW4Info.HitLocation, int> HitLocationCount;
|
Dictionary<IW4Info.HitLocation, int> HitLocationCount;
|
||||||
DateTime LastKill;
|
DateTime LastKill;
|
||||||
ILogger Log;
|
ILogger Log;
|
||||||
@ -51,13 +53,25 @@ namespace StatsPlugin.Cheat
|
|||||||
|
|
||||||
#region VIEWANGLES
|
#region VIEWANGLES
|
||||||
double distance = Vector3.Distance(kill.KillOrigin, kill.DeathOrigin);
|
double distance = Vector3.Distance(kill.KillOrigin, kill.DeathOrigin);
|
||||||
double x = kill.KillOrigin.X + distance * Math.Cos(kill.ViewAngles.Y.ToRadians()) * Math.Cos(kill.ViewAngles.X.ToRadians());
|
double x = kill.KillOrigin.X + distance * Math.Cos(kill.ViewAngles.X.ToRadians()) * Math.Cos(kill.ViewAngles.Y.ToRadians());
|
||||||
double y = kill.KillOrigin.Y + (distance * Math.Sin((360.0f - kill.ViewAngles.Y).ToRadians()));
|
double y = kill.KillOrigin.Y + (distance * Math.Sin(kill.ViewAngles.X.ToRadians()) * Math.Cos(kill.ViewAngles.Y.ToRadians()));
|
||||||
double z = kill.KillOrigin.Z + (distance * Math.Cos(kill.ViewAngles.Y.ToRadians()) * Math.Sin((360.0f - kill.ViewAngles.X).ToRadians()));
|
double z = kill.KillOrigin.Z + distance * Math.Sin((360.0f - kill.ViewAngles.Y).ToRadians());
|
||||||
var trueVector = Vector3.Subtract(kill.KillOrigin, kill.DeathOrigin);
|
var trueVector = Vector3.Subtract(kill.KillOrigin, kill.DeathOrigin);
|
||||||
var calculatedVector = Vector3.Subtract(kill.KillOrigin, new Vector3((float)x, (float)y, (float)z));
|
var calculatedVector = Vector3.Subtract(kill.KillOrigin, new Vector3((float)x, (float)y, (float)z));
|
||||||
double angle = trueVector.AngleBetween(calculatedVector);
|
double angle = trueVector.AngleBetween(calculatedVector);
|
||||||
// Console.WriteLine(((float)angle).ToDegrees());
|
|
||||||
|
if (kill.AdsPercent > 0.5)
|
||||||
|
{
|
||||||
|
Log.WriteInfo($"{((float)angle).ToDegrees()}");
|
||||||
|
AverageHitOffset += angle;
|
||||||
|
avgcnt++;
|
||||||
|
double avg = AverageHitOffset / (float)avgcnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*r = distance,
|
||||||
|
x = playerX + r*cos(yaw)*cos(pitch),
|
||||||
|
y = playerY + r*sin(yaw)*cos(pitch)
|
||||||
|
z = playerZ + r*sin(360-pitch)*/
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -12,11 +12,11 @@ namespace StatsPlugin.Helpers
|
|||||||
|
|
||||||
public static Vector3 FixIW4Angles(this Vector3 vector)
|
public static Vector3 FixIW4Angles(this Vector3 vector)
|
||||||
{
|
{
|
||||||
float X = vector.X > 0 ? 360.0f - vector.X : Math.Abs(vector.X);
|
float X = vector.X >= 0 ? vector.X : 360.0f + vector.X;
|
||||||
float Y = vector.Y > 0 ? 360.0f - vector.Y : Math.Abs(vector.Y);
|
float Y = vector.Y >= 0 ? vector.Y : 360.0f + vector.Y;
|
||||||
float Z = vector.Z > 0 ? 360.0f - vector.Z : Math.Abs(vector.Z);
|
float Z = vector.Z >= 0 ? vector.Z : 360.0f + vector.Z;
|
||||||
|
|
||||||
return new Vector3(X, Y, Z);
|
return new Vector3(Y, X, Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float ToRadians(this float value) => (float)Math.PI * value / 180.0f;
|
public static float ToRadians(this float value) => (float)Math.PI * value / 180.0f;
|
||||||
|
@ -205,7 +205,7 @@ namespace StatsPlugin.Helpers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task AddScriptKill(Player attacker, Player victim, int serverId, string map, string hitLoc, string type,
|
public async Task AddScriptKill(Player attacker, Player victim, int serverId, string map, string hitLoc, string type,
|
||||||
string damage, string weapon, string killOrigin, string deathOrigin, string viewAngles, string offset)
|
string damage, string weapon, string killOrigin, string deathOrigin, string viewAngles, string offset, string isKillstreakKill, string Ads)
|
||||||
{
|
{
|
||||||
var statsSvc = ContextThreads[serverId];
|
var statsSvc = ContextThreads[serverId];
|
||||||
|
|
||||||
@ -224,7 +224,9 @@ namespace StatsPlugin.Helpers
|
|||||||
Weapon = ParseEnum<IW4Info.WeaponName>.Get(weapon, typeof(IW4Info.WeaponName)),
|
Weapon = ParseEnum<IW4Info.WeaponName>.Get(weapon, typeof(IW4Info.WeaponName)),
|
||||||
ViewAngles = Vector3.Parse(viewAngles).FixIW4Angles(),
|
ViewAngles = Vector3.Parse(viewAngles).FixIW4Angles(),
|
||||||
TimeOffset = Int64.Parse(offset),
|
TimeOffset = Int64.Parse(offset),
|
||||||
When = DateTime.UtcNow
|
When = DateTime.UtcNow,
|
||||||
|
IsKillstreakKill = isKillstreakKill[0] != '0',
|
||||||
|
AdsPercent = float.Parse(Ads)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (kill.DeathType == IW4Info.MeansOfDeath.MOD_SUICIDE &&
|
if (kill.DeathType == IW4Info.MeansOfDeath.MOD_SUICIDE &&
|
||||||
@ -236,6 +238,11 @@ namespace StatsPlugin.Helpers
|
|||||||
|
|
||||||
await AddStandardKill(attacker, victim);
|
await AddStandardKill(attacker, victim);
|
||||||
|
|
||||||
|
if (kill.IsKillstreakKill)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var playerDetection = Servers[serverId].PlayerDetections[attacker.ClientId];
|
var playerDetection = Servers[serverId].PlayerDetections[attacker.ClientId];
|
||||||
var playerStats = Servers[serverId].PlayerStats[attacker.ClientId];
|
var playerStats = Servers[serverId].PlayerStats[attacker.ClientId];
|
||||||
|
|
||||||
|
@ -32,13 +32,17 @@ namespace StatsPlugin.Models
|
|||||||
public IW4Info.WeaponName Weapon { get; set; }
|
public IW4Info.WeaponName Weapon { get; set; }
|
||||||
public Vector3 KillOrigin { get; set; }
|
public Vector3 KillOrigin { get; set; }
|
||||||
public Vector3 DeathOrigin { get; set; }
|
public Vector3 DeathOrigin { get; set; }
|
||||||
|
public Vector3 ViewAngles { get; set; }
|
||||||
|
public DateTime When { get; set; }
|
||||||
// http://wiki.modsrepository.com/index.php?title=Call_of_Duty_5:_Gameplay_standards for conversion to meters
|
// http://wiki.modsrepository.com/index.php?title=Call_of_Duty_5:_Gameplay_standards for conversion to meters
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public double Distance => Vector3.Distance(KillOrigin, DeathOrigin) * 0.0254;
|
public double Distance => Vector3.Distance(KillOrigin, DeathOrigin) * 0.0254;
|
||||||
public IW4Info.MapName Map { get; set; }
|
public IW4Info.MapName Map { get; set; }
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public long TimeOffset { get; set; }
|
public long TimeOffset { get; set; }
|
||||||
public Vector3 ViewAngles { get; set; }
|
[NotMapped]
|
||||||
public DateTime When { get; set; }
|
public bool IsKillstreakKill { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public float AdsPercent { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ namespace StatsPlugin
|
|||||||
string[] killInfo = (E.Data != null) ? E.Data.Split(';') : new string[0];
|
string[] killInfo = (E.Data != null) ? E.Data.Split(';') : new string[0];
|
||||||
if (killInfo.Length >= 9 && killInfo[0].Contains("ScriptKill") && E.Owner.CustomCallback)
|
if (killInfo.Length >= 9 && killInfo[0].Contains("ScriptKill") && E.Owner.CustomCallback)
|
||||||
await Manager.AddScriptKill(E.Origin, E.Target, S.GetHashCode(), S.CurrentMap.Name, killInfo[7], killInfo[8],
|
await Manager.AddScriptKill(E.Origin, E.Target, S.GetHashCode(), S.CurrentMap.Name, killInfo[7], killInfo[8],
|
||||||
killInfo[5], killInfo[6], killInfo[3], killInfo[4], killInfo[9], killInfo[10]);
|
killInfo[5], killInfo[6], killInfo[3], killInfo[4], killInfo[9], killInfo[10], killInfo[11], killInfo[12]);
|
||||||
else if (!E.Owner.CustomCallback)
|
else if (!E.Owner.CustomCallback)
|
||||||
await Manager.AddStandardKill(E.Origin, E.Target);
|
await Manager.AddStandardKill(E.Origin, E.Target);
|
||||||
break;
|
break;
|
||||||
|
@ -38,7 +38,7 @@ namespace SharedLibrary.Helpers
|
|||||||
|
|
||||||
public static double Distance(Vector3 a, Vector3 b)
|
public static double Distance(Vector3 a, Vector3 b)
|
||||||
{
|
{
|
||||||
return Math.Round(Math.Sqrt(Math.Pow(b.X - a.X, 2) + Math.Pow(b.Y - a.Y, 2) + Math.Pow(b.Z - a.Z, 2)), 2);
|
return Math.Sqrt(Math.Pow(b.X - a.X, 2) + Math.Pow(b.Y - a.Y, 2) + Math.Pow(b.Z - a.Z, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3 Subtract(Vector3 a, Vector3 b) => new Vector3(b.X - a.X, b.Y - a.Y, b.Z - a.Z);
|
public static Vector3 Subtract(Vector3 a, Vector3 b) => new Vector3(b.X - a.X, b.Y - a.Y, b.Z - a.Z);
|
||||||
|
@ -246,7 +246,9 @@ namespace SharedLibrary
|
|||||||
protected void InitializeMaps()
|
protected void InitializeMaps()
|
||||||
{
|
{
|
||||||
Maps = new List<Map>();
|
Maps = new List<Map>();
|
||||||
Maps.AddRange(Manager.GetApplicationSettings().Configuration().Maps.First(m => m.Game == GameName).Maps);
|
var gameMaps = Manager.GetApplicationSettings().Configuration().Maps.FirstOrDefault(m => m.Game == GameName);
|
||||||
|
if (gameMaps != null)
|
||||||
|
Maps.AddRange(gameMaps.Maps);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -46,6 +46,7 @@ namespace IW4MAdmin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !DEBUG
|
||||||
if (polledPlayer.Name.Length < 3)
|
if (polledPlayer.Name.Length < 3)
|
||||||
{
|
{
|
||||||
Logger.WriteDebug($"Kicking {polledPlayer} because their name is too short");
|
Logger.WriteDebug($"Kicking {polledPlayer} because their name is too short");
|
||||||
@ -76,6 +77,7 @@ namespace IW4MAdmin
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
Logger.WriteDebug($"Client slot #{polledPlayer.ClientNumber} now reserved");
|
Logger.WriteDebug($"Client slot #{polledPlayer.ClientNumber} now reserved");
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -656,7 +658,7 @@ namespace IW4MAdmin
|
|||||||
LogFile = new IFile(logPath);
|
LogFile = new IFile(logPath);
|
||||||
//#else
|
//#else
|
||||||
}
|
}
|
||||||
// LogFile = new RemoteFile("https://raidmax.org/IW4MAdmin/getlog.php");
|
LogFile = new RemoteFile("https://raidmax.org/IW4MAdmin/getlog.php");
|
||||||
//#endif
|
//#endif
|
||||||
Logger.WriteInfo($"Log file is {logPath}");
|
Logger.WriteInfo($"Log file is {logPath}");
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
|
@ -23,7 +23,10 @@ namespace WebfrontCore.Controllers
|
|||||||
ViewBag.Authorized = Authorized;
|
ViewBag.Authorized = Authorized;
|
||||||
ViewBag.Url = Startup.Configuration["Web:Address"];
|
ViewBag.Url = Startup.Configuration["Web:Address"];
|
||||||
string inviteLink = Manager.GetApplicationSettings().Configuration().DiscordInviteCode;
|
string inviteLink = Manager.GetApplicationSettings().Configuration().DiscordInviteCode;
|
||||||
ViewBag.DiscordLink = inviteLink != null && inviteLink.Contains("http") ? inviteLink : $"https://discordapp.com/invite/{inviteLink}";
|
if (inviteLink != null)
|
||||||
|
ViewBag.DiscordLink = inviteLink.Contains("https") ? inviteLink : $"https://discordapp.com/invite/{inviteLink}";
|
||||||
|
else
|
||||||
|
ViewBag.DiscorLink = "";
|
||||||
base.OnActionExecuting(context);
|
base.OnActionExecuting(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ namespace WebfrontCore.Controllers
|
|||||||
|
|
||||||
public async Task<IActionResult> ListAsync(int offset = 0)
|
public async Task<IActionResult> ListAsync(int offset = 0)
|
||||||
{
|
{
|
||||||
return View("_List", offset);
|
return await Task.FromResult(View("_List", offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> PublicAsync()
|
public async Task<IActionResult> PublicAsync()
|
||||||
|
@ -20,6 +20,22 @@
|
|||||||
<span id="profile_aliases_btn" class="oi oi-caret-bottom pl-2"></span>
|
<span id="profile_aliases_btn" class="oi oi-caret-bottom pl-2"></span>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@{
|
||||||
|
if (ViewBag.Authorized)
|
||||||
|
{
|
||||||
|
if (Model.Level == SharedLibrary.Objects.Player.Permission.User.ToString())
|
||||||
|
{
|
||||||
|
|
||||||
|
<span id="profile_action_ban_btn" class="oi oi-ban text-danger" title="ban" aria-hidden="true"></span>
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Model.Level == SharedLibrary.Objects.Player.Permission.Banned.ToString())
|
||||||
|
{
|
||||||
|
<span id="profile_action_unban_btn" class="iconic iconic-carriage-return text-success" title="carriage return" aria-hidden="true"></span>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</h1>
|
</h1>
|
||||||
<div id="profile_aliases" class="pr-0 pr-sm-4 pb-2 mb-2 text-muted">
|
<div id="profile_aliases" class="pr-0 pr-sm-4 pb-2 mb-2 text-muted">
|
||||||
|
@ -2,5 +2,5 @@
|
|||||||
ViewData["Title"] = "Error";
|
ViewData["Title"] = "Error";
|
||||||
}
|
}
|
||||||
|
|
||||||
<h1 class="text-danger">Error.</h1>
|
<h3 class="text-danger">Sorry!</h3>
|
||||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
<h4 class="text-danger">An error occurred while processing your request.</h4>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<title>@ViewBag.Title | IW4MAdmin</title>
|
<title>@ViewBag.Title | IW4MAdmin</title>
|
||||||
<meta property="og:title" content="@ViewBag.Title | IW4MAdmin">
|
<meta property="og:title" content="@ViewBag.Title | IW4MAdmin">
|
||||||
<meta property="og:type" content="website">
|
<meta property="og:type" content="website">
|
||||||
<meta property="og:image" content="/images/icon.png">
|
<meta property="og:image" content="@ViewBag.Url/images/icon.png">
|
||||||
<meta property="og:description" content="@ViewBag.Description">
|
<meta property="og:description" content="@ViewBag.Description">
|
||||||
<meta property="og:url" content="@ViewBag.Url">
|
<meta property="og:url" content="@ViewBag.Url">
|
||||||
<meta name="description" content="@ViewBag.Description">
|
<meta name="description" content="@ViewBag.Description">
|
||||||
|
@ -69,11 +69,11 @@ Callback_PlayerKilled( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vD
|
|||||||
else if(!isPlayer(attacker) && sMeansOfDeath == "MOD_FALLING")
|
else if(!isPlayer(attacker) && sMeansOfDeath == "MOD_FALLING")
|
||||||
_attacker = victim;
|
_attacker = victim;
|
||||||
|
|
||||||
|
|
||||||
location = victim GetTagOrigin(hitLocationToBone(sHitLoc));
|
location = victim GetTagOrigin(hitLocationToBone(sHitLoc));
|
||||||
//attacker iPrintLnBold(location);
|
isKillstreakKill = !isPlayer(attacker) || isKillstreakWeapon(sWeapon);
|
||||||
//attacker iPrintLnBold(attacker.origin[0]);
|
|
||||||
|
|
||||||
/*BulletTrace(_attacker GetTagOrigin("tag_eye"), VectorScale(anglesToForward(attacker getPlayerAngles())), true, attacker)["entity"]*/
|
/*BulletTrace(_attacker GetTagOrigin("tag_eye"), VectorScale(anglesToForward(attacker getPlayerAngles())), true, attacker)["entity"]*/
|
||||||
logPrint("ScriptKill;" + _attacker.guid + ";" + victim.guid + ";" + _attacker GetTagOrigin("tag_eye") + ";" + location + ";" + iDamage + ";" + sWeapon + ";" + sHitLoc + ";" + sMeansOfDeath + ";" + _attacker getPlayerAngles() + ";" + gettime() + "\n");
|
logPrint("ScriptKill;" + _attacker.guid + ";" + victim.guid + ";" + _attacker GetTagOrigin("tag_eye") + ";" + location + ";" + iDamage + ";" + sWeapon + ";" + sHitLoc + ";" + sMeansOfDeath + ";" + _attacker getPlayerAngles() + ";" + gettime() + ";" + isKillstreakKill + ";" + _attacker playerADS() + "\n");
|
||||||
self maps\mp\gametypes\_damage::Callback_PlayerKilled( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration );
|
self maps\mp\gametypes\_damage::Callback_PlayerKilled( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration );
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user