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
|
|
@ -1,126 +1,128 @@
|
|||
using Server.Multis;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flippable( 0x14F0, 0x14EF )]
|
||||
public abstract class BaseAddonDeed : Item
|
||||
{
|
||||
public abstract BaseAddon Addon{ get;
|
||||
}
|
||||
[Flippable(0x14F0, 0x14EF)]
|
||||
public abstract class BaseAddonDeed : Item
|
||||
{
|
||||
public BaseAddonDeed() : base(0x14F0)
|
||||
{
|
||||
Weight = 1.0;
|
||||
|
||||
#region Mondain's Legacy
|
||||
private CraftResource m_Resource;
|
||||
if (!Core.AOS)
|
||||
LootType = LootType.Newbied;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CraftResource Resource
|
||||
{
|
||||
get => m_Resource;
|
||||
set
|
||||
{
|
||||
if ( m_Resource != value )
|
||||
{
|
||||
m_Resource = value;
|
||||
Hue = CraftResources.GetHue( m_Resource );
|
||||
public BaseAddonDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
public abstract BaseAddon Addon{ get; }
|
||||
|
||||
public BaseAddonDeed() : base( 0x14F0 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
if ( !Core.AOS )
|
||||
LootType = LootType.Newbied;
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public BaseAddonDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
int version = reader.ReadInt();
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
if (Weight == 0.0)
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack))
|
||||
from.Target = new InternalTarget(this);
|
||||
else
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
|
||||
int version = reader.ReadInt();
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private BaseAddonDeed m_Deed;
|
||||
|
||||
if ( Weight == 0.0 )
|
||||
Weight = 1.0;
|
||||
}
|
||||
public InternalTarget(BaseAddonDeed deed) : base(-1, true, TargetFlags.None)
|
||||
{
|
||||
m_Deed = deed;
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsChildOf( from.Backpack ) )
|
||||
from.Target = new InternalTarget( this );
|
||||
else
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
CheckLOS = false;
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private BaseAddonDeed m_Deed;
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
IPoint3D p = targeted as IPoint3D;
|
||||
Map map = from.Map;
|
||||
|
||||
public InternalTarget( BaseAddonDeed deed ) : base( -1, true, TargetFlags.None )
|
||||
{
|
||||
m_Deed = deed;
|
||||
if (p == null || map == null || m_Deed.Deleted)
|
||||
return;
|
||||
|
||||
CheckLOS = false;
|
||||
}
|
||||
if (m_Deed.IsChildOf(from.Backpack))
|
||||
{
|
||||
BaseAddon addon = m_Deed.Addon;
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
IPoint3D p = targeted as IPoint3D;
|
||||
Map map = from.Map;
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
||||
if ( p == null || map == null || m_Deed.Deleted )
|
||||
return;
|
||||
BaseHouse house = null;
|
||||
|
||||
if ( m_Deed.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
BaseAddon addon = m_Deed.Addon;
|
||||
AddonFitResult res = addon.CouldFit(p, map, from, ref house);
|
||||
|
||||
Spells.SpellHelper.GetSurfaceTop( ref p );
|
||||
if (res == AddonFitResult.Valid)
|
||||
addon.MoveToWorld(new Point3D(p), map);
|
||||
else if (res == AddonFitResult.Blocked)
|
||||
from.SendLocalizedMessage(500269); // You cannot build that there.
|
||||
else if (res == AddonFitResult.NotInHouse)
|
||||
from.SendLocalizedMessage(500274); // You can only place this in a house that you own!
|
||||
else if (res == AddonFitResult.DoorTooClose)
|
||||
from.SendLocalizedMessage(500271); // You cannot build near the door.
|
||||
else if (res == AddonFitResult.NoWall)
|
||||
from.SendLocalizedMessage(500268); // This object needs to be mounted on something.
|
||||
|
||||
BaseHouse house = null;
|
||||
if (res == AddonFitResult.Valid)
|
||||
{
|
||||
m_Deed.Delete();
|
||||
house.Addons.Add(addon);
|
||||
}
|
||||
else
|
||||
{
|
||||
addon.Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AddonFitResult res = addon.CouldFit( p, map, from, ref house );
|
||||
#region Mondain's Legacy
|
||||
|
||||
if ( res == AddonFitResult.Valid )
|
||||
addon.MoveToWorld( new Point3D( p ), map );
|
||||
else if ( res == AddonFitResult.Blocked )
|
||||
from.SendLocalizedMessage( 500269 ); // You cannot build that there.
|
||||
else if ( res == AddonFitResult.NotInHouse )
|
||||
from.SendLocalizedMessage( 500274 ); // You can only place this in a house that you own!
|
||||
else if ( res == AddonFitResult.DoorTooClose )
|
||||
from.SendLocalizedMessage( 500271 ); // You cannot build near the door.
|
||||
else if ( res == AddonFitResult.NoWall )
|
||||
from.SendLocalizedMessage( 500268 ); // This object needs to be mounted on something.
|
||||
|
||||
if ( res == AddonFitResult.Valid )
|
||||
{
|
||||
m_Deed.Delete();
|
||||
house.Addons.Add( addon );
|
||||
}
|
||||
else
|
||||
{
|
||||
addon.Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private CraftResource m_Resource;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public CraftResource Resource
|
||||
{
|
||||
get => m_Resource;
|
||||
set
|
||||
{
|
||||
if (m_Resource != value)
|
||||
{
|
||||
m_Resource = value;
|
||||
Hue = CraftResources.GetHue(m_Resource);
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue