Skip to content

Commit

Permalink
fix material item to FAV
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrosine1153 committed Oct 11, 2024
1 parent dd2249f commit cca6859
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Lib9c/TableData/WorldBossRankingRewardSheet.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Lib9c;
using Libplanet.Types.Assets;
using Nekoyume.Helper;
using Nekoyume.Model.Item;
Expand Down Expand Up @@ -63,29 +64,29 @@ public override void Set(IReadOnlyList<string> fields)
}
}

public (List<FungibleAssetValue> assets, Dictionary<Material, int> materials) GetRewards(
public List<FungibleAssetValue> GetRewards(
RuneSheet runeSheet,
MaterialItemSheet materialSheet)
{
var assets = new List<FungibleAssetValue>
var result = new List<FungibleAssetValue>
{
Crystal * CrystalCalculator.CRYSTAL
};
assets.AddRange(Runes
result.AddRange(Runes
.Where(runeInfo => runeInfo.RuneQty > 0)
.Select(runeInfo =>
RuneHelper.ToFungibleAssetValue(runeSheet[runeInfo.RuneId],
runeInfo.RuneQty)));

var materials = new Dictionary<Material, int>();
foreach (var (itemId, quantity) in Materials)
{
var materialRow = materialSheet.Values.First(r => r.Id == itemId);
var material = ItemFactory.CreateMaterial(materialRow);
materials.TryAdd(material, 0);
materials[material] += quantity;
var isTradable = materialSheet[itemId].ItemSubType
is ItemSubType.Circle or ItemSubType.Scroll;
var currency = Currencies.GetItemCurrency(itemId, isTradable);
result.Add(currency * quantity);
}
return (assets, materials);

return result;
}
}

Expand Down

0 comments on commit cca6859

Please sign in to comment.