GetFromOreInfo() public static method

Returns the CraftResource value which represents 'info' -or- CraftResource.None if unable to convert.
public static GetFromOreInfo ( OreInfo info ) : CraftResource
info OreInfo
return CraftResource
Ejemplo n.º 1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 2:     // Reset from Resource System
                this.m_Resource = this.DefaultResource;
                reader.ReadString();
                break;

            case 1:
            {
                this.m_Resource = (CraftResource)reader.ReadInt();
                break;
            }

            case 0:
            {
                OreInfo info = new OreInfo(reader.ReadInt(), reader.ReadInt(), reader.ReadString());

                this.m_Resource = CraftResources.GetFromOreInfo(info);
                break;
            }
            }
        }
Ejemplo n.º 2
0
        private void Deserialize(IGenericReader reader, int version)
        {
            switch (version)
            {
            case 1:
            {
                // Use this line instead if you are getting world loading issues
                _resource = (CraftResource)reader.ReadByte();
                // _resource = (CraftResource)reader.ReadInt();
                break;
            }

            case 0:
            {
                var info = reader.ReadInt() switch
                {
                    0 => OreInfo.Iron,
                    1 => OreInfo.DullCopper,
                    2 => OreInfo.ShadowIron,
                    3 => OreInfo.Copper,
                    4 => OreInfo.Bronze,
                    5 => OreInfo.Gold,
                    6 => OreInfo.Agapite,
                    7 => OreInfo.Verite,
                    8 => OreInfo.Valorite,
                    _ => null
                };

                _resource = CraftResources.GetFromOreInfo(info);
                break;
            }
            }
        }
Ejemplo n.º 3
0
        private void Deserialize(IGenericReader reader, int version)
        {
            switch (version)
            {
            case 1:
            {
                _resource = (CraftResource)reader.ReadInt();
                break;
            }

            case 0:
            {
                var info = reader.ReadInt() switch
                {
                    0 => OreInfo.Iron,
                    1 => OreInfo.DullCopper,
                    2 => OreInfo.ShadowIron,
                    3 => OreInfo.Copper,
                    4 => OreInfo.Bronze,
                    5 => OreInfo.Gold,
                    6 => OreInfo.Agapite,
                    7 => OreInfo.Verite,
                    8 => OreInfo.Valorite,
                    _ => null
                };

                _resource = CraftResources.GetFromOreInfo(info);
                break;
            }
            }
        }
Ejemplo n.º 4
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_Resource = (CraftResource)reader.ReadInt();
                break;
            }

            case 0:
            {
                OreInfo info = new OreInfo(reader.ReadInt(), reader.ReadInt(), reader.ReadString());

                m_Resource = CraftResources.GetFromOreInfo(info);
                break;
            }
            }

            Hue = CraftResources.GetHue(m_Resource);
        }
Ejemplo n.º 5
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_Resource = (CraftResource)reader.ReadInt();
                break;
            }

            case 0:
            {
                OreInfo info;

                switch (reader.ReadInt())
                {
                case 0: info = OreInfo.Fer; break;

                case 1: info = OreInfo.Cuivre; break;

                case 2: info = OreInfo.Bronze; break;

                case 3: info = OreInfo.Acier; break;

                case 4: info = OreInfo.Argent; break;

                case 5: info = OreInfo.Or; break;

                case 6: info = OreInfo.Mytheril; break;

                case 7: info = OreInfo.Luminium; break;

                case 8: info = OreInfo.Obscurium; break;

                case 9: info = OreInfo.Mystirium; break;

                case 10: info = OreInfo.Dominium; break;

                case 11: info = OreInfo.Eclarium; break;

                case 12: info = OreInfo.Venarium; break;

                case 13: info = OreInfo.Athenium; break;

                case 14: info = OreInfo.Umbrarium; break;

                default: info = null; break;
                }

                m_Resource = CraftResources.GetFromOreInfo(info);
                break;
            }
            }
            Hue = CraftResources.GetHue(m_Resource);
        }
Ejemplo n.º 6
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_Resource = (CraftResource)reader.ReadInt();
                break;
            }

            case 0:
            {
                OreInfo info;

                switch (reader.ReadInt())
                {
                case 0: info = OreInfo.Iron; break;

                case 1: info = OreInfo.DullCopper; break;

                case 2: info = OreInfo.ShadowIron; break;

                case 3: info = OreInfo.Copper; break;

                case 4: info = OreInfo.Bronze; break;

                case 5: info = OreInfo.Gold; break;

                case 6: info = OreInfo.Agapite; break;

                case 7: info = OreInfo.Verite; break;

                case 8: info = OreInfo.Valorite; break;

                //daat99 OWLTR start - custom ores
                case 9: info = OreInfo.Blaze; break;

                case 10: info = OreInfo.Ice; break;

                case 11: info = OreInfo.Toxic; break;

                case 12: info = OreInfo.Electrum; break;

                case 13: info = OreInfo.Platinum; break;

                //daat99 OWLTR end - custom ores
                default: info = null; break;
                }

                m_Resource = CraftResources.GetFromOreInfo(info);
                break;
            }
            }
        }
Ejemplo n.º 7
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_Resource = (CraftResource)reader.ReadInt();
                break;
            }

            case 0:
            {
                OreInfo info;

                switch (reader.ReadInt())
                {
                case 0: info = OreInfo.Iron; break;

                case 1: info = OreInfo.DullCopper; break;

                case 2: info = OreInfo.ShadowIron; break;

                case 3: info = OreInfo.Copper; break;

                case 4: info = OreInfo.Bronze; break;

                case 5: info = OreInfo.Gold; break;

                case 6: info = OreInfo.Agapite; break;

                case 7: info = OreInfo.Verite; break;

                case 8: info = OreInfo.Valorite; break;

                case 9: info = OreInfo.Mithril; break;

                case 10: info = OreInfo.Bloodrock; break;

                case 11: info = OreInfo.Steel; break;

                case 12: info = OreInfo.Adamantite; break;

                case 13: info = OreInfo.Ithilmar; break;

                case 14: info = OreInfo.Silver; break;

                default: info = null; break;
                }

                m_Resource = CraftResources.GetFromOreInfo(info);
                break;
            }
            }
        }
Ejemplo n.º 8
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_Resource = (CraftResource)reader.ReadInt();
                break;
            }

            case 0:
            {
                OreInfo info;

                switch (reader.ReadInt())
                {
                case 0: info = OreInfo.Iron; break;

                case 1: info = OreInfo.DullCopper; break;

                case 2: info = OreInfo.ShadowIron; break;

                case 3: info = OreInfo.Copper; break;

                case 4: info = OreInfo.Bronze; break;

                case 5: info = OreInfo.Gold; break;

                case 6: info = OreInfo.Agapite; break;

                case 7: info = OreInfo.Verite; break;

                case 8: info = OreInfo.Valorite; break;

                case 9: info = OreInfo.Silver; break;

                //case 10: info = OreInfo.Platinum; break;
                //case 11: info = OreInfo.Mythril; break;
                //case 12: info = OreInfo.Obsidian; break;
                case 10: info = OreInfo.Jade; break;

                case 11: info = OreInfo.Moonstone; break;

                case 12: info = OreInfo.Sunstone; break;

                //case 16: info = OreInfo.Bloodstone; break;
                default: info = null; break;
                }

                m_Resource = CraftResources.GetFromOreInfo(info);
                break;
            }
            }
        }
Ejemplo n.º 9
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_Resource = (CraftResource)reader.ReadInt();
                break;
            }

            case 0:
            {
                OreInfo info;

                switch (reader.ReadInt())
                {
                case 0: info = OreInfo.Oak; break;

                case 1: info = OreInfo.Pine; break;

                case 2: info = OreInfo.Redwood; break;

                case 3: info = OreInfo.WhitePine; break;

                case 4: info = OreInfo.Ashwood; break;

                case 5: info = OreInfo.SilverBirch; break;

                case 6: info = OreInfo.Yew; break;

                case 7: info = OreInfo.BlackOak; break;

                default: info = null; break;
                }

                m_Resource = CraftResources.GetFromOreInfo(info);
                break;
            }
            }
        }
Ejemplo n.º 10
0
        private void Deserialize(IGenericReader reader, int version)
        {
            switch (version)
            {
            case 1:
            {
                _resource = (CraftResource)reader.ReadInt();
                break;
            }

            case 0:
            {
                var info = new OreInfo(reader.ReadInt(), reader.ReadInt(), reader.ReadString());

                _resource = CraftResources.GetFromOreInfo(info);
                break;
            }
            }
        }
