159 lines
No EOL
3.8 KiB
C#
159 lines
No EOL
3.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Server;
|
|
using Server.Multis;
|
|
using Server.Targeting;
|
|
using Server.ContextMenus;
|
|
using Server.Gumps;
|
|
using Server.Network;
|
|
using Server.Misc;
|
|
|
|
namespace Server.Items
|
|
{
|
|
public class PigmentTub : DyeTub
|
|
{
|
|
public override bool AllowLeather{ get{ return Settings.PigmentLeather(); } }
|
|
public override bool AllowMetal{ get{ return Settings.PigmentMetal(); } }
|
|
public override bool AllowWood{ get{ return Settings.PigmentWood(); } }
|
|
|
|
public int m_Color;
|
|
public int m_Hue;
|
|
public int m_Category;
|
|
|
|
[Constructable]
|
|
public PigmentTub()
|
|
{
|
|
Name = "pigment tub";
|
|
}
|
|
|
|
public PigmentTub( Serial serial ) : base( serial )
|
|
{
|
|
}
|
|
|
|
public override void Serialize( GenericWriter writer )
|
|
{
|
|
base.Serialize( writer );
|
|
writer.Write( (int) 1 ); // version
|
|
}
|
|
|
|
public override void Deserialize( GenericReader reader )
|
|
{
|
|
base.Deserialize( reader );
|
|
int version = reader.ReadInt();
|
|
}
|
|
|
|
public static int tubCost()
|
|
{
|
|
int value = 1000;
|
|
if ( Settings.PigmentLeather() )
|
|
value = value + 1000;
|
|
if ( Settings.PigmentMetal() )
|
|
value = value + 1000;
|
|
if ( Settings.PigmentWood() )
|
|
value = value + 500;
|
|
|
|
return value;
|
|
}
|
|
|
|
public class PigmentGump : Gump
|
|
{
|
|
private PigmentTub m_Tub;
|
|
|
|
public PigmentGump( Mobile from, PigmentTub tub ) : base( 50, 50 )
|
|
{
|
|
m_Tub = tub;
|
|
|
|
if ( m_Tub.m_Color < 1 )
|
|
{
|
|
m_Tub.m_Color = 1200;
|
|
m_Tub.m_Hue = m_Tub.m_Color+1;
|
|
m_Tub.m_Category = 900;
|
|
}
|
|
|
|
int color = m_Tub.m_Color;
|
|
int c = 0;
|
|
int d = 162;
|
|
int n = 18;
|
|
if ( m_Tub.m_Color == 1800 )
|
|
d = 142;
|
|
|
|
this.Closable=true;
|
|
this.Disposable=true;
|
|
this.Dragable=true;
|
|
this.Resizable=false;
|
|
|
|
AddPage(0);
|
|
AddImage(0, 0, 1);
|
|
|
|
int x = 52;
|
|
int y = 50;
|
|
|
|
while ( d > 0 )
|
|
{
|
|
c++;
|
|
d--;
|
|
if ( c >= n ){ c=1; y=y+12; x=52; }
|
|
x=x+12;
|
|
|
|
if ( color == 1254 ){ color = 1300; }
|
|
else if ( color == 1354 ){ color = 1400; }
|
|
else if ( color == 1454 ){ color = 1500; }
|
|
else if ( color == 1554 ){ color = 1600; }
|
|
else if ( color == 1654 ){ color = 1700; }
|
|
else if ( color == 1754 ){ color = 1800; }
|
|
else if ( color == 1908 ){ color = 2400; }
|
|
|
|
AddButton(x, y, 2, 2, color, GumpButtonType.Reply, 0);
|
|
AddImage(x, y, 2, color);
|
|
|
|
color++;
|
|
}
|
|
|
|
AddItem(283, 43, 7939, m_Tub.m_Hue);
|
|
if ( Settings.PigmentLeather() ){ AddItem(276, 71, 5075, m_Tub.m_Hue); }
|
|
if ( Settings.PigmentMetal() ){ AddItem(291, 94, 5137, m_Tub.m_Hue); }
|
|
if ( Settings.PigmentWood() ){ AddItem(280, 120, 7034, m_Tub.m_Hue); }
|
|
AddItem(293, 149, 4011, m_Tub.m_Hue);
|
|
|
|
AddButton(280, 205, 247, 248, 0, GumpButtonType.Reply, 0);
|
|
|
|
int prev = m_Tub.m_Category-1; if ( prev == 899 ){ prev = 902; }
|
|
int next = m_Tub.m_Category+1; if ( next == 903 ){ next = 900; }
|
|
|
|
AddButton(47, 213, 5603, 5603, prev, GumpButtonType.Reply, 0);
|
|
AddButton(70, 213, 5601, 5601, next, GumpButtonType.Reply, 0);
|
|
}
|
|
|
|
public override void OnResponse(NetState sender, RelayInfo info)
|
|
{
|
|
Mobile from = sender.Mobile;
|
|
int button = info.ButtonID;
|
|
|
|
if ( button == 900 )
|
|
{
|
|
m_Tub.m_Color = 1200;
|
|
m_Tub.m_Category = button;
|
|
}
|
|
else if ( button == 901 )
|
|
{
|
|
m_Tub.m_Color = 1500;
|
|
m_Tub.m_Category = button;
|
|
}
|
|
else if ( button == 902 )
|
|
{
|
|
m_Tub.m_Color = 1800;
|
|
m_Tub.m_Category = button;
|
|
}
|
|
else if ( button > 1000 )
|
|
{
|
|
m_Tub.m_Hue = button+1;
|
|
m_Tub.Hue = m_Tub.m_Hue;
|
|
m_Tub.DyedHue = m_Tub.Hue;
|
|
}
|
|
|
|
if ( button > 0 )
|
|
from.SendGump( new PigmentTub.PigmentGump( from, m_Tub ) );
|
|
}
|
|
}
|
|
}
|
|
} |