using
System;
Server;
Server.Network;
Server.Targeting;
Server.Mobiles;
Server.Gumps;
System.Collections;
System.Collections.Generic;
Server.ContextMenus;
Server.Multis;
Server.Items;
Server.Engines.Craft;
Server.Engines.Plants;
namespace
public class PlantPigment : Item
{
private PlantPigmentHue m_Hue;
private PlantHue m_PlantHue;
[CommandProperty( AccessLevel.GameMaster )]
public PlantPigmentHue PigmentHue
get{ return m_Hue; }
set{
m_Hue =
value;
// set any invalid pigment hue to Plain
//if ( m_Hue != PlantPigmentHueInfo.GetInfo(m_Hue).PlantPigmentHue )
// m_Hue = PlantPigmentHue.Plain;
//Hue = PlantPigmentHueInfo.GetInfo(m_Hue).Hue;
//InvalidateProperties();
}
public PlantHue hue
get{ return m_PlantHue;}
set{ m_PlantHue = value;
Hue = PlantHueInfo.GetInfo(m_PlantHue).Hue;
// public override int Hue { get { return PlantHueInfo.GetInfo(m_PlantHue).Hue; } }
public override bool ForceShowProperties { get { return ObjectPropertyList.Enabled; } }
public override int LabelNumber { get { return 1112132; } } // plant pigment
public bool RetainsColorFrom { get { return true; } }
/* [Constructable]
public PlantPigment() : this( PlantPigmentHue.Plain )
[Constructable]
public PlantPigment( PlantPigmentHue hue ) : base( 0x0F02 )
Weight = 1.0;
PigmentHue = hue;
}*/
public PlantPigment() : base( 0x0F02 )
PigmentHue = PlantHueInfo.GetInfo(m_PlantHue).Hue;
//PigmentHue = PlantHueInfo.HueFromPlantHue(hue);
public override void AddNameProperty( ObjectPropertyList list )
PlantPigmentHueInfo hueInfo = PlantPigmentHueInfo.GetInfo( m_Hue );
list.Add ( 1112133,
"#" + hueInfo.Name ); // ~1_COLOR~ plant clippings
public PlantPigment( Serial serial ) : base( serial )
public override void Serialize( GenericWriter writer )
base.Serialize( writer );
writer.Write( (
int) 1 ); // version
int) m_Hue );
int) m_PlantHue );
public override void Deserialize( GenericReader reader )
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
case 1:
m_Hue = (PlantPigmentHue)reader.ReadInt();
m_PlantHue = (PlantHue)reader.ReadInt();
break;
public override void OnDoubleClick( Mobile from )
if ( !PlantPigmentHueInfo.IsMixable(PigmentHue) )
from.SendLocalizedMessage( 1112125 );
// This pigment is saturated and cannot be mixed further.
else
from.SendLocalizedMessage( 1112123 );
// Which plant pigment do you wish to mix this with?
from.Target =
new InternalTarget( this );
private class InternalTarget : Target
private PlantPigment m_Item;
public InternalTarget( PlantPigment item ) : base( 2, false, TargetFlags.None )
m_Item = item;
protected override void OnTarget( Mobile from, object targeted )
if ( m_Item.Deleted )
return;
PlantPigment pigment = targeted
as PlantPigment;
if ( null == pigment )
from.SendLocalizedMessage( 1112124 );
// You may only mix this with another non-saturated plant pigment.
if ( from.Skills[SkillName.Alchemy].Base < 75.0 && from.Skills[SkillName.Cooking].Base < 75.0 )
from.SendLocalizedMessage( 1112214 );
// You lack the alchemy or cooking skills to mix plant pigments.
else if ( (PlantPigmentHue.White == pigment.PigmentHue || PlantPigmentHue.Black == pigment.PigmentHue
|| PlantPigmentHue.White == m_Item.PigmentHue || PlantPigmentHue.Black == m_Item.PigmentHue)
&& from.Skills[SkillName.Alchemy].Base < 100.0
&& from.Skills[SkillName.Cooking].Base < 100.0 )
from.SendLocalizedMessage( 1112213 );
// You lack the alchemy or cooking skills to mix so unstable a pigment.
else if ( m_Item.PigmentHue == pigment.PigmentHue )
from.SendLocalizedMessage( 1112242 );
// You decide not to waste pigments by mixing two identical colors.
else if ( (m_Item.PigmentHue & ~(PlantPigmentHue.Bright | PlantPigmentHue.Dark | PlantPigmentHue.Ice))
== (pigment.PigmentHue & ~(PlantPigmentHue.Bright | PlantPigmentHue.Dark | PlantPigmentHue.Ice)) )
from.SendLocalizedMessage( 1112243 );
// You decide not to waste pigments by mixing variations of the same hue.
else if ( (PlantPigmentHue.White == m_Item.PigmentHue && PlantPigmentHueInfo.IsBright(pigment.PigmentHue))
|| (PlantPigmentHue.White == pigment.PigmentHue && PlantPigmentHueInfo.IsBright(m_Item.PigmentHue)) )
from.SendLocalizedMessage( 1112241 );
// This pigment is too diluted to be faded further.
else if ( !PlantPigmentHueInfo.IsMixable(pigment.PigmentHue) )
PlantPigmentHue newHue = PlantPigmentHueInfo.Mix( m_Item.PigmentHue, pigment.PigmentHue );
if ( PlantPigmentHue.None == newHue )
pigment.PigmentHue = newHue;
Bottle bottle =
new Bottle();
bottle.MoveToWorld(m_Item.Location, m_Item.Map);
m_Item.Delete();
from.PlaySound( 0x240 );