fixed issues with the previous commit :(

This commit is contained in:
RaidMax 2015-03-10 23:47:34 -05:00
parent 3aef7619fc
commit c7f8b0591b
8 changed files with 66 additions and 14 deletions

View File

@ -167,10 +167,15 @@ namespace IW4MAdmin
{ {
E.Target.LastOffense = Utilities.removeWords(E.Data, 1); E.Target.LastOffense = Utilities.removeWords(E.Data, 1);
E.Target.lastEvent = E; // needs to be fixed E.Target.lastEvent = E; // needs to be fixed
String Message;
#if DEBUG #if DEBUG
String Message = "^1Player Banned: ^5" + E.Target.LastOffense + "^7 (appeal at nbsclan.org)"; Message = "^1Player Banned: ^5" + E.Target.LastOffense + "^7 (appeal at nbsclan.org)";
#else #else
String Message = "^1Player Banned: ^5" + E.Target.LastOffense; if (E.Owner.Website == null)
Message = "^1Player Banned: ^5" + E.Target.LastOffense;
else
Message = "^1Player Banned: ^5" + E.Target.LastOffense + "^7 (appeal at " + E.Owner.Website + ")";
#endif #endif
if (E.Origin.getLevel() > E.Target.getLevel()) if (E.Origin.getLevel() > E.Target.getLevel())
{ {
@ -220,7 +225,7 @@ namespace IW4MAdmin
if (P == null) if (P == null)
continue; continue;
E.Origin.Tell(String.Format("[^3{0}^7]{3}[^3{1}^7] {2}", P.getLevel(), P.getClientNum(), P.getName(), Utilities.getSpaces(Player.Permission.SeniorAdmin.ToString().Length - P.getLevel().ToString().Length))); E.Origin.Tell(String.Format("[^3{0}^7]{3}[^3{1}^7] {2}", Utilities.levelToColor(P.getLevel()), P.getClientNum(), P.getName(), Utilities.getSpaces(Player.Permission.SeniorAdmin.ToString().Length - P.getLevel().ToString().Length)));
} }
} }
@ -252,11 +257,21 @@ namespace IW4MAdmin
else else
{ {
int count = 0;
String _commands = String.Empty;
foreach (Command C in E.Owner.getCommands()) foreach (Command C in E.Owner.getCommands())
{ {
if (E.Origin.getLevel() >= C.getNeededPerm()) if (E.Origin.getLevel() >= C.getNeededPerm())
{ {
E.Origin.Tell(" [^3" + C.getName() + "^7] "); _commands = _commands + " [^3" + C.getName() + "^7] ";
if (count >= 3)
{
E.Origin.Tell(_commands);
_commands = String.Empty;
count = 0;
}
count++;
} }
} }
E.Origin.Tell("Type !help <cmd> to get command usage example"); E.Origin.Tell("Type !help <cmd> to get command usage example");
@ -351,7 +366,7 @@ namespace IW4MAdmin
{ {
if (P != null && P.getLevel() > Player.Permission.User) if (P != null && P.getLevel() > Player.Permission.User)
{ {
E.Origin.Tell(String.Format("[^3{0}^7]{3} {1}", P.getLevel(), P.getName(), Utilities.getSpaces(Player.Permission.SeniorAdmin.ToString().Length - P.getLevel().ToString().Length))); E.Origin.Tell(String.Format("[^3{0}^7] {1}", Utilities.levelToColor(P.getLevel()), P.getName()));
} }
} }
} }
@ -411,7 +426,7 @@ namespace IW4MAdmin
foreach (Player P in db_players) foreach (Player P in db_players)
{ {
String mesg = String.Format("[^3{0}^7] [^3@{1}^7] - {2}", P.getName(), P.getDBID(), P.getID()); String mesg = String.Format("[^3{0}^7] [^3@{1}^7] - {2} [{3}^7]", P.getName(), P.getDBID(), P.getID(), Utilities.levelToColor(P.getLevel()));
E.Origin.Tell(mesg); E.Origin.Tell(mesg);
} }

View File

@ -28,7 +28,7 @@ namespace IW4MAdmin
public file(String file, bool write) public file(String file, bool write)
{ {
Name = file; Name = file;
writeHandle = new StreamWriter(new FileStream(Name, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite)); writeHandle = new StreamWriter(new FileStream(Name, FileMode.Create, FileAccess.Write, FileShare.ReadWrite));
sze = 0; sze = 0;
} }

View File

@ -29,7 +29,7 @@
<CreateWebPageOnPublish>true</CreateWebPageOnPublish> <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.htm</WebPage> <WebPage>publish.htm</WebPage>
<ApplicationRevision>5</ApplicationRevision> <ApplicationRevision>5</ApplicationRevision>
<ApplicationVersion>0.3.0.%2a</ApplicationVersion> <ApplicationVersion>0.4.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>

View File

@ -10,7 +10,7 @@ namespace IW4MAdmin
static String IP; static String IP;
static int Port; static int Port;
static String RCON; static String RCON;
static public double Version = 0.3; static public double Version = 0.4;
static public double latestVersion; static public double latestVersion;
static void Main(string[] args) static void Main(string[] args)

View File

@ -413,6 +413,23 @@ namespace IW4MAdmin
Thread.Sleep(FLOOD_TIMEOUT); Thread.Sleep(FLOOD_TIMEOUT);
//get _Website
p = RCON.responseSendRCON("_Website");
if (p == null)
{
Log.Write("Could not website name!", Log.Level.All);
return false;
}
p = p[1].Split('"');
if (p[0].Trim() != "Unknown command")
Website = (p[3].Substring(0, p[3].Length - 2).Trim());
p = null;
//END
Thread.Sleep(FLOOD_TIMEOUT);
//GET fs_basepath //GET fs_basepath
p = RCON.responseSendRCON("fs_basepath"); p = RCON.responseSendRCON("fs_basepath");
@ -811,6 +828,7 @@ namespace IW4MAdmin
public Queue<Event> events; public Queue<Event> events;
public Database stats; public Database stats;
public Heartbeat HB; public Heartbeat HB;
public String Website;
//Info //Info
private String IP; private String IP;

View File

@ -79,5 +79,24 @@ namespace IW4MAdmin
{ {
return Regex.Replace(str, @"\^[0-9]", ""); return Regex.Replace(str, @"\^[0-9]", "");
} }
public static String levelToColor(Player.Permission level)
{
switch (level)
{
case Player.Permission.Banned:
return "^1" + Player.Permission.Banned;
break;
case Player.Permission.Owner:
return "^5" + Player.Permission.Owner;
break;
case Player.Permission.User:
return "^3" + Player.Permission.User;
break;
default:
return "^2" + level;
break;
}
}
} }
} }

View File

@ -1 +1 @@
0.2 0.4

View File

@ -13,8 +13,8 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Debug|Any CPU.Build.0 = Debug|Any CPU {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Any CPU.ActiveCfg = Debug|Any CPU {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Any CPU.Build.0 = Debug|Any CPU {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE