Exemplo n.º 1
0
        public WeaponViewModel(WeaponPrimitive primitive)
        {
            Id              = primitive.Id;
            Name            = primitive.Name;
            Type            = ConvertWeaponType(primitive.Type);
            Rarity          = primitive.Rarity;
            Attack          = primitive.Attack.Display;
            Attributes      = new WeaponAttributesViewModel(primitive.Attributes);
            SharpnessLevels = primitive.SharpnessLevels?
                              .Select(p => new int[] { p.Red, p.Orange, p.Yellow, p.Green, p.Blue, p.White })
                              .ToList();
            Elements    = primitive.Elements.Select(x => new WeaponElementViewModel(x)).ToList();
            IsCraftable = primitive.Crafting.IsCraftable;

            originalSlots = primitive.Slots.Select(x => x.Rank).OrderByDescending(x => x).ToList();
            Slots         = originalSlots;
        }
Exemplo n.º 2
0
        public WeaponViewModel(WeaponBase weapon)
        {
            Id         = (int)weapon.Id;
            Name       = weapon.Name;
            Type       = weapon.Type;
            Rarity     = weapon.Rarity;
            Attack     = weapon.Damage;
            Attributes = new WeaponAttributesViewModel(weapon);

            SortIndex = weapon.SortOrder;

            if (weapon is MeleeWeapon meleeWeapon)
            {
                SharpnessLevels = meleeWeapon.Sharpness.Select(x => x.ToArray()).ToList();
            }

            Elements = CreateElements(weapon);

            IsCraftable = weapon.Craft?.IsCraftable ?? false;

            originalSlots = weapon.Slots.OrderByDescending(x => x).ToList();
            Slots         = originalSlots;
        }