From a4b21c6dd2e7a9de2d792645a228a8c62c120ed3 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Sun, 4 Apr 2021 16:50:44 +0200 Subject: [PATCH 1/3] Fix Medic 7 --- .../Interaction/factioninteraction.ts | 48 +++++++++---------- .../Commands/AdminCommands.cs | 24 +++++++++- .../Factions/Medic/Medic.cs | 5 +- ReallifeGamemode.Server/Util/ThreadTimers.cs | 3 ++ 4 files changed, 53 insertions(+), 27 deletions(-) diff --git a/ReallifeGamemode.Client/Interaction/factioninteraction.ts b/ReallifeGamemode.Client/Interaction/factioninteraction.ts index 79d5dcb4..3f4e7d54 100644 --- a/ReallifeGamemode.Client/Interaction/factioninteraction.ts +++ b/ReallifeGamemode.Client/Interaction/factioninteraction.ts @@ -26,7 +26,6 @@ export default function factionInteraction(globalData: IGlobalData) { var sortText; var deadRespawned = false; var timeLeft = null; - var deathTime; var ticketName: string; var pointsName: string; @@ -324,7 +323,6 @@ export default function factionInteraction(globalData: IGlobalData) { dimension: 0 }); reviveTaskMenuMedic.Close(); - deathTime = tasks[index].TimeLeft; mp.gui.chat.activate(true); globalData.InMenu = false; ambulanceImagePos = 0.325 @@ -332,7 +330,6 @@ export default function factionInteraction(globalData: IGlobalData) { taskFinish = tasks[index].Position; taskRange = mp.game.gameplay.getDistanceBetweenCoords(player.position.x, player.position.y, player.position.z, tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z, true); activeTask = tasks[index]; - mp.events.callRemote("getTaskTimeLeft", tasks[index].Victim); } } }); @@ -503,6 +500,7 @@ export default function factionInteraction(globalData: IGlobalData) { }); mp.events.add('render', () => { + if (activeTask) { rangeLeft = mp.game.gameplay.getDistanceBetweenCoords(player.position.x, player.position.y, player.position.z, taskFinish.x, taskFinish.y, taskFinish.z, true).toFixed(2); if (rangeLeft > 1.9) { @@ -526,33 +524,35 @@ export default function factionInteraction(globalData: IGlobalData) { var currentDate = new Date(); - if (deadRespawned == false) { - //timeLeft = Math.round(Math.abs(Math.floor(currentDate.getTime() / 1000) - activeTask.TimeLeft - 60)); - if (timeLeft < 60) mp.events.call("cutMedicEarnings"); - } else { - //timeLeft = Math.round(Math.abs(Math.floor(currentDate.getTime() / 1000) - activeTask.TimeLeft - 120)); - if (timeLeft < 1) mp.events.call("destroyMedicTaskCheckpoint"); - } + if (timeLeft != null) { + if (deadRespawned == false) { + //timeLeft = Math.round(Math.abs(Math.floor(currentDate.getTime() / 1000) - activeTask.TimeLeft - 60)); + if (timeLeft < 60) mp.events.call("cutMedicEarnings"); + } else { + //timeLeft = Math.round(Math.abs(Math.floor(currentDate.getTime() / 1000) - activeTask.TimeLeft - 120)); + if (timeLeft < 1) mp.events.call("destroyMedicTaskCheckpoint"); + } - if (deadRespawned == false) { - mp.game.graphics.drawText(timeLeft + "s ", [0.5, 0.88], { - font: 7, - color: [60, 179, 113, 255], - scale: [0.3, 0.3], - outline: true, - centre: true - }); - } else { - { + if (deadRespawned == false) { mp.game.graphics.drawText(timeLeft + "s", [0.5, 0.88], { font: 7, - color: [255, 203, 145, 255], - scale: [0.3, 0.3], + color: [60, 179, 113, 255], + scale: [0.5, 0.5], outline: true, centre: true }); - } - } + } else { + { + mp.game.graphics.drawText(timeLeft + "s", [0.5, 0.88], { + font: 7, + color: [255, 203, 145, 255], + scale: [0.5, 0.5], + outline: true, + centre: true + }); + } + } + } } }); } \ No newline at end of file diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index fd583aff..cb0e7a6a 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -1726,7 +1726,29 @@ namespace ReallifeGamemode.Server.Commands #endregion Admin #region ALevel1337 - + /* NUR ZUM TESTEN + [Command("fakedeath", "~m~Benutzung:~s~ /fakedeath")] + public void CmdAdmFakeDeath(Player player) + { + if (!player.GetUser()?.IsAdmin(AdminLevel.PROJEKTLEITUNG) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + MedicTask reviveTask = new MedicTask() + { + Victim = player.Name, + Position = player.Position, + CauseOfDeath = "FAKE", + Caller = null, + Description = "Gestorben", + Time = DateTime.Now, + Type = MedicTaskType.REVIVE, + MedicName = "none" + }; + Medic.AddTaskToList(reviveTask); + } + */ [Command("setsvar", "~m~Benutzung:~s~ /setsvar [ID] [WERT]")] public void CmdAdmSetSvar(Player player, int varId, int varValue) { diff --git a/ReallifeGamemode.Server/Factions/Medic/Medic.cs b/ReallifeGamemode.Server/Factions/Medic/Medic.cs index 39bb0852..48b9f4e3 100644 --- a/ReallifeGamemode.Server/Factions/Medic/Medic.cs +++ b/ReallifeGamemode.Server/Factions/Medic/Medic.cs @@ -81,9 +81,10 @@ namespace ReallifeGamemode.Server.Factions.Medic { if (task.MedicName != null) { - var taskTimeLeft = (Int32)(((DateTimeOffset)task.Time).ToUnixTimeSeconds() - ((DateTimeOffset)actualTime).ToUnixTimeSeconds() - reviveTaskTime); + var taskTimeLeft = Math.Abs((Int32)(((DateTimeOffset)actualTime).ToUnixTimeSeconds() - ((DateTimeOffset)task.Time).ToUnixTimeSeconds() - reviveTaskTime)); task.TimeLeft = taskTimeLeft; - PlayerService.GetPlayerByNameOrId(task.MedicName).TriggerEvent("setTaskTimeLeft", taskTimeLeft); + var medic = PlayerService.GetPlayerByNameOrId(task.MedicName); + if(task.MedicName != "none") medic.TriggerEvent("setTaskTimeLeft", taskTimeLeft); } } } diff --git a/ReallifeGamemode.Server/Util/ThreadTimers.cs b/ReallifeGamemode.Server/Util/ThreadTimers.cs index ff3f417f..92b16424 100644 --- a/ReallifeGamemode.Server/Util/ThreadTimers.cs +++ b/ReallifeGamemode.Server/Util/ThreadTimers.cs @@ -22,6 +22,9 @@ namespace ReallifeGamemode.Server.Util timer500.Start(); timer500.Elapsed += Timer500_Elapsed; + timer1000.Start(); + timer1000.Elapsed += Timer1000_Elapsed; + timer2500.Start(); timer2500.Elapsed += Timer2500_Elapsed; From 866b9f976122008d0e3a04406791b8e3ade05a3b Mon Sep 17 00:00:00 2001 From: VegaZ Date: Sun, 4 Apr 2021 16:58:38 +0200 Subject: [PATCH 2/3] Fix Medic 8 --- ReallifeGamemode.Client/Interaction/factioninteraction.ts | 2 +- ReallifeGamemode.Server/Factions/Medic/Medic.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ReallifeGamemode.Client/Interaction/factioninteraction.ts b/ReallifeGamemode.Client/Interaction/factioninteraction.ts index 3f4e7d54..c491236d 100644 --- a/ReallifeGamemode.Client/Interaction/factioninteraction.ts +++ b/ReallifeGamemode.Client/Interaction/factioninteraction.ts @@ -527,7 +527,7 @@ export default function factionInteraction(globalData: IGlobalData) { if (timeLeft != null) { if (deadRespawned == false) { //timeLeft = Math.round(Math.abs(Math.floor(currentDate.getTime() / 1000) - activeTask.TimeLeft - 60)); - if (timeLeft < 60) mp.events.call("cutMedicEarnings"); + if (timeLeft < 120) mp.events.call("cutMedicEarnings"); } else { //timeLeft = Math.round(Math.abs(Math.floor(currentDate.getTime() / 1000) - activeTask.TimeLeft - 120)); if (timeLeft < 1) mp.events.call("destroyMedicTaskCheckpoint"); diff --git a/ReallifeGamemode.Server/Factions/Medic/Medic.cs b/ReallifeGamemode.Server/Factions/Medic/Medic.cs index 48b9f4e3..a9acc028 100644 --- a/ReallifeGamemode.Server/Factions/Medic/Medic.cs +++ b/ReallifeGamemode.Server/Factions/Medic/Medic.cs @@ -24,7 +24,7 @@ namespace ReallifeGamemode.Server.Factions.Medic public static List FireTasks = new List(); public static int ReviveIncome = 100; public static int dutyMedics = 0; - public static int reviveTaskTime = 120; + public static int reviveTaskTime = 240; public static void AddTaskToList(MedicTask task) { From f6475ac48a00106a5d7f709c52d7943100033092 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Sun, 4 Apr 2021 17:08:49 +0200 Subject: [PATCH 3/3] Fix SANI Final --- ReallifeGamemode.Client/Interaction/factioninteraction.ts | 4 ++-- ReallifeGamemode.Server/Commands/AdminCommands.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ReallifeGamemode.Client/Interaction/factioninteraction.ts b/ReallifeGamemode.Client/Interaction/factioninteraction.ts index c491236d..aa577562 100644 --- a/ReallifeGamemode.Client/Interaction/factioninteraction.ts +++ b/ReallifeGamemode.Client/Interaction/factioninteraction.ts @@ -534,7 +534,7 @@ export default function factionInteraction(globalData: IGlobalData) { } if (deadRespawned == false) { - mp.game.graphics.drawText(timeLeft + "s", [0.5, 0.88], { + mp.game.graphics.drawText(timeLeft + "s", [0.5, 0.85], { font: 7, color: [60, 179, 113, 255], scale: [0.5, 0.5], @@ -543,7 +543,7 @@ export default function factionInteraction(globalData: IGlobalData) { }); } else { { - mp.game.graphics.drawText(timeLeft + "s", [0.5, 0.88], { + mp.game.graphics.drawText(timeLeft + "s", [0.5, 0.85], { font: 7, color: [255, 203, 145, 255], scale: [0.5, 0.5], diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index cb0e7a6a..afc3641a 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -1726,7 +1726,7 @@ namespace ReallifeGamemode.Server.Commands #endregion Admin #region ALevel1337 - /* NUR ZUM TESTEN + /*NUR ZUM TESTEN [Command("fakedeath", "~m~Benutzung:~s~ /fakedeath")] public void CmdAdmFakeDeath(Player player) { @@ -1747,8 +1747,8 @@ namespace ReallifeGamemode.Server.Commands MedicName = "none" }; Medic.AddTaskToList(reviveTask); - } - */ + }*/ + [Command("setsvar", "~m~Benutzung:~s~ /setsvar [ID] [WERT]")] public void CmdAdmSetSvar(Player player, int varId, int varValue) {