mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-27 15:40:32 -05:00
removed reload command
prevent control characters from being used in name added MOD_HEAD_SHOT to hit location increment css fix for alias dropdown testing view angle analysis
This commit is contained in:
26
Plugins/SimpleStats/Helpers/Extensions.cs
Normal file
26
Plugins/SimpleStats/Helpers/Extensions.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using SharedLibrary.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StatsPlugin.Helpers
|
||||
{
|
||||
static class Extensions
|
||||
{
|
||||
|
||||
public static Vector3 FixIW4Angles(this Vector3 vector)
|
||||
{
|
||||
float X = vector.X > 0 ? 360.0f - vector.X : Math.Abs(vector.X);
|
||||
float Y = vector.Y > 0 ? 360.0f - vector.Y : Math.Abs(vector.Y);
|
||||
float Z = vector.Z > 0 ? 360.0f - vector.Z : Math.Abs(vector.Z);
|
||||
|
||||
return new Vector3(X, Y, Z);
|
||||
}
|
||||
|
||||
public static float ToRadians(this float value) => (float)Math.PI * value / 180.0f;
|
||||
|
||||
public static float ToDegrees(this float value) => value * 180.0f / (float)Math.PI;
|
||||
}
|
||||
}
|
@ -205,7 +205,7 @@ namespace StatsPlugin.Helpers
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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 damage, string weapon, string killOrigin, string deathOrigin, string viewAngles, string offset)
|
||||
{
|
||||
var statsSvc = ContextThreads[serverId];
|
||||
|
||||
@ -221,7 +221,10 @@ namespace StatsPlugin.Helpers
|
||||
DeathType = ParseEnum<IW4Info.MeansOfDeath>.Get(type, typeof(IW4Info.MeansOfDeath)),
|
||||
Damage = Int32.Parse(damage),
|
||||
HitLoc = ParseEnum<IW4Info.HitLocation>.Get(hitLoc, typeof(IW4Info.HitLocation)),
|
||||
Weapon = ParseEnum<IW4Info.WeaponName>.Get(weapon, typeof(IW4Info.WeaponName))
|
||||
Weapon = ParseEnum<IW4Info.WeaponName>.Get(weapon, typeof(IW4Info.WeaponName)),
|
||||
ViewAngles = Vector3.Parse(viewAngles).FixIW4Angles(),
|
||||
TimeOffset = Int64.Parse(offset),
|
||||
When = DateTime.UtcNow
|
||||
};
|
||||
|
||||
if (kill.DeathType == IW4Info.MeansOfDeath.MOD_SUICIDE &&
|
||||
@ -238,15 +241,17 @@ namespace StatsPlugin.Helpers
|
||||
|
||||
// increment their hit count
|
||||
if (kill.DeathType == IW4Info.MeansOfDeath.MOD_PISTOL_BULLET ||
|
||||
kill.DeathType == IW4Info.MeansOfDeath.MOD_RIFLE_BULLET)
|
||||
kill.DeathType == IW4Info.MeansOfDeath.MOD_RIFLE_BULLET ||
|
||||
kill.DeathType == IW4Info.MeansOfDeath.MOD_HEAD_SHOT)
|
||||
{
|
||||
playerStats.HitLocations.Single(hl => hl.Location == kill.HitLoc).HitCount += 1;
|
||||
await statsSvc.ClientStatSvc.SaveChangesAsync();
|
||||
}
|
||||
|
||||
//statsSvc.KillStatsSvc.Insert(kill);
|
||||
//await statsSvc.KillStatsSvc.SaveChangesAsync();
|
||||
if(Plugin.Config.Configuration().EnableAntiCheat)
|
||||
statsSvc.KillStatsSvc.Insert(kill);
|
||||
await statsSvc.KillStatsSvc.SaveChangesAsync();
|
||||
|
||||
if (Plugin.Config.Configuration().EnableAntiCheat)
|
||||
{
|
||||
async Task executePenalty(Cheat.DetectionPenaltyResult penalty)
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ namespace StatsPlugin.Helpers
|
||||
var deathstreakMessage = Plugin.Config.Configuration().DeathstreakMessages;
|
||||
|
||||
string message = killstreakMessage.FirstOrDefault(m => m.Count == killStreak)?.Message;
|
||||
message = (message == null) ? deathstreakMessage.FirstOrDefault(m => m.Count == deathStreak)?.Message : message;
|
||||
message = message ?? deathstreakMessage.FirstOrDefault(m => m.Count == deathStreak)?.Message;
|
||||
return message ?? "";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user