예제 #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));
 }