Gangwar: Meldung an alle bei Start/Ende

This commit is contained in:
hydrant
2021-04-25 13:33:06 +02:00
parent 97ead73242
commit 49255eafd2

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -259,10 +259,13 @@ namespace ReallifeGamemode.Server.Gangwar
return; return;
} }
string takeOverMessage = string.Empty;
if (getOwner() == FactionName) if (getOwner() == FactionName)
{ {
ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion hat erfolgreich das Gebiet ~g~" + getName() + "~w~ verteidigt.", ownerFaction); takeOverMessage = $"~y~[GANGWAR] ~w~Die {getOwner()} konnten ihr Gebiet ~g~{getName()} ~w~ erfolgreich gegen die {getAttacker()} verteidigen.";
ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion hat den Angrif auf das Gebiet ~r~" + getName() + "~w~ verloren.", attackerFaction); //ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion hat erfolgreich das Gebiet ~g~" + getName() + "~w~ verteidigt.", ownerFaction);
//ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion hat den Angrif auf das Gebiet ~r~" + getName() + "~w~ verloren.", attackerFaction);
foreach (var o in owners) foreach (var o in owners)
{ {
@@ -276,8 +279,9 @@ namespace ReallifeGamemode.Server.Gangwar
} }
else if (getOwner() != FactionName) else if (getOwner() != FactionName)
{ {
ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion konnte das Gebiet ~r~" + getName() + "~w~ nicht verteidigen.", ownerFaction); takeOverMessage = $"~y~[GANGWAR] ~w~Die {getAttacker()} konnten das Gebiet ~g~{getName()} ~w~ der {getAttacker()} erfolgreich erobern.";
ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion konnte erfolgreich das Gebiet ~g~" + getName() + "~w~ erobern.", attackerFaction); //ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion konnte das Gebiet ~r~" + getName() + "~w~ nicht verteidigen.", ownerFaction);
//ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion konnte erfolgreich das Gebiet ~g~" + getName() + "~w~ erobern.", attackerFaction);
foreach (var o in owners) foreach (var o in owners)
{ {
if (o != null) if (o != null)
@@ -294,6 +298,7 @@ namespace ReallifeGamemode.Server.Gangwar
turf.Owner = this.Owner; turf.Owner = this.Owner;
turf.FactionId = attackerFaction.Id; turf.FactionId = attackerFaction.Id;
} }
ChatService.Broadcast(takeOverMessage);
dbContext.SaveChanges(); dbContext.SaveChanges();
} }
this.Attacker = null; this.Attacker = null;
@@ -358,9 +363,11 @@ namespace ReallifeGamemode.Server.Gangwar
u.TriggerEvent("CLIENT:setAttackBlip", true, TurfID); u.TriggerEvent("CLIENT:setAttackBlip", true, TurfID);
u.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score); u.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score);
u.SetData("inGangWar", getId()); u.SetData("inGangWar", getId());
ChatService.SendMessage(u, "~y~[GANGWAR]~w~ Die " + getAttacker() + " haben das Gebiet ~y~" + TurfName + "~w~ der " + getOwner() + " angegriffen.");
clientsInGangwar.Add(u); clientsInGangwar.Add(u);
} }
ChatService.Broadcast("~y~[GANGWAR]~w~ Die " + getAttacker() + " haben das Gebiet ~y~" + TurfName + "~w~ der " + getOwner() + " angegriffen.");
playerInGangwar = clientsInGangwar.ToArray(); 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)); NAPI.ClientEvent.TriggerClientEventForAll("CLIENT:Turf_Update", JsonConvert.SerializeObject(this.TurfID), JsonConvert.SerializeObject(this.status), JsonConvert.SerializeObject(this.Owner), JsonConvert.SerializeObject(this.Attacker));
this.TurfTick(); this.TurfTick();