From 35518f0eef759f92f91b91ea6b0198ce86eff354 Mon Sep 17 00:00:00 2001 From: Chomp Date: Sun, 19 Jan 2025 19:36:49 +0000 Subject: [PATCH] Added new mechanic gift on profile create --- Libraries/Core/Controllers/GameController.cs | 10 ++++++++++ Libraries/Core/Services/GiftService.cs | 15 ++++++++++++++- Server/Assets/configs/gifts.json | 18 ++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/Libraries/Core/Controllers/GameController.cs b/Libraries/Core/Controllers/GameController.cs index 6d5164c8..6da67018 100644 --- a/Libraries/Core/Controllers/GameController.cs +++ b/Libraries/Core/Controllers/GameController.cs @@ -129,6 +129,7 @@ public class GameController( if (pmcProfile.Inventory is not null) { SendPraporGiftsToNewProfiles(pmcProfile); + SendMechanicGiftsToNewProfile(pmcProfile); _profileFixerService.CheckForOrphanedModdedItems(sessionId, fullProfile); } @@ -457,6 +458,15 @@ public class GameController( } } + /** + * Mechanic sends players a measuring tape on profile start for some reason + * @param pmcProfile Player profile + */ + protected void SendMechanicGiftsToNewProfile(PmcData pmcProfile) + { + _giftService.SendGiftWithSilentReceivedCheck("MechanicGiftDay1", pmcProfile.SessionId, 1); + } + /// /// Get a list of installed mods and save their details to the profile being used /// diff --git a/Libraries/Core/Services/GiftService.cs b/Libraries/Core/Services/GiftService.cs index 4942ac19..70a29dec 100644 --- a/Libraries/Core/Services/GiftService.cs +++ b/Libraries/Core/Services/GiftService.cs @@ -238,11 +238,24 @@ public class GiftService( if (giftId is not null) { - //var giftData = GetGiftById(giftId); if (!_profileHelper.PlayerHasRecievedMaxNumberOfGift(sessionId, giftId, 1)) { SendGiftToPlayer(sessionId, giftId); } } } + + /** + * Send player a gift with silent received check + * @param giftId Id of gift to send + * @param sessionId Session id of player to send to + * @param giftCount OPTIONAL How many to send + */ + public void SendGiftWithSilentReceivedCheck(string giftId, string? sessionId, int giftCount) + { + if (!_profileHelper.PlayerHasRecievedMaxNumberOfGift(sessionId, giftId, giftCount)) + { + SendGiftToPlayer(sessionId, giftId); + } + } } diff --git a/Server/Assets/configs/gifts.json b/Server/Assets/configs/gifts.json index 6d460052..69c97b30 100644 --- a/Server/Assets/configs/gifts.json +++ b/Server/Assets/configs/gifts.json @@ -1300,6 +1300,24 @@ "collectionTimeHours": 48, "maxToSendPlayer": 5 }, + "MechanicGiftDay1": { + "items": [ + { + "_id": "678d4d81189b5f2a7538f14d", + "_tpl": "590c2c9c86f774245b1f03f2", + "slotId": "main", + "upd": { + "StackObjectsCount": 1 + }, + "parentId": "678d4d90fc70718b8c4067ad" + } + ], + "sender": "Trader", + "trader": "MECHANIC", + "localeTextId": "6776e324810eb26b880fb4a5 0", + "collectionTimeHours": 72, + "maxToSendPlayer": 1 + }, "KAPPA4U": { "items": [ {