When do those happen?![]()
I'm seeing these strange characters. Can you fix that? Or maybe release the source code?
"Snake was last seen: Dec 30, 2015 "((((
Sent From My Samsung Galaxy S4
When do those happen?![]()
I'm seeing these strange characters. Can you fix that? Or maybe release the source code?
"Snake was last seen: Dec 30, 2015 "((((
using Fougerite;
using Fougerite.Events;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace Rank__
{
public class RankModule : Module
{
private string n = "Rank++";
private DataStore ds = DataStore.GetInstance();
private string l;
private StreamWriter log;
public override string Name
{
get
{
return "Rank++";
}
}
public override string Author
{
get
{
return "Snake";
}
}
public override string Description
{
get
{
return "Tops, rankings and all statistics of your players tracked!";
}
}
public override Version Version
{
get
{
return new Version("2.2");
}
}
public override void Initialize()
{
this.l = "[" + (object) DateTime.Now + "] ";
bool flag = true;
if (!Directory.Exists(this.ModuleFolder))
{
flag = false;
Directory.CreateDirectory(this.ModuleFolder);
}
if (File.Exists(this.ModuleFolder + "\\log.txt"))
{
this.log = File.AppendText(this.ModuleFolder + "\\log.txt");
this.log.WriteLine(this.l + "---- RANK++ INITIALIZATION ----");
if (!flag)
this.log.WriteLine(this.l + "- WARNING : FOLDER WAS MISSING / NEW ONE CREATED");
this.log.WriteLine(this.l + "LOG LOADED");
}
else
{
this.log = new StreamWriter((Stream) File.Create(this.ModuleFolder + "\\log.txt"));
this.log.WriteLine(this.l + "---- RANK++ INITIALIZATION ----");
if (!flag)
this.log.WriteLine(this.l + "WARNING : FOLDER WAS MISSING / NEW ONE CREATED");
this.log.WriteLine(this.l + "WARNING : LOG WAS MISSING / NEW ONE CREATED");
}
this.log.AutoFlush = true;
Hooks.OnCommand += new Hooks.CommandHandlerDelegate(this.HandleCommand);
Hooks.OnPlayerConnected += new Hooks.ConnectionHandlerDelegate(this.PlayerConnected);
Hooks.OnPlayerDisconnected += new Hooks.DisconnectionHandlerDelegate(this.PlayerDisconnected);
Hooks.OnPlayerKilled += new Hooks.KillHandlerDelegate(this.PlayerKilled);
Hooks.OnPlayerGathering += new Hooks.PlayerGatheringHandlerDelegate(this.PlayerGathering);
Hooks.OnNPCKilled += new Hooks.KillHandlerDelegate(this.NPCKilled);
this.log.WriteLine(this.l + "HOOKS LOADED");
}
public override void DeInitialize()
{
this.l = "[" + (object) DateTime.Now + "]";
this.log.WriteLine(this.l + "------ PLUGIN DEINITIALIZE ------");
Hooks.OnCommand -= new Hooks.CommandHandlerDelegate(this.HandleCommand);
Hooks.OnPlayerConnected -= new Hooks.ConnectionHandlerDelegate(this.PlayerConnected);
Hooks.OnPlayerDisconnected -= new Hooks.DisconnectionHandlerDelegate(this.PlayerDisconnected);
Hooks.OnPlayerKilled -= new Hooks.KillHandlerDelegate(this.PlayerKilled);
Hooks.OnPlayerGathering -= new Hooks.PlayerGatheringHandlerDelegate(this.PlayerGathering);
Hooks.OnNPCKilled -= new Hooks.KillHandlerDelegate(this.NPCKilled);
this.log.WriteLine(this.l + "HOOKS UNLOADED");
this.log.Close();
}
public void HandleCommand(Fougerite.Player pl, string cmd, string[] args)
{
switch (cmd)
{
case "rank":
switch (args.Length)
{
case 0:
pl.MessageFrom(this.n, "[COLOR#00EB7E]Rank++ 2.2 [COLOR#FFFFFF]by Snake");
pl.MessageFrom(this.n, "----------------------------");
pl.MessageFrom(this.n, "Use '/rank' to see this info");
pl.MessageFrom(this.n, "Use '/stats' to check your own stats");
pl.MessageFrom(this.n, "Use '/stats playername' to check a player's stats");
pl.MessageFrom(this.n, "Use '/top category' to see the top 5 most valuable players");
pl.MessageFrom(this.n, "Valid Top Categories : kills, deaths, headshots, time, pve, gathering");
if (!pl.Admin)
return;
pl.MessageFrom(this.n, "[COLOR#FB9A50]---------- Admin Only Commands ----------");
pl.MessageFrom(this.n, "Use '/rank resetall' to reset all stats");
pl.MessageFrom(this.n, "Use '/rank backup' to back up all the stats");
pl.MessageFrom(this.n, "Use '/rank restore' to back up all the stats");
return;
case 1:
if (!pl.Admin)
return;
switch (args[0])
{
case "resetall":
string str1 = this.backupStats();
this.deleteStats();
pl.MessageFrom(this.n, "[COLOR#00EB7E]Rank++ Stats deleted except Time");
pl.MessageFrom(this.n, "[COLOR#00EB7E]Emergency Rank++ Back-up saved as : [COLOR#FFA500]" + str1);
break;
case "backup":
string str2 = this.backupStats();
pl.MessageFrom(this.n, "[COLOR#00EB7E]Rank++ Back-up saved as : [COLOR#FFA500]" + str2);
break;
}
return;
case 2:
switch (args[0])
{
case "restore":
if (pl.Admin)
{
string str3 = this.ModuleFolder + "\\" + args[1];
if (!str3.EndsWith(".ini"))
str3 += ".ini";
if (File.Exists(str3))
{
IniParser iniParser = new IniParser(str3);
foreach (string section in iniParser.Sections)
{
foreach (string settingName in iniParser.EnumSection(section))
this.ds.Add("Rank++" + section, (object) settingName, (object) iniParser.GetSetting(section, settingName));
}
pl.MessageFrom(this.n, "[COLOR#00EB7E]Rank++ Stats restored from [COLOR#FFA500]" + str3);
return;
}
pl.MessageFrom(this.n, "[COLOR#00EB7E]The file [COLOR#FFA500]" + str3 + "[COLOR#00EB7E] was not found");
return;
}
pl.MessageFrom(this.n, "[COLOR#00EB7E]Only admins can acces this command");
return;
case null:
return;
default:
return;
}
default:
return;
}
case "stats":
switch (args.Length)
{
case 0:
string steamId = pl.SteamID;
double num1 = double.Parse(this.ds.Get("Rank++Kills", (object) steamId).ToString());
double num2 = double.Parse(this.ds.Get("Rank++Deaths", (object) steamId).ToString());
double num3 = double.Parse(this.ds.Get("Rank++Headshots", (object) steamId).ToString());
double ms1 = double.Parse(this.ds.Get("Rank++Time", (object) steamId).ToString());
double num4 = double.Parse(this.ds.Get("Rank++PVE", (object) steamId).ToString());
double num5 = double.Parse(this.ds.Get("Rank++Gathering", (object) steamId).ToString());
double num6 = Math.Round(num3 / num1 * 100.0, 1);
double num7 = num2 != 0.0 ? Math.Round(num1 / num2, 2) : num1;
pl.MessageFrom(this.n, "[COLOR#FFFFFF]------ [COLOR#00EB7E]" + pl.Name + " Rank++ Stats [COLOR#FFFFFF]-----");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]K : [COLOR#00EB7E]" + (object) num1 + "[COLOR#FFFFFF] | D : [COLOR#00EB7E]" + (object) num2 + "[COLOR#FFFFFF] | Headshots : [COLOR#00EB7E]" + (object) num3 + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) num6 + "[COLOR#FFFFFF]%) | K/D Ratio : [COLOR#00EB7E]" + (object) num7);
pl.MessageFrom(this.n, "[COLOR#FFFFFF]Time Played : [COLOR#00EB7E]" + this.msToTime(ms1) + "[COLOR#FFFFFF] | PVE Kills : [COLOR#00EB7E]" + (object) num4 + "[COLOR#FFFFFF] | Resources Gathered : [COLOR#00EB7E]" + (object) num5);
return;
case 1:
bool flag = false;
foreach (object key in this.ds.Keys("LastName"))
{
string @string = this.ds.Get("LastName", key).ToString();
if (@string.Equals(args[0], StringComparison.OrdinalIgnoreCase))
{
flag = true;
double num8 = double.Parse(this.ds.Get("Rank++Kills", key).ToString());
double num9 = double.Parse(this.ds.Get("Rank++Deaths", key).ToString());
double num10 = double.Parse(this.ds.Get("Rank++Headshots", key).ToString());
double ms2 = double.Parse(this.ds.Get("Rank++Time", key).ToString());
double num11 = double.Parse(this.ds.Get("Rank++PVE", key).ToString());
double num12 = double.Parse(this.ds.Get("Rank++Gathering", key).ToString());
double num13 = Math.Round(num10 / num8 * 100.0, 1);
double num14 = num9 != 0.0 ? Math.Round(num8 / num9, 2) : num8;
pl.MessageFrom(this.n, "[COLOR#FFFFFF]------ [COLOR#00EB7E]" + @string + " Rank++ Stats [COLOR#FFFFFF]-----");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]K : [COLOR#00EB7E]" + (object) num8 + "[COLOR#FFFFFF] | D : [COLOR#00EB7E]" + (object) num9 + "[COLOR#FFFFFF] | Headshots : [COLOR#00EB7E]" + (object) num10 + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) num13 + "[COLOR#FFFFFF]%) | K/D Ratio : [COLOR#00EB7E]" + (object) num14);
pl.MessageFrom(this.n, "[COLOR#FFFFFF]Time Played : [COLOR#00EB7E]" + this.msToTime(ms2) + "[COLOR#FFFFFF] | PVE Kills : [COLOR#00EB7E]" + (object) num11 + "[COLOR#FFFFFF] | Resources Gathered : [COLOR#00EB7E]" + (object) num12);
}
}
if (flag)
return;
pl.MessageFrom(this.n, "[COLOR#FFFFFF]The player [COLOR#00EB7E]" + args[1] + "[COLOR#FFFFFF] was not found");
return;
default:
pl.MessageFrom(this.n, "[COLOR#FFFFFF]The player [COLOR#00EB7E]" + args[1] + "[COLOR#FFFFFF] was not found");
return;
}
case "top":
if (args.Length == 1)
{
switch (args[0])
{
case "kills":
Dictionary<int, RankModule.TopPlayer> dictionary1 = this.calcTop("Kills");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]------ [COLOR#00EB7E]TOP 5 Most Kills [COLOR#FFFFFF]------");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]1. [COLOR#00EB7E]" + dictionary1[0].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary1[0].count + "[COLOR#FFFFFF] kills)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]2. [COLOR#00EB7E]" + dictionary1[1].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary1[1].count + "[COLOR#FFFFFF] kills)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]3. [COLOR#00EB7E]" + dictionary1[2].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary1[2].count + "[COLOR#FFFFFF] kills)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]4. [COLOR#00EB7E]" + dictionary1[3].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary1[3].count + "[COLOR#FFFFFF] kills)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]5. [COLOR#00EB7E]" + dictionary1[4].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary1[4].count + "[COLOR#FFFFFF] kills)");
return;
case "deaths":
Dictionary<int, RankModule.TopPlayer> dictionary2 = this.calcTop("Deaths");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]------ [COLOR#00EB7E]TOP 5 Most Deaths [COLOR#FFFFFF]------");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]1. [COLOR#00EB7E]" + dictionary2[0].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary2[0].count + "[COLOR#FFFFFF] deaths)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]2. [COLOR#00EB7E]" + dictionary2[1].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary2[1].count + "[COLOR#FFFFFF] deaths)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]3. [COLOR#00EB7E]" + dictionary2[2].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary2[2].count + "[COLOR#FFFFFF] deaths)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]4. [COLOR#00EB7E]" + dictionary2[3].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary2[3].count + "[COLOR#FFFFFF] deaths)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]5. [COLOR#00EB7E]" + dictionary2[4].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary2[4].count + "[COLOR#FFFFFF] deaths)");
return;
case "headshots":
Dictionary<int, RankModule.TopPlayer> dictionary3 = this.calcTop("Headshots");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]------ [COLOR#00EB7E]TOP 5 Most Headshots [COLOR#FFFFFF]------");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]1. [COLOR#00EB7E]" + dictionary3[0].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary3[0].count + "[COLOR#FFFFFF] headshots)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]2. [COLOR#00EB7E]" + dictionary3[1].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary3[1].count + "[COLOR#FFFFFF] headshots)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]3. [COLOR#00EB7E]" + dictionary3[2].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary3[2].count + "[COLOR#FFFFFF] headshots)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]4. [COLOR#00EB7E]" + dictionary3[3].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary3[3].count + "[COLOR#FFFFFF] headshots)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]5. [COLOR#00EB7E]" + dictionary3[4].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary3[4].count + "[COLOR#FFFFFF] headshots)");
return;
case "time":
Dictionary<int, RankModule.TopPlayer> dictionary4 = this.calcTop("Time");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]------ [COLOR#00EB7E]TOP 5 Most Time Played [COLOR#FFFFFF]------");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]1. [COLOR#00EB7E]" + dictionary4[0].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + this.msToTime((double) dictionary4[0].count) + "[COLOR#FFFFFF])");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]2. [COLOR#00EB7E]" + dictionary4[1].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + this.msToTime((double) dictionary4[1].count) + "[COLOR#FFFFFF])");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]3. [COLOR#00EB7E]" + dictionary4[2].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + this.msToTime((double) dictionary4[2].count) + "[COLOR#FFFFFF])");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]4. [COLOR#00EB7E]" + dictionary4[3].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + this.msToTime((double) dictionary4[3].count) + "[COLOR#FFFFFF])");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]5. [COLOR#00EB7E]" + dictionary4[4].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + this.msToTime((double) dictionary4[4].count) + "[COLOR#FFFFFF])");
return;
case "pve":
Dictionary<int, RankModule.TopPlayer> dictionary5 = this.calcTop("PVE");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]------ [COLOR#00EB7E]TOP 5 Most PVE Kills [COLOR#FFFFFF]------");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]1. [COLOR#00EB7E]" + dictionary5[0].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary5[0].count + "[COLOR#FFFFFF] PVE Kills)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]2. [COLOR#00EB7E]" + dictionary5[1].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary5[1].count + "[COLOR#FFFFFF] PVE Kills)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]3. [COLOR#00EB7E]" + dictionary5[2].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary5[2].count + "[COLOR#FFFFFF] PVE Kills)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]4. [COLOR#00EB7E]" + dictionary5[3].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary5[3].count + "[COLOR#FFFFFF] PVE Kills)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]5. [COLOR#00EB7E]" + dictionary5[4].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary5[4].count + "[COLOR#FFFFFF] PVE Kills)");
return;
case "gathering":
Dictionary<int, RankModule.TopPlayer> dictionary6 = this.calcTop("Gathering");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]------ [COLOR#00EB7E]TOP 5 Most Resources Gathered [COLOR#FFFFFF]------");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]1. [COLOR#00EB7E]" + dictionary6[0].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary6[0].count + "[COLOR#FFFFFF] resources)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]2. [COLOR#00EB7E]" + dictionary6[1].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary6[1].count + "[COLOR#FFFFFF] resources)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]3. [COLOR#00EB7E]" + dictionary6[2].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary6[2].count + "[COLOR#FFFFFF] resources)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]4. [COLOR#00EB7E]" + dictionary6[3].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary6[3].count + "[COLOR#FFFFFF] resources)");
pl.MessageFrom(this.n, "[COLOR#FFFFFF]5. [COLOR#00EB7E]" + dictionary6[4].name + "[COLOR#FFFFFF] ([COLOR#00EB7E]" + (object) dictionary6[4].count + "[COLOR#FFFFFF] resources)");
return;
default:
pl.MessageFrom(this.n, "[COLOR#FFFFFF]Valid TOPs : [COLOR#00EB7E]kills , deaths , headshots , time , pve , gathering");
return;
}
}
else
{
pl.MessageFrom(this.n, "[COLOR#FFFFFF]Valid TOPs : [COLOR#00EB7E]kills , deaths , headshots , time , pve , gathering");
break;
}
}
}
public void PlayerConnected(Fougerite.Player pl)
{
string[] playerProperties = RankModule.TryToGetPlayerProperties(pl);
if (playerProperties == null)
return;
string str1 = playerProperties[0];
string str2 = playerProperties[1];
this.ds.Add("LastplayerName", (object) str2, (object) str1);
object obj1 = this.ds.Get("Rank++Kills", (object) str2);
object obj2 = this.ds.Get("Rank++Deaths", (object) str2);
object obj3 = this.ds.Get("Rank++Headshots", (object) str2);
object obj4 = this.ds.Get("Rank++Time", (object) str2);
object obj5 = this.ds.Get("Rank++PVE", (object) str2);
object obj6 = this.ds.Get("Rank++Gathering", (object) str2);
if (obj1 == null)
this.ds.Add("Rank++Kills", (object) str2, (object) "0");
if (obj2 == null)
this.ds.Add("Rank++Deaths", (object) str2, (object) "0");
if (obj3 == null)
this.ds.Add("Rank++Headshots", (object) str2, (object) "0");
if (obj4 == null)
this.ds.Add("Rank++Time", (object) str2, (object) "1");
if (obj5 == null)
this.ds.Add("Rank++PVE", (object) str2, (object) "0");
if (obj6 != null)
return;
this.ds.Add("Rank++Gathering", (object) str2, (object) "0");
}
public void PlayerDisconnected(Fougerite.Player player)
{
string[] playerProperties = RankModule.TryToGetPlayerProperties(player);
if (playerProperties == null)
return;
string str1 = playerProperties[0];
string str2 = playerProperties[1];
this.ds.Add("LastName", (object) str2, (object) str1);
double num = (double) player.TimeOnline + double.Parse(this.ds.Get("Rank++Time", (object) str2).ToString());
this.ds.Add("Rank++Time", (object) str2, (object) num.ToString((IFormatProvider) CultureInfo.InvariantCulture));
}
public void PlayerKilled(DeathEvent de)
{
if (de.Victim == null || de.Attacker == null)
return;
Fougerite.Player player1 = (Fougerite.Player) de.Victim;
string[] playerProperties1 = RankModule.TryToGetPlayerProperties(player1);
if (playerProperties1 == null)
return;
string str1 = playerProperties1[1];
double num1 = double.Parse(this.ds.Get("Rank++Deaths", (object) str1).ToString());
this.ds.Add("Rank++Deaths", (object) str1, (object) (num1 + 1.0));
if (!(de.Attacker is Fougerite.Player))
return;
Fougerite.Player player2 = (Fougerite.Player) de.Attacker;
if (player2 != player1)
{
string[] playerProperties2 = RankModule.TryToGetPlayerProperties(player2);
if (playerProperties2 == null)
return;
string str2 = playerProperties2[1];
double num2 = double.Parse(this.ds.Get("Rank++Kills", (object) str2).ToString());
this.ds.Add("Rank++Kills", (object) str2, (object) (num2 + 1.0));
if (this.isHead(de.DamageEvent.bodyPart.ToString()))
{
double num3 = double.Parse(this.ds.Get("Rank++Headshots", (object) str2).ToString());
this.ds.Add("Rank++Headshots", (object) str2, (object) (num3 + 1.0));
}
}
}
public void PlayerGathering(Fougerite.Player player, GatherEvent ge)
{
string[] playerProperties = RankModule.TryToGetPlayerProperties(player);
if (playerProperties == null)
return;
string str = playerProperties[1];
double num = double.Parse(this.ds.Get("Rank++Gathering", (object) str).ToString());
this.ds.Add("Rank++Gathering", (object) str, (object) (num + 1.0));
}
public void NPCKilled(DeathEvent de)
{
if (!(de.Attacker is Fougerite.Player) || de.Attacker == null)
return;
string[] playerProperties = RankModule.TryToGetPlayerProperties((Fougerite.Player) de.Attacker);
if (playerProperties == null)
return;
string str = playerProperties[1];
double num = double.Parse(this.ds.Get("Rank++PVE", (object) str).ToString());
this.ds.Add("Rank++PVE", (object) str, (object) (num + 1.0));
}
public static string[] TryToGetPlayerProperties(Fougerite.Player player)
{
try
{
return new string[3]
{
player.Name,
player.SteamID,
player.IP
};
}
catch
{
return (string[]) null;
}
}
private bool isHead(string bodypart)
{
switch (bodypart)
{
case "Head":
case "Scalp":
case "Nostrils":
case "Jaw":
case "TongueRear":
case "TongueFront":
case "L_Eye":
case "R_Eye":
case "L_EyeLidLower":
case "L_EyeLidUpper":
case "R_EyeLidLower":
case "R_EyeLidUpper":
case "L_BrowInner":
case "L_BrowOuter":
case "R_BrowInner":
case "R_BrowOuter":
case "L_Cheek":
case "R_Cheek":
case "L_LipUpper":
case "L_LipLower":
case "R_LipUpper":
case "R_LipLower":
case "L_LipCorner":
case "R_LipCorner":
return true;
default:
return false;
}
}
public string backupStats()
{
string str = "backup_" + (object) DateTime.Now.Hour + "h-" + (object) DateTime.Now.Minute + "m_" + (object) DateTime.Now.Day + "-" + (object) DateTime.Now.Month + "-" + (object) DateTime.Now.Year + ".ini";
File.Create(this.ModuleFolder + "\\" + str).Close();
IniParser iniParser = new IniParser(this.ModuleFolder + "\\" + str);
foreach (object key in this.ds.Keys("Rank++Time"))
{
iniParser.AddSetting("Kills", key.ToString(), this.ds.Get("Rank++Kills", key).ToString());
iniParser.AddSetting("Deaths", key.ToString(), this.ds.Get("Rank++Deaths", key).ToString());
iniParser.AddSetting("Headshots", key.ToString(), this.ds.Get("Rank++Headshots", key).ToString());
iniParser.AddSetting("Time", key.ToString(), this.ds.Get("Rank++Time", key).ToString());
iniParser.AddSetting("PVE", key.ToString(), this.ds.Get("Rank++PVE", key).ToString());
iniParser.AddSetting("Gathering", key.ToString(), this.ds.Get("Rank++Gathering", key).ToString());
}
iniParser.Save();
return str;
}
public void deleteStats()
{
foreach (object key in this.ds.Keys("Rank++Time"))
{
this.ds.Add("Rank++Kills", key, (object) "0");
this.ds.Add("Rank++Deaths", key, (object) "0");
this.ds.Add("Rank++Headshots", key, (object) "0");
this.ds.Add("Rank++PVE", key, (object) "0");
this.ds.Add("Rank++Gathering", key, (object) "0");
}
}
public Dictionary<int, RankModule.TopPlayer> calcTop(string top)
{
Dictionary<int, RankModule.TopPlayer> dictionary = new Dictionary<int, RankModule.TopPlayer>(5);
dictionary[0] = new RankModule.TopPlayer(" ", 0);
dictionary[1] = new RankModule.TopPlayer(" ", 0);
dictionary[2] = new RankModule.TopPlayer(" ", 0);
dictionary[3] = new RankModule.TopPlayer(" ", 0);
dictionary[4] = new RankModule.TopPlayer(" ", 0);
foreach (object key in this.ds.Keys("Rank++" + top))
{
int count = int.Parse(this.ds.Get("Rank++" + top, key).ToString());
if (count > dictionary[0].count)
{
dictionary[4] = dictionary[3];
dictionary[3] = dictionary[2];
dictionary[2] = dictionary[1];
dictionary[1] = dictionary[0];
dictionary[0] = new RankModule.TopPlayer(this.ds.Get("LastName", key).ToString(), count);
}
else if (count > dictionary[1].count)
{
dictionary[4] = dictionary[3];
dictionary[3] = dictionary[2];
dictionary[2] = dictionary[1];
dictionary[1] = new RankModule.TopPlayer(this.ds.Get("LastName", key).ToString(), count);
}
else if (count > dictionary[2].count)
{
dictionary[4] = dictionary[3];
dictionary[3] = dictionary[2];
dictionary[2] = new RankModule.TopPlayer(this.ds.Get("LastName", key).ToString(), count);
}
else if (count > dictionary[3].count)
{
dictionary[4] = dictionary[3];
dictionary[3] = new RankModule.TopPlayer(this.ds.Get("LastName", key).ToString(), count);
}
else if (count > dictionary[4].count)
dictionary[4] = new RankModule.TopPlayer(this.ds.Get("LastName", key).ToString(), count);
}
return dictionary;
}
public string msToTime(double ms)
{
double num1 = Math.Round(ms / 1000.0);
if (num1 <= 60.0)
return num1.ToString() + "s";
double num2 = (num1 - num1 % 60.0) / 60.0;
double num3 = num1 % 60.0;
if (num2 > 60.0)
{
double num4 = (num2 - num2 % 60.0) / 60.0;
double num5 = num2 % 60.0;
if (num4 > 24.0)
return ((num4 - num4 % 24.0) / 24.0).ToString() + "days " + (object) (num4 % 60.0) + "h " + (object) num5 + "m " + (object) num3 + "s";
return num4.ToString() + "h " + (object) num5 + "m " + (object) num3 + "s";
}
return num2.ToString() + "m " + (object) num3 + "s";
}
public class TopPlayer
{
public string name;
public int count;
public TopPlayer(string name, int count)
{
this.name = name;
this.count = count;
}
}
}
}
[1/12/2017 2:07:20 AM] [Error] PlayerDisconnectedEvent Error System.NullReferenceException: Object reference not set to an instance of an object
at Rank__.RankModule.PlayerDisconnected (Fougerite.Player player) [0x00000] in <filename unknown>:0
at (wrapper delegate-invoke) Fougerite.Hooks/ConnectionHandlerDelegate:invoke_void__this___Player (Fougerite.Player)
at (wrapper delegate-invoke) Fougerite.Hooks/ConnectionHandlerDelegate:invoke_void__this___Player (Fougerite.Player)
at Fougerite.Hooks.PlayerDisconnect (NetworkPlayer nplayer) [0x00000] in <filename unknown>:0
Hello ,When do those happen?
Sent From My Samsung Galaxy S4
I dunno, it needs update.Hello ,
the same problem still exist any new updates o the Rank++ plugin?
/stats show exactly same.
Regards