コード例 #1
0
        public static async ValueTask <Stream> Write(ProfileSaveFile settings)
        {
            Stream stream = new MemoryStream();
            await JsonSerializer.SerializeAsync(stream, settings, _options);

            return(stream);
        }
コード例 #2
0
        public static int remainingEnchantmentPoints(this ProfileSaveFile profile)
        {
            int totalEnchantmentPointsUsed = 1;

            foreach (var item in profile.Items)
            {
                totalEnchantmentPointsUsed += item.enchantmentPoints();
            }
            return(profile.level() - totalEnchantmentPointsUsed);
        }
コード例 #3
0
        public static int computeCharacterPower(this ProfileSaveFile profile)
        {
            var melee                 = profile.meleeGearItem()?.Power ?? 0;
            var armor                 = profile.armorGearItem()?.Power ?? 0;
            var ranged                = profile.rangedGearItem()?.Power ?? 0;
            var slot1                 = profile.hotbarSlot1Item()?.Power ?? 0;
            var slot2                 = profile.hotbarSlot2Item()?.Power ?? 0;
            var slot3                 = profile.hotbarSlot3Item()?.Power ?? 0;
            var characterPower        = GameCalculator.characterPowerFromEquippedItemPowers(melee, armor, ranged, slot1, slot2, slot3);
            var chacarterDisplayPower = GameCalculator.levelFromPower(characterPower);

            return(chacarterDisplayPower);
        }
コード例 #4
0
 public static bool isValid(this ProfileSaveFile profile)
 {
     return(profile.Items != null);
 }
コード例 #5
0
 public static int level(this ProfileSaveFile profile)
 {
     return(GameCalculator.levelForExperience(profile.Xp));
 }
コード例 #6
0
 public static IEnumerable <Item> equippedItems(this ProfileSaveFile profile)
 {
     return(profile.Items.Where(x => x.EquipmentSlot != null));
 }
コード例 #7
0
 public static Item equipmentSlot(this ProfileSaveFile profile, EquipmentSlotEnum equipmentSlot)
 {
     return(profile.Items.FirstOrDefault(x => x.EquipmentSlot == equipmentSlot.ToString()));
 }
コード例 #8
0
 public static Item hotbarSlot3Item(this ProfileSaveFile profile)
 {
     return(profile.equipmentSlot(EquipmentSlotEnum.HotbarSlot3));
 }
コード例 #9
0
 public static Item rangedGearItem(this ProfileSaveFile profile)
 {
     return(profile.equipmentSlot(EquipmentSlotEnum.RangedGear));
 }
コード例 #10
0
 public static Item armorGearItem(this ProfileSaveFile profile)
 {
     return(profile.equipmentSlot(EquipmentSlotEnum.ArmorGear));
 }
コード例 #11
0
 public static Item meleeGearItem(this ProfileSaveFile profile)
 {
     return(profile.equipmentSlot(EquipmentSlotEnum.MeleeGear));
 }