This commit is contained in:
mark 2006-06-15 04:14:30 +00:00
commit 47711d616e
2644 changed files with 479454 additions and 0 deletions

View file

@ -0,0 +1,63 @@
using System;
using Server.Items;
using Server.Targeting;
namespace Server.ContextMenus
{
public class AddToSpellbookEntry : ContextMenuEntry
{
public AddToSpellbookEntry() : base( 6144, 3 )
{
}
public override void OnClick()
{
if ( Owner.From.CheckAlive() && Owner.Target is SpellScroll )
Owner.From.Target = new InternalTarget( (SpellScroll)Owner.Target );
}
private class InternalTarget : Target
{
private SpellScroll m_Scroll;
public InternalTarget( SpellScroll scroll ) : base( 3, false, TargetFlags.None )
{
m_Scroll = scroll;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( targeted is Spellbook )
{
if ( from.CheckAlive() && !m_Scroll.Deleted && m_Scroll.Movable && m_Scroll.Amount >= 1 )
{
Spellbook book = (Spellbook)targeted;
SpellbookType type = Spellbook.GetTypeForSpell( m_Scroll.SpellID );
if ( type != book.SpellbookType )
{
}
else if ( book.HasSpell( m_Scroll.SpellID ) )
{
from.SendLocalizedMessage( 500179 ); // That spell is already present in that spellbook.
}
else
{
int val = m_Scroll.SpellID - book.BookOffset;
if ( val >= 0 && val < book.BookCount )
{
book.Content |= (ulong)1 << val;
m_Scroll.Consume();
from.Send( new Network.PlaySound( 0x249, book.GetWorldLocation() ) );
}
}
}
}
}
}
}
}

View file

@ -0,0 +1,25 @@
using System;
using Server.Items;
namespace Server.ContextMenus
{
public class EatEntry : ContextMenuEntry
{
private Mobile m_From;
private Food m_Food;
public EatEntry( Mobile from, Food food ) : base( 6135, 1 )
{
m_From = from;
m_Food = food;
}
public override void OnClick()
{
if ( m_Food.Deleted || !m_Food.Movable || !m_From.CheckAlive() )
return;
m_Food.Eat( m_From );
}
}
}

View file

@ -0,0 +1,33 @@
using System;
using Server.Items;
namespace Server.ContextMenus
{
public class OpenBankEntry : ContextMenuEntry
{
private Mobile m_Banker;
public OpenBankEntry( Mobile from, Mobile banker ) : base( 6105, 12 )
{
m_Banker = banker;
}
public override void OnClick()
{
if ( !Owner.From.CheckAlive() )
return;
if ( Owner.From.Criminal )
{
m_Banker.Say( 500378 ); // Thou art a criminal and cannot access thy bank box.
}
else
{
BankBox box = this.Owner.From.BankBox;
if ( box != null )
box.Open();
}
}
}
}

View file

@ -0,0 +1,30 @@
using System;
using Server.Mobiles;
namespace Server.ContextMenus
{
public class TeachEntry : ContextMenuEntry
{
private SkillName m_Skill;
private BaseCreature m_Mobile;
private Mobile m_From;
public TeachEntry( SkillName skill, BaseCreature m, Mobile from, bool enabled ) : base( 6000 + (int)skill, 4 )
{
m_Skill = skill;
m_Mobile = m;
m_From = from;
if ( !enabled )
Flags |= Network.CMEFlags.Disabled;
}
public override void OnClick()
{
if ( !m_From.CheckAlive() )
return;
m_Mobile.Teach( m_Skill, m_From, 0, false );
}
}
}