Example #1
0
            public InternalSellInfo()
            {
                Add(typeof(RecallRune), RecallRune.GetSBSellValue());
                Add(typeof(BlankScroll), BlankScroll.GetSBSellValue());
                Add(typeof(Spellbook), Spellbook.GetSBSellValue());
                Add(typeof(ScribesPen), ScribesPen.GetSBSellValue());

                Add(typeof(BrownBook), BrownBook.GetSBSellValue());
                Add(typeof(TanBook), TanBook.GetSBSellValue());
                Add(typeof(BlueBook), BlueBook.GetSBSellValue());
                Add(typeof(RedBook), RedBook.GetSBSellValue());
            }
Example #2
0
            public InternalSellInfo()
            {
                //TEST: FIX THIS !!!!!

                //TEST: DETERMINE SPELL SCROLL PRICES

                /*
                 * Type[] types = Loot.RegularScrollTypes;
                 *
                 * for (int i = 0; i < types.Length; ++i)
                 * {
                 *  Type type = types[i];
                 *
                 *  var ci = Server.Engines.Craft.DefInscription.CraftSystem.CraftItems.SearchFor(type);
                 *
                 *  if (ci == null)
                 *      continue;
                 *
                 *  var res = ci.Resources;
                 *
                 *  int cost = 0;
                 *
                 *  foreach (CraftRes c in ci.Resources)
                 *      cost += CostOfResource(c.ItemType);
                 *
                 *  int level = ((i + 1) / 8) / 2;
                 *
                 *  cost += LevelBonusFor(level);
                 *
                 *  cost *= 3;
                 *
                 *  int count = res.Count;
                 *
                 *  //TEST: DETERMINE SCROLL SELL PRICES
                 *  Add(type, Math.Min(6 + ((i / 8) * 5), cost));
                 * }
                 */

                Add(typeof(BlackPearl), BlackPearl.GetSBSellValue());
                Add(typeof(Bloodmoss), Bloodmoss.GetSBSellValue());
                Add(typeof(MandrakeRoot), MandrakeRoot.GetSBSellValue());
                Add(typeof(Garlic), Garlic.GetSBSellValue());
                Add(typeof(Ginseng), Ginseng.GetSBSellValue());
                Add(typeof(Nightshade), Nightshade.GetSBSellValue());
                Add(typeof(SpidersSilk), SpidersSilk.GetSBSellValue());
                Add(typeof(SulfurousAsh), SulfurousAsh.GetSBSellValue());

                Add(typeof(RecallRune), RecallRune.GetSBSellValue());
                Add(typeof(BlankScroll), BlankScroll.GetSBSellValue());
                Add(typeof(Spellbook), Spellbook.GetSBSellValue());
                Add(typeof(ScribesPen), ScribesPen.GetSBSellValue());
                Add(typeof(MagicWizardsHat), MagicWizardsHat.GetSBSellValue());
            }
