예제 #1
0
 public ChargeBlade(
     IDataSource dataSource,
     string name,
     ChargeBladePhialType phialType,
     int rarity,
     int attack,
     int affinity,
     int defense,
     int[] sharpnessRanksLevel1,
     int[] sharpnessRanksLevel5,
     EldersealLevel elderseal,
     ElementInfo[] elements,
     int[] slots)
     : base(
         dataSource,
         name,
         WeaponType.ChargeBlade,
         rarity,
         attack,
         affinity,
         defense,
         sharpnessRanksLevel1,
         sharpnessRanksLevel5,
         elderseal,
         elements,
         slots
         )
 {
     PhialType = phialType;
 }
예제 #2
0
        private Weapon CreateWeapon(JObject weapon, WeaponType type)
        {
            int            attack;
            int            affinity;
            int            defense;
            EldersealLevel eldersealLevel;

            var name       = (string)weapon["name"];
            var rarity     = (int)weapon["rarity"];
            var attributes = (JObject)weapon["attributes"];

            ExtractAttributes(attributes, out attack, out affinity, out defense, out eldersealLevel);

            ElementInfo[] elementInfo = ExtractElementInfo((JArray)weapon["elements"]);
            int[]         slots       = ExtractSlots((JArray)weapon["slots"]);
            int[]         sharpness   = ExtractSharpness((JObject)weapon["sharpness"]);

            Weapon outputWeapon;

            if (type == WeaponType.ChargeBlade)
            {
                ChargeBladePhialType phialType = ExtractChargeBladePhialType(attributes);
                outputWeapon = new ChargeBlade(this, name, phialType, rarity, attack, affinity, defense, sharpness, null, eldersealLevel, elementInfo, slots);
            }
            else if (type == WeaponType.HuntingHorn)
            {
                // mhw-db.com is missing melodies info
                outputWeapon = new HuntingHorn(this, name, new Melody[0], rarity, attack, affinity, defense, sharpness, null, eldersealLevel, elementInfo, slots);
            }
            else if (type == WeaponType.SwitchAxe)
            {
                ExtractSwitchAxePhialInfo(attributes, out SwitchAxePhialType phialType, out int phialValue);
                outputWeapon = new SwitchAxe(this, name, phialType, phialValue, rarity, attack, affinity, defense, sharpness, null, eldersealLevel, elementInfo, slots);
            }
            else if (type == WeaponType.Gunlance)
            {
                ExtractGunlanceShellingInfo(attributes, out GunlanceShellingType shellingType, out int shellingLevel);
                outputWeapon = new Gunlance(this, name, shellingType, shellingLevel, rarity, attack, affinity, defense, sharpness, null, eldersealLevel, elementInfo, slots);
            }
            else if (type == WeaponType.InsectGlaive)
            {
                KinsectBonusType kinsectBonusType = ExtractInsectGlaiveKinsectBonusType(attributes);
                outputWeapon = new InsectGlaive(this, name, kinsectBonusType, rarity, attack, affinity, defense, sharpness, null, eldersealLevel, elementInfo, slots);
            }
            else
            {
                outputWeapon = new Weapon(this, name, type, rarity, attack, affinity, defense, sharpness, null, eldersealLevel, elementInfo, slots);
            }

            return(outputWeapon.UpdateId((int)weapon["id"]));
        }