GetProtOffset() public method

public GetProtOffset ( ) : int
return int
Ejemplo n.º 1
0
        public virtual void GenerateiProps(object miref)
        {
            // Item type

            ItemType = miref.GetType();

            // Approximate label

            ClassNameTranslator cnt = new ClassNameTranslator();

            sApproxLabel = cnt.TranslateClass(ItemType);

            // Magical properties

            iProps = new int[4];

            // Default to blacksmithing requirement for enhancement

            iMajorSkill = (int)SkillName.Blacksmith;

            if (miref is BaseArmor)
            {
                BaseArmor ba = (BaseArmor)miref;

                // Stored    : Protection / Durability

                iProps[0] = ba.GetProtOffset() + 1;
                iProps[1] = (int)ba.Durability;
                iProps[2] = 0;

                // Figure out what kind of material was used

                if (ba.MaterialType == ArmorMaterialType.Leather ||
                    ba.MaterialType == ArmorMaterialType.Studded ||
                    ba.MaterialType == ArmorMaterialType.Bone)
                {
                    iMajorSkill = (int)SkillName.Tailoring;
                }
                else if (miref is WoodenShield)
                {
                    iMajorSkill = (int)SkillName.Carpentry;
                }
            }
            else if (miref is BaseWeapon)
            {
                BaseWeapon bw = (BaseWeapon)miref;

                // Stored    : Damage / Durability / Accuracy / Silver

                iProps[0] = (int)bw.DamageLevel;
                iProps[1] = (int)bw.DurabilityLevel;
                iProps[2] = (int)bw.AccuracyLevel;
                iProps[3] = (int)bw.Slayer;

                // If it's a bow or a staff, a carpenter made it.
                // Blackstaffs are made by tinkers.

                if (miref is BaseRanged || (miref is BaseStaff && !(miref is BlackStaff)) || miref is Club)
                {
                    iMajorSkill = (int)SkillName.Carpentry;
                }
                else if (miref is BlackStaff || miref is Pitchfork)
                {
                    iMajorSkill = (int)SkillName.Tinkering;
                }
            }
            else if (miref is BaseClothing)
            {
                // Store :
                // [0] - int representing the type of charge
                // [1] - int representing the number of charges

                BaseClothing bc = (BaseClothing)miref;

                iProps[0] = (int)bc.MagicType;
                iProps[1] = (int)bc.MagicCharges;

                iMajorSkill = (int)SkillName.Tailoring;
            }
            else if (miref is BaseJewel)
            {
                // Store :
                // [0] - int representing the type of charge
                // [1] - int representing the number of charges

                BaseJewel bj = (BaseJewel)miref;

                iProps[0] = (int)bj.MagicType;
                iProps[1] = (int)bj.MagicCharges;

                iMajorSkill = (int)SkillName.Tinkering;
            }
            else
            {
                // We've been passed an object that cannot be handled...
                // don't drop this enchanted item!

                this.Delete();
                return;
            }

            // Skill requirements

            SkillReq = new int[52];

            // all enhancements require these

            SkillReq[(int)SkillName.Magery] = 80;

            if (ItemType.IsSubclassOf(typeof(BaseJewel)) ||
                ItemType.IsSubclassOf(typeof(BaseClothing)))
            {
                SkillReq[(int)SkillName.ItemID] = 80;
            }
            else
            {
                SkillReq[(int)SkillName.ArmsLore] = 80;
            }

            // base final skill on what kind of object we're dealing with

            SkillReq[iMajorSkill] = 90;
        }