Skip to content

Commit

Permalink
Merge pull request #785 from planetarium/rc-migrate-200230
Browse files Browse the repository at this point in the history
Add new actions for migration
  • Loading branch information
U-lis authored Oct 2, 2024
2 parents 3a28498 + c555aa2 commit af8175f
Showing 1 changed file with 50 additions and 7 deletions.
57 changes: 50 additions & 7 deletions NineChronicles.DataProvider.Executable/Commands/MySqlMigration.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Nekoyume.Action.AdventureBoss;
using Nekoyume.Action.CustomEquipmentCraft;
using Nekoyume.Model.EnumType;
using NineChronicles.DataProvider.DataRendering.AdventureBoss;
using NineChronicles.DataProvider.DataRendering.Crafting;
Expand Down Expand Up @@ -55,6 +56,8 @@ public class MySqlMigration
private readonly List<AdventureBossRushModel> _adventureBossRushList = new ();
private readonly List<AdventureBossUnlockFloorModel> _adventureBossUnlockFloorList = new ();
private readonly List<AdventureBossClaimRewardModel> _adventureBossClaimRewardList = new ();
private readonly List<UnlockCombinationSlotModel> _unlockCombinationSlotList = new ();
private List<CustomEquipmentCraftModel> _customEquipmentCraftList = new ();
private string _connectionString;
private IStore _baseStore;
private BlockChain _baseChain;
Expand Down Expand Up @@ -433,6 +436,18 @@ await Task.Run(async () =>
Console.WriteLine($"[Grinding] {_grindList.Count} grinding");
await _mySqlStore.StoreGrindList(_grindList);
});

await Task.Run(async () =>
{
Console.WriteLine($"[CustomEquipmentCraft] {_customEquipmentCraftList} Custom Equipment Craft");
await _mySqlStore.StoreCustomEquipmentCraftList(_customEquipmentCraftList);
});

await Task.Run(async () =>
{
Console.WriteLine($"[UnlockCombinationSlot] {_unlockCombinationSlotList} unlock combination slot");
await _mySqlStore.StoreUnlockCombinationSlotList(_unlockCombinationSlotList);
});
}
catch (Exception e)
{
Expand Down Expand Up @@ -1063,13 +1078,13 @@ private void ProcessTasks(Task<List<ICommittedActionEvaluation>>[] taskArray, IB
var start = DateTimeOffset.UtcNow;
_rapidCombinationList = _rapidCombinationList.Concat(
RapidCombinationData.GetRapidCombinationInfo(
inputState,
ae.InputContext.Signer,
rapidCombination.avatarAddress,
rapidCombination.slotIndexList,
rapidCombination.Id,
ae.InputContext.BlockIndex,
_blockTimeOffset)
inputState,
ae.InputContext.Signer,
rapidCombination.avatarAddress,
rapidCombination.slotIndexList,
rapidCombination.Id,
ae.InputContext.BlockIndex,
_blockTimeOffset)
).ToList();
var end = DateTimeOffset.UtcNow;
Console.WriteLine("Writing RapidCombination action in block #{0}. Time Taken: {1} ms.", ae.InputContext.BlockIndex, (end - start).Milliseconds);
Expand Down Expand Up @@ -1279,6 +1294,34 @@ private void ProcessTasks(Task<List<ICommittedActionEvaluation>>[] taskArray, IB
$"[Adventure Boss] Season updated : {_adventureBossSeasonDict.Count}");
break;
}

case CustomEquipmentCraft cec:
{
var cecList = CustomEquipmentCraftData.GetCustomEquipmentCraftInfo(
inputState,
outputState,
new ReplayRandom(ae.InputContext.RandomSeed),
ae.InputContext.Signer,
Guid.NewGuid(),
cec,
ae.InputContext.BlockIndex,
_blockTimeOffset
);
_customEquipmentCraftList = _customEquipmentCraftList.Concat(cecList).ToList();
break;
}

case UnlockCombinationSlot ucs:
{
_unlockCombinationSlotList.Add(UnlockCombinationSlotData.GetUnlockCombinationSlotInfo(
inputState,
ae.InputContext.Signer,
ucs,
ae.InputContext.BlockIndex,
_blockTimeOffset
));
break;
}
}
}
}
Expand Down

0 comments on commit af8175f

Please sign in to comment.