RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Simple Mage Armour Scroll

Epti

Wanderer
Simple Mage Armour Scroll

Scroll, that adds Mage Armor prop to the armor.
MageArmorScroll.cs said:
//customscript
using System;
using Server;
using Server.Mobiles;
using Server.Items;
using Server.Targeting;

namespace Server.Items
{
[TypeAlias( "Server.Items.MageArmorScroll" )]
public class MageArmorScroll : Item
{
public override int LabelNumber{ get{ return 1060437; } } // mage armor

[Constructable]
public MageArmorScroll() : base( 0x2264 )
{
Weight = 1.0;
Hue = 0x66;
}

public override void OnDoubleClick( Mobile from )
{
if ( IsChildOf( from.Backpack ) )
{
from.BeginTarget( 6, false, TargetFlags.None, new TargetCallback( OnTarget ) );
from.SendLocalizedMessage( 502450 ); // What would you like to modify?
}
else
{
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
}

public virtual void OnTarget( Mobile from, object targeted )
{
if ( Deleted )
return;

if(targeted is BaseArmor)
{
BaseArmor arm = (BaseArmor)targeted;

if ( !arm.IsChildOf( from.Backpack ) )
{
from.SendLocalizedMessage( 1042010 ); // You must have the object in your backpack to use it.
}
else
{
if ( arm.ArmorAttributes.MageArmor == 0 )
{
from.PlaySound( 0xFE );
Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x376A, 1, 29, 0x47D, 2, 9962, 0 );
arm.ArmorAttributes.MageArmor = 1;
from.SendLocalizedMessage( 500038 ); // Success!
this.Delete();
}
else
{
from.SendLocalizedMessage( 501026 ); // That did not seem to work.
}
}
}
else
{
from.SendLocalizedMessage( 501026 ); // That did not seem to work.
}
}

public MageArmorScroll( Serial serial ) : base( serial )
{
}

public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version

}

public override void Deserialize(GenericReader reader)
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}
 
Top