protected override void OnTarget(Mobile from, object targeted)
        {
            if (targeted is BaseArmor)
            {
                BaseArmor repairing = (BaseArmor)targeted;

                if (!repairing.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1044275);                       // The item must be in your backpack to repair it.
                }
                else if (repairing.MaxHitPoints <= 0 || repairing.HitPoints == repairing.MaxHitPoints)
                {
                    from.SendLocalizedMessage(1044281);                      // That item is in full repair
                }
                else
                {
                    from.SendLocalizedMessage(1044279);                       // You repair the item.
                    repairing.HitPoints = repairing.MaxHitPoints;

                    m_Deed.Delete();
                }
            }
            else if (targeted is Item)
            {
                from.SendLocalizedMessage(1044277);                   // That item cannot be repaired.
            }
            else
            {
                from.SendLocalizedMessage(500426);                   // You can't repair that.
            }
        }
Exemple #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                int number;

                if (targeted is BaseArmor)
                {
                    BaseArmor repairing = (BaseArmor)targeted;
                    if (!repairing.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1044275);                           // The item must be in your backpack to repair it.
                    }
                    else if (repairing.MaxHitPoints <= 0 || repairing.HitPoints == repairing.MaxHitPoints)
                    {
                        from.SendLocalizedMessage(1044281);                          // That item is in full repair
                    }
                    else
                    {
                        from.SendLocalizedMessage(1044279);                           // You repair the item.
                        repairing.MaxHitPoints = repairing.MaxHitPoints - 1;
                        repairing.HitPoints    = repairing.MaxHitPoints;
                        Server.Items.DuctTape.ConsumeCharge(m_Tape, m_From);
                    }
                }
                else if (targeted is BaseWeapon)
                {
                    BaseWeapon repairing2 = (BaseWeapon)targeted;
                    if (!repairing2.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1044275);                           // The item must be in your backpack to repair it.
                    }
                    else if (repairing2.MaxHitPoints <= 0 || repairing2.HitPoints == repairing2.MaxHitPoints)
                    {
                        from.SendLocalizedMessage(1044281);                          // That item is in full repair
                    }
                    else
                    {
                        from.SendLocalizedMessage(1044279);                           // You repair the item.
                        repairing2.MaxHitPoints = repairing2.MaxHitPoints - 1;
                        repairing2.HitPoints    = repairing2.MaxHitPoints;
                        Server.Items.DuctTape.ConsumeCharge(m_Tape, m_From);
                    }
                }
                else if (targeted is Item)
                {
                    from.SendLocalizedMessage(1044277);                       // That item cannot be repaired.
                }
                else
                {
                    from.SendLocalizedMessage(500426);                       // You can't repair that.
                }
            }
Exemple #3
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                int number;

                if (targeted is BaseArmor)
                {
                    BaseArmor repairing = (BaseArmor)targeted;
                    if (!repairing.IsChildOf(from.Backpack))
                    {
                        from.SendMessage("The item must be in your backpack to use that potion on it!");
                    }
                    else if (repairing.MaxHitPoints >= 50)
                    {
                        from.SendMessage("This item is already too durable to be affected!");
                    }
                    else
                    {
                        from.SendMessage("You add to the durability of the item!");
                        repairing.MaxHitPoints += 10;
                        Server.Items.DurabilityPotion.ConsumeCharge(m_Potion, m_From);
                    }
                }
                else if (targeted is BaseWeapon)
                {
                    BaseWeapon repairing2 = (BaseWeapon)targeted;
                    if (!repairing2.IsChildOf(from.Backpack))
                    {
                        from.SendMessage("The item must be in your backpack to use that potion on it!");
                    }
                    else if (repairing2.MaxHitPoints >= 50)
                    {
                        from.SendMessage("This item is already too durable to be affected!");
                    }
                    else
                    {
                        from.SendMessage("You add to the durability of the item!");
                        repairing2.MaxHitPoints += 10;
                        Server.Items.DurabilityPotion.ConsumeCharge(m_Potion, m_From);
                    }
                }
                else if (targeted is Item)
                {
                    from.SendMessage("This item cannot be altered!");
                }
                else
                {
                    from.SendMessage("You cannot do that!");
                }
            }
