RAGE Multiplayer 1.1.0-DP Update
/freeze was obselete and removed /unfreeze was obselete and removed /spectate was obselete and removed
This commit is contained in:
@@ -9,23 +9,23 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Client Extension (ClientExtension.cs)
|
||||
* @overview Life of German Reallife - Player Extension (PlayerExtension.cs)
|
||||
* @author hydrant, Siga, aviate
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
namespace ReallifeGamemode.Server.Extensions
|
||||
{
|
||||
public static class ClientExtension
|
||||
public static class PlayerExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// Gibt das User-Objekt eines Client's zurück.
|
||||
/// Gibt nichts zurück, wenn der Client nicht eingeloggt ist
|
||||
/// Gibt das User-Objekt eines Player's zurück.
|
||||
/// Gibt nichts zurück, wenn der Player nicht eingeloggt ist
|
||||
/// </summary>
|
||||
/// <param name="client">Der Client, dessen User man bekommen möchte</param>
|
||||
/// <param name="client">Der Player, dessen User man bekommen möchte</param>
|
||||
/// <param name="context">Ein eventuell vorhandener Datenbank-Context, falls man Änderungen in der Datenbank vornehmen will</param>
|
||||
/// <returns></returns>
|
||||
public static User GetUser(this Client client, DatabaseContext context = null)
|
||||
public static User GetUser(this Player client, DatabaseContext context = null)
|
||||
{
|
||||
context = context ?? new DatabaseContext();
|
||||
if (!client.IsLoggedIn()) return null;
|
||||
@@ -55,16 +55,16 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gibt zurück, ob ein Client eingeloggt ist
|
||||
/// Gibt zurück, ob ein Player eingeloggt ist
|
||||
/// </summary>
|
||||
/// <param name="player">Der Client, dessen Login-Status man bekommen möchte</param>
|
||||
/// <param name="player">Der Player, dessen Login-Status man bekommen möchte</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsLoggedIn(this Client player)
|
||||
public static bool IsLoggedIn(this Player player)
|
||||
{
|
||||
return player.HasData("isLoggedIn") ? player.GetData("isLoggedIn") : false;
|
||||
return player.HasData("isLoggedIn") ? player.GetData<bool>("isLoggedIn") : false;
|
||||
}
|
||||
|
||||
public static Vector3 GetPositionFromPlayer(Client player, float distance, int offset = 0)
|
||||
public static Vector3 GetPositionFromPlayer(Player player, float distance, int offset = 0)
|
||||
{
|
||||
var pos = player.Position;
|
||||
var a = player.Heading + offset;
|
||||
@@ -78,8 +78,8 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
internal static T GetData<T>(this User user, string key, T nullValue)
|
||||
{
|
||||
key += "data_";
|
||||
if (!user.Client.HasData(key)) return nullValue;
|
||||
return JsonConvert.DeserializeObject<T>(user.Client.GetData(key));
|
||||
if (!user.Player.HasData(key)) return nullValue;
|
||||
return JsonConvert.DeserializeObject<T>(user.Player.GetData<dynamic>(key));
|
||||
}
|
||||
|
||||
internal static T GetData<T>(this User user, string key) => user.GetData<T>(key, default);
|
||||
@@ -87,10 +87,10 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
internal static void SetData(this User user, string key, object value)
|
||||
{
|
||||
key += "data_";
|
||||
user.Client.SetData(key, JsonConvert.SerializeObject(value));
|
||||
user.Player.SetData(key, JsonConvert.SerializeObject(value));
|
||||
}
|
||||
|
||||
internal static void GiveWanteds(this User user, Client cop, int amount, string reason)
|
||||
internal static void GiveWanteds(this User user, Player cop, int amount, string reason)
|
||||
{
|
||||
if (user.Wanteds + amount > 50)
|
||||
{
|
||||
@@ -104,9 +104,9 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
dbUser.Wanteds = newWanteds;
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
user.Client.SetSharedData("blipColor", 64);
|
||||
ChatService.SendMessage(user.Client, "!{#FF614A}Du hast ein Verbrechen begangen: " + reason + "" + (cop != null ? " | Gemeldet von: " + cop.Name + "." : ""));
|
||||
ChatService.SendMessage(user.Client, " !{#FFFF00}Fahnundgslevel:~s~ " + newWanteds);
|
||||
user.Player.SetSharedData("blipColor", 64);
|
||||
ChatService.SendMessage(user.Player, "!{#FF614A}Du hast ein Verbrechen begangen: " + reason + "" + (cop != null ? " | Gemeldet von: " + cop.Name + "." : ""));
|
||||
ChatService.SendMessage(user.Player, " !{#FFFF00}Fahnundgslevel:~s~ " + newWanteds);
|
||||
|
||||
foreach (var copPlayer in NAPI.Pools.GetAllPlayers())
|
||||
{
|
||||
@@ -146,7 +146,7 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
}
|
||||
}
|
||||
|
||||
public static void BanPlayer(this User user, Client admin, string reason, int mins)
|
||||
public static void BanPlayer(this User user, Player admin, string reason, int mins)
|
||||
{
|
||||
using (var banUserContext = new DatabaseContext())
|
||||
{
|
||||
@@ -158,7 +158,7 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
ChatService.Broadcast("!{#FF4040}[BAN] " + user.Name + " wurde von " + admin.Name + " permanent gebannt. [" + reason + "]");
|
||||
banUser = new Ban { UserId = user.Id, Reason = reason, BannedBy = admin.Name, Applied = unixTimestamp, UntilDateTime = unixTimestamp };
|
||||
|
||||
user.Client?.Kick();
|
||||
user.Player?.Kick();
|
||||
|
||||
mins--;
|
||||
}
|
||||
@@ -166,7 +166,7 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
{
|
||||
ChatService.Broadcast("!{#FF4040}[BAN] " + user.Name + " wurde von " + admin.Name + " für " + mins + " Minuten gebannt. [" + reason + "]");
|
||||
banUser = new Ban { UserId = user.Id, Reason = reason, BannedBy = admin.Name, Applied = unixTimestamp, UntilDateTime = unixTimestamp + mins * 60 };
|
||||
user.Client?.Kick();
|
||||
user.Player?.Kick();
|
||||
}
|
||||
|
||||
banUserContext.Bans.Add(banUser);
|
||||
|
||||
Reference in New Issue
Block a user