A new smith bod reward

We try to put in new spawn areas, quests, events, items and scripts. This is where you submit your wish.
Locked
Penny
Legendary Scribe
Reactions:
Posts: 210
Joined: Thu Oct 01, 2009 12:05 pm

A new smith bod reward

Post by Penny »

A balancing tool, does the same as sharpening blade except increases SSI.
Maybe this could be another high-end LBOD reward?

Tested the script and with 120 BS it increased SSI by 4-5% per use, up to 30%
The item graphic should be changed :P

BalancingTool.cs : ( = mutilated SharpeningTool.cs)

Code: Select all

using System;
using Server;
using Server.Targeting;

namespace Server.Items
{
	public class BalancingTool : Item
	{
		private int i_Uses;
		[CommandProperty( AccessLevel.GameMaster )]
		public int Uses { get { return i_Uses; } set { i_Uses = value; InvalidateProperties(); } }

		[Constructable] 
		public BalancingTool() : this( 50 )
		{
		}

		[Constructable] 
		public BalancingTool( int uses ) : base( 4735 ) 
		{ 
			Weight = 1.0;
			i_Uses = uses;
			Name = "Balancing Tool";
		} 

		public override void GetProperties( ObjectPropertyList list )
		{
			base.GetProperties( list );

			list.Add( 1060584, i_Uses.ToString() ); // uses remaining: ~1_val~
		}
		
		public override void OnDoubleClick( Mobile from )
		{
			if ( IsChildOf( from.Backpack ) )
			{
				if ( Uses < 1 )
				{
					Delete();
					from.SendMessage(32, "This has no charges so it's gone!!!");
				}
				from.SendMessage("Which weapon you want to try to balance?");
				from.Target = new BalancingToolTarget(this); 
			}
			else
				from.SendMessage("This must be in your backpack to use.");
		}
		
		public void Balancing(Mobile from, object o)
		{
			if (o is BaseWeapon && ((BaseWeapon)o).IsChildOf(from.Backpack))
			{
				BaseWeapon weap = o as BaseWeapon;
				int i_DI = weap.Attributes.WeaponSpeed;
				if (weap.Quality == WeaponQuality.Exceptional)
					i_DI += 5;		// EDIT THESE
				if (i_DI >= 30)		//
				{
					from.SendMessage("This weapon cannot be balanced any further");
					return;
				}
				else if (from.Skills[SkillName.Blacksmith].Value < 100.0)
					from.SendMessage(32, "You need atleast 100 blacksmith to balance weapons");
				else if ( !Deleted )
				{
					int bonus = Utility.Random((int)(from.Skills[SkillName.Blacksmith].Value/10));
					if (bonus > 0)
					{
						if (30 < i_DI + bonus)
							bonus = 30 - i_DI;
						weap.Attributes.WeaponSpeed += bonus;
						from.SendMessage(88, "You enhanced the weapon with {0} speed increase", bonus);
					}
					else
						from.SendMessage(32, "You fail to enhance the weapon");
					if (Uses <= 1)
					{
						from.SendMessage(32, "You used up the balancing tool");
						Delete();
					}
					else
					{
						--Uses;
						from.SendMessage(32, "You have {0} uses left", Uses);
					}
				}
			}
			else
				from.SendMessage(32, "You can only enhance weapons");
		}
				
		public BalancingTool( Serial serial ) : base( serial )
		{
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 1 ); // version

			writer.Write( (int) i_Uses );
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			i_Uses = reader.ReadInt();
			if ( version == 0 ) { Serial sr_Owner = reader.ReadInt(); }
		}
	}

	public class BalancingToolTarget : Target
	{
		private BalancingTool sb_Btool;

		public BalancingToolTarget(BalancingTool tool) : base( 18, false, TargetFlags.None )
		{
			sb_Btool = tool;
		}

		protected override void OnTarget(Mobile from, object targeted)
		{
			if (sb_Btool.Deleted)
				return;

			sb_Btool.Balancing(from, targeted);
		}
	}
}
Failure is not an option, it's a standard.
Locked