Пример #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));
 }