Ejemplo n.º 11
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_Resource = (CraftResource)reader.ReadInt();
                break;
            }

            case 0:
            {
                OreInfo info;

                switch (reader.ReadInt())
                {
                case 0: info = OreInfo.Iron; break;

                case 1: info = OreInfo.DullCopper; break;

                case 2: info = OreInfo.ShadowIron; break;

                case 3: info = OreInfo.Copper; break;

                case 4: info = OreInfo.Bronze; break;

                case 5: info = OreInfo.Gold; break;

                case 6: info = OreInfo.Agapite; break;

                case 7: info = OreInfo.Verite; break;

                case 8: info = OreInfo.Valorite; break;

                case 9: info = OreInfo.Rusty; break;

                case 10: info = OreInfo.Silver; break;

                case 11: info = OreInfo.PureCopper; break;

                case 12: info = OreInfo.BronzeAlloy; break;

                case 13: info = OreInfo.Shadow; break;

                case 14: info = OreInfo.Rose; break;

                case 15: info = OreInfo.Lime; break;

                case 16: info = OreInfo.Fuscia; break;

                case 17: info = OreInfo.Bloodrock; break;

                case 18: info = OreInfo.ChromeBlue; break;

                case 19: info = OreInfo.ChromeCopper; break;

                case 20: info = OreInfo.Pansy; break;

                case 21: info = OreInfo.Stinger; break;

                case 22: info = OreInfo.Royal; break;

                case 23: info = OreInfo.BlueSteel; break;

                case 24: info = OreInfo.Ice; break;

                case 25: info = OreInfo.Lemon; break;

                case 26: info = OreInfo.Blackrock; break;

                case 27: info = OreInfo.RoseQuartz; break;

                case 28: info = OreInfo.Mint; break;

                case 29: info = OreInfo.Aqua; break;

                case 30: info = OreInfo.Daemon; break;

                case 31: info = OreInfo.Mythril; break;

                case 32: info = OreInfo.Titanium; break;

                case 33: info = OreInfo.Kryptonite; break;

                case 34: info = OreInfo.Diamond; break;

                case 35: info = OreInfo.Jolt; break;

                case 36: info = OreInfo.Uranium; break;

                case 37: info = OreInfo.Opiate; break;

                case 38: info = OreInfo.Negative; break;

                case 39: info = OreInfo.Deus; break;

                case 40: info = OreInfo.DarkDeus; break;

                default: info = null; break;
                }

                m_Resource = CraftResources.GetFromOreInfo(info);
                break;
            }
            }
        }
Ejemplo n.º 12
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 2:     // Reset from Resource System
                m_Resource = DefaultResource;
                reader.ReadString();
                break;

            case 1:
            {
                m_Resource = (CraftResource)reader.ReadInt();
                break;
            }

            case 0:
            {
                OreInfo info;

                switch (reader.ReadInt())
                {
                case 0:
                    info = OreInfo.Iron;
                    break;

                case 1:
                    info = OreInfo.DullCopper;
                    break;

                case 2:
                    info = OreInfo.ShadowIron;
                    break;

                case 3:
                    info = OreInfo.Copper;
                    break;

                case 4:
                    info = OreInfo.Bronze;
                    break;

                case 5:
                    info = OreInfo.Gold;
                    break;

                case 6:
                    info = OreInfo.Agapite;
                    break;

                case 7:
                    info = OreInfo.Verite;
                    break;

                case 8:
                    info = OreInfo.Valorite;
                    break;

                default:
                    info = null;
                    break;
                }

                m_Resource = CraftResources.GetFromOreInfo(info);
                break;
            }
            }
        }
