diff --git a/DragaliaAPI/DragaliaAPI.Integration.Test/Features/Dungeon/DungeonRecordTest.cs b/DragaliaAPI/DragaliaAPI.Integration.Test/Features/Dungeon/DungeonRecordTest.cs index d1db609e2..3dc1a6c07 100644 --- a/DragaliaAPI/DragaliaAPI.Integration.Test/Features/Dungeon/DungeonRecordTest.cs +++ b/DragaliaAPI/DragaliaAPI.Integration.Test/Features/Dungeon/DungeonRecordTest.cs @@ -49,7 +49,7 @@ await AddToDatabase( { Party = new List() { new() { CharaId = Charas.ThePrince } }, QuestData = MasterAsset.QuestData.Get(questId), - EnemyList = new Dictionary>() + EnemyList = new Dictionary>() { { 1, @@ -222,10 +222,7 @@ await Client.PostMsgpack( }, }, QuestData = MasterAsset.QuestData.Get(questId), - EnemyList = new Dictionary>() - { - { 1, Enumerable.Empty() }, - }, + EnemyList = new Dictionary>() { { 1, [] } }, }; string key = await this.StartDungeon(mockSession); @@ -273,10 +270,7 @@ await Client.PostMsgpack( { Party = new List() { new() { CharaId = Charas.ThePrince } }, QuestData = MasterAsset.QuestData.Get(questId), - EnemyList = new Dictionary>() - { - { 1, Enumerable.Empty() }, - }, + EnemyList = new Dictionary>() { { 1, [] } }, }; string key = await this.StartDungeon(mockSession); @@ -335,10 +329,7 @@ await Client.PostMsgpack( }, }, QuestData = MasterAsset.QuestData.Get(questId), - EnemyList = new Dictionary>() - { - { 1, Enumerable.Empty() }, - }, + EnemyList = new Dictionary>() { { 1, [] } }, }; string key = await this.StartDungeon(mockSession); @@ -399,10 +390,7 @@ await Client.PostMsgpack( { Party = new List() { new() { CharaId = Charas.ThePrince } }, QuestData = MasterAsset.QuestData.Get(questId), - EnemyList = new Dictionary>() - { - { 1, Enumerable.Empty() }, - }, + EnemyList = new Dictionary>() { { 1, [] } }, }; string key = await this.StartDungeon(mockSession); @@ -454,10 +442,7 @@ await Client.PostMsgpack( { Party = new List() { new() { CharaId = Charas.ThePrince } }, QuestData = MasterAsset.QuestData.Get(questId), - EnemyList = new Dictionary>() - { - { 1, Enumerable.Empty() }, - }, + EnemyList = new Dictionary>() { { 1, [] } }, }; string key = await this.StartDungeon(mockSession); @@ -501,10 +486,7 @@ await Client.PostMsgpack( { Party = new List() { new() { CharaId = Charas.ThePrince } }, QuestData = MasterAsset.QuestData.Get(exQuestId), - EnemyList = new Dictionary>() - { - { 1, Enumerable.Empty() }, - }, + EnemyList = new Dictionary>() { { 1, [] } }, }; string key = await this.StartDungeon(mockSession); @@ -553,10 +535,7 @@ await Client.PostMsgpack( { Party = new List() { new() { CharaId = Charas.ThePrince } }, QuestData = MasterAsset.QuestData.Get(questId), - EnemyList = new Dictionary>() - { - { 1, Enumerable.Empty() }, - }, + EnemyList = new Dictionary>() { { 1, [] } }, }; string key = await this.StartDungeon(mockSession); @@ -608,10 +587,7 @@ await Client.PostMsgpack( { Party = new List() { new() { CharaId = Charas.ThePrince } }, QuestData = MasterAsset.QuestData.Get(questId), - EnemyList = new Dictionary>() - { - { 1, Enumerable.Empty() }, - }, + EnemyList = new Dictionary>() { { 1, [] } }, }; string key = await this.StartDungeon(mockSession); @@ -669,10 +645,7 @@ await Client.PostMsgpack( { Party = new List() { new() { CharaId = Charas.ThePrince } }, QuestData = MasterAsset.QuestData.Get(questId), - EnemyList = new Dictionary>() - { - { 1, Enumerable.Empty() }, - }, + EnemyList = new Dictionary>() { { 1, [] } }, }; string key = await this.StartDungeon(mockSession); @@ -718,10 +691,7 @@ await Client.PostMsgpack( { Party = new List() { new() { CharaId = Charas.ThePrince } }, QuestData = MasterAsset.QuestData.Get(questId), - EnemyList = new Dictionary>() - { - { 1, Enumerable.Empty() }, - }, + EnemyList = new Dictionary>() { { 1, [] } }, }; string key = await this.StartDungeon(mockSession); @@ -780,7 +750,7 @@ await Client.PostMsgpack( { Party = new List() { new() { CharaId = Charas.ThePrince } }, QuestData = MasterAsset.QuestData.Get(questId), - EnemyList = new Dictionary>() + EnemyList = new Dictionary>() { { 1, @@ -859,10 +829,7 @@ public async Task Record_HandlesNonExistentQuestData() { Party = new List() { new() { CharaId = Charas.ThePrince } }, QuestData = MasterAsset.QuestData.Get(questId), - EnemyList = new Dictionary>() - { - { 1, Enumerable.Empty() }, - }, + EnemyList = new Dictionary>() { { 1, [] } }, }; string key = await this.StartDungeon(mockSession); @@ -983,7 +950,7 @@ await AddToDatabase( { Party = new List() { new() { CharaId = Charas.ThePrince } }, QuestData = MasterAsset.QuestData.Get(questId), - EnemyList = new Dictionary>(), + EnemyList = new Dictionary>(), }; string key = await this.StartDungeon(mockSession); @@ -1038,7 +1005,7 @@ await AddToDatabase( { Party = new List() { new() { CharaId = Charas.ThePrince } }, QuestData = MasterAsset.QuestData.Get(questId), - EnemyList = new Dictionary>(), + EnemyList = new Dictionary>(), }; string key = await this.StartDungeon(mockSession); @@ -1090,7 +1057,7 @@ await this.AddToDatabase( { Party = new List() { new() { CharaId = Charas.ThePrince } }, QuestData = MasterAsset.QuestData.Get(questId), - EnemyList = new Dictionary>(), + EnemyList = new Dictionary>(), } ); @@ -1141,7 +1108,7 @@ await Client.PostMsgpack("/dungeon_record/record", { Party = new List() { new() { CharaId = Charas.ThePrince } }, QuestData = MasterAsset.QuestData.Get(questId), - EnemyList = new Dictionary>(), + EnemyList = new Dictionary>(), } ); @@ -1177,7 +1144,7 @@ await this.AddToDatabase( { Party = new List() { new() { CharaId = Charas.ThePrince } }, QuestData = MasterAsset.QuestData.Get(questId), - EnemyList = new Dictionary>(), + EnemyList = new Dictionary>(), } ); @@ -1226,7 +1193,7 @@ await this.AddToDatabase( { Party = new List() { new() { CharaId = Charas.ThePrince } }, QuestData = MasterAsset.QuestData.Get(questId), - EnemyList = new Dictionary>(), + EnemyList = new Dictionary>(), } ); @@ -1281,6 +1248,185 @@ await this.Client.PostMsgpack( .Contain(x => x.MessageId == PresentMessage.SocialReward && x.MessageParamValue1 == 2); } + [Fact] + public async Task Record_DragonEssencesAvailable_GrantsEssences() + { + // Ch. 5 / 4-3 Dark Terminus (Hard) + int questId = 100050209; + int existingEssenceQuantity = this + .ApiContext.PlayerMaterials.First(x => x.MaterialId == Materials.ChthoniussEssence) + .Quantity; + + await this.AddToDatabase(new DbQuest() { QuestId = questId, DailyPlayCount = 0 }); + + string dungeonKey = await this.StartDungeon( + new() + { + Party = new List() { new() { CharaId = Charas.ThePrince } }, + QuestData = MasterAsset.QuestData.Get(questId), + EnemyList = new Dictionary>(), + } + ); + + DungeonRecordRecordRequest request = + new() + { + DungeonKey = dungeonKey, + PlayRecord = new PlayRecord + { + Time = 10, + TreasureRecord = new List() + { + new() { AreaIdx = 1, Enemy = [] }, + }, + LiveUnitNoList = new List(), + DamageRecord = [], + DragonDamageRecord = [], + BattleRoyalRecord = new AtgenBattleRoyalRecord(), + }, + }; + + DungeonRecordRecordResponse response = ( + await Client.PostMsgpack("/dungeon_record/record", request) + ).Data; + + response.UpdateDataList.MaterialList.Should().NotBeNull(); + response + .UpdateDataList.MaterialList.Should() + .Contain(x => x.MaterialId == Materials.ChthoniussEssence) + .Which.Quantity.Should() + .Be(existingEssenceQuantity + 1); + } + + [Fact] + public async Task Record_DragonEssencesNotAvailable_StopsGivingEssence() + { + // Ch. 5 / 4-3 Dark Terminus (Hard) + int questId = 100050209; + int existingEssenceQuantity = this + .ApiContext.PlayerMaterials.First(x => x.MaterialId == Materials.ChthoniussEssence) + .Quantity; + + await this.AddToDatabase( + new DbQuest() + { + QuestId = questId, + DailyPlayCount = 2, + LastDailyResetTime = DateTimeOffset.UtcNow, + } + ); + + string dungeonKey = await this.StartDungeon( + new() + { + Party = new List() { new() { CharaId = Charas.ThePrince } }, + QuestData = MasterAsset.QuestData.Get(questId), + EnemyList = new Dictionary>(), + } + ); + + DungeonRecordRecordRequest request = + new() + { + DungeonKey = dungeonKey, + PlayRecord = new PlayRecord + { + Time = 10, + TreasureRecord = new List() + { + new() { AreaIdx = 1, Enemy = [] }, + }, + LiveUnitNoList = new List(), + DamageRecord = [], + DragonDamageRecord = [], + BattleRoyalRecord = new AtgenBattleRoyalRecord(), + }, + }; + + DungeonRecordRecordResponse response = ( + await Client.PostMsgpack("/dungeon_record/record", request) + ).Data; + + response.UpdateDataList.MaterialList.Should().NotBeNull(); + response + .UpdateDataList.MaterialList.Should() + .Contain(x => x.MaterialId == Materials.ChthoniussEssence) + .Which.Quantity.Should() + .Be(existingEssenceQuantity + 1); + + request.DungeonKey = await this.StartDungeon( + new() + { + Party = new List() { new() { CharaId = Charas.ThePrince } }, + QuestData = MasterAsset.QuestData.Get(questId), + EnemyList = new Dictionary>(), + } + ); + + DungeonRecordRecordResponse secondResponse = ( + await Client.PostMsgpack("/dungeon_record/record", request) + ).Data; + + secondResponse.UpdateDataList.MaterialList.Should().BeNull(); + } + + [Fact] + public async Task Record_DragonEssencesEarnedBeforeReset_ResetsAndGrantsEssence() + { + // Ch. 5 / 4-3 Dark Terminus (Hard) + int questId = 100050209; + int existingEssenceQuantity = this + .ApiContext.PlayerMaterials.First(x => x.MaterialId == Materials.ChthoniussEssence) + .Quantity; + + await this.AddToDatabase( + new DbQuest() + { + QuestId = questId, + DailyPlayCount = 3, + LastDailyResetTime = DateTimeOffset.UtcNow.AddDays(-2), + } + ); + + string dungeonKey = await this.StartDungeon( + new() + { + Party = new List() { new() { CharaId = Charas.ThePrince } }, + QuestData = MasterAsset.QuestData.Get(questId), + EnemyList = new Dictionary>(), + } + ); + + DungeonRecordRecordRequest request = + new() + { + DungeonKey = dungeonKey, + PlayRecord = new PlayRecord + { + Time = 10, + TreasureRecord = new List() + { + new() { AreaIdx = 1, Enemy = [] }, + }, + LiveUnitNoList = new List(), + DamageRecord = [], + DragonDamageRecord = [], + BattleRoyalRecord = new AtgenBattleRoyalRecord(), + }, + }; + + DungeonRecordRecordResponse response = ( + await Client.PostMsgpack("/dungeon_record/record", request) + ).Data; + + response.UpdateDataList.MaterialList.Should().NotBeNull(); + response + .UpdateDataList.MaterialList.Should() + .Contain(x => x.MaterialId == Materials.ChthoniussEssence) + .Which.Quantity.Should() + .Be(existingEssenceQuantity + 1); + } + private async Task StartDungeon(DungeonSession session) { string key = this.DungeonService.CreateSession(session); diff --git a/DragaliaAPI/DragaliaAPI.Integration.Test/Features/Dungeon/DungeonSkipTest.cs b/DragaliaAPI/DragaliaAPI.Integration.Test/Features/Dungeon/DungeonSkipTest.cs index bdb77ec2d..ecc5f3875 100644 --- a/DragaliaAPI/DragaliaAPI.Integration.Test/Features/Dungeon/DungeonSkipTest.cs +++ b/DragaliaAPI/DragaliaAPI.Integration.Test/Features/Dungeon/DungeonSkipTest.cs @@ -271,6 +271,38 @@ await this.Client.PostMsgpack( ); } + [Fact] + public async Task DungeonSkipStart_RewardsCorrectDragonEssences() + { + // Ch. 5 / 4-3 Dark Terminus (Hard) + int questId = 100050209; + int existingEssenceQuantity = this + .ApiContext.PlayerMaterials.First(x => x.MaterialId == Materials.ChthoniussEssence) + .Quantity; + + await this.AddToDatabase(new DbQuest() { QuestId = questId, DailyPlayCount = 0 }); + + DungeonSkipStartResponse response = ( + await this.Client.PostMsgpack( + $"{Endpoint}/start", + new DungeonSkipStartRequest() + { + PartyNo = 1, + PlayCount = 4, + SupportViewerId = 1000, + QuestId = questId, + } + ) + ).Data; + + response.UpdateDataList.MaterialList.Should().NotBeNull(); + response + .UpdateDataList.MaterialList.Should() + .Contain(x => x.MaterialId == Materials.ChthoniussEssence) + .Which.Quantity.Should() + .Be(existingEssenceQuantity + 3); + } + [Fact] public async Task DungeonSkipStart_CompletesDailyMissions() { diff --git a/DragaliaAPI/DragaliaAPI.Shared/MasterAsset/Models/QuestRewards/QuestRewardData.cs b/DragaliaAPI/DragaliaAPI.Shared/MasterAsset/Models/QuestRewards/QuestRewardData.cs index c3af29f74..83ce4a655 100644 --- a/DragaliaAPI/DragaliaAPI.Shared/MasterAsset/Models/QuestRewards/QuestRewardData.cs +++ b/DragaliaAPI/DragaliaAPI.Shared/MasterAsset/Models/QuestRewards/QuestRewardData.cs @@ -39,7 +39,8 @@ public record QuestRewardData( int FirstClearSetEntityQuantity4, EntityTypes FirstClearSetEntityType5, int FirstClearSetEntityId5, - int FirstClearSetEntityQuantity5 + int FirstClearSetEntityQuantity5, + Materials DropLimitBreakMaterialId ) { [IgnoreMember] diff --git a/DragaliaAPI/DragaliaAPI.Test/Features/Dungeon/Record/DungeonRecordRewardServiceTest.cs b/DragaliaAPI/DragaliaAPI.Test/Features/Dungeon/Record/DungeonRecordRewardServiceTest.cs index 2fbf972ed..3af830dbc 100644 --- a/DragaliaAPI/DragaliaAPI.Test/Features/Dungeon/Record/DungeonRecordRewardServiceTest.cs +++ b/DragaliaAPI/DragaliaAPI.Test/Features/Dungeon/Record/DungeonRecordRewardServiceTest.cs @@ -129,7 +129,7 @@ public async Task ProcessEnemyDrops_RewardsCorrectDrops() { QuestData = null!, Party = null!, - EnemyList = new Dictionary>() + EnemyList = new Dictionary>() { { 0, diff --git a/DragaliaAPI/DragaliaAPI.Test/Features/Dungeon/Record/DungeonRecordServiceTest.cs b/DragaliaAPI/DragaliaAPI.Test/Features/Dungeon/Record/DungeonRecordServiceTest.cs index f535ad3bb..4fd1c9fc5 100644 --- a/DragaliaAPI/DragaliaAPI.Test/Features/Dungeon/Record/DungeonRecordServiceTest.cs +++ b/DragaliaAPI/DragaliaAPI.Test/Features/Dungeon/Record/DungeonRecordServiceTest.cs @@ -186,6 +186,8 @@ public async Task GenerateIngameResultData_CallsExpectedMethods() eventDrops ) ); + this.mockDungeonRewardService.Setup(x => x.ProcessDraconicEssenceDrops(session)) + .ReturnsAsync([]); this.mockQuestService.Setup(x => x.GetQuestStamina(lSurtrSoloId, StaminaType.Single)) .ReturnsAsync(40); diff --git a/DragaliaAPI/DragaliaAPI/Features/Dungeon/DungeonSession.cs b/DragaliaAPI/DragaliaAPI/Features/Dungeon/DungeonSession.cs index 345030e81..52d3f720c 100644 --- a/DragaliaAPI/DragaliaAPI/Features/Dungeon/DungeonSession.cs +++ b/DragaliaAPI/DragaliaAPI/Features/Dungeon/DungeonSession.cs @@ -18,7 +18,7 @@ public class DungeonSession public DateTimeOffset StartTime { get; init; } - public Dictionary> EnemyList { get; set; } = new(); + public Dictionary> EnemyList { get; set; } = new(); public int PlayCount { get; init; } = 1; diff --git a/DragaliaAPI/DragaliaAPI/Features/Dungeon/IQuestEnemyService.cs b/DragaliaAPI/DragaliaAPI/Features/Dungeon/IQuestEnemyService.cs index 58d6d7340..ee905793c 100644 --- a/DragaliaAPI/DragaliaAPI/Features/Dungeon/IQuestEnemyService.cs +++ b/DragaliaAPI/DragaliaAPI/Features/Dungeon/IQuestEnemyService.cs @@ -4,7 +4,7 @@ namespace DragaliaAPI.Features.Dungeon; public interface IQuestEnemyService { - IEnumerable BuildQuestEnemyList(int questId, int areaNum); + IList BuildQuestEnemyList(int questId, int areaNum); - IEnumerable BuildQuestWallEnemyList(int wallId, int wallLevel); + IList BuildQuestWallEnemyList(int wallId, int wallLevel); } diff --git a/DragaliaAPI/DragaliaAPI/Features/Dungeon/QuestEnemyService.cs b/DragaliaAPI/DragaliaAPI/Features/Dungeon/QuestEnemyService.cs index a37d49e3a..e565b3d8d 100644 --- a/DragaliaAPI/DragaliaAPI/Features/Dungeon/QuestEnemyService.cs +++ b/DragaliaAPI/DragaliaAPI/Features/Dungeon/QuestEnemyService.cs @@ -19,7 +19,7 @@ public QuestEnemyService(ILogger logger) this.logger = logger; } - public IEnumerable BuildQuestEnemyList(int questId, int areaNum) + public IList BuildQuestEnemyList(int questId, int areaNum) { AtgenEnemy[] enemyList = this.GetEnemyList(questId, areaNum); @@ -34,7 +34,7 @@ public IEnumerable BuildQuestEnemyList(int questId, int areaNum) return enemyList; } - int areaCount = MasterAsset.QuestData[questId].AreaInfo.Count(); + int areaCount = MasterAsset.QuestData[questId].AreaInfo.Count; int totalQuantity = (int)Math.Round(questDropInfo.Drops.Sum(x => x.Quantity) / areaCount); int totalRupies = AddVariance(questDropInfo.Rupies) / areaCount; @@ -105,7 +105,7 @@ public IEnumerable BuildQuestEnemyList(int questId, int areaNum) } // Mercurial Gauntlet - public IEnumerable BuildQuestWallEnemyList(int wallId, int wallLevel) + public IList BuildQuestWallEnemyList(int wallId, int wallLevel) { List enemyList = GetWallEnemyList(wallId, wallLevel).ToList(); // should handle enemy drops but eh diff --git a/DragaliaAPI/DragaliaAPI/Features/Dungeon/Record/DungeonRecordRewardService.cs b/DragaliaAPI/DragaliaAPI/Features/Dungeon/Record/DungeonRecordRewardService.cs index 950d8cbea..b5714689f 100644 --- a/DragaliaAPI/DragaliaAPI/Features/Dungeon/Record/DungeonRecordRewardService.cs +++ b/DragaliaAPI/DragaliaAPI/Features/Dungeon/Record/DungeonRecordRewardService.cs @@ -1,4 +1,5 @@ -using DragaliaAPI.Database.Entities; +using System.Collections; +using DragaliaAPI.Database.Entities; using DragaliaAPI.Database.Repositories; using DragaliaAPI.Features.Event; using DragaliaAPI.Features.Missions; @@ -7,6 +8,9 @@ using DragaliaAPI.Models.Generated; using DragaliaAPI.Shared.Definitions.Enums; using DragaliaAPI.Shared.Features.Presents; +using DragaliaAPI.Shared.MasterAsset; +using DragaliaAPI.Shared.MasterAsset.Models; +using DragaliaAPI.Shared.MasterAsset.Models.QuestRewards; namespace DragaliaAPI.Features.Dungeon.Record; @@ -64,17 +68,9 @@ int CoinDrop int coinDrop = 0; List entities = new(); - foreach ( - AtgenTreasureRecord record in playRecord.TreasureRecord - ?? Enumerable.Empty() - ) + foreach (AtgenTreasureRecord record in playRecord.TreasureRecord ?? []) { - if ( - !session.EnemyList.TryGetValue( - record.AreaIdx, - out IEnumerable? enemyList - ) - ) + if (!session.EnemyList.TryGetValue(record.AreaIdx, out IList? enemyList)) { logger.LogWarning( "Could not retrieve enemy list for area_idx {idx}", @@ -84,7 +80,7 @@ out IEnumerable? enemyList } // Sometimes record.enemy is null for boss stages. Give all drops in this case. - IEnumerable enemyRecord = record.Enemy ?? Enumerable.Repeat(1, enemyList.Count()); + IEnumerable enemyRecord = record.Enemy ?? Enumerable.Repeat(1, enemyList.Count); foreach ( EnemyDropList enemyDropList in enemyList @@ -112,6 +108,50 @@ EnemyDropList enemyDropList in enemyList return (drops, manaDrop, coinDrop); } + public async Task> ProcessDraconicEssenceDrops(DungeonSession session) + { + if ( + !MasterAsset.QuestRewardData.TryGetValue( + session.QuestId, + out QuestRewardData? questRewardData + ) + || questRewardData.DropLimitBreakMaterialId == 0 + ) + { + return []; + } + + DbQuest dbRow = await questRepository.GetQuestDataAsync(session.QuestId); + + // We are in this method after the play count has been incremented for the current completion + // It would be easier to run before, but the play count incrementing function also handles daily resets + int previousPlayCount = dbRow.DailyPlayCount - session.PlayCount; + int availableEssences = 3 - previousPlayCount; + + if (availableEssences <= 0) + { + return []; + } + + int rewardQuantity = Math.Min(session.PlayCount, availableEssences); + + Entity essence = + new( + EntityTypes.Material, + (int)questRewardData.DropLimitBreakMaterialId, + rewardQuantity + ); + + RewardGrantResult result = await rewardService.GrantReward(essence); + + if (result is not RewardGrantResult.Added) + { + presentService.AddPresent(new Present.Present(PresentMessage.QuestDailyBonus, essence)); + } + + return [essence.ToDropAll()]; + } + public async Task ProcessEventRewards( PlayRecord playRecord, DungeonSession session diff --git a/DragaliaAPI/DragaliaAPI/Features/Dungeon/Record/DungeonRecordService.cs b/DragaliaAPI/DragaliaAPI/Features/Dungeon/Record/DungeonRecordService.cs index f605f123d..f2941734c 100644 --- a/DragaliaAPI/DragaliaAPI/Features/Dungeon/Record/DungeonRecordService.cs +++ b/DragaliaAPI/DragaliaAPI/Features/Dungeon/Record/DungeonRecordService.cs @@ -68,12 +68,16 @@ await this.ProcessExperience( ingameResultData.RewardRecord.MissionsClearSet = missionStatus.MissionsClearSet; ingameResultData.RewardRecord.MissionComplete = missionStatus.MissionCompleteSet; + IList essenceDrops = + await dungeonRecordRewardService.ProcessDraconicEssenceDrops(session); + (IEnumerable dropList, int manaDrop, int coinDrop) = await dungeonRecordRewardService.ProcessEnemyDrops(playRecord, session); ingameResultData.RewardRecord.TakeCoin = coinDrop; ingameResultData.GrowRecord.TakeMana = manaDrop; ingameResultData.RewardRecord.DropAll.AddRange(dropList); + ingameResultData.RewardRecord.DropAll.AddRange(essenceDrops); ( IEnumerable scoreMissionSuccessList, diff --git a/DragaliaAPI/DragaliaAPI/Features/Dungeon/Record/IDungeonRecordRewardService.cs b/DragaliaAPI/DragaliaAPI/Features/Dungeon/Record/IDungeonRecordRewardService.cs index db2065681..2af78b9fa 100644 --- a/DragaliaAPI/DragaliaAPI/Features/Dungeon/Record/IDungeonRecordRewardService.cs +++ b/DragaliaAPI/DragaliaAPI/Features/Dungeon/Record/IDungeonRecordRewardService.cs @@ -20,4 +20,5 @@ DungeonSession session ); AtgenFirstMeeting ProcessFirstMeetingRewards(IList connectingViewerIdList); + Task> ProcessDraconicEssenceDrops(DungeonSession session); } diff --git a/DragaliaAPI/DragaliaAPI/Features/Dungeon/Skip/DungeonSkipController.cs b/DragaliaAPI/DragaliaAPI/Features/Dungeon/Skip/DungeonSkipController.cs index 3d61ee31b..c0a5ccc78 100644 --- a/DragaliaAPI/DragaliaAPI/Features/Dungeon/Skip/DungeonSkipController.cs +++ b/DragaliaAPI/DragaliaAPI/Features/Dungeon/Skip/DungeonSkipController.cs @@ -211,7 +211,7 @@ IEnumerable party PlayCount = playCount, }; - Dictionary> enemyList = new(questData.AreaInfo.Count); + Dictionary> enemyList = new(questData.AreaInfo.Count); for (int areaIndex = 0; areaIndex < questData.AreaInfo.Count; areaIndex++) { diff --git a/DragaliaAPI/DragaliaAPI/Features/Present/Present.cs b/DragaliaAPI/DragaliaAPI/Features/Present/Present.cs index 6fc18e6ec..af9b931a0 100644 --- a/DragaliaAPI/DragaliaAPI/Features/Present/Present.cs +++ b/DragaliaAPI/DragaliaAPI/Features/Present/Present.cs @@ -1,4 +1,5 @@ using DragaliaAPI.Database.Entities; +using DragaliaAPI.Features.Reward; using DragaliaAPI.Models.Generated; using DragaliaAPI.Shared.Definitions.Enums; using DragaliaAPI.Shared.Features.Presents; @@ -23,6 +24,16 @@ public record Present( int EntityLimitBreakCount = 0 ) { + public Present(PresentMessage messageId, Entity entity) + : this( + messageId, + entity.Type, + entity.Id, + entity.Quantity, + entity.BuildupCount ?? 0, + entity.LimitBreakCount ?? 0 + ) { } + public DateTimeOffset CreateTime { get; } = DateTimeOffset.UtcNow; public TimeSpan? ExpiryTime { get; init; } diff --git a/DragaliaAPI/DragaliaAPI/Models/Generated/Components.cs b/DragaliaAPI/DragaliaAPI/Models/Generated/Components.cs index f09c0c172..30bd70b2f 100644 --- a/DragaliaAPI/DragaliaAPI/Models/Generated/Components.cs +++ b/DragaliaAPI/DragaliaAPI/Models/Generated/Components.cs @@ -9473,9 +9473,6 @@ public partial class OddsInfo [Key("drop_obj")] public IEnumerable DropObj { get; set; } = []; - [Key("enemy")] - public IEnumerable Enemy { get; set; } = []; - [Key("grade")] public IEnumerable Grade { get; set; } = []; @@ -9483,7 +9480,7 @@ public OddsInfo( int areaIndex, int reactionObjCount, IEnumerable dropObj, - IEnumerable enemy, + IList enemy, IEnumerable grade ) { diff --git a/DragaliaAPI/DragaliaAPI/Models/Generated/OddsInfo.cs b/DragaliaAPI/DragaliaAPI/Models/Generated/OddsInfo.cs new file mode 100644 index 000000000..1aa05ffcd --- /dev/null +++ b/DragaliaAPI/DragaliaAPI/Models/Generated/OddsInfo.cs @@ -0,0 +1,9 @@ +using MessagePack; + +namespace DragaliaAPI.Models.Generated; + +public partial class OddsInfo +{ + [Key("enemy")] + public IList Enemy { get; set; } = []; +}