Skip to content

Commit

Permalink
Merged branch develop and master together
Browse files Browse the repository at this point in the history
  • Loading branch information
UserR00T committed Jun 29, 2018
1 parent cc1cdf3 commit 4e84fdc
Show file tree
Hide file tree
Showing 78 changed files with 1,435 additions and 1,795 deletions.
19 changes: 9 additions & 10 deletions source/BP-Essentials/BP-Essentials.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<ItemGroup>
<Compile Include="Chat\Commands\Admin\Arrest.cs" />
<Compile Include="Chat\Commands\Admin\CheckAlts.cs" />
<Compile Include="Chat\Commands\Admin\Clear.cs" />
<Compile Include="Chat\Commands\Admin\ClearWanted.cs" />
<Compile Include="Chat\Commands\Admin\FakeJoin.cs" />
<Compile Include="Chat\Commands\Admin\FakeLeave.cs" />
Expand All @@ -58,11 +59,15 @@
<Compile Include="Chat\Commands\Admin\LatestVoteResults.cs" />
<Compile Include="Chat\Commands\Admin\Launch.cs" />
<Compile Include="Chat\Commands\Admin\Money.cs" />
<Compile Include="Chat\Commands\Admin\Promote.cs" />
<Compile Include="Chat\Commands\Admin\Restrain.cs" />
<Compile Include="Chat\Commands\Admin\Say.cs" />
<Compile Include="Chat\Commands\Admin\Search.cs" />
<Compile Include="Chat\Commands\Admin\Spy.cs" />
<Compile Include="Chat\Commands\Admin\ToggleReceiveStaffChat.cs" />
<Compile Include="Chat\Commands\Admin\ToggleStaffChat.cs" />
<Compile Include="Chat\Commands\Admin\TpHere.cs" />
<Compile Include="Chat\Commands\Admin\TpToApartment.cs" />
<Compile Include="Chat\Commands\Admin\_SetJob.cs" />
<Compile Include="Chat\Commands\Admin\Slap.cs" />
<Compile Include="Chat\Commands\Admin\Strip.cs" />
Expand All @@ -73,7 +78,6 @@
<Compile Include="Chat\Commands\Admin\DebugCommands.cs" />
<Compile Include="Chat\Commands\Everyone\Confirm.cs" />
<Compile Include="Chat\Commands\Everyone\Essentials.cs" />
<Compile Include="Chat\Commands\Admin\ExecuteOnPlayer.cs" />
<Compile Include="Chat\Commands\Admin\GodMode.cs" />
<Compile Include="Chat\Commands\Admin\Mute.cs" />
<Compile Include="Chat\Commands\Everyone\OnlinePlayers.cs" />
Expand All @@ -92,15 +96,18 @@
<Compile Include="Chat\Announce.cs" />
<Compile Include="Methods\API\DownloadFile.cs" />
<Compile Include="Methods\API\FilterComments.cs" />
<Compile Include="Methods\API\GetShByStr.cs" />
<Compile Include="Methods\API\GetShBySv.cs" />
<Compile Include="Methods\API\HasPermission.cs" />
<Compile Include="Methods\API\SendDiscordMessage.cs" />
<Compile Include="Methods\API\StringToVar.cs" />
<Compile Include="Methods\Check\CheckAltAcc.cs" />
<Compile Include="Methods\Check\CheckBanned.cs" />
<Compile Include="Methods\FileHandler\CheckFiles.cs" />
<Compile Include="Methods\Check\CheckGodMode.cs" />
<Compile Include="Methods\FileHandler\CreateFile.cs" />
<Compile Include="Methods\FileHandler\ReadGroups.cs" />
<Compile Include="Methods\FileHandler\RegisterCommands.cs" />
<Compile Include="Methods\GameMethods\CleanupApartment.cs" />
<Compile Include="Methods\GameMethods\SetJob.cs" />
<Compile Include="Methods\GameMethods\UnRetain.cs" />
Expand Down Expand Up @@ -138,11 +145,7 @@
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Runtime.Serialization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Unity Full v3.5\System.Runtime.Serialization.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\BrokeProtocol_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -291,10 +294,6 @@
<ItemGroup>
<None Include="BP-Essentials.ruleset" />
</ItemGroup>
<ItemGroup>
<Content Include="Newtonsoft.Json.dll" />
<Content Include="System.Runtime.Serialization.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 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.
Expand Down
11 changes: 5 additions & 6 deletions source/BP-Essentials/Chat/Announce.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using static BP_Essentials.EssentialsVariablesPlugin;
using static BP_Essentials.EssentialsMethodsPlugin;
using System.Threading;
using System.Timers;

