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
|
|
@ -5,125 +5,122 @@ using Server.Multis;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class CharacterStatuePlinth : Static, IAddon
|
||||
{
|
||||
public Item Deed => new CharacterStatueDeed( m_Statue );
|
||||
public override int LabelNumber => 1076201; // Character Statue
|
||||
public class CharacterStatuePlinth : Static, IAddon
|
||||
{
|
||||
private CharacterStatue m_Statue;
|
||||
|
||||
private CharacterStatue m_Statue;
|
||||
public CharacterStatuePlinth(CharacterStatue statue) : base(0x32F2)
|
||||
{
|
||||
m_Statue = statue;
|
||||
|
||||
public CharacterStatuePlinth( CharacterStatue statue ) : base( 0x32F2 )
|
||||
{
|
||||
m_Statue = statue;
|
||||
InvalidateHue();
|
||||
}
|
||||
|
||||
InvalidateHue();
|
||||
}
|
||||
public CharacterStatuePlinth(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public CharacterStatuePlinth( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1076201; // Character Statue
|
||||
public Item Deed => new CharacterStatueDeed(m_Statue);
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
public virtual bool CouldFit(IPoint3D p, Map map)
|
||||
{
|
||||
Point3D point = new Point3D(p.X, p.Y, p.Z);
|
||||
|
||||
if ( m_Statue != null && !m_Statue.Deleted )
|
||||
m_Statue.Delete();
|
||||
}
|
||||
if (map == null || !map.CanFit(point, 20))
|
||||
return false;
|
||||
|
||||
public override void OnMapChange()
|
||||
{
|
||||
if ( m_Statue != null )
|
||||
m_Statue.Map = Map;
|
||||
}
|
||||
BaseHouse house = BaseHouse.FindHouseAt(point, map, 20);
|
||||
|
||||
public override void OnLocationChange( Point3D oldLocation )
|
||||
{
|
||||
if ( m_Statue != null )
|
||||
m_Statue.Location = new Point3D( X, Y, Z + 5 );
|
||||
}
|
||||
if (house == null)
|
||||
return false;
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( m_Statue != null )
|
||||
from.SendGump( new CharacterPlinthGump( m_Statue ) );
|
||||
}
|
||||
AddonFitResult result = CharacterStatueTarget.CheckDoors(point, 20, house);
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
if (result == AddonFitResult.Valid)
|
||||
return true;
|
||||
|
||||
writer.WriteEncodedInt( (int) 0 ); // version
|
||||
return false;
|
||||
}
|
||||
|
||||
writer.Write( (Mobile) m_Statue );
|
||||
}
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
if (m_Statue != null && !m_Statue.Deleted)
|
||||
m_Statue.Delete();
|
||||
}
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
public override void OnMapChange()
|
||||
{
|
||||
if (m_Statue != null)
|
||||
m_Statue.Map = Map;
|
||||
}
|
||||
|
||||
m_Statue = reader.ReadMobile() as CharacterStatue;
|
||||
public override void OnLocationChange(Point3D oldLocation)
|
||||
{
|
||||
if (m_Statue != null)
|
||||
m_Statue.Location = new Point3D(X, Y, Z + 5);
|
||||
}
|
||||
|
||||
if ( m_Statue?.SculptedBy == null || Map == Map.Internal )
|
||||
{
|
||||
Timer.DelayCall( TimeSpan.Zero, Delete );
|
||||
}
|
||||
}
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (m_Statue != null)
|
||||
from.SendGump(new CharacterPlinthGump(m_Statue));
|
||||
}
|
||||
|
||||
public void InvalidateHue()
|
||||
{
|
||||
if ( m_Statue != null )
|
||||
Hue = 0xB8F + (int) m_Statue.StatueType * 4 + (int) m_Statue.Material;
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
public virtual bool CouldFit( IPoint3D p, Map map )
|
||||
{
|
||||
Point3D point = new Point3D( p.X, p.Y, p.Z );
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
if ( map == null || !map.CanFit( point, 20 ) )
|
||||
return false;
|
||||
writer.Write(m_Statue);
|
||||
}
|
||||
|
||||
BaseHouse house = BaseHouse.FindHouseAt( point, map, 20 );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
if ( house == null )
|
||||
return false;
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
AddonFitResult result = CharacterStatueTarget.CheckDoors( point, 20, house );
|
||||
m_Statue = reader.ReadMobile() as CharacterStatue;
|
||||
|
||||
if ( result == AddonFitResult.Valid )
|
||||
return true;
|
||||
if (m_Statue?.SculptedBy == null || Map == Map.Internal) Timer.DelayCall(TimeSpan.Zero, Delete);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public void InvalidateHue()
|
||||
{
|
||||
if (m_Statue != null)
|
||||
Hue = 0xB8F + (int)m_Statue.StatueType * 4 + (int)m_Statue.Material;
|
||||
}
|
||||
|
||||
private class CharacterPlinthGump : Gump
|
||||
{
|
||||
public CharacterPlinthGump( CharacterStatue statue ) : base( 60, 30 )
|
||||
{
|
||||
Closable = true;
|
||||
Disposable = true;
|
||||
Dragable = true;
|
||||
Resizable = false;
|
||||
private class CharacterPlinthGump : Gump
|
||||
{
|
||||
public CharacterPlinthGump(CharacterStatue statue) : base(60, 30)
|
||||
{
|
||||
Closable = true;
|
||||
Disposable = true;
|
||||
Dragable = true;
|
||||
Resizable = false;
|
||||
|
||||
AddPage( 0 );
|
||||
AddImage( 0, 0, 0x24F4 );
|
||||
AddHtml( 55, 50, 150, 20, statue.Name, false, false );
|
||||
AddHtml( 55, 75, 150, 20, statue.SculptedOn.ToString(), false, false );
|
||||
AddHtmlLocalized( 55, 100, 150, 20, GetTypeNumber( statue.StatueType ), 0, false, false );
|
||||
}
|
||||
AddPage(0);
|
||||
AddImage(0, 0, 0x24F4);
|
||||
AddHtml(55, 50, 150, 20, statue.Name, false, false);
|
||||
AddHtml(55, 75, 150, 20, statue.SculptedOn.ToString(), false, false);
|
||||
AddHtmlLocalized(55, 100, 150, 20, GetTypeNumber(statue.StatueType), 0, false, false);
|
||||
}
|
||||
|
||||
public int GetTypeNumber( StatueType type )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case StatueType.Marble: return 1076181;
|
||||
case StatueType.Jade: return 1076180;
|
||||
case StatueType.Bronze: return 1076230;
|
||||
default: return 1076181;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public int GetTypeNumber(StatueType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case StatueType.Marble: return 1076181;
|
||||
case StatueType.Jade: return 1076180;
|
||||
case StatueType.Bronze: return 1076230;
|
||||
default: return 1076181;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue