Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix quests not granting rupies and mana #314

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions DragaliaAPI.Test/Controllers/DungeonRecordControllerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -24,6 +25,7 @@ public class DungeonRecordControllerTest
private readonly Mock<IUpdateDataService> mockUpdateDataService;
private readonly Mock<ITutorialService> mockTutorialService;
private readonly Mock<IMissionProgressionService> mockMissionProgressionService;
private readonly Mock<IRewardService> mockRewardService;
private readonly Mock<ILogger<DungeonRecordController>> mockLogger;

private const string dungeonKey = "key";
Expand All @@ -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(
Expand All @@ -49,6 +52,7 @@ public DungeonRecordControllerTest()
this.mockUpdateDataService.Object,
this.mockTutorialService.Object,
this.mockMissionProgressionService.Object,
this.mockRewardService.Object,
this.mockLogger.Object
);

Expand Down
7 changes: 7 additions & 0 deletions DragaliaAPI/Features/Dungeon/DungeonRecordController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<DungeonRecordController> logger;

public DungeonRecordController(
Expand All @@ -37,6 +39,7 @@ public DungeonRecordController(
IUpdateDataService updateDataService,
ITutorialService tutorialService,
IMissionProgressionService missionProgressionService,
IRewardService rewardService,
ILogger<DungeonRecordController> logger
)
{
Expand All @@ -47,6 +50,7 @@ ILogger<DungeonRecordController> logger
this.updateDataService = updateDataService;
this.tutorialService = tutorialService;
this.missionProgressionService = missionProgressionService;
this.rewardService = rewardService;
this.logger = logger;
}

Expand Down Expand Up @@ -182,6 +186,9 @@ await inventoryRepository.UpdateQuantity(
drops.Select(x => new KeyValuePair<Materials, int>((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()
Expand Down
Loading