Ejemplo n.º 1
0
        public BaseJewel(int itemID, Layer layer) : base(itemID)
        {
            m_AosAttributes   = new AosAttributes(this);
            m_AosResistances  = new AosElementAttributes(this);
            m_AosSkillBonuses = new AosSkillBonuses(this);
            m_AosSkillBonuses = new AosSkillBonuses(this);
// Xml Spawner XmlSockets - SOF
// mod to randomly add sockets and socketability features to armor. These settings will yield
// 2% drop rate of socketed/socketable items
// 0.1% chance of 5 sockets
// 0.5% of 4 sockets
// 3% chance of 3 sockets
// 15% chance of 2 sockets
// 50% chance of 1 socket
// the remainder will be 0 socket (31.4% in this case)
// uncomment the next line to prevent artifacts from being socketed
// if(ArtifactRarity == 0)
            XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0);
// Xml Spawner XmlSockets - EOF
            m_Resource = CraftResource.Iron;
            m_GemType  = GemType.None;

            Layer = layer;

            m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax(InitMinHits, InitMaxHits);
        }
Ejemplo n.º 2
0
        public TestSocketedWeapon()
        {
            Name = "Test socketed weapon";

            switch (Utility.Random(4))
            {
            case 0:
                // make the weapon socketable up to 4 sockets using the default blacksmithing requirements
                // and add 2 sockets to start
                XmlAttach.AttachTo(this, new XmlSocketable(4));
                XmlAttach.AttachTo(this, new XmlSockets(2));
                break;

            case 1:
                // make the weapon socketable up to 4 sockets, and set specific socketing requirements
                // minimum of 100 skill in Tinkering required to socket it, and it uses 50 Agapipe ingots
                XmlAttach.AttachTo(this, new XmlSocketable(4, SkillName.Tinkering, 100.0, typeof(AgapiteIngot), 50));
                break;

            case 2:
                // give it 2 sockets and dont allow it to be further socketed
                XmlAttach.AttachTo(this, new XmlSocketable(0));
                XmlAttach.AttachTo(this, new XmlSockets(2));
                break;

            case 3:
                // give it 2 sockets, fill one of them with an augment, nd dont allow it to be further socketed

                // create 2 sockets
                XmlSockets s = new XmlSockets(2);
                // fill the sockets (starting at 0) with an ancient diamond augment (which only takes up 1 slot)
                // the augment call has this form: public static bool Augment( Mobile from, object parent, XmlSockets sock, int socketnum, IXmlSocketAugmentation a)
                // Note that the new augment will be automatically deleted after augmenting
                XmlSockets.Augment(null, this, s, 0, new AncientDiamond());
                // and put the sockets onto the katana
                XmlAttach.AttachTo(this, s);
                // and dont allow it to be further socketed
                XmlAttach.AttachTo(this, new XmlSocketable(0));
                break;
            }
        }
Ejemplo n.º 3
0
        public override string OnIdentify(Mobile from)
        {
            string msg      = null;
            int    nSockets = 0;

            // first see if the target has any existing sockets

            XmlSockets s = XmlAttach.FindAttachment(this.AttachedTo, typeof(XmlSockets)) as XmlSockets;

            if (s != null)
            {
                // find out how many sockets it has
                nSockets = s.NSockets;
            }

            if (nSockets > this.MaxSockets)
            {
                this.m_MaxSockets = nSockets;
            }

            if (this.MaxSockets == nSockets)
            {
                // already full so no chance of socketing
                return("Cannot be socketed any further.");
            }

            if (this.MaxSockets > 0)
            {
                msg = String.Format("Maximum sockets allowed is {0}.", this.MaxSockets);
            }
            else if (this.MaxSockets == 0)
            {
                return("You cannot add sockets to this.");
            }
            else if (this.MaxSockets == -1)
            {
                msg = String.Format("Can be socketed.");
            }

            // compute difficulty based upon existing sockets

            if (from != null)
            {
                if (this.MinSkillLevel > 0)
                {
                    msg += String.Format("\nRequires {0} skill in {1} to socket.", this.MinSkillLevel, this.RequiredSkill);
                }

                if (this.MinSkillLevel2 > 0)
                {
                    msg += String.Format("\nas well as {0} skill in {1} to socket.", this.MinSkillLevel2, this.RequiredSkill2);
                }

                if (this.RequiredResource != null && this.ResourceQuantity > 0)
                {
                    msg += String.Format("\nSocketing consumes {0} {1}.", this.ResourceQuantity, this.RequiredResource.Name);
                }

                int success = XmlSockets.ComputeSuccessChance(from, nSockets, this.MinSkillLevel, this.RequiredSkill, this.MinSkillLevel2, this.RequiredSkill2);

                msg += String.Format("\n{0}% chance of socketing\n", success);
            }

            return(msg);
        }