namespace BP_Essentials.Chat
{
Expand All @@ -17,10 +16,9 @@ public static void Run(object man)
try
{
var svManager = (SvManager)man;
var Tmer = new System.Timers.Timer();
Tmer.Elapsed += (sender, e) => OnTime(svManager);
Tmer.Interval = TimeBetweenAnnounce * 1000;
Tmer.Enabled = true;
_Timer.Elapsed += (sender, e) => OnTime(svManager);
_Timer.Interval = TimeBetweenAnnounce * 1000;
_Timer.Enabled = true;
}
catch (Exception ex)
{
Expand All @@ -32,7 +30,8 @@ private static void OnTime(object onetMan)
{
var svManager = (SvManager)onetMan;
foreach (var player in svManager.players)
player.svPlayer.SendToSelf(Channel.Reliable, ClPacket.GameMessage, Announcements[AnnounceIndex]);
foreach (var line in Announcements[AnnounceIndex].Split(new[] { "\\r\\n", "\\r", "\\n" }, StringSplitOptions.None))
player.Value.svPlayer.SendToSelf(Channel.Reliable, ClPacket.GameMessage, line);
Debug.Log($"{SetTimeStamp.Run()}[INFO] Announcement made...");
AnnounceIndex += 1;
if (AnnounceIndex > Announcements.Length - 1)
Expand Down
28 changes: 12 additions & 16 deletions source/BP-Essentials/Chat/Commands/Admin/Arrest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,23 @@ namespace BP_Essentials.Commands
{
class Arrest : EssentialsChatPlugin
{
public static bool Run(object oPlayer, string message)
public static void Run(SvPlayer player, string message)
{
try
string arg1 = GetArgument.Run(1, false, true, message);
if (!string.IsNullOrEmpty(arg1))
{
var player = (SvPlayer)oPlayer;
if (HasPermission.Run(player, CmdArrestExecutableBy))
var shPlayer = GetShByStr.Run(arg1);
if (shPlayer == null)
{
string arg1 = GetArgument.Run(1, false, true, message);
if (!string.IsNullOrEmpty(arg1))
ExecuteOnPlayer.Run(player, message, arg1);
else
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, ArgRequired);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, NotFoundOnline);
return;
}
else
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, MsgNoPerm);
}
catch (Exception ex)
{
ErrorLogging.Run(ex);
shPlayer.svPlayer.Restrain(shPlayer.manager.handcuffed);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Arrested</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}>.</color>");

}
return true;
else
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, ArgRequired);
}
}
}
36 changes: 19 additions & 17 deletions source/BP-Essentials/Chat/Commands/Admin/Ban.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
using System;
using static BP_Essentials.EssentialsVariablesPlugin;
namespace BP_Essentials.Commands {
public class Ban : EssentialsChatPlugin {
public static bool Run(object oPlayer, string message) {
try
public class Ban : EssentialsChatPlugin
{
public static void Run(SvPlayer player, string message)
{
var arg1 = GetArgument.Run(1, false, false, message);
var arg2 = GetArgument.Run(2, false, true, message);
if (!string.IsNullOrEmpty(arg1) || !string.IsNullOrEmpty(arg2))
{
var player = (SvPlayer)oPlayer;
if (HasPermission.Run(player, CmdBanExecutableBy))
var shPlayer = GetShByStr.Run(arg1, true);
if (shPlayer == null)
{
string arg1 = GetArgument.Run(1, false, true, message);
if (!string.IsNullOrEmpty(arg1))
ExecuteOnPlayer.Run(player, message, arg1);
else
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, ArgRequired);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, NotFoundOnlineIdOnly);
return;
}
else
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, MsgNoPerm);
LogMessage.LogOther($"{SetTimeStamp.Run()}[INFO] {shPlayer.username} Got banned by {player.playerData.username}");
player.SendToAll(Channel.Unsequenced, ClPacket.GameMessage, $"<color={argColor}>{shPlayer.username}</color> <color={warningColor}>Just got banned by</color> <color={argColor}>{player.playerData.username}</color>");
SendDiscordMessage.BanMessage(shPlayer.username, player.playerData.username, arg2);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Banned</color> <color={argColor}>{shPlayer.username}</color><color={infoColor}>. (Reason: {arg2})</color>");
player.svManager.AddBanned(shPlayer);
player.svManager.Disconnect(shPlayer.svPlayer.connection);
}
catch (Exception ex)
{
ErrorLogging.Run(ex);
}
return true;
else
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, ArgRequired);
}
}
}
81 changes: 33 additions & 48 deletions source/BP-Essentials/Chat/Commands/Admin/CheckAlts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,65 +11,50 @@ namespace BP_Essentials.Commands
{
class CheckAlts : EssentialsChatPlugin
{
public static bool Run(object oPlayer, string message)
public static void Run(SvPlayer player, string message)
{
try
var arg1 = GetArgument.Run(1, false, false, message);
var found = 0;
if (!String.IsNullOrEmpty(arg1))
{
var player = (SvPlayer)oPlayer;
if (HasPermission.Run(player, CmdCheckAltsExecutableBy))
var arg2 = GetArgument.Run(2, false, true, message);
if (arg1.Equals("ip", StringComparison.InvariantCultureIgnoreCase))
{
var arg1 = GetArgument.Run(1, false, false, message);
var found = 0;
if (!String.IsNullOrEmpty(arg1))
var content = "Possible accounts using the IP " + arg2 + ":\r\n\r\n";
var builder = new StringBuilder();
builder.Append(content);
foreach (var line in File.ReadAllLines(IpListFile))
{
var arg2 = GetArgument.Run(2, false, true, message);
if (arg1.Equals("ip", StringComparison.InvariantCultureIgnoreCase))
if (line.EndsWith(arg2))
{
var content = "Possible accounts using the IP " + arg2 + ":\r\n\r\n";
var builder = new StringBuilder();
builder.Append(content);
foreach (var line in File.ReadAllLines(IpListFile))
{
if (line.EndsWith(arg2))
{
++found;
builder.Append(line.Replace(": " + arg2, String.Empty) + "\r\n");
}
}
content = builder.ToString();
content += "\r\n\r\n" + arg2 + " occurred " + found + " times in the iplog file." + "\r\n";
player.SendToSelf(Channel.Reliable, ClPacket.ServerInfo, content);
++found;
builder.Append(line.Replace(": " + arg2, String.Empty) + "\r\n");
}
else if (arg1.Equals("ign", StringComparison.InvariantCultureIgnoreCase) || (arg1.Equals("player", StringComparison.InvariantCultureIgnoreCase)))
}
content = builder.ToString();
content += "\r\n\r\n" + arg2 + " occurred " + found + " times in the iplog file." + "\r\n";
player.SendToSelf(Channel.Reliable, ClPacket.ServerInfo, content);
}
else if (arg1.Equals("ign", StringComparison.InvariantCultureIgnoreCase) || (arg1.Equals(nameof(player), StringComparison.InvariantCultureIgnoreCase)))
{
var content = "Possible logins on the account " + arg2 + " using the following IP's:\r\n\r\n";
var builder = new StringBuilder();
builder.Append(content);
foreach (var line in File.ReadAllLines(IpListFile))
{
if (line.StartsWith(arg2 + ": "))
{
var content = "Possible logins on the account " + arg2 + " using the following IP's:\r\n\r\n";
var builder = new StringBuilder();
builder.Append(content);
foreach (var line in File.ReadAllLines(IpListFile))
{
if (line.StartsWith(arg2 + ": "))
{
++found;
builder.Append(line.Replace(arg2 + ": ", String.Empty) + "\r\n");
}
}
content = builder.ToString();
content = content + "\r\n\r\n" + arg2 + " occurred " + found + " times in the iplog file." + "\r\n";
player.SendToSelf(Channel.Reliable, ClPacket.ServerInfo, content);
++found;
builder.Append(line.Replace(arg2 + ": ", String.Empty) + "\r\n");
}
}
else
player.SendToSelf(Channel.Reliable, ClPacket.GameMessage, CmdCheckAlts + "[IP/IGN] [Arg2] Eg " + CmdCheckAlts + " ip 127.0.0.1");

content = builder.ToString();
content = content + "\r\n\r\n" + arg2 + " occurred " + found + " times in the iplog file." + "\r\n";
player.SendToSelf(Channel.Reliable, ClPacket.ServerInfo, content);
}
else
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, MsgNoPerm);
}
catch (Exception ex)
{
ErrorLogging.Run(ex);
}
return true;
else
player.SendToSelf(Channel.Reliable, ClPacket.GameMessage, GetArgument.Run(0, false,false,message) + "[IP/IGN] [Arg2] Eg " + GetArgument.Run(0,false,false,message) + " ip 127.0.0.1");
}
}
}
31 changes: 31 additions & 0 deletions source/BP-Essentials/Chat/Commands/Admin/Clear.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using static BP_Essentials.EssentialsVariablesPlugin;
namespace BP_Essentials.Commands
{
public class Clear : EssentialsChatPlugin
{
public static void Run(SvPlayer player, string message)
{
string arg1 = GetArgument.Run(1, false, true, message);
if (!string.IsNullOrEmpty(arg1))
{
var shPlayer = GetShByStr.Run(arg1);
if (shPlayer == null)
{
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, NotFoundOnline);
return;
}
var tempList = new List<InventoryItem>();
foreach (var item in shPlayer.myItems.Values)
tempList.Add(item);
for (int i = 0; i < tempList.Count; i++)
shPlayer.TransferItem(2, tempList[i].item.index, shPlayer.MyItemCount(tempList[i].item.index), true);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>You cleared the inventory of</color> <color={argColor}>{shPlayer.username}</color><color={infoColor}>.</color>");
shPlayer.svPlayer.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={warningColor}>Your inventory has been cleared by</color> <color={argColor}>{player.playerData.username}</color><color={warningColor}>.</color>");
}
else
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, ArgRequired);
}
}
}
49 changes: 17 additions & 32 deletions source/BP-Essentials/Chat/Commands/Admin/ClearWanted.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,27 @@ namespace BP_Essentials.Commands
{
class ClearWanted : EssentialsChatPlugin
{
public static bool Run(object oPlayer, string message)
public static void Run(SvPlayer player, string message)
{
try
bool found = false;
string arg1 = GetArgument.Run(1, false, true, message);
string msg;
if (String.IsNullOrEmpty(arg1))
{
var player = (SvPlayer)oPlayer;

if (HasPermission.Run(player, CmdClearWantedExecutableBy))
arg1 = player.playerData.username;
msg = "yourself";
}
foreach (var shPlayer in UnityEngine.Object.FindObjectsOfType<ShPlayer>())
if (shPlayer.username == arg1 && !shPlayer.svPlayer.IsServerside() || shPlayer.ID.ToString() == arg1.ToString() && !shPlayer.svPlayer.IsServerside())
{
bool found = false;
string arg1 = GetArgument.Run(1, false, true, message);
string msg;
if (String.IsNullOrEmpty(arg1))
{
arg1 = player.playerData.username;
msg = "yourself";
}
foreach (var shPlayer in UnityEngine.Object.FindObjectsOfType<ShPlayer>())
if (shPlayer.username == arg1 && shPlayer.IsRealPlayer() || shPlayer.ID.ToString() == arg1.ToString() && shPlayer.IsRealPlayer())
{
msg = shPlayer.username;
shPlayer.ClearCrimes();
shPlayer.svPlayer.SendToSelf(Channel.Reliable, 33, shPlayer.ID);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Cleared crimes of '" + msg + "'.</color>");
found = true;
}
if (!found)
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, NotFoundOnline);
msg = shPlayer.username;
shPlayer.ClearCrimes();
shPlayer.svPlayer.SendToSelf(Channel.Reliable, 33, shPlayer.ID);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Cleared crimes of '" + msg + "'.</color>");
found = true;
}
else
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, MsgNoPerm);
}
catch (Exception ex)
{
ErrorLogging.Run(ex);
}
return true;
if (!found)
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, NotFoundOnline);
}
}
}
Loading

0 comments on commit 4e84fdc

Please sign in to comment.