Example #3
0
            public InternalBuyInfo()
            {
                Add(new GenericBuyInfo("Recall Rune", typeof(RecallRune), RecallRune.GetSBPurchaseValue(), 50, 0x1f14, 0));
                Add(new GenericBuyInfo("Spellbook", typeof(Spellbook), Spellbook.GetSBPurchaseValue(), 25, 0xEFA, 0));
                Add(new GenericBuyInfo("Blank Scroll", typeof(BlankScroll), BlankScroll.GetSBPurchaseValue(), 500, 0x0E34, 0));
                Add(new GenericBuyInfo("Scribe's Pen", typeof(ScribesPen), ScribesPen.GetSBPurchaseValue(), 50, 0xFBF, 0));

                Add(new GenericBuyInfo("Book", typeof(RedBook), RedBook.GetSBPurchaseValue(), 50, 0xFF1, 0));
                Add(new GenericBuyInfo("Book", typeof(BrownBook), BrownBook.GetSBPurchaseValue(), 50, 0xFEF, 0));
                Add(new GenericBuyInfo("Book", typeof(TanBook), TanBook.GetSBPurchaseValue(), 50, 0xFF0, 0));
                Add(new GenericBuyInfo("Book", typeof(BlueBook), BlueBook.GetSBPurchaseValue(), 50, 0xFF2, 0));

                //TEST: DETERMINE SCROLLS

                //Add( new GenericBuyInfo( typeof( BladeSpiritsScroll ), 350, 5, 0x1F4D, 0 ) );
                Add(new GenericBuyInfo(typeof(IncognitoScroll), 450, 5, 0x1F4F, 0));
                Add(new GenericBuyInfo(typeof(MagicReflectScroll), 500, 5, 0x1F50, 0));
                Add(new GenericBuyInfo(typeof(MindBlastScroll), 350, 5, 0x1F51, 0));
                Add(new GenericBuyInfo(typeof(ParalyzeScroll), 550, 5, 0x1F52, 0));
                Add(new GenericBuyInfo(typeof(PoisonFieldScroll), 450, 5, 0x1F53, 0));
                Add(new GenericBuyInfo(typeof(SummonCreatureScroll), 450, 5, 0x1F54, 0));
                Add(new GenericBuyInfo(typeof(DispelScroll), 800, 4, 0x1F55, 0));
                Add(new GenericBuyInfo(typeof(EnergyBoltScroll), 900, 4, 0x1F56, 0));
                Add(new GenericBuyInfo(typeof(ExplosionScroll), 1050, 4, 0x1F57, 0));
                Add(new GenericBuyInfo(typeof(InvisibilityScroll), 900, 4, 0x1F58, 0));
                Add(new GenericBuyInfo(typeof(MarkScroll), 600, 4, 0x1F59, 0));
                Add(new GenericBuyInfo(typeof(MassCurseScroll), 700, 4, 0x1F5A, 0));
                Add(new GenericBuyInfo(typeof(ParalyzeFieldScroll), 700, 4, 0x1F5B, 0));
                Add(new GenericBuyInfo(typeof(RevealScroll), 800, 4, 0x1F5C, 0));
                //Add( new GenericBuyInfo( typeof( ChainLightningScroll ), 1500, 3, 0x1F5D, 0 ) );
                //Add( new GenericBuyInfo( typeof( EnergyFieldScroll ),1500, 3, 0x1F5E, 0 ) );
                //Add( new GenericBuyInfo( typeof( FlamestrikeScroll ), 1750, 3, 0x1F5F, 0 ) );
                //Add( new GenericBuyInfo( typeof( GateTravelScroll ), 1950, 3, 0x1F60, 0 ) );
                //Add( new GenericBuyInfo( typeof( ManaVampireScroll ), 1550, 3, 0x1F61, 0 ) );
                //Add( new GenericBuyInfo( typeof( MassDispelScroll ), 1500, 3, 0x1F62, 0 ) );
                //Add( new GenericBuyInfo( typeof( MeteorSwarmScroll ), 1050, 3, 0x1F63, 0 ) );
                //Add( new GenericBuyInfo( typeof( PolymorphScroll ), 1000, 3, 0x1F64, 0 ) );
                //Add( new GenericBuyInfo( typeof( EarthquakeScroll ), 5500, 2, 0x1F65, 0 ) );
                //Add( new GenericBuyInfo( typeof( EnergyVortexScroll ), 2500, 2, 0x1F66, 0 ) );
                //Add( new GenericBuyInfo( typeof( ResurrectionScroll ), 6575, 2, 0x1F67, 0 ) );
                //Add( new GenericBuyInfo( typeof( SummonAirElementalScroll ), 2000, 2, 0x1F68, 0 ) );
                //Add( new GenericBuyInfo( typeof( SummonDaemonScroll ), 2500, 2, 0x1F69, 0 ) );
                //Add( new GenericBuyInfo( typeof( SummonEarthElementalScroll ), 2000, 2, 0x1F6A, 0 ) );
                //Add( new GenericBuyInfo( typeof( SummonFireElementalScroll ), 2000, 2, 0x1F6B, 0 ) );
                //Add( new GenericBuyInfo( typeof( SummonWaterElementalScroll ), 2000, 2, 0x1F6C, 0 ) );
                //Add( new GenericBuyInfo( typeof( DispelFieldScroll ), 500, 5, 0x1F4E, 0 ) );
            }
Example #4
0
            public InternalBuyInfo()
            {
                //TEST: FIX THIS!!!!


                /*
                 *              Type[] types = Loot.RegularScrollTypes;
                 *
                 *              //for ( int i = 0; i < types.Length; ++i )
                 *              for ( int i = 0; i < 32; ++i )
                 *
                 *              {
                 *                      int itemID = 0x1F2E + i;
                 *
                 *                      if ( i == 6 )
                 *                              itemID = 0x1F2D;
                 *
                 *                      else if ( i > 6 )
                 *                              --itemID;
                 *
                 *  //TEST: DETERMINE SCROLL PRICES
                 *                      Add( new GenericBuyInfo( types[i], 12 + ((i / 3) * 10), 20, itemID, 0 ) );
                 *              }
                 */

                Add(new GenericBuyInfo("Black Pearl", typeof(BlackPearl), BlackPearl.GetSBPurchaseValue(), 500, 0xF7A, 0));
                Add(new GenericBuyInfo("Bloodmoss", typeof(Bloodmoss), Bloodmoss.GetSBPurchaseValue(), 500, 0xF7B, 0));
                Add(new GenericBuyInfo("Mandrake Root", typeof(MandrakeRoot), MandrakeRoot.GetSBPurchaseValue(), 500, 0xF86, 0));
                Add(new GenericBuyInfo("Garlic", typeof(Garlic), Garlic.GetSBPurchaseValue(), 500, 0xF84, 0));
                Add(new GenericBuyInfo("Ginseng", typeof(Ginseng), Ginseng.GetSBPurchaseValue(), 500, 0xF85, 0));
                Add(new GenericBuyInfo("Nightshade", typeof(Nightshade), Nightshade.GetSBPurchaseValue(), 500, 0xF88, 0));
                Add(new GenericBuyInfo("Spider Silk", typeof(SpidersSilk), SpidersSilk.GetSBPurchaseValue(), 500, 0xF8D, 0));
                Add(new GenericBuyInfo("Sulfurous Ash", typeof(SulfurousAsh), SulfurousAsh.GetSBPurchaseValue(), 500, 0xF8C, 0));

                Add(new GenericBuyInfo("Recall Rune", typeof(RecallRune), RecallRune.GetSBPurchaseValue(), 50, 0x1f14, 0));
                Add(new GenericBuyInfo("Spellbook", typeof(Spellbook), Spellbook.GetSBPurchaseValue(), 25, 0xEFA, 0));
                Add(new GenericBuyInfo("Blank Scroll", typeof(BlankScroll), BlankScroll.GetSBPurchaseValue(), 500, 0x0E34, 0));
                Add(new GenericBuyInfo("Scribe's Pen", typeof(ScribesPen), ScribesPen.GetSBPurchaseValue(), 50, 0xFBF, 0));
                Add(new GenericBuyInfo("Magical Wizard's Hat", typeof(MagicWizardsHat), MagicWizardsHat.GetSBPurchaseValue(), 25, 0x1718, 0));
            }
