Ejemplo n.º 1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is UnidentifiedItem)
                {
                    Container        packs    = from.Backpack;
                    int              nCost    = 200;
                    UnidentifiedItem WhatIsIt = (UnidentifiedItem)targeted;

                    if (BeggingPose(from) > 0)                       // LET US SEE IF THEY ARE BEGGING - WIZARD
                    {
                        nCost = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost); if (nCost < 1)
                        {
                            nCost = 1;
                        }
                    }
                    int toConsume = nCost;

                    if (WhatIsIt.VendorCanID != "Bard")
                    {
                        m_Bard.SayTo(from, "Sorry, I cannot tell what that is.");
                    }
                    else if (packs.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        string      MyItemName = "item";
                        Container   pack       = (Container)targeted;
                        List <Item> items      = new List <Item>();
                        foreach (Item item in pack.Items)
                        {
                            items.Add(item);
                        }
                        foreach (Item item in items)
                        {
                            MyItemName = item.Name;
                            from.AddToBackpack(item);
                        }
                        if (MyItemName == "")
                        {
                            MyItemName = "item";
                        }
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                        m_Bard.SayTo(from, "Let me tell you about this item...");
                        WhatIsIt.Delete();
                    }
                    else
                    {
                        m_Bard.SayTo(from, "It would cost you {0} gold to have that identified.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                else
                {
                    m_Bard.SayTo(from, "That does not need my services.");
                }
            }
Ejemplo n.º 2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                Container pack = from.Backpack;

                int nCost  = 500;
                int nCost2 = 5000;

                if (BeggingPose(from) > 0)                   // LET US SEE IF THEY ARE BEGGING - WIZARD
                {
                    nCost  = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost);
                    nCost2 = nCost2 - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost2);
                }

                if (targeted is UnknownWand && from.Backpack != null)
                {
                    int toConsume = nCost;

                    if (pack.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));

                        if (Utility.RandomMinMax(1, 100) > 10)
                        {
                            Server.Items.UnknownWand.WandType((Item)targeted, from, m_Sage);
                        }
                        else
                        {
                            int    nJunk     = Utility.RandomMinMax(1, 5);
                            string stickName = "";
                            switch (nJunk)
                            {
                            case 1: stickName = "a useless stick"; break;

                            case 2: stickName = "a wand that was never enchanted"; break;

                            case 3: stickName = "a fake wand"; break;

                            case 4: stickName = "nothing magical at all"; break;

                            case 5: stickName = "a simple metal rod"; break;
                            }
                            m_Sage.SayTo(from, "This seems to be " + stickName + ".");
                        }
                        ((Item)targeted).Delete();
                    }
                    else
                    {
                        m_Sage.SayTo(from, "It would cost you {0} gold to have that identified.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                else if (targeted is UnidentifiedArtifact)
                {
                    Container packs = from.Backpack;
                    nCost2 = 5000;
                    UnidentifiedArtifact WhatIsIt = (UnidentifiedArtifact)targeted;

                    if (BeggingPose(from) > 0)                       // LET US SEE IF THEY ARE BEGGING - WIZARD
                    {
                        nCost2 = nCost2 - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost2); if (nCost2 < 1)
                        {
                            nCost2 = 1;
                        }
                    }
                    int toConsume = nCost2;

                    if (packs.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        Container   bpack = (Container)targeted;
                        List <Item> items = new List <Item>();
                        foreach (Item item in bpack.Items)
                        {
                            items.Add(item);
                        }
                        foreach (Item item in items)
                        {
                            from.AddToBackpack(item);
                        }
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                        m_Sage.SayTo(from, "Let me tell you about this artifact...");
                        WhatIsIt.Delete();
                    }
                    else
                    {
                        m_Sage.SayTo(from, "It would cost you {0} gold to have that identified.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                else if (targeted is UnidentifiedItem)
                {
                    Container packs = from.Backpack;
                    nCost = 200;
                    UnidentifiedItem WhatIsIt = (UnidentifiedItem)targeted;

                    if (BeggingPose(from) > 0)                       // LET US SEE IF THEY ARE BEGGING - WIZARD
                    {
                        nCost = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost); if (nCost < 1)
                        {
                            nCost = 1;
                        }
                    }
                    int toConsume = nCost;

                    if (WhatIsIt.VendorCanID != "Sage")
                    {
                        m_Sage.SayTo(from, "Sorry, I cannot tell what that is.");
                    }
                    else if (packs.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        Container   bpack = (Container)targeted;
                        List <Item> items = new List <Item>();
                        foreach (Item item in bpack.Items)
                        {
                            items.Add(item);
                        }
                        foreach (Item item in items)
                        {
                            from.AddToBackpack(item);
                        }
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                        m_Sage.SayTo(from, "Let me tell you about this item...");
                        WhatIsIt.Delete();
                    }
                    else
                    {
                        m_Sage.SayTo(from, "It would cost you {0} gold to have that identified.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                else if (targeted is ScrollClue)
                {
                    Container packs = from.Backpack;
                    nCost = 100;
                    ScrollClue WhatIsIt = (ScrollClue)targeted;

                    if (BeggingPose(from) > 0)                       // LET US SEE IF THEY ARE BEGGING - WIZARD
                    {
                        nCost = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost); if (nCost < 1)
                        {
                            nCost = 1;
                        }
                    }
                    int toConsume = nCost;

                    if (WhatIsIt.ScrollIntelligence == 0)
                    {
                        m_Sage.SayTo(from, "That was already deciphered by someone.");
                    }
                    else if (packs.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        if (WhatIsIt.ScrollIntelligence >= 80)
                        {
                            WhatIsIt.Name = "diabolically coded parchment";
                        }
                        else if (WhatIsIt.ScrollIntelligence >= 70)
                        {
                            WhatIsIt.Name = "ingeniously coded parchment";
                        }
                        else if (WhatIsIt.ScrollIntelligence >= 60)
                        {
                            WhatIsIt.Name = "deviously coded parchment";
                        }
                        else if (WhatIsIt.ScrollIntelligence >= 50)
                        {
                            WhatIsIt.Name = "cleverly coded parchment";
                        }
                        else if (WhatIsIt.ScrollIntelligence >= 40)
                        {
                            WhatIsIt.Name = "adeptly coded parchment";
                        }
                        else if (WhatIsIt.ScrollIntelligence >= 30)
                        {
                            WhatIsIt.Name = "expertly coded parchment";
                        }
                        else
                        {
                            WhatIsIt.Name = "plainly coded parchment";
                        }

                        WhatIsIt.ScrollIntelligence = 0;
                        WhatIsIt.InvalidateProperties();
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                        m_Sage.SayTo(from, "Let me show you what this reads...");
                        WhatIsIt.ScrollSolved = "Deciphered by " + m_Sage.Name + " the Librarian";
                        from.PlaySound(0x249);
                        WhatIsIt.InvalidateProperties();
                    }
                    else
                    {
                        m_Sage.SayTo(from, "It would cost you {0} gold to have that deciphered.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                else
                {
                    m_Sage.SayTo(from, "That does not need my services.");
                }
            }
Ejemplo n.º 3
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                if (targeted is MagicRobe && from.Backpack != null)
                {
                    Item      ba        = targeted as Item;
                    Container pack      = from.Backpack;
                    int       toConsume = 0;

                    if (ba.ItemID != 0x1F03 && ba.ItemID != 0x1F04)
                    {
                        int nCost = 5;

                        if (BeggingPose(from) > 0)                           // LET US SEE IF THEY ARE BEGGING - WIZARD
                        {
                            nCost = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost); if (nCost < 1)
                            {
                                nCost = 1;
                            }
                        }
                        toConsume = nCost;
                    }
                    else
                    {
                        m_Weaver.SayTo(from, "That does not need my services.");
                    }

                    if (toConsume == 0)
                    {
                        return;
                    }

                    if (pack.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        if (BeggingPose(from) > 0)
                        {
                            Titles.AwardKarma(from, -BeggingKarma(from), true);
                        }                                                                                                               // DO ANY KARMA LOSS
                        m_Weaver.SayTo(from, "Here is your robe.");
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                        Effects.PlaySound(from.Location, from.Map, 0x248);
                        ba.ItemID = 0x1F03;
                        ba.Name   = "robe";
                    }
                    else
                    {
                        m_Weaver.SayTo(from, "It would cost you {0} gold to have that done.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                else if (targeted is MagicCloak && from.Backpack != null)
                {
                    Item      ba        = targeted as Item;
                    Container pack      = from.Backpack;
                    int       toConsume = 0;

                    if (ba.ItemID != 0x1515 && ba.ItemID != 0x1530)
                    {
                        int nCost = 5;

                        if (BeggingPose(from) > 0)                           // LET US SEE IF THEY ARE BEGGING - WIZARD
                        {
                            nCost = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost); if (nCost < 1)
                            {
                                nCost = 1;
                            }
                        }
                        toConsume = nCost;
                    }
                    else
                    {
                        m_Weaver.SayTo(from, "That does not need my services.");
                    }

                    if (toConsume == 0)
                    {
                        return;
                    }

                    if (pack.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        if (BeggingPose(from) > 0)
                        {
                            Titles.AwardKarma(from, -BeggingKarma(from), true);
                        }                                                                                                               // DO ANY KARMA LOSS
                        m_Weaver.SayTo(from, "Here is your cloak.");
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                        Effects.PlaySound(from.Location, from.Map, 0x248);
                        ba.ItemID = 0x1515;
                        ba.Name   = "cloak";
                    }
                    else
                    {
                        m_Weaver.SayTo(from, "It would cost you {0} gold to have that done.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                else if (targeted is BaseHat && from.Backpack != null && !(targeted is DeerMask) && !(targeted is BearMask))
                {
                    BaseHat   ba        = targeted as BaseHat;
                    Container pack      = from.Backpack;
                    int       toConsume = 0;

                    if (ba.HitPoints < ba.MaxHitPoints)
                    {
                        int nCost = 10;

                        if (BeggingPose(from) > 0)                           // LET US SEE IF THEY ARE BEGGING - WIZARD
                        {
                            nCost = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost); if (nCost < 1)
                            {
                                nCost = 1;
                            }
                            toConsume = (ba.MaxHitPoints - ba.HitPoints) * nCost;
                        }
                        else
                        {
                            toConsume = (ba.MaxHitPoints - ba.HitPoints) * nCost;
                        }
                    }
                    else if (ba.HitPoints >= ba.MaxHitPoints)
                    {
                        m_Weaver.SayTo(from, "That does not need to be repaired.");
                    }
                    else
                    {
                        m_Weaver.SayTo(from, "I cannot repair that.");
                    }

                    if (toConsume == 0)
                    {
                        return;
                    }

                    if (pack.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        if (BeggingPose(from) > 0)
                        {
                            Titles.AwardKarma(from, -BeggingKarma(from), true);
                        }                                                                                                               // DO ANY KARMA LOSS
                        m_Weaver.SayTo(from, "Here is your hat.");
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                        Effects.PlaySound(from.Location, from.Map, 0x248);
                        ba.MaxHitPoints -= 1;
                        ba.HitPoints     = ba.MaxHitPoints;
                    }
                    else
                    {
                        m_Weaver.SayTo(from, "It would cost you {0} gold to have that repaired.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                else if (targeted is UnidentifiedItem)
                {
                    Container        packs    = from.Backpack;
                    int              nCost    = 200;
                    UnidentifiedItem WhatIsIt = (UnidentifiedItem)targeted;

                    if (BeggingPose(from) > 0)                       // LET US SEE IF THEY ARE BEGGING - WIZARD
                    {
                        nCost = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost); if (nCost < 1)
                        {
                            nCost = 1;
                        }
                    }
                    int toConsume = nCost;

                    if (WhatIsIt.VendorCanID != "Tailor")
                    {
                        m_Weaver.SayTo(from, "Sorry, I cannot tell what that is.");
                    }
                    else if (packs.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        string      MyItemName = "item";
                        Container   pack       = (Container)targeted;
                        List <Item> items      = new List <Item>();
                        foreach (Item item in pack.Items)
                        {
                            items.Add(item);
                        }
                        foreach (Item item in items)
                        {
                            MyItemName = item.Name;
                            from.AddToBackpack(item);
                        }
                        if (MyItemName == "")
                        {
                            MyItemName = "item";
                        }
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                        m_Weaver.SayTo(from, "Let me tell you about this item...");
                        WhatIsIt.Delete();
                    }
                    else
                    {
                        m_Weaver.SayTo(from, "It would cost you {0} gold to have that identified.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                else
                {
                    m_Weaver.SayTo(from, "That does not need my services.");
                }
            }
Ejemplo n.º 4
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item ITEM = (Item)targeted;

                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    if (targeted is UnidentifiedItem)
                    {
                        Container        packs    = from.Backpack;
                        int              nCost    = 200;
                        UnidentifiedItem WhatIsIt = (UnidentifiedItem)targeted;

                        if (BeggingPose(from) > 0)                           // LET US SEE IF THEY ARE BEGGING - WIZARD
                        {
                            nCost = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost); if (nCost < 1)
                            {
                                nCost = 1;
                            }
                        }
                        int toConsume = nCost;

                        if (WhatIsIt.VendorCanID != "Blacksmith")
                        {
                            m_Blacksmith.SayTo(from, "Sorry, I cannot tell what that is.");
                        }
                        else if (packs.ConsumeTotal(typeof(Gold), toConsume))
                        {
                            string      MyItemName = "item";
                            Container   pack       = (Container)targeted;
                            List <Item> items      = new List <Item>();
                            foreach (Item item in pack.Items)
                            {
                                items.Add(item);
                            }
                            foreach (Item item in items)
                            {
                                MyItemName = item.Name;
                                from.AddToBackpack(item);
                            }
                            if (MyItemName == "")
                            {
                                MyItemName = "item";
                            }
                            from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                            m_Blacksmith.SayTo(from, "Let me tell you about this item...");
                            WhatIsIt.Delete();
                        }
                        else
                        {
                            m_Blacksmith.SayTo(from, "It would cost you {0} gold to have that identified.", toConsume);
                            from.SendMessage("You do not have enough gold.");
                        }
                    }
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    else if ((targeted is BaseWeapon && from.Backpack != null) && !(targeted is BaseRanged) && Server.Misc.MaterialInfo.IsAnyKindOfMetalItem(ITEM))
                    {
                        BaseWeapon bw        = targeted as BaseWeapon;
                        Container  pack      = from.Backpack;
                        int        toConsume = 0;

                        if (bw.HitPoints < bw.MaxHitPoints)
                        {
                            int nCost = 10;

                            if (BeggingPose(from) > 0)                               // LET US SEE IF THEY ARE BEGGING - WIZARD
                            {
                                nCost = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost); if (nCost < 1)
                                {
                                    nCost = 1;
                                }
                                toConsume = (bw.MaxHitPoints - bw.HitPoints - 1) * nCost;
                            }
                            else
                            {
                                toConsume = (bw.MaxHitPoints - bw.HitPoints - 1) * nCost;
                            }
                        }
                        else
                        {
                            m_Blacksmith.SayTo(from, "That does not need to be repaired.");
                        }

                        if (toConsume == 0)
                        {
                            return;
                        }

                        if (pack.ConsumeTotal(typeof(Gold), toConsume))
                        {
                            if (BeggingPose(from) > 0)
                            {
                                Titles.AwardKarma(from, -BeggingKarma(from), true);
                            }                                                                                                                   // DO ANY KARMA LOSS
                            m_Blacksmith.SayTo(from, "Here is your weapon.");
                            from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                            Effects.PlaySound(from.Location, from.Map, 0x2A);
                            bw.MaxHitPoints -= 1;
                            bw.HitPoints     = bw.MaxHitPoints;
                        }
                        else
                        {
                            m_Blacksmith.SayTo(from, "It would cost you {0} gold to have that repaired.", toConsume);
                            from.SendMessage("You do not have enough gold.");
                        }
                    }
                    else if (targeted is BaseArmor && from.Backpack != null && Server.Misc.MaterialInfo.IsAnyKindOfMetalItem(ITEM))
                    {
                        BaseArmor ba        = targeted as BaseArmor;
                        Container pack      = from.Backpack;
                        int       toConsume = 0;

                        if (ba.HitPoints < ba.MaxHitPoints && Server.Misc.MaterialInfo.IsAnyKindOfMetalItem(((Item)targeted)))
                        {
                            int nCost = 10;

                            if (BeggingPose(from) > 0)                               // LET US SEE IF THEY ARE BEGGING - WIZARD
                            {
                                nCost = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost); if (nCost < 1)
                                {
                                    nCost = 1;
                                }
                                toConsume = (ba.MaxHitPoints - ba.HitPoints - 1) * nCost;
                            }
                            else
                            {
                                toConsume = (ba.MaxHitPoints - ba.HitPoints - 1) * nCost;
                            }
                        }
                        else if (ba.HitPoints >= ba.MaxHitPoints && Server.Misc.MaterialInfo.IsAnyKindOfMetalItem(((Item)targeted)))
                        {
                            m_Blacksmith.SayTo(from, "That does not need to be repaired.");
                        }
                        else
                        {
                            m_Blacksmith.SayTo(from, "I cannot repair that.");
                        }

                        if (toConsume == 0)
                        {
                            return;
                        }

                        if (pack.ConsumeTotal(typeof(Gold), toConsume))
                        {
                            if (BeggingPose(from) > 0)
                            {
                                Titles.AwardKarma(from, -BeggingKarma(from), true);
                            }                                                                                                                   // DO ANY KARMA LOSS
                            m_Blacksmith.SayTo(from, "Here is your armor.");
                            from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                            Effects.PlaySound(from.Location, from.Map, 0x2A);
                            ba.MaxHitPoints -= 1;
                            ba.HitPoints     = ba.MaxHitPoints;
                        }
                        else
                        {
                            m_Blacksmith.SayTo(from, "It would cost you {0} gold to have that repaired.", toConsume);
                            from.SendMessage("You do not have enough gold.");
                        }
                    }
                    else
                    {
                        m_Blacksmith.SayTo(from, "I cannot repair that.");
                    }
                }
                else
                {
                    m_Blacksmith.SayTo(from, "I cannot repair that.");
                }
            }
Ejemplo n.º 5
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                if (targeted is UnidentifiedItem)
                {
                    Container        packs    = from.Backpack;
                    int              nCost    = 200;
                    UnidentifiedItem WhatIsIt = (UnidentifiedItem)targeted;

                    if (BeggingPose(from) > 0)                       // LET US SEE IF THEY ARE BEGGING
                    {
                        nCost = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost); if (nCost < 1)
                        {
                            nCost = 1;
                        }
                    }
                    int toConsume = nCost;

                    if (WhatIsIt.VendorCanID != "Leatherworker")
                    {
                        m_LeatherWorker.SayTo(from, "Sorry, I cannot tell what that is.");
                    }
                    else if (packs.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        string      MyItemName = "item";
                        Container   pack       = (Container)targeted;
                        List <Item> items      = new List <Item>();
                        foreach (Item item in pack.Items)
                        {
                            items.Add(item);
                        }
                        foreach (Item item in items)
                        {
                            MyItemName = item.Name;
                            from.AddToBackpack(item);
                        }
                        if (MyItemName == "")
                        {
                            MyItemName = "item";
                        }
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                        m_LeatherWorker.SayTo(from, "Let me tell you about this item...");
                        WhatIsIt.Delete();
                    }
                    else
                    {
                        m_LeatherWorker.SayTo(from, "It would cost you {0} gold to have that identified.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                else if (targeted is BaseArmor && from.Backpack != null)
                {
                    BaseArmor ba        = targeted as BaseArmor;
                    Container pack      = from.Backpack;
                    int       toConsume = 0;

                    if (ba.HitPoints < ba.MaxHitPoints && Server.Misc.MaterialInfo.IsAnyKindOfClothItem(((Item)targeted)))
                    {
                        int nCost = 10;

                        if (BeggingPose(from) > 0)                           // LET US SEE IF THEY ARE BEGGING
                        {
                            nCost = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost); if (nCost < 1)
                            {
                                nCost = 1;
                            }
                            toConsume = (ba.MaxHitPoints - ba.HitPoints - 1) * nCost;
                        }
                        else
                        {
                            toConsume = (ba.MaxHitPoints - ba.HitPoints - 1) * nCost;
                        }
                    }
                    else if (ba.HitPoints >= ba.MaxHitPoints && Server.Misc.MaterialInfo.IsAnyKindOfClothItem(((Item)targeted)))
                    {
                        m_LeatherWorker.SayTo(from, "That does not need to be repaired.");
                    }
                    else
                    {
                        m_LeatherWorker.SayTo(from, "I cannot repair that.");
                    }

                    if (toConsume == 0)
                    {
                        m_LeatherWorker.SayTo(from, "That is not really that damaged.");
                        return;
                    }

                    if (pack.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        if (BeggingPose(from) > 0)
                        {
                            Titles.AwardKarma(from, -BeggingKarma(from), true);
                        }                                                                                                               // DO ANY KARMA LOSS
                        m_LeatherWorker.SayTo(from, "Here is your armor.");
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                        Effects.PlaySound(from.Location, from.Map, 0x248);
                        ba.MaxHitPoints -= 1;
                        ba.HitPoints     = ba.MaxHitPoints;
                    }
                    else
                    {
                        m_LeatherWorker.SayTo(from, "It would cost you {0} gold to have that repaired.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
                else if (targeted is BearMask && from.Backpack != null)
                {
                    BearMask  ba        = targeted as BearMask;
                    Container pack      = from.Backpack;
                    int       toConsume = 0;

                    if (ba.HitPoints < ba.MaxHitPoints)
                    {
                        toConsume = (ba.MaxHitPoints - ba.HitPoints) * 10;
                    }
                    else if (ba.HitPoints >= ba.MaxHitPoints)
                    {
                        m_LeatherWorker.SayTo(from, "That does not need to be repaired.");
                    }
                    else
                    {
                        m_LeatherWorker.SayTo(from, "I cannot repair that.");
                    }

                    if (toConsume == 0)
                    {
                        m_LeatherWorker.SayTo(from, "That is not really that damaged.");
                        return;
                    }

                    if (pack.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        if (BeggingPose(from) > 0)
                        {
                            Titles.AwardKarma(from, -BeggingKarma(from), true);
                        }                                                                                                               // DO ANY KARMA LOSS
                        m_LeatherWorker.SayTo(from, "Here is your bearskin cap.");
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                        Effects.PlaySound(from.Location, from.Map, 0x248);
                        ba.MaxHitPoints -= 1;
                        ba.HitPoints     = ba.MaxHitPoints;
                    }
                    else
                    {
                        m_LeatherWorker.SayTo(from, "It would cost you {0} gold to have that repaired.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
                else if (targeted is DeerMask && from.Backpack != null)
                {
                    DeerMask  ba        = targeted as DeerMask;
                    Container pack      = from.Backpack;
                    int       toConsume = 0;

                    if (ba.HitPoints < ba.MaxHitPoints)
                    {
                        toConsume = (ba.MaxHitPoints - ba.HitPoints) * 10;
                    }
                    else if (ba.HitPoints >= ba.MaxHitPoints)
                    {
                        m_LeatherWorker.SayTo(from, "That does not need to be repaired.");
                    }
                    else
                    {
                        m_LeatherWorker.SayTo(from, "I cannot repair that.");
                    }

                    if (toConsume == 0)
                    {
                        m_LeatherWorker.SayTo(from, "That is not really that damaged.");
                        return;
                    }

                    if (pack.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        if (BeggingPose(from) > 0)
                        {
                            Titles.AwardKarma(from, -BeggingKarma(from), true);
                        }                                                                                                               // DO ANY KARMA LOSS
                        m_LeatherWorker.SayTo(from, "Here is your deerskin cap.");
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                        Effects.PlaySound(from.Location, from.Map, 0x248);
                        ba.MaxHitPoints -= 1;
                        ba.HitPoints     = ba.MaxHitPoints;
                    }
                    else
                    {
                        m_LeatherWorker.SayTo(from, "It would cost you {0} gold to have that repaired.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
                else if ((targeted is BaseWeapon && from.Backpack != null) && (targeted is LevelPugilistGloves || targeted is LevelThrowingGloves || targeted is GiftPugilistGloves || targeted is GiftThrowingGloves || targeted is ThrowingGloves || targeted is PugilistGlove || targeted is PugilistGloves || targeted is PugilistMits))
                {
                    BaseWeapon ba        = targeted as BaseWeapon;
                    Container  pack      = from.Backpack;
                    int        toConsume = 0;

                    if (ba.HitPoints < ba.MaxHitPoints)
                    {
                        toConsume = (ba.MaxHitPoints - ba.HitPoints) * 10;
                    }
                    else
                    {
                        m_LeatherWorker.SayTo(from, "That does not need to be repaired.");
                    }

                    if (toConsume == 0)
                    {
                        m_LeatherWorker.SayTo(from, "That is not really that damaged.");
                        return;
                    }

                    if (pack.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        if (BeggingPose(from) > 0)
                        {
                            Titles.AwardKarma(from, -BeggingKarma(from), true);
                        }                                                                                                               // DO ANY KARMA LOSS
                        m_LeatherWorker.SayTo(from, "Here are your gloves.");
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                        Effects.PlaySound(from.Location, from.Map, 0x248);
                        ba.MaxHitPoints -= 1;
                        ba.HitPoints     = ba.MaxHitPoints;
                    }
                    else
                    {
                        m_LeatherWorker.SayTo(from, "It would cost you {0} gold to have that repaired.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
            }
Ejemplo n.º 6
0
        public static List <BaseItemType> LoadPotions()
        {
            List <BaseItemType> potions = new List <BaseItemType>();

            string    filePath = Directory.GetCurrentDirectory() + "//Data//Items//Potions//Potions.xml";
            XmlReader reader   = XmlReader.Create(filePath);

            List <IdentifiedItem>   identifiedItems   = new List <IdentifiedItem>();
            List <UnidentifiedItem> unidentifiedItems = new List <UnidentifiedItem>();
            string actionWord     = "strikes";
            string governingSkill = "None";
            string category       = "None";

            while (reader.Read())
            {
                if (reader.Depth == 0 && reader.NodeType == XmlNodeType.Element && !reader.Name.Equals("Items"))
                {
                    break;
                }

                if (reader.Name.Equals("Category") && reader.NodeType == XmlNodeType.Element)
                {
                    category = reader.ReadElementContentAsString();
                }

                if (reader.Name.Equals("IdentifiedItem") && reader.NodeType == XmlNodeType.Element)
                {
                    IdentifiedItem item = new IdentifiedItem();
                    while (reader.NodeType != XmlNodeType.EndElement)
                    {
                        reader.Read();
                        if (reader.Name.Equals("Name"))
                        {
                            item.name = reader.ReadElementContentAsString();
                        }
                        else if (reader.Name.Equals("Description"))
                        {
                            item.description = reader.ReadElementContentAsString();
                        }
                        else if (reader.Name.Equals("Value"))
                        {
                            item.value = reader.ReadElementContentAsInt();
                        }
                        else if (reader.Name.Equals("Effect"))
                        {
                            item.interactionFile = Directory.GetCurrentDirectory() + "//Data//Scripts//Items//Potions//" + reader.ReadElementContentAsString();
                        }
                        else if (reader.Name.Equals("SpawnWeight"))
                        {
                            item.weighting = reader.ReadElementContentAsInt();
                        }
                    }
                    item.category = category;
                    identifiedItems.Add(item);
                }
                else if (reader.Name.Equals("UnidentifiedItem") && reader.NodeType == XmlNodeType.Element)
                {
                    UnidentifiedItem item = new UnidentifiedItem();
                    while (reader.NodeType != XmlNodeType.EndElement)
                    {
                        reader.Read();
                        if (reader.Name.Equals("Name"))
                        {
                            item.name = reader.ReadElementContentAsString();
                        }
                        else if (reader.Name.Equals("Description"))
                        {
                            item.description = reader.ReadElementContentAsString();
                        }
                    }
                    unidentifiedItems.Add(item);
                }
                else if (reader.Name.Equals("ActionWord"))
                {
                    actionWord = reader.ReadElementContentAsString();
                }
            }

            reader.Close();

            ItemMaterial glass = MaterialHandler.GetMaterial("Glass");

            for (int i = 0; i < identifiedItems.Count; i++)
            {
                int index = RNG.Roll(0, unidentifiedItems.Count - 1);
                UnidentifiedItem chosenDescription = unidentifiedItems[index];
                unidentifiedItems.RemoveAt(index);

                potions.Add(new BaseItemType(identifiedItems[i].category, identifiedItems[i].description, chosenDescription.description, chosenDescription.name,
                                             identifiedItems[i].name, "None", 5.0f, glass, "Potions", governingSkill, actionWord,
                                             identifiedItems[i].interactionFile, identifiedItems[i].value, identifiedItems[i].weighting));
            }

            return(potions);
        }
Ejemplo n.º 7
0
        public static List <BaseItemType> LoadItems()
        {
            List <BaseItemType> weapons = new List <BaseItemType>();

            string folderPath = Directory.GetCurrentDirectory() + GlobalConstants.DATA_FOLDER + "Items";

            string[] files = Directory.GetFiles(folderPath, "*.xml", SearchOption.AllDirectories);


            for (int i = 0; i < files.Length; i++)
            {
                XmlReader reader = XmlReader.Create(files[i]);

                List <IdentifiedItem>   identifiedItems   = new List <IdentifiedItem>();
                List <UnidentifiedItem> unidentifiedItems = new List <UnidentifiedItem>();

                string actionWord = "strikes";
                string category   = "Misc";
                int    lightLevel = 0;

                while (reader.Read())
                {
                    if (reader.Depth == 0 && reader.NodeType == XmlNodeType.Element && !reader.Name.Equals("Items"))
                    {
                        break;
                    }

                    if (reader.Name.Equals("Category") && reader.NodeType == XmlNodeType.Element)
                    {
                        category = reader.ReadElementContentAsString();
                    }

                    if (reader.Name.Equals("IdentifiedItem") && reader.NodeType == XmlNodeType.Element)
                    {
                        IdentifiedItem item = new IdentifiedItem();
                        item.slot  = "None";
                        item.skill = "None";
                        while (reader.NodeType != XmlNodeType.EndElement)
                        {
                            reader.Read();
                            if (reader.Name.Equals("Name"))
                            {
                                item.name = reader.ReadElementContentAsString();
                            }
                            else if (reader.Name.Equals("Description"))
                            {
                                item.description = reader.ReadElementContentAsString();
                            }
                            else if (reader.Name.Equals("Value"))
                            {
                                item.value = reader.ReadElementContentAsInt();
                            }
                            else if (reader.Name.Equals("Effect"))
                            {
                                item.interactionFile = reader.ReadElementContentAsString();
                            }
                            else if (reader.Name.Equals("SpawnWeight"))
                            {
                                item.weighting = reader.ReadElementContentAsInt();
                            }
                            else if (reader.Name.Equals("Materials"))
                            {
                                string materials = reader.ReadElementContentAsString();
                                item.materials = materials.Split(',');
                            }
                            else if (reader.Name.Equals("Size"))
                            {
                                item.size = reader.ReadElementContentAsFloat();
                            }
                            else if (reader.Name.Equals("Slot"))
                            {
                                item.slot = reader.ReadElementContentAsString();
                            }
                            else if (reader.Name.Equals("Skill"))
                            {
                                item.skill = reader.ReadElementContentAsString();
                            }
                            else if (reader.Name.Equals("LightLevel"))
                            {
                                lightLevel = reader.ReadElementContentAsInt();
                            }
                        }
                        item.category = category;
                        identifiedItems.Add(item);
                    }
                    else if (reader.Name.Equals("UnidentifiedItem"))
                    {
                        UnidentifiedItem item = new UnidentifiedItem();
                        while (reader.NodeType != XmlNodeType.EndElement)
                        {
                            reader.Read();
                            if (reader.Name.Equals("Name"))
                            {
                                item.name = reader.ReadElementContentAsString();
                            }
                            else if (reader.Name.Equals("Description"))
                            {
                                item.description = reader.ReadElementContentAsString();
                            }
                        }
                        unidentifiedItems.Add(item);
                    }
                    else if (reader.Name.Equals("ActionWord"))
                    {
                        actionWord = reader.ReadElementContentAsString();
                    }
                }

                reader.Close();

                for (int j = 0; j < identifiedItems.Count; j++)
                {
                    UnidentifiedItem chosenDescription = new UnidentifiedItem(identifiedItems[j].name, identifiedItems[j].description);

                    if (unidentifiedItems.Count != 0)
                    {
                        int index = RNG.Roll(0, unidentifiedItems.Count - 1);
                        chosenDescription = unidentifiedItems[index];
                        unidentifiedItems.RemoveAt(index);
                    }

                    for (int k = 0; k < identifiedItems[j].materials.Length; k++)
                    {
                        weapons.Add(new BaseItemType(identifiedItems[j].category, identifiedItems[j].description, chosenDescription.description, chosenDescription.name,
                                                     identifiedItems[j].name, identifiedItems[j].slot, identifiedItems[j].size,
                                                     MaterialHandler.GetMaterial(identifiedItems[j].materials[k]),
                                                     identifiedItems[j].category, identifiedItems[j].skill, actionWord, identifiedItems[j].interactionFile,
                                                     identifiedItems[j].value, identifiedItems[j].weighting, lightLevel));
                    }
                }
            }

            return(weapons);
        }
Ejemplo n.º 8
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item examine = (Item)targeted;

                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    if (targeted is UnidentifiedItem)
                    {
                        UnidentifiedItem relic = (UnidentifiedItem)targeted;

                        if (relic.IDAttempt > 5)
                        {
                            from.SendMessage("Only a vendor can identify this item now as too many attempts were made.");
                        }
                        else if (relic.SkillRequired != "ArmsLore")
                        {
                            from.SendMessage("You are using the wrong skill to figure this out.");
                        }
                        else if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, -5, 120))
                        {
                            Container   pack  = (Container)relic;
                            List <Item> items = new List <Item>();
                            foreach (Item item in pack.Items)
                            {
                                items.Add(item);
                            }
                            foreach (Item item in items)
                            {
                                from.AddToBackpack(item);
                            }

                            from.SendMessage("You successfully identify the item.");
                            relic.Delete();
                        }
                        else
                        {
                            relic.IDAttempt = relic.IDAttempt + 1;
                            from.SendMessage("You can't seem to identify this item.");
                        }
                    }
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    else if (Server.Misc.RelicItems.IsRelicItem(examine) == true)
                    {
                        from.SendMessage(Server.Misc.RelicItems.IdentifyRelicValue(from, from, examine));
                    }
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    else if (targeted is BaseWeapon)
                    {
                        if (((BaseWeapon)targeted).Identified == true)
                        {
                            BaseWeapon weap = (BaseWeapon)targeted;

                            if (weap.MaxHitPoints != 0)
                            {
                                int hp = (int)((weap.HitPoints / (double)weap.MaxHitPoints) * 10);

                                if (hp < 0)
                                {
                                    hp = 0;
                                }
                                else if (hp > 9)
                                {
                                    hp = 9;
                                }

                                from.SendLocalizedMessage(1038285 + hp);
                            }

                            int damage = (weap.MaxDamage + weap.MinDamage) / 2;
                            int hand   = (weap.Layer == Layer.OneHanded ? 0 : 1);

                            if (damage < 3)
                            {
                                damage = 0;
                            }
                            else
                            {
                                damage = (int)Math.Ceiling(Math.Min(damage, 30) / 5.0);
                            }

                            WeaponType type = weap.Type;

                            if (type == WeaponType.Ranged)
                            {
                                from.SendLocalizedMessage(1038224 + (damage * 9));
                            }
                            else if (type == WeaponType.Piercing)
                            {
                                from.SendLocalizedMessage(1038218 + hand + (damage * 9));
                            }
                            else if (type == WeaponType.Slashing)
                            {
                                from.SendLocalizedMessage(1038220 + hand + (damage * 9));
                            }
                            else if (type == WeaponType.Bashing)
                            {
                                from.SendLocalizedMessage(1038222 + hand + (damage * 9));
                            }
                            else
                            {
                                from.SendLocalizedMessage(1038216 + hand + (damage * 9));
                            }

                            if (weap.Poison != null && weap.PoisonCharges > 0)
                            {
                                from.SendLocalizedMessage(1038284);                                   // It appears to have poison smeared on it.
                            }
                        }
                        else if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100))
                        {
                            ((BaseWeapon)targeted).Identified = true;
                            BaseWeapon weap = (BaseWeapon)targeted;

                            if (weap.MaxHitPoints != 0)
                            {
                                int hp = (int)((weap.HitPoints / (double)weap.MaxHitPoints) * 10);

                                if (hp < 0)
                                {
                                    hp = 0;
                                }
                                else if (hp > 9)
                                {
                                    hp = 9;
                                }

                                from.SendLocalizedMessage(1038285 + hp);
                            }

                            int damage = (weap.MaxDamage + weap.MinDamage) / 2;
                            int hand   = (weap.Layer == Layer.OneHanded ? 0 : 1);

                            if (damage < 3)
                            {
                                damage = 0;
                            }
                            else
                            {
                                damage = (int)Math.Ceiling(Math.Min(damage, 30) / 5.0);
                            }

                            WeaponType type = weap.Type;

                            if (type == WeaponType.Ranged)
                            {
                                from.SendLocalizedMessage(1038224 + (damage * 9));
                            }
                            else if (type == WeaponType.Piercing)
                            {
                                from.SendLocalizedMessage(1038218 + hand + (damage * 9));
                            }
                            else if (type == WeaponType.Slashing)
                            {
                                from.SendLocalizedMessage(1038220 + hand + (damage * 9));
                            }
                            else if (type == WeaponType.Bashing)
                            {
                                from.SendLocalizedMessage(1038222 + hand + (damage * 9));
                            }
                            else
                            {
                                from.SendLocalizedMessage(1038216 + hand + (damage * 9));
                            }

                            if (weap.Poison != null && weap.PoisonCharges > 0)
                            {
                                from.SendLocalizedMessage(1038284);                                   // It appears to have poison smeared on it.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(500353);                               // You are not certain...
                        }
                    }
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    else if (targeted is BaseArmor)
                    {
                        if (((BaseArmor)targeted).Identified == true)
                        {
                            BaseArmor arm = (BaseArmor)targeted;

                            if (arm.MaxHitPoints != 0)
                            {
                                int hp = (int)((arm.HitPoints / (double)arm.MaxHitPoints) * 10);

                                if (hp < 0)
                                {
                                    hp = 0;
                                }
                                else if (hp > 9)
                                {
                                    hp = 9;
                                }

                                from.SendLocalizedMessage(1038285 + hp);
                            }
                        }
                        else if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100))
                        {
                            ((BaseArmor)targeted).Identified = true;
                            BaseArmor arm = (BaseArmor)targeted;

                            if (arm.MaxHitPoints != 0)
                            {
                                int hp = (int)((arm.HitPoints / (double)arm.MaxHitPoints) * 10);

                                if (hp < 0)
                                {
                                    hp = 0;
                                }
                                else if (hp > 9)
                                {
                                    hp = 9;
                                }

                                from.SendLocalizedMessage(1038285 + hp);
                            }

                            from.SendLocalizedMessage(1038295 + (int)Math.Ceiling(Math.Min(arm.ArmorRating, 35) / 5.0));

                            /*
                             * if ( arm.ArmorRating < 1 )
                             *      from.SendLocalizedMessage( 1038295 ); // This armor offers no defense against attackers.
                             * else if ( arm.ArmorRating < 6 )
                             *      from.SendLocalizedMessage( 1038296 ); // This armor provides almost no protection.
                             * else if ( arm.ArmorRating < 11 )
                             *      from.SendLocalizedMessage( 1038297 ); // This armor provides very little protection.
                             * else if ( arm.ArmorRating < 16 )
                             *      from.SendLocalizedMessage( 1038298 ); // This armor offers some protection against blows.
                             * else if ( arm.ArmorRating < 21 )
                             *      from.SendLocalizedMessage( 1038299 ); // This armor serves as sturdy protection.
                             * else if ( arm.ArmorRating < 26 )
                             *      from.SendLocalizedMessage( 1038300 ); // This armor is a superior defense against attack.
                             * else if ( arm.ArmorRating < 31 )
                             *      from.SendLocalizedMessage( 1038301 ); // This armor offers excellent protection.
                             * else
                             *      from.SendLocalizedMessage( 1038302 ); // This armor is superbly crafted to provide maximum protection.
                             * */
                        }
                        else
                        {
                            from.SendLocalizedMessage(500353);                               // You are not certain...
                        }
                    }
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
                    {
                        SwampDragon pet = (SwampDragon)targeted;

                        if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100))
                        {
                            int perc = (4 * pet.BardingHP) / pet.BardingMaxHP;

                            if (perc < 0)
                            {
                                perc = 0;
                            }
                            else if (perc > 4)
                            {
                                perc = 4;
                            }

                            pet.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1053021 - perc, from.NetState);
                        }
                        else
                        {
                            from.SendLocalizedMessage(500353);                               // You are not certain...
                        }
                    }
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    else
                    {
                        from.SendLocalizedMessage(500352);                           // This is neither weapon nor armor.
                    }
                }
            }