Exemple #4
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseArmor)
                {
                    BaseArmor     armor     = targeted as BaseArmor;
                    int           toWeaken  = 0;
                    int           number    = 0;
                    CraftResource armortype = armor.Resource;

                    if (m_repair.SkillLevel >= 90.0)
                    {
                        toWeaken = 1;
                    }
                    else if (m_repair.SkillLevel >= 70.0)
                    {
                        toWeaken = 2;
                    }
                    else
                    {
                        toWeaken = 3;
                    }

                    if (armortype >= CraftResource.Iron && armortype <= CraftResource.Valorite)
                    {
                        number = 1044277;                 // That item cannot be repaired.
                    }
                    else if (armortype >= CraftResource.RedScales && armortype <= CraftResource.BlueScales)
                    {
                        number = 1044277;                 // That item cannot be repaired.
                    }
                    else if (!armor.IsChildOf(from.Backpack))
                    {
                        number = 1044275;                 // The item must be in your backpack to repair it.
                    }
                    else if (armor.MaxHitPoints <= 0 || armor.HitPoints == armor.MaxHitPoints)
                    {
                        number = 1044281;                 // That item is in full repair
                    }
                    else if (armor.MaxHitPoints <= toWeaken)
                    {
                        number = 500424;                 // You destroyed the item.
                        armor.Delete();
                    }
                    else
                    {
                        number              = 1044279;    // You repair the item.
                        armor.MaxHitPoints -= toWeaken;
                        armor.HitPoints     = armor.MaxHitPoints;
                        if (m_repair.Uses > 1)
                        {
                            m_repair.Uses -= 1;
                        }
                        else
                        {
                            m_repair.Delete();
                        }
                    }

                    from.SendLocalizedMessage(number);

                    if (armor.MaxHitPoints <= toWeaken)
                    {
                        from.SendLocalizedMessage(1044278);           // That item has been repaired many times, and will break if repairs are attempted again.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1044277);     // That item cannot be repaired.
                }
            }
