Skip to content

Commit 798ac8b

Browse files
Fix and add HWID support
1 parent 6ca26c3 commit 798ac8b

18 files changed

+1620
-1547
lines changed

CommandDelInstance.cs

Lines changed: 72 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,72 @@
1-
using Rocket.API;
2-
using Rocket.Unturned.Chat;
3-
using System.Collections.Generic;
4-
5-
namespace PlayerInfoLibrary
6-
{
7-
public class CommandDelInstance : IRocketCommand
8-
{
9-
internal static readonly string syntax = "<\"Instance ID\">";
10-
internal static readonly string help = "Uses the numerical Instance ID for a server to remove all player data saved for that server. !!Use with caution, can't be undone without a database backup!!";
11-
public List<string> Aliases
12-
{
13-
get { return new List<string>(); }
14-
}
15-
16-
public AllowedCaller AllowedCaller
17-
{
18-
get { return AllowedCaller.Console; }
19-
}
20-
21-
public string Help
22-
{
23-
get { return help; }
24-
}
25-
26-
public string Name
27-
{
28-
get { return "delint"; }
29-
}
30-
31-
public List<string> Permissions
32-
{
33-
get { return new List<string> { "PlayerInfoLib.delint" }; }
34-
}
35-
36-
public string Syntax
37-
{
38-
get { return syntax; }
39-
}
40-
41-
public void Execute(IRocketPlayer caller, string[] command)
42-
{
43-
if (command.Length == 0)
44-
{
45-
UnturnedChat.Say(caller, PlayerInfoLib.Instance.Translate("delint_help"));
46-
}
47-
if (command.Length > 1)
48-
{
49-
UnturnedChat.Say(caller, PlayerInfoLib.Instance.Translate("too_many_parameters"));
50-
return;
51-
}
52-
if (command.Length == 1)
53-
{
54-
ushort ID;
55-
if (!ushort.TryParse(command[0], out ID))
56-
{
57-
UnturnedChat.Say(caller, PlayerInfoLib.Instance.Translate("delint_invalid"));
58-
return;
59-
}
60-
if (PlayerInfoLib.Database.RemoveInstance(ID))
61-
{
62-
UnturnedChat.Say(caller, PlayerInfoLib.Instance.Translate("delint_success"));
63-
return;
64-
}
65-
else
66-
{
67-
UnturnedChat.Say(caller, PlayerInfoLib.Instance.Translate("delint_not_found"));
68-
}
69-
}
70-
}
71-
}
72-
}
1+
using Rocket.API;
2+
using Rocket.Unturned.Chat;
3+
using System.Collections.Generic;
4+
5+
namespace PlayerInfoLibrary
6+
{
7+
public class CommandDelInstance : IRocketCommand
8+
{
9+
internal static readonly string syntax = "<\"Instance ID\">";
10+
internal static readonly string help = "Uses the numerical Instance ID for a server to remove all player data saved for that server. !!Use with caution, can't be undone without a database backup!!";
11+
public List<string> Aliases
12+
{
13+
get { return new List<string>(); }
14+
}
15+
16+
public AllowedCaller AllowedCaller
17+
{
18+
get { return AllowedCaller.Console; }
19+
}
20+
21+
public string Help
22+
{
23+
get { return help; }
24+
}
25+
26+
public string Name
27+
{
28+
get { return "delint"; }
29+
}
30+
31+
public List<string> Permissions
32+
{
33+
get { return new List<string> { "PlayerInfoLib.delint" }; }
34+
}
35+
36+
public string Syntax
37+
{
38+
get { return syntax; }
39+
}
40+
41+
public void Execute(IRocketPlayer caller, string[] command)
42+
{
43+
if (command.Length == 0)
44+
{
45+
UnturnedChat.Say(caller, PlayerInfoLib.Instance.Translate("delint_help"));
46+
}
47+
if (command.Length > 1)
48+
{
49+
UnturnedChat.Say(caller, PlayerInfoLib.Instance.Translate("too_many_parameters"));
50+
return;
51+
}
52+
if (command.Length == 1)
53+
{
54+
ushort ID;
55+
if (!ushort.TryParse(command[0], out ID))
56+
{
57+
UnturnedChat.Say(caller, PlayerInfoLib.Instance.Translate("delint_invalid"));
58+
return;
59+
}
60+
if (PlayerInfoLib.Database.RemoveInstance(ID))
61+
{
62+
UnturnedChat.Say(caller, PlayerInfoLib.Instance.Translate("delint_success"));
63+
return;
64+
}
65+
else
66+
{
67+
UnturnedChat.Say(caller, PlayerInfoLib.Instance.Translate("delint_not_found"));
68+
}
69+
}
70+
}
71+
}
72+
}

CommandInvestigate.cs

