#W# Creating rewards for quests.
This commit is contained in:
parent
f2894f2f70
commit
ad9521ebb9
3 changed files with 264 additions and 0 deletions
37
Scripts/Quests/Rewards/BleedersBlade.cs
Normal file
37
Scripts/Quests/Rewards/BleedersBlade.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class BleedersBlade : Katana
|
||||
{
|
||||
[Constructable]
|
||||
public BleedersBlade()
|
||||
{
|
||||
Name = "The Bleeder's Blade";
|
||||
|
||||
Hue = 32;
|
||||
|
||||
AccuracyLevel = WeaponAccuracyLevel.Supremely;
|
||||
DamageLevel = WeaponDamageLevel.Vanq;
|
||||
|
||||
DurabilityLevel = WeaponDurabilityLevel.Indestructible;
|
||||
}
|
||||
|
||||
public BleedersBlade( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
113
Scripts/Quests/Rewards/EnchantedArmorPolish.cs
Normal file
113
Scripts/Quests/Rewards/EnchantedArmorPolish.cs
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Targeting;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class EnchantedArmorPolish : Item
|
||||
{
|
||||
private int m_Uses;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Uses
|
||||
{
|
||||
get { return m_Uses; }
|
||||
set { m_Uses = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public EnchantedArmorPolish() : base( 0xE28 )
|
||||
{
|
||||
Name = "a tin of enchanted armor polish";
|
||||
Hue = 1150;
|
||||
Weight = 1.0;
|
||||
m_Uses = 3;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 );
|
||||
return;
|
||||
}
|
||||
|
||||
from.SendMessage( "Target the armor or shield you wish to flawlessly repair." );
|
||||
from.Target = new InternalTarget( this );
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
base.OnSingleClick( from );
|
||||
this.LabelTo( from, String.Format( "[Charges: {0}]", m_Uses ) );
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private EnchantedArmorPolish m_Polish;
|
||||
|
||||
public InternalTarget( EnchantedArmorPolish polish ) : base( 1, false, TargetFlags.None )
|
||||
{
|
||||
m_Polish = polish;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( m_Polish.Deleted ) return;
|
||||
|
||||
if ( !m_Polish.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( targeted is BaseArmor )
|
||||
{
|
||||
BaseArmor armor = (BaseArmor)targeted;
|
||||
|
||||
if ( armor.HitPoints >= armor.MaxHitPoints )
|
||||
{
|
||||
from.SendMessage( 33, "That piece of armor is already in perfect condition." );
|
||||
return;
|
||||
}
|
||||
|
||||
armor.HitPoints = armor.MaxHitPoints;
|
||||
|
||||
from.PlaySound( 0x55 );
|
||||
from.SendMessage( 63, "You magically mend the armor, restoring it to maximum durability!" );
|
||||
|
||||
m_Polish.Uses--;
|
||||
|
||||
if ( m_Polish.Uses <= 0 )
|
||||
{
|
||||
from.SendMessage( 33, "You scrape the last of the polish from the tin and discard it." );
|
||||
m_Polish.Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( 33, "This polish can only be used on armor and shields." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EnchantedArmorPolish( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 ); // version
|
||||
writer.Write( (int) m_Uses );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
m_Uses = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
114
Scripts/Quests/Rewards/EnchantedWhetstone.cs
Normal file
114
Scripts/Quests/Rewards/EnchantedWhetstone.cs
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Targeting;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class EnchantedWhetstone : Item
|
||||
{
|
||||
private int m_Uses;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Uses
|
||||
{
|
||||
get { return m_Uses; }
|
||||
set { m_Uses = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public EnchantedWhetstone() : base( 0x1F14 )
|
||||
{
|
||||
Name = "an enchanted whetstone";
|
||||
Hue = 1150;
|
||||
Weight = 1.0;
|
||||
m_Uses = 3;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
from.SendMessage( "Target the weapon you wish to flawlessly repair." );
|
||||
from.Target = new InternalTarget( this );
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
base.OnSingleClick( from );
|
||||
this.LabelTo( from, String.Format( "[Charges: {0}]", m_Uses ) );
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private EnchantedWhetstone m_Stone;
|
||||
|
||||
public InternalTarget( EnchantedWhetstone stone ) : base( 1, false, TargetFlags.None )
|
||||
{
|
||||
m_Stone = stone;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( m_Stone.Deleted ) return;
|
||||
|
||||
if ( !m_Stone.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( targeted is BaseWeapon )
|
||||
{
|
||||
BaseWeapon weapon = (BaseWeapon)targeted;
|
||||
|
||||
if ( weapon.HitPoints >= weapon.MaxHitPoints )
|
||||
{
|
||||
from.SendMessage( 33, "That weapon is already in perfect condition." );
|
||||
return;
|
||||
}
|
||||
|
||||
// Flawless repair without lowering maximum durability
|
||||
weapon.HitPoints = weapon.MaxHitPoints;
|
||||
|
||||
from.PlaySound( 0x2A ); // Sharpening sound
|
||||
from.SendMessage( 63, "You flawlessly restore the weapon to its maximum durability!" );
|
||||
|
||||
m_Stone.Uses--;
|
||||
|
||||
if ( m_Stone.Uses <= 0 )
|
||||
{
|
||||
from.SendMessage( 33, "The enchanted whetstone crumbles to dust." );
|
||||
m_Stone.Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( 33, "This whetstone can only be used on weapons." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EnchantedWhetstone( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 ); // version
|
||||
writer.Write( (int) m_Uses );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
m_Uses = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue