This commit is contained in:
Lukas Moungos
2019-12-01 18:50:42 +01:00
parent e81772d351
commit 4b45fdfc5e

View File

@@ -108,7 +108,10 @@ namespace ReallifeGamemode.Server.Gangwar
if(owners.Length < attackers.Length)
this.Def_Score -= attackers.Length - owners.Length;
*/
foreach (Client gangwarPlayer in this.playerInGangwar)
{
gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score);
}
if (this.Def_Score <= 0)
{
this.takeOver(this.Attacker);
@@ -172,7 +175,7 @@ namespace ReallifeGamemode.Server.Gangwar
turf.FactionId = dbContext.Factions.Where(f => f.Name == this.Owner).FirstOrDefault().Id;
dbContext.SaveChanges();
}
ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion hat erfolgreich das Gebiet ~g~" + getName() + "~w~ erobert.", dbContext.Factions.Where(f => f.Name == this.Owner).FirstOrDefault());
ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion konnte erfolgreich das Gebiet ~g~" + getName() + "~w~ verteidigen.", dbContext.Factions.Where(f => f.Name == this.Owner).FirstOrDefault());
}
this.Attacker = null;
foreach(var c in playerInGangwar)
@@ -203,6 +206,9 @@ namespace ReallifeGamemode.Server.Gangwar
Client[] usersInGangwar = NAPI.Pools.GetAllPlayers().Where(c => c.GetUser().Faction.Name == getOwner() || c.GetUser().Faction.Name == getAttacker()).ToArray();
foreach (var u in usersInGangwar)
{
Console.WriteLine(JsonConvert.SerializeObject(usersInGangwar));
Console.WriteLine(JsonConvert.SerializeObject(usersInGangwar.Length));
Console.WriteLine(JsonConvert.SerializeObject(u.Name));
u.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score);
u.SetData("inGangWar", getId());
clientsInGangwar.Add(u);
@@ -210,7 +216,6 @@ namespace ReallifeGamemode.Server.Gangwar
playerInGangwar = clientsInGangwar.ToArray();
}
NAPI.ClientEvent.TriggerClientEventForAll("CLIENT:Turf_Update", JsonConvert.SerializeObject(this.TurfID), JsonConvert.SerializeObject(this.status), JsonConvert.SerializeObject(this.Owner), JsonConvert.SerializeObject(this.Attacker));
this.TurfTick();
}
}
@@ -225,11 +230,6 @@ namespace ReallifeGamemode.Server.Gangwar
{
Att_Score -= 1;
}
foreach (Client gangwarPlayer in this.playerInGangwar)
{
gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score);
}
}
}
}