Fixes lots more spelling errors (#5)
* Renames constructable to constructible * Fixes project references. * Fixes BaseEquippableLight file name * Replaces payed with paid. * Fixes various other spelling errors
This commit is contained in:
parent
ca4e99c179
commit
20ae1b3989
2195 changed files with 4617 additions and 4617 deletions
118
Scripts/Items/Misc/FlippableAttribute.cs
Normal file
118
Scripts/Items/Misc/FlippableAttribute.cs
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
using System;
|
||||
using Server;
|
||||
using System.Reflection;
|
||||
using Server.Targeting;
|
||||
using Server.Commands;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class FlipCommandHandlers
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register( "Flip", AccessLevel.GameMaster, new CommandEventHandler( Flip_OnCommand ) );
|
||||
}
|
||||
|
||||
[Usage( "Flip" )]
|
||||
[Description( "Turns an item." )]
|
||||
public static void Flip_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
e.Mobile.Target = new FlipTarget();
|
||||
}
|
||||
|
||||
private class FlipTarget : Target
|
||||
{
|
||||
public FlipTarget()
|
||||
: base( -1, false, TargetFlags.None )
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if( targeted is Item )
|
||||
{
|
||||
Item item = (Item)targeted;
|
||||
|
||||
if( item.Movable == false && from.AccessLevel == AccessLevel.Player )
|
||||
return;
|
||||
|
||||
Type type = targeted.GetType();
|
||||
|
||||
FlippableAttribute[] AttributeArray = (FlippableAttribute[])type.GetCustomAttributes( typeof( FlippableAttribute ), false );
|
||||
|
||||
if( AttributeArray.Length == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FlippableAttribute fa = AttributeArray[0];
|
||||
|
||||
fa.Flip( (Item)targeted );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage( AttributeTargets.Class )]
|
||||
public class DynamicFlipingAttribute : Attribute
|
||||
{
|
||||
public DynamicFlipingAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage( AttributeTargets.Class )]
|
||||
public class FlippableAttribute : Attribute
|
||||
{
|
||||
private int[] m_ItemIDs;
|
||||
|
||||
public int[] ItemIDs
|
||||
{
|
||||
get { return m_ItemIDs; }
|
||||
}
|
||||
|
||||
public FlippableAttribute()
|
||||
: this( null )
|
||||
{
|
||||
}
|
||||
|
||||
public FlippableAttribute( params int[] itemIDs )
|
||||
{
|
||||
m_ItemIDs = itemIDs;
|
||||
}
|
||||
|
||||
public virtual void Flip( Item item )
|
||||
{
|
||||
if( m_ItemIDs == null )
|
||||
{
|
||||
try
|
||||
{
|
||||
MethodInfo flipMethod = item.GetType().GetMethod( "Flip", Type.EmptyTypes );
|
||||
if( flipMethod != null )
|
||||
flipMethod.Invoke( item, new object[0] );
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
int index = 0;
|
||||
for( int i = 0; i < m_ItemIDs.Length; i++ )
|
||||
{
|
||||
if( item.ItemID == m_ItemIDs[i] )
|
||||
{
|
||||
index = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( index > m_ItemIDs.Length - 1 )
|
||||
index = 0;
|
||||
|
||||
item.ItemID = m_ItemIDs[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue