|
İçerde : 1 misafir, 0 üye : ---
|
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 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) );
}
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 BaseJewel || target is BaseArmor || target is BaseClothing ||target is BaseShield || target is BaseWeapon || target is EtherealMount || target is BaseSuit )
{
if (m_Hue > -1 && m_Hue < 2000)
{
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 item." );
}
}
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 item." );
}
}
else
{
from.SendMessage( "To hue you need 2000 Gold in your pack or bank." );
}
}
else
{
from.SendMessage( "You may only use hues 0-2000." );
}
}
}
}
}
using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Commands
{
public class HueTarget : Target // Create our targeting class (which we derive from the base target class)
{
int m_Hue;
public static void Initialize()
{
CommandSystem.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));
}
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 BaseJewel || target is BaseArmor || target is BaseClothing || target is BaseShield || target is BaseWeapon || target is EtherealMount || target is BaseSuit)
{
if (m_Hue > -1 && m_Hue < 2000)
{
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), 10000); // Delete the tokens
from.SendMessage("Boyadiginiz Item Karsiliginda Bankanizdan 10000 Gold Alinmistir.");
}
}
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), 10000); // Delete the tokens
from.SendMessage("Boyadiginiz Item Karsiliginda Bankanizdan 10000 Gold Alinmistir.");
}
}
else
{
from.SendMessage("Bankanizda 10000 Gold Bulunmamaktadir.");
}
}
else
{
from.SendMessage("0-2000 Arasi Bir Sayi Girmelisiniz.");
}
}
}
}
}
|