Removed some files no longer needed, and cleaned up build events to export our nice release build easier.
This commit is contained in:
parent
cd85a5c384
commit
73aa001d79
@ -1,56 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace IW4MAdmin
|
||||
{
|
||||
class Ban
|
||||
{
|
||||
public Ban(String Reas, String TargID, String From, DateTime time, String ip)
|
||||
{
|
||||
Reason = Reas;
|
||||
npID = TargID;
|
||||
bannedByID = From;
|
||||
When = time;
|
||||
IP = ip;
|
||||
}
|
||||
|
||||
public String getReason()
|
||||
{
|
||||
return Reason;
|
||||
}
|
||||
|
||||
public String getID()
|
||||
{
|
||||
return npID;
|
||||
}
|
||||
|
||||
public String getBanner()
|
||||
{
|
||||
return bannedByID;
|
||||
}
|
||||
|
||||
public String getIP()
|
||||
{
|
||||
return IP;
|
||||
}
|
||||
|
||||
public String getWhen()
|
||||
{
|
||||
return When.ToString("MM/dd/yy HH:mm:ss"); ;
|
||||
}
|
||||
|
||||
public DateTime getTime()
|
||||
{
|
||||
return When;
|
||||
}
|
||||
|
||||
private String Reason;
|
||||
private String npID;
|
||||
private String bannedByID;
|
||||
private DateTime When;
|
||||
private String IP;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -33,7 +33,7 @@ namespace IW4MAdmin
|
||||
E.Origin.Tell("You cannot warn " + E.Target.Name);
|
||||
else
|
||||
{
|
||||
E.Target.lastOffense = Utilities.removeWords(E.Data, 1);
|
||||
E.Target.lastOffense = SharedLibrary.Utilities.removeWords(E.Data, 1);
|
||||
E.Target.Warnings++;
|
||||
String Message = String.Format("^1WARNING ^7[^3{0}^7]: ^3{1}^7, {2}", E.Target.Warnings, E.Target.Name, E.Target.lastOffense);
|
||||
E.Owner.Broadcast(Message);
|
||||
@ -62,7 +62,7 @@ namespace IW4MAdmin
|
||||
|
||||
public override void Execute(Event E)
|
||||
{
|
||||
E.Target.lastOffense = Utilities.removeWords(E.Data, 1);
|
||||
E.Target.lastOffense = SharedLibrary.Utilities.removeWords(E.Data, 1);
|
||||
String Message = "^1Player Kicked: ^5" + E.Target.lastOffense + " ^1Admin: ^5" + E.Origin.Name;
|
||||
if (E.Origin.Level > E.Target.Level)
|
||||
E.Target.Kick(Message);
|
||||
@ -87,7 +87,7 @@ namespace IW4MAdmin
|
||||
|
||||
public override void Execute(Event E)
|
||||
{
|
||||
E.Target.lastOffense = Utilities.removeWords(E.Data, 1);
|
||||
E.Target.lastOffense = SharedLibrary.Utilities.removeWords(E.Data, 1);
|
||||
String Message = "^1Player Temporarily Banned: ^5" + E.Target.lastOffense + "^7 (1 hour)";
|
||||
if (E.Origin.Level > E.Target.Level)
|
||||
E.Target.tempBan(Message);
|
||||
@ -102,7 +102,7 @@ namespace IW4MAdmin
|
||||
|
||||
public override void Execute(Event E)
|
||||
{
|
||||
E.Target.lastOffense = Utilities.removeWords(E.Data, 1);
|
||||
E.Target.lastOffense = SharedLibrary.Utilities.removeWords(E.Data, 1);
|
||||
E.Target.lastEvent = E; // needs to be fixed
|
||||
String Message;
|
||||
if (E.Owner.Website == null)
|
||||
@ -138,7 +138,7 @@ namespace IW4MAdmin
|
||||
|
||||
public override void Execute(Event E)
|
||||
{
|
||||
String You = String.Format("{0} [^3#{1}^7] {2} [^3@{3}^7] [{4}^7] IP: {5}", E.Origin.Name, E.Origin.clientID, E.Origin.npID, E.Origin.databaseID, Utilities.levelToColor(E.Origin.Level), E.Origin.IP);
|
||||
String You = String.Format("{0} [^3#{1}^7] {2} [^3@{3}^7] [{4}^7] IP: {5}", E.Origin.Name, E.Origin.clientID, E.Origin.npID, E.Origin.databaseID, SharedLibrary.Utilities.levelToColor(E.Origin.Level), E.Origin.IP);
|
||||
E.Origin.Tell(You);
|
||||
}
|
||||
}
|
||||
@ -156,7 +156,7 @@ namespace IW4MAdmin
|
||||
if (P == null)
|
||||
continue;
|
||||
|
||||
E.Origin.Tell(String.Format("[^3{0}^7]{3}[^3{1}^7] {2}", Utilities.levelToColor(P.Level), P.clientID, P.Name, Utilities.getSpaces(Player.Permission.SeniorAdmin.ToString().Length - P.Level.ToString().Length)));
|
||||
E.Origin.Tell(String.Format("[^3{0}^7]{3}[^3{1}^7] {2}", SharedLibrary.Utilities.levelToColor(P.Level), P.clientID, P.Name, SharedLibrary.Utilities.getSpaces(Player.Permission.SeniorAdmin.ToString().Length - P.Level.ToString().Length)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -245,7 +245,7 @@ namespace IW4MAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Player.Permission newPerm = Utilities.matchPermission(Utilities.removeWords(E.Data, 1));
|
||||
Player.Permission newPerm = SharedLibrary.Utilities.matchPermission(SharedLibrary.Utilities.removeWords(E.Data, 1));
|
||||
|
||||
if (newPerm > Player.Permission.Banned)
|
||||
{
|
||||
@ -295,7 +295,7 @@ namespace IW4MAdmin
|
||||
{
|
||||
if (P != null && P.Level > Player.Permission.Flagged && !P.Masked)
|
||||
{
|
||||
E.Origin.Tell(String.Format("[^3{0}^7] {1}", Utilities.levelToColor(P.Level), P.Name));
|
||||
E.Origin.Tell(String.Format("[^3{0}^7] {1}", SharedLibrary.Utilities.levelToColor(P.Level), P.Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -314,14 +314,14 @@ namespace IW4MAdmin
|
||||
if (m.Name.ToLower() == newMap || m.Alias.ToLower() == newMap)
|
||||
{
|
||||
E.Owner.Broadcast("Changing to map ^2" + m.Alias);
|
||||
Utilities.Wait(3);
|
||||
SharedLibrary.Utilities.Wait(3);
|
||||
E.Owner.Map(m.Name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
E.Owner.Broadcast("Attempting to change to unknown map ^1" + newMap);
|
||||
Utilities.Wait(3);
|
||||
SharedLibrary.Utilities.Wait(3);
|
||||
E.Owner.Map(newMap);
|
||||
}
|
||||
}
|
||||
@ -342,7 +342,7 @@ namespace IW4MAdmin
|
||||
|
||||
foreach (Player P in db_players)
|
||||
{
|
||||
String mesg = String.Format("[^3{0}^7] [^3@{1}^7] - [{2}^7] - {3} | last seen {4} ago", P.Name, P.databaseID, Utilities.levelToColor(P.Level), P.IP, P.getLastConnection());
|
||||
String mesg = String.Format("[^3{0}^7] [^3@{1}^7] - [{2}^7] - {3} | last seen {4} ago", P.Name, P.databaseID, SharedLibrary.Utilities.levelToColor(P.Level), P.IP, P.getLastConnection());
|
||||
E.Origin.Tell(mesg);
|
||||
}
|
||||
}
|
||||
@ -417,7 +417,7 @@ namespace IW4MAdmin
|
||||
|
||||
public override void Execute(Event E)
|
||||
{
|
||||
E.Data = Utilities.removeWords(E.Data, 1);
|
||||
E.Data = SharedLibrary.Utilities.removeWords(E.Data, 1);
|
||||
E.Target.Alert();
|
||||
E.Target.Tell("^1" + E.Origin.Name + " ^3[PM]^7 - " + E.Data);
|
||||
E.Origin.Tell(String.Format("To ^3{0} ^7-> {1}", E.Target.Name, E.Data));
|
||||
@ -562,7 +562,7 @@ namespace IW4MAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
E.Data = Utilities.removeWords(E.Data, 1);
|
||||
E.Data = SharedLibrary.Utilities.removeWords(E.Data, 1);
|
||||
E.Owner.Reports.Add(new Report(E.Target, E.Origin, E.Data));
|
||||
E.Origin.Tell("Successfully reported " + E.Target.Name);
|
||||
|
||||
@ -599,7 +599,7 @@ namespace IW4MAdmin
|
||||
|
||||
public override void Execute(Event E)
|
||||
{
|
||||
E.Data = Utilities.removeWords(E.Data, 1);
|
||||
E.Data = SharedLibrary.Utilities.removeWords(E.Data, 1);
|
||||
E.Origin.currentServer.executeCommand(String.Format("admin_lastevent tell;{0};{1};{2}", E.Origin.npID, E.Target.npID, E.Data));
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,8 @@
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetZone>LocalIntranet</TargetZone>
|
||||
@ -71,12 +73,11 @@
|
||||
<ApplicationIcon>IW4MAdmin.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<StartupObject>IW4MAdmin.Program</StartupObject>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<PropertyGroup>
|
||||
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
|
||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>false</GenerateManifests>
|
||||
@ -91,11 +92,6 @@
|
||||
<HintPath>..\packages\Kayak.0.7.2\lib\Kayak.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Moserware.Skills, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>bin\Debug\Moserware.Skills.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="SharedLibary">
|
||||
<HintPath>..\SharedLibary\SharedLibary\bin\Debug\SharedLibary.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
@ -119,13 +115,13 @@
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="Manager.cs" />
|
||||
<Compile Include="Plugins.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Server.cs" />
|
||||
<Compile Include="TrueSkill.cs" />
|
||||
<Compile Include="Utilities.cs" />
|
||||
<Compile Include="WebFront.cs" />
|
||||
<Compile Include="IW4_GameStructs.cs" />
|
||||
@ -138,18 +134,15 @@
|
||||
<None Include="lib\Kayak.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="lib\Moserware.Skills.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="lib\SQLite.Interop.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="lib\System.Data.SQLite.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<Content Include="lib\SharedLibary.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="lib\SQLite.Interop.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="plugins\SamplePlugin.dll" />
|
||||
<Content Include="version.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
@ -184,7 +177,9 @@
|
||||
<Content Include="config\rules.cfg">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="app.config" />
|
||||
<None Include="app.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="m2demo\admin\commands.gsc">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
@ -303,13 +298,14 @@
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>cd "$(TargetDir)"
|
||||
del *.config
|
||||
del *.application
|
||||
del *.pdb
|
||||
del *.dll
|
||||
del app.config
|
||||
del *.manifest
|
||||
del *.rm
|
||||
del *.log</PostBuildEvent>
|
||||
del *.log
|
||||
xcopy /E /Y "$(ProjectDir)bin\Release" "$(SolutionDir)Release Build"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
60
Admin/Log.cs
60
Admin/Log.cs
@ -1,60 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace IW4MAdmin
|
||||
{
|
||||
class Log
|
||||
{
|
||||
public enum Level
|
||||
{
|
||||
All,
|
||||
Debug,
|
||||
Production,
|
||||
None,
|
||||
}
|
||||
|
||||
public Log(IFile logf, Level mode, int port)
|
||||
{
|
||||
logFile = logf;
|
||||
logMode = mode;
|
||||
Port = port;
|
||||
}
|
||||
|
||||
public void Write(String line)
|
||||
{
|
||||
Write(line, Level.Debug);
|
||||
}
|
||||
|
||||
public void Write(String line, Level lv)
|
||||
{
|
||||
String Line = String.Format("{1} - [{0}]: {2}", Port, getTime(), line);
|
||||
switch(logMode)
|
||||
{
|
||||
case Level.All:
|
||||
if (lv == Level.All || lv == Level.Debug || lv == Level.Production)
|
||||
Console.WriteLine(Line);
|
||||
break;
|
||||
case Level.Debug:
|
||||
if (lv == Level.All || lv == Level.Debug)
|
||||
Console.WriteLine(Line);
|
||||
break;
|
||||
case Level.Production:
|
||||
if (lv == Level.Production)
|
||||
Console.WriteLine(Line);
|
||||
break;
|
||||
}
|
||||
|
||||
logFile.Write(Line);
|
||||
}
|
||||
|
||||
private string getTime()
|
||||
{
|
||||
return DateTime.Now.ToString("HH:mm:ss");
|
||||
}
|
||||
|
||||
private IFile logFile;
|
||||
private Level logMode;
|
||||
private int Port;
|
||||
}
|
||||
}
|
@ -39,11 +39,11 @@ namespace IW4MAdmin
|
||||
|
||||
while(!serverManager.isReady())
|
||||
{
|
||||
Utilities.Wait(1);
|
||||
SharedLibrary.Utilities.Wait(1);
|
||||
}
|
||||
|
||||
if (serverManager.getServers() != null)
|
||||
Program.getManager().mainLog.Write("IW4M Now Initialized! Visit http://127.0.0.1:1624 for server overview.");
|
||||
Program.getManager().mainLog.Write("IW4M Now Initialized! Visit http://127.0.0.1:1624 for server overview.", Log.Level.Production);
|
||||
|
||||
if (serverManager.getServers().Count > 0)
|
||||
{
|
||||
@ -106,41 +106,5 @@ namespace IW4MAdmin
|
||||
{
|
||||
return serverManager;
|
||||
}
|
||||
|
||||
#if DEBUG2
|
||||
static List<Server> checkConfig()
|
||||
{
|
||||
|
||||
file Config = new file("config\\servers.cfg");
|
||||
String[] SV_CONF = Config.readAll();
|
||||
List<Server> Servers = new List<Server>();
|
||||
Config.Close();
|
||||
|
||||
if (SV_CONF == null || SV_CONF.Length < 1 || SV_CONF[0] == String.Empty)
|
||||
{
|
||||
setupConfig(); // get our first time server
|
||||
Config = new file("config\\servers.cfg", true);
|
||||
Config.Write(IP + ':' + Port + ':' + RCON);
|
||||
Config.Close();
|
||||
Servers.Add(new Server(IP, Port, RCON, 0));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
foreach (String L in SV_CONF)
|
||||
{
|
||||
String[] server_line = L.Split(':');
|
||||
int newPort;
|
||||
if (server_line.Length < 3 || !int.TryParse(server_line[1], out newPort))
|
||||
{
|
||||
Console.WriteLine("You have an error in your server.cfg");
|
||||
continue;
|
||||
}
|
||||
Servers.Add(new Server(server_line[0], newPort, server_line[2],0));
|
||||
}
|
||||
}
|
||||
return Servers;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -22,15 +22,15 @@ namespace IW4MAdmin
|
||||
{
|
||||
ThreadList = new SortedDictionary<int, Thread>();
|
||||
IFile logFile = new IFile("IW4MAdminManager.log", true);
|
||||
mainLog = new Log(logFile, Log.Level.All, 0);
|
||||
mainLog = new Log(logFile, Log.Level.Production, 0);
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
while (getCurrentIW4MProcesses().Count == 0)
|
||||
{
|
||||
mainLog.Write("No viable IW4M instances detected.", Log.Level.All);
|
||||
Utilities.Wait(10);
|
||||
mainLog.Write("No viable IW4M instances detected.", Log.Level.Production);
|
||||
SharedLibrary.Utilities.Wait(10);
|
||||
}
|
||||
|
||||
PluginImporter.Load();
|
||||
@ -69,7 +69,7 @@ namespace IW4MAdmin
|
||||
Defunct.Join();
|
||||
ThreadList[S.pID()] = null;
|
||||
}
|
||||
mainLog.Write("Server with PID #" + S.pID() + " no longer appears to be running.", Log.Level.All);
|
||||
mainLog.Write("Server with PID #" + S.pID() + " no longer appears to be running.", Log.Level.Debug);
|
||||
activePIDs.Remove(S.pID());
|
||||
defunctServers.Add(S);
|
||||
}
|
||||
@ -81,7 +81,7 @@ namespace IW4MAdmin
|
||||
defunctServers = null;
|
||||
|
||||
scanForNewServers();
|
||||
Utilities.Wait(5);
|
||||
SharedLibrary.Utilities.Wait(5);
|
||||
}
|
||||
|
||||
mainLog.Write("Manager shutting down...");
|
||||
@ -130,7 +130,7 @@ namespace IW4MAdmin
|
||||
Servers.Add(S);
|
||||
Thread IW4MServerThread = new Thread(S.Monitor);
|
||||
ThreadList.Add(pID, IW4MServerThread);
|
||||
mainLog.Write("New server detected on port " + S.getPort(), Log.Level.All);
|
||||
mainLog.Write("New server detected on port " + S.getPort(), Log.Level.Production);
|
||||
IW4MServerThread.Start();
|
||||
}
|
||||
}
|
||||
@ -209,14 +209,14 @@ namespace IW4MAdmin
|
||||
{
|
||||
int sv_runningPtr = Utilities.getIntFromPointer(0x1AD7934, (int)Handle) + 0x10; // where the dvar_t struct is stored + the offset for current value
|
||||
sv_running = Utilities.getBoolFromPointer(sv_runningPtr, (int)Handle);
|
||||
Utilities.Wait(1);
|
||||
SharedLibrary.Utilities.Wait(1);
|
||||
timeWaiting++;
|
||||
|
||||
if (timeWaiting > 30) // don't want to get stuck waiting forever if the server is frozen
|
||||
return null;
|
||||
}
|
||||
|
||||
Utilities.Wait(5);
|
||||
SharedLibrary.Utilities.Wait(2);
|
||||
|
||||
dvar net_ip = Utilities.getDvarOld(0x64A1DF8, (int)Handle);
|
||||
dvar net_port = Utilities.getDvarOld(0x64A3004, (int)Handle);
|
||||
|
@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace IW4MAdmin
|
||||
{
|
||||
class Map
|
||||
{
|
||||
public Map(String N, String A)
|
||||
{
|
||||
Name = N;
|
||||
Alias = A;
|
||||
}
|
||||
|
||||
public String Name;
|
||||
public String Alias;
|
||||
}
|
||||
}
|
294
Admin/Player.cs
294
Admin/Player.cs
@ -1,294 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace IW4MAdmin
|
||||
{
|
||||
class Stats
|
||||
{
|
||||
public Stats(int n, int K, int D, double kdr, double skill, double mean, double dev)
|
||||
{
|
||||
statIndex = n;
|
||||
Kills = K;
|
||||
Deaths = D;
|
||||
KDR = Math.Round(kdr,2);
|
||||
|
||||
Rating = new Moserware.Skills.Rating(mean, dev);
|
||||
Skill = Math.Round(Rating.ConservativeRating, 3)*10;
|
||||
|
||||
}
|
||||
|
||||
public void updateKDR()
|
||||
{
|
||||
int tempDeaths = Deaths; // cuz we don't want undefined!
|
||||
if (Deaths == 0)
|
||||
tempDeaths = 1;
|
||||
|
||||
KDR = Math.Round((double)((double)Kills / (double)tempDeaths), 2);
|
||||
}
|
||||
|
||||
public int Kills;
|
||||
public int Deaths;
|
||||
public double KDR;
|
||||
public double Skill;
|
||||
public int statIndex;
|
||||
public Moserware.Skills.Rating Rating;
|
||||
}
|
||||
|
||||
class Aliases
|
||||
{
|
||||
public Aliases(int Num, String N, String I)
|
||||
{
|
||||
Number = Num;
|
||||
Names = N;
|
||||
IPS = I;
|
||||
}
|
||||
|
||||
public List<String> getNames()
|
||||
{
|
||||
return new List<String>(Names.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));
|
||||
}
|
||||
|
||||
public List<String> getIPS()
|
||||
{
|
||||
return new List<String>(IPS.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));
|
||||
}
|
||||
|
||||
public String getIPSDB()
|
||||
{
|
||||
return IPS;
|
||||
}
|
||||
|
||||
public String getNamesDB()
|
||||
{
|
||||
return Names;
|
||||
}
|
||||
|
||||
public int getNumber()
|
||||
{
|
||||
return Number;
|
||||
}
|
||||
|
||||
public void addName(String Name)
|
||||
{
|
||||
if (Name.Trim() != String.Empty && Name != null)
|
||||
Names += ';' + Name;
|
||||
}
|
||||
|
||||
public void addIP(String IP)
|
||||
{
|
||||
if (IP.Trim() != String.Empty && IP != null)
|
||||
IPS += ';' + IP;
|
||||
}
|
||||
|
||||
private String Names;
|
||||
private String IPS;
|
||||
private int Number;
|
||||
}
|
||||
|
||||
class Player
|
||||
{
|
||||
public enum Permission
|
||||
{
|
||||
Banned = -1,
|
||||
User = 0,
|
||||
Flagged = 1,
|
||||
Moderator = 2,
|
||||
Administrator = 3,
|
||||
SeniorAdmin = 4,
|
||||
Owner = 5,
|
||||
Creator = 6,
|
||||
}
|
||||
|
||||
public Player(string n, string id, int num, int l)
|
||||
{
|
||||
Name = n;
|
||||
npID = id;
|
||||
Number = num;
|
||||
Level = (Player.Permission)l;
|
||||
LastOffense = String.Empty;
|
||||
Connections = 0;
|
||||
IP = "";
|
||||
Warnings = 0;
|
||||
Alias = new Aliases(0, "", "");
|
||||
stats = new Stats(0, 0, 0, 0, Moserware.Skills.GameInfo.DefaultGameInfo.DefaultRating.ConservativeRating, Moserware.Skills.GameInfo.DefaultGameInfo.DefaultRating.Mean, Moserware.Skills.GameInfo.DefaultGameInfo.DefaultRating.StandardDeviation);
|
||||
LastConnection = DateTime.Now;
|
||||
|
||||
}
|
||||
|
||||
public Player(string n, string id, int num, String I)
|
||||
{
|
||||
Name = n;
|
||||
npID = id;
|
||||
Number = num;
|
||||
IP = I;
|
||||
LastConnection = DateTime.Now;
|
||||
}
|
||||
|
||||
public Player(string n, string id, Player.Permission P, String I)
|
||||
{
|
||||
Name = n;
|
||||
npID = id;
|
||||
Level = P;
|
||||
IP = I;
|
||||
}
|
||||
|
||||
public Player(string n, string id, int num, Player.Permission l, int cind, String lo, int con, String IP2)
|
||||
{
|
||||
Name = n;
|
||||
npID = id;
|
||||
Number = num;
|
||||
Level = l;
|
||||
dbID = cind;
|
||||
if (lo == null)
|
||||
LastOffense = String.Empty;
|
||||
else
|
||||
LastOffense = lo;
|
||||
Connections = con;
|
||||
IP = IP2;
|
||||
Warnings = 0;
|
||||
Masked = false;
|
||||
LastConnection = DateTime.Now;
|
||||
}
|
||||
|
||||
public Player(string n, string id, int num, Player.Permission l, int cind, String lo, int con, String IP2, DateTime LC)
|
||||
{
|
||||
Name = n;
|
||||
npID = id;
|
||||
Number = num;
|
||||
Level = l;
|
||||
dbID = cind;
|
||||
if (lo == null)
|
||||
LastOffense = String.Empty;
|
||||
else
|
||||
LastOffense = lo;
|
||||
Connections = con;
|
||||
IP = IP2;
|
||||
Warnings = 0;
|
||||
Masked = false;
|
||||
LastConnection = LC;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
public String getID()
|
||||
{
|
||||
return npID;
|
||||
}
|
||||
|
||||
public int getDBID()
|
||||
{
|
||||
return dbID;
|
||||
}
|
||||
|
||||
public int getClientNum()
|
||||
{
|
||||
return Number;
|
||||
}
|
||||
|
||||
public Player.Permission getLevel()
|
||||
{
|
||||
return Level;
|
||||
}
|
||||
|
||||
public int getConnections()
|
||||
{
|
||||
return Connections;
|
||||
}
|
||||
|
||||
public String getLastO()
|
||||
{
|
||||
return LastOffense;
|
||||
}
|
||||
|
||||
public String getIP()
|
||||
{
|
||||
return IP;
|
||||
}
|
||||
|
||||
public String getLastConnection()
|
||||
{
|
||||
return Utilities.timePassed(LastConnection);
|
||||
}
|
||||
|
||||
public void updateName(String n)
|
||||
{
|
||||
if (n.Trim() != String.Empty)
|
||||
Name = n;
|
||||
}
|
||||
|
||||
public void updateIP(String I)
|
||||
{
|
||||
IP = I;
|
||||
}
|
||||
|
||||
// BECAUSE IT NEEDS TO BE CHANGED!
|
||||
public void setLevel(Player.Permission Perm)
|
||||
{
|
||||
Level = Perm;
|
||||
}
|
||||
|
||||
public void Tell(String Message)
|
||||
{
|
||||
lastEvent.Owner.Tell(Message, this);
|
||||
}
|
||||
|
||||
public void Warn(String Message)
|
||||
{
|
||||
lastEvent.Owner.Broadcast(Message);
|
||||
}
|
||||
|
||||
public void Kick(String Message)
|
||||
{
|
||||
lastEvent.Owner.Kick(Message, this);
|
||||
}
|
||||
|
||||
public void tempBan(String Message)
|
||||
{
|
||||
lastEvent.Owner.tempBan(Message, this);
|
||||
}
|
||||
|
||||
public void Ban(String Message, Player Sender)
|
||||
{
|
||||
lastEvent.Owner.Ban(Message, this, Sender);
|
||||
}
|
||||
|
||||
public void Alert()
|
||||
{
|
||||
lastEvent.Owner.Alert(this);
|
||||
}
|
||||
|
||||
//should be moved to utils
|
||||
public Player findPlayer(String Nme)
|
||||
{
|
||||
foreach (Player P in lastEvent.Owner.getPlayers())
|
||||
{
|
||||
if (P == null)
|
||||
continue;
|
||||
if (P.getName().ToLower().Contains(Name.ToLower()))
|
||||
return P;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string Name;
|
||||
private string npID;
|
||||
private int Number;
|
||||
private Player.Permission Level;
|
||||
private int dbID;
|
||||
public int Connections;
|
||||
private String IP;
|
||||
private DateTime LastConnection;
|
||||
|
||||
public Event lastEvent;
|
||||
public String LastOffense;
|
||||
public int Warnings;
|
||||
public Stats stats;
|
||||
public Aliases Alias;
|
||||
public bool Masked;
|
||||
}
|
||||
}
|
@ -21,13 +21,13 @@ namespace IW4MAdmin
|
||||
|
||||
else
|
||||
{
|
||||
Program.getManager().mainLog.Write("Plugin folder does not exist!", Log.Level.Debug);
|
||||
Program.getManager().mainLog.Write("Plugin folder does not exist!", Log.Level.All);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dllFileNames == null || dllFileNames.Length == 0)
|
||||
{
|
||||
Program.getManager().mainLog.Write("No plugins to load", Log.Level.Debug);
|
||||
Program.getManager().mainLog.Write("No plugins to load", Log.Level.All);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -51,10 +51,10 @@ namespace IW4MAdmin
|
||||
Object commandObject = Activator.CreateInstance(assemblyType);
|
||||
Command newCommand = (Command)commandObject;
|
||||
potentialPlugins.Add(newCommand);
|
||||
Program.getManager().mainLog.Write("Loaded command plugin \"" + newCommand.Name + "\"", Log.Level.Debug);
|
||||
Program.getManager().mainLog.Write("Loaded command plugin \"" + newCommand.Name + "\"", Log.Level.All);
|
||||
}
|
||||
else
|
||||
Program.getManager().mainLog.Write("Ignoring invalid command plugin \"" + assemblyType.Name + "\"", Log.Level.Debug);
|
||||
Program.getManager().mainLog.Write("Ignoring invalid command plugin \"" + assemblyType.Name + "\"", Log.Level.All);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,11 +7,11 @@ using System.Resources;
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("IW4M Admin")]
|
||||
[assembly: AssemblyDescription("Admin for IW4x projects")]
|
||||
[assembly: AssemblyDescription("Server admin for your IW4M Servers")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("RaidMax LLC")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("© 2015")]
|
||||
[assembly: AssemblyCopyright("2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@ -33,5 +33,5 @@ using System.Resources;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.8.1")]
|
||||
[assembly: AssemblyVersion("0.9.5")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
||||
|
156
Admin/RCON.cs
156
Admin/RCON.cs
@ -1,156 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
|
||||
//DILEMMA -- Seperate intance of RCON for each server or no?
|
||||
namespace IW4MAdmin
|
||||
{
|
||||
class RCON
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
Query,
|
||||
Execute,
|
||||
}
|
||||
|
||||
public RCON(Server I)
|
||||
{
|
||||
//sv_connection = new UdpClient();
|
||||
// sv_connection.Client.SendTimeout = 1000;
|
||||
//sv_connection.Client.ReceiveTimeout = 1000;
|
||||
Instance = I;
|
||||
toSend = new Queue<RCON_Request>();
|
||||
}
|
||||
|
||||
//We want to read the reponse
|
||||
public String[] responseSendRCON(String message)
|
||||
{
|
||||
return null;
|
||||
/* try
|
||||
{
|
||||
String STR_REQUEST = String.Empty;
|
||||
if (message != "getstatus")
|
||||
STR_REQUEST = String.Format("ÿÿÿÿrcon {0} {1}", Instance.getPassword(), message);
|
||||
else
|
||||
STR_REQUEST = String.Format("ÿÿÿÿ getstatus");
|
||||
|
||||
Byte[] Request_ = Encoding.Unicode.GetBytes(STR_REQUEST);
|
||||
Byte[] Request = new Byte[Request_.Length/2];
|
||||
|
||||
int count = 0; //This is kinda hacky but Unicode -> ASCII doesn't seem to be working correctly for this.
|
||||
foreach (Byte b in Request_)
|
||||
{
|
||||
if (b != 0)
|
||||
Request[count/2] = b;
|
||||
count++;
|
||||
}
|
||||
|
||||
|
||||
System.Net.IPAddress IP = System.Net.IPAddress.Parse(Instance.getIP());
|
||||
IPEndPoint endPoint = new IPEndPoint(IP, Instance.getPort());
|
||||
|
||||
sv_connection.Connect(endPoint);
|
||||
sv_connection.Send(Request, Request.Length);
|
||||
|
||||
String incoming = String.Empty;
|
||||
byte[] bufferRecv = new byte[65536];
|
||||
do
|
||||
{
|
||||
// loop on receiving the bytes
|
||||
bufferRecv = sv_connection.Receive(ref endPoint);
|
||||
|
||||
// only decode the bytes received
|
||||
incoming += (Encoding.ASCII.GetString(bufferRecv, 0, bufferRecv.Length));
|
||||
} while (sv_connection.Available > 0);
|
||||
|
||||
int num = int.Parse("0a", System.Globalization.NumberStyles.AllowHexSpecifier);
|
||||
|
||||
String[] response = incoming.Split(new char[] {(char)num} , StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(response[1] == "Invalid password.")
|
||||
{
|
||||
Instance.Log.Write("Invalid RCON password specified", Log.Level.Debug);
|
||||
return null;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
catch (SocketException)
|
||||
{
|
||||
Instance.Log.Write("Unable to reach server for sending RCON", Log.Level.Debug);
|
||||
return null;
|
||||
}
|
||||
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
Instance.Log.Write("RCON Connection terminated by server. Uh-OH", Log.Level.Debug);
|
||||
sv_connection.Close();
|
||||
sv_connection = new UdpClient();
|
||||
return null;
|
||||
}*/
|
||||
}
|
||||
|
||||
public String[] addRCON(String Message)
|
||||
{
|
||||
RCON_Request newReq = new RCON_Request(Message);
|
||||
toSend.Enqueue(newReq);
|
||||
return newReq.waitForResponse();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
sv_connection.Close();
|
||||
sv_connection = new UdpClient();
|
||||
}
|
||||
|
||||
public void ManageRCONQueue()
|
||||
{
|
||||
while (Instance.isRunning)
|
||||
{
|
||||
if (toSend.Count > 0)
|
||||
{
|
||||
RCON_Request Current = toSend.Peek();
|
||||
//Current.Response = responseSendRCON(Current.Request);
|
||||
Utilities.executeCommand(Instance.pID(), Current.Request, Instance.lastCommandPointer);
|
||||
toSend.Dequeue();
|
||||
//Utilities.Wait(0.567);
|
||||
Utilities.Wait(.3);
|
||||
}
|
||||
else
|
||||
Utilities.Wait(0.01);
|
||||
}
|
||||
}
|
||||
|
||||
private UdpClient sv_connection;
|
||||
private Server Instance;
|
||||
private Queue<RCON_Request> toSend;
|
||||
}
|
||||
|
||||
class RCON_Request
|
||||
{
|
||||
public RCON_Request(String IN)
|
||||
{
|
||||
Request = IN;
|
||||
Response = null;
|
||||
}
|
||||
|
||||
public String[] waitForResponse()
|
||||
{
|
||||
DateTime Start = DateTime.Now;
|
||||
DateTime Current = DateTime.Now;
|
||||
while (Response == null && (Current-Start).TotalMilliseconds < 1000)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
Current = DateTime.Now;
|
||||
}
|
||||
return Response;
|
||||
}
|
||||
|
||||
public String Request;
|
||||
public String[] Response;
|
||||
}
|
||||
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace IW4MAdmin
|
||||
{
|
||||
class Report
|
||||
{
|
||||
public Report(Player T, Player O, String R)
|
||||
{
|
||||
Target = T;
|
||||
Origin = O;
|
||||
Reason = R;
|
||||
}
|
||||
|
||||
public Player Target { get; private set; }
|
||||
public Player Origin { get; private set; }
|
||||
public String Reason { get; private set; }
|
||||
}
|
||||
}
|
@ -12,8 +12,6 @@ namespace IW4MAdmin
|
||||
{
|
||||
class IW4MServer : SharedLibrary.Server
|
||||
{
|
||||
const int FLOOD_TIMEOUT = 300;
|
||||
|
||||
public IW4MServer(string address, int port, string password, int H, int PID) : base(address, port, password, H, PID)
|
||||
{
|
||||
playerHistory = new Queue<pHistory>();
|
||||
@ -194,7 +192,7 @@ namespace IW4MAdmin
|
||||
players[NewPlayer.clientID] = NewPlayer;
|
||||
}
|
||||
#if DEBUG == FALSE
|
||||
NewPlayer.Tell("Welcome ^5" + NewPlayer.Name + " ^7this is your ^5" + Utilities.timesConnected(NewPlayer.Connections) + " ^7time connecting!");
|
||||
NewPlayer.Tell("Welcome ^5" + NewPlayer.Name + " ^7this is your ^5" + SharedLibrary.Utilities.timesConnected(NewPlayer.Connections) + " ^7time connecting!");
|
||||
#endif
|
||||
Log.Write("Client " + NewPlayer.Name + " connecting...", Log.Level.Debug); // they're clean
|
||||
|
||||
@ -326,18 +324,18 @@ namespace IW4MAdmin
|
||||
//Procses requested command correlating to an event
|
||||
override public Command processCommand(Event E, Command C)
|
||||
{
|
||||
E.Data = Utilities.removeWords(E.Data, 1);
|
||||
String[] Args = E.Data.Trim().Split(' ');
|
||||
|
||||
if (Args.Length < (C.requiredArgNum))
|
||||
E.Data = SharedLibrary.Utilities.removeWords(E.Data, 1);
|
||||
String[] Args = E.Data.Trim().Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (E.Origin.Level < C.Permission)
|
||||
{
|
||||
E.Origin.Tell("Not enough arguments supplied!");
|
||||
E.Origin.Tell("You do not have access to that command!");
|
||||
return null;
|
||||
}
|
||||
|
||||
if(E.Origin.Level < C.Permission)
|
||||
if (Args.Length < (C.requiredArgNum))
|
||||
{
|
||||
E.Origin.Tell("You do not have access to that command!");
|
||||
E.Origin.Tell("Not enough arguments supplied!");
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -407,6 +405,18 @@ namespace IW4MAdmin
|
||||
[DllImport("kernel32.dll")]
|
||||
public static extern bool ReadProcessMemory(int hProcess, int lpBaseAddress, byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesRead);
|
||||
|
||||
private void manageEventQueue()
|
||||
{
|
||||
while(isRunning)
|
||||
{
|
||||
if (events.Count > 0)
|
||||
processEvent(events.Dequeue());
|
||||
if (commandQueue.Count > 0)
|
||||
lastCommandPointer = Utilities.executeCommand(PID, commandQueue.Dequeue(), lastCommandPointer);
|
||||
Thread.Sleep(350);
|
||||
}
|
||||
}
|
||||
|
||||
//Starts the monitoring process
|
||||
override public void Monitor()
|
||||
{
|
||||
@ -419,6 +429,10 @@ namespace IW4MAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Thread eventQueueThread = new Thread(new ThreadStart(manageEventQueue));
|
||||
eventQueueThread.Name = "Event Queue Manager";
|
||||
eventQueueThread.Start();
|
||||
|
||||
long l_size = -1;
|
||||
bool checkedForOutdate = false;
|
||||
String[] lines = new String[8];
|
||||
@ -451,7 +465,7 @@ namespace IW4MAdmin
|
||||
if(lastMessage.TotalSeconds > messageTime && messages.Count > 0)
|
||||
{
|
||||
initMacros(); // somethings dynamically change so we have to re-init the dictionary
|
||||
Broadcast(Utilities.processMacro(Macros, messages[nextMessage]));
|
||||
Broadcast(SharedLibrary.Utilities.processMacro(Macros, messages[nextMessage]));
|
||||
if (nextMessage == (messages.Count - 1))
|
||||
nextMessage = 0;
|
||||
else
|
||||
@ -490,7 +504,7 @@ namespace IW4MAdmin
|
||||
|
||||
else if (eachClient.state == 5 )
|
||||
{
|
||||
addPlayer(new Player(Utilities.stripColors(Utilities.cleanChars(eachClient.name)), eachClient.steamid.ToString("x16"), i, 0, i, null, 0, Helpers.NET_AdrToString(eachClient.adr).Split(':')[0]));
|
||||
addPlayer(new Player(SharedLibrary.Utilities.stripColors(SharedLibrary.Utilities.cleanChars(eachClient.name)), eachClient.steamid.ToString("x16"), i, 0, i, null, 0, Helpers.NET_AdrToString(eachClient.adr).Split(':')[0]));
|
||||
activeClients++;
|
||||
}
|
||||
}
|
||||
@ -533,7 +547,7 @@ namespace IW4MAdmin
|
||||
|
||||
event_.Origin.lastEvent = event_;
|
||||
event_.Origin.lastEvent.Owner = this;
|
||||
processEvent(event_);
|
||||
events.Enqueue(event_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -542,20 +556,19 @@ namespace IW4MAdmin
|
||||
}
|
||||
oldLines = lines;
|
||||
l_size = logFile.getSize();
|
||||
if (commandQueue.Count > 0)
|
||||
lastCommandPointer = Utilities.executeCommand(PID, commandQueue.Dequeue(), lastCommandPointer);
|
||||
Thread.Sleep(150);
|
||||
Thread.Sleep(350);
|
||||
}
|
||||
#if DEBUG == false
|
||||
catch (Exception E)
|
||||
{
|
||||
Log.Write("Something unexpected occured. Hopefully we can ignore it - " + E.Message + " @" + Utilities.GetLineNumber(E), Log.Level.All);
|
||||
Log.Write("Something unexpected occured. Hopefully we can ignore it :)", Log.Level.All);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
isRunning = false;
|
||||
eventQueueThread.Join();
|
||||
}
|
||||
|
||||
override public bool intializeBasics()
|
||||
@ -570,7 +583,7 @@ namespace IW4MAdmin
|
||||
}
|
||||
|
||||
// basic info dvars
|
||||
hostname = Utilities.stripColors(getDvar("sv_hostname").current);
|
||||
hostname = SharedLibrary.Utilities.stripColors(getDvar("sv_hostname").current);
|
||||
mapname = getDvar("mapname").current;
|
||||
IW_Ver = getDvar("shortversion").current;
|
||||
maxClients = -1;
|
||||
@ -721,7 +734,7 @@ namespace IW4MAdmin
|
||||
|
||||
if (E.Data.Substring(0, 1) != "!") // Not a command so who gives an F?
|
||||
{
|
||||
E.Data = Utilities.stripColors(Utilities.cleanChars(E.Data));
|
||||
E.Data = SharedLibrary.Utilities.stripColors(SharedLibrary.Utilities.cleanChars(E.Data));
|
||||
if (E.Data.Length > 50)
|
||||
E.Data = E.Data.Substring(0, 50) + "...";
|
||||
while (chatHistory.Count > Math.Ceiling((double)clientnum/2))
|
||||
|
@ -1,39 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Moserware.Skills.TrueSkill;
|
||||
using IW4MAdmin;
|
||||
using SharedLibrary;
|
||||
|
||||
|
||||
namespace Moserware
|
||||
{
|
||||
class TrueSkill
|
||||
{
|
||||
public TrueSkill()
|
||||
{
|
||||
calculator = new TwoPlayerTrueSkillCalculator();
|
||||
gInfo = Skills.GameInfo.DefaultGameInfo;
|
||||
}
|
||||
|
||||
public void updateNewSkill(Player P1, Player P2)
|
||||
{
|
||||
/* var player1 = new Skills.Player(P1.databaseID);
|
||||
var player2 = new Skills.Player(P2.databaseID);
|
||||
|
||||
var team1 = new Skills.Team(player1, P1.stats.Rating);
|
||||
var team2 = new Skills.Team(player2, P2.stats.Rating);
|
||||
|
||||
var newRatings = calculator.CalculateNewRatings(gInfo, Skills.Teams.Concat(team1, team2), 1, 2);
|
||||
|
||||
P1.stats.Rating = newRatings[player1];
|
||||
P2.stats.Rating = newRatings[player2];
|
||||
|
||||
P1.stats.Skill = Math.Round(P1.stats.Rating.ConservativeRating, 3)*10;
|
||||
P2.stats.Skill = Math.Round(P2.stats.Rating.ConservativeRating, 3)*10;*/
|
||||
}
|
||||
|
||||
private Skills.SkillCalculator calculator;
|
||||
public Skills.GameInfo gInfo;
|
||||
}
|
||||
}
|
@ -11,314 +11,6 @@ namespace IW4MAdmin
|
||||
{
|
||||
class Utilities
|
||||
{
|
||||
//Get string with specified number of spaces -- really only for visual output
|
||||
public static String getSpaces(int Num)
|
||||
{
|
||||
String SpaceString = String.Empty;
|
||||
while (Num > 0)
|
||||
{
|
||||
SpaceString += ' ';
|
||||
Num--;
|
||||
}
|
||||
|
||||
return SpaceString;
|
||||
}
|
||||
|
||||
//Sleep for x amount of seconds
|
||||
public static void Wait(double time)
|
||||
{
|
||||
Thread.Sleep((int)Math.Ceiling(time*1000));
|
||||
}
|
||||
|
||||
//Remove words from a space delimited string
|
||||
public static String removeWords(String str, int num)
|
||||
{
|
||||
String newStr = String.Empty;
|
||||
String[] tmp = str.Split(' ');
|
||||
|
||||
for (int i = 0; i < tmp.Length; i++)
|
||||
{
|
||||
if (i >= num)
|
||||
newStr += tmp[i] + ' ';
|
||||
}
|
||||
|
||||
return newStr;
|
||||
}
|
||||
|
||||
public static Player.Permission matchPermission(String str)
|
||||
{
|
||||
String lookingFor = str.ToLower();
|
||||
|
||||
for (Player.Permission Perm = Player.Permission.User; Perm < Player.Permission.Owner; Perm++)
|
||||
{
|
||||
if (lookingFor.Contains(Perm.ToString().ToLower()))
|
||||
return Perm;
|
||||
}
|
||||
|
||||
return Player.Permission.Banned;
|
||||
}
|
||||
|
||||
public static String removeNastyChars(String str)
|
||||
{
|
||||
if (str != null)
|
||||
return str.Replace("`", "").Replace("\\", "").Replace("\"", "").Replace(""", "''").Replace("&", "&").Replace("\"", "''");
|
||||
else
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
public static int GetLineNumber(Exception ex)
|
||||
{
|
||||
var lineNumber = 0;
|
||||
const string lineSearch = ":line ";
|
||||
var index = ex.StackTrace.LastIndexOf(lineSearch);
|
||||
if (index != -1)
|
||||
{
|
||||
var lineNumberText = ex.StackTrace.Substring(index + lineSearch.Length);
|
||||
if (int.TryParse(lineNumberText, out lineNumber))
|
||||
{
|
||||
}
|
||||
}
|
||||
return lineNumber;
|
||||
}
|
||||
|
||||
public static String cleanChars(String S)
|
||||
{
|
||||
StringBuilder Cleaned = new StringBuilder();
|
||||
|
||||
foreach (char c in S)
|
||||
if (c < 127 && c > 31 && c != 37 && c != 34 && c != 92) Cleaned.Append(c);
|
||||
return Cleaned.ToString();
|
||||
}
|
||||
|
||||
public static String stripColors(String str)
|
||||
{
|
||||
if (str == null)
|
||||
return "";
|
||||
return Regex.Replace(str, @"\^[0-9]", "");
|
||||
}
|
||||
|
||||
public static String levelToColor(Player.Permission level)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
case Player.Permission.Banned:
|
||||
return "^1" + Player.Permission.Banned;
|
||||
case Player.Permission.Flagged:
|
||||
return "^0" + Player.Permission.Flagged;
|
||||
case Player.Permission.Owner:
|
||||
return "^5" + Player.Permission.Owner;
|
||||
case Player.Permission.User:
|
||||
return "^2" + Player.Permission.User;
|
||||
default:
|
||||
return "^3" + level;
|
||||
}
|
||||
}
|
||||
|
||||
public static String processMacro(Dictionary<String, Object> Dict, String str)
|
||||
{
|
||||
MatchCollection Found = Regex.Matches(str, @"\{\{[A-Z]+\}\}", RegexOptions.IgnoreCase);
|
||||
foreach (Match M in Found)
|
||||
{
|
||||
String Match = M.Value;
|
||||
String Identifier = M.Value.Substring(2, M.Length - 4);
|
||||
String Replacement = Dict[Identifier].ToString();
|
||||
str = str.Replace(Match, Replacement);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
public static Dictionary<String, String> IPFromStatus(String[] players)
|
||||
{
|
||||
Dictionary<String, String> Dict = new Dictionary<String, String>();
|
||||
|
||||
if (players == null)
|
||||
return null;
|
||||
|
||||
foreach (String S in players)
|
||||
{
|
||||
String S2 = S.Trim();
|
||||
if (S.Length < 50)
|
||||
continue;
|
||||
if (Regex.Matches(S2, @"\d+$", RegexOptions.IgnoreCase).Count > 0)
|
||||
{
|
||||
String[] eachPlayer = S2.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
for (int i = 3; i < eachPlayer.Length; i++ )
|
||||
{
|
||||
if (eachPlayer[i].Split(':').Length > 1)
|
||||
{
|
||||
Dict.Add(eachPlayer[3], eachPlayer[i].Split(':')[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return Dict;
|
||||
|
||||
}
|
||||
|
||||
public static String nameHTMLFormatted(Player P)
|
||||
{
|
||||
switch (P.Level)
|
||||
{
|
||||
case Player.Permission.User:
|
||||
return "<span style='color:rgb(87, 150, 66)'>" + P.Name+ "</span>";
|
||||
case Player.Permission.Moderator:
|
||||
return "<span style='color:#e7b402'>" + P.Name+ "</span>";
|
||||
case Player.Permission.Administrator:
|
||||
return "<span style='color:#ec82de'>" + P.Name+ "</span>";
|
||||
case Player.Permission.SeniorAdmin:
|
||||
return "<span style='color:#2eb6bf'>" + P.Name+ "</span>";
|
||||
case Player.Permission.Owner:
|
||||
return "<span style='color:rgb(38,120,230)'>" + P.Name+ "</span>";
|
||||
case Player.Permission.Creator:
|
||||
return "<span style='color:rgb(38,120,230)'>" + P.Name+ "</span>";
|
||||
case Player.Permission.Banned:
|
||||
return "<span style='color:rgb(196, 22, 28)'>" + P.Name+ "</span>";
|
||||
case Player.Permission.Flagged:
|
||||
return "<span style='color:rgb(251, 124, 98)'>" + P.Name+ "</span>";
|
||||
default:
|
||||
return "<i>" + P.Name+ "</i>";
|
||||
}
|
||||
}
|
||||
|
||||
public static String nameHTMLFormatted(Player.Permission Level)
|
||||
{
|
||||
switch (Level)
|
||||
{
|
||||
case Player.Permission.User:
|
||||
return "<span style='color:rgb(87, 150, 66)'>" + Level + "</span>";
|
||||
case Player.Permission.Moderator:
|
||||
return "<span style='color:#e7b402'>" + Level + "</span>";
|
||||
case Player.Permission.Administrator:
|
||||
return "<span style='color:#ec82de'>" + Level + "</span>";
|
||||
case Player.Permission.SeniorAdmin:
|
||||
return "<span style='color:#2eb6bf'>" + Level + "</span>";
|
||||
case Player.Permission.Owner:
|
||||
return "<span style='color:rgb(38,120,230)'>" + Level + "</span>";
|
||||
case Player.Permission.Creator:
|
||||
return "<span style='color:rgb(38,120,230)'>" + Level + "</span>";
|
||||
case Player.Permission.Banned:
|
||||
return "<span style='color:rgb(196, 22, 28)'>" + Level + "</span>";
|
||||
case Player.Permission.Flagged:
|
||||
return "<span style='color:rgb(251, 124, 98)'>" + Level + "</span>";
|
||||
default:
|
||||
return "<i>" + Level + "</i>";
|
||||
}
|
||||
}
|
||||
|
||||
public static String gametypeLocalized(String input)
|
||||
{
|
||||
switch (input)
|
||||
{
|
||||
case "dm":
|
||||
return "Deathmatch";
|
||||
case "war":
|
||||
return "Team Deathmatch";
|
||||
case "koth":
|
||||
return "Headquarters";
|
||||
case "ctf":
|
||||
return "Capture The Flag";
|
||||
case "dd":
|
||||
return "Demolition";
|
||||
case "dom":
|
||||
return "Domination";
|
||||
case "sab":
|
||||
return "Sabotage";
|
||||
case "sd":
|
||||
return "Search & Destroy";
|
||||
case "vip":
|
||||
return "Very Important Person";
|
||||
case "gtnw":
|
||||
return "Global Thermonuclear War";
|
||||
case "oitc":
|
||||
return "One In The Chamber";
|
||||
case "arena":
|
||||
return "Arena";
|
||||
case "dzone":
|
||||
return "Drop Zone";
|
||||
case "gg":
|
||||
return "Gun Game";
|
||||
case "snipe":
|
||||
return "Sniping";
|
||||
case "ss":
|
||||
return "Sharp Shooter";
|
||||
case "m40a3":
|
||||
return "M40A3";
|
||||
case "fo":
|
||||
return "Face Off";
|
||||
case "dmc":
|
||||
return "Deathmatch Classic";
|
||||
case "killcon":
|
||||
return "Kill Confirmed";
|
||||
case "oneflag":
|
||||
return "One Flag CTF";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
public static Dictionary<String, Player> playersFromStatus(String[] Status)
|
||||
{
|
||||
Dictionary<String, Player> playerDictionary = new Dictionary<String, Player>();
|
||||
|
||||
if (Status == null) // looks like we didn't get a proper response
|
||||
return null;
|
||||
|
||||
foreach (String S in Status)
|
||||
{
|
||||
String responseLine = S.Trim();
|
||||
|
||||
if (Regex.Matches(responseLine, @"\d+$", RegexOptions.IgnoreCase).Count > 0 && responseLine.Length > 92) // its a client line!
|
||||
{
|
||||
String[] playerInfo = responseLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
int cID = -1;
|
||||
String cName = stripColors(responseLine.Substring(46, 18)).Trim();
|
||||
String npID = responseLine.Substring(29, 17).Trim(); // DONT TOUCH PLZ
|
||||
int.TryParse(playerInfo[0], out cID);
|
||||
String cIP = responseLine.Substring(72,20).Trim().Split(':')[0];
|
||||
|
||||
Player P = new Player(cName, npID, cID, cIP);
|
||||
|
||||
try
|
||||
{
|
||||
playerDictionary.Add(npID, P);
|
||||
}
|
||||
|
||||
catch(Exception E)
|
||||
{
|
||||
/// need to handle eventually
|
||||
Program.getManager().mainLog.Write("Error handling player add -- " + E.Message);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
return playerDictionary;
|
||||
|
||||
}
|
||||
|
||||
public static String DateTimeSQLite(DateTime datetime)
|
||||
{
|
||||
string dateTimeFormat = "{0}-{1}-{2} {3}:{4}:{5}.{6}";
|
||||
return string.Format(dateTimeFormat, datetime.Year, datetime.Month, datetime.Day, datetime.Hour, datetime.Minute, datetime.Second, datetime.Millisecond);
|
||||
}
|
||||
|
||||
public static String timePassed(DateTime start)
|
||||
{
|
||||
TimeSpan Elapsed = DateTime.Now - start;
|
||||
|
||||
if (Elapsed.TotalMinutes < 120)
|
||||
return Math.Round(Elapsed.TotalMinutes, 0) + " minutes";
|
||||
if (Elapsed.TotalHours <= 24)
|
||||
return Math.Round(Elapsed.TotalHours, 0) + " hours";
|
||||
if (Elapsed.TotalDays <= 365)
|
||||
return Math.Round(Elapsed.TotalDays, 0) + " days";
|
||||
else
|
||||
return "a very long time";
|
||||
}
|
||||
|
||||
const int PROCESS_CREATE_THREAD = 0x0002;
|
||||
const int PROCESS_QUERY_INFORMATION = 0x0400;
|
||||
const int PROCESS_VM_OPERATION = 0x0008;
|
||||
@ -400,7 +92,7 @@ namespace IW4MAdmin
|
||||
[DllImport("kernel32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
|
||||
static extern IntPtr GetProcAddress(IntPtr hModule, string lpProcName);
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
|
||||
static extern IntPtr GetModuleHandle(string lpModuleName);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
@ -422,7 +114,7 @@ namespace IW4MAdmin
|
||||
[Out] out IntPtr Thread,
|
||||
[Out] out ClientId ClientId
|
||||
);
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct ClientId
|
||||
{
|
||||
@ -431,10 +123,10 @@ namespace IW4MAdmin
|
||||
this.UniqueProcess = new IntPtr(processId);
|
||||
this.UniqueThread = new IntPtr(threadId);
|
||||
}
|
||||
|
||||
|
||||
public IntPtr UniqueProcess;
|
||||
public IntPtr UniqueThread;
|
||||
|
||||
|
||||
public int ProcessId { get { return this.UniqueProcess.ToInt32(); } }
|
||||
public int ThreadId { get { return this.UniqueThread.ToInt32(); } }
|
||||
}
|
||||
@ -514,7 +206,7 @@ namespace IW4MAdmin
|
||||
ReadProcessMemory(Handle, Location, Buff, Buff.Length, ref numberRead);
|
||||
|
||||
StringBuilder str = new StringBuilder();
|
||||
for ( int i = 0; i < Buff.Length; i++)
|
||||
for (int i = 0; i < Buff.Length; i++)
|
||||
{
|
||||
if (Buff[i] == 0)
|
||||
break;
|
||||
@ -596,7 +288,7 @@ namespace IW4MAdmin
|
||||
}
|
||||
}
|
||||
|
||||
IntPtr memoryForDvarName = allocateAndWrite(Encoding.ASCII.GetBytes(Command + "\0"), ProcessHandle); // this gets disposed next call
|
||||
IntPtr memoryForDvarName = allocateAndWrite(Encoding.ASCII.GetBytes(Command + "\0"), ProcessHandle); // this gets disposed next call
|
||||
|
||||
if (memoryForDvarName == IntPtr.Zero)
|
||||
{
|
||||
@ -604,7 +296,7 @@ namespace IW4MAdmin
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
setDvarCurrentPtr(0x2098D9C, memoryForDvarName, ProcessHandle);
|
||||
setDvarCurrentPtr(0x2098D9C, memoryForDvarName, ProcessHandle);
|
||||
CloseHandle(ProcessHandle);
|
||||
|
||||
return memoryForDvarName;
|
||||
@ -707,8 +399,8 @@ namespace IW4MAdmin
|
||||
{
|
||||
if (Pointer != IntPtr.Zero)
|
||||
{
|
||||
// if (!VirtualFreeEx(ProcessHandle, Pointer, 0, AllocationType.Release))
|
||||
// Program.getManager().mainLog.Write("Virtual Free Failed During Exit Cleanup -- Error #" + Marshal.GetLastWin32Error());
|
||||
// if (!VirtualFreeEx(ProcessHandle, Pointer, 0, AllocationType.Release))
|
||||
// Program.getManager().mainLog.Write("Virtual Free Failed During Exit Cleanup -- Error #" + Marshal.GetLastWin32Error());
|
||||
}
|
||||
}
|
||||
|
||||
@ -717,7 +409,7 @@ namespace IW4MAdmin
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
public static Boolean initalizeInterface(int pID)
|
||||
{
|
||||
@ -731,7 +423,7 @@ namespace IW4MAdmin
|
||||
|
||||
UIntPtr bytesWritten;
|
||||
IntPtr threadID;
|
||||
|
||||
|
||||
IntPtr ProcessHandle = OpenProcess(ProcessAccessFlags.All, false, pID);
|
||||
#if DEBUG
|
||||
Program.getManager().mainLog.Write("Process handle is: " + ProcessHandle);
|
||||
@ -772,7 +464,7 @@ namespace IW4MAdmin
|
||||
Program.getManager().mainLog.Write("Could not write process memory");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
ClientId clientid = new ClientId();
|
||||
threadID = new IntPtr();
|
||||
RtlCreateUserThread(ProcessHandle, IntPtr.Zero, false, 0, (uint)0, IntPtr.Zero, lpLLAddress, pathAllocation, out threadID, out clientid);
|
||||
@ -785,7 +477,7 @@ namespace IW4MAdmin
|
||||
#if DEBUG
|
||||
//Program.getManager().mainLog.Write("Thread Status is " + threadStatus);
|
||||
Program.getManager().mainLog.Write("Thread ID is " + threadID);
|
||||
#endif
|
||||
#endif
|
||||
uint responseCode = WaitForSingleObject(threadID, 5000);
|
||||
|
||||
if (responseCode != 0x00000000L)
|
||||
@ -804,8 +496,8 @@ namespace IW4MAdmin
|
||||
|
||||
public static dvar getDvar(int pID, String DVAR, IntPtr lastMemoryLocation)
|
||||
{
|
||||
dvar requestedDvar = new dvar();
|
||||
IntPtr ProcessHandle = OpenProcess(ProcessAccessFlags.All, false, pID);
|
||||
dvar requestedDvar = new dvar();
|
||||
IntPtr ProcessHandle = OpenProcess(ProcessAccessFlags.All, false, pID);
|
||||
|
||||
if (lastMemoryLocation != IntPtr.Zero)
|
||||
{
|
||||
@ -813,7 +505,7 @@ namespace IW4MAdmin
|
||||
Program.getManager().mainLog.Write("Virtual free failed during cleanup-- Error #" + Marshal.GetLastWin32Error(), Log.Level.Debug);
|
||||
}
|
||||
|
||||
IntPtr memoryForDvarName = allocateAndWrite(Encoding.ASCII.GetBytes(DVAR + "\0"), ProcessHandle);
|
||||
IntPtr memoryForDvarName = allocateAndWrite(Encoding.ASCII.GetBytes(DVAR + "\0"), ProcessHandle);
|
||||
|
||||
if (memoryForDvarName == IntPtr.Zero)
|
||||
{
|
||||
@ -865,46 +557,5 @@ namespace IW4MAdmin
|
||||
|
||||
return requestedDvar;
|
||||
}
|
||||
|
||||
public static String timesConnected(int connection)
|
||||
{
|
||||
String Prefix = String.Empty;
|
||||
if (connection % 10 > 3 || connection % 10 == 0 || (connection % 100 > 9 && connection % 100 < 19))
|
||||
Prefix = "th";
|
||||
else
|
||||
{
|
||||
switch (connection % 10)
|
||||
{
|
||||
case 1:
|
||||
Prefix = "st";
|
||||
break;
|
||||
case 2:
|
||||
Prefix = "nd";
|
||||
break;
|
||||
case 3:
|
||||
Prefix = "rd";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (connection)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
return "first";
|
||||
case 2:
|
||||
return "second";
|
||||
case 3:
|
||||
return "third";
|
||||
case 4:
|
||||
return "fourth";
|
||||
case 5:
|
||||
return "fifth";
|
||||
case 100:
|
||||
return "One-Hundreth (amazing!)";
|
||||
default:
|
||||
return connection.ToString() + Prefix;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ namespace IW4MAdmin_Web
|
||||
}
|
||||
}
|
||||
|
||||
players.AppendFormat("<td><a href='/{0}/{1}/userip/?player'>{2}</a></td>", i, P.databaseID, Utilities.nameHTMLFormatted(P));
|
||||
players.AppendFormat("<td><a href='/{0}/{1}/userip/?player'>{2}</a></td>", i, P.databaseID, SharedLibrary.Utilities.nameHTMLFormatted(P));
|
||||
|
||||
if (count % 2 != 0)
|
||||
{
|
||||
@ -153,7 +153,7 @@ namespace IW4MAdmin_Web
|
||||
<table cellpadding='0' cellspacing='0' class='players'>
|
||||
{5}
|
||||
</table>",
|
||||
Servers[i].getName(), Servers[i].getMap(), Servers[i].getClientNum() + "/" + Servers[i].getMaxClients(), Utilities.gametypeLocalized(Servers[i].getGametype()), i, players.ToString());
|
||||
Servers[i].getName(), Servers[i].getMap(), Servers[i].getClientNum() + "/" + Servers[i].getMaxClients(), SharedLibrary.Utilities.gametypeLocalized(Servers[i].getGametype()), i, players.ToString());
|
||||
buffer.AppendFormat("<div class='chatHistory' id='chatHistory_{0}'></div><script type='text/javascript'>$( document ).ready(function() {{ setInterval({1}loadChatMessages({0}, '#chatHistory_{0}'){1}, 2500); }});</script><div class='null' style='clear:both;'></div>", i, '\"');
|
||||
if (Servers[i].getClientNum() > 0)
|
||||
buffer.AppendFormat("<form class='chatOutFormat' action={1}javascript:chatRequest({0}, 'chatEntry_{0}'){1}><input class='chatFormat_text' type='text' placeholder='Enter a message...' id='chatEntry_{0}'/><input class='chatFormat_submit' type='submit'/></form>", i, '\"');
|
||||
@ -187,7 +187,7 @@ namespace IW4MAdmin_Web
|
||||
buffer.Append("<h1 style=margin-top: 0;>{{TIME}}</h1><hr /><tr><th>Name</th><th style=text-align:left;>Offense</th><th style=text-align:left;>Banned By</th><th style='width: 175px; text-align:right;padding-right: 80px;'>Time</th></tr>");
|
||||
|
||||
if (Bans[0] != null)
|
||||
buffer = buffer.Replace("{{TIME}}", "From " + Utilities.timePassed(Bans[0].When) + " ago" + " — " + totalBans + " total");
|
||||
buffer = buffer.Replace("{{TIME}}", "From " + SharedLibrary.Utilities.timePassed(Bans[0].When) + " ago" + " — " + totalBans + " total");
|
||||
|
||||
for (int i = 0; i < Bans.Count; i++)
|
||||
{
|
||||
@ -216,7 +216,7 @@ namespace IW4MAdmin_Web
|
||||
else
|
||||
Prefix = "class=row-white";
|
||||
String Link = "/" + server + "/" + P.databaseID + "/userip/?player";
|
||||
buffer.AppendFormat("<tr {4}><td><a href='{5}'>{0}</a></th><td style='border-left: 3px solid #bbb; text-align:left;'>{1}</td><td style='border-left: 3px solid #bbb;text-align:left;'>{2}</td><td style='width: 175px; text-align:right;'>{3}</td></tr></div>", P.Name, P.lastOffense, Utilities.nameHTMLFormatted(B), Bans[i].getWhen(), Prefix, Link);
|
||||
buffer.AppendFormat("<tr {4}><td><a href='{5}'>{0}</a></th><td style='border-left: 3px solid #bbb; text-align:left;'>{1}</td><td style='border-left: 3px solid #bbb;text-align:left;'>{2}</td><td style='width: 175px; text-align:right;'>{3}</td></tr></div>", P.Name, P.lastOffense, SharedLibrary.Utilities.nameHTMLFormatted(B), Bans[i].getWhen(), Prefix, Link);
|
||||
cycleFix++;
|
||||
}
|
||||
}
|
||||
@ -364,7 +364,7 @@ namespace IW4MAdmin_Web
|
||||
if (logged)
|
||||
Screenshot = String.Format("<a href='http://server.nbsclan.org/screen.php?id={0}&name={1}'><div style='background-image:url(http://server.nbsclan.org/shutter.png); width: 20px; height: 20px;float: right; position:relative; right: 21%; background-size: contain;'></div></a>", forumID, Player.Name);
|
||||
|
||||
buffer.AppendFormat("<td><a style='float: left;' href='{9}'>{0}</a>{10}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6} ago</td><td><a href='https://repziw4.de/memberlist.php?mode=viewprofile&u={7}'>{8}</a></td>", Player.Name, str, IPs, Rating, Utilities.nameHTMLFormatted(Player.Level), Player.Connections, Player.getLastConnection(), forumID, Player.Name, "/0/" + Player.databaseID + "/userip/?player", Screenshot);
|
||||
buffer.AppendFormat("<td><a style='float: left;' href='{9}'>{0}</a>{10}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6} ago</td><td><a href='https://repziw4.de/memberlist.php?mode=viewprofile&u={7}'>{8}</a></td>", Player.Name, str, IPs, Rating, SharedLibrary.Utilities.nameHTMLFormatted(Player), Player.Connections, Player.getLastConnection(), forumID, Player.Name, "/0/" + Player.databaseID + "/userip/?player", Screenshot);
|
||||
buffer.Append("</tr>");
|
||||
}
|
||||
|
||||
@ -547,7 +547,7 @@ namespace IW4MAdmin_Web
|
||||
if (req.Length > 3)
|
||||
{
|
||||
IP = req[2];
|
||||
Text = Utilities.cleanChars(HttpUtility.UrlDecode(req[3]));
|
||||
Text = SharedLibrary.Utilities.cleanChars(HttpUtility.UrlDecode(req[3]));
|
||||
}
|
||||
|
||||
else
|
||||
@ -560,7 +560,7 @@ namespace IW4MAdmin_Web
|
||||
{
|
||||
chatMessages.Append("<table id='table_chatHistory'>");
|
||||
foreach (Chat Message in Program.getServers()[server].chatHistory)
|
||||
chatMessages.AppendFormat("<tr><td class='chat_name' style='text-align: left;'>{0}</td><td class='chat_message'>{1}</td><td class='chat_time' style='text-align: right;'>{2}</td></tr>", Utilities.nameHTMLFormatted(Message.Origin), Message.Message, Message.timeString());
|
||||
chatMessages.AppendFormat("<tr><td class='chat_name' style='text-align: left;'>{0}</td><td class='chat_message'>{1}</td><td class='chat_time' style='text-align: right;'>{2}</td></tr>", SharedLibrary.Utilities.nameHTMLFormatted(Message.Origin), Message.Message, Message.timeString());
|
||||
chatMessages.Append("</table>");
|
||||
body = chatMessages.ToString();
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1,4 +1,8 @@
|
||||
VERSION 0.9.2
|
||||
VERSION 0.9.5
|
||||
-Major refactoring to support plugins
|
||||
-*web front redux*
|
||||
|
||||
VERSION 0.9.2
|
||||
CHANGELOG:
|
||||
-fixed issues with crashing IW4 Servers
|
||||
|
||||
|
@ -4,10 +4,16 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
VisualStudioVersion = 12.0.30723.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IW4M ADMIN", "Admin\IW4M ADMIN.csproj", "{DD5DCDA2-51DB-4B1A-922F-5705546E6115}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{D51EECEB-438A-47DA-870F-7D7B41BC24D6} = {D51EECEB-438A-47DA-870F-7D7B41BC24D6}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedLibrary", "SharedLibary\SharedLibrary.csproj", "{D51EECEB-438A-47DA-870F-7D7B41BC24D6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SamplePlugin", "SamplePlugin\SamplePlugin.csproj", "{4785AB75-66F3-4391-985D-63A5A049A0FA}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{D51EECEB-438A-47DA-870F-7D7B41BC24D6} = {D51EECEB-438A-47DA-870F-7D7B41BC24D6}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -34,7 +34,7 @@ namespace SamplePlugin
|
||||
String Sender = E.Origin.Name;
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
originatingServer.Broadcast(String.Format("^7{0}: {1}", Sender, Message));
|
||||
originatingServer.Broadcast(String.Format("^7{0}: ^{1}{2}^7", Sender, i, Message));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="SharedLibary">
|
||||
<HintPath>..\SharedLibary\bin\Release\SharedLibary.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
|
@ -22,7 +22,7 @@ namespace SharedLibrary
|
||||
|
||||
catch(System.DllNotFoundException)
|
||||
{
|
||||
Console.WriteLine("Could not locate the SQLite DLL!\nEnsure it is located in the 'lib' folder");
|
||||
Console.WriteLine("Fatal Error: could not locate the SQLite DLL(s)!\nEnsure they are located in the 'lib' folder");
|
||||
Utilities.Wait(5);
|
||||
System.Environment.Exit(0);
|
||||
}
|
||||
|
@ -62,6 +62,9 @@
|
||||
<Compile Include="Utilities.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy /Y "$(TargetDir)$(TargetName).dll" "$(SolutionDir)Admin\lib\$(TargetName).dll"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace SharedLibrary
|
||||
{
|
||||
class Utilities
|
||||
public class Utilities
|
||||
{
|
||||
//Get string with specified number of spaces -- really only for visual output
|
||||
public static String getSpaces(int Num)
|
||||
@ -114,6 +114,31 @@ namespace SharedLibrary
|
||||
}
|
||||
}
|
||||
|
||||
public static String nameHTMLFormatted(Player P)
|
||||
{
|
||||
switch (P.Level)
|
||||
{
|
||||
case Player.Permission.User:
|
||||
return "<span style='color:rgb(87, 150, 66)'>" + P.Name + "</span>";
|
||||
case Player.Permission.Moderator:
|
||||
return "<span style='color:#e7b402'>" + P.Name + "</span>";
|
||||
case Player.Permission.Administrator:
|
||||
return "<span style='color:#ec82de'>" + P.Name + "</span>";
|
||||
case Player.Permission.SeniorAdmin:
|
||||
return "<span style='color:#2eb6bf'>" + P.Name + "</span>";
|
||||
case Player.Permission.Owner:
|
||||
return "<span style='color:rgb(38,120,230)'>" + P.Name + "</span>";
|
||||
case Player.Permission.Creator:
|
||||
return "<span style='color:rgb(38,120,230)'>" + P.Name + "</span>";
|
||||
case Player.Permission.Banned:
|
||||
return "<span style='color:rgb(196, 22, 28)'>" + P.Name + "</span>";
|
||||
case Player.Permission.Flagged:
|
||||
return "<span style='color:rgb(251, 124, 98)'>" + P.Name + "</span>";
|
||||
default:
|
||||
return "<i>" + P.Name + "</i>";
|
||||
}
|
||||
}
|
||||
|
||||
public static String processMacro(Dictionary<String, Object> Dict, String str)
|
||||
{
|
||||
MatchCollection Found = Regex.Matches(str, @"\{\{[A-Z]+\}\}", RegexOptions.IgnoreCase);
|
||||
|
Loading…
Reference in New Issue
Block a user