Ejemplo n.º 13
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 7:
            case 6:
            case 5:
            {
                SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

                if (GetSaveFlag(flags, SaveFlag.Identified))
                {
                    m_Identified = version >= 7 || reader.ReadBool();
                }

                if (GetSaveFlag(flags, SaveFlag.MaxHitPoints))
                {
                    m_MaxHitPoints = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.HitPoints))
                {
                    m_HitPoints = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.Crafter))
                {
                    m_Crafter = reader.ReadMobile();
                }

                if (GetSaveFlag(flags, SaveFlag.Quality))
                {
                    m_Quality = (ArmorQuality)reader.ReadEncodedInt();
                }
                else
                {
                    m_Quality = ArmorQuality.Regular;
                }

                if (version == 5 && m_Quality == ArmorQuality.Low)
                {
                    m_Quality = ArmorQuality.Regular;
                }

                if (GetSaveFlag(flags, SaveFlag.Durability))
                {
                    m_Durability = (ArmorDurabilityLevel)reader.ReadEncodedInt();

                    if (m_Durability > ArmorDurabilityLevel.Indestructible)
                    {
                        m_Durability = ArmorDurabilityLevel.Durable;
                    }
                }

                if (GetSaveFlag(flags, SaveFlag.Protection))
                {
                    m_Protection = (ArmorProtectionLevel)reader.ReadEncodedInt();

                    if (m_Protection > ArmorProtectionLevel.Invulnerability)
                    {
                        m_Protection = ArmorProtectionLevel.Defense;
                    }
                }

                if (GetSaveFlag(flags, SaveFlag.Resource))
                {
                    m_Resource = (CraftResource)reader.ReadEncodedInt();
                }
                else
                {
                    m_Resource = DefaultResource;
                }

                if (m_Resource == CraftResource.None)
                {
                    m_Resource = DefaultResource;
                }

                if (GetSaveFlag(flags, SaveFlag.BaseArmor))
                {
                    m_ArmorBase = reader.ReadEncodedInt();
                }
                else
                {
                    m_ArmorBase = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.StrBonus))
                {
                    m_StrBonus = reader.ReadEncodedInt();
                }
                else
                {
                    m_StrBonus = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.DexBonus))
                {
                    m_DexBonus = reader.ReadEncodedInt();
                }
                else
                {
                    m_DexBonus = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.IntBonus))
                {
                    m_IntBonus = reader.ReadEncodedInt();
                }
                else
                {
                    m_IntBonus = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.StrReq))
                {
                    m_StrReq = reader.ReadEncodedInt();
                }
                else
                {
                    m_StrReq = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.DexReq))
                {
                    m_DexReq = reader.ReadEncodedInt();
                }
                else
                {
                    m_DexReq = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.IntReq))
                {
                    m_IntReq = reader.ReadEncodedInt();
                }
                else
                {
                    m_IntReq = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.MedAllowance))
                {
                    m_Meditate = (AMA)reader.ReadEncodedInt();
                }
                else
                {
                    m_Meditate = (AMA)(-1);
                }

                if (GetSaveFlag(flags, SaveFlag.PlayerConstructed))
                {
                    m_PlayerConstructed = true;
                }

                break;
            }

            case 4:
            case 3:
            case 2:
            case 1:
            {
                m_Identified = reader.ReadBool();
                goto case 0;
            }

            case 0:
            {
                m_ArmorBase    = reader.ReadInt();
                m_MaxHitPoints = reader.ReadInt();
                m_HitPoints    = reader.ReadInt();
                m_Crafter      = reader.ReadMobile();
                m_Quality      = (ArmorQuality)reader.ReadInt();
                m_Durability   = (ArmorDurabilityLevel)reader.ReadInt();
                m_Protection   = (ArmorProtectionLevel)reader.ReadInt();

                AMT mat = (AMT)reader.ReadInt();

                if (m_ArmorBase == RevertArmorBase)
                {
                    m_ArmorBase = -1;
                }

                if (version >= 2)
                {
                    m_Resource = (CraftResource)reader.ReadInt();
                }
                else
                {
                    OreInfo info;

                    switch (reader.ReadInt())
                    {
                    default:
                    case 0: info = OreInfo.Iron; break;

                    case 1: info = OreInfo.DullCopper; break;

                    case 2: info = OreInfo.ShadowIron; break;

                    case 3: info = OreInfo.Copper; break;

                    case 4: info = OreInfo.Bronze; break;

                    case 5: info = OreInfo.Gold; break;

                    case 6: info = OreInfo.Agapite; break;

                    case 7: info = OreInfo.Verite; break;

                    case 8: info = OreInfo.Valorite; break;
                    }

                    m_Resource = CraftResources.GetFromOreInfo(info, mat);
                }

                m_StrBonus = reader.ReadInt();
                m_DexBonus = reader.ReadInt();
                m_IntBonus = reader.ReadInt();
                m_StrReq   = reader.ReadInt();
                m_DexReq   = reader.ReadInt();
                m_IntReq   = reader.ReadInt();

                if (m_StrBonus == OldStrBonus)
                {
                    m_StrBonus = -1;
                }

                if (m_DexBonus == OldDexBonus)
                {
                    m_DexBonus = -1;
                }

                if (m_IntBonus == OldIntBonus)
                {
                    m_IntBonus = -1;
                }

                if (m_StrReq == OldStrReq)
                {
                    m_StrReq = -1;
                }

                if (m_DexReq == OldDexReq)
                {
                    m_DexReq = -1;
                }

                if (m_IntReq == OldIntReq)
                {
                    m_IntReq = -1;
                }

                m_Meditate = (AMA)reader.ReadInt();

                if (m_Meditate == OldMedAllowance)
                {
                    m_Meditate = (AMA)(-1);
                }

                if (m_Resource == CraftResource.None)
                {
                    if (mat == ArmorMaterialType.Studded || mat == ArmorMaterialType.Leather)
                    {
                        m_Resource = CraftResource.RegularLeather;
                    }
                    else
                    {
                        m_Resource = CraftResource.Iron;
                    }
                }

                if (m_MaxHitPoints == 0 && m_HitPoints == 0)
                {
                    m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax(InitMinHits, InitMaxHits);
                }

                break;
            }
            }

            int strBonus = ComputeStatBonus(StatType.Str);
            int dexBonus = ComputeStatBonus(StatType.Dex);
            int intBonus = ComputeStatBonus(StatType.Int);

            if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
            {
                Mobile m = (Mobile)Parent;

                string modName = Serial.ToString();

                if (strBonus != 0)
                {
                    m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
                }

                if (dexBonus != 0)
                {
                    m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
                }

                if (intBonus != 0)
                {
                    m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
                }
            }

            if (Parent is Mobile)
            {
                ((Mobile)Parent).CheckStatTimers();
            }

            if (version < 7)
            {
                m_PlayerConstructed = true;                 // we don't know, so, assume it's crafted
            }
        }
