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:
Siga
2020-02-24 21:18:54 +01:00
parent 0d5731fb11
commit edf06f4478
85 changed files with 804 additions and 643 deletions

View File

@@ -32,12 +32,12 @@ namespace ReallifeGamemode.Server.Gangwar
}
}
public static void loadClient(Client client)
public static void loadPlayer(Player client)
{
client.TriggerEvent("GangAreas:Create", JsonConvert.SerializeObject(turfs.ToArray()));
}
public static void loadTurfs_ToAllClients()
public static void loadTurfs_ToAllPlayers()
{
NAPI.ClientEvent.TriggerClientEventForAll("GangAreas:Create", JsonConvert.SerializeObject(turfs.ToArray()));
foreach(var l in NAPI.Pools.GetAllPlayers())
@@ -50,13 +50,13 @@ namespace ReallifeGamemode.Server.Gangwar
}
}
public static void GangwarKill(Client killer, Client victim)
public static void GangwarKill(Player killer, Player victim)
{
if (killer.HasData("GotInsideOfTurf") && victim.HasData("GotInsideOfTurf"))
{
foreach (var turf in getTurfs())
{
if (turf.getId() == victim.GetData("inGangWar"))
if (turf.getId() == victim.GetData<int>("inGangWar"))
{
turf.setKill(victim.GetUser().Faction.Name);
return;
@@ -71,7 +71,7 @@ namespace ReallifeGamemode.Server.Gangwar
}
[RemoteEvent("Gangarea:Enter")]
public void RmtEvent_TurfEnter(Client client, string jsonId)
public void RmtEvent_TurfEnter(Player client, string jsonId)
{
int id = JsonConvert.DeserializeObject<int>(jsonId);
@@ -86,7 +86,7 @@ namespace ReallifeGamemode.Server.Gangwar
}
[RemoteEvent("Gangarea:Leave")]
public void RmtEvent_TurfLeave(Client client, string jsonId)
public void RmtEvent_TurfLeave(Player client, string jsonId)
{
int id = JsonConvert.DeserializeObject<int>(jsonId);
@@ -101,7 +101,7 @@ namespace ReallifeGamemode.Server.Gangwar
}
[RemoteEvent("SERVER:SetTurf")]
public void RmtEvent_SetTurf(Client client, string jsonX, string jsonY, string jsonRot, string jsonRange, string Name)
public void RmtEvent_SetTurf(Player client, string jsonX, string jsonY, string jsonRot, string jsonRange, string Name)
{
float pX = JsonConvert.DeserializeObject<float>(jsonX);
float pY = (float)JsonConvert.DeserializeObject<float>(jsonY);
@@ -125,11 +125,11 @@ namespace ReallifeGamemode.Server.Gangwar
dbContext.SaveChanges();
}
loadTurfs();
loadTurfs_ToAllClients();
loadTurfs_ToAllPlayers();
}
[RemoteEvent("SERVER:DeleteTurf")]
public void RmtEvent_DeleteTurf(Client client, string jsonId)
public void RmtEvent_DeleteTurf(Player client, string jsonId)
{
int id = JsonConvert.DeserializeObject<int>(jsonId);
if (id == -1)
@@ -145,13 +145,13 @@ namespace ReallifeGamemode.Server.Gangwar
dbContext.Turfs.Remove(dturf);
dbContext.SaveChanges();
loadTurfs();
loadTurfs_ToAllClients();
loadTurfs_ToAllPlayers();
}
}
}
[RemoteEvent("SERVER:Turf_SetNewLeaderPoint")]
public void RmtEvent_SetNewLeaderPoint(Client client, string vector, string jsonId) {
public void RmtEvent_SetNewLeaderPoint(Player client, string vector, string jsonId) {
int id = JsonConvert.DeserializeObject<int>(jsonId);
if (id == -1)
{
@@ -166,14 +166,14 @@ namespace ReallifeGamemode.Server.Gangwar
dturf.Vector = vector;
dbContext.SaveChanges();
loadTurfs();
loadTurfs_ToAllClients();
loadTurfs_ToAllPlayers();
}
}
}
[RemoteEvent("SERVER:StartGangwar")]
public void RmtEvent_StartGangwar(Client client)
public void RmtEvent_StartGangwar(Player client)
{
if (!client.GetUser().FactionLeader)
return;

View File

@@ -23,9 +23,9 @@ namespace ReallifeGamemode.Server.Gangwar
public int Att_Score { get; set; }
public int Def_Score { get; set; }
public string status { get; set; }
public List<Client> playerInside { get; set; }
public List<Player> playerInside { get; set; }
public Timer timer { get; set; }
public Client[] playerInGangwar { get; set; }
public Player[] playerInGangwar { get; set; }
public int timerCount;
@@ -40,7 +40,7 @@ namespace ReallifeGamemode.Server.Gangwar
this.Def_Score = 50;
this.status = "normal";
this.timer = null;
this.playerInside = new List<Client>();
this.playerInside = new List<Player>();
this.timerCount = 0;
}
@@ -95,8 +95,8 @@ namespace ReallifeGamemode.Server.Gangwar
/*
try
{
Client[] owners = NAPI.Pools.GetAllPlayers().Where(c => c.GetUser().Faction.Name == this.Owner).ToArray();
Client[] attackers = NAPI.Pools.GetAllPlayers().Where(c => c.GetUser().Faction.Name == this.Attacker).ToArray();
Player[] owners = NAPI.Pools.GetAllPlayers().Where(c => c.GetUser().Faction.Name == this.Owner).ToArray();
Player[] attackers = NAPI.Pools.GetAllPlayers().Where(c => c.GetUser().Faction.Name == this.Attacker).ToArray();
}catch(NullReferenceException ex)
{
int i = 0;
@@ -115,7 +115,7 @@ namespace ReallifeGamemode.Server.Gangwar
this.Def_Score -= attackers.Length - owners.Length;
*/
#endregion
foreach (Client gangwarPlayer in this.playerInGangwar)
foreach (Player gangwarPlayer in this.playerInGangwar)
{
gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score);
}
@@ -131,7 +131,7 @@ namespace ReallifeGamemode.Server.Gangwar
{
if(this.Def_Score > this.Att_Score)
{
foreach (Client gangwarPlayer in this.playerInGangwar)
foreach (Player gangwarPlayer in this.playerInGangwar)
{
gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, 0, 0);
}
@@ -139,7 +139,7 @@ namespace ReallifeGamemode.Server.Gangwar
this.Att_Score = 0;
}else if(this.Def_Score < this.Att_Score)
{
foreach (Client gangwarPlayer in this.playerInGangwar)
foreach (Player gangwarPlayer in this.playerInGangwar)
{
gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, 0, 0);
}
@@ -149,7 +149,7 @@ namespace ReallifeGamemode.Server.Gangwar
}
else if(this.Def_Score == this.Att_Score)
{
foreach (Client gangwarPlayer in this.playerInGangwar)
foreach (Player gangwarPlayer in this.playerInGangwar)
{
gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, 0, 0);
}
@@ -161,14 +161,14 @@ namespace ReallifeGamemode.Server.Gangwar
}
}
public void enter(Client client)
public void enter(Player client)
{
if (this.status == "attack")
{
if (client.GetUser().Faction.Name != getOwner() && client.GetUser().Faction.Name != getAttacker())
return;
Client gClient = playerInGangwar.Where(c => c.GetUser().Id == client.GetUser().Id).FirstOrDefault();
if (gClient == null)
Player gPlayer = playerInGangwar.Where(c => c.GetUser().Id == client.GetUser().Id).FirstOrDefault();
if (gPlayer == null)
{
using (var dbContext = new DatabaseContext())
{
@@ -185,7 +185,7 @@ namespace ReallifeGamemode.Server.Gangwar
}
}
public void leave(Client client)
public void leave(Player client)
{
if(playerInside.Find(c => c == client) != null)
{
@@ -203,8 +203,8 @@ namespace ReallifeGamemode.Server.Gangwar
{
if (getOwner() == FactionName)
{
Client[] owners = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && c.GetUser().Faction.Name == this.Owner).ToArray();
Client[] attackers = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && c.GetUser().Faction.Name == this.Attacker).ToArray();
Player[] owners = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && c.GetUser().Faction.Name == this.Owner).ToArray();
Player[] attackers = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && c.GetUser().Faction.Name == this.Attacker).ToArray();
foreach (var o in owners)
{
o.TriggerEvent("CLIENT:win");
@@ -219,8 +219,8 @@ namespace ReallifeGamemode.Server.Gangwar
else if (getOwner() != FactionName)
{
ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion konnte das Gebiet ~r~" + getName() + "~w~ nicht verteidigen.", dbContext.Factions.Where(f => f.Name == getOwner()).FirstOrDefault());
Client[] owners = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && c.GetUser().Faction.Name == this.Owner).ToArray();
Client[] attackers = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && c.GetUser().Faction.Name == this.Attacker).ToArray();
Player[] owners = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && c.GetUser().Faction.Name == this.Owner).ToArray();
Player[] attackers = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && c.GetUser().Faction.Name == this.Attacker).ToArray();
foreach (var o in owners)
{
o.TriggerEvent("CLIENT:loose");
@@ -247,7 +247,7 @@ namespace ReallifeGamemode.Server.Gangwar
}
this.playerInGangwar = null;
Gangwar.loadTurfs();
Gangwar.loadTurfs_ToAllClients();
Gangwar.loadTurfs_ToAllPlayers();
}
public void attack(string attacker)
@@ -263,9 +263,9 @@ namespace ReallifeGamemode.Server.Gangwar
this.status = "attack";
using (var context = new DatabaseContext())
{
List<Client> clientsInGangwar = new List<Client>();
List<Player> clientsInGangwar = new List<Player>();
Client[] usersInGangwar = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && (c.GetUser().Faction.Name == getOwner() || c.GetUser().Faction.Name == getAttacker())).ToArray();
Player[] usersInGangwar = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && (c.GetUser().Faction.Name == getOwner() || c.GetUser().Faction.Name == getAttacker())).ToArray();
foreach (var u in usersInGangwar)
{
u.TriggerEvent("CLIENT:setAttackBlip", true, TurfID);