From 7efb465ae321b4df3ef660dd9f3325f7d53ea7cb Mon Sep 17 00:00:00 2001 From: Jay Malhotra <5047192+SapiensAnatis@users.noreply.github.com> Date: Wed, 19 Jul 2023 19:54:57 +0100 Subject: [PATCH] Fix quests not granting rupies and mana (#314) --- .../Controllers/DungeonRecordControllerTest.cs | 4 ++++ DragaliaAPI/Features/Dungeon/DungeonRecordController.cs | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/DragaliaAPI.Test/Controllers/DungeonRecordControllerTest.cs b/DragaliaAPI.Test/Controllers/DungeonRecordControllerTest.cs index 0b0e8e1cd..0fc8b668e 100644 --- a/DragaliaAPI.Test/Controllers/DungeonRecordControllerTest.cs +++ b/DragaliaAPI.Test/Controllers/DungeonRecordControllerTest.cs @@ -2,6 +2,7 @@ using DragaliaAPI.Database.Repositories; using DragaliaAPI.Features.Dungeon; using DragaliaAPI.Features.Missions; +using DragaliaAPI.Features.Reward; using DragaliaAPI.Models; using DragaliaAPI.Models.Generated; using DragaliaAPI.Services; @@ -24,6 +25,7 @@ public class DungeonRecordControllerTest private readonly Mock mockUpdateDataService; private readonly Mock mockTutorialService; private readonly Mock mockMissionProgressionService; + private readonly Mock mockRewardService; private readonly Mock> mockLogger; private const string dungeonKey = "key"; @@ -39,6 +41,7 @@ public DungeonRecordControllerTest() this.mockUpdateDataService = new(MockBehavior.Strict); this.mockTutorialService = new(MockBehavior.Strict); this.mockMissionProgressionService = new(MockBehavior.Strict); + this.mockRewardService = new(MockBehavior.Loose); // This file is about to be overhauled anyway this.mockLogger = new(MockBehavior.Loose); this.dungeonRecordController = new( @@ -49,6 +52,7 @@ public DungeonRecordControllerTest() this.mockUpdateDataService.Object, this.mockTutorialService.Object, this.mockMissionProgressionService.Object, + this.mockRewardService.Object, this.mockLogger.Object ); diff --git a/DragaliaAPI/Features/Dungeon/DungeonRecordController.cs b/DragaliaAPI/Features/Dungeon/DungeonRecordController.cs index a294c17d2..b56a89e76 100644 --- a/DragaliaAPI/Features/Dungeon/DungeonRecordController.cs +++ b/DragaliaAPI/Features/Dungeon/DungeonRecordController.cs @@ -3,6 +3,7 @@ using DragaliaAPI.Database.Entities; using DragaliaAPI.Database.Repositories; using DragaliaAPI.Features.Missions; +using DragaliaAPI.Features.Reward; using DragaliaAPI.Middleware; using DragaliaAPI.Models; using DragaliaAPI.Models.Generated; @@ -27,6 +28,7 @@ public class DungeonRecordController : DragaliaControllerBase private readonly IUpdateDataService updateDataService; private readonly ITutorialService tutorialService; private readonly IMissionProgressionService missionProgressionService; + private readonly IRewardService rewardService; private readonly ILogger logger; public DungeonRecordController( @@ -37,6 +39,7 @@ public DungeonRecordController( IUpdateDataService updateDataService, ITutorialService tutorialService, IMissionProgressionService missionProgressionService, + IRewardService rewardService, ILogger logger ) { @@ -47,6 +50,7 @@ ILogger logger this.updateDataService = updateDataService; this.tutorialService = tutorialService; this.missionProgressionService = missionProgressionService; + this.rewardService = rewardService; this.logger = logger; } @@ -182,6 +186,9 @@ await inventoryRepository.UpdateQuantity( drops.Select(x => new KeyValuePair((Materials)x.id, x.quantity)) ); + await this.rewardService.GrantReward(new Entity(EntityTypes.Rupies, Quantity: coinDrop)); + await this.rewardService.GrantReward(new Entity(EntityTypes.Mana, Quantity: manaDrop)); + UpdateDataList updateDataList = await updateDataService.SaveChangesAsync(); return new DungeonRecordRecordData()