Ejemplo n.º 4
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 3:
            {
                m_MaxHitPoints = reader.ReadEncodedInt();
                m_HitPoints    = reader.ReadEncodedInt();

                goto case 2;
            }

            case 2:
            {
                m_Resource = (CraftResource)reader.ReadEncodedInt();
                m_GemType  = (GemType)reader.ReadEncodedInt();

                goto case 1;
            }

            case 1:
            {
                m_AosAttributes   = new AosAttributes(this, reader);
                m_AosResistances  = new AosElementAttributes(this, reader);
                m_AosSkillBonuses = new AosSkillBonuses(this, reader);

                if (Core.AOS && Parent is Mobile)
                {
                    m_AosSkillBonuses.AddTo((Mobile)Parent);
                }

                int strBonus = m_AosAttributes.BonusStr;
                int dexBonus = m_AosAttributes.BonusDex;
                int intBonus = m_AosAttributes.BonusInt;

                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();
                }

                break;
            }

            case 0:
            {
                m_AosAttributes   = new AosAttributes(this);
                m_AosResistances  = new AosElementAttributes(this);
                m_AosSkillBonuses = new AosSkillBonuses(this);
                m_AosSkillBonuses = new AosSkillBonuses(this);
// Xml Spawner XmlSockets - SOF
// mod to randomly add sockets and socketability features to armor. These settings will yield
// 2% drop rate of socketed/socketable items
// 0.1% chance of 5 sockets
// 0.5% of 4 sockets
// 3% chance of 3 sockets
// 15% chance of 2 sockets
// 50% chance of 1 socket
// the remainder will be 0 socket (31.4% in this case)
// uncomment the next line to prevent artifacts from being socketed
// if(ArtifactRarity == 0)
                XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0);
// Xml Spawner XmlSockets - EOF

                break;
            }
            }

            if (version < 2)
            {
                m_Resource = CraftResource.Iron;
                m_GemType  = GemType.None;
            }
        }
Ejemplo n.º 5
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (from == null || targeted == null)
                {
                    return;
                }

                // BaseShield uses BaseArmor
                if (targeted is BaseArmor || targeted is BaseWeapon || targeted is BaseJewel || targeted is BaseCreature)
                {
                    if (targeted is BaseCreature)
                    {
                        BaseCreature bc = (BaseCreature)targeted;

                        if (bc.ControlMaster != from)
                        {
                            from.SendMessage("That is not your pet!");
                            return;
                        }
                    }

                    int       maxSockets  = XmlSockets.DefaultMaxSockets;
                    double    difficulty  = 0.00;                 //DefaultSocketDifficulty;
                    SkillName skillname   = SkillName.Meditation; // DefaultSocketSkill;
                    double    difficulty2 = 0.00;                 //DefaultSocketDifficulty;
                    SkillName skillname2  = SkillName.Meditation; //DefaultSocketSkill;
                    Type      resource    = null;                 //DefaultSocketResource;
                    int       quantity    = 0;                    //DefaultSocketResourceQuantity;

                    int nSockets = 0;

                    XmlSockets s = XmlAttach.FindAttachment(targeted, typeof(XmlSockets)) as XmlSockets;

                    if (s != null)
                    {
                        // find out how many sockets it has
                        nSockets = s.NSockets;
                    }

                    // already full, no more sockets allowed
                    if ((nSockets + m_extrasockets - 1) >= maxSockets && maxSockets >= 0)
                    {
                        from.SendMessage("You cannot add that many sockets to the item! It already has {0} of max {1} sockets.", nSockets, maxSockets);
                        return;
                    }

                    if (nSockets >= maxSockets && maxSockets >= 0)
                    {
                        from.SendMessage("This cannot be socketed any further.");
                        return;
                    }

                    from.PlaySound(0x2A);                       // play anvil sound

                    from.SendMessage("You have successfully added a socket the target!");

                    if (s != null)
                    {
                        // add an empty socket
                        for (int i = 0; i <= (m_extrasockets - 1); i++)
                        {
                            s.SocketOccupants.Add(null);
                        }
                    }
                    else
                    {
                        // add an xmlsockets attachment with the new socket
                        s = new XmlSockets(m_extrasockets);
                        XmlAttach.AttachTo(targeted, s);
                    }

                    if (s != null)
                    {
                        s.InvalidateParentProperties();
                    }
                    from.SendGump(new XmlSockets.SocketsGump(from, s));

                    _deed.Delete();
                }
                else
                {
                    from.SendMessage("This cannot be socketed.");
                }
            }
Ejemplo n.º 6
0
        public override void DoTransmute(Mobile from, Recipe r)
        {
            if (r == null || from == null)
            {
                return;
            }

            Recipes rid = (Recipes)r.RecipeID;

            switch (rid)
            {
            case Recipes.PowerScrollSkillChange:
            {
                // get the target value from one of the powerscrolls
                Item[] slist = this.FindItemsByType(typeof(PowerScroll), true);

                double value = 0;
                // make sure they are all of the same value
                foreach (Item s in slist)
                {
                    if (value == 0)
                    {
                        value = ((PowerScroll)s).Value;
                    }
                    else
                    {
                        if (value != ((PowerScroll)s).Value)
                        {
                            from.SendMessage("All powerscrolls must be of the same level");
                            return;
                        }
                    }
                }

                PowerScroll newps = PowerScroll.CreateRandom((int)(value - 100), (int)(value - 100));

                // consume ingredients
                this.ConsumeAll();

                // add the new powerscroll
                this.DropItem(newps);

                break;
            }

            case Recipes.SmallBODChange:
            {
                // get the target value from one of the powerscrolls
                Item[] slist = this.FindItemsByType(typeof(SmallBOD), true);

                Type t = null;
                // make sure they are all of the same type
                foreach (Item s in slist)
                {
                    if (t == null)
                    {
                        t = ((SmallBOD)s).GetType();
                    }
                    else
                    {
                        if (t != ((SmallBOD)s).GetType())
                        {
                            from.SendMessage("All BODs must be of the same type");
                            return;
                        }
                    }
                }

                SmallBOD newbod = null;

                if (t == typeof(SmallTailorBOD))
                {
                    newbod = new SmallTailorBOD();
                }
                else if (t == typeof(SmallSmithBOD))
                {
                    newbod = new SmallSmithBOD();
                }
                else
                {
                    from.SendMessage("Cannot transmute those BODs");
                    return;
                }

                if (newbod == null)
                {
                    return;
                }

                // consume ingredients
                this.ConsumeAll();

                // add the new powerscroll
                this.DropItem(newbod);

                break;
            }

            case Recipes.LargeBODChange:
            {
                // get the target value from one of the powerscrolls
                Item[] slist = this.FindItemsByType(typeof(LargeBOD), true);

                Type t = null;
                // make sure they are all of the same type
                foreach (Item s in slist)
                {
                    if (t == null)
                    {
                        t = ((LargeBOD)s).GetType();
                    }
                    else
                    {
                        if (t != ((LargeBOD)s).GetType())
                        {
                            from.SendMessage("All BODs must be of the same type");
                            return;
                        }
                    }
                }

                LargeBOD newbod = null;

                if (t == typeof(LargeTailorBOD))
                {
                    newbod = new LargeTailorBOD();
                }
                else if (t == typeof(LargeSmithBOD))
                {
                    newbod = new LargeSmithBOD();
                }
                else
                {
                    from.SendMessage("Cannot transmute those BODs");
                    return;
                }

                if (newbod == null)
                {
                    return;
                }

                // consume ingredients
                this.ConsumeAll();

                // add the new powerscroll
                this.DropItem(newbod);

                break;
            }

            case Recipes.UpgradeAncientAugment:
            {
                // check what type of augment is being upgraded
                BaseSocketAugmentation augment = null;
                if (this.Items.Count > 0)
                {
                    augment = this.Items[0] as BaseSocketAugmentation;
                }

                if (augment == null)
                {
                    return;
                }

                // make sure they are all the same
                foreach (Item i in this.Items)
                {
                    if (augment.GetType() != i.GetType())
                    {
                        return;
                    }
                }

                // take the ingredients
                this.ConsumeAll();
                // and add the result
                if (augment is AncientDiamond)
                {
                    this.DropItem(new LegendaryDiamond());
                }
                else if (augment is AncientSapphire)
                {
                    this.DropItem(new LegendarySapphire());
                }
                else if (augment is AncientSkull)
                {
                    this.DropItem(new LegendarySkull());
                }
                else if (augment is AncientTourmaline)
                {
                    this.DropItem(new LegendaryTourmaline());
                }
                else if (augment is AncientWood)
                {
                    this.DropItem(new LegendaryWood());
                }
                else if (augment is AncientRuby)
                {
                    this.DropItem(new LegendaryRuby());
                }
                else if (augment is AncientEmerald)
                {
                    this.DropItem(new LegendaryEmerald());
                }
                else if (augment is AncientAmethyst)
                {
                    this.DropItem(new LegendaryAmethyst());
                }

                break;
            }

            case Recipes.UpgradeLegendaryAugment:
            {
                // check what type of augment is being upgraded
                BaseSocketAugmentation augment = null;
                if (this.Items.Count > 0)
                {
                    augment = this.Items[0] as BaseSocketAugmentation;
                }

                if (augment == null)
                {
                    return;
                }

                // make sure they are all the same
                foreach (Item i in this.Items)
                {
                    if (augment.GetType() != i.GetType())
                    {
                        return;
                    }
                }

                // take the ingredients
                this.ConsumeAll();

                // and add the result
                if (augment is LegendaryDiamond)
                {
                    this.DropItem(new MythicDiamond());
                }
                else if (augment is LegendarySapphire)
                {
                    this.DropItem(new MythicSapphire());
                }
                else if (augment is LegendarySkull)
                {
                    this.DropItem(new MythicSkull());
                }
                else if (augment is LegendaryTourmaline)
                {
                    this.DropItem(new MythicTourmaline());
                }
                else if (augment is LegendaryWood)
                {
                    this.DropItem(new MythicWood());
                }
                else if (augment is LegendaryRuby)
                {
                    this.DropItem(new MythicRuby());
                }
                else if (augment is LegendaryEmerald)
                {
                    this.DropItem(new MythicEmerald());
                }
                else if (augment is LegendaryAmethyst)
                {
                    this.DropItem(new MythicAmethyst());
                }

                break;
            }

            case Recipes.UpgradeCrystalAugment:
            {
                // check what type of augment is being upgraded
                BaseSocketAugmentation augment = null;
                if (this.Items.Count > 0)
                {
                    augment = this.Items[0] as BaseSocketAugmentation;
                }

                if (augment == null)
                {
                    return;
                }

                // make sure they are all the same
                foreach (Item i in this.Items)
                {
                    if (augment.GetType() != i.GetType())
                    {
                        return;
                    }
                }

                // take the ingredients
                this.ConsumeAll();

                // and add the result
                if (augment is RhoCrystal)
                {
                    this.DropItem(new RadiantRhoCrystal());
                }
                else if (augment is RysCrystal)
                {
                    this.DropItem(new RadiantRysCrystal());
                }
                else if (augment is WyrCrystal)
                {
                    this.DropItem(new RadiantWyrCrystal());
                }
                else if (augment is FreCrystal)
                {
                    this.DropItem(new RadiantFreCrystal());
                }
                else if (augment is TorCrystal)
                {
                    this.DropItem(new RadiantTorCrystal());
                }
                else if (augment is VelCrystal)
                {
                    this.DropItem(new RadiantVelCrystal());
                }
                else if (augment is XenCrystal)
                {
                    this.DropItem(new RadiantXenCrystal());
                }
                else if (augment is PolCrystal)
                {
                    this.DropItem(new RadiantPolCrystal());
                }
                else if (augment is WolCrystal)
                {
                    this.DropItem(new RadiantWolCrystal());
                }
                else if (augment is BalCrystal)
                {
                    this.DropItem(new RadiantBalCrystal());
                }
                else if (augment is TalCrystal)
                {
                    this.DropItem(new RadiantTalCrystal());
                }
                else if (augment is JalCrystal)
                {
                    this.DropItem(new RadiantJalCrystal());
                }
                else if (augment is RalCrystal)
                {
                    this.DropItem(new RadiantRalCrystal());
                }
                else if (augment is KalCrystal)
                {
                    this.DropItem(new RadiantKalCrystal());
                }

                break;
            }

            case Recipes.RecoverAugmentation:
            {
                // does item have any sockets on it?
                Item b = this.FindItemByType(typeof(BaseArmor), true);
                if (b == null)
                {
                    b = this.FindItemByType(typeof(BaseWeapon), true);
                }
                if (b == null)
                {
                    b = this.FindItemByType(typeof(BaseJewel), true);
                }

                XmlSockets a = XmlAttach.FindAttachment(b, typeof(XmlSockets)) as XmlSockets;
                if (a == null)
                {
                    // if so then forget it
                    from.SendMessage("This item is not socketed.");
                    return;
                }

                if (a.NSockets == 0)
                {
                    from.SendMessage("This item is has no sockets.");
                    return;
                }

                BaseSocketAugmentation augment = a.RecoverRandomAugmentation(from, b);

                if (augment != null)
                {
                    // consume the crystal
                    this.ConsumeTotal(typeof(AncientRuby), 1, true);

                    // put the recovered augment in the container
                    this.DropItem(augment);

                    from.SendMessage("Recovered a {0} augmentation.", augment.Name);

                    // update the sockets gump
                    a.OnIdentify(from);
                }
                else
                {
                    from.SendMessage("Failed to recover augmentation.");
                }

                break;
            }

            case Recipes.HammerOfRecovery:
            {
                // consume ingredients
                this.ConsumeAll();

                // add the hammer
                this.DropItem(new HammerOfRecovery(1));

                break;
            }

            case Recipes.ExceptionalSocketHammer:
            {
                // consume ingredients
                this.ConsumeAll();

                // add the hammer
                this.DropItem(new ExceptionalSocketHammer(1));

                break;
            }

            case Recipes.SocketWeapon:
            {
                // does the weapon already have any sockets on it?
                Item          b = this.FindItemByType(typeof(BaseWeapon), true);
                XmlAttachment a = XmlAttach.FindAttachment(b, typeof(XmlSockets));
                if (a != null)
                {
                    // if so then forget it
                    from.SendMessage("Weapon already socketed.");
                    return;
                }
                // otherwise add the socket
                XmlAttach.AttachTo(b, new XmlSockets(1));
                // consume the crystal
                this.ConsumeTotal(typeof(RadiantRhoCrystal), 1, true);
                break;
            }

            case Recipes.SocketArmor:
            {
                // does the armor already have any sockets on it?
                Item          b = this.FindItemByType(typeof(BaseArmor), true);
                XmlAttachment a = XmlAttach.FindAttachment(b, typeof(XmlSockets));
                if (a != null)
                {
                    // if so then forget it
                    from.SendMessage("Armor already socketed.");
                    return;
                }
                // otherwise add the socket
                XmlAttach.AttachTo(b, new XmlSockets(1));
                // consume the crystal
                this.ConsumeTotal(typeof(RadiantRhoCrystal), 1, true);
                break;
            }

                // Uncomment the follow recipes if you have XmlMobFactions installed and you would like to allow faction gain through these recipes
            #if (XMLMOBFACTIONS)
            case Recipes.UndeadFaction:
            {
                // how much gold is being offered
                Item b     = FindItemByType(typeof(Gold), true);
                int  value = 0;
                if (b != null)
                {
                    value = b.Amount / 10;
                }
                // take the ingredients
                ConsumeAll();
                // add the faction
                XmlAttach.AttachTo(from, new XmlAddFaction("Undead", value));
                break;
            }

            case Recipes.AbyssFaction:
            {
                // how much gold is being offered
                Item b     = FindItemByType(typeof(Gold), true);
                int  value = 0;
                if (b != null)
                {
                    value = b.Amount / 10;
                }
                // take the ingredients
                ConsumeAll();
                // add the faction
                XmlAttach.AttachTo(from, new XmlAddFaction("Abyss", value));
                break;
            }

            case Recipes.HumanoidFaction:
            {
                // how much gold is being offered
                Item b     = FindItemByType(typeof(Gold), true);
                int  value = 0;
                if (b != null)
                {
                    value = b.Amount / 10;
                }
                // take the ingredients
                ConsumeAll();
                // add the faction
                XmlAttach.AttachTo(from, new XmlAddFaction("Humanoid", value));
                break;
            }

            case Recipes.ReptilianFaction:
            {
                // how much gold is being offered
                Item b     = FindItemByType(typeof(Gold), true);
                int  value = 0;
                if (b != null)
                {
                    value = b.Amount / 10;
                }
                // take the ingredients
                ConsumeAll();
                // add the faction
                XmlAttach.AttachTo(from, new XmlAddFaction("Reptilian", value));
                break;
            }

            case Recipes.ArachnidFaction:
            {
                // how much gold is being offered
                Item b     = FindItemByType(typeof(Gold), true);
                int  value = 0;
                if (b != null)
                {
                    value = b.Amount / 10;
                }
                // take the ingredients
                ConsumeAll();
                // add the faction
                XmlAttach.AttachTo(from, new XmlAddFaction("Arachnid", value));
                break;
            }

            case Recipes.ElementalFaction:
            {
                // how much gold is being offered
                Item b     = FindItemByType(typeof(Gold), true);
                int  value = 0;
                if (b != null)
                {
                    value = b.Amount / 10;
                }
                // take the ingredients
                ConsumeAll();
                // add the faction
                XmlAttach.AttachTo(from, new XmlAddFaction("Elemental", value));
                break;
            }

            case Recipes.UnderworldFaction:
            {
                // how much gold is being offered
                Item b     = FindItemByType(typeof(Gold), true);
                int  value = 0;
                if (b != null)
                {
                    value = b.Amount / 10;
                }
                // take the ingredients
                ConsumeAll();
                // add the faction
                XmlAttach.AttachTo(from, new XmlAddFaction("Underworld", value));
                break;
            }
// end of commented-out XmlMobFactions recipes
            #endif
            }

            // give effects for successful transmutation
            from.PlaySound(503);

            base.DoTransmute(from, r);
        }