Example #5
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                int number;

                if (m_CraftSystem is DefTinkering && targeted is Golem)
                {
                    Golem g      = (Golem)targeted;
                    int   damage = g.HitsMax - g.Hits;

                    if (g.IsDeadBondedPet)
                    {
                        number = 500426;                         // You can't repair that.
                    }
                    else if (damage <= 0)
                    {
                        number = 500423;                         // That is already in full repair.
                    }
                    else
                    {
                        double skillValue = from.Skills[SkillName.Tinkering].Value;

                        if (skillValue < 60.0)
                        {
                            number = 1044153;                             // You don't have the required skills to attempt this item.
                        }
                        else if (!from.CanBeginAction(typeof(Golem)))
                        {
                            number = 501789;                             // You must wait before trying again.
                        }
                        else
                        {
                            if (damage > (int)(skillValue * 0.3))
                            {
                                damage = (int)(skillValue * 0.3);
                            }

                            damage += 30;

                            if (!from.CheckSkill(SkillName.Tinkering, 0.0, 100.0))
                            {
                                damage /= 2;
                            }

                            Container pack = from.Backpack;

                            if (pack != null)
                            {
                                int v = pack.ConsumeUpTo(typeof(IronIngot), (damage + 4) / 5);

                                if (v > 0)
                                {
                                    g.Hits += v * 5;

                                    number = 1044279;                                     // You repair the item.

                                    from.BeginAction(typeof(Golem));
                                    Timer.DelayCall(TimeSpan.FromSeconds(12.0), new TimerStateCallback(EndGolemRepair), from);
                                }
                                else
                                {
                                    number = 1044037;                                     // You do not have sufficient metal to make that.
                                }
                            }
                            else
                            {
                                number = 1044037;                                 // You do not have sufficient metal to make that.
                            }
                        }
                    }
                }
                else 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.
                    }
                    else if (!weapon.IsChildOf(from.Backpack))
                    {
                        number = 1044275;                         // The item must be in your backpack to repair it.
                    }
                    else if (weapon.MaxHits <= 0 || weapon.Hits == weapon.MaxHits)
                    {
                        number = 1044281;                         // That item is in full repair
                    }
                    else if (weapon.MaxHits <= toWeaken)
                    {
                        number = 500424;                         // You destroyed the item.
                        m_CraftSystem.PlayCraftEffect(from);
                        weapon.Delete();
                    }
                    else if (from.CheckSkill(skill, -285.0, 100.0))
                    {
                        number = 1044279;                         // You repair the item.
                        m_CraftSystem.PlayCraftEffect(from);
                        weapon.MaxHits -= toWeaken;
                        weapon.Hits     = weapon.MaxHits;
                    }
                    else
                    {
                        number = 1044280;                         // You fail to repair the item.
                        m_CraftSystem.PlayCraftEffect(from);
                        weapon.MaxHits -= toWeaken;

                        if (weapon.Hits - toWeaken < 0)
                        {
                            weapon.Hits = 0;
                        }
                        else
                        {
                            weapon.Hits -= toWeaken;
                        }
                    }

                    if (weapon.MaxHits <= toWeaken)
                    {
                        from.SendLocalizedMessage(1044278);                           // That item has been repaired many times, and will break if repairs are attempted again.
                    }
                }
                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 && !IsSpecialArmor(armor))
                    {
                        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.
                        m_CraftSystem.PlayCraftEffect(from);
                        armor.Delete();
                    }
                    else if (from.CheckSkill(skill, -285.0, 100.0))
                    {
                        number = 1044279;                         // You repair the item.
                        m_CraftSystem.PlayCraftEffect(from);
                        armor.MaxHitPoints -= toWeaken;
                        armor.HitPoints     = armor.MaxHitPoints;
                    }
                    else
                    {
                        number = 1044280;                         // You fail to repair the item.
                        m_CraftSystem.PlayCraftEffect(from);
                        armor.MaxHitPoints -= toWeaken;

                        if (armor.HitPoints - toWeaken < 0)
                        {
                            armor.HitPoints = 0;
                        }
                        else
                        {
                            armor.HitPoints -= toWeaken;
                        }
                    }

                    if (armor.MaxHitPoints <= toWeaken)
                    {
                        from.SendLocalizedMessage(1044278);                           // That item has been repaired many times, and will break if repairs are attempted again.
                    }
                }
                else if (targeted is Item)
                {
                    SkillName skill = m_CraftSystem.MainSkill;
                    if (targeted is BlankScroll)
                    {
                        if (skill == SkillName.Blacksmith && from.Skills[SkillName.Blacksmith].Value >= 55.0)
                        {
                            BlackSmithRepair r1 = new BlackSmithRepair();
                            r1.SkillLevel = from.Skills[SkillName.Blacksmith].Value;
                            r1.Maker      = from.Name;
                            r1.Uses       = 8;
                            from.AddToBackpack(r1);
                            number = 1044154;
                            BlankScroll i_blank = targeted as BlankScroll;
                            if (i_blank.Amount >= 2)
                            {
                                i_blank.Amount -= 1;
                            }
                            else
                            {
                                i_blank.Delete();
                            }
                        }
                        else if (skill == SkillName.Tailoring && from.Skills[SkillName.Tailoring].Value >= 55.0)
                        {
                            TailorRepair r1 = new TailorRepair();
                            r1.SkillLevel = from.Skills[SkillName.Tailoring].Value;
                            r1.Maker      = from.Name;
                            r1.Uses       = 8;
                            from.AddToBackpack(r1);
                            number = 1044154;
                            BlankScroll i_blank = targeted as BlankScroll;
                            if (i_blank.Amount >= 2)
                            {
                                i_blank.Amount -= 1;
                            }
                            else
                            {
                                i_blank.Delete();
                            }
                        }
                        else
                        {
                            number = 1044277;                     // That item cannot be repaired.
                        }
                    }
                    else
                    {
                        number = 1044277;                 // That item cannot be repaired.
                    }
                }
                else
                {
                    number = 500426;                     // You can't repair that.
                }

                CraftContext context = m_CraftSystem.GetContext(from);

                from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, number));
            }
