From 40d9b92dfe72fda75d9a8803861546be34f82880 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Fri, 9 Apr 2021 00:32:29 +0200 Subject: [PATCH 01/11] Sani Checkpoint Rework --- .../Interaction/factioninteraction.ts | 50 +++++++++++-------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/ReallifeGamemode.Client/Interaction/factioninteraction.ts b/ReallifeGamemode.Client/Interaction/factioninteraction.ts index f10a8a11..81fee996 100644 --- a/ReallifeGamemode.Client/Interaction/factioninteraction.ts +++ b/ReallifeGamemode.Client/Interaction/factioninteraction.ts @@ -18,7 +18,8 @@ export default function factionInteraction(globalData: IGlobalData) { var sorting = 0; var firstSorting = true; var activeTask = null; - var activeCheckpoint: CheckpointMp; + var activeMarker: MarkerMp; + var activeColshape: ColshapeMp; var taskStart; var taskFinish; var taskRange; @@ -234,7 +235,7 @@ export default function factionInteraction(globalData: IGlobalData) { factionInteractionMenu.AddItem(fireTaskMenuMedic); */ if (activeTask != null) { - if (activeTask.Type == 1 && activeCheckpoint && mp.checkpoints.exists(activeCheckpoint)) { + if (activeTask.Type == 1 && activeColshape && mp.colshapes.exists(activeColshape)) { deleteCheckpointItem = new UIMenuItem("~r~Checkpoint löschen"); factionInteractionMenu.AddItem(deleteCheckpointItem); } @@ -320,13 +321,13 @@ export default function factionInteraction(globalData: IGlobalData) { mp.game.graphics.requestStreamedTextureDict("medicimages", true); mp.events.callRemote("updateMedicTask", 0, tasks[index].Victim); mp.game.ui.setNewWaypoint(tasks[index].Position.x, tasks[index].Position.y); - activeCheckpoint = mp.checkpoints.new(4, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 2), 3.0, + activeMarker = mp.markers.new(1, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 1), 3.0, { - direction: new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 5), color: [255, 0, 0, 150], visible: true, dimension: 0 }); + activeColshape = mp.colshapes.newTube(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 1, 2, 3, 0); reviveTaskMenuMedic.Close(); mp.gui.chat.activate(true); globalData.InMenu = false; @@ -374,13 +375,13 @@ export default function factionInteraction(globalData: IGlobalData) { mp.game.graphics.requestStreamedTextureDict("medicimages", true); mp.events.callRemote("updateMedicTask", 1, tasks[index].Victim); mp.game.ui.setNewWaypoint(tasks[index].Position.x, tasks[index].Position.y); - activeCheckpoint = mp.checkpoints.new(4, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 2), 3.0, + activeMarker = mp.markers.new(1, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 1), 3.0, { - direction: new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 5), color: [255, 0, 0, 150], visible: true, dimension: 0 }); + activeColshape = mp.colshapes.newTube(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 1, 2, 3, 0); healTaskMenuMedic.Close(); mp.gui.chat.activate(true); globalData.InMenu = false; @@ -404,19 +405,27 @@ export default function factionInteraction(globalData: IGlobalData) { } }); - mp.events.add('playerEnterCheckpoint', (activeCheckpoint) => { + mp.events.add('playerEnterColshape', (activeColshape) => { if (activeTask.Type == 1) { - activeCheckpoint.destroy(); - activeCheckpoint = null; + activeColshape.destroy(); + activeColshape = null; + if (mp.markers.exists(activeMarker)) { + activeMarker.destroy(); + activeMarker = null; + } activeTask = null; timeLeft = null; } }); mp.events.add("destroyMedicTaskCheckpoint", () => { - if (activeCheckpoint && mp.checkpoints.exists(activeCheckpoint)) { - activeCheckpoint.destroy(); - activeCheckpoint = null; + if (activeColshape && mp.colshapes.exists(activeColshape)) { + activeColshape.destroy(); + activeColshape = null; + if (mp.markers.exists(activeMarker)) { + activeMarker.destroy(); + activeMarker = null; + } activeTask = null; timeLeft = null; } @@ -430,16 +439,13 @@ export default function factionInteraction(globalData: IGlobalData) { mp.events.add('updateHealCheckpoint', (xPos, yPos, zPos) => { if (activeTask && activeTask.Type == 1) { - activeCheckpoint.destroy(); - activeCheckpoint = null; - activeCheckpoint = mp.checkpoints.new(4, new mp.Vector3(xPos, yPos, zPos - 2), 3.0, - { - direction: new mp.Vector3(xPos, yPos, zPos - 5), - color: [255, 0, 0, 150], - visible: true, - dimension: 0 - }); - + if (mp.colshapes.exists(activeColshape) && mp.markers.exists(activeMarker)) { + activeMarker.setCoords2(xPos, yPos, zPos, 0, 0, 0, false); + activeColshape.setCoords2(xPos, yPos, zPos, 0, 0, 0, false); + } + taskFinish.x = xPos; + taskFinish.y = yPos; + taskFinish.z = zPos; mp.game.ui.setNewWaypoint(xPos, yPos); } }); From f355ccd50d426fd0134d8cb1108975223c166019 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Fri, 9 Apr 2021 00:40:48 +0200 Subject: [PATCH 02/11] Junggeeee --- ReallifeGamemode.Client/Interaction/factioninteraction.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/ReallifeGamemode.Client/Interaction/factioninteraction.ts b/ReallifeGamemode.Client/Interaction/factioninteraction.ts index 81fee996..79763749 100644 --- a/ReallifeGamemode.Client/Interaction/factioninteraction.ts +++ b/ReallifeGamemode.Client/Interaction/factioninteraction.ts @@ -438,6 +438,7 @@ export default function factionInteraction(globalData: IGlobalData) { }); mp.events.add('updateHealCheckpoint', (xPos, yPos, zPos) => { + mp.gui.chat.push("DEBUG: JO LÜPPT"); if (activeTask && activeTask.Type == 1) { if (mp.colshapes.exists(activeColshape) && mp.markers.exists(activeMarker)) { activeMarker.setCoords2(xPos, yPos, zPos, 0, 0, 0, false); From 09f7072f1af686854f84f97703d261226a8aef26 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Fri, 9 Apr 2021 01:00:29 +0200 Subject: [PATCH 03/11] Nun aber --- .../Interaction/factioninteraction.ts | 40 +++++-------------- .../Factions/Medic/Medic.cs | 2 +- 2 files changed, 12 insertions(+), 30 deletions(-) diff --git a/ReallifeGamemode.Client/Interaction/factioninteraction.ts b/ReallifeGamemode.Client/Interaction/factioninteraction.ts index 79763749..9956adf3 100644 --- a/ReallifeGamemode.Client/Interaction/factioninteraction.ts +++ b/ReallifeGamemode.Client/Interaction/factioninteraction.ts @@ -18,8 +18,7 @@ export default function factionInteraction(globalData: IGlobalData) { var sorting = 0; var firstSorting = true; var activeTask = null; - var activeMarker: MarkerMp; - var activeColshape: ColshapeMp; + var activeCheckpoint: CheckpointMp; var taskStart; var taskFinish; var taskRange; @@ -235,7 +234,7 @@ export default function factionInteraction(globalData: IGlobalData) { factionInteractionMenu.AddItem(fireTaskMenuMedic); */ if (activeTask != null) { - if (activeTask.Type == 1 && activeColshape && mp.colshapes.exists(activeColshape)) { + if (activeTask.Type == 1 && activeCheckpoint && mp.checkpoints.exists(activeCheckpoint)) { deleteCheckpointItem = new UIMenuItem("~r~Checkpoint löschen"); factionInteractionMenu.AddItem(deleteCheckpointItem); } @@ -321,13 +320,12 @@ export default function factionInteraction(globalData: IGlobalData) { mp.game.graphics.requestStreamedTextureDict("medicimages", true); mp.events.callRemote("updateMedicTask", 0, tasks[index].Victim); mp.game.ui.setNewWaypoint(tasks[index].Position.x, tasks[index].Position.y); - activeMarker = mp.markers.new(1, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 1), 3.0, + activeCheckpoint = mp.checkpoints.new(4, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 2), 3.0, { color: [255, 0, 0, 150], visible: true, dimension: 0 }); - activeColshape = mp.colshapes.newTube(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 1, 2, 3, 0); reviveTaskMenuMedic.Close(); mp.gui.chat.activate(true); globalData.InMenu = false; @@ -375,13 +373,12 @@ export default function factionInteraction(globalData: IGlobalData) { mp.game.graphics.requestStreamedTextureDict("medicimages", true); mp.events.callRemote("updateMedicTask", 1, tasks[index].Victim); mp.game.ui.setNewWaypoint(tasks[index].Position.x, tasks[index].Position.y); - activeMarker = mp.markers.new(1, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 1), 3.0, + activeCheckpoint = mp.checkpoints.new(4, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 2), 3.0, { color: [255, 0, 0, 150], visible: true, dimension: 0 }); - activeColshape = mp.colshapes.newTube(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 1, 2, 3, 0); healTaskMenuMedic.Close(); mp.gui.chat.activate(true); globalData.InMenu = false; @@ -405,27 +402,19 @@ export default function factionInteraction(globalData: IGlobalData) { } }); - mp.events.add('playerEnterColshape', (activeColshape) => { + mp.events.add('playerEnterCheckpoint', (activeCheckpoint) => { if (activeTask.Type == 1) { - activeColshape.destroy(); - activeColshape = null; - if (mp.markers.exists(activeMarker)) { - activeMarker.destroy(); - activeMarker = null; - } + activeCheckpoint.destroy(); + activeCheckpoint = null; activeTask = null; timeLeft = null; } }); mp.events.add("destroyMedicTaskCheckpoint", () => { - if (activeColshape && mp.colshapes.exists(activeColshape)) { - activeColshape.destroy(); - activeColshape = null; - if (mp.markers.exists(activeMarker)) { - activeMarker.destroy(); - activeMarker = null; - } + if (activeCheckpoint && mp.checkpoints.exists(activeCheckpoint)) { + activeCheckpoint.destroy(); + activeCheckpoint = null; activeTask = null; timeLeft = null; } @@ -438,15 +427,8 @@ export default function factionInteraction(globalData: IGlobalData) { }); mp.events.add('updateHealCheckpoint', (xPos, yPos, zPos) => { - mp.gui.chat.push("DEBUG: JO LÜPPT"); if (activeTask && activeTask.Type == 1) { - if (mp.colshapes.exists(activeColshape) && mp.markers.exists(activeMarker)) { - activeMarker.setCoords2(xPos, yPos, zPos, 0, 0, 0, false); - activeColshape.setCoords2(xPos, yPos, zPos, 0, 0, 0, false); - } - taskFinish.x = xPos; - taskFinish.y = yPos; - taskFinish.z = zPos; + activeCheckpoint.setCoords2(xPos, yPos, zPos, 0, 0, 0, false); mp.game.ui.setNewWaypoint(xPos, yPos); } }); diff --git a/ReallifeGamemode.Server/Factions/Medic/Medic.cs b/ReallifeGamemode.Server/Factions/Medic/Medic.cs index 89c8fbe7..d0271cc6 100644 --- a/ReallifeGamemode.Server/Factions/Medic/Medic.cs +++ b/ReallifeGamemode.Server/Factions/Medic/Medic.cs @@ -222,7 +222,7 @@ namespace ReallifeGamemode.Server.Factions.Medic break; case 1: - var healTask = ReviveTasks.FirstOrDefault(t => t.Victim == victim); + var healTask = HealTasks.FirstOrDefault(t => t.Victim == victim); healTask.MedicName = player.Name; ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " hat den Healauftrag von " + victim + " angenommen.", new List() { 2 }); target.SendNotification("~w~Sanitäter~g~ " + player.Name + "~w~ hat deinen Auftrag angenommen."); From 1dd5a1a004d80705c9d877ae192a04dbe350f2e9 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Fri, 9 Apr 2021 01:04:15 +0200 Subject: [PATCH 04/11] Nun aber --- ReallifeGamemode.Client/Interaction/factioninteraction.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReallifeGamemode.Client/Interaction/factioninteraction.ts b/ReallifeGamemode.Client/Interaction/factioninteraction.ts index 9956adf3..54a1d799 100644 --- a/ReallifeGamemode.Client/Interaction/factioninteraction.ts +++ b/ReallifeGamemode.Client/Interaction/factioninteraction.ts @@ -428,7 +428,7 @@ export default function factionInteraction(globalData: IGlobalData) { mp.events.add('updateHealCheckpoint', (xPos, yPos, zPos) => { if (activeTask && activeTask.Type == 1) { - activeCheckpoint.setCoords2(xPos, yPos, zPos, 0, 0, 0, false); + activeCheckpoint.setCoords(xPos, yPos, zPos, false, false, false, false); mp.game.ui.setNewWaypoint(xPos, yPos); } }); From 8476b112ed3fbf1e6894de315295d6aba7515318 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Fri, 9 Apr 2021 01:10:21 +0200 Subject: [PATCH 05/11] =?UTF-8?q?Letzte=20f=C3=BCr=20heute?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Interaction/factioninteraction.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ReallifeGamemode.Client/Interaction/factioninteraction.ts b/ReallifeGamemode.Client/Interaction/factioninteraction.ts index 54a1d799..e8e905cf 100644 --- a/ReallifeGamemode.Client/Interaction/factioninteraction.ts +++ b/ReallifeGamemode.Client/Interaction/factioninteraction.ts @@ -428,8 +428,19 @@ export default function factionInteraction(globalData: IGlobalData) { mp.events.add('updateHealCheckpoint', (xPos, yPos, zPos) => { if (activeTask && activeTask.Type == 1) { - activeCheckpoint.setCoords(xPos, yPos, zPos, false, false, false, false); - mp.game.ui.setNewWaypoint(xPos, yPos); + if (activeCheckpoint && mp.checkpoints.exists(activeCheckpoint)) { + activeCheckpoint.destroy(); + activeCheckpoint = mp.checkpoints.new(4, new mp.Vector3(xPos, yPos, zPos - 2), 3.0, + { + color: [255, 0, 0, 150], + visible: true, + dimension: 0 + }); + mp.game.ui.setNewWaypoint(xPos, yPos); + taskFinish.x = xPos; + taskFinish.y = yPos; + taskFinish.z = zPos; + } } }); From 7a444a167140b1e580a37605abfa224c9be4187a Mon Sep 17 00:00:00 2001 From: VegaZ Date: Fri, 9 Apr 2021 01:32:08 +0200 Subject: [PATCH 06/11] Feierabend --- .../Interaction/factioninteraction.ts | 5 ++-- .../Factions/Medic/Medic.cs | 25 +++++++++++++++---- .../Managers/InteractionManager.cs | 1 + 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/ReallifeGamemode.Client/Interaction/factioninteraction.ts b/ReallifeGamemode.Client/Interaction/factioninteraction.ts index e8e905cf..1dbb710c 100644 --- a/ReallifeGamemode.Client/Interaction/factioninteraction.ts +++ b/ReallifeGamemode.Client/Interaction/factioninteraction.ts @@ -273,6 +273,7 @@ export default function factionInteraction(globalData: IGlobalData) { mp.gui.chat.activate(true); globalData.InMenu = false; mp.events.call("destroyMedicTaskCheckpoint"); + mp.events.callRemote("updateMedicTask", 1, activeTask.Victim, true); break; } @@ -318,7 +319,7 @@ export default function factionInteraction(globalData: IGlobalData) { } else { if (tasks[index].MedicName === "none") { mp.game.graphics.requestStreamedTextureDict("medicimages", true); - mp.events.callRemote("updateMedicTask", 0, tasks[index].Victim); + mp.events.callRemote("updateMedicTask", 0, tasks[index].Victim, false); mp.game.ui.setNewWaypoint(tasks[index].Position.x, tasks[index].Position.y); activeCheckpoint = mp.checkpoints.new(4, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 2), 3.0, { @@ -371,7 +372,7 @@ export default function factionInteraction(globalData: IGlobalData) { } else { if (tasks[index].MedicName === "none") { mp.game.graphics.requestStreamedTextureDict("medicimages", true); - mp.events.callRemote("updateMedicTask", 1, tasks[index].Victim); + mp.events.callRemote("updateMedicTask", 1, tasks[index].Victim, false); mp.game.ui.setNewWaypoint(tasks[index].Position.x, tasks[index].Position.y); activeCheckpoint = mp.checkpoints.new(4, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 2), 3.0, { diff --git a/ReallifeGamemode.Server/Factions/Medic/Medic.cs b/ReallifeGamemode.Server/Factions/Medic/Medic.cs index d0271cc6..98dda68e 100644 --- a/ReallifeGamemode.Server/Factions/Medic/Medic.cs +++ b/ReallifeGamemode.Server/Factions/Medic/Medic.cs @@ -209,23 +209,38 @@ namespace ReallifeGamemode.Server.Factions.Medic } [RemoteEvent("updateMedicTask")] - public void UpdateMedicTasks(Player player, int type, string victim) + public void UpdateMedicTasks(Player player, int type, string victim, bool isRemoved) { Player target = PlayerService.GetPlayerByNameOrId(victim); switch (type) { case 0: var reviveTask = ReviveTasks.FirstOrDefault(t => t.Victim == victim); - reviveTask.MedicName = player.Name; + if (isRemoved) + { + reviveTask.MedicName = "none"; + } + else + { + reviveTask.MedicName = player.Name; + } + ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " hat den Reviveauftrag von " + victim + " angenommen.", new List() { 2 }); target.SendNotification("~w~Sanitäter~g~ " + player.Name + "~w~ eilt zur Rettung."); break; case 1: var healTask = HealTasks.FirstOrDefault(t => t.Victim == victim); - healTask.MedicName = player.Name; - ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " hat den Healauftrag von " + victim + " angenommen.", new List() { 2 }); - target.SendNotification("~w~Sanitäter~g~ " + player.Name + "~w~ hat deinen Auftrag angenommen."); + if (isRemoved) + { + healTask.MedicName = "none"; + } + else + { + healTask.MedicName = player.Name; + ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " hat den Healauftrag von " + victim + " angenommen.", new List() { 2 }); + target.SendNotification("~w~Sanitäter~g~ " + player.Name + "~w~ hat deinen Auftrag angenommen."); + } break; case 2: diff --git a/ReallifeGamemode.Server/Managers/InteractionManager.cs b/ReallifeGamemode.Server/Managers/InteractionManager.cs index b1c04dfc..c5189bb9 100644 --- a/ReallifeGamemode.Server/Managers/InteractionManager.cs +++ b/ReallifeGamemode.Server/Managers/InteractionManager.cs @@ -834,6 +834,7 @@ namespace ReallifeGamemode.Server.Managers { Medic.AddTaskToList(healTask); player.SetData("healauftrag", true); + player.SendNotification("~w~Du hast einen Sanitäter um Hilfe gerufen"); ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " hat soeben einen Serviceauftrag beantragt.", new List() { 2 }); } } From 63e488bb197fa7b9b415ade3562d613da0ba537b Mon Sep 17 00:00:00 2001 From: VegaZ Date: Fri, 9 Apr 2021 19:39:32 +0200 Subject: [PATCH 07/11] =?UTF-8?q?Fix=20Checkpoint=20L=C3=B6schen=20Sani?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ReallifeGamemode.Client/Interaction/factioninteraction.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReallifeGamemode.Client/Interaction/factioninteraction.ts b/ReallifeGamemode.Client/Interaction/factioninteraction.ts index 1dbb710c..592c816f 100644 --- a/ReallifeGamemode.Client/Interaction/factioninteraction.ts +++ b/ReallifeGamemode.Client/Interaction/factioninteraction.ts @@ -272,8 +272,8 @@ export default function factionInteraction(globalData: IGlobalData) { factionInteractionMenu.Close(); mp.gui.chat.activate(true); globalData.InMenu = false; - mp.events.call("destroyMedicTaskCheckpoint"); mp.events.callRemote("updateMedicTask", 1, activeTask.Victim, true); + mp.events.call("destroyMedicTaskCheckpoint"); break; } @@ -370,7 +370,7 @@ export default function factionInteraction(globalData: IGlobalData) { healTaskMenuMedic.Close(); factionInteractionMenu.Visible = true; } else { - if (tasks[index].MedicName === "none") { + if (tasks[index].MedicName === "none" && tasks[index].MedicName != mp.players.local.name) { mp.game.graphics.requestStreamedTextureDict("medicimages", true); mp.events.callRemote("updateMedicTask", 1, tasks[index].Victim, false); mp.game.ui.setNewWaypoint(tasks[index].Position.x, tasks[index].Position.y); From 313a3293302c583e416a76fe34bed052aeb158b8 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Fri, 9 Apr 2021 19:45:29 +0200 Subject: [PATCH 08/11] Fix Own Heal --- ReallifeGamemode.Client/Interaction/factioninteraction.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReallifeGamemode.Client/Interaction/factioninteraction.ts b/ReallifeGamemode.Client/Interaction/factioninteraction.ts index 592c816f..8bf52a93 100644 --- a/ReallifeGamemode.Client/Interaction/factioninteraction.ts +++ b/ReallifeGamemode.Client/Interaction/factioninteraction.ts @@ -357,7 +357,7 @@ export default function factionInteraction(globalData: IGlobalData) { } aTask1.SetRightLabel(mp.game.gameplay.getDistanceBetweenCoords(player.position.x, player.position.y, player.position.z, tasks[i].Position.x, tasks[i].Position.y, tasks[i].Position.z, true).toFixed(2).toString() + " ~g~m"); - healTaskMenuMedic.AddItem(aTask1); + healTaskMenuMedic.AddItem(aTask1); } let backItem1 = new UIMenuItem("Zur\u00fcck", "Zur\u00fcck zur Fraktionsinteraktion."); @@ -370,7 +370,7 @@ export default function factionInteraction(globalData: IGlobalData) { healTaskMenuMedic.Close(); factionInteractionMenu.Visible = true; } else { - if (tasks[index].MedicName === "none" && tasks[index].MedicName != mp.players.local.name) { + if (tasks[index].MedicName === "none" && tasks[index].Victim != mp.players.local.name) { mp.game.graphics.requestStreamedTextureDict("medicimages", true); mp.events.callRemote("updateMedicTask", 1, tasks[index].Victim, false); mp.game.ui.setNewWaypoint(tasks[index].Position.x, tasks[index].Position.y); From 81f8aed6476105afccd222539f83a273f817a85d Mon Sep 17 00:00:00 2001 From: hydrant Date: Fri, 9 Apr 2021 19:47:03 +0200 Subject: [PATCH 09/11] [HOTFIX] Gangwar starten crasht Server nicht mehr --- ReallifeGamemode.Server/Gangwar/Turf.cs | 116 ++++++++++++------------ 1 file changed, 56 insertions(+), 60 deletions(-) diff --git a/ReallifeGamemode.Server/Gangwar/Turf.cs b/ReallifeGamemode.Server/Gangwar/Turf.cs index 62321bcc..ea2f3ea0 100644 --- a/ReallifeGamemode.Server/Gangwar/Turf.cs +++ b/ReallifeGamemode.Server/Gangwar/Turf.cs @@ -133,79 +133,70 @@ namespace ReallifeGamemode.Server.Gangwar private void update() { - #region Ticket system - - /* - try + NAPI.Task.Run(() => { - Player[] owners = NAPI.Pools.GetAllPlayers().Where(c => c.GetUser().Faction.Name == this.Owner).ToArray(); - Player[] attackers = NAPI.Pools.GetAllPlayers().Where(c => c.GetUser().Faction.Name == this.Attacker).ToArray(); - }catch(NullReferenceException ex) - { - int i = 0; - foreach(var c in playerInGangwar) + foreach (Player gangwarPlayer in this.playerInGangwar) { - if (!NAPI.Entity.DoesEntityExist(c.Handle)) + if(!gangwarPlayer.IsLoggedIn()) { - this.playerInside = this.playerInside.Where(gp => gp != c).ToArray(); + continue; } - i++; + + gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score, 900 - timerCount); } - } - if (owners.Length > attackers.Length) - this.Att_Score -= owners.Length - attackers.Length; - if(owners.Length < attackers.Length) - this.Def_Score -= attackers.Length - owners.Length; - */ - - #endregion Ticket system - - foreach (Player gangwarPlayer in this.playerInGangwar) - { - gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score, 900 - timerCount); - } - /*if (this.Att_Score >= 200) - { - this.takeOver(this.Attacker); - } - else if (this.Def_Score >= 200) - { - 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.Att_Score > this.Def_Score) + /*if (this.Att_Score >= 200) { - foreach (Player gangwarPlayer in this.playerInGangwar) - { - gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, 0, 0, 0); - } this.takeOver(this.Attacker); - this.Def_Score = 0; - return; } - else if (this.Att_Score < this.Def_Score) + else if (this.Def_Score >= 200) { - foreach (Player gangwarPlayer in this.playerInGangwar) - { - gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, 0, 0, 0); - } this.takeOver(this.Owner); - this.Att_Score = 0; - return; - } - else if (this.Def_Score == this.Att_Score) + }*/ + timerCount += 1; + if (timerCount >= 900) //change to 900 (seconds) before release for testing reasons change to whatever you like { - foreach (Player gangwarPlayer in this.playerInGangwar) + if (this.Att_Score > this.Def_Score) { - gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, 0, 0, 0); + foreach (Player gangwarPlayer in this.playerInGangwar) + { + if(!gangwarPlayer.IsLoggedIn()) + { + continue; + } + + gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, 0, 0, 0); + } + this.takeOver(this.Attacker); + this.Def_Score = 0; + return; + } + else if (this.Att_Score < this.Def_Score) + { + foreach (Player gangwarPlayer in this.playerInGangwar) + { + gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, 0, 0, 0); + } + this.takeOver(this.Owner); + this.Att_Score = 0; + return; + } + else if (this.Def_Score == this.Att_Score) + { + foreach (Player gangwarPlayer in this.playerInGangwar) + { + if (!gangwarPlayer.IsLoggedIn()) + { + continue; + } + + gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, 0, 0, 0); + } + this.takeOver(this.Owner); + this.Def_Score = 0; + return; } - this.takeOver(this.Owner); - this.Def_Score = 0; - return; } - } + }); } public void enter(Player client) @@ -215,7 +206,7 @@ namespace ReallifeGamemode.Server.Gangwar { if (user.Faction.Name != getOwner() && user.Faction.Name != getAttacker()) return; - Player gPlayer = playerInGangwar.Where(c => c != null && !c.Handle.IsNull && c.IsLoggedIn() && c.GetUser().Id == user.Id).FirstOrDefault(); + Player gPlayer = playerInGangwar.Where(c => c != null && !c.Handle.IsNull && c.IsLoggedIn() && c.GetUser()?.Id == user.Id).FirstOrDefault(); if (gPlayer == null) { using (var dbContext = new DatabaseContext()) @@ -294,6 +285,11 @@ namespace ReallifeGamemode.Server.Gangwar this.Attacker = null; foreach (var c in playerInGangwar) { + if (!c.IsLoggedIn()) + { + continue; + } + c.TriggerEvent("CLIENT:setAttackBlip", false, TurfID); c.ResetData("inGangWar"); c.ResetData("GotInsideOfTurf"); From 1a97d0aa3c26e466334b269c025de5c824c25e89 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Fri, 9 Apr 2021 20:14:37 +0200 Subject: [PATCH 10/11] Fix Duty-Medics / In Gangwar - TSupport wird kein Revive Auftrag erstellt --- ReallifeGamemode.Client/Gui/deathscreen.ts | 3 ++- ReallifeGamemode.Server/Events/Death.cs | 2 +- ReallifeGamemode.Server/Events/Key.cs | 4 ++-- ReallifeGamemode.Server/Factions/Medic/Medic.cs | 7 ++++--- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ReallifeGamemode.Client/Gui/deathscreen.ts b/ReallifeGamemode.Client/Gui/deathscreen.ts index 375f989a..8374bd18 100644 --- a/ReallifeGamemode.Client/Gui/deathscreen.ts +++ b/ReallifeGamemode.Client/Gui/deathscreen.ts @@ -36,7 +36,8 @@ export default function deathScreen() { deathDate = new Date(); respawnTime = Math.floor(deathDate.getTime() / 1000 + maxDeathTime); fade = 255 - maxDeathTime; - mp.game.graphics.requestStreamedTextureDict("Mptattoos", true); + mp.game.graphics.requestStreamedTextureDict("Mptattoos", true); + mp.events.call("GetDutyMedics"); taskTimeout = false; } }); diff --git a/ReallifeGamemode.Server/Events/Death.cs b/ReallifeGamemode.Server/Events/Death.cs index 3d8993d1..faeeb590 100644 --- a/ReallifeGamemode.Server/Events/Death.cs +++ b/ReallifeGamemode.Server/Events/Death.cs @@ -97,7 +97,7 @@ namespace ReallifeGamemode.Server.Events user.Dead = true; - if (!player.HasData("reviveSperre")) + if (!player.HasData("reviveSperre") || !player.HasData("inGangWar") || player.GetData("SAdminduty") == true) { //MEDIC AUFTRAG MedicTask reviveTask = new MedicTask() diff --git a/ReallifeGamemode.Server/Events/Key.cs b/ReallifeGamemode.Server/Events/Key.cs index 70012ea6..cbc7f76c 100644 --- a/ReallifeGamemode.Server/Events/Key.cs +++ b/ReallifeGamemode.Server/Events/Key.cs @@ -300,7 +300,7 @@ namespace ReallifeGamemode.Server.Events player.TriggerEvent("toggleDutyMode", true); if (player.GetUser().FactionId == 2) //Fire Department { - Medic.UpdateDutyMedics(1); + Medic.UpdateDutyMedics(); } switch (factionId) { @@ -338,7 +338,7 @@ namespace ReallifeGamemode.Server.Events user.SetData("duty", false); player.SendNotification("Du bist nun ~r~außer Dienst."); player.TriggerEvent("toggleDutyMode", false); - Medic.UpdateDutyMedics(-1); + Medic.UpdateDutyMedics(); UpdateCharacterCloth.LoadCharacterDefaults(player); } user.SetBlipAndNametagColor(); diff --git a/ReallifeGamemode.Server/Factions/Medic/Medic.cs b/ReallifeGamemode.Server/Factions/Medic/Medic.cs index 98dda68e..3d060783 100644 --- a/ReallifeGamemode.Server/Factions/Medic/Medic.cs +++ b/ReallifeGamemode.Server/Factions/Medic/Medic.cs @@ -288,10 +288,11 @@ namespace ReallifeGamemode.Server.Factions.Medic RemoveTaskFromList(task); } } - - public static void UpdateDutyMedics(int modifier) + [RemoteEvent("GetDutyMedics")] + public static void UpdateDutyMedics() { - dutyMedics = dutyMedics + modifier; + + dutyMedics = NAPI.Pools.GetAllPlayers().Where(c => c.GetData("duty") == true && c.GetUser().FactionId == 2).ToList().Count; NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", dutyMedics); } } From aa57c7d0fac05c3793987f06a236c6ad8a772049 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Fri, 9 Apr 2021 20:24:03 +0200 Subject: [PATCH 11/11] Fix UpdateDutyMedics --- ReallifeGamemode.Server/Commands/AdminCommands.cs | 6 +++--- ReallifeGamemode.Server/Events/Disconnect.cs | 2 +- ReallifeGamemode.Server/Managers/InteractionManager.cs | 2 +- ReallifeGamemode.Server/Util/FactionHelper.cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index f6a425a6..700b1006 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -468,7 +468,7 @@ namespace ReallifeGamemode.Server.Commands if (target.GetData("duty") == true) { target.SetData("duty", false); - Medic.UpdateDutyMedics(-1); + Medic.UpdateDutyMedics(); } string adminPlayername = NAPI.Player.GetPlayerName(player); @@ -783,7 +783,7 @@ namespace ReallifeGamemode.Server.Commands if (target.GetData("duty") == true) { target.SetData("duty", false); - Medic.UpdateDutyMedics(-1); + Medic.UpdateDutyMedics(); } string adminPlayername = NAPI.Player.GetPlayerName(player); @@ -871,7 +871,7 @@ namespace ReallifeGamemode.Server.Commands if (target.GetData("duty") == true) { target.SetData("duty", false); - Medic.UpdateDutyMedics(-1); + Medic.UpdateDutyMedics(); } reason = Regex.Replace(reason, "(~[a-zA-Z]~)|(!{(.*)})", ""); diff --git a/ReallifeGamemode.Server/Events/Disconnect.cs b/ReallifeGamemode.Server/Events/Disconnect.cs index 886357c5..de3dd8c8 100644 --- a/ReallifeGamemode.Server/Events/Disconnect.cs +++ b/ReallifeGamemode.Server/Events/Disconnect.cs @@ -152,7 +152,7 @@ namespace ReallifeGamemode.Server.Events if (player.GetData("duty") == true) { player.SetData("duty", false); - Medic.UpdateDutyMedics(-1); + Medic.UpdateDutyMedics(); } } } diff --git a/ReallifeGamemode.Server/Managers/InteractionManager.cs b/ReallifeGamemode.Server/Managers/InteractionManager.cs index c5189bb9..ce9c081a 100644 --- a/ReallifeGamemode.Server/Managers/InteractionManager.cs +++ b/ReallifeGamemode.Server/Managers/InteractionManager.cs @@ -255,7 +255,7 @@ namespace ReallifeGamemode.Server.Managers target.SetData("duty", false); target.TriggerEvent("toggleDutyMode", false); - Medic.UpdateDutyMedics(-1); + Medic.UpdateDutyMedics(); UpdateCharacterCloth.LoadCharacterDefaults(target); target.GetUser(dbContext).FactionRankId = null; target.GetUser(dbContext).FactionId = null; diff --git a/ReallifeGamemode.Server/Util/FactionHelper.cs b/ReallifeGamemode.Server/Util/FactionHelper.cs index 5424dfb6..1f54c2d0 100644 --- a/ReallifeGamemode.Server/Util/FactionHelper.cs +++ b/ReallifeGamemode.Server/Util/FactionHelper.cs @@ -39,7 +39,7 @@ namespace ReallifeGamemode.Server.Util if (player.GetData("duty") == true) { player.SetData("duty", false); - Medic.UpdateDutyMedics(-1); + Medic.UpdateDutyMedics(); } var userClothes = dbContext.CharacterClothes.Where(c => c.UserId == user.Id && c.Duty == true);