From fa8a39c9c3dbae53711fdbb0718e5ed412039774 Mon Sep 17 00:00:00 2001 From: kookroach <62265045+kookroach@users.noreply.github.com> Date: Sat, 3 Apr 2021 22:51:41 +0200 Subject: [PATCH 01/12] Fix DrivingSchool selection --- ReallifeGamemode.Client/Interaction/drivingschool.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReallifeGamemode.Client/Interaction/drivingschool.ts b/ReallifeGamemode.Client/Interaction/drivingschool.ts index d7818027..11a888dc 100644 --- a/ReallifeGamemode.Client/Interaction/drivingschool.ts +++ b/ReallifeGamemode.Client/Interaction/drivingschool.ts @@ -23,7 +23,7 @@ export default function drivingSchoolList(globalData: IGlobalData) { var drivingMenu: NativeUI.Menu; - var stage = ""; + var stage = "Auto"; //Weapon Menu From eaf7c658138018257af3674d3ed1b44e08fa6ee7 Mon Sep 17 00:00:00 2001 From: hydrant Date: Sat, 3 Apr 2021 22:55:27 +0200 Subject: [PATCH 02/12] fix get set data nullreference --- ReallifeGamemode.Server/Extensions/ClientExtension.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ReallifeGamemode.Server/Extensions/ClientExtension.cs b/ReallifeGamemode.Server/Extensions/ClientExtension.cs index 7dd2338e..6b04c579 100644 --- a/ReallifeGamemode.Server/Extensions/ClientExtension.cs +++ b/ReallifeGamemode.Server/Extensions/ClientExtension.cs @@ -93,6 +93,11 @@ namespace ReallifeGamemode.Server.Extensions internal static T GetData(this User user, string key, T nullValue) { + if(user == null) + { + return default; + } + key += "data_"; if (!user.Player.HasData(key)) return nullValue; return JsonConvert.DeserializeObject(user.Player.GetData(key)); @@ -102,6 +107,11 @@ namespace ReallifeGamemode.Server.Extensions internal static void SetData(this User user, string key, object value) { + if(user == null) + { + return; + } + key += "data_"; user.Player.SetData(key, JsonConvert.SerializeObject(value)); } From 27ef35750d688e5df309e2c83f8f92cbc4db394f Mon Sep 17 00:00:00 2001 From: hydrant Date: Sat, 3 Apr 2021 22:55:38 +0200 Subject: [PATCH 03/12] kein taxi rufen --- ReallifeGamemode.Server/Managers/InteractionManager.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ReallifeGamemode.Server/Managers/InteractionManager.cs b/ReallifeGamemode.Server/Managers/InteractionManager.cs index aeefe1a6..45cda73d 100644 --- a/ReallifeGamemode.Server/Managers/InteractionManager.cs +++ b/ReallifeGamemode.Server/Managers/InteractionManager.cs @@ -443,6 +443,12 @@ namespace ReallifeGamemode.Server.Managers { var taxiJob = JobManager.GetJob(); + if(taxiJob == null) + { + player.SendChatMessage("Aktuell kann kein Taxi gerufen werden."); + return; + } + if (taxiJob.TaxiContracts.Where(t => t.Name == player.Name).Count() != 0) { ChatService.ErrorMessage(player, "Du kannst nur einmal ein Taxi rufen"); From a360d5e06e6743114995c4d45673282880e6d0ff Mon Sep 17 00:00:00 2001 From: hydrant Date: Sat, 3 Apr 2021 22:55:53 +0200 Subject: [PATCH 04/12] onlineliste nach id sortieren --- ReallifeGamemode.Server/Events/Key.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReallifeGamemode.Server/Events/Key.cs b/ReallifeGamemode.Server/Events/Key.cs index 32ec4e1a..cc38b584 100644 --- a/ReallifeGamemode.Server/Events/Key.cs +++ b/ReallifeGamemode.Server/Events/Key.cs @@ -612,7 +612,7 @@ namespace ReallifeGamemode.Server.Events public void KeyPressO(Player player) { if (!player.IsLoggedIn()) return; - List players = NAPI.Pools.GetAllPlayers().Where(p => p.IsLoggedIn() == true).ToList(); + List players = NAPI.Pools.GetAllPlayers().Where(p => p.IsLoggedIn() == true).OrderBy(o => o.Handle.Value).ToList(); var listPlayers = players.Select(p => new { From 44aaea6021b37a7cce29ab1c7c878c4fa94c4aae Mon Sep 17 00:00:00 2001 From: hydrant Date: Sat, 3 Apr 2021 22:56:06 +0200 Subject: [PATCH 05/12] =?UTF-8?q?/lc=20und=20/ga=20f=C3=BCr=20admins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Commands/FactionCommands.cs | 14 +++++++++----- ReallifeGamemode.Server/Services/ChatService.cs | 9 +++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ReallifeGamemode.Server/Commands/FactionCommands.cs b/ReallifeGamemode.Server/Commands/FactionCommands.cs index 6a75bf9c..c0668be5 100644 --- a/ReallifeGamemode.Server/Commands/FactionCommands.cs +++ b/ReallifeGamemode.Server/Commands/FactionCommands.cs @@ -10,6 +10,7 @@ using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Factions.Medic; using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Services; +using ReallifeGamemode.Server.Types; using ReallifeGamemode.Services; /** @@ -43,20 +44,21 @@ namespace ReallifeGamemode.Server.Commands [Command("ga", "~m~Benutzung: ~s~/ga [Nachricht]", GreedyArg = true)] public void CmdFactionGA(Player player, string message) { - Faction f = player.GetUser()?.Faction; + User user = player.GetUser(); + Faction f = user?.Faction; if (f == null || f.StateOwned) { ChatService.NotAuthorized(player); return; } - if (player.GetUser().Faction.Name == "Ballas" || player.GetUser().Faction.Name == "Grove") + if (f.Name == "Ballas" || f.Name == "Grove" || user.IsAdmin(AdminLevel.ADMIN)) { message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", ""); string broadcastMessage = "!{FF0000}** " + player.GetUser().GetFactionRank().RankName + " " + player.Name + ": " + message + " **"; using (var context = new DatabaseContext()) { - ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.GangOwned)); + ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.GangOwned), true); } } else @@ -177,7 +179,8 @@ namespace ReallifeGamemode.Server.Commands [Command("lc", "~m~Benutzung: ~s~/lc [Nachricht]", GreedyArg = true)] public void CmdFactionLc(Player player, string message) { - if (player.GetUser()?.FactionId == null || player.GetUser().FactionLeader == false) + User user = player.GetUser(); + if (user?.FactionId == null || user.FactionLeader == false || !user.IsAdmin(AdminLevel.ADMIN)) { ChatService.NotAuthorized(player); return; @@ -189,7 +192,8 @@ namespace ReallifeGamemode.Server.Commands NAPI.Pools.GetAllPlayers().ForEach(p => { - if (p.GetUser()?.FactionLeader ?? false) ChatService.SendMessage(p, broadcastMsg); + User pUser = p.GetUser(); + if (pUser?.FactionLeader ?? false || pUser.IsAdmin(AdminLevel.ADMIN)) ChatService.SendMessage(p, broadcastMsg); }); } diff --git a/ReallifeGamemode.Server/Services/ChatService.cs b/ReallifeGamemode.Server/Services/ChatService.cs index 196d123f..d63d16c2 100644 --- a/ReallifeGamemode.Server/Services/ChatService.cs +++ b/ReallifeGamemode.Server/Services/ChatService.cs @@ -52,11 +52,12 @@ namespace ReallifeGamemode.Server.Services /// /// Die Nachricht, die gesendet werden soll /// Die Liste an Fraktionen, die diese Nachricht bekommen sollen - public static void BroadcastFaction(string message, List factions) + public static void BroadcastFaction(string message, List factions, bool toAdmins = false) { foreach (Player c in NAPI.Pools.GetAllPlayers()) { - Faction f = c.GetUser()?.Faction; + User user = c.GetUser(); + Faction f = user.Faction; if (f != null) { if (factions.Find(fT => fT.Id == f.Id) != null) @@ -64,6 +65,10 @@ namespace ReallifeGamemode.Server.Services ChatService.SendMessage(c, message); } } + else if(user.IsAdmin(AdminLevel.ADMIN) && toAdmins) + { + ChatService.SendMessage(c, message); + } } } From b92b4e8b4874b627defc2707e497282e2bfaf1f4 Mon Sep 17 00:00:00 2001 From: hydrant Date: Sat, 3 Apr 2021 22:58:23 +0200 Subject: [PATCH 06/12] fix onlineliste --- ReallifeGamemode.Server/Events/Key.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReallifeGamemode.Server/Events/Key.cs b/ReallifeGamemode.Server/Events/Key.cs index cc38b584..474d6d44 100644 --- a/ReallifeGamemode.Server/Events/Key.cs +++ b/ReallifeGamemode.Server/Events/Key.cs @@ -619,7 +619,7 @@ namespace ReallifeGamemode.Server.Events Id = p.Handle.Value, p.Name, p.Ping, - FactionName = p.GetUser().Faction?.Name ?? "Zivilist", + FactionName = p.GetUser()?.Faction?.Name ?? "Zivilist", }); player.TriggerEvent("showPlayerlist", JsonConvert.SerializeObject(listPlayers)); } From 51c761789d8ca727db92e90bc4eb65759ec717b6 Mon Sep 17 00:00:00 2001 From: kookroach <62265045+kookroach@users.noreply.github.com> Date: Sat, 3 Apr 2021 22:58:34 +0200 Subject: [PATCH 07/12] =?UTF-8?q?Medic=20m=C3=BCssen=20Soli=20zahlen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ReallifeGamemode.Server/Factions/Medic/Medic.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReallifeGamemode.Server/Factions/Medic/Medic.cs b/ReallifeGamemode.Server/Factions/Medic/Medic.cs index 99075bdd..60442169 100644 --- a/ReallifeGamemode.Server/Factions/Medic/Medic.cs +++ b/ReallifeGamemode.Server/Factions/Medic/Medic.cs @@ -22,7 +22,7 @@ namespace ReallifeGamemode.Server.Factions.Medic public static List ReviveTasks = new List(); public static List HealTasks = new List(); public static List FireTasks = new List(); - public static int ReviveIncome = 500; + public static int ReviveIncome = 100; public static int dutyMedics = 0; public static void AddTaskToList(MedicTask task) From 04ea942f758788d8c743a3bcf915fcd58e611dc5 Mon Sep 17 00:00:00 2001 From: kookroach <62265045+kookroach@users.noreply.github.com> Date: Sat, 3 Apr 2021 23:09:56 +0200 Subject: [PATCH 08/12] fix bank money --- ReallifeGamemode.Client/Gui/infobox.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ReallifeGamemode.Client/Gui/infobox.ts b/ReallifeGamemode.Client/Gui/infobox.ts index 52750cd0..5e31953c 100644 --- a/ReallifeGamemode.Client/Gui/infobox.ts +++ b/ReallifeGamemode.Client/Gui/infobox.ts @@ -110,6 +110,9 @@ export default function (globalData: IGlobalData): void { }); mp.events.add("updateMoney", (money) => { + if (money == undefined) + money = 0; + playerMoney = moneyFormat(money); }); From df306792de78186abaccbd8e2e33ed7526971e36 Mon Sep 17 00:00:00 2001 From: kookroach <62265045+kookroach@users.noreply.github.com> Date: Sat, 3 Apr 2021 23:13:37 +0200 Subject: [PATCH 09/12] fix --- ReallifeGamemode.Client/Gui/infobox.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReallifeGamemode.Client/Gui/infobox.ts b/ReallifeGamemode.Client/Gui/infobox.ts index 5e31953c..86f582bc 100644 --- a/ReallifeGamemode.Client/Gui/infobox.ts +++ b/ReallifeGamemode.Client/Gui/infobox.ts @@ -50,7 +50,7 @@ export default function (globalData: IGlobalData): void { var playerName; var playerId; - var playerMoney; + var playerMoney = "0"; mp.events.add("draw", (pName, pId) => { playerName = pName; From 95c84ec40ec6391344b1a6de06dab48ce5fe141f Mon Sep 17 00:00:00 2001 From: hydrant Date: Sat, 3 Apr 2021 23:15:53 +0200 Subject: [PATCH 10/12] Add checkstats --- .../Commands/AdminCommands.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index 49212db0..73e01650 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -3540,6 +3540,33 @@ namespace ReallifeGamemode.Server.Commands player.SendChatMessage("~m~Benutzung:~s~ /business [price] [Option]"); } + [Command("checkstats", "~m~Benutzung:~s~ /checkstats [Name / ID]")] + public void CmdAdminCheckStats(Player player, string nameOrId) + { + User user = player.GetUser(); + if(!user.IsAdmin(AdminLevel.ADMIN)) + { + ChatService.NotAuthorized(player); + } + + Player target = PlayerService.GetPlayerByNameOrId(nameOrId); + if(target == null || !target.IsLoggedIn()) + { + ChatService.PlayerNotFound(player); + return; + } + + User targetUser = target.GetUser(); + int handmoney = targetUser.Handmoney; + int bankmoney = targetUser.BankAccount.Balance; + bool driverLicense = targetUser.DriverLicenseVehicle; + bool bikeLicense = targetUser.DriverLicenseBike; + bool flyingLicense = targetUser.FlyingLicensePlane; + bool weaponLicense = targetUser.WeaponLicense; + ChatService.SendMessage(player, $"Stats von {target.Name} - HandMoney: {handmoney.ToMoneyString()}, BankMoney: {bankmoney.ToMoneyString()}, DriverLicense: {driverLicense.ToString()}, BikeLicense: {bikeLicense.ToString()}, FlyingLicense: {flyingLicense.ToString()}, WeaponLicense: {weaponLicense.ToString()}") + } + + #endregion ALevel1337 #region ALevel1338 From f14c11632b337957359d8ef43a91c6824b7358dc Mon Sep 17 00:00:00 2001 From: hydrant Date: Sat, 3 Apr 2021 23:16:45 +0200 Subject: [PATCH 11/12] fix --- ReallifeGamemode.Server/Commands/AdminCommands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index 73e01650..fd583aff 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -3563,7 +3563,7 @@ namespace ReallifeGamemode.Server.Commands bool bikeLicense = targetUser.DriverLicenseBike; bool flyingLicense = targetUser.FlyingLicensePlane; bool weaponLicense = targetUser.WeaponLicense; - ChatService.SendMessage(player, $"Stats von {target.Name} - HandMoney: {handmoney.ToMoneyString()}, BankMoney: {bankmoney.ToMoneyString()}, DriverLicense: {driverLicense.ToString()}, BikeLicense: {bikeLicense.ToString()}, FlyingLicense: {flyingLicense.ToString()}, WeaponLicense: {weaponLicense.ToString()}") + ChatService.SendMessage(player, $"Stats von {target.Name} - HandMoney: {handmoney.ToMoneyString()}, BankMoney: {bankmoney.ToMoneyString()}, DriverLicense: {driverLicense.ToString()}, BikeLicense: {bikeLicense.ToString()}, FlyingLicense: {flyingLicense.ToString()}, WeaponLicense: {weaponLicense.ToString()}"); } From 8393d13eb8a3655a5c82bba5fc0bf8deb8d9bd68 Mon Sep 17 00:00:00 2001 From: kookroach <62265045+kookroach@users.noreply.github.com> Date: Sat, 3 Apr 2021 23:20:42 +0200 Subject: [PATCH 12/12] fix last --- ReallifeGamemode.Client/Gui/infobox.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReallifeGamemode.Client/Gui/infobox.ts b/ReallifeGamemode.Client/Gui/infobox.ts index 86f582bc..be4c2555 100644 --- a/ReallifeGamemode.Client/Gui/infobox.ts +++ b/ReallifeGamemode.Client/Gui/infobox.ts @@ -50,7 +50,7 @@ export default function (globalData: IGlobalData): void { var playerName; var playerId; - var playerMoney = "0"; + var playerMoney = "5000"; mp.events.add("draw", (pName, pId) => { playerName = pName;