Example #6
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                int number;

                if (m_CraftSystem is DefBlacksmithy)
                {
                    bool anvil, forge;
                    DefBlacksmithy.CheckAnvilAndForge(from, 2, out anvil, out forge);

                    if (anvil && forge)
                    {
                        // You must be near a forge and and anvil to repair items.
                        number = 1044282;
                    }
                }

                if (m_CraftSystem is DefTinkering && targeted is Golem)
                {
                    Golem g      = (Golem)targeted;
                    int   damage = g.HitsMax - g.Hits;

                    if (g.IsDeadBondedPet)
                    {
                        number = 500426;                         // You can't repair that.
                    }
                    else if (damage <= 0)
                    {
                        number = 500423;                         // That is already in full repair.
                    }
                    else
                    {
                        double skillValue = from.Skills[SkillName.Tinkering].Value;

                        if (skillValue < 60.0)
                        {
                            number = 1044153;                             // You don't have the required skills to attempt this item.
                        }
                        else if (!from.CanBeginAction(typeof(Golem)))
                        {
                            number = 501789;                             // You must wait before trying again.
                        }
                        else
                        {
                            if (damage > (int)(skillValue * 0.3))
                            {
                                damage = (int)(skillValue * 0.3);
                            }

                            damage += 30;

                            if (!from.CheckSkill(SkillName.Tinkering, 0.0, 100.0))
                            {
                                damage /= 2;
                            }

                            Container pack = from.Backpack;

                            if (pack != null)
                            {
                                int v = pack.ConsumeUpTo(typeof(IronIngot), (damage + 4) / 5);

                                if (v > 0)
                                {
                                    g.Hits += v * 5;

                                    number = 1044279;                                     // You repair the item.

                                    from.BeginAction(typeof(Golem));
                                    Timer.DelayCall(TimeSpan.FromSeconds(12.0), new TimerStateCallback(EndGolemRepair), from);

                                    if (m_Contract != null)
                                    {
                                        m_Contract.Delete();
                                    }
                                }
                                else
                                {
                                    number = 1044037;                                     // You do not have sufficient metal to make that.
                                }
                            }
                            else
                            {
                                number = 1044037;                                 // You do not have sufficient metal to make that.
                            }
                        }
                    }
                }
                else 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 (m_Tool == null)
                        {
                            skillLevel = m_SkillLevel;
                        }

                        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))
                    {
                        if (m_Contract != null)
                        {
                            // You cannot repair that item with this type of repair contract.
                            number = 1061136;
                        }
                        else
                        {
                            // You cannot repair that using this type of tool.
                            number = 1061139;
                        }
                    }
                    else if (!weapon.IsChildOf(from.Backpack))
                    {
                        number = 1044275;                         // The item must be in your backpack to repair it.
                    }
                    else if (weapon.MaxHits <= 0 || weapon.Hits == weapon.MaxHits)
                    {
                        number = 1044281;                         // That item is in full repair
                    }
                    else if (weapon.MaxHits <= toWeaken)
                    {
                        number = 1044278;                         // That item has been repaired many times, and will break if repairs are attempted again.
                    }
                    else
                    {
                        if (CheckWeaken(from, skill, weapon.Hits, weapon.MaxHits))
                        {
                            weapon.MaxHits -= toWeaken;
                            weapon.Hits     = Math.Max(0, weapon.Hits - toWeaken);
                        }

                        if (CheckRepairDifficulty(from, skill, weapon.Hits, weapon.MaxHits))
                        {
                            number = 1044279;                             // You repair the item.
                            m_CraftSystem.PlayCraftEffect(from);
                            weapon.Hits = weapon.MaxHits;

                            if (from.AccessLevel > AccessLevel.Player)
                            {
                                weapon.Cheater_Name = String.Format("This item repaired by GM {0}", from.Name);
                            }
                        }
                        else
                        {
                            if (m_Contract != null)
                            {
                                // You fail to repair the item and the repair contract is destroyed.
                                number = 1061137;
                            }
                            else
                            {
                                // You fail to repair the item.
                                number = 1044280;
                            }

                            m_CraftSystem.PlayCraftEffect(from);
                        }

                        if (m_Contract != null)
                        {
                            m_Contract.Delete();
                        }
                    }
                }
                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 (m_Tool == null)
                        {
                            skillLevel = m_SkillLevel;
                        }

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

                    if (m_CraftSystem.CraftItems.SearchForSubclass(armor.GetType()) == null)
                    {
                        if (m_Contract != null)
                        {
                            // You cannot repair that item with this type of repair contract.
                            number = 1061136;
                        }
                        else
                        {
                            // You cannot repair that using this type of tool.
                            number = 1061139;
                        }
                    }
                    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;

                            if (from.AccessLevel > AccessLevel.Player)
                            {
                                armor.Cheater_Name = String.Format("This item repaired by GM {0}", from.Name);
                            }
                        }
                        else
                        {
                            if (m_Contract != null)
                            {
                                // You fail to repair the item and the repair contract is destroyed.
                                number = 1061137;
                            }
                            else
                            {
                                // You fail to repair the item.
                                number = 1044280;
                            }

                            m_CraftSystem.PlayCraftEffect(from);
                        }

                        if (m_Contract != null)
                        {
                            m_Contract.Delete();
                        }
                    }
                }
                else if (targeted is Item)
                {
                    number = 1044283;                     // You cannot repair that.

                    SkillName skill = m_CraftSystem.MainSkill;

                    double value = from.Skills[skill].Value;

                    if (targeted is BlankScroll)
                    {
                        Item contract = null;

                        if (value < 50.0)
                        {
                            // You must be at least apprentice level to create a repair service contract.
                            number = 1047005;
                        }
                        else
                        {
                            if (skill == SkillName.Blacksmith)
                            {
                                contract = new RepairContract(ContractType.Blacksmith, value, from.Name);
                            }
                            else if (skill == SkillName.Carpentry)
                            {
                                contract = new RepairContract(ContractType.Carpenter, value, from.Name);
                            }
                            else if (skill == SkillName.Fletching)
                            {
                                contract = new RepairContract(ContractType.Fletcher, value, from.Name);
                            }
                            else if (skill == SkillName.Tailoring)
                            {
                                contract = new RepairContract(ContractType.Tailor, value, from.Name);
                            }
                            else if (skill == SkillName.Tinkering)
                            {
                                contract = new RepairContract(ContractType.Tinker, value, from.Name);
                            }
                        }

                        if (contract != null)
                        {
                            if (from.AccessLevel > AccessLevel.Player)
                            {
                                contract.Cheater_Name = String.Format("This item crafted by GM {0}", from.Name);
                            }

                            from.AddToBackpack(contract);

                            number = 1044154;                             // You create the item.

                            BlankScroll scroll = targeted as BlankScroll;

                            if (scroll.Amount >= 2)
                            {
                                scroll.Amount -= 1;
                            }
                            else
                            {
                                scroll.Delete();
                            }
                        }
                    }
                }
                else
                {
                    number = 500426;                     // You can't repair that.
                }

                if (m_Tool != null)
                {
                    CraftContext context = m_CraftSystem.GetContext(from);

                    from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, number));
                }
                else
                {
                    from.SendLocalizedMessage(number);
                }
            }