Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -22,140 +22,144 @@ using System;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class BaseMulti : Item
|
||||
{
|
||||
[Constructible]
|
||||
public BaseMulti( int itemID ) : base( itemID )
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
public class BaseMulti : Item
|
||||
{
|
||||
[Constructible]
|
||||
public BaseMulti(int itemID) : base(itemID)
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public BaseMulti( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public BaseMulti(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public override int ItemID {
|
||||
get => base.ItemID;
|
||||
set {
|
||||
if ( base.ItemID != value ) {
|
||||
Map facet = ( Parent == null ? Map : null );
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public override int ItemID
|
||||
{
|
||||
get => base.ItemID;
|
||||
set
|
||||
{
|
||||
if (base.ItemID != value)
|
||||
{
|
||||
Map facet = Parent == null ? Map : null;
|
||||
|
||||
facet?.OnLeave( this );
|
||||
facet?.OnLeave(this);
|
||||
|
||||
base.ItemID = value;
|
||||
base.ItemID = value;
|
||||
|
||||
facet?.OnEnter( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
facet?.OnEnter(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete( "Replace with calls to OnLeave and OnEnter surrounding component invalidation.", true )]
|
||||
public virtual void RefreshComponents()
|
||||
{
|
||||
if ( Parent == null ) {
|
||||
Map facet = Map;
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
MultiComponentList mcl = Components;
|
||||
|
||||
if ( facet != null ) {
|
||||
facet.OnLeave( this );
|
||||
facet.OnEnter( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mcl.List.Length > 0)
|
||||
{
|
||||
int id = mcl.List[0].m_ItemID;
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
MultiComponentList mcl = Components;
|
||||
if (id < 0x4000)
|
||||
return 1020000 + id;
|
||||
return 1078872 + id;
|
||||
}
|
||||
|
||||
if ( mcl.List.Length > 0 ) {
|
||||
int id = mcl.List[0].m_ItemID;
|
||||
return base.LabelNumber;
|
||||
}
|
||||
}
|
||||
|
||||
if ( id < 0x4000 )
|
||||
return 1020000 + id;
|
||||
return 1078872 + id;
|
||||
}
|
||||
public virtual bool AllowsRelativeDrop => false;
|
||||
|
||||
return base.LabelNumber;
|
||||
}
|
||||
}
|
||||
public virtual MultiComponentList Components => MultiData.GetComponents(ItemID);
|
||||
|
||||
public virtual bool AllowsRelativeDrop => false;
|
||||
[Obsolete("Replace with calls to OnLeave and OnEnter surrounding component invalidation.", true)]
|
||||
public virtual void RefreshComponents()
|
||||
{
|
||||
if (Parent == null)
|
||||
{
|
||||
Map facet = Map;
|
||||
|
||||
public override int GetMaxUpdateRange()
|
||||
{
|
||||
return 22;
|
||||
}
|
||||
if (facet != null)
|
||||
{
|
||||
facet.OnLeave(this);
|
||||
facet.OnEnter(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetUpdateRange( Mobile m )
|
||||
{
|
||||
return 22;
|
||||
}
|
||||
public override int GetMaxUpdateRange()
|
||||
{
|
||||
return 22;
|
||||
}
|
||||
|
||||
public virtual MultiComponentList Components => MultiData.GetComponents( ItemID );
|
||||
public override int GetUpdateRange(Mobile m)
|
||||
{
|
||||
return 22;
|
||||
}
|
||||
|
||||
public virtual bool Contains( Point2D p )
|
||||
{
|
||||
return Contains( p.m_X, p.m_Y );
|
||||
}
|
||||
public virtual bool Contains(Point2D p)
|
||||
{
|
||||
return Contains(p.m_X, p.m_Y);
|
||||
}
|
||||
|
||||
public virtual bool Contains( Point3D p )
|
||||
{
|
||||
return Contains( p.m_X, p.m_Y );
|
||||
}
|
||||
public virtual bool Contains(Point3D p)
|
||||
{
|
||||
return Contains(p.m_X, p.m_Y);
|
||||
}
|
||||
|
||||
public virtual bool Contains( IPoint3D p )
|
||||
{
|
||||
return Contains( p.X, p.Y );
|
||||
}
|
||||
public virtual bool Contains(IPoint3D p)
|
||||
{
|
||||
return Contains(p.X, p.Y);
|
||||
}
|
||||
|
||||
public virtual bool Contains( int x, int y )
|
||||
{
|
||||
MultiComponentList mcl = Components;
|
||||
public virtual bool Contains(int x, int y)
|
||||
{
|
||||
MultiComponentList mcl = Components;
|
||||
|
||||
x -= X + mcl.Min.m_X;
|
||||
y -= Y + mcl.Min.m_Y;
|
||||
x -= X + mcl.Min.m_X;
|
||||
y -= Y + mcl.Min.m_Y;
|
||||
|
||||
return x >= 0
|
||||
&& x < mcl.Width
|
||||
&& y >= 0
|
||||
&& y < mcl.Height
|
||||
&& mcl.Tiles[x][y].Length > 0;
|
||||
}
|
||||
return x >= 0
|
||||
&& x < mcl.Width
|
||||
&& y >= 0
|
||||
&& y < mcl.Height
|
||||
&& mcl.Tiles[x][y].Length > 0;
|
||||
}
|
||||
|
||||
public bool Contains( Mobile m )
|
||||
{
|
||||
if ( m.Map == Map )
|
||||
return Contains( m.X, m.Y );
|
||||
return false;
|
||||
}
|
||||
public bool Contains(Mobile m)
|
||||
{
|
||||
if (m.Map == Map)
|
||||
return Contains(m.X, m.Y);
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Contains( Item item )
|
||||
{
|
||||
if ( item.Map == Map )
|
||||
return Contains( item.X, item.Y );
|
||||
return false;
|
||||
}
|
||||
public bool Contains(Item item)
|
||||
{
|
||||
if (item.Map == Map)
|
||||
return Contains(item.X, item.Y);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
}
|
||||
writer.Write(1); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( version == 0 ) {
|
||||
if ( ItemID >= 0x4000 ) {
|
||||
ItemID -= 0x4000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (version == 0)
|
||||
if (ItemID >= 0x4000)
|
||||
ItemID -= 0x4000;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -18,133 +18,128 @@
|
|||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
|
||||
using Server.Accounting;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class BankBox : Container
|
||||
{
|
||||
public override int DefaultMaxWeight => 0;
|
||||
public class BankBox : Container
|
||||
{
|
||||
public BankBox(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool IsVirtualItem => true;
|
||||
public BankBox(Mobile owner) : base(0xE7C)
|
||||
{
|
||||
Layer = Layer.Bank;
|
||||
Movable = false;
|
||||
Owner = owner;
|
||||
}
|
||||
|
||||
public BankBox( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int DefaultMaxWeight => 0;
|
||||
|
||||
public Mobile Owner { get; private set; }
|
||||
public override bool IsVirtualItem => true;
|
||||
|
||||
public bool Opened { get; private set; }
|
||||
public Mobile Owner{ get; private set; }
|
||||
|
||||
public void Open()
|
||||
{
|
||||
Opened = true;
|
||||
public bool Opened{ get; private set; }
|
||||
|
||||
if ( Owner != null )
|
||||
{
|
||||
Owner.PrivateOverheadMessage( MessageType.Regular, 0x3B2, true,
|
||||
$"Bank container has {TotalItems} items, {TotalWeight} stones", Owner.NetState );
|
||||
Owner.Send( new EquipUpdate( this ) );
|
||||
DisplayTo( Owner );
|
||||
}
|
||||
}
|
||||
public static bool SendDeleteOnClose{ get; set; }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public void Open()
|
||||
{
|
||||
Opened = true;
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
if (Owner != null)
|
||||
{
|
||||
Owner.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true,
|
||||
$"Bank container has {TotalItems} items, {TotalWeight} stones", Owner.NetState);
|
||||
Owner.Send(new EquipUpdate(this));
|
||||
DisplayTo(Owner);
|
||||
}
|
||||
}
|
||||
|
||||
writer.Write( (Mobile) Owner );
|
||||
writer.Write( (bool) Opened );
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
writer.Write(0); // version
|
||||
|
||||
int version = reader.ReadInt();
|
||||
writer.Write(Owner);
|
||||
writer.Write(Opened);
|
||||
}
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Owner = reader.ReadMobile();
|
||||
Opened = reader.ReadBool();
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
if ( Owner == null )
|
||||
Delete();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Owner = reader.ReadMobile();
|
||||
Opened = reader.ReadBool();
|
||||
|
||||
if ( ItemID == 0xE41 )
|
||||
ItemID = 0xE7C;
|
||||
}
|
||||
if (Owner == null)
|
||||
Delete();
|
||||
|
||||
public static bool SendDeleteOnClose { get; set; }
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
Opened = false;
|
||||
if (ItemID == 0xE41)
|
||||
ItemID = 0xE7C;
|
||||
}
|
||||
|
||||
if ( Owner != null && SendDeleteOnClose )
|
||||
Owner.Send( RemovePacket );
|
||||
}
|
||||
public void Close()
|
||||
{
|
||||
Opened = false;
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
}
|
||||
if (Owner != null && SendDeleteOnClose)
|
||||
Owner.Send(RemovePacket);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
}
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
}
|
||||
|
||||
public override DeathMoveResult OnParentDeath( Mobile parent )
|
||||
{
|
||||
return DeathMoveResult.RemainEquipped;
|
||||
}
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
}
|
||||
|
||||
public BankBox( Mobile owner ) : base( 0xE7C )
|
||||
{
|
||||
Layer = Layer.Bank;
|
||||
Movable = false;
|
||||
Owner = owner;
|
||||
}
|
||||
public override DeathMoveResult OnParentDeath(Mobile parent)
|
||||
{
|
||||
return DeathMoveResult.RemainEquipped;
|
||||
}
|
||||
|
||||
public override bool IsAccessibleTo(Mobile check)
|
||||
{
|
||||
if ( ( check == Owner && Opened ) || check.AccessLevel >= AccessLevel.GameMaster )
|
||||
return base.IsAccessibleTo (check);
|
||||
return false;
|
||||
}
|
||||
public override bool IsAccessibleTo(Mobile check)
|
||||
{
|
||||
if (check == Owner && Opened || check.AccessLevel >= AccessLevel.GameMaster)
|
||||
return base.IsAccessibleTo(check);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
{
|
||||
if ( ( from == Owner && Opened ) || from.AccessLevel >= AccessLevel.GameMaster )
|
||||
return base.OnDragDrop( from, dropped );
|
||||
return false;
|
||||
}
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
if (from == Owner && Opened || from.AccessLevel >= AccessLevel.GameMaster)
|
||||
return base.OnDragDrop(from, dropped);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
|
||||
{
|
||||
if ( ( from == Owner && Opened ) || from.AccessLevel >= AccessLevel.GameMaster )
|
||||
return base.OnDragDropInto (from, item, p);
|
||||
return false;
|
||||
}
|
||||
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
|
||||
{
|
||||
if (from == Owner && Opened || from.AccessLevel >= AccessLevel.GameMaster)
|
||||
return base.OnDragDropInto(from, item, p);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override int GetTotal(TotalType type)
|
||||
{
|
||||
if (AccountGold.Enabled && Owner?.Account != null && type == TotalType.Gold)
|
||||
{
|
||||
return Owner.Account.TotalGold;
|
||||
}
|
||||
public override int GetTotal(TotalType type)
|
||||
{
|
||||
if (AccountGold.Enabled && Owner?.Account != null && type == TotalType.Gold) return Owner.Account.TotalGold;
|
||||
|
||||
return base.GetTotal(type);
|
||||
}
|
||||
}
|
||||
return base.GetTotal(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -23,124 +23,100 @@ using Server.Network;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SecureTradeContainer : Container
|
||||
{
|
||||
public SecureTrade Trade { get; }
|
||||
public class SecureTradeContainer : Container
|
||||
{
|
||||
public SecureTradeContainer(SecureTrade trade) : base(0x1E5E)
|
||||
{
|
||||
Trade = trade;
|
||||
|
||||
public SecureTradeContainer( SecureTrade trade ) : base( 0x1E5E )
|
||||
{
|
||||
Trade = trade;
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
Movable = false;
|
||||
}
|
||||
public SecureTradeContainer(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public SecureTradeContainer( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public SecureTrade Trade{ get; }
|
||||
|
||||
public override bool CheckHold( Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight )
|
||||
{
|
||||
if (item == Trade.From.VirtualCheck || item == Trade.To.VirtualCheck)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public override bool CheckHold(Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight)
|
||||
{
|
||||
if (item == Trade.From.VirtualCheck || item == Trade.To.VirtualCheck) return true;
|
||||
|
||||
Mobile to;
|
||||
Mobile to;
|
||||
|
||||
if ( Trade.From.Container != this )
|
||||
to = Trade.From.Mobile;
|
||||
else
|
||||
to = Trade.To.Mobile;
|
||||
if (Trade.From.Container != this)
|
||||
to = Trade.From.Mobile;
|
||||
else
|
||||
to = Trade.To.Mobile;
|
||||
|
||||
return m.CheckTrade( to, item, this, message, checkItems, plusItems, plusWeight );
|
||||
}
|
||||
return m.CheckTrade(to, item, this, message, checkItems, plusItems, plusWeight);
|
||||
}
|
||||
|
||||
public override bool CheckLift( Mobile from, Item item, ref LRReason reject )
|
||||
{
|
||||
reject = LRReason.CannotLift;
|
||||
return false;
|
||||
}
|
||||
public override bool CheckLift(Mobile from, Item item, ref LRReason reject)
|
||||
{
|
||||
reject = LRReason.CannotLift;
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool IsAccessibleTo( Mobile check )
|
||||
{
|
||||
if ( !IsChildOf( check ) || Trade == null || !Trade.Valid )
|
||||
return false;
|
||||
public override bool IsAccessibleTo(Mobile check)
|
||||
{
|
||||
if (!IsChildOf(check) || Trade == null || !Trade.Valid)
|
||||
return false;
|
||||
|
||||
return base.IsAccessibleTo( check );
|
||||
}
|
||||
return base.IsAccessibleTo(check);
|
||||
}
|
||||
|
||||
public override void OnItemAdded( Item item )
|
||||
{
|
||||
if ( !(item is VirtualCheck) )
|
||||
{
|
||||
ClearChecks();
|
||||
}
|
||||
}
|
||||
public override void OnItemAdded(Item item)
|
||||
{
|
||||
if (!(item is VirtualCheck)) ClearChecks();
|
||||
}
|
||||
|
||||
public override void OnItemRemoved( Item item )
|
||||
{
|
||||
if ( !(item is VirtualCheck) )
|
||||
{
|
||||
ClearChecks();
|
||||
}
|
||||
}
|
||||
public override void OnItemRemoved(Item item)
|
||||
{
|
||||
if (!(item is VirtualCheck)) ClearChecks();
|
||||
}
|
||||
|
||||
public override void OnSubItemAdded( Item item )
|
||||
{
|
||||
if ( !(item is VirtualCheck) )
|
||||
{
|
||||
ClearChecks();
|
||||
}
|
||||
}
|
||||
public override void OnSubItemAdded(Item item)
|
||||
{
|
||||
if (!(item is VirtualCheck)) ClearChecks();
|
||||
}
|
||||
|
||||
public override void OnSubItemRemoved( Item item )
|
||||
{
|
||||
if ( !(item is VirtualCheck) )
|
||||
{
|
||||
ClearChecks();
|
||||
}
|
||||
}
|
||||
public override void OnSubItemRemoved(Item item)
|
||||
{
|
||||
if (!(item is VirtualCheck)) ClearChecks();
|
||||
}
|
||||
|
||||
public void ClearChecks( )
|
||||
{
|
||||
if ( Trade != null )
|
||||
{
|
||||
if ( Trade.From != null && !Trade.From.IsDisposed )
|
||||
{
|
||||
Trade.From.Accepted = false;
|
||||
}
|
||||
public void ClearChecks()
|
||||
{
|
||||
if (Trade != null)
|
||||
{
|
||||
if (Trade.From != null && !Trade.From.IsDisposed) Trade.From.Accepted = false;
|
||||
|
||||
if ( Trade.To != null && !Trade.To.IsDisposed )
|
||||
{
|
||||
Trade.To.Accepted = false;
|
||||
}
|
||||
if (Trade.To != null && !Trade.To.IsDisposed) Trade.To.Accepted = false;
|
||||
|
||||
Trade.Update();
|
||||
}
|
||||
}
|
||||
Trade.Update();
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsChildVisibleTo( Mobile m, Item child )
|
||||
{
|
||||
if (child is VirtualCheck)
|
||||
{
|
||||
return AccountGold.Enabled && (m.NetState == null || !m.NetState.NewSecureTrading);
|
||||
}
|
||||
public override bool IsChildVisibleTo(Mobile m, Item child)
|
||||
{
|
||||
if (child is VirtualCheck) return AccountGold.Enabled && (m.NetState == null || !m.NetState.NewSecureTrading);
|
||||
|
||||
return base.IsChildVisibleTo(m, child);
|
||||
}
|
||||
return base.IsChildVisibleTo(m, child);
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,391 +1,367 @@
|
|||
#region Header
|
||||
|
||||
// **********
|
||||
// ServUO - VirtualCheck.cs
|
||||
// **********
|
||||
|
||||
#endregion
|
||||
|
||||
#region References
|
||||
using System;
|
||||
|
||||
using System.Drawing;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public sealed class VirtualCheck : Item
|
||||
{
|
||||
public static bool UseEditGump = false;
|
||||
|
||||
public override bool IsVirtualItem => true;
|
||||
|
||||
public override bool DisplayWeight => false;
|
||||
public override bool DisplayLootType => false;
|
||||
|
||||
public override double DefaultWeight => 0;
|
||||
|
||||
public override string DefaultName => "Offer Of Currency";
|
||||
|
||||
public EditGump Editor { get; private set; }
|
||||
|
||||
private int _Plat;
|
||||
|
||||
[CommandProperty(AccessLevel.Administrator)]
|
||||
public int Plat
|
||||
{
|
||||
get => _Plat;
|
||||
set
|
||||
{
|
||||
_Plat = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
private int _Gold;
|
||||
|
||||
[CommandProperty(AccessLevel.Administrator)]
|
||||
public int Gold
|
||||
{
|
||||
get => _Gold;
|
||||
set
|
||||
{
|
||||
_Gold = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public VirtualCheck()
|
||||
: this(0, 0)
|
||||
{ }
|
||||
|
||||
public VirtualCheck(int plat, int gold)
|
||||
: base(0x14F0)
|
||||
{
|
||||
Plat = plat;
|
||||
Gold = gold;
|
||||
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public VirtualCheck(Serial serial)
|
||||
: base(serial)
|
||||
{ }
|
||||
|
||||
public override bool IsAccessibleTo(Mobile check)
|
||||
{
|
||||
var c = GetSecureTradeCont();
|
||||
|
||||
if (check == null || c == null)
|
||||
{
|
||||
return base.IsAccessibleTo(check);
|
||||
}
|
||||
|
||||
return c.RootParent == check && IsChildOf(c);
|
||||
}
|
||||
|
||||
public override void OnDoubleClickSecureTrade(Mobile from)
|
||||
{
|
||||
if (UseEditGump && IsAccessibleTo(from))
|
||||
{
|
||||
if (Editor?.Check == null || Editor.Check.Deleted)
|
||||
{
|
||||
Editor = new EditGump(from, this);
|
||||
Editor.Send();
|
||||
}
|
||||
else
|
||||
{
|
||||
Editor.Refresh(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Editor != null)
|
||||
{
|
||||
Editor.Close();
|
||||
Editor = null;
|
||||
}
|
||||
|
||||
base.OnDoubleClickSecureTrade(from);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
LabelTo(from, "Offer: {0:#,0} platinum, {1:#,0} gold", Plat, Gold);
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1060738, $"{Plat:#,0} platinum, {Gold:#,0} gold"); // value: ~1_val~
|
||||
}
|
||||
|
||||
public void UpdateTrade(Mobile user)
|
||||
{
|
||||
var c = GetSecureTradeCont();
|
||||
|
||||
if (c?.Trade == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (user == c.Trade.From.Mobile)
|
||||
{
|
||||
c.Trade.UpdateFromCurrency();
|
||||
}
|
||||
else if (user == c.Trade.To.Mobile)
|
||||
{
|
||||
c.Trade.UpdateToCurrency();
|
||||
}
|
||||
|
||||
c.ClearChecks();
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
if (Editor != null)
|
||||
{
|
||||
Editor.Close();
|
||||
Editor = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{ }
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
Delete();
|
||||
}
|
||||
|
||||
public class EditGump : Gump
|
||||
{
|
||||
public enum Buttons
|
||||
{
|
||||
Close,
|
||||
Clear,
|
||||
Accept,
|
||||
AllPlat,
|
||||
AllGold
|
||||
}
|
||||
|
||||
private int _Plat, _Gold;
|
||||
|
||||
public Mobile User { get; private set; }
|
||||
public VirtualCheck Check { get; private set; }
|
||||
|
||||
public EditGump(Mobile user, VirtualCheck check)
|
||||
: base(50, 50)
|
||||
{
|
||||
User = user;
|
||||
Check = check;
|
||||
|
||||
_Plat = Check.Plat;
|
||||
_Gold = Check.Gold;
|
||||
|
||||
Closable = true;
|
||||
Disposable = true;
|
||||
Dragable = true;
|
||||
Resizable = false;
|
||||
|
||||
User.CloseGump(GetType());
|
||||
|
||||
CompileLayout();
|
||||
}
|
||||
|
||||
public override void OnServerClose(NetState owner)
|
||||
{
|
||||
base.OnServerClose(owner);
|
||||
|
||||
if (Check != null && !Check.Deleted)
|
||||
{
|
||||
Check.UpdateTrade(User);
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
User.CloseGump(GetType());
|
||||
|
||||
if (Check != null && !Check.Deleted)
|
||||
{
|
||||
Check.UpdateTrade(User);
|
||||
}
|
||||
else
|
||||
{
|
||||
Check = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Send()
|
||||
{
|
||||
if (Check != null && !Check.Deleted)
|
||||
{
|
||||
User.SendGump(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void Refresh(bool recompile)
|
||||
{
|
||||
if (Check == null || Check.Deleted)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
if (recompile)
|
||||
{
|
||||
CompileLayout();
|
||||
}
|
||||
|
||||
Close();
|
||||
Send();
|
||||
}
|
||||
|
||||
private void CompileLayout()
|
||||
{
|
||||
if (Check == null || Check.Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Entries.ForEach(e => e.Parent = null);
|
||||
Entries.Clear();
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 400, 160, 3500);
|
||||
|
||||
// Title
|
||||
AddImageTiled(25, 35, 350, 3, 96);
|
||||
AddImage(10, 8, 113);
|
||||
AddImage(360, 8, 113);
|
||||
|
||||
var title =
|
||||
$"<BASEFONT COLOR=#{Color.DarkSlateGray.ToArgb():X}><CENTER>BANK OF {User.RawName.ToUpper()}</CENTER>";
|
||||
|
||||
AddHtml(40, 15, 320, 20, title, false, false);
|
||||
|
||||
// Platinum Row
|
||||
AddBackground(15, 60, 175, 20, 9300);
|
||||
AddBackground(20, 45, 165, 30, 9350);
|
||||
AddItem(20, 45, 3826); // Plat
|
||||
AddLabel(60, 50, 0, User.Account.TotalPlat.ToString("#,0"));
|
||||
|
||||
AddButton(195, 50, 95, 95, (int)Buttons.AllPlat, GumpButtonType.Reply, 0); // ->
|
||||
|
||||
AddBackground(210, 60, 175, 20, 9300);
|
||||
AddBackground(215, 45, 165, 30, 9350);
|
||||
AddTextEntry(225, 50, 145, 20, 0, 0, _Plat.ToString(), User.Account.TotalPlat.ToString().Length);
|
||||
|
||||
// Gold Row
|
||||
AddBackground(15, 100, 175, 20, 9300);
|
||||
AddBackground(20, 85, 165, 30, 9350);
|
||||
AddItem(20, 85, 3823); // Gold
|
||||
AddLabel(60, 90, 0, User.Account.TotalGold.ToString("#,0"));
|
||||
|
||||
AddButton(195, 90, 95, 95, (int)Buttons.AllGold, GumpButtonType.Reply, 0); // ->
|
||||
|
||||
AddBackground(210, 100, 175, 20, 9300);
|
||||
AddBackground(215, 85, 165, 30, 9350);
|
||||
AddTextEntry(225, 90, 145, 20, 0, 1, _Gold.ToString(), User.Account.TotalGold.ToString().Length);
|
||||
|
||||
// Buttons
|
||||
AddButton(20, 128, 12006, 12007, (int)Buttons.Close, GumpButtonType.Reply, 0);
|
||||
AddButton(215, 128, 12003, 12004, (int)Buttons.Clear, GumpButtonType.Reply, 0);
|
||||
AddButton(305, 128, 12000, 12002, (int)Buttons.Accept, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (Check == null || Check.Deleted || sender.Mobile != User)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
bool refresh = false, updated = false;
|
||||
|
||||
switch ((Buttons)info.ButtonID)
|
||||
{
|
||||
case Buttons.Close:
|
||||
break;
|
||||
case Buttons.Clear:
|
||||
{
|
||||
_Plat = _Gold = 0;
|
||||
refresh = true;
|
||||
}
|
||||
break;
|
||||
case Buttons.Accept:
|
||||
{
|
||||
var platText = info.GetTextEntry(0).Text;
|
||||
var goldText = info.GetTextEntry(1).Text;
|
||||
|
||||
if (!int.TryParse(platText, out _Plat))
|
||||
{
|
||||
User.SendMessage("That is not a valid amount of platinum.");
|
||||
refresh = true;
|
||||
}
|
||||
else if (!int.TryParse(goldText, out _Gold))
|
||||
{
|
||||
User.SendMessage("That is not a valid amount of gold.");
|
||||
refresh = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
int totalPlat = User.Account.TotalPlat;
|
||||
int totalGold = User.Account.TotalGold;
|
||||
|
||||
if (totalPlat < _Plat || totalGold < _Gold)
|
||||
{
|
||||
_Plat = User.Account.TotalPlat;
|
||||
_Gold = User.Account.TotalGold;
|
||||
User.SendMessage("You do not have that much currency.");
|
||||
refresh = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Check.Plat = _Plat;
|
||||
Check.Gold = _Gold;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Buttons.AllPlat:
|
||||
{
|
||||
_Plat = User.Account.TotalPlat;
|
||||
refresh = true;
|
||||
}
|
||||
break;
|
||||
case Buttons.AllGold:
|
||||
{
|
||||
_Gold = User.Account.TotalGold;
|
||||
refresh = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (updated)
|
||||
{
|
||||
User.SendMessage("Your offer has been updated.");
|
||||
}
|
||||
|
||||
if (refresh && Check != null && !Check.Deleted)
|
||||
{
|
||||
Refresh(true);
|
||||
return;
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public sealed class VirtualCheck : Item
|
||||
{
|
||||
public static bool UseEditGump = false;
|
||||
|
||||
private int _Gold;
|
||||
|
||||
private int _Plat;
|
||||
|
||||
public VirtualCheck()
|
||||
: this(0, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public VirtualCheck(int plat, int gold)
|
||||
: base(0x14F0)
|
||||
{
|
||||
Plat = plat;
|
||||
Gold = gold;
|
||||
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public VirtualCheck(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool IsVirtualItem => true;
|
||||
|
||||
public override bool DisplayWeight => false;
|
||||
public override bool DisplayLootType => false;
|
||||
|
||||
public override double DefaultWeight => 0;
|
||||
|
||||
public override string DefaultName => "Offer Of Currency";
|
||||
|
||||
public EditGump Editor{ get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.Administrator)]
|
||||
public int Plat
|
||||
{
|
||||
get => _Plat;
|
||||
set
|
||||
{
|
||||
_Plat = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Administrator)]
|
||||
public int Gold
|
||||
{
|
||||
get => _Gold;
|
||||
set
|
||||
{
|
||||
_Gold = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsAccessibleTo(Mobile check)
|
||||
{
|
||||
SecureTradeContainer c = GetSecureTradeCont();
|
||||
|
||||
if (check == null || c == null) return base.IsAccessibleTo(check);
|
||||
|
||||
return c.RootParent == check && IsChildOf(c);
|
||||
}
|
||||
|
||||
public override void OnDoubleClickSecureTrade(Mobile from)
|
||||
{
|
||||
if (UseEditGump && IsAccessibleTo(from))
|
||||
{
|
||||
if (Editor?.Check == null || Editor.Check.Deleted)
|
||||
{
|
||||
Editor = new EditGump(from, this);
|
||||
Editor.Send();
|
||||
}
|
||||
else
|
||||
{
|
||||
Editor.Refresh(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Editor != null)
|
||||
{
|
||||
Editor.Close();
|
||||
Editor = null;
|
||||
}
|
||||
|
||||
base.OnDoubleClickSecureTrade(from);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
LabelTo(from, "Offer: {0:#,0} platinum, {1:#,0} gold", Plat, Gold);
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1060738, $"{Plat:#,0} platinum, {Gold:#,0} gold"); // value: ~1_val~
|
||||
}
|
||||
|
||||
public void UpdateTrade(Mobile user)
|
||||
{
|
||||
SecureTradeContainer c = GetSecureTradeCont();
|
||||
|
||||
if (c?.Trade == null) return;
|
||||
|
||||
if (user == c.Trade.From.Mobile)
|
||||
c.Trade.UpdateFromCurrency();
|
||||
else if (user == c.Trade.To.Mobile) c.Trade.UpdateToCurrency();
|
||||
|
||||
c.ClearChecks();
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
if (Editor != null)
|
||||
{
|
||||
Editor.Close();
|
||||
Editor = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
Delete();
|
||||
}
|
||||
|
||||
public class EditGump : Gump
|
||||
{
|
||||
public enum Buttons
|
||||
{
|
||||
Close,
|
||||
Clear,
|
||||
Accept,
|
||||
AllPlat,
|
||||
AllGold
|
||||
}
|
||||
|
||||
private int _Plat, _Gold;
|
||||
|
||||
public EditGump(Mobile user, VirtualCheck check)
|
||||
: base(50, 50)
|
||||
{
|
||||
User = user;
|
||||
Check = check;
|
||||
|
||||
_Plat = Check.Plat;
|
||||
_Gold = Check.Gold;
|
||||
|
||||
Closable = true;
|
||||
Disposable = true;
|
||||
Dragable = true;
|
||||
Resizable = false;
|
||||
|
||||
User.CloseGump(GetType());
|
||||
|
||||
CompileLayout();
|
||||
}
|
||||
|
||||
public Mobile User{ get; }
|
||||
public VirtualCheck Check{ get; private set; }
|
||||
|
||||
public override void OnServerClose(NetState owner)
|
||||
{
|
||||
base.OnServerClose(owner);
|
||||
|
||||
if (Check != null && !Check.Deleted) Check.UpdateTrade(User);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
User.CloseGump(GetType());
|
||||
|
||||
if (Check != null && !Check.Deleted)
|
||||
Check.UpdateTrade(User);
|
||||
else
|
||||
Check = null;
|
||||
}
|
||||
|
||||
public void Send()
|
||||
{
|
||||
if (Check != null && !Check.Deleted)
|
||||
User.SendGump(this);
|
||||
else
|
||||
Close();
|
||||
}
|
||||
|
||||
public void Refresh(bool recompile)
|
||||
{
|
||||
if (Check == null || Check.Deleted)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
if (recompile) CompileLayout();
|
||||
|
||||
Close();
|
||||
Send();
|
||||
}
|
||||
|
||||
private void CompileLayout()
|
||||
{
|
||||
if (Check == null || Check.Deleted) return;
|
||||
|
||||
Entries.ForEach(e => e.Parent = null);
|
||||
Entries.Clear();
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 400, 160, 3500);
|
||||
|
||||
// Title
|
||||
AddImageTiled(25, 35, 350, 3, 96);
|
||||
AddImage(10, 8, 113);
|
||||
AddImage(360, 8, 113);
|
||||
|
||||
string title =
|
||||
$"<BASEFONT COLOR=#{Color.DarkSlateGray.ToArgb():X}><CENTER>BANK OF {User.RawName.ToUpper()}</CENTER>";
|
||||
|
||||
AddHtml(40, 15, 320, 20, title, false, false);
|
||||
|
||||
// Platinum Row
|
||||
AddBackground(15, 60, 175, 20, 9300);
|
||||
AddBackground(20, 45, 165, 30, 9350);
|
||||
AddItem(20, 45, 3826); // Plat
|
||||
AddLabel(60, 50, 0, User.Account.TotalPlat.ToString("#,0"));
|
||||
|
||||
AddButton(195, 50, 95, 95, (int)Buttons.AllPlat, GumpButtonType.Reply, 0); // ->
|
||||
|
||||
AddBackground(210, 60, 175, 20, 9300);
|
||||
AddBackground(215, 45, 165, 30, 9350);
|
||||
AddTextEntry(225, 50, 145, 20, 0, 0, _Plat.ToString(), User.Account.TotalPlat.ToString().Length);
|
||||
|
||||
// Gold Row
|
||||
AddBackground(15, 100, 175, 20, 9300);
|
||||
AddBackground(20, 85, 165, 30, 9350);
|
||||
AddItem(20, 85, 3823); // Gold
|
||||
AddLabel(60, 90, 0, User.Account.TotalGold.ToString("#,0"));
|
||||
|
||||
AddButton(195, 90, 95, 95, (int)Buttons.AllGold, GumpButtonType.Reply, 0); // ->
|
||||
|
||||
AddBackground(210, 100, 175, 20, 9300);
|
||||
AddBackground(215, 85, 165, 30, 9350);
|
||||
AddTextEntry(225, 90, 145, 20, 0, 1, _Gold.ToString(), User.Account.TotalGold.ToString().Length);
|
||||
|
||||
// Buttons
|
||||
AddButton(20, 128, 12006, 12007, (int)Buttons.Close, GumpButtonType.Reply, 0);
|
||||
AddButton(215, 128, 12003, 12004, (int)Buttons.Clear, GumpButtonType.Reply, 0);
|
||||
AddButton(305, 128, 12000, 12002, (int)Buttons.Accept, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (Check == null || Check.Deleted || sender.Mobile != User)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
bool refresh = false, updated = false;
|
||||
|
||||
switch ((Buttons)info.ButtonID)
|
||||
{
|
||||
case Buttons.Close:
|
||||
break;
|
||||
case Buttons.Clear:
|
||||
{
|
||||
_Plat = _Gold = 0;
|
||||
refresh = true;
|
||||
}
|
||||
break;
|
||||
case Buttons.Accept:
|
||||
{
|
||||
string platText = info.GetTextEntry(0).Text;
|
||||
string goldText = info.GetTextEntry(1).Text;
|
||||
|
||||
if (!int.TryParse(platText, out _Plat))
|
||||
{
|
||||
User.SendMessage("That is not a valid amount of platinum.");
|
||||
refresh = true;
|
||||
}
|
||||
else if (!int.TryParse(goldText, out _Gold))
|
||||
{
|
||||
User.SendMessage("That is not a valid amount of gold.");
|
||||
refresh = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
int totalPlat = User.Account.TotalPlat;
|
||||
int totalGold = User.Account.TotalGold;
|
||||
|
||||
if (totalPlat < _Plat || totalGold < _Gold)
|
||||
{
|
||||
_Plat = User.Account.TotalPlat;
|
||||
_Gold = User.Account.TotalGold;
|
||||
User.SendMessage("You do not have that much currency.");
|
||||
refresh = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Check.Plat = _Plat;
|
||||
Check.Gold = _Gold;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Buttons.AllPlat:
|
||||
{
|
||||
_Plat = User.Account.TotalPlat;
|
||||
refresh = true;
|
||||
}
|
||||
break;
|
||||
case Buttons.AllGold:
|
||||
{
|
||||
_Gold = User.Account.TotalGold;
|
||||
refresh = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (updated) User.SendMessage("Your offer has been updated.");
|
||||
|
||||
if (refresh && Check != null && !Check.Deleted)
|
||||
{
|
||||
Refresh(true);
|
||||
return;
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -22,151 +22,151 @@ using Server.Network;
|
|||
|
||||
namespace Server
|
||||
{
|
||||
public abstract class BaseHairInfo
|
||||
{
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int ItemID { get; set; }
|
||||
public abstract class BaseHairInfo
|
||||
{
|
||||
protected BaseHairInfo(int itemid)
|
||||
: this(itemid, 0)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Hue { get; set; }
|
||||
protected BaseHairInfo(int itemid, int hue)
|
||||
{
|
||||
ItemID = itemid;
|
||||
Hue = hue;
|
||||
}
|
||||
|
||||
protected BaseHairInfo( int itemid )
|
||||
: this( itemid, 0 )
|
||||
{
|
||||
}
|
||||
protected BaseHairInfo(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
|
||||
protected BaseHairInfo( int itemid, int hue )
|
||||
{
|
||||
ItemID = itemid;
|
||||
Hue = hue;
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
ItemID = reader.ReadInt();
|
||||
Hue = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected BaseHairInfo( GenericReader reader )
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int ItemID{ get; set; }
|
||||
|
||||
switch( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
ItemID = reader.ReadInt();
|
||||
Hue = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Hue{ get; set; }
|
||||
|
||||
public virtual void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.Write( (int)0 ); //version
|
||||
writer.Write( (int)ItemID );
|
||||
writer.Write( (int)Hue );
|
||||
}
|
||||
}
|
||||
public virtual void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.Write(0); //version
|
||||
writer.Write(ItemID);
|
||||
writer.Write(Hue);
|
||||
}
|
||||
}
|
||||
|
||||
public class HairInfo : BaseHairInfo
|
||||
{
|
||||
public HairInfo( int itemid )
|
||||
: base( itemid, 0 )
|
||||
{
|
||||
}
|
||||
public class HairInfo : BaseHairInfo
|
||||
{
|
||||
public HairInfo(int itemid)
|
||||
: base(itemid, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public HairInfo( int itemid, int hue )
|
||||
: base( itemid, hue )
|
||||
{
|
||||
}
|
||||
public HairInfo(int itemid, int hue)
|
||||
: base(itemid, hue)
|
||||
{
|
||||
}
|
||||
|
||||
public HairInfo( GenericReader reader )
|
||||
: base( reader )
|
||||
{
|
||||
}
|
||||
public HairInfo(GenericReader reader)
|
||||
: base(reader)
|
||||
{
|
||||
}
|
||||
|
||||
public static int FakeSerial( Mobile parent )
|
||||
{
|
||||
return (0x7FFFFFFF - 0x400 - (parent.Serial * 4));
|
||||
}
|
||||
}
|
||||
public static int FakeSerial(Mobile parent)
|
||||
{
|
||||
return 0x7FFFFFFF - 0x400 - parent.Serial * 4;
|
||||
}
|
||||
}
|
||||
|
||||
public class FacialHairInfo : BaseHairInfo
|
||||
{
|
||||
public FacialHairInfo( int itemid )
|
||||
: base( itemid, 0 )
|
||||
{
|
||||
}
|
||||
public class FacialHairInfo : BaseHairInfo
|
||||
{
|
||||
public FacialHairInfo(int itemid)
|
||||
: base(itemid, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public FacialHairInfo( int itemid, int hue )
|
||||
: base( itemid, hue )
|
||||
{
|
||||
}
|
||||
public FacialHairInfo(int itemid, int hue)
|
||||
: base(itemid, hue)
|
||||
{
|
||||
}
|
||||
|
||||
public FacialHairInfo( GenericReader reader )
|
||||
: base( reader )
|
||||
{
|
||||
}
|
||||
public FacialHairInfo(GenericReader reader)
|
||||
: base(reader)
|
||||
{
|
||||
}
|
||||
|
||||
public static int FakeSerial( Mobile parent )
|
||||
{
|
||||
return (0x7FFFFFFF - 0x400 - 1 - (parent.Serial * 4));
|
||||
}
|
||||
}
|
||||
public static int FakeSerial(Mobile parent)
|
||||
{
|
||||
return 0x7FFFFFFF - 0x400 - 1 - parent.Serial * 4;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class HairEquipUpdate : Packet
|
||||
{
|
||||
public HairEquipUpdate( Mobile parent )
|
||||
: base( 0x2E, 15 )
|
||||
{
|
||||
int hue = parent.HairHue;
|
||||
public sealed class HairEquipUpdate : Packet
|
||||
{
|
||||
public HairEquipUpdate(Mobile parent)
|
||||
: base(0x2E, 15)
|
||||
{
|
||||
int hue = parent.HairHue;
|
||||
|
||||
if ( parent.SolidHueOverride >= 0 )
|
||||
hue = parent.SolidHueOverride;
|
||||
if (parent.SolidHueOverride >= 0)
|
||||
hue = parent.SolidHueOverride;
|
||||
|
||||
int hairSerial = HairInfo.FakeSerial( parent );
|
||||
int hairSerial = HairInfo.FakeSerial(parent);
|
||||
|
||||
m_Stream.Write( (int)hairSerial );
|
||||
m_Stream.Write( (short)parent.HairItemID );
|
||||
m_Stream.Write( (byte)0 );
|
||||
m_Stream.Write( (byte)Layer.Hair );
|
||||
m_Stream.Write( (int)parent.Serial );
|
||||
m_Stream.Write( (short)hue );
|
||||
}
|
||||
}
|
||||
m_Stream.Write(hairSerial);
|
||||
m_Stream.Write((short)parent.HairItemID);
|
||||
m_Stream.Write((byte)0);
|
||||
m_Stream.Write((byte)Layer.Hair);
|
||||
m_Stream.Write(parent.Serial);
|
||||
m_Stream.Write((short)hue);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class FacialHairEquipUpdate : Packet
|
||||
{
|
||||
public FacialHairEquipUpdate( Mobile parent )
|
||||
: base( 0x2E, 15 )
|
||||
{
|
||||
int hue = parent.FacialHairHue;
|
||||
public sealed class FacialHairEquipUpdate : Packet
|
||||
{
|
||||
public FacialHairEquipUpdate(Mobile parent)
|
||||
: base(0x2E, 15)
|
||||
{
|
||||
int hue = parent.FacialHairHue;
|
||||
|
||||
if ( parent.SolidHueOverride >= 0 )
|
||||
hue = parent.SolidHueOverride;
|
||||
if (parent.SolidHueOverride >= 0)
|
||||
hue = parent.SolidHueOverride;
|
||||
|
||||
int hairSerial = FacialHairInfo.FakeSerial( parent );
|
||||
int hairSerial = FacialHairInfo.FakeSerial(parent);
|
||||
|
||||
m_Stream.Write( (int)hairSerial );
|
||||
m_Stream.Write( (short)parent.FacialHairItemID );
|
||||
m_Stream.Write( (byte)0 );
|
||||
m_Stream.Write( (byte)Layer.FacialHair );
|
||||
m_Stream.Write( (int)parent.Serial );
|
||||
m_Stream.Write( (short)hue );
|
||||
}
|
||||
}
|
||||
m_Stream.Write(hairSerial);
|
||||
m_Stream.Write((short)parent.FacialHairItemID);
|
||||
m_Stream.Write((byte)0);
|
||||
m_Stream.Write((byte)Layer.FacialHair);
|
||||
m_Stream.Write(parent.Serial);
|
||||
m_Stream.Write((short)hue);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class RemoveHair : Packet
|
||||
{
|
||||
public RemoveHair( Mobile parent )
|
||||
: base( 0x1D, 5 )
|
||||
{
|
||||
m_Stream.Write( (int)HairInfo.FakeSerial( parent ) );
|
||||
}
|
||||
}
|
||||
public sealed class RemoveHair : Packet
|
||||
{
|
||||
public RemoveHair(Mobile parent)
|
||||
: base(0x1D, 5)
|
||||
{
|
||||
m_Stream.Write(HairInfo.FakeSerial(parent));
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class RemoveFacialHair : Packet
|
||||
{
|
||||
public RemoveFacialHair( Mobile parent )
|
||||
: base( 0x1D, 5 )
|
||||
{
|
||||
m_Stream.Write( (int)FacialHairInfo.FakeSerial( parent ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
public sealed class RemoveFacialHair : Packet
|
||||
{
|
||||
public RemoveFacialHair(Mobile parent)
|
||||
: base(0x1D, 5)
|
||||
{
|
||||
m_Stream.Write(FacialHairInfo.FakeSerial(parent));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue