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,179 +1,177 @@
|
|||
using Server.Regions;
|
||||
using Server.Targeting;
|
||||
using Server.Engines.CannedEvil;
|
||||
using Server.Network;
|
||||
using Server.Regions;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public abstract class BaseBoatDeed : Item
|
||||
{
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int MultiID { get; set; }
|
||||
public abstract class BaseBoatDeed : Item
|
||||
{
|
||||
public BaseBoatDeed(int id, Point3D offset) : base(0x14F2)
|
||||
{
|
||||
Weight = 1.0;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D Offset { get; set; }
|
||||
if (!Core.AOS)
|
||||
LootType = LootType.Newbied;
|
||||
|
||||
public BaseBoatDeed( int id, Point3D offset ) : base( 0x14F2 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
MultiID = id;
|
||||
Offset = offset;
|
||||
}
|
||||
|
||||
if ( !Core.AOS )
|
||||
LootType = LootType.Newbied;
|
||||
public BaseBoatDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
MultiID = id;
|
||||
Offset = offset;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int MultiID{ get; set; }
|
||||
|
||||
public BaseBoatDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Point3D Offset{ get; set; }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public abstract BaseBoat Boat{ get; }
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( MultiID );
|
||||
writer.Write( Offset );
|
||||
}
|
||||
writer.Write(0); // version
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
writer.Write(MultiID);
|
||||
writer.Write(Offset);
|
||||
}
|
||||
|
||||
int version = reader.ReadInt();
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
MultiID = reader.ReadInt();
|
||||
Offset = reader.ReadPoint3D();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
MultiID = reader.ReadInt();
|
||||
Offset = reader.ReadPoint3D();
|
||||
|
||||
if ( Weight == 0.0 )
|
||||
Weight = 1.0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
else if ( from.AccessLevel < AccessLevel.GameMaster && (from.Map == Map.Ilshenar || from.Map == Map.Malas) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1010567, null, 0x25 ); // You may not place a boat from this location.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( Core.SE )
|
||||
from.SendLocalizedMessage( 502482 ); // Where do you wish to place the ship?
|
||||
else
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502482 ); // Where do you wish to place the ship?
|
||||
if (Weight == 0.0)
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
from.Target = new InternalTarget( this );
|
||||
}
|
||||
}
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
else if (from.AccessLevel < AccessLevel.GameMaster && (from.Map == Map.Ilshenar || from.Map == Map.Malas))
|
||||
{
|
||||
from.SendLocalizedMessage(1010567, null, 0x25); // You may not place a boat from this location.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Core.SE)
|
||||
from.SendLocalizedMessage(502482); // Where do you wish to place the ship?
|
||||
else
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 502482); // Where do you wish to place the ship?
|
||||
|
||||
public abstract BaseBoat Boat{ get; }
|
||||
from.Target = new InternalTarget(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPlacement( Mobile from, Point3D p )
|
||||
{
|
||||
if ( Deleted )
|
||||
{
|
||||
return;
|
||||
}
|
||||
public void OnPlacement(Mobile from, Point3D p)
|
||||
{
|
||||
if (Deleted) return;
|
||||
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
else
|
||||
{
|
||||
Map map = from.Map;
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
else
|
||||
{
|
||||
Map map = from.Map;
|
||||
|
||||
if ( map == null )
|
||||
return;
|
||||
if (map == null)
|
||||
return;
|
||||
|
||||
if ( from.AccessLevel < AccessLevel.GameMaster && (map == Map.Ilshenar || map == Map.Malas) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1043284 ); // A ship can not be created here.
|
||||
return;
|
||||
}
|
||||
if (from.AccessLevel < AccessLevel.GameMaster && (map == Map.Ilshenar || map == Map.Malas))
|
||||
{
|
||||
from.SendLocalizedMessage(1043284); // A ship can not be created here.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( from.Region.IsPartOf( typeof( HouseRegion ) ) || BaseBoat.FindBoatAt( from, from.Map ) != null )
|
||||
{
|
||||
from.SendLocalizedMessage( 1010568, null, 0x25 ); // You may not place a ship while on another ship or inside a house.
|
||||
return;
|
||||
}
|
||||
if (from.Region.IsPartOf(typeof(HouseRegion)) || BaseBoat.FindBoatAt(from, from.Map) != null)
|
||||
{
|
||||
from.SendLocalizedMessage(1010568, null,
|
||||
0x25); // You may not place a ship while on another ship or inside a house.
|
||||
return;
|
||||
}
|
||||
|
||||
BaseBoat boat = Boat;
|
||||
BaseBoat boat = Boat;
|
||||
|
||||
if ( boat == null )
|
||||
return;
|
||||
if (boat == null)
|
||||
return;
|
||||
|
||||
p = new Point3D( p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z );
|
||||
p = new Point3D(p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z);
|
||||
|
||||
if ( BaseBoat.IsValidLocation( p, map ) && boat.CanFit( p, map, boat.ItemID ) )
|
||||
{
|
||||
Delete();
|
||||
if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, boat.ItemID))
|
||||
{
|
||||
Delete();
|
||||
|
||||
boat.Owner = from;
|
||||
boat.Anchored = true;
|
||||
boat.Owner = from;
|
||||
boat.Anchored = true;
|
||||
|
||||
uint keyValue = boat.CreateKeys( from );
|
||||
uint keyValue = boat.CreateKeys(from);
|
||||
|
||||
if ( boat.PPlank != null )
|
||||
boat.PPlank.KeyValue = keyValue;
|
||||
if (boat.PPlank != null)
|
||||
boat.PPlank.KeyValue = keyValue;
|
||||
|
||||
if ( boat.SPlank != null )
|
||||
boat.SPlank.KeyValue = keyValue;
|
||||
if (boat.SPlank != null)
|
||||
boat.SPlank.KeyValue = keyValue;
|
||||
|
||||
boat.MoveToWorld( p, map );
|
||||
}
|
||||
else
|
||||
{
|
||||
boat.Delete();
|
||||
from.SendLocalizedMessage( 1043284 ); // A ship can not be created here.
|
||||
}
|
||||
}
|
||||
}
|
||||
boat.MoveToWorld(p, map);
|
||||
}
|
||||
else
|
||||
{
|
||||
boat.Delete();
|
||||
from.SendLocalizedMessage(1043284); // A ship can not be created here.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : MultiTarget
|
||||
{
|
||||
private BaseBoatDeed m_Deed;
|
||||
private class InternalTarget : MultiTarget
|
||||
{
|
||||
private BaseBoatDeed m_Deed;
|
||||
|
||||
public InternalTarget( BaseBoatDeed deed ) : base( deed.MultiID, deed.Offset )
|
||||
{
|
||||
m_Deed = deed;
|
||||
}
|
||||
public InternalTarget(BaseBoatDeed deed) : base(deed.MultiID, deed.Offset)
|
||||
{
|
||||
m_Deed = deed;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object o )
|
||||
{
|
||||
IPoint3D ip = o as IPoint3D;
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
IPoint3D ip = o as IPoint3D;
|
||||
|
||||
if ( ip != null )
|
||||
{
|
||||
if ( ip is Item )
|
||||
ip = ((Item)ip).GetWorldTop();
|
||||
if (ip != null)
|
||||
{
|
||||
if (ip is Item)
|
||||
ip = ((Item)ip).GetWorldTop();
|
||||
|
||||
Point3D p = new Point3D( ip );
|
||||
Point3D p = new Point3D(ip);
|
||||
|
||||
Region region = Region.Find( p, from.Map );
|
||||
Region region = Region.Find(p, from.Map);
|
||||
|
||||
if ( region.IsPartOf( typeof( DungeonRegion ) ) )
|
||||
from.SendLocalizedMessage( 502488 ); // You can not place a ship inside a dungeon.
|
||||
else if ( region.IsPartOf( typeof( HouseRegion ) ) || region.IsPartOf( typeof( ChampionSpawnRegion ) ) )
|
||||
from.SendLocalizedMessage( 1042549 ); // A boat may not be placed in this area.
|
||||
else
|
||||
m_Deed.OnPlacement( from, p );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (region.IsPartOf(typeof(DungeonRegion)))
|
||||
from.SendLocalizedMessage(502488); // You can not place a ship inside a dungeon.
|
||||
else if (region.IsPartOf(typeof(HouseRegion)) || region.IsPartOf(typeof(ChampionSpawnRegion)))
|
||||
from.SendLocalizedMessage(1042549); // A boat may not be placed in this area.
|
||||
else
|
||||
m_Deed.OnPlacement(from, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue