Пример #1
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.");
                }
            }
Пример #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseWeapon)
                {
                    BaseWeapon bw        = targeted as BaseWeapon;
                    Container  pack      = from.Backpack;
                    int        toConsume = 0;
                    toConsume = (bw.MaxHitPoints - bw.HitPoints) * 3;         //Adjuct price here by changing 3 to whatever you want.

                    if (toConsume == 0)
                    {
                        m_Blacksmith.SayTo(from, "That weapon is not damaged.");
                    }
                    else if ((bw.HitPoints < bw.MaxHitPoints) && (pack.ConsumeTotal(typeof(Gold), toConsume)))
                    {
                        Item a = from.Backpack.FindItemByType(typeof(Gold));
                        if (a != null)
                        {
                            a.Consume(toConsume);
                        }

                        bw.HitPoints = bw.MaxHitPoints;
                        m_Blacksmith.SayTo(from, "Here is your weapon.");
                        from.SendMessage(String.Format("You pay {0}gp.", toConsume));
                        Effects.PlaySound(from.Location, from.Map, 0x2A);
                    }
                    else
                    {
                        m_Blacksmith.SayTo(from, "It will cost you {0}gp to have your weapon repaired.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }

                if (targeted is BaseArmor)
                {
                    BaseArmor ba        = targeted as BaseArmor;
                    Container pack      = from.Backpack;
                    int       toConsume = 0;
                    toConsume = (ba.MaxHitPoints - ba.HitPoints) * 3;         //Adjuct price here by changing 3 to whatever you want.

                    if ((toConsume == 0) && (ba.Resource == CraftResource.Iron || ba.Resource == CraftResource.DullCopper || ba.Resource == CraftResource.ShadowIron || ba.Resource == CraftResource.Copper || ba.Resource == CraftResource.Bronze || ba.Resource == CraftResource.Gold || ba.Resource == CraftResource.Agapite || ba.Resource == CraftResource.Verite || ba.Resource == CraftResource.Valorite))
                    {
                        m_Blacksmith.SayTo(from, "That armor is not damaged.");
                    }
                    else if (ba.Resource == CraftResource.RegularLeather || ba.Resource == CraftResource.SpinedLeather || ba.Resource == CraftResource.HornedLeather || ba.Resource == CraftResource.BarbedLeather)
                    {
                        m_Blacksmith.SayTo(from, "I cannot repair that.");
                    }
                    else if ((ba.HitPoints < ba.MaxHitPoints) && (pack.ConsumeTotal(typeof(Gold), toConsume) && (ba.Resource == CraftResource.Iron || ba.Resource == CraftResource.DullCopper || ba.Resource == CraftResource.ShadowIron || ba.Resource == CraftResource.Copper || ba.Resource == CraftResource.Bronze || ba.Resource == CraftResource.Gold || ba.Resource == CraftResource.Agapite || ba.Resource == CraftResource.Verite || ba.Resource == CraftResource.Valorite)))
                    {
                        Item a = from.Backpack.FindItemByType(typeof(Gold));
                        if (a != null)
                        {
                            a.Consume(toConsume);
                        }

                        ba.HitPoints = ba.MaxHitPoints;
                        m_Blacksmith.SayTo(from, "Here is your armor.");
                        from.SendMessage(String.Format("You pay {0}gp.", toConsume));
                        Effects.PlaySound(from.Location, from.Map, 0x2A);
                    }
                    else
                    {
                        m_Blacksmith.SayTo(from, "It will cost you {0}gp to have your armor repaired.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
            }