diff --git a/ReallifeGamemode.Database/Entities/Faction.cs b/ReallifeGamemode.Database/Entities/Faction.cs index a0291a0f..5e600b89 100644 --- a/ReallifeGamemode.Database/Entities/Faction.cs +++ b/ReallifeGamemode.Database/Entities/Faction.cs @@ -19,6 +19,8 @@ namespace ReallifeGamemode.Database.Entities [StringLength(32)] public string Name { get; set; } public bool StateOwned { get; set; } + + public bool GangOwned { get; set; } public int WeaponDealTime { get; set; } = 60; public override string BankAccountName => Name; diff --git a/ReallifeGamemode.Server/Commands/FactionCommands.cs b/ReallifeGamemode.Server/Commands/FactionCommands.cs index c05429b8..18e4a5d8 100644 --- a/ReallifeGamemode.Server/Commands/FactionCommands.cs +++ b/ReallifeGamemode.Server/Commands/FactionCommands.cs @@ -53,7 +53,10 @@ namespace ReallifeGamemode.Server.Commands message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", ""); string broadcastMessage = "!{FF0000}** " + player.GetUser().GetFactionRank().RankName + " " + player.Name + ": " + message + " )) **"; - ChatService.BroadcastFaction(broadcastMessage, f); + using (var context = new DatabaseContext()) + { + ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.GangOwned)); + } } else { diff --git a/ReallifeGamemode.Server/Gangwar/Turf.cs b/ReallifeGamemode.Server/Gangwar/Turf.cs index 8828a401..f9a41bff 100644 --- a/ReallifeGamemode.Server/Gangwar/Turf.cs +++ b/ReallifeGamemode.Server/Gangwar/Turf.cs @@ -40,8 +40,8 @@ namespace ReallifeGamemode.Server.Gangwar this.maxValue = maxValue; this.surplus = surplus; this.Attacker = null; - this.Att_Score = 50; - this.Def_Score = 50; + this.Att_Score = 1; + this.Def_Score = 0; this.status = "normal"; this.timer = null; this.playerInside = new List(); @@ -154,27 +154,18 @@ namespace ReallifeGamemode.Server.Gangwar { gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score); } - if (this.Def_Score <= 0) + if (this.Att_Score >= 5) { this.takeOver(this.Attacker); } - else if (this.Att_Score <= 0) + else if (this.Def_Score >= 5) { this.takeOver(this.Owner); } timerCount += 1; if (timerCount >= 900) //change to 900 (seconds) before release for testing reasons change to whatever you like { - if (this.Def_Score > this.Att_Score) - { - foreach (Player gangwarPlayer in this.playerInGangwar) - { - gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, 0, 0); - } - this.takeOver(this.Owner); - this.Att_Score = 0; - } - else if (this.Def_Score < this.Att_Score) + if (this.Att_Score > this.Def_Score) { foreach (Player gangwarPlayer in this.playerInGangwar) { @@ -182,6 +173,15 @@ namespace ReallifeGamemode.Server.Gangwar } this.takeOver(this.Attacker); this.Def_Score = 0; + } + else if (this.Att_Score < this.Def_Score) + { + foreach (Player gangwarPlayer in this.playerInGangwar) + { + gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, 0, 0); + } + this.takeOver(this.Owner); + this.Att_Score = 0; return; } else if (this.Def_Score == this.Att_Score) @@ -190,7 +190,7 @@ namespace ReallifeGamemode.Server.Gangwar { gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, 0, 0); } - this.takeOver(this.Attacker); + this.takeOver(this.Owner); this.Def_Score = 0; return; @@ -341,11 +341,11 @@ namespace ReallifeGamemode.Server.Gangwar { if (getOwner() == FactionName) { - Def_Score -= 1; + Att_Score += 1; } else if (getAttacker() == FactionName) { - Att_Score -= 1; + Def_Score += 1; } } }