From 0d963d362f543e284929d497b41428a4a08f5837 Mon Sep 17 00:00:00 2001 From: kookroach <62265045+kookroach@users.noreply.github.com> Date: Sun, 4 Apr 2021 16:17:40 +0200 Subject: [PATCH 1/7] Fix Refuse --- .../Interaction/clothes/ClotheShop.ts | 10 ++++- .../Job/RefuseCollectorJob.cs | 45 ++++++++++--------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts index 8212aa2e..db35dec2 100644 --- a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts +++ b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts @@ -177,8 +177,14 @@ export default function clotheShopList(globalData: IGlobalData) { if (item.ComponentId == key) { var txData = getClothingName(key, item.ClotheId, gender); - categoryMenu.AddItem(new UIMenuItem(mp.game.ui.getLabelText(txData[0].data[0].GXT), "")); - let clotheUpperMenu = new UIMenu(" ", mp.game.ui.getLabelText(txData[0].data[0].GXT), new Point(0, 0), bannerSprite.library, bannerSprite.texture); + + mp.gui.chat.push('Key ' + key); + mp.gui.chat.push(item); + + if (key === 11 || key === 4 || key === 6) { + categoryMenu.AddItem(new UIMenuItem(mp.game.ui.getLabelText(txData[0].data[0].GXT), "")); + let clotheUpperMenu = new UIMenu(" ", mp.game.ui.getLabelText(txData[0].data[0].GXT), new Point(0, 0), bannerSprite.library, bannerSprite.texture); + } clotheUpperMenu.Visible = false; for (const x of txData) { diff --git a/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs b/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs index 8cdeed57..42032803 100644 --- a/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs +++ b/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs @@ -19,6 +19,8 @@ namespace ReallifeGamemode.Server.Job public override bool NeedVehicleToStart => false; + const int MAX_BAG = 50; + public RefuseCollectorJob() { JobStart += RefuseCollectorJobJobStart; @@ -168,7 +170,7 @@ namespace ReallifeGamemode.Server.Job if (data.getDataFromClient(player) == null) continue; veh = data.vehicle; JobBase job = JobManager.GetJob(player.GetUser().JobId ?? -1); - ChatService.SendMessage((Player)player, $"~y~Job: ~s~Du hast deinen Job (~o~{job.Name}~s~) gestartet."); + ChatService.SendMessage((Player)player, $"~y~[Job] ~s~Du hast deinen Job (~o~{job.Name}~s~) gestartet."); player.TriggerEvent("SERVER:MuellmannStatusTrue"); player.TriggerEvent("SERVER:MuellmannBCSErstellen", JsonConvert.SerializeObject(vector3s.ToArray()), veh); return; @@ -179,10 +181,8 @@ namespace ReallifeGamemode.Server.Job public void MuellmannJobBeenden(Player player) { JobBase job = JobManager.GetJob(player.GetUser().JobId ?? -1); - ChatService.SendMessage((Player)player, $"~y~Job: ~s~Du hast deinen Job (~o~{job.Name}~s~) beendet."); player.TriggerEvent("SERVER:MuellmannStatusFalse"); player.TriggerEvent("SERVER:MuellmannBCSEntfernen"); - job.StopJob(player, true); foreach (var data in muellmanData) { @@ -195,6 +195,7 @@ namespace ReallifeGamemode.Server.Job muellmanData.Remove(data); return; } + ChatService.SendMessage(data.getPartnerClient(player), $"~y~[Job] ~s~Dein Partner hat den Job beendet."); data.removeClientFromData(player); return; @@ -233,28 +234,30 @@ namespace ReallifeGamemode.Server.Job User user2 = target.GetUser(dbContext); - data.setTrashCount(data.getTrashCount() + 1); - player.SendNotification("Müllsack: " + data.getTrashCount() + " von 20."); - if (target != null) - { - target.SendNotification("Müllsack: " + data.getTrashCount() + " von 20."); - } - dbContext.SaveChanges(); - // player.AddAttachment("binbag", true); - if (data.getTrashCount() >= 20) + if (data.getTrashCount() == MAX_BAG) { - ChatService.SendMessage((Player)player, "~y~Job: ~s~Der Müllwagen ist voll. Fahre nun zurück zur Recyclinganlage!"); + ChatService.SendMessage((Player)player, "~y~[Job] ~s~Der Müllwagen ist voll. Fahre nun zurück zur Recyclinganlage!"); if (target != null) { - ChatService.SendMessage((Player)target, "~y~Job: ~s~Der Müllwagen ist voll! Er muss entleert werden."); + ChatService.SendMessage((Player)target, "~y~[Job] ~s~Der Müllwagen ist voll! Er muss entleert werden."); target.TriggerEvent("SERVER:MuellmannZuBase"); } player.TriggerEvent("SERVER:MuellmannZuBase"); + }else if(data.getTrashCount() > MAX_BAG) + { + ChatService.ErrorMessage((Player)player, "Der Müllwagen ist schon voll."); } else { + data.setTrashCount(data.getTrashCount() + 1); + player.SendNotification("Müllsack: " + data.getTrashCount() + " von " + MAX_BAG + "."); + if (target != null) + { + target.SendNotification("Müllsack: " + data.getTrashCount() + " von " + MAX_BAG + "."); + } + if (target != null) { @@ -282,15 +285,15 @@ namespace ReallifeGamemode.Server.Job if (data.getDataFromClient(player) == null) continue; Player target = data.getPartnerClient(player); - if (target != null) ChatService.SendMessage((Player)target, $"~y~Job: ~s~Fahrzeug wurde entleert. Säcke: {data.getTrashCount()}"); - ChatService.SendMessage((Player)player, $"~y~Job: ~s~Fahrzeug wurde entleert. Säcke: {data.getTrashCount()}"); + if (target != null) ChatService.SendMessage((Player)target, $"~y~[Job] ~s~Fahrzeug wurde entleert. Säcke: {data.getTrashCount()}"); + ChatService.SendMessage((Player)player, $"~y~[Job] ~s~Fahrzeug wurde entleert. Säcke: {data.getTrashCount()}"); //bonus pro sack using (var dbContext = new DatabaseContext()) { User user1 = player.GetUser(dbContext); User user2 = target.GetUser(dbContext); - int bonus = 25 * data.getTrashCount(); + int bonus = 5 * data.getTrashCount(); if (target != null) { @@ -372,8 +375,8 @@ namespace ReallifeGamemode.Server.Job if (target == null) return; - ChatService.SendMessage((Player)player, $"~y~Job: ~s~Dein Partner ist {target.Name}!"); - ChatService.SendMessage((Player)target, $"~y~Job: ~s~Dein Partner ist {player.Name}!"); + ChatService.SendMessage((Player)player, $"~y~[Job] ~s~Dein Partner ist {target.Name}!"); + ChatService.SendMessage((Player)target, $"~y~[Job] ~s~Dein Partner ist {player.Name}!"); return; } } @@ -389,8 +392,8 @@ namespace ReallifeGamemode.Server.Job if (target == null) return; - ChatService.SendMessage((Player)player, $"~y~Job: ~s~Dein Partner ist {target.Name}!"); - ChatService.SendMessage((Player)target, $"~y~Job: ~s~Dein Partner ist {player.Name}!"); + ChatService.SendMessage((Player)player, $"~y~[Job] ~s~Dein Partner ist {target.Name}!"); + ChatService.SendMessage((Player)target, $"~y~[Job] ~s~Dein Partner ist {player.Name}!"); } } From 996bd29a37308701f90abcdb8b35669a47d078ec Mon Sep 17 00:00:00 2001 From: kookroach <62265045+kookroach@users.noreply.github.com> Date: Sun, 4 Apr 2021 16:18:42 +0200 Subject: [PATCH 2/7] Change Refuse --- .../Job/RefuseCollectorJob.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs b/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs index 42032803..a348d29a 100644 --- a/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs +++ b/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs @@ -233,6 +233,12 @@ namespace ReallifeGamemode.Server.Job User user1 = player.GetUser(dbContext); User user2 = target.GetUser(dbContext); + data.setTrashCount(data.getTrashCount() + 1); + player.SendNotification("Müllsack: " + data.getTrashCount() + " von " + MAX_BAG + "."); + if (target != null) + { + target.SendNotification("Müllsack: " + data.getTrashCount() + " von " + MAX_BAG + "."); + } // player.AddAttachment("binbag", true); @@ -245,19 +251,14 @@ namespace ReallifeGamemode.Server.Job target.TriggerEvent("SERVER:MuellmannZuBase"); } player.TriggerEvent("SERVER:MuellmannZuBase"); - }else if(data.getTrashCount() > MAX_BAG) + } + else if(data.getTrashCount() > MAX_BAG) { + data.setTrashCount(MAX_BAG); ChatService.ErrorMessage((Player)player, "Der Müllwagen ist schon voll."); } else { - data.setTrashCount(data.getTrashCount() + 1); - player.SendNotification("Müllsack: " + data.getTrashCount() + " von " + MAX_BAG + "."); - if (target != null) - { - target.SendNotification("Müllsack: " + data.getTrashCount() + " von " + MAX_BAG + "."); - } - if (target != null) { From 0df5f90a432b3e43b259a3ccf03b30c8ef984bd2 Mon Sep 17 00:00:00 2001 From: kookroach <62265045+kookroach@users.noreply.github.com> Date: Sun, 4 Apr 2021 16:22:17 +0200 Subject: [PATCH 3/7] fix --- .../Interaction/clothes/ClotheShop.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts index db35dec2..6d64c95e 100644 --- a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts +++ b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts @@ -172,7 +172,7 @@ export default function clotheShopList(globalData: IGlobalData) { mainMenu.Item // Fill it - + let clotheUpperMenu; for (const item of value) { if (item.ComponentId == key) { @@ -180,12 +180,13 @@ export default function clotheShopList(globalData: IGlobalData) { mp.gui.chat.push('Key ' + key); mp.gui.chat.push(item); - + if (key === 11 || key === 4 || key === 6) { categoryMenu.AddItem(new UIMenuItem(mp.game.ui.getLabelText(txData[0].data[0].GXT), "")); - let clotheUpperMenu = new UIMenu(" ", mp.game.ui.getLabelText(txData[0].data[0].GXT), new Point(0, 0), bannerSprite.library, bannerSprite.texture); + clotheUpperMenu = new UIMenu(" ", mp.game.ui.getLabelText(txData[0].data[0].GXT), new Point(0, 0), bannerSprite.library, bannerSprite.texture); + clotheUpperMenu.Visible = false; + } - clotheUpperMenu.Visible = false; for (const x of txData) { var itemDescription = (key === 11 ? mp.game.ui.getLabelText(x.undershirt[1].GXT) : " "); From 0af43fb32b37bac974f77ae8a9e839b30ed61505 Mon Sep 17 00:00:00 2001 From: kookroach <62265045+kookroach@users.noreply.github.com> Date: Sun, 4 Apr 2021 16:28:47 +0200 Subject: [PATCH 4/7] Debug Msg --- ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts index 6d64c95e..2b6d853c 100644 --- a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts +++ b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts @@ -180,8 +180,8 @@ export default function clotheShopList(globalData: IGlobalData) { mp.gui.chat.push('Key ' + key); mp.gui.chat.push(item); - - if (key === 11 || key === 4 || key === 6) { + + if (txData[0].data == undefined) { categoryMenu.AddItem(new UIMenuItem(mp.game.ui.getLabelText(txData[0].data[0].GXT), "")); clotheUpperMenu = new UIMenu(" ", mp.game.ui.getLabelText(txData[0].data[0].GXT), new Point(0, 0), bannerSprite.library, bannerSprite.texture); clotheUpperMenu.Visible = false; From 3a37ed7b9be0078b3dcf252deca5b17fccb2a495 Mon Sep 17 00:00:00 2001 From: kookroach <62265045+kookroach@users.noreply.github.com> Date: Sun, 4 Apr 2021 16:29:13 +0200 Subject: [PATCH 5/7] fix fix --- ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts index 2b6d853c..063d1ac2 100644 --- a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts +++ b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts @@ -181,7 +181,7 @@ export default function clotheShopList(globalData: IGlobalData) { mp.gui.chat.push('Key ' + key); mp.gui.chat.push(item); - if (txData[0].data == undefined) { + if (txData[0].data != undefined) { categoryMenu.AddItem(new UIMenuItem(mp.game.ui.getLabelText(txData[0].data[0].GXT), "")); clotheUpperMenu = new UIMenu(" ", mp.game.ui.getLabelText(txData[0].data[0].GXT), new Point(0, 0), bannerSprite.library, bannerSprite.texture); clotheUpperMenu.Visible = false; From 6140ccc495a317761ea708b2790c9d15ecdc8fb1 Mon Sep 17 00:00:00 2001 From: kookroach <62265045+kookroach@users.noreply.github.com> Date: Sun, 4 Apr 2021 16:33:27 +0200 Subject: [PATCH 6/7] fix clothe --- ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts index 063d1ac2..502f7869 100644 --- a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts +++ b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts @@ -181,7 +181,7 @@ export default function clotheShopList(globalData: IGlobalData) { mp.gui.chat.push('Key ' + key); mp.gui.chat.push(item); - if (txData[0].data != undefined) { + if (txData != undefined) { categoryMenu.AddItem(new UIMenuItem(mp.game.ui.getLabelText(txData[0].data[0].GXT), "")); clotheUpperMenu = new UIMenu(" ", mp.game.ui.getLabelText(txData[0].data[0].GXT), new Point(0, 0), bannerSprite.library, bannerSprite.texture); clotheUpperMenu.Visible = false; From 889a8e5cd0545f854835ab8916ee70928e6dd1b5 Mon Sep 17 00:00:00 2001 From: kookroach <62265045+kookroach@users.noreply.github.com> Date: Sun, 4 Apr 2021 16:38:15 +0200 Subject: [PATCH 7/7] debug --- ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts index 502f7869..9eb0dccf 100644 --- a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts +++ b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts @@ -181,7 +181,7 @@ export default function clotheShopList(globalData: IGlobalData) { mp.gui.chat.push('Key ' + key); mp.gui.chat.push(item); - if (txData != undefined) { + if (txData != undefined && txData.length > 0) { categoryMenu.AddItem(new UIMenuItem(mp.game.ui.getLabelText(txData[0].data[0].GXT), "")); clotheUpperMenu = new UIMenu(" ", mp.game.ui.getLabelText(txData[0].data[0].GXT), new Point(0, 0), bannerSprite.library, bannerSprite.texture); clotheUpperMenu.Visible = false;