Code formatiert

This commit is contained in:
Lennart Kampshoff
2019-12-21 14:03:06 +01:00
parent c5f72c2ce5
commit ed95acc24d
56 changed files with 1771 additions and 1764 deletions

View File

@@ -14,7 +14,7 @@ namespace ReallifeGamemode.Server.Gangwar
{
public class Turf
{
public int TurfID { get; set; }
public string TurfName { get; set; }
public int Color { get; set; }
@@ -68,7 +68,7 @@ namespace ReallifeGamemode.Server.Gangwar
{
return this.Attacker;
}
private void TurfTick()
{
this.timer = new System.Timers.Timer(1000);
@@ -81,7 +81,7 @@ namespace ReallifeGamemode.Server.Gangwar
private void Tick(object sender, System.Timers.ElapsedEventArgs e)
{
if(this.status == "attack")
if (this.status == "attack")
{
update();
}
@@ -120,16 +120,17 @@ namespace ReallifeGamemode.Server.Gangwar
if (this.Def_Score <= 0)
{
this.takeOver(this.Attacker);
} else if (this.Att_Score <= 0)
}
else if (this.Att_Score <= 0)
{
this.takeOver(this.Owner);
}
timerCount += 1;
if(timerCount >= 60) //change to 900 before release
if (timerCount >= 60) //change to 900 before release
{
this.timer.Stop();
this.timer = null;
if(this.Def_Score > this.Att_Score)
if (this.Def_Score > this.Att_Score)
{
this.takeOver(this.Owner);
this.Att_Score = 0;
@@ -137,7 +138,8 @@ namespace ReallifeGamemode.Server.Gangwar
{
gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, 0, 0);
}
}else if(this.Def_Score < this.Att_Score)
}
else if (this.Def_Score < this.Att_Score)
{
this.takeOver(this.Attacker);
this.Def_Score = 0;
@@ -147,7 +149,7 @@ namespace ReallifeGamemode.Server.Gangwar
}
return;
}
else if(this.Def_Score == this.Att_Score)
else if (this.Def_Score == this.Att_Score)
{
this.takeOver(this.Attacker);
this.Def_Score = 0;
@@ -177,8 +179,9 @@ namespace ReallifeGamemode.Server.Gangwar
return;
}
}
if(playerInside.Find(c => c == client) == null) {
if (playerInside.Find(c => c == client) == null)
{
playerInside.Add(client);
client.SetData("GotInsideOfTurf", true);
}
@@ -186,10 +189,10 @@ namespace ReallifeGamemode.Server.Gangwar
public void leave(Client client)
{
if(playerInside.Find(c => c == client) != null)
if (playerInside.Find(c => c == client) != null)
{
this.playerInside = this.playerInside.Where(c => c != client).ToList();
if(this.status != "attack")
if (this.status != "attack")
client.ResetData("GotInsideOfTurf");
}
}
@@ -213,7 +216,7 @@ namespace ReallifeGamemode.Server.Gangwar
a.TriggerEvent("CLIENT:loose");
}
ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion hat erfolgreich das Gebiet ~g~" + getName() + "~w~ verteidigt.", dbContext.Factions.Where(f => f.Name == getOwner()).FirstOrDefault());
ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion hat den Angrif auf das Gebiet ~r~" + getName() + "~w~ verloren.", dbContext.Factions.Where(f => f.Name == getAttacker()).FirstOrDefault());
ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion hat den Angrif auf das Gebiet ~r~" + getName() + "~w~ verloren.", dbContext.Factions.Where(f => f.Name == getAttacker()).FirstOrDefault());
}
else if (getOwner() != FactionName)
{
@@ -239,10 +242,10 @@ namespace ReallifeGamemode.Server.Gangwar
turf.FactionId = dbContext.Factions.Where(f => f.Name == this.Owner).FirstOrDefault().Id;
dbContext.SaveChanges();
}
}
this.Attacker = null;
foreach(var c in playerInGangwar)
foreach (var c in playerInGangwar)
{
c.TriggerEvent("CLIENT:setAttackBlip", false, TurfID);
c.ResetData("inGangWar");
@@ -255,9 +258,9 @@ namespace ReallifeGamemode.Server.Gangwar
public void attack(string attacker)
{
if(this.status == "normal")
if (this.status == "normal")
{
if(this.timer != null)
if (this.timer != null)
{
this.timer.Stop();
this.timer = null;
@@ -274,7 +277,7 @@ namespace ReallifeGamemode.Server.Gangwar
u.TriggerEvent("CLIENT:setAttackBlip", true, TurfID);
u.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score);
u.SetData("inGangWar", getId());
ChatService.SendMessage(u, "~y~[GANGWAR]~w~ Die " + getAttacker() + " hat das Gebiet ~y~"+ TurfName +"~w~ der "+ getOwner() +" angegriffen.");
ChatService.SendMessage(u, "~y~[GANGWAR]~w~ Die " + getAttacker() + " hat das Gebiet ~y~" + TurfName + "~w~ der " + getOwner() + " angegriffen.");
clientsInGangwar.Add(u);
}
playerInGangwar = clientsInGangwar.ToArray();