Ejemplo n.º 14
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_Resource = (CraftResource)reader.ReadInt();
                break;
            }

            case 0:
            {
                OreInfo info;

                switch (reader.ReadInt())
                {
                case 0: info = OreInfo.Iron; break;

                case 1: info = OreInfo.Rusty; break;

                case 2: info = OreInfo.OldCopper; break;

                case 3: info = OreInfo.DullCopper; break;

                case 4: info = OreInfo.Ruby; break;

                case 5: info = OreInfo.Copper; break;

                case 6: info = OreInfo.Bronze; break;

                case 7: info = OreInfo.ShadowIron; break;

                case 8: info = OreInfo.Silver; break;

                case 9: info = OreInfo.Mercury; break;

                case 10: info = OreInfo.Rose; break;

                case 11: info = OreInfo.Gold; break;

                case 12: info = OreInfo.Agapite; break;

                case 13: info = OreInfo.Verite; break;

                case 14: info = OreInfo.Plutonio; break;

                case 15: info = OreInfo.BloodRock; break;

                case 16: info = OreInfo.Valorite; break;

                case 17: info = OreInfo.BlackRock; break;

                case 18: info = OreInfo.Mytheril; break;

                case 19: info = OreInfo.Aqua; break;

                case 20: info = OreInfo.Endurium; break;

                case 21: info = OreInfo.OldEndurium; break;

                case 22: info = OreInfo.GoldStone; break;

                case 23: info = OreInfo.MaxMytheril; break;

                case 24: info = OreInfo.Magma; break;

                default: info = null; break;
                }

                m_Resource = CraftResources.GetFromOreInfo(info);
                break;
            }
            }
        }