Lines changed: 116 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,116 @@
1-
using Rocket.API;
2-
using Rocket.API.Extensions;
3-
using Rocket.Unturned.Chat;
4-
using SDG.Unturned;
5-
using Steamworks;
6-
using System;
7-
using System.Collections.Generic;
8-
using UnityEngine;
9-
10-
namespace PlayerInfoLibrary
11-
{
12-
public class CommandInvestigate : IRocketCommand
13-
{
14-
internal static readonly string syntax = "<\"Player name\" | SteamID> [page]";
15-
internal static readonly string help = "Returns info for players matching the search quarry.";
16-
public List<string> Aliases
17-
{
18-
get { return new List<string>(); }
19-
}
20-
21-
public AllowedCaller AllowedCaller
22-
{
23-
get { return AllowedCaller.Both; }
24-
}
25-
26-
public string Help
27-
{
28-
get { return help; }
29-
}
30-
31-
public string Name
32-
{
33-
get { return "investigate"; }
34-
}
35-
36-
public List<string> Permissions
37-
{
38-
get { return new List<string> { "PlayerInfoLib.Ivestigate" }; }
39-
}
40-
41-
public string Syntax
42-
{
43-
get { return syntax; }
44-
}
45-
46-
public void Execute(IRocketPlayer caller, string[] command)
47-
{
48-
if (command.Length == 0)
49-
{
50-
UnturnedChat.Say(caller, PlayerInfoLib.Instance.Translate("investigate_help"));
51-
}
52-
CSteamID cSteamID;
53-
uint totalRecods = 1;
54-
uint? page = 1;
55-
uint start = 0;
56-
uint perPage = caller is ConsolePlayer ? 10u : 4u;
57-
List<PlayerData> pInfo = new List<PlayerData>();
58-
if (command.Length >= 1)
59-
{
60-
if (command.Length ==2)
61-
{
62-
page = command.GetUInt32Parameter(1);
63-
if (page == null || page == 0)
64-
{
65-
UnturnedChat.Say(caller, PlayerInfoLib.Instance.Translate("invalid_page"));
66-
return;
67-
}
68-
}
69-
if (command.Length > 2)
70-
{
71-
UnturnedChat.Say(caller, PlayerInfoLib.Instance.Translate("too_many_parameters"));
72-
return;
73-
}
74-
// Is what is entered in the command a SteamID64 number?
75-
if (command[0].isCSteamID(out cSteamID))
76-
{
77-
PlayerData pData = PlayerInfoLib.Database.QueryById(cSteamID);
78-
if(pData.IsValid())
79-
pInfo.Add(pData);
80-
}
81-
else if(Parser.checkIP(command[0]))
82-
{
83-
pInfo = PlayerInfoLib.Database.QueryByName(command[0], QueryType.IP, out totalRecods, true, (uint)page, perPage);
84-
}
85-
else
86-
{
87-
pInfo = PlayerInfoLib.Database.QueryByName(command[0], QueryType.Both, out totalRecods, true, (uint)page, perPage);
88-
}
89-
if (pInfo.Count > 0)
90-
{
91-
start = ((uint)page - 1) * perPage;
92-
UnturnedChat.Say(caller, PlayerInfoLib.Instance.Translate("number_of_records_found", totalRecods, command[0], page, Math.Ceiling(totalRecods / (float)perPage)), Color.red);
93-
foreach (PlayerData pData in pInfo)
94-
{
95-
start++;
96-
if (pData.IsLocal())
97-
{
98-
UnturnedChat.Say(caller, string.Format("{0}: {1} [{2}] ({3}), IP: {4}, Local: {5}, IsVip: {6}", start, caller is ConsolePlayer ? pData.CharacterName : pData.CharacterName.Truncate(12), caller is ConsolePlayer ? pData.SteamName : pData.SteamName.Truncate(12), pData.SteamID, pData.IP, pData.IsLocal(), pData.IsVip()), Color.yellow);
99-
UnturnedChat.Say(caller, string.Format("Seen: {0}, TT: {1}, Cleaned:{2}:{3}", pData.LastLoginLocal, pData.TotalPlayime.FormatTotalTime(), pData.CleanedBuildables, pData.CleanedPlayerData), Color.yellow);
100-
}
101-
else
102-
{
103-
UnturnedChat.Say(caller, string.Format("{0}: {1} [{2}] ({3}), IP: {4}, Local: {5}", start, caller is ConsolePlayer ? pData.CharacterName : pData.CharacterName.Truncate(12), caller is ConsolePlayer ? pData.SteamName : pData.SteamName.Truncate(12), pData.SteamID, pData.IP, pData.IsLocal()), Color.yellow);
104-
UnturnedChat.Say(caller, string.Format("Seen: {0}, TT: {1}, on: {2}:{3}", pData.LastLoginLocal, pData.TotalPlayime.FormatTotalTime(), pData.LastServerID, pData.LastServerName), Color.yellow);
105-
}
106-
}
107-
}
108-
else
109-
{
110-
UnturnedChat.Say(caller, "No players found by that name.");
111-
return;
112-
}
113-
}
114-
}
115-
}
116-
}
1+
using Rocket.API;
2+
using Rocket.API.Extensions;
3+
using Rocket.Unturned.Chat;
4+
using SDG.Unturned;
5+
using Steamworks;
6+
using System;
7+
using System.Collections.Generic;
8+
using UnityEngine;
9+
10+
namespace PlayerInfoLibrary
11+
{
12+
public class CommandInvestigate : IRocketCommand
13+
{
14+
internal static readonly string syntax = "<\"Player name\" | SteamID> [page]";
15+
internal static readonly string help = "Returns info for players matching the search quarry.";
16+
public List<string> Aliases
17+
{
18+
get { return new List<string>(); }
19+
}
20+
21+
public AllowedCaller AllowedCaller
22+
{
23+
get { return AllowedCaller.Both; }
24+
}
25+
26+
public string Help
27+
{
28+
get { return help; }
29+
}
30+
31+
public string Name
32+
{
33+
get { return "investigate"; }
34+
}
35+
36+
public List<string> Permissions
37+
{
38+
get { return new List<string> { "PlayerInfoLib.Ivestigate" }; }
39+
}
40+
41+
public string Syntax
42+
{
43+
get { return syntax; }
44+
}
45+
46+
public void Execute(IRocketPlayer caller, string[] command)
47+
{
48+
if (command.Length == 0)
49+
{
50+
UnturnedChat.Say(caller, PlayerInfoLib.Instance.Translate("investigate_help"));
51+
}
52+
CSteamID cSteamID;
53+
uint totalRecods = 1;
54+
uint? page = 1;
55+
uint start = 0;
56+
uint perPage = caller is ConsolePlayer ? 10u : 4u;
57+
List<PlayerData> pInfo = new List<PlayerData>();
58+
if (command.Length >= 1)
59+
{
60+
if (command.Length ==2)
61+
{
62+
page = command.GetUInt32Parameter(1);
63+
if (page == null || page == 0)
64+
{
65+
UnturnedChat.Say(caller, PlayerInfoLib.Instance.Translate("invalid_page"));
66+
return;
67+
}
68+
}
69+
if (command.Length > 2)
70+
{
71+
UnturnedChat.Say(caller, PlayerInfoLib.Instance.Translate("too_many_parameters"));
72+
return;
73+
}
74+
// Is what is entered in the command a SteamID64 number?
75+
if (command[0].isCSteamID(out cSteamID))
76+
{
77+
PlayerData pData = PlayerInfoLib.Database.QueryById(cSteamID);
78+
if(pData.IsValid())
79+
pInfo.Add(pData);
80+
}
81+
else if(Parser.checkIP(command[0]))
82+
{
83+
pInfo = PlayerInfoLib.Database.QueryByName(command[0], QueryType.IP, out totalRecods, true, (uint)page, perPage);
84+
}
85+
else
86+
{
87+
pInfo = PlayerInfoLib.Database.QueryByName(command[0], QueryType.Both, out totalRecods, true, (uint)page, perPage);
88+
}
89+
if (pInfo.Count > 0)
90+
{
91+
start = ((uint)page - 1) * perPage;
92+
UnturnedChat.Say(caller, PlayerInfoLib.Instance.Translate("number_of_records_found", totalRecods, command[0], page, Math.Ceiling(totalRecods / (float)perPage)), Color.red);
93+
foreach (PlayerData pData in pInfo)
94+
{
95+
start++;
96+
if (pData.IsLocal())
97+
{
98+
UnturnedChat.Say(caller, string.Format("{0}: {1} [{2}] ({3}), IP: {4}, Local: {5}, IsVip: {6}", start, caller is ConsolePlayer ? pData.CharacterName : pData.CharacterName.Truncate(12), caller is ConsolePlayer ? pData.SteamName : pData.SteamName.Truncate(12), pData.SteamID, pData.IP, pData.IsLocal(), pData.IsVip()), Color.yellow);
99+
UnturnedChat.Say(caller, string.Format("Seen: {0}, TT: {1}, Cleaned:{2}:{3}", pData.LastLoginLocal, pData.TotalPlayime.FormatTotalTime(), pData.CleanedBuildables, pData.CleanedPlayerData), Color.yellow);
100+
}
101+
else
102+
{
103+
UnturnedChat.Say(caller, string.Format("{0}: {1} [{2}] ({3}), IP: {4}, Local: {5}", start, caller is ConsolePlayer ? pData.CharacterName : pData.CharacterName.Truncate(12), caller is ConsolePlayer ? pData.SteamName : pData.SteamName.Truncate(12), pData.SteamID, pData.IP, pData.IsLocal()), Color.yellow);
104+
UnturnedChat.Say(caller, string.Format("Seen: {0}, TT: {1}, on: {2}:{3}", pData.LastLoginLocal, pData.TotalPlayime.FormatTotalTime(), pData.LastServerID, pData.LastServerName), Color.yellow);
105+
}
106+
}
107+
}
108+
else
109+
{
110+
UnturnedChat.Say(caller, "No players found by that name.");
111+
return;
112+
}
113+
}
114+
}
115+
}
116+
}

0 commit comments

Comments
 (0)