Skip to content

Commit

Permalink
Updated to game version 0.78 and fixed a few bugs
Browse files Browse the repository at this point in the history
* Updated to game version 0.78
* Fixed bug with auto saving every x minutes
* Changed most GameMessage and ServerInfo messages to the ClPacket class, if Nong decides to change them
  • Loading branch information
UserR00T committed May 16, 2018
1 parent a8f1999 commit 3727948
Show file tree
Hide file tree
Showing 50 changed files with 289 additions and 251 deletions.
1 change: 1 addition & 0 deletions source/BP-Essentials/BP-Essentials.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
<Compile Include="Chat\Announce.cs" />
<Compile Include="Methods\API\DownloadFile.cs" />
<Compile Include="Methods\API\FilterComments.cs" />
<Compile Include="Methods\API\GetShBySv.cs" />
<Compile Include="Methods\API\HasPermission.cs" />
<Compile Include="Methods\API\StringToVar.cs" />
<Compile Include="Methods\Check\CheckAltAcc.cs" />
Expand Down
1 change: 0 additions & 1 deletion source/BP-Essentials/Chat/Announce.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public static void Run(object man)
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]);
Debug.Log(SetTimeStamp.Run() + "[INFO] Announcement made...");
Expand Down
4 changes: 2 additions & 2 deletions source/BP-Essentials/Chat/Commands/Admin/Arrest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public static bool Run(object oPlayer, string message)
if (!string.IsNullOrEmpty(arg1))
ExecuteOnPlayer.Run(player, message, arg1);
else
player.SendToSelf(Channel.Unsequenced, 10, ArgRequired);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, ArgRequired);
}
else
player.SendToSelf(Channel.Unsequenced, 10, MsgNoPerm);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, MsgNoPerm);
}
catch (Exception ex)
{
Expand Down
4 changes: 2 additions & 2 deletions source/BP-Essentials/Chat/Commands/Admin/Ban.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ public static bool Run(object oPlayer, string message) {
if (!string.IsNullOrEmpty(arg1))
ExecuteOnPlayer.Run(player, message, arg1);
else
player.SendToSelf(Channel.Unsequenced, 10, ArgRequired);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, ArgRequired);
}
else
player.SendToSelf(Channel.Unsequenced, 10, MsgNoPerm);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, MsgNoPerm);
}
catch (Exception ex)
{
Expand Down
8 changes: 4 additions & 4 deletions source/BP-Essentials/Chat/Commands/Admin/CheckAlts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static bool Run(object oPlayer, string message)
}
content = builder.ToString();
content += "\r\n\r\n" + arg2 + " occurred " + found + " times in the iplog file." + "\r\n";
player.SendToSelf(Channel.Reliable, 50, content);
player.SendToSelf(Channel.Reliable, ClPacket.ServerInfo, content);
}
else if (arg1.Equals("ign", StringComparison.InvariantCultureIgnoreCase) || (arg1.Equals("player", StringComparison.InvariantCultureIgnoreCase)))
{
Expand All @@ -57,15 +57,15 @@ public static bool Run(object oPlayer, 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, 50, content);
player.SendToSelf(Channel.Reliable, ClPacket.ServerInfo, content);
}
}
else
player.SendToSelf(Channel.Reliable, 10, CmdCheckAlts + "[IP/IGN] [Arg2] Eg " + CmdCheckAlts + " ip 127.0.0.1");
player.SendToSelf(Channel.Reliable, ClPacket.GameMessage, CmdCheckAlts + "[IP/IGN] [Arg2] Eg " + CmdCheckAlts + " ip 127.0.0.1");

}
else
player.SendToSelf(Channel.Unsequenced, 10, MsgNoPerm);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, MsgNoPerm);
}
catch (Exception ex)
{
Expand Down
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 @@ -32,14 +32,14 @@ public static bool Run(object oPlayer, string message)
msg = shPlayer.username;
shPlayer.ClearCrimes();
shPlayer.svPlayer.SendToSelf(Channel.Reliable, 33, shPlayer.ID);
player.SendToSelf(Channel.Unsequenced, 10, $"<color={infoColor}>Cleared crimes of '" + msg + "'.</color>");
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Cleared crimes of '" + msg + "'.</color>");
found = true;
}
if (!found)
player.SendToSelf(Channel.Unsequenced, 10, NotFoundOnline);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, NotFoundOnline);
}
else
player.SendToSelf(Channel.Unsequenced, 10, MsgNoPerm);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, MsgNoPerm);
}
catch (Exception ex)
{
Expand Down
14 changes: 7 additions & 7 deletions source/BP-Essentials/Chat/Commands/Admin/DebugCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ public static bool Run(object oPlayer, string message)
{
string arg = GetArgument.Run(1, false, false, message).Trim().ToLower();
if (arg == "location" || arg == "getlocation")
player.SendToSelf(Channel.Unsequenced, 10, "Your location: " + shPlayer.GetPosition());
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, "Your location: " + shPlayer.GetPosition());
else if (arg == "getplayerhash" || arg == "gethash")
{
string arg2 = GetArgument.Run(2, false, true, message);
if (!String.IsNullOrEmpty(arg2))
player.SendToSelf(Channel.Unsequenced, 10, "Hash of " + arg2 + " : " + Animator.StringToHash(arg2).ToString());
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, "Hash of " + arg2 + " : " + Animator.StringToHash(arg2).ToString());
else
player.SendToSelf(Channel.Unsequenced, 10, "Invalid arguments. /debug get(player)hash [username]");
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, "Invalid arguments. /debug get(player)hash [username]");
}
else if (arg == "spaceindex" || arg == "getspaceindex")
{
Expand All @@ -40,18 +40,18 @@ public static bool Run(object oPlayer, string message)
if (shPlayer2.IsRealPlayer())
{
found = true;
player.SendToSelf(Channel.Unsequenced, 10, "SpaceIndex of '" + shPlayer2.svPlayer.playerData.username + "': " + shPlayer2.GetPlaceIndex());
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, "SpaceIndex of '" + shPlayer2.svPlayer.playerData.username + "': " + shPlayer2.GetPlaceIndex());
}
if (!found)
player.SendToSelf(Channel.Unsequenced, 10, "Invalid arguments (Or user is not found online.) /debug (get)spaceindex [username] ");
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, "Invalid arguments (Or user is not found online.) /debug (get)spaceindex [username] ");
}
else
player.SendToSelf(Channel.Unsequenced, 10, "Your SpaceIndex: " + shPlayer.GetPlaceIndex());
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, "Your SpaceIndex: " + shPlayer.GetPlaceIndex());
}
}
}
else
player.SendToSelf(Channel.Unsequenced, 10, MsgNoPerm);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, MsgNoPerm);
}
catch (Exception ex)
{
Expand Down
34 changes: 17 additions & 17 deletions source/BP-Essentials/Chat/Commands/Admin/ExecuteOnPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static bool Run(object oPlayer, string message, string arg1)
if (message.StartsWith(CmdKnockout) || message.StartsWith(CmdKnockout2))
{
shPlayer.svPlayer.SvForceStance(StanceIndex.KnockedOut);
player.SendToSelf(Channel.Unsequenced, 10, $"<color={infoColor}>Knocked out</color> <color={argColor}>{shPlayer.username}</color><color={infoColor}>.</color>");
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Knocked out</color> <color={argColor}>{shPlayer.username}</color><color={infoColor}>.</color>");
}
else if (message.StartsWith(CmdJail) || message.StartsWith(CmdJail2))
{
Expand All @@ -31,66 +31,66 @@ public static bool Run(object oPlayer, string message, string arg1)
{
if (SendToJail.Run(shPlayer, t))
{
shPlayer.svPlayer.SendToSelf(Channel.Unsequenced, 10, $"<color={argColor}>{shPlayer1.username}</color> <color={infoColor}>sent you to jail.</color>");
player.SendToSelf(Channel.Unsequenced, 10, $"<color={infoColor}>Sent</color> <color={argColor}>{shPlayer.username}</color> <color={infoColor}>To jail.</color>");
shPlayer.svPlayer.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={argColor}>{shPlayer1.username}</color> <color={infoColor}>sent you to jail.</color>");
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Sent</color> <color={argColor}>{shPlayer.username}</color> <color={infoColor}>To jail.</color>");
}
else
player.SendToSelf(Channel.Unsequenced, 10, $"<color={errorColor}>Cannot send </color> <color={argColor}>{shPlayer.username}</color> <color={errorColor}>To jail.</color>");
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={errorColor}>Cannot send </color> <color={argColor}>{shPlayer.username}</color> <color={errorColor}>To jail.</color>");
}
else
player.SendToSelf(Channel.Unsequenced, 10, ArgRequired);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, ArgRequired);
}
else if (message.StartsWith(CmdTpHere) || message.StartsWith(CmdTpHere2))
{
shPlayer.svPlayer.SvReset(shPlayer1.GetPosition(), shPlayer1.GetRotation(), shPlayer1.GetPlaceIndex());
shPlayer.svPlayer.SendToSelf(Channel.Unsequenced, 10, $"<color={argColor}>" + shPlayer1.username + $"</color><color={infoColor}> Teleported you to him.</color>");
player.SendToSelf(Channel.Unsequenced, 10, $"<color={infoColor}>Teleported</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}> To you.</color>");
shPlayer.svPlayer.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={argColor}>" + shPlayer1.username + $"</color><color={infoColor}> Teleported you to him.</color>");
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Teleported</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}> To you.</color>");
}
else if (message.StartsWith(CmdTp))
{
player.SvReset(shPlayer.GetPosition(), shPlayer.GetRotation(), shPlayer.GetPlaceIndex());
player.SendToSelf(Channel.Unsequenced, 10, $"<color={infoColor}>Teleported to</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}>.</color>");
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Teleported to</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}>.</color>");
}
else if (message.Contains(CmdBan))
{
player.svManager.AddBanned(shPlayer);
player.svManager.Disconnect(shPlayer.svPlayer.connection);
player.SendToSelf(Channel.Unsequenced, 10, $"<color={infoColor}>Banned</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}>.</color>");
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Banned</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}>.</color>");
}
else if (message.Contains(CmdKick))
{
player.svManager.Kick(shPlayer.svPlayer.connection);
player.SendToSelf(Channel.Unsequenced, 10, $"<color={infoColor}>Kicked</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}>.</color>");
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Kicked</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}>.</color>");
}
else if (message.Contains(CmdArrest))
{
shPlayer.svPlayer.Arrest();
player.SendToSelf(Channel.Unsequenced, 10, $"<color={infoColor}>Arrested</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}>.</color>");
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Arrested</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}>.</color>");
}
else if (message.Contains(CmdRestrain))
{
shPlayer.svPlayer.Arrest();
shPlayer.svPlayer.SvSetEquipable(shPlayer.manager.restrained.index);
if (!shPlayer.svPlayer.IsServerside())
shPlayer.svPlayer.SendToSelf(Channel.Unsequenced, 10, "You've been restrained");
player.SendToSelf(Channel.Unsequenced, 10, $"<color={infoColor}>Restrained</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}>.</color>");
shPlayer.svPlayer.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, "You've been restrained");
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Restrained</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}>.</color>");
}
else if (message.Contains(CmdKill))
{
shPlayer.svPlayer.SvSuicide();
player.SendToSelf(Channel.Unsequenced, 10, $"<color={infoColor}>Killed</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}>.</color>");
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Killed</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}>.</color>");
}
else if (message.Contains(CmdFree))
{
shPlayer.svPlayer.Unhandcuff();
player.SendToSelf(Channel.Unsequenced, 10, $"<color={infoColor}>Freed</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}>.</color>");
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={infoColor}>Freed</color> <color={argColor}>" + shPlayer.username + $"</color><color={infoColor}>.</color>");
}
found = true;
}
else
player.SendToSelf(Channel.Unsequenced, 10, $"<color={argColor}>" + arg1 + $"</color><color={errorColor}> Is not a real player.</color>");
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={argColor}>" + arg1 + $"</color><color={errorColor}> Is not a real player.</color>");
if (!(found))
player.SendToSelf(Channel.Unsequenced, 10, $"<color={argColor}>" + arg1 + $"</color><color={errorColor}> Is not online.</color>");
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"<color={argColor}>" + arg1 + $"</color><color={errorColor}> Is not online.</color>");
}
catch (Exception ex)
{
Expand Down
6 changes: 3 additions & 3 deletions source/BP-Essentials/Chat/Commands/Admin/FakeJoin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ public static bool Run(object oPlayer, string message)
string arg1 = GetArgument.Run(1, false, true, message);
if (!String.IsNullOrEmpty(arg1))
{
player.SendToAll(Channel.Unsequenced, 10, arg1 + " connected");
player.SendToAll(Channel.Unsequenced, ClPacket.GameMessage, arg1 + " connected");
}
else
player.SendToSelf(Channel.Unsequenced, 10, ArgRequired);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, ArgRequired);
}
else
player.SendToSelf(Channel.Unsequenced, 10, MsgNoPerm);
player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, MsgNoPerm);
}
catch (Exception ex)
{
Expand Down
Loading

0 comments on commit 3727948

Please sign in to comment.