#W# Added SkillSword to remind me how to add +skills to items.
This commit is contained in:
parent
b0bd466ee5
commit
000d16eab6
1 changed files with 65 additions and 0 deletions
65
Scripts/Quests/Rewards/SkillSword.cs
Normal file
65
Scripts/Quests/Rewards/SkillSword.cs
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SkillSword : VikingSword
|
||||
{
|
||||
private SkillMod m_SkillMod;
|
||||
|
||||
[Constructable]
|
||||
public SkillSword()
|
||||
{
|
||||
Name = "sword of mastery";
|
||||
Hue = 1150;
|
||||
}
|
||||
|
||||
public override bool OnEquip( Mobile from )
|
||||
{
|
||||
// First check if base weapon equip succeeds
|
||||
bool equipped = base.OnEquip( from );
|
||||
|
||||
if ( equipped )
|
||||
{
|
||||
// Remove existing mod if needed
|
||||
if ( m_SkillMod != null )
|
||||
m_SkillMod.Remove();
|
||||
|
||||
// Add +5.0 Swordsmanship
|
||||
m_SkillMod = new DefaultSkillMod( SkillName.Swords, true, 5.0 );
|
||||
from.AddSkillMod( m_SkillMod );
|
||||
}
|
||||
|
||||
return equipped;
|
||||
}
|
||||
|
||||
public override void OnRemoved( object parent )
|
||||
{
|
||||
base.OnRemoved( parent );
|
||||
|
||||
// Remove skill bonus when unequipped
|
||||
if ( m_SkillMod != null )
|
||||
{
|
||||
m_SkillMod.Remove();
|
||||
m_SkillMod = null;
|
||||
}
|
||||
}
|
||||
|
||||
public SkillSword( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue