From c90420ec164b0b1ef2ddc20db69c12e695f30e23 Mon Sep 17 00:00:00 2001 From: Lukas Moungos Date: Sun, 15 Dec 2019 13:52:06 +0100 Subject: [PATCH] Added Faction Color to Player Blips for Trucker, Ballas and Grove. --- ReallifeGamemode.Client/util/Gangwar.ts | 6 +++- .../Commands/FactionCommands.cs | 20 ++++++++++++- ReallifeGamemode.Server/Events/Key.cs | 2 +- ReallifeGamemode.Server/Events/Login.cs | 17 ++++++++++- ReallifeGamemode.Server/Gangwar/Turf.cs | 30 ++++++++++++++++++- .../Managers/InteractionManager.cs | 20 +++++++++++-- 6 files changed, 87 insertions(+), 8 deletions(-) diff --git a/ReallifeGamemode.Client/util/Gangwar.ts b/ReallifeGamemode.Client/util/Gangwar.ts index fba1e47f..e4b1e144 100644 --- a/ReallifeGamemode.Client/util/Gangwar.ts +++ b/ReallifeGamemode.Client/util/Gangwar.ts @@ -333,7 +333,6 @@ } return false; } - } var gangturfs = []; @@ -379,6 +378,11 @@ last_blip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 5); } + let last_attackBlip = mp.game.invoke(Natives.GET_FIRST_BLIP_INFO_ID, 378); + while (mp.game.invoke(Natives.DOES_BLIP_EXIST, last_attackBlip)) { + mp.game.ui.removeBlip(last_attackBlip); + last_attackBlip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 378); + } } diff --git a/ReallifeGamemode.Server/Commands/FactionCommands.cs b/ReallifeGamemode.Server/Commands/FactionCommands.cs index 60344ec3..fc11bd9e 100644 --- a/ReallifeGamemode.Server/Commands/FactionCommands.cs +++ b/ReallifeGamemode.Server/Commands/FactionCommands.cs @@ -290,7 +290,25 @@ namespace ReallifeGamemode.Server.Commands } ChatService.SendMessage(target, "!{#8181E9}Deine Akte wurde von " + player.Name + " gelöscht. Grund: " + reason); ChatService.BroadcastFaction("!{#8181E9}HQ: Die Akte von " + target.Name + " wurde von " + player.Name + " gelöscht. Grund: " + reason + ".", new List() { 1, 3 }); - + if (targetUser.Faction != null) + { + switch (targetUser.Faction.Name) + { + case "Ballas": + target.SetSharedData("blipColor", 83); + break; + case "Grove": + target.SetSharedData("blipColor", 52); + break; + case "Trucker": + target.SetSharedData("blipColor", 5); + break; + } + } + else + { + target.SetSharedData("blipColor", 0); + } targetUser.Wanteds = 0; dbContext.SaveChanges(); } diff --git a/ReallifeGamemode.Server/Events/Key.cs b/ReallifeGamemode.Server/Events/Key.cs index 4cf208a3..a25b859d 100644 --- a/ReallifeGamemode.Server/Events/Key.cs +++ b/ReallifeGamemode.Server/Events/Key.cs @@ -187,7 +187,7 @@ namespace ReallifeGamemode.Server.Events //FBI case 3: nameTagColor = new Color(173, 0, 118); - player.SetSharedData("blipColor", 83); + player.SetSharedData("blipColor", 72); player.SetAccessories(2, 2, 0); break; } diff --git a/ReallifeGamemode.Server/Events/Login.cs b/ReallifeGamemode.Server/Events/Login.cs index 404efab3..c43e8007 100644 --- a/ReallifeGamemode.Server/Events/Login.cs +++ b/ReallifeGamemode.Server/Events/Login.cs @@ -58,7 +58,22 @@ namespace ReallifeGamemode.Server.Events player.SetData("editmode", false); player.SetData("quicksavemode", "none"); } - + if(user.Faction != null) + { + switch (user.Faction.Name) + { + case "Ballas": + player.SetSharedData("blipColor", 83); + break; + case "Grove": + player.SetSharedData("blipColor", 52); + break; + case "Trucker": + player.SetSharedData("blipColor", 5); + break; + } + } + var userBankAccount = user.GetBankAccount(); userBankAccount.Balance = userBankAccount.Balance; diff --git a/ReallifeGamemode.Server/Gangwar/Turf.cs b/ReallifeGamemode.Server/Gangwar/Turf.cs index 13ef1e24..621c8ec2 100644 --- a/ReallifeGamemode.Server/Gangwar/Turf.cs +++ b/ReallifeGamemode.Server/Gangwar/Turf.cs @@ -125,10 +125,38 @@ namespace ReallifeGamemode.Server.Gangwar this.takeOver(this.Owner); } timerCount += 1; - if(timerCount >= 69) + if(timerCount >= 60) //change to 900 before release { this.timer.Stop(); this.timer = null; + if(this.Def_Score > this.Att_Score) + { + this.takeOver(this.Owner); + this.Att_Score = 0; + foreach (Client gangwarPlayer in this.playerInGangwar) + { + gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, 0, 0); + } + }else if(this.Def_Score < this.Att_Score) + { + this.takeOver(this.Attacker); + this.Def_Score = 0; + foreach (Client gangwarPlayer in this.playerInGangwar) + { + gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, 0, 0); + } + return; + } + else if(this.Def_Score == this.Att_Score) + { + this.takeOver(this.Attacker); + this.Def_Score = 0; + foreach (Client gangwarPlayer in this.playerInGangwar) + { + gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, 0, 0); + } + return; + } } } diff --git a/ReallifeGamemode.Server/Managers/InteractionManager.cs b/ReallifeGamemode.Server/Managers/InteractionManager.cs index 265e27df..991df11a 100644 --- a/ReallifeGamemode.Server/Managers/InteractionManager.cs +++ b/ReallifeGamemode.Server/Managers/InteractionManager.cs @@ -63,7 +63,21 @@ namespace ReallifeGamemode.Server.Managers ChatService.SendMessage(leader, "!{02FCFF}" + player.Name + " hat die Einladung angenommen."); ChatService.SendMessage(player, "!{02FCFF}Du hast die Einladung angenommen."); - + if (own.Faction != null) + { + switch (own.Faction.Name) + { + case "Ballas": + player.SetSharedData("blipColor", 83); + break; + case "Grove": + player.SetSharedData("blipColor", 52); + break; + case "Trucker": + player.SetSharedData("blipColor", 5); + break; + } + } dbContext.SaveChanges(); } } @@ -251,8 +265,8 @@ namespace ReallifeGamemode.Server.Managers target.GetUser(dbContext).FactionId = null; ChatService.SendMessage(player, "!{02FCFF}Du hast " + target.Name + " aus der Fraktion geworfen."); - ChatService.SendMessage(target, "!{02FCFF}Du wurdest von " + player.Name + " aus der Fraktion geworfen."); - + ChatService.SendMessage(target, "!{02FCFF}Du wurdest von " + player.Name + " aus der Fraktion geworfen."); + target.SetSharedData("blipColor", 0); dbContext.SaveChanges(); } }