public override IValue Serialize() => new Dictionary(new Dictionary <IKey, IValue> { [(Text)"itemId"] = ItemId.Serialize(), [(Text)"statsMap"] = StatsMap.Serialize(), [(Text)"skills"] = new List(Skills.Select(s => s.Serialize())), [(Text)"buffSkills"] = new List(BuffSkills.Select(s => s.Serialize())), [(Text)"requiredBlockIndex"] = RequiredBlockIndex.Serialize(), }.Union((Dictionary)base.Serialize()));
public override IValue Serialize() => #pragma warning disable LAA1002 new Dictionary(new Dictionary <IKey, IValue> { [(Text)"itemId"] = ItemId.Serialize(), [(Text)"statsMap"] = StatsMap.Serialize(), [(Text)"skills"] = new List(Skills .OrderByDescending(i => i.Chance) .ThenByDescending(i => i.Power) .Select(s => s.Serialize())), [(Text)"buffSkills"] = new List(BuffSkills .OrderByDescending(i => i.Chance) .ThenByDescending(i => i.Power) .Select(s => s.Serialize())), [(Text)"requiredBlockIndex"] = RequiredBlockIndex.Serialize(), }.Union((Dictionary)base.Serialize()));
public void Use(List <Guid> consumableIds) { var consumables = Inventory.Items .Select(i => i.item) .OfType <Consumable>() .Where(i => consumableIds.Contains(i.ItemId)) .ToList(); Stats.SetConsumables(consumables); foreach (var food in consumables) { foreach (var skill in food.Skills) { Skills.Add(skill); } foreach (var buffSkill in food.BuffSkills) { BuffSkills.Add(buffSkill); } Inventory.RemoveNonFungibleItem(food); } }