Exemple #5
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Powder.Deleted || m_Powder.UsesRemaining <= 0)
                {
                    from.SendLocalizedMessage(1049086);                       // You have used up your powder of temperament.
                    return;
                }

                if (targeted is BaseArmor /*&& (DefBlacksmithy.CraftSystem.CraftItems.SearchForSubclass( targeted.GetType() ) != null)*/)
                {
                    BaseArmor ar = (BaseArmor)targeted;

                    if (ar.IsChildOf(from.Backpack) && m_Powder.IsChildOf(from.Backpack))
                    {
                        int origMaxHP = ar.MaxHitPoints;
                        int origCurHP = ar.HitPoints;

                        ar.UnscaleDurability();

                        if (ar.MaxHitPoints < ar.InitMaxHits)
                        {
                            int bonus = ar.InitMaxHits - ar.MaxHitPoints;

                            if (bonus > 10)
                            {
                                bonus = 10;
                            }

                            ar.MaxHitPoints += bonus;
                            ar.HitPoints    += bonus;

                            ar.ScaleDurability();

                            if (ar.MaxHitPoints > origMaxHP)
                            {
                                from.SendLocalizedMessage(1049084);                                   // You successfully use the powder on the item.

                                --m_Powder.UsesRemaining;

                                if (m_Powder.UsesRemaining <= 0)
                                {
                                    from.SendLocalizedMessage(1049086);                                       // You have used up your powder of temperament.
                                    m_Powder.Delete();
                                }
                            }
                            else
                            {
                                ar.MaxHitPoints = origMaxHP;
                                ar.HitPoints    = origCurHP;
                                from.SendLocalizedMessage(1049085);                                   // The item cannot be improved any further.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1049085);                               // The item cannot be improved any further.
                            ar.ScaleDurability();
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1042001);                           // That must be in your pack for you to use it.
                    }
                }
                else if (targeted is BaseWeapon /*&& (DefBlacksmithy.CraftSystem.CraftItems.SearchForSubclass( targeted.GetType() ) != null)*/)
                {
                    BaseWeapon wep = (BaseWeapon)targeted;

                    if (wep.IsChildOf(from.Backpack) && m_Powder.IsChildOf(from.Backpack))
                    {
                        int origMaxHP = wep.MaxHitPoints;
                        int origCurHP = wep.HitPoints;

                        wep.UnscaleDurability();

                        if (wep.MaxHitPoints < wep.InitMaxHits)
                        {
                            int bonus = wep.InitMaxHits - wep.MaxHitPoints;

                            if (bonus > 10)
                            {
                                bonus = 10;
                            }

                            wep.MaxHitPoints += bonus;
                            wep.HitPoints    += bonus;

                            wep.ScaleDurability();

                            if (wep.MaxHitPoints > origMaxHP)
                            {
                                from.SendLocalizedMessage(1049084);                                   // You successfully use the powder on the item.

                                --m_Powder.UsesRemaining;

                                if (m_Powder.UsesRemaining <= 0)
                                {
                                    from.SendLocalizedMessage(1049086);                                       // You have used up your powder of temperament.
                                    m_Powder.Delete();
                                }
                            }
                            else
                            {
                                wep.MaxHitPoints = origMaxHP;
                                wep.HitPoints    = origCurHP;
                                from.SendLocalizedMessage(1049085);                                   // The item cannot be improved any further.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1049085);                               // The item cannot be improved any further.
                            wep.ScaleDurability();
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1042001);                           // That must be in your pack for you to use it.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049083);                       // You cannot use the powder on that item.
                }
            }
Exemple #6
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            bool hasForge, hasAnvil;

            DefBlacksmithy.CheckAnvilAndForge(from, 4, out hasAnvil, out hasForge);

            if (targeted is BaseIngot && m_Tool is BaseTool)
            {
                if (hasAnvil && hasForge)
                {
                    BaseTool    tool   = (BaseTool)m_Tool;
                    BaseIngot   ingot  = (BaseIngot)targeted;
                    CraftSubRes subRes = CustomCraftMenu.GetSubRes(DefBlacksmithy.CraftSystem, targeted.GetType(), null);
                    int         num    = CraftResources.GetIndex(ingot.Resource);

                    if (subRes == null || !CustomCraftMenu.ResourceInfoList.ContainsKey(subRes))
                    {
                        from.SendAsciiMessage("You can't use that.");
                        return;
                    }

                    if (from.Skills[DefBlacksmithy.CraftSystem.MainSkill].Base < subRes.RequiredSkill)
                    {
                        from.SendAsciiMessage("You cannot work this strange and unusual metal.");
                        return;
                    }

                    from.SendGump(new CraftGump(from, m_CraftSystem, tool, null, num));
                    //from.SendMenu( new CustomCraftMenu( from, DefBlacksmithy.CraftSystem, ( (BaseTool)m_Tool ), -1, targeted.GetType(), CustomCraftMenu.ResourceInfoList[subRes].ResourceIndex ) );
                }
                else
                {
                    from.SendAsciiMessage("You need to be close to a forge and anvil to smith.");
                }
            }
            else if (targeted is BaseIngot && !(m_Tool is BaseTool))
            {
                from.SendAsciiMessage("You need to use a smith's hammer on that.");
            }
            else
            {
                if (!hasAnvil)
                {
                    from.SendAsciiMessage("You need to be close to an anvil to repair.");
                    return;
                }

                int number;

                if (targeted is BaseWeapon)
                {
                    BaseWeapon weapon   = (BaseWeapon)targeted;
                    SkillName  skill    = m_CraftSystem.MainSkill;
                    int        toWeaken = 0;

                    if (Core.AOS)
                    {
                        toWeaken = 1;
                    }
                    else if (skill != SkillName.Tailoring)
                    {
                        double skillLevel = from.Skills[skill].Base;

                        if (skillLevel >= 90.0)
                        {
                            toWeaken = 1;
                        }
                        else if (skillLevel >= 70.0)
                        {
                            toWeaken = 2;
                        }
                        else
                        {
                            toWeaken = 3;
                        }
                    }

                    if (m_CraftSystem.CraftItems.SearchForSubclass(weapon.GetType()) == null && !IsSpecialWeapon(weapon))
                    {
                        number = 1044277;                         // That item cannot be repaired. // You cannot repair that item with this type of repair contract.
                    }
                    else if (!weapon.IsChildOf(from.Backpack))
                    {
                        number = 1044275;                         // The item must be in your backpack to repair it.
                    }
                    else if (weapon.MaxHitPoints <= 0 || weapon.HitPoints == weapon.MaxHitPoints)
                    {
                        number = 1044281;                         // That item is in full repair
                    }
                    else if (weapon.MaxHitPoints <= toWeaken)
                    {
                        number = 1044278;                         // That item has been repaired many times, and will break if repairs are attempted again.
                    }
                    else
                    {
                        if (CheckWeaken(from, skill, weapon.HitPoints, weapon.MaxHitPoints))
                        {
                            weapon.MaxHitPoints -= toWeaken;
                            weapon.HitPoints     = Math.Max(0, weapon.HitPoints - toWeaken);
                        }

                        if (CheckRepairDifficulty(from, skill, weapon.HitPoints, weapon.MaxHitPoints))
                        {
                            number = 1044279;                             // You repair the item.
                            m_CraftSystem.PlayCraftEffect(from);
                            weapon.HitPoints = weapon.MaxHitPoints;
                        }
                        else
                        {
                            number = 1044280;                             // You fail to repair the item. [And the contract is destroyed]
                            m_CraftSystem.PlayCraftEffect(from);
                        }
                    }
                }
                else if (targeted is BaseArmor)
                {
                    BaseArmor armor    = (BaseArmor)targeted;
                    SkillName skill    = m_CraftSystem.MainSkill;
                    int       toWeaken = 0;

                    if (Core.AOS)
                    {
                        toWeaken = 1;
                    }
                    else if (skill != SkillName.Tailoring)
                    {
                        double skillLevel = from.Skills[skill].Base;

                        if (skillLevel >= 90.0)
                        {
                            toWeaken = 1;
                        }
                        else if (skillLevel >= 70.0)
                        {
                            toWeaken = 2;
                        }
                        else
                        {
                            toWeaken = 3;
                        }
                    }

                    if (m_CraftSystem.CraftItems.SearchForSubclass(armor.GetType()) == null)
                    {
                        number = 1044277;
                    }
                    // That item cannot be repaired. // You cannot repair that item with this type of repair contract.
                    else if (!armor.IsChildOf(from.Backpack))
                    {
                        number = 1044275;                         // The item must be in your backpack to repair it.
                    }
                    else if (armor.MaxHitPoints <= 0 || armor.HitPoints == armor.MaxHitPoints)
                    {
                        number = 1044281;                         // That item is in full repair
                    }
                    else if (armor.MaxHitPoints <= toWeaken)
                    {
                        number = 1044278;
                    }
                    // That item has been repaired many times, and will break if repairs are attempted again.
                    else
                    {
                        if (CheckWeaken(from, skill, armor.HitPoints, armor.MaxHitPoints))
                        {
                            armor.MaxHitPoints -= toWeaken;
                            armor.HitPoints     = Math.Max(0, armor.HitPoints - toWeaken);
                        }

                        if (CheckRepairDifficulty(from, skill, armor.HitPoints, armor.MaxHitPoints))
                        {
                            number = 1044279;                             // You repair the item.
                            m_CraftSystem.PlayCraftEffect(from);
                            armor.HitPoints = armor.MaxHitPoints;
                        }
                        else
                        {
                            number = 1044280;
                            // You fail to repair the item. [And the contract is destroyed]
                            m_CraftSystem.PlayCraftEffect(from);
                        }
                    }
                }
                else if (targeted is Item)
                {
                    number = 1044277;                     // That item cannot be repaired. // You cannot repair that item with this type of repair contract.
                }
                else
                {
                    number = 500426;                     // You can't repair that.
                }
                from.SendAsciiMessage(CliLoc.LocToString(number));
            }
        }
 protected override void OnTarget(Mobile from, object targ)
 {
     if (targ is BaseArmor)
     {
         BaseArmor item = (BaseArmor)targ;
         if (item.IsChildOf(from.Backpack))
         {
             if (!item.Identified)
             {
                 ball.PublicOverheadMessage(MessageType.Regular, 0x0, false, ("Your armor has been identified"));
                 item.Identified      = true;
                 ball.LastActiveCheck = DateTime.Now;
                 if (ball.Charges > 0)
                 {
                     ball.Charges -= 1;
                 }
             }
             else
             {
                 ball.PublicOverheadMessage(MessageType.Regular, 0x0, false, ("That has already been identified."));
             }
         }
         else
         {
             ball.PublicOverheadMessage(MessageType.Regular, 0x0, false, ("That must be in your pack to identify"));
         }
     }
     else if (targ is BaseJewel)
     {
         BaseJewel item = (BaseJewel)targ;
         if (item.IsChildOf(from.Backpack))
         {
             if (!item.Identified)
             {
                 ball.PublicOverheadMessage(MessageType.Regular, 0x0, false, ("Your jewelry has been identified"));
                 item.Identified      = true;
                 ball.LastActiveCheck = DateTime.Now;
                 if (ball.Charges > 0)
                 {
                     ball.Charges -= 1;
                 }
             }
             else
             {
                 ball.PublicOverheadMessage(MessageType.Regular, 0x0, false, ("That has already been identified."));
             }
         }
         else
         {
             ball.PublicOverheadMessage(MessageType.Regular, 0x0, false, ("That must be in your pack to identify"));
         }
     }
     else if (targ is BaseWeapon)
     {
         BaseWeapon item = (BaseWeapon)targ;
         if (item.IsChildOf(from.Backpack))
         {
             if (!item.Identified)
             {
                 ball.PublicOverheadMessage(MessageType.Regular, 0x0, false, ("Your weapon has been identified"));
                 item.Identified      = true;
                 ball.LastActiveCheck = DateTime.Now;
                 if (ball.Charges > 0)
                 {
                     ball.Charges -= 1;
                 }
             }
             else
             {
                 ball.PublicOverheadMessage(MessageType.Regular, 0x0, false, ("That has already been identified."));
             }
         }
         else
         {
             ball.PublicOverheadMessage(MessageType.Regular, 0x0, false, ("That must be in your pack to identify"));
         }
     }
     else if (targ is BaseClothing)
     {
         BaseClothing item = (BaseClothing)targ;
         if (item.IsChildOf(from.Backpack))
         {
             if (!item.Identified)
             {
                 ball.PublicOverheadMessage(MessageType.Regular, 0x0, false, ("Your clothing has been identified"));
                 item.Identified      = true;
                 ball.LastActiveCheck = DateTime.Now;
                 if (ball.Charges > 0)
                 {
                     ball.Charges -= 1;
                 }
             }
             else
             {
                 ball.PublicOverheadMessage(MessageType.Regular, 0x0, false, ("That has already been identified."));
             }
         }
         else
         {
             ball.PublicOverheadMessage(MessageType.Regular, 0x0, false, ("That must be in your pack to identify"));
         }
     }
     else
     {
         ball.PublicOverheadMessage(MessageType.Regular, 0x0, false, ("I can't identify that!"));
     }
 }