Kod:
////////////////////////////////
////// //////////
/////--Miss Cathy-- /////////
//// /////////
////////////////////////////
using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Scripts.Commands
{
public class HueTarget : Target // Create our targeting class (which we derive from the base target class)
{
int m_Hue;
public HueTarget( int hue ) : base( 1, false, TargetFlags.None )
{
m_Hue = hue;
}
protected override void OnTarget( Mobile from, object target ) // Override the protected OnTarget() for our feature
{
Gold m_Gold = (Gold)from.Backpack.FindItemByType( typeof( Gold ) );
Gold b_Gold = (Gold)from.BankBox.FindItemByType( typeof( Gold ) );
int m_Amount = from.Backpack.GetAmount( typeof( Gold ) );
int b_Amount = from.BankBox.GetAmount( typeof( Gold ) );
if ( target is BaseClothing )
{
if (m_Hue > 0 && m_Hue < 3000)
{
Item item = (Item)target;
if (m_Amount >= 2000)
{
if( item.RootParent == from ) // Make sure its in their pack or they are wearing it
{
item.Hue = m_Hue;
from.Backpack.ConsumeTotal( typeof( Gold ), 2000 ); // Delete the tokens
from.SendMessage( "Removed 2k from backpack and hued the clothing." );
}
}
else if (b_Amount >= 2000)
{
if( item.RootParent == from ) // Make sure its in their pack or they are wearing it
{
item.Hue = m_Hue;
from.BankBox.ConsumeTotal( typeof( Gold ), 2000 ); // Delete the tokens
from.SendMessage( "Removed 2k from bank and hued the clothing." );
}
}
else
{
from.SendMessage( "To hue clothing you need 2k Golds in your pack or bank." );
}
}
else
{
from.SendMessage( "You may only use hues 0-3000." );
}
}
else if (target is EtherealMount)
{
Item item = (Item)target;
if (m_Amount >= 5000)
{
if( item.RootParent == from ) // Make sure its in their pack or they are wearing it
{
item.Hue = m_Hue;
from.Backpack.ConsumeTotal( typeof( Gold ), 5000 ); // Delete the tokens
from.SendMessage( "Removed 5k from backpack and hued the mount." );
}
}
else if (b_Amount >= 5000)
{
if( item.RootParent == from ) // Make sure its in their pack or they are wearing it
{
item.Hue = m_Hue;
from.BankBox.ConsumeTotal( typeof( Gold ), 5000 ); // Delete the tokens
from.SendMessage( "Removed 5k from bank and hued the mount." );
}
}
else
{
from.SendMessage( "To hue a mount you need 5k Golds in your pack or bank." );
}
}
else if (target is Item)
{
Item item = (Item)target;
if (m_Amount >= 3000)
{
if( item.RootParent == from ) // Make sure its in their pack or they are wearing it
{
item.Hue = m_Hue;
from.Backpack.ConsumeTotal( typeof( Gold ), 3000 ); // Delete the tokens
from.SendMessage( "Removed 3k from backpack and hued the item." );
}
}
else if (b_Amount >= 3000)
{
if( item.RootParent == from ) // Make sure its in their pack or they are wearing it
{
item.Hue = m_Hue;
from.BankBox.ConsumeTotal( typeof( Gold ), 3000 ); // Delete the tokens
from.SendMessage( "Removed 3k from bank and hued the item." );
}
}
else
{
from.SendMessage( "To hue an item you need 3k Golds in your pack or bank." );
}
}
else if (target == from)
{
if (m_Amount >= 10000)
{
from.Hue = m_Hue;
from.Backpack.ConsumeTotal( typeof( Gold), 10000 ); // Delete the tokens
}
else if (b_Amount >= 10000)
{
from.Hue = m_Hue;
from.BankBox.ConsumeTotal( typeof( Gold ), 10000 ); // Delete the tokens
}
else
{
from.SendMessage( "To hue your skin you need 10k Golds in your pack or bank." );
}
}
}
}
public class Hue
{
public static void Initialize()
{
Server.Commands.Register( "Hue", AccessLevel.Player, new CommandEventHandler( Hue_OnCommand ) );
}
public static void Hue_OnCommand( CommandEventArgs e )
{
if(e.Length >= 1)
e.Mobile.Target = new HueTarget( e.GetInt32(0) );
}
}
}
Nereye Eklenicek