Ejemplo n.º 15
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 7:
            case 6:
            case 5:
            {
                SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

                if (GetSaveFlag(flags, SaveFlag.Identified))
                {
                    m_Identified = (version >= 7 || reader.ReadBool());
                }

                if (GetSaveFlag(flags, SaveFlag.MaxHitPoints))
                {
                    m_MaxHitPoints = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.HitPoints))
                {
                    m_HitPoints = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.Crafter))
                {
                    m_Crafter = reader.ReadMobile();
                }

                if (GetSaveFlag(flags, SaveFlag.Quality))
                {
                    m_Quality = (ArmorQuality)reader.ReadEncodedInt();
                }
                else
                {
                    m_Quality = ArmorQuality.Regular;
                }

                if (version == 5 && m_Quality == ArmorQuality.Low)
                {
                    m_Quality = ArmorQuality.Regular;
                }

                if (GetSaveFlag(flags, SaveFlag.Durability))
                {
                    m_Durability = (ArmorDurabilityLevel)reader.ReadEncodedInt();

                    if (m_Durability > ArmorDurabilityLevel.Indestructible)
                    {
                        m_Durability = ArmorDurabilityLevel.Durable;
                    }
                }

                if (GetSaveFlag(flags, SaveFlag.Protection))
                {
                    m_Protection = (ArmorProtectionLevel)reader.ReadEncodedInt();

                    if (m_Protection > ArmorProtectionLevel.Invulnerability)
                    {
                        m_Protection = ArmorProtectionLevel.Defense;
                    }
                }

                if (GetSaveFlag(flags, SaveFlag.Resource))
                {
                    m_Resource = (CraftResource)reader.ReadEncodedInt();
                }
                else
                {
                    m_Resource = DefaultResource;
                }

                if (m_Resource == CraftResource.None)
                {
                    m_Resource = DefaultResource;
                }

                if (GetSaveFlag(flags, SaveFlag.BaseArmor))
                {
                    m_ArmorBase = reader.ReadEncodedInt();
                }
                else
                {
                    m_ArmorBase = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.StrBonus))
                {
                    m_StrBonus = reader.ReadEncodedInt();
                }
                else
                {
                    m_StrBonus = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.DexBonus))
                {
                    m_DexBonus = reader.ReadEncodedInt();
                }
                else
                {
                    m_DexBonus = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.IntBonus))
                {
                    m_IntBonus = reader.ReadEncodedInt();
                }
                else
                {
                    m_IntBonus = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.StrReq))
                {
                    m_StrReq = reader.ReadEncodedInt();
                }
                else
                {
                    m_StrReq = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.DexReq))
                {
                    m_DexReq = reader.ReadEncodedInt();
                }
                else
                {
                    m_DexReq = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.IntReq))
                {
                    m_IntReq = reader.ReadEncodedInt();
                }
                else
                {
                    m_IntReq = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.MedAllowance))
                {
                    m_Meditate = (AMA)reader.ReadEncodedInt();
                }
                else
                {
                    m_Meditate = (AMA)(-1);
                }

                if (GetSaveFlag(flags, SaveFlag.PlayerConstructed))
                {
                    m_PlayerConstructed = true;
                }

                break;
            }

            case 4:
            case 3:
            case 2:
            case 1:
            {
                m_Identified = reader.ReadBool();
                goto case 0;
            }

            case 0:
            {
                m_ArmorBase    = reader.ReadInt();
                m_MaxHitPoints = reader.ReadInt();
                m_HitPoints    = reader.ReadInt();
                m_Crafter      = reader.ReadMobile();
                m_Quality      = (ArmorQuality)reader.ReadInt();
                m_Durability   = (ArmorDurabilityLevel)reader.ReadInt();
                m_Protection   = (ArmorProtectionLevel)reader.ReadInt();

                AMT mat = (AMT)reader.ReadInt();

                if (m_ArmorBase == RevertArmorBase)
                {
                    m_ArmorBase = -1;
                }

                /*m_BodyPos = (ArmorBodyType)*/ reader.ReadInt();

                // if ( version < 3 && m_Quality == ArmorQuality.Exceptional )
                // Add some AR and HP ??

                if (version >= 2)
                {
                    m_Resource = (CraftResource)reader.ReadInt();
                }
                else
                {
                    OreInfo info;

                    switch (reader.ReadInt())
                    {
                    default:
                    case 0: info = OreInfo.Iron; break;

                    case 1: info = OreInfo.DullCopper; break;

                    case 2: info = OreInfo.ShadowIron; break;

                    case 3: info = OreInfo.Copper; break;

                    case 4: info = OreInfo.Bronze; break;

                    case 5: info = OreInfo.Gold; break;

                    case 6: info = OreInfo.Agapite; break;

                    case 7: info = OreInfo.Verite; break;

                    case 8: info = OreInfo.Valorite; break;
                    }

                    m_Resource = CraftResources.GetFromOreInfo(info, mat);
                }

                m_StrBonus = reader.ReadInt();
                m_DexBonus = reader.ReadInt();
                m_IntBonus = reader.ReadInt();
                m_StrReq   = reader.ReadInt();
                m_DexReq   = reader.ReadInt();
                m_IntReq   = reader.ReadInt();

                if (m_StrBonus == OldStrBonus)
                {
                    m_StrBonus = -1;
                }

                if (m_DexBonus == OldDexBonus)
                {
                    m_DexBonus = -1;
                }

                if (m_IntBonus == OldIntBonus)
                {
                    m_IntBonus = -1;
                }

                if (m_StrReq == OldStrReq)
                {
                    m_StrReq = -1;
                }

                if (m_DexReq == OldDexReq)
                {
                    m_DexReq = -1;
                }

                if (m_IntReq == OldIntReq)
                {
                    m_IntReq = -1;
                }

                m_Meditate = (AMA)reader.ReadInt();

                if (m_Meditate == OldMedAllowance)
                {
                    m_Meditate = (AMA)(-1);
                }

                if (m_Resource == CraftResource.None)
                {
                    if (mat == ArmorMaterialType.Studded || mat == ArmorMaterialType.Leather)
                    {
                        m_Resource = CraftResource.RegularLeather;
                    }
                    else if (mat == ArmorMaterialType.Spined)
                    {
                        m_Resource = CraftResource.SpinedLeather;
                    }
                    else if (mat == ArmorMaterialType.Horned)
                    {
                        m_Resource = CraftResource.HornedLeather;
                    }
                    else if (mat == ArmorMaterialType.Barbed)
                    {
                        m_Resource = CraftResource.BarbedLeather;
                    }
                    else
                    {
                        m_Resource = CraftResource.Iron;
                    }
                }

                if (m_MaxHitPoints == 0 && m_HitPoints == 0)
                {
                    m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax(InitMinHits, InitMaxHits);
                }

                break;
            }
            }

            if (Parent is Mobile)
            {
                ((Mobile)Parent).CheckStatTimers();
            }

            if (version < 7)
            {
                m_PlayerConstructed = true;                 // we don't know, so, assume it's crafted
            }
        }
