1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 23:31:13 -05:00

-reconfigured solution and projects to be correct debug/release and files copy properly

-started working on more advanced statistics
This commit is contained in:
RaidMax
2017-09-29 21:42:24 -05:00
parent 8d52d7ddc5
commit 4cddefd542
26 changed files with 1824 additions and 334 deletions

View File

@ -18,7 +18,7 @@ namespace IW4MAdmin.Plugins
public string Author => "RaidMax";
private static DateTime Interval;
private DateTime Interval;
public async Task OnEventAsync(Event E, Server S)
{
@ -54,7 +54,7 @@ namespace IW4MAdmin.Plugins
{
var rand = new Random();
int index = rand.Next(0, 17);
var p = new Player($"Test_{index}", "_test", index, (int)Player.Permission.User)
var p = new Player($"Test_{index}", $"_test{index}", index, (int)Player.Permission.User)
{
Ping = 1
};
@ -66,7 +66,56 @@ namespace IW4MAdmin.Plugins
await S.AddPlayer(p);
Interval = DateTime.Now;
if (S.ClientNum > 0)
{
//"K;26d2f66b95184934;1;allies;egor;5c56fef676b3818d;0;axis;1_din;m21_heartbeat_mp;98;MOD_RIFLE_BULLET;torso_lower";
var victimPlayer = S.Players.Where(pl => pl != null).ToList()[rand.Next(0, S.ClientNum - 1)];
var attackerPlayer = S.Players.Where(pl => pl != null).ToList()[rand.Next(0, S.ClientNum - 1)];
string[] eventLine = null;
if (S.GameName == Server.Game.IW4)
{
// attackerID ; victimID ; attackerOrigin ; victimOrigin ; Damage ; Weapon ; hitLocation ; meansOfDeath
eventLine = new string[]
{
"ScriptKill",
attackerPlayer.NetworkID,
victimPlayer.NetworkID,
new StatsPlugin.Vector3(rand.Next(0, 5000), rand.Next(0, 100), rand.Next(0, 5000)).ToString(),
new StatsPlugin.Vector3(rand.Next(0, 5000), rand.Next(0, 100), rand.Next(0, 5000)).ToString(),
rand.Next(50, 105).ToString(),
((StatsPlugin.IW4Info.WeaponName)rand.Next(0, Enum.GetValues(typeof(StatsPlugin.IW4Info.WeaponName)).Length - 1)).ToString(),
((StatsPlugin.IW4Info.HitLocation)rand.Next(0, Enum.GetValues(typeof(StatsPlugin.IW4Info.HitLocation)).Length - 1)).ToString(),
((StatsPlugin.IW4Info.MeansOfDeath)rand.Next(0, Enum.GetValues(typeof(StatsPlugin.IW4Info.MeansOfDeath)).Length - 1)).ToString()
};
}
else
{
eventLine = new string[]
{
"K",
victimPlayer.NetworkID,
victimPlayer.ClientID.ToString(),
rand.Next(0, 1) == 0 ? "allies" : "axis",
victimPlayer.Name,
attackerPlayer.NetworkID,
attackerPlayer.ClientID.ToString(),
rand.Next(0, 1) == 0 ? "allies" : "axis",
attackerPlayer.Name.ToString(),
((StatsPlugin.IW4Info.WeaponName)rand.Next(0, Enum.GetValues(typeof(StatsPlugin.IW4Info.WeaponName)).Length - 1)).ToString(), // Weapon
rand.Next(50, 105).ToString(), // Damange
((StatsPlugin.IW4Info.MeansOfDeath)rand.Next(0, Enum.GetValues(typeof(StatsPlugin.IW4Info.MeansOfDeath)).Length - 1)).ToString(), // Means of Death
((StatsPlugin.IW4Info.HitLocation)rand.Next(0, Enum.GetValues(typeof(StatsPlugin.IW4Info.HitLocation)).Length - 1)).ToString(), // Hit Location
};
}
var _event = Event.ParseEventString(eventLine, S);
await S.ExecuteEvent(_event);
}
}
}
public async Task OnUnloadAsync()