コード例 #1
0
        public static bool CanEnchantItem(this EnumEnchantmentType instance, Item par1Item)
        {
            if (instance == EnumEnchantmentType.all)
            {
                return(true);
            }

            if (par1Item is ItemArmor)
            {
                if (instance == EnumEnchantmentType.armor)
                {
                    return(true);
                }

                ItemArmor itemarmor = (ItemArmor)par1Item;

                if (itemarmor.ArmorType == 0)
                {
                    return(instance == EnumEnchantmentType.armor_head);
                }

                if (itemarmor.ArmorType == 2)
                {
                    return(instance == EnumEnchantmentType.armor_legs);
                }

                if (itemarmor.ArmorType == 1)
                {
                    return(instance == EnumEnchantmentType.armor_torso);
                }

                if (itemarmor.ArmorType == 3)
                {
                    return(instance == EnumEnchantmentType.armor_feet);
                }
                else
                {
                    return(false);
                }
            }

            if (par1Item is ItemSword)
            {
                return(instance == EnumEnchantmentType.weapon);
            }

            if (par1Item is ItemTool)
            {
                return(instance == EnumEnchantmentType.digger);
            }

            if (par1Item is ItemBow)
            {
                return(instance == EnumEnchantmentType.bow);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        public EnchantmentLootBonus(int par1, int par2, EnumEnchantmentType par3EnumEnchantmentType)
            : base(par1, par2, par3EnumEnchantmentType)
        {
            SetName("lootBonus");

            if (par3EnumEnchantmentType == EnumEnchantmentType.digger)
            {
                SetName("lootBonusDigger");
            }
        }
コード例 #3
0
        protected Enchantment(int par1, int par2, EnumEnchantmentType par3EnumEnchantmentType)
        {
            EffectId = par1;
            Weight   = par2;
            Type     = par3EnumEnchantmentType;

            if (EnchantmentsList[par1] != null)
            {
                throw new System.ArgumentException("Duplicate enchantment id!");
            }
            else
            {
                EnchantmentsList[par1] = this;
                return;
            }
        }