Skip to content

Commit

Permalink
BPE 2.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
UserR00T committed Jul 31, 2018
1 parent e65a4c5 commit 1e63097
Show file tree
Hide file tree
Showing 90 changed files with 1,167 additions and 643 deletions.
17 changes: 14 additions & 3 deletions source/BP-Essentials/BP-Essentials.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<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\CreateKit.cs" />
<Compile Include="Chat\Commands\Admin\FakeJoin.cs" />
<Compile Include="Chat\Commands\Admin\FakeLeave.cs" />
<Compile Include="Chat\Commands\Admin\Feed.cs" />
Expand All @@ -63,10 +64,13 @@
<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\SpawnVehicle.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\TpAll.cs" />
<Compile Include="Chat\Commands\Admin\TpHere.cs" />
<Compile Include="Chat\Commands\Admin\TpLocation.cs" />
<Compile Include="Chat\Commands\Admin\TpToApartment.cs" />
<Compile Include="Chat\Commands\Admin\_SetJob.cs" />
<Compile Include="Chat\Commands\Admin\Slap.cs" />
Expand All @@ -80,6 +84,8 @@
<Compile Include="Chat\Commands\Everyone\Essentials.cs" />
<Compile Include="Chat\Commands\Admin\GodMode.cs" />
<Compile Include="Chat\Commands\Admin\Mute.cs" />
<Compile Include="Chat\Commands\Everyone\GetKit.cs" />
<Compile Include="Chat\Commands\Everyone\ListKits.cs" />
<Compile Include="Chat\Commands\Everyone\OnlinePlayers.cs" />
<Compile Include="Chat\Commands\Everyone\Pay.cs" />
<Compile Include="Chat\Commands\Admin\Reload.cs" />
Expand All @@ -94,23 +100,25 @@
<Compile Include="EssentialsVariables.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Chat\Announce.cs" />
<Compile Include="Methods\API\DownloadAndWriteToFile.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\CheckAutoReloadFile.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\Kits.cs" />
<Compile Include="Methods\FileHandler\RegisterCommands.cs" />
<Compile Include="Methods\GameMethods\CleanupApartment.cs" />
<Compile Include="Methods\GameMethods\GetExtraCount.cs" />
<Compile Include="Methods\GameMethods\SetJob.cs" />
<Compile Include="Methods\GameMethods\UnRetain.cs" />
<Compile Include="Methods\GameMethods\UnRestrain.cs" />
<Compile Include="Methods\misc\ErrorLogging.cs" />
<Compile Include="Methods\API\GetArgument.cs" />
<Compile Include="Chat\Commands\Admin\GetLogs.cs" />
Expand Down Expand Up @@ -284,6 +292,9 @@
<Reference Include="UnityEngine.VRModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\BrokeProtocol_Data\Managed\UnityEngine.VRModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.WebModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\BrokeProtocol_Data\Managed\UnityEngine.WebModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.WindModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\BrokeProtocol_Data\Managed\UnityEngine.WindModule.dll</HintPath>
</Reference>
Expand Down
2 changes: 1 addition & 1 deletion source/BP-Essentials/Chat/Announce.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private static void OnTime(object onetMan)
var svManager = (SvManager)onetMan;
foreach (var player in svManager.players)
foreach (var line in Announcements[AnnounceIndex].Split(new[] { "\\r\\n", "\\r", "\\n" }, StringSplitOptions.None))
player.Value.svPlayer.SendToSelf(Channel.Reliable, ClPacket.GameMessage, line);
player.Value.svPlayer.Send(SvSendType.Self, Channel.Reliable, ClPacket.GameMessage, line);
Debug.Log($"{SetTimeStamp.Run()}[INFO] Announcement made...");
AnnounceIndex += 1;
if (AnnounceIndex > Announcements.Length - 1)
Expand Down
7 changes: 4 additions & 3 deletions source/BP-Essentials/Chat/Commands/Admin/Arrest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ public static void Run(SvPlayer player, string message)
var shPlayer = GetShByStr.Run(arg1);
if (shPlayer == null)
{
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, NotFoundOnline);
player.Send(SvSendType.Self, Channel.Unsequenced, ClPacket.GameMessage, NotFoundOnline);
return;
}
shPlayer.svPlayer.Restrain(shPlayer.manager.handcuffed);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Arrested</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}>.</color>");
player.Send(SvSendType.Self, Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Arrested</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}>.</color>");

}
else
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, ArgRequired);
player.Send(SvSendType.Self, Channel.Unsequenced, ClPacket.GameMessage, ArgRequired);
player.Send(SvSendType.Self, Channel.Unsequenced, ClPacket.GameMessage, ArgRequired);
}
}
}
12 changes: 6 additions & 6 deletions source/BP-Essentials/Chat/Commands/Admin/Ban.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ 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))
if (!string.IsNullOrEmpty(arg1) && !string.IsNullOrEmpty(arg2))
{
var shPlayer = GetShByStr.Run(arg1, true);
if (shPlayer == null)
{
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, NotFoundOnlineIdOnly);
player.Send(SvSendType.Self, Channel.Unsequenced, ClPacket.GameMessage, NotFoundOnlineIdOnly);
return;
}
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>");
LogMessage.LogOther($"{SetTimeStamp.Run()}[INFO] {shPlayer.username} Got banned by {player.playerData.username} (Reason: {arg2}");
player.Send(SvSendType.All, Channel.Unsequenced, ClPacket.GameMessage, $"<color={argColor}>{shPlayer.username}</color> <color={warningColor}>Just got banned by</color> <color={argColor}>{player.playerData.username}</color> <color={warningColor}>(Reason: <color={argColor}>{arg2}</color><color={warningColor}>)</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.Send(SvSendType.Self, 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);
}
else
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, ArgRequired);
player.Send(SvSendType.Self, Channel.Unsequenced, ClPacket.GameMessage, ArgRequired);
}
}
}
6 changes: 3 additions & 3 deletions source/BP-Essentials/Chat/Commands/Admin/CheckAlts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static void Run(SvPlayer player, string message)
}
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);
player.Send(SvSendType.Self, Channel.Reliable, ClPacket.ServerInfo, content);
}
else if (arg1.Equals("ign", StringComparison.InvariantCultureIgnoreCase) || (arg1.Equals(nameof(player), StringComparison.InvariantCultureIgnoreCase)))
{
Expand All @@ -50,11 +50,11 @@ public static void Run(SvPlayer player, string message)
}
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);
player.Send(SvSendType.Self, Channel.Reliable, ClPacket.ServerInfo, content);
}
}
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");
player.Send(SvSendType.Self, 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");
}
}
}
8 changes: 4 additions & 4 deletions source/BP-Essentials/Chat/Commands/Admin/Clear.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ public static void Run(SvPlayer player, string message)
var shPlayer = GetShByStr.Run(arg1);
if (shPlayer == null)
{
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, NotFoundOnline);
player.Send(SvSendType.Self, 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>");
player.Send(SvSendType.Self, Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>You cleared the inventory of</color> <color={argColor}>{shPlayer.username}</color><color={infoColor}>.</color>");
shPlayer.svPlayer.Send(SvSendType.Self, 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);
player.Send(SvSendType.Self, Channel.Unsequenced, ClPacket.GameMessage, ArgRequired);
}
}
}
6 changes: 3 additions & 3 deletions source/BP-Essentials/Chat/Commands/Admin/ClearWanted.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public static void Run(SvPlayer player, string message)
{
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>");
shPlayer.svPlayer.Send(SvSendType.Self, Channel.Reliable, 33, shPlayer.ID);
player.Send(SvSendType.Self, Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Cleared crimes of '" + msg + "'.</color>");
found = true;
}
if (!found)
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, NotFoundOnline);
player.Send(SvSendType.Self, Channel.Unsequenced, ClPacket.GameMessage, NotFoundOnline);
}
}
}
36 changes: 36 additions & 0 deletions source/BP-Essentials/Chat/Commands/Admin/CreateKit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using static BP_Essentials.EssentialsVariablesPlugin;
using System;
using static BP_Essentials.EssentialsMethodsPlugin;
using System.IO;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace BP_Essentials.Commands
{
public class CreateKit : 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.Trim()) || string.IsNullOrEmpty(arg2.Trim()))
{
player.Send(SvSendType.Self, Channel.Unsequenced, ClPacket.GameMessage, ArgRequired);
return;
}
if (!int.TryParse(arg1, out int arg1i))
{
player.Send(SvSendType.Self, Channel.Unsequenced, ClPacket.GameMessage, $"<color={errorColor}>Cannot convert {arg1} to a integer.</color>");
return;
}
var file = Path.Combine(KitDirectory, $"{arg2}.json");
if (File.Exists(file))
{
player.Send(SvSendType.Self, Channel.Unsequenced, ClPacket.GameMessage, $"<color={errorColor}>A kit already exists with that name.</color>");
return;
}
Kits.CreateKit(player, arg2, arg1i, file);
player.Send(SvSendType.Self, Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Kit created. Please edit </color><color={argColor}>{file}</color> <color={infoColor}>to add ExecuteableBy.</color>");
}
}
}
Loading

0 comments on commit 1e63097

Please sign in to comment.