mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
Fixed non player killstreak kills counting as suicide
(custom callbacks) RCON tweaks to hopefully prevent RCON flooding Stats reimp added IW4x extra weapons
This commit is contained in:
@ -18,6 +18,7 @@ namespace SharedLibrary.Database.Models
|
||||
[Required]
|
||||
public int Connections { get; set; }
|
||||
[Required]
|
||||
// in seconds
|
||||
public int TotalConnectionTime { get; set; }
|
||||
[Required]
|
||||
public DateTime FirstConnection { get; set; }
|
||||
|
@ -3,19 +3,53 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace SharedLibrary
|
||||
{
|
||||
public class RemoteFile : IFile
|
||||
{
|
||||
string Location;
|
||||
string[] FileCache;
|
||||
|
||||
public RemoteFile(string location) : base(string.Empty)
|
||||
{
|
||||
Location = location;
|
||||
}
|
||||
|
||||
private void Retrieve()
|
||||
{
|
||||
using (var cl = new HttpClient())
|
||||
FileCache = cl.GetStringAsync(Location).Result.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
public override string[] Tail(int lineCount)
|
||||
{
|
||||
Retrieve();
|
||||
return FileCache;
|
||||
}
|
||||
|
||||
public override long Length()
|
||||
{
|
||||
Retrieve();
|
||||
return FileCache[0].Length;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class IFile
|
||||
{
|
||||
public IFile(String fileName)
|
||||
{
|
||||
Name = fileName;
|
||||
Handle = new StreamReader(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
|
||||
sze = Handle.BaseStream.Length;
|
||||
if (fileName != string.Empty)
|
||||
{
|
||||
Name = fileName;
|
||||
Handle = new StreamReader(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
|
||||
sze = Handle.BaseStream.Length;
|
||||
}
|
||||
}
|
||||
|
||||
public long Length()
|
||||
public virtual long Length()
|
||||
{
|
||||
sze = Handle.BaseStream.Length;
|
||||
return sze;
|
||||
@ -36,7 +70,7 @@ namespace SharedLibrary
|
||||
return Handle?.ReadToEnd();
|
||||
}
|
||||
|
||||
public String[] Tail(int lineCount)
|
||||
public virtual String[] Tail(int lineCount)
|
||||
{
|
||||
var buffer = new List<string>(lineCount);
|
||||
string line;
|
||||
|
@ -40,7 +40,7 @@ namespace SharedLibrary.Helpers
|
||||
public void Update(Task<bool> T)
|
||||
{
|
||||
RequestedTask = T;
|
||||
Console.WriteLine($"Starting Task {T.Id} ");
|
||||
// Console.WriteLine($"Starting Task {T.Id} ");
|
||||
RequestedTask.Start();
|
||||
|
||||
if (TimesRun > 25)
|
||||
|
@ -26,12 +26,12 @@ namespace SharedLibrary.Network
|
||||
|
||||
static string[] SendQuery(QueryType Type, Server QueryServer, string Parameters = "")
|
||||
{
|
||||
if ((DateTime.Now - LastQuery).TotalMilliseconds < 30)
|
||||
Task.Delay(30).Wait();
|
||||
if ((DateTime.Now - LastQuery).TotalMilliseconds < 100)
|
||||
Task.Delay(100).Wait();
|
||||
LastQuery = DateTime.Now;
|
||||
var ServerOOBConnection = new UdpClient();
|
||||
ServerOOBConnection.Client.SendTimeout = 5000;
|
||||
ServerOOBConnection.Client.ReceiveTimeout = 5000;
|
||||
ServerOOBConnection.Client.SendTimeout = 1000;
|
||||
ServerOOBConnection.Client.ReceiveTimeout = 1000;
|
||||
var Endpoint = new IPEndPoint(IPAddress.Parse(QueryServer.GetIP()), QueryServer.GetPort());
|
||||
|
||||
string QueryString = String.Empty;
|
||||
@ -139,7 +139,7 @@ namespace SharedLibrary.Network
|
||||
|
||||
public static async Task<List<Player>> GetStatusAsync(this Server server)
|
||||
{
|
||||
#if DEBUG
|
||||
#if DEBUG && DEBUG_PLAYERS
|
||||
string[] response = await Task.Run(() => System.IO.File.ReadAllLines("players.txt"));
|
||||
#else
|
||||
string[] response = await Task.FromResult(SendQuery(QueryType.DVAR, server, "status"));
|
||||
|
@ -140,11 +140,13 @@ namespace SharedLibrary
|
||||
/// <param name="Message">Message to be sent to all players</param>
|
||||
public async Task Broadcast(String Message)
|
||||
{
|
||||
#if DEBUG
|
||||
//return;
|
||||
#endif
|
||||
|
||||
string sayCommand = (GameName == Game.IW4) ? "sayraw" : "say";
|
||||
#if !DEBUG
|
||||
await this.ExecuteCommandAsync($"{sayCommand} {Message}");
|
||||
#else
|
||||
Logger.WriteVerbose(Message.StripColors());
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -156,8 +158,12 @@ namespace SharedLibrary
|
||||
{
|
||||
string tellCommand = (GameName == Game.IW4) ? "tellraw" : "tell";
|
||||
|
||||
#if !DEBUG
|
||||
if (Target.ClientNumber > -1 && Message.Length > 0 && Target.Level != Player.Permission.Console)
|
||||
await this.ExecuteCommandAsync($"{tellCommand} {Target.ClientNumber} {Message}^7");
|
||||
#else
|
||||
Logger.WriteVerbose($"{Target.ClientNumber}->{Message.StripColors()}");
|
||||
#endif
|
||||
|
||||
if (Target.Level == Player.Permission.Console)
|
||||
{
|
||||
|
@ -86,6 +86,7 @@
|
||||
<HintPath>..\packages\Microsoft.SqlServer.Compact.4.0.8876.1\lib\net40\System.Data.SqlServerCe.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
|
Reference in New Issue
Block a user