Ejemplo n.º 16
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_Resource = (CraftResource)reader.ReadInt();
                break;
            }

            case 0:
            {
                OreInfo info;

                switch (reader.ReadInt())
                {
                case 0: info = OreInfo.MIron; break;

                case 1: info = OreInfo.MBronze; break;

                case 2: info = OreInfo.MGold; break;

                case 3: info = OreInfo.MCopper; break;

                case 4: info = OreInfo.MOldcopper; break;

                case 5: info = OreInfo.MDullcopper; break;

                case 6: info = OreInfo.MSilver; break;

                case 7: info = OreInfo.MShadow; break;

                case 8: info = OreInfo.MBloodrock; break;

                case 9: info = OreInfo.MBlackrock; break;

                case 10: info = OreInfo.MMytheril; break;

                case 11: info = OreInfo.MRose; break;

                case 12: info = OreInfo.MVerite; break;

                case 13: info = OreInfo.MAgapite; break;

                case 14: info = OreInfo.MRusty; break;

                case 15: info = OreInfo.MValorite; break;

                case 16: info = OreInfo.MDragon; break;

                case 17: info = OreInfo.MTitan; break;

                case 18: info = OreInfo.MCrystaline; break;

                case 19: info = OreInfo.MKrynite; break;

                case 20: info = OreInfo.MVulcan; break;

                case 21: info = OreInfo.MBloodcrest; break;

                case 22: info = OreInfo.MElvin; break;

                case 23: info = OreInfo.MAcid; break;

                case 24: info = OreInfo.MAqua; break;

                case 25: info = OreInfo.MEldar; break;

                case 26: info = OreInfo.MGlowing; break;

                case 27: info = OreInfo.MGorgan; break;

                case 28: info = OreInfo.MSandrock; break;

                case 29: info = OreInfo.MSteel; break;

                default: info = null; break;
                }

                m_Resource = CraftResources.GetFromOreInfo(info);
                break;
            }
            }
        }