#W# Initial Commit: Avatars Conquest

This commit is contained in:
WarrentyExpired 2026-07-04 10:35:30 -04:00
commit 5df497787a
7510 changed files with 416048 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,173 @@
using System;
using Server;
using Server.Regions;
using Server.Targeting;
using Server.Network;
namespace Server.Multis
{
public abstract class BaseBoatDeed : Item
{
private int m_MultiID;
private Point3D m_Offset;
[CommandProperty( AccessLevel.GameMaster )]
public int MultiID{ get{ return m_MultiID; } set{ m_MultiID = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public Point3D Offset{ get{ return m_Offset; } set{ m_Offset = value; } }
public BaseBoatDeed( int id, Point3D offset ) : base( 0x14F2 )
{
Weight = 1.0;
m_MultiID = id;
m_Offset = offset;
}
public BaseBoatDeed( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( m_MultiID );
writer.Write( m_Offset );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
m_MultiID = reader.ReadInt();
m_Offset = reader.ReadPoint3D();
break;
}
}
if ( Weight == 0.0 )
Weight = 1.0;
}
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 ( !BaseBoat.NearDock( from ) )
{
from.SendMessage( "You cannot launch a ship here" );
}
else
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502482 ); // Where do you wish to place the ship?
from.Target = new InternalTarget( this );
}
}
public abstract BaseBoat Boat{ get; }
public void OnPlacement( Mobile from, Point3D p )
{
if ( Deleted )
{
return;
}
else if ( !IsChildOf( from.Backpack ) )
{
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
else if ( !BaseBoat.NearDock( from ) )
{
from.SendMessage( "You cannot launch a ship here" );
}
else
{
Map map = from.Map;
if ( map == null )
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;
if ( boat == null )
return;
p = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z );
if ( BaseBoat.IsValidLocation( p, map ) && boat.CanFit( p, map, boat.ItemID ) )
{
Delete();
boat.Owner = from;
boat.Anchored = true;
uint keyValue = boat.CreateKeys( from );
if ( boat.PPlank != null )
boat.PPlank.KeyValue = keyValue;
if ( boat.SPlank != null )
boat.SPlank.KeyValue = keyValue;
boat.MoveToWorld( p, map );
Effects.PlaySound( from.Location, from.Map, 0x026 );
}
else
{
boat.Delete();
from.SendLocalizedMessage( 1043284 ); // A ship can not be created here.
}
}
}
private class InternalTarget : MultiTarget
{
private BaseBoatDeed m_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;
if ( ip != null )
{
if ( ip is Item )
ip = ((Item)ip).GetWorldTop();
Point3D p = new Point3D( ip );
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
m_Deed.OnPlacement( from, p );
}
}
}
}
}

View file

@ -0,0 +1,196 @@
using System;
using Server;
using Server.Regions;
using Server.Targeting;
namespace Server.Multis
{
public abstract class BaseDockedBoat : Item
{
private int m_MultiID;
private Point3D m_Offset;
private string m_ShipName;
[CommandProperty( AccessLevel.GameMaster )]
public int MultiID{ get{ return m_MultiID; } set{ m_MultiID = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public Point3D Offset{ get{ return m_Offset; } set{ m_Offset = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public string ShipName{ get{ return m_ShipName; } set{ m_ShipName = value; InvalidateProperties(); } }
public BaseDockedBoat( int id, Point3D offset, BaseBoat boat ) : base( 0x14F4 )
{
Weight = 1.0;
m_MultiID = id;
m_Offset = offset;
m_ShipName = boat.ShipName;
}
public BaseDockedBoat( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 1 ); // version
writer.Write( m_MultiID );
writer.Write( m_Offset );
writer.Write( m_ShipName );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 1:
case 0:
{
m_MultiID = reader.ReadInt();
m_Offset = reader.ReadPoint3D();
m_ShipName = reader.ReadString();
if ( version == 0 )
reader.ReadUInt();
break;
}
}
if ( Weight == 0.0 )
Weight = 1.0;
}
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 ( !BaseBoat.NearDock( from ) )
{
from.SendMessage( "You cannot launch a ship here" );
}
else
{
from.SendLocalizedMessage( 502482 ); // Where do you wish to place the ship?
from.Target = new InternalTarget( this );
}
}
public abstract BaseBoat Boat{ get; }
public override void AddNameProperty( ObjectPropertyList list )
{
if ( m_ShipName != null )
list.Add( m_ShipName );
else
base.AddNameProperty( list );
}
public override void OnSingleClick( Mobile from )
{
if ( m_ShipName != null )
LabelTo( from, m_ShipName );
else
base.OnSingleClick( from );
}
public void OnPlacement( Mobile from, Point3D p )
{
if ( Deleted )
{
return;
}
else if ( !IsChildOf( from.Backpack ) )
{
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
else if ( !BaseBoat.NearDock( from ) )
{
from.SendMessage( "You cannot launch a ship here" );
}
else
{
Map map = from.Map;
if ( map == null )
return;
BaseBoat boat = Boat;
if ( boat == null )
return;
p = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z );
if ( BaseBoat.IsValidLocation( p, map ) && boat.CanFit( p, map, boat.ItemID ) && map != Map.Underworld )
{
Delete();
boat.Owner = from;
boat.Anchored = true;
boat.ShipName = m_ShipName;
uint keyValue = boat.CreateKeys( from );
if ( boat.PPlank != null )
boat.PPlank.KeyValue = keyValue;
if ( boat.SPlank != null )
boat.SPlank.KeyValue = keyValue;
boat.MoveToWorld( p, map );
Effects.PlaySound( from.Location, from.Map, 0x026 );
}
else
{
boat.Delete();
from.SendLocalizedMessage( 1043284 ); // A ship can not be created here.
}
}
}
private class InternalTarget : MultiTarget
{
private BaseDockedBoat m_Model;
public InternalTarget( BaseDockedBoat model ) : base( model.MultiID, model.Offset )
{
m_Model = model;
}
protected override void OnTarget( Mobile from, object o )
{
IPoint3D ip = o as IPoint3D;
if ( ip != null )
{
if ( ip is Item )
ip = ((Item)ip).GetWorldTop();
Point3D p = new Point3D( ip );
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
m_Model.OnPlacement( from, p );
}
}
}
}
}

View file

@ -0,0 +1,869 @@
using Server;
using Server.Commands;
using Server.Gumps;
using Server.Multis;
using Server.Network;
using System;
using System.Text;
namespace Server.Misc
{
public class BoatNavigationControl : Gump
{
public BoatNavigationControl(Mobile from) : base(50, 50)
{
this.Closable = true;
this.Disposable = true;
this.Dragable = true;
this.Resizable = false;
AddPage(0);
AddImage(333, 141, 9274);
AddImage(343, 152, 9274);
AddImage(222, 214, 1417);
AddImage(504, 214, 1417);
AddItem(525, 219, 5367);
AddItem(504, 262, 5368);
AddItem(242, 221, 16083);
AddImage(302, 110, 9007);
AddItem(385, 163, 15946, 795);
AddBackground(368, 199, 74, 46, 9400);
AddButton(554, 233, 5600, 5604, (int)Buttons.RaiseAnchor, GumpButtonType.Reply, 0);
AddButton(554, 261, 5606, 5606, (int)Buttons.LowerAnchor, GumpButtonType.Reply, 0);
AddButton(395, 143, 2117, 11400, (int)Buttons.NorthWest, GumpButtonType.Reply, 0);
AddButton(396, 263, 2117, 11400, (int)Buttons.SouthEast, GumpButtonType.Reply, 0);
AddButton(336, 203, 2117, 11400, (int)Buttons.SouthWest, GumpButtonType.Reply, 0);
AddButton(456, 202, 2117, 11400, (int)Buttons.NorthEast, GumpButtonType.Reply, 0);
AddButton(436, 162, 2117, 11400, (int)Buttons.North, GumpButtonType.Reply, 0);
AddButton(355, 244, 2117, 11400, (int)Buttons.South, GumpButtonType.Reply, 0);
AddButton(353, 163, 2117, 11400, (int)Buttons.West, GumpButtonType.Reply, 0);
AddButton(438, 244, 2117, 11400, (int)Buttons.East, GumpButtonType.Reply, 0);
AddButton(239, 229, 5603, 5607, (int)Buttons.PPlankControl, GumpButtonType.Reply, 0);
AddButton(275, 249, 5601, 5605, (int)Buttons.SPlankControl, GumpButtonType.Reply, 0);
AddButton(275, 249, 5601, 5605, (int)Buttons.SPlankControl, GumpButtonType.Reply, 0);
AddButton(553, 280, 4, 4, (int)Buttons.RenameShip, GumpButtonType.Reply, 0);
AddLabel(388, 212, 295, @"STOP");
AddButton(478, 244, 3, 3, (int)Buttons.Close, GumpButtonType.Reply, 0);
AddButton(571, 217, 22404, 22404, (int)Buttons.TurnRight, GumpButtonType.Reply, 0);
AddButton(476, 198, 9904, 9903, (int)Buttons.NorthEastOne, GumpButtonType.Reply, 0);
AddButton(309, 199, 9910, 9909, (int)Buttons.SouthWestOne, GumpButtonType.Reply, 0);
AddButton(392, 116, 9901, 9900, (int)Buttons.NorthWestOne, GumpButtonType.Reply, 0);
AddButton(393, 284, 9907, 9906, (int)Buttons.SouthEastOne, GumpButtonType.Reply, 0);
AddButton(217, 217, 22403, 22403, (int)Buttons.TurnLeft, GumpButtonType.Reply, 0);
AddButton(286, 278, 22400, 22400, (int)Buttons.TurnAround, GumpButtonType.Reply, 0);
AddButton(435, 215, 9762, 9763, (int)Buttons.ForwardOnCurrentHeading, GumpButtonType.Reply, 0);
AddButton(358, 215, 9766, 9767, (int)Buttons.BackwardOnCurrentHeading, GumpButtonType.Reply, 0);
}
public enum Buttons
{
DoNothing,
RaiseAnchor,
LowerAnchor,
NorthWest,
SouthEast,
SouthWest,
NorthEast,
North,
South,
West,
East,
PPlankControl,
SPlankControl,
Stop,
Close,
TurnRight,
NorthEastOne,
SouthWestOne,
NorthWestOne,
SouthEastOne,
TurnLeft,
TurnAround,
ForwardOnCurrentHeading,
BackwardOnCurrentHeading,
RenameShip
}
public override void OnResponse(NetState sender, RelayInfo info)
{
Mobile from = sender.Mobile;
BaseBoat boat = BaseBoat.FindBoatAt(from, from.Map);
if (!from.Alive && boat == null)
{
return;
}
else if (boat == null)
{
return;
}
else
{
switch (info.ButtonID)
{
case 0:
{
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.RenameShip:
{
boat.BeginRename( from );
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.RaiseAnchor:
{
from.Say("Raise The Anchor!");
boat.RaiseAnchor(true);
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.LowerAnchor:
{
from.Say("Lower The Anchor!");
boat.LowerAnchor(true);
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.NorthWest:
{
if (boat.Facing == Direction.North)
{
from.Say("Set Heading: North Northwest!!");
boat.StartMove(Direction.Up, true);
}
else if (boat.Facing != Direction.North)
{
if (boat.Facing == Direction.East)
{
switch (Utility.Random(2))
{
case 1:
{
from.Say("Set Heading: North Northwest!!");
boat.Turn(270, true);
boat.StartMove(Direction.Up, true);
break;
}
case 0:
{
from.Say("Set Heading: West Northwest!!");
boat.Turn(180, true);
boat.StartMove(Direction.Right, true);
break;
}
}
}
else if (boat.Facing == Direction.South)
{
switch (Utility.Random(2))
{
case 1:
{
from.Say("Set Heading: North Northwest!!");
boat.Turn(180, true);
boat.StartMove(Direction.Up, true);
break;
}
case 0:
{
from.Say("Set Heading: West Northwest!!");
boat.Turn(90, true);
boat.StartMove(Direction.Right, true);
break;
}
}
}
else if (boat.Facing == Direction.West)
{
switch (Utility.Random(2))
{
case 1:
{
from.Say("Set Heading: North Northwest!!");
boat.Turn(90, true);
boat.StartMove(Direction.Up, true);
break;
}
case 0:
{
from.Say("Set Heading: West Northwest!!");
boat.StartMove(Direction.Right, true);
break;
}
}
}
}
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.SouthEast:
{
if (boat.Facing == Direction.South)
{
from.Say("Set Heading: South Southeast!!");
boat.StartMove(Direction.Up, true);
}
else if (boat.Facing != Direction.South)
{
if (boat.Facing == Direction.West)
{
switch (Utility.Random(2))
{
case 1:
{
from.Say("Set Heading: South Southeast!!");
boat.Turn(270, true);
boat.StartMove(Direction.Up, true);
break;
}
case 0:
{
from.Say("Set Heading: East Southeast!!");
boat.Turn(180, true);
boat.StartMove(Direction.Right, true);
break;
}
}
}
else if (boat.Facing == Direction.North)
{
switch (Utility.Random(2))
{
case 1:
{
from.Say("Set Heading: South Southeast!!");
boat.Turn(180, true);
boat.StartMove(Direction.Up, true);
break;
}
case 0:
{
from.Say("Set Heading: East Southeast!!");
boat.Turn(90, true);
boat.StartMove(Direction.Right, true);
break;
}
}
}
else if (boat.Facing == Direction.East)
{
switch (Utility.Random(2))
{
case 1:
{
from.Say("Set Heading: South Southeast!!");
boat.Turn(90, true);
boat.StartMove(Direction.Up, true);
break;
}
case 0:
{
from.Say("Set Heading: East Southeast!!");
boat.StartMove(Direction.Right, true);
break;
}
}
}
}
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.SouthWest:
{
if (boat.Facing == Direction.South)
{
from.Say("Set Heading: South Southwest!");
boat.StartMove(Direction.Right, true);
}
else if (boat.Facing != Direction.South)
{
if (boat.Facing == Direction.West)
{
switch (Utility.Random(2))
{
case 1:
{
from.Say("Set Heading: South Southwest!!");
boat.Turn(270, true);
boat.StartMove(Direction.Right, true);
break;
}
case 0:
{
from.Say("Set Heading: West Southwest!!");
boat.StartMove(Direction.Up, true);
break;
}
}
}
else if (boat.Facing == Direction.North)
{
switch (Utility.Random(2))
{
case 1:
{
from.Say("Set Heading: South Southwest!!");
boat.Turn(180, true);
boat.StartMove(Direction.Right, true);
break;
}
case 0:
{
from.Say("Set Heading: West Southwest!!");
boat.Turn(270, true);
boat.StartMove(Direction.Up, true);
break;
}
}
}
else if (boat.Facing == Direction.East)
{
switch (Utility.Random(2))
{
case 1:
{
from.Say("Set Heading: South Southwest!!");
boat.Turn(90, true);
boat.StartMove(Direction.Right, true);
break;
}
case 0:
{
from.Say("Set Heading: West Southwest!!");
boat.Turn(180, true);
boat.StartMove(Direction.Up, true);
break;
}
}
}
}
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.NorthEast:
{
if (boat.Facing == Direction.North)
{
from.Say("Set Heading: North Northeast!");
boat.StartMove(Direction.Right, true);
}
else if (boat.Facing != Direction.North)
{
if (boat.Facing == Direction.East)
{
switch (Utility.Random(2))
{
case 1:
{
from.Say("Set Heading: North Northeast!!");
boat.Turn(270, true);
boat.StartMove(Direction.Right, true);
break;
}
case 0:
{
from.Say("Set Heading: East Northeast!!");
boat.StartMove(Direction.Up, true);
break;
}
}
}
else if (boat.Facing == Direction.South)
{
switch (Utility.Random(2))
{
case 1:
{
from.Say("Set Heading: North Northeast!!");
boat.Turn(180, true);
boat.StartMove(Direction.Right, true);
break;
}
case 0:
{
from.Say("Set Heading: East Northeast!!");
boat.Turn(270, true);
boat.StartMove(Direction.Up, true);
break;
}
}
}
else if (boat.Facing == Direction.West)
{
switch (Utility.Random(2))
{
case 1:
{
from.Say("Set Heading: North Northeast!!");
boat.Turn(90, true);
boat.StartMove(Direction.Right, true);
break;
}
case 0:
{
from.Say("Set Heading: East Northeast!!");
boat.Turn(180, true);
boat.StartMove(Direction.Up, true);
break;
}
}
}
}
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.North:
{
if (boat.Facing == Direction.North)
{
from.Say("Set Heading: Due North!!");
boat.StartMove(Direction.North, true);
}
else if (boat.Facing != Direction.North)
{
if (boat.Facing == Direction.East)
{
switch (Utility.Random(1))
{
case 0:
{
from.Say("Set Heading: Due North!!");
boat.Turn(270, true);
boat.StartMove(Direction.North, true);
break;
}
}
}
else if (boat.Facing == Direction.South)
{
switch (Utility.Random(1))
{
case 0:
{
from.Say("Set Heading: Due North!!");
boat.Turn(180, true);
boat.StartMove(Direction.North, true);
break;
}
}
}
else if (boat.Facing == Direction.West)
{
switch (Utility.Random(1))
{
case 0:
{
from.Say("Set Heading: Due North!!");
boat.Turn(90, true);
boat.StartMove(Direction.North, true);
break;
}
}
}
}
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.South:
{
if (boat.Facing == Direction.South)
{
from.Say("Set Heading: Due South!!");
boat.StartMove(Direction.North, true);
}
else if (boat.Facing != Direction.South)
{
if (boat.Facing == Direction.West)
{
switch (Utility.Random(1))
{
case 0:
{
from.Say("Set Heading: Due South!!");
boat.Turn(270, true);
boat.StartMove(Direction.North, true);
break;
}
}
}
else if (boat.Facing == Direction.North)
{
switch (Utility.Random(1))
{
case 0:
{
from.Say("Set Heading: Due South!!");
boat.Turn(180, true);
boat.StartMove(Direction.North, true);
break;
}
}
}
else if (boat.Facing == Direction.East)
{
switch (Utility.Random(1))
{
case 0:
{
from.Say("Set Heading: Due South!!");
boat.Turn(90, true);
boat.StartMove(Direction.North, true);
break;
}
}
}
}
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.West:
{
if (boat.Facing == Direction.West)
{
from.Say("Set Heading: Due West!!");
boat.StartMove(Direction.North, true);
}
else if (boat.Facing != Direction.West)
{
if (boat.Facing == Direction.North)
{
switch (Utility.Random(1))
{
case 0:
{
from.Say("Set Heading: Due West!!");
boat.Turn(270, true);
boat.StartMove(Direction.North, true);
break;
}
}
}
else if (boat.Facing == Direction.East)
{
switch (Utility.Random(1))
{
case 0:
{
from.Say("Set Heading: Due West!!");
boat.Turn(180, true);
boat.StartMove(Direction.North, true);
break;
}
}
}
else if (boat.Facing == Direction.South)
{
switch (Utility.Random(1))
{
case 0:
{
from.Say("Set Heading: Due West!!");
boat.Turn(90, true);
boat.StartMove(Direction.North, true);
break;
}
}
}
}
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.East:
{
if (boat.Facing == Direction.East)
{
from.Say("Set Heading: Due East!!");
boat.StartMove(Direction.North, true);
}
else if (boat.Facing != Direction.East)
{
if (boat.Facing == Direction.South)
{
switch (Utility.Random(1))
{
case 0:
{
from.Say("Set Heading: Due East!!");
boat.Turn(270, true);
boat.StartMove(Direction.North, true);
break;
}
}
}
else if (boat.Facing == Direction.West)
{
switch (Utility.Random(1))
{
case 0:
{
from.Say("Set Heading: Due East!!");
boat.Turn(180, true);
boat.StartMove(Direction.North, true);
break;
}
}
}
else if (boat.Facing == Direction.North)
{
switch (Utility.Random(1))
{
case 0:
{
from.Say("Set Heading: Due East!!");
boat.Turn(90, true);
boat.StartMove(Direction.North, true);
break;
}
}
}
}
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.PPlankControl:
{
from.Say("Extend The Port Plank!!");
boat.PPlank.Open();
boat.PPlank.Locked = false;
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.SPlankControl:
{
from.Say("Extend The Starboard Plank!!");
boat.SPlank.Open();
boat.SPlank.Locked = false;
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.Stop:
{
from.Say("Stop The Ship!!");
boat.StopMove(true);
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.Close:
{
from.CloseGump(typeof(BoatNavigationControl));
break;
}
case (int)Buttons.TurnRight:
{
if (boat.Facing == Direction.North)
{
from.Say("Change Course! New Heading: Due East!");
boat.Turn(90, true);
}
else if (boat.Facing != Direction.North)
{
if (boat.Facing == Direction.East)
{
from.Say("Change Course! New Heading: Due South!");
boat.Turn(90, true);
}
else if (boat.Facing == Direction.South)
{
from.Say("Change Course! New Heading: Due West!");
boat.Turn(90, true);
}
else if (boat.Facing == Direction.West)
{
from.Say("Change Course! New Heading Due North!");
boat.Turn(90, true);
}
}
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.NorthEastOne:
{
if (boat.Facing == Direction.North)
{
from.Say("Set Heading: One Right!");
boat.OneMove(Direction.East);
}
else if (boat.Facing == Direction.East)
{
from.Say("Set Heading: One Right!");
boat.OneMove(Direction.East);
}
else if (boat.Facing == Direction.South)
{
from.Say("Set Heading: One Right!");
boat.OneMove(Direction.East);
}
else if (boat.Facing == Direction.West)
{
from.Say("Set Heading: One Right!");
boat.OneMove(Direction.East);
}
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.SouthWestOne: // Left One
{
if (boat.Facing == Direction.North)
{
from.Say("Set Heading: One Left!");
boat.OneMove(Direction.West);
}
else if (boat.Facing == Direction.East)
{
from.Say("Set Heading: One Left!");
boat.OneMove(Direction.West);
}
else if (boat.Facing == Direction.South)
{
from.Say("Set Heading: One Left!");
boat.OneMove(Direction.West);
}
else if (boat.Facing == Direction.West)
{
from.Say("Set Heading: One Left!");
boat.OneMove(Direction.West);
}
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.NorthWestOne: // Forward One
{
if (boat.Facing == Direction.North)
{
from.Say("Set Heading: One Forward!");
boat.OneMove(Direction.North);
}
else if (boat.Facing == Direction.East)
{
from.Say("Set Heading: One Forward!");
boat.OneMove(Direction.North);
}
else if (boat.Facing == Direction.South)
{
from.Say("Set Heading: One Forward!");
boat.OneMove(Direction.North);
}
else if (boat.Facing == Direction.West)
{
from.Say("Set Heading: One Forward!");
boat.OneMove(Direction.North);
}
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.SouthEastOne:
{
if (boat.Facing == Direction.North)
{
from.Say("Set Heading: One Backward!");
boat.OneMove(Direction.South);
}
else if (boat.Facing == Direction.East)
{
from.Say("Set Heading: One Backward!");
boat.OneMove(Direction.South);
}
else if (boat.Facing == Direction.South)
{
from.Say("Set Heading: One Backward!");
boat.OneMove(Direction.South);
}
else if (boat.Facing == Direction.West)
{
from.Say("Set Heading: One Backward!");
boat.OneMove(Direction.South);
}
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.TurnLeft:
{
if (boat.Facing == Direction.North)
{
from.Say("Change Course! New Heading: Due West!");
boat.Turn(-90, true);
}
else if (boat.Facing != Direction.North)
{
if (boat.Facing == Direction.West)
{
from.Say("Change Course! New Heading: Due South!");
boat.Turn(-90, true);
}
else if (boat.Facing == Direction.South)
{
from.Say("Change Course! New Heading: Due East!");
boat.Turn(-90, true);
}
else if (boat.Facing == Direction.East)
{
from.Say("Change Course! New Heading: Due North!");
boat.Turn(-90, true);
}
}
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.TurnAround:
{
from.Say("Come About!!");
boat.Turn(180, true);
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.ForwardOnCurrentHeading:
{
// Code: boat.Speed = 1
// Originally Worked But Caused Boats To Beach Themselves On Land
boat.StartMove(Direction.North, false);
from.SendGump(new BoatNavigationControl(from));
break;
}
case (int)Buttons.BackwardOnCurrentHeading:
{
// Code: boat.Speed = -1
// Originally Worked But Caused Boats To Beach Themselves On Land
boat.StartMove(Direction.South, false);
from.SendGump(new BoatNavigationControl(from));
break;
}
}
}
}
}
}

View file

@ -0,0 +1,40 @@
using System;
using Server;
using Server.Gumps;
using Server.Network;
namespace Server.Multis
{
public class ConfirmDryDockGump : Gump
{
private Mobile m_From;
private BaseBoat m_Boat;
public ConfirmDryDockGump( Mobile from, BaseBoat boat ) : base( 150, 200 )
{
m_From = from;
m_Boat = boat;
m_From.CloseGump( typeof( ConfirmDryDockGump ) );
AddPage( 0 );
AddBackground( 0, 0, 220, 170, 5054 );
AddBackground( 10, 10, 200, 150, 3000 );
AddHtmlLocalized( 20, 20, 180, 80, 1018319, true, false ); // Do you wish to dry dock this boat?
AddHtmlLocalized( 55, 100, 140, 25, 1011011, false, false ); // CONTINUE
AddButton( 20, 100, 4005, 4007, 2, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 55, 125, 140, 25, 1011012, false, false ); // CANCEL
AddButton( 20, 125, 4005, 4007, 1, GumpButtonType.Reply, 0 );
}
public override void OnResponse( NetState state, RelayInfo info )
{
if ( info.ButtonID == 2 )
m_Boat.EndDryDock( m_From );
}
}
}

View file

@ -0,0 +1,147 @@
using System;
using Server;
using Server.Multis;
using Server.Network;
namespace Server.Items
{
public class Hold : Container
{
private int m_MaxWeightDefault = 1000;
private BaseBoat m_Boat;
public Hold( BaseBoat boat ) : base( 0x3EAE )
{
m_Boat = boat;
Movable = false;
m_MaxWeightDefault = 1000;
if ( boat is LargeDragonBoat ) m_MaxWeightDefault = 3200;
else if ( boat is MediumDragonBoat ) m_MaxWeightDefault = 2200;
else if ( boat is SmallDragonBoat ) m_MaxWeightDefault = 1400;
else if ( boat is LargeBoat ) m_MaxWeightDefault = 2600;
else if ( boat is MediumBoat ) m_MaxWeightDefault = 1800;
}
public override int DefaultMaxWeight{ get{ return m_MaxWeightDefault; } }
public Hold( Serial serial ) : base( serial )
{
}
public void SetFacing( Direction dir )
{
switch ( dir )
{
case Direction.East: ItemID = 0x3E65; break;
case Direction.West: ItemID = 0x3E93; break;
case Direction.North: ItemID = 0x3EAE; break;
case Direction.South: ItemID = 0x3EB9; break;
}
}
public override bool OnDragDrop( Mobile from, Item item )
{
if ( m_Boat == null || !m_Boat.Contains( from ) || m_Boat.IsMoving )
return false;
return base.OnDragDrop( from, item );
}
public override bool OnDragDropInto( Mobile from, Item item, Point3D p )
{
if ( m_Boat == null || !m_Boat.Contains( from ) || m_Boat.IsMoving )
return false;
return base.OnDragDropInto( from, item, p );
}
public override bool CheckItemUse( Mobile from, Item item )
{
if ( item != this && (m_Boat == null || !m_Boat.Contains( from ) || m_Boat.IsMoving) )
return false;
return base.CheckItemUse( from, item );
}
public override bool CheckLift( Mobile from, Item item, ref LRReason reject )
{
if ( m_Boat == null || !m_Boat.Contains( from ) || m_Boat.IsMoving )
return false;
return base.CheckLift( from, item, ref reject );
}
public override void OnAfterDelete()
{
if ( m_Boat != null )
m_Boat.Delete();
}
public override void OnDoubleClick( Mobile from )
{
if ( m_Boat == null || !m_Boat.Contains( from ) )
{
if ( m_Boat.TillerMan != null )
m_Boat.TillerMan.Say( 502490 ); // You must be on the ship to open the hold.
}
else if ( m_Boat.IsMoving )
{
if ( m_Boat.TillerMan != null )
m_Boat.TillerMan.Say( 502491 ); // I can not open the hold while the ship is moving.
}
else
{
base.OnDoubleClick( from );
}
}
public override bool IsDecoContainer
{
get{ return false; }
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 );
writer.Write( m_Boat );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
m_Boat = reader.ReadItem() as BaseBoat;
if ( m_Boat == null || Parent != null )
{
Delete();
}
else
{
if ( m_Boat is LargeDragonBoat ) m_MaxWeightDefault = 3200;
else if ( m_Boat is MediumDragonBoat ) m_MaxWeightDefault = 2200;
else if ( m_Boat is SmallDragonBoat ) m_MaxWeightDefault = 1400;
else if ( m_Boat is LargeBoat ) m_MaxWeightDefault = 2600;
else if ( m_Boat is MediumBoat ) m_MaxWeightDefault = 1800;
else { m_MaxWeightDefault = 1000; }
}
Movable = false;
break;
}
}
}
}
}

View file

@ -0,0 +1,103 @@
using System;
using Server;
using Server.Items;
namespace Server.Multis
{
public class LargeBoat : BaseBoat
{
public override int NorthID{ get{ return 0x10; } }
public override int EastID{ get{ return 0x11; } }
public override int SouthID{ get{ return 0x12; } }
public override int WestID{ get{ return 0x13; } }
public override int HoldDistance{ get{ return 5; } }
public override int TillerManDistance{ get{ return -5; } }
public override Point2D StarboardOffset{ get{ return new Point2D( 2, -1 ); } }
public override Point2D PortOffset{ get{ return new Point2D( -2, -1 ); } }
public override Point3D MarkOffset{ get{ return new Point3D( 0, 0, 3 ); } }
public override BaseDockedBoat DockedBoat{ get{ return new LargeDockedBoat( this ); } }
[Constructable]
public LargeBoat()
{
}
public LargeBoat( Serial serial ) : base( serial )
{
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
}
public class LargeBoatDeed : BaseBoatDeed
{
public override int LabelNumber{ get{ return 1041209; } } // large ship deed
public override BaseBoat Boat{ get{ return new LargeBoat(); } }
[Constructable]
public LargeBoatDeed() : base( 0x10, new Point3D( 0, -1, 0 ) )
{
}
public LargeBoatDeed( Serial serial ) : base( serial )
{
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
}
public class LargeDockedBoat : BaseDockedBoat
{
public override BaseBoat Boat{ get{ return new LargeBoat(); } }
public LargeDockedBoat( BaseBoat boat ) : base( 0x10, new Point3D( 0, -1, 0 ), boat )
{
}
public LargeDockedBoat( Serial serial ) : base( serial )
{
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
}
}

View file

@ -0,0 +1,103 @@
using System;
using Server;
using Server.Items;
namespace Server.Multis
{
public class LargeDragonBoat : BaseBoat
{
public override int NorthID{ get{ return 0x14; } }
public override int EastID{ get{ return 0x15; } }
public override int SouthID{ get{ return 0x16; } }
public override int WestID{ get{ return 0x17; } }
public override int HoldDistance{ get{ return 5; } }
public override int TillerManDistance{ get{ return -5; } }
public override Point2D StarboardOffset{ get{ return new Point2D( 2, -1 ); } }
public override Point2D PortOffset{ get{ return new Point2D( -2, -1 ); } }
public override Point3D MarkOffset{ get{ return new Point3D( 0, 0, 3 ); } }
public override BaseDockedBoat DockedBoat{ get{ return new LargeDockedDragonBoat( this ); } }
[Constructable]
public LargeDragonBoat()
{
}
public LargeDragonBoat( Serial serial ) : base( serial )
{
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
}
public class LargeDragonBoatDeed : BaseBoatDeed
{
public override int LabelNumber{ get{ return 1041210; } }// large dragon ship deed
public override BaseBoat Boat{ get{ return new LargeDragonBoat(); } }
[Constructable]
public LargeDragonBoatDeed() : base( 0x14, new Point3D( 0, -1, 0 ) )
{
}
public LargeDragonBoatDeed( Serial serial ) : base( serial )
{
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
}
public class LargeDockedDragonBoat : BaseDockedBoat
{
public override BaseBoat Boat{ get{ return new LargeDragonBoat(); } }
public LargeDockedDragonBoat( BaseBoat boat ) : base( 0x14, new Point3D( 0, -1, 0 ), boat )
{
}
public LargeDockedDragonBoat( Serial serial ) : base( serial )
{
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
}
}

View file

@ -0,0 +1,103 @@
using System;
using Server;
using Server.Items;
namespace Server.Multis
{
public class MediumBoat : BaseBoat
{
public override int NorthID{ get{ return 0x8; } }
public override int EastID{ get{ return 0x9; } }
public override int SouthID{ get{ return 0xA; } }
public override int WestID{ get{ return 0xB; } }
public override int HoldDistance{ get{ return 4; } }
public override int TillerManDistance{ get{ return -5; } }
public override Point2D StarboardOffset{ get{ return new Point2D( 2, 0 ); } }
public override Point2D PortOffset{ get{ return new Point2D( -2, 0 ); } }
public override Point3D MarkOffset{ get{ return new Point3D( 0, 1, 3 ); } }
public override BaseDockedBoat DockedBoat{ get{ return new MediumDockedBoat( this ); } }
[Constructable]
public MediumBoat()
{
}
public MediumBoat( Serial serial ) : base( serial )
{
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
}
public class MediumBoatDeed : BaseBoatDeed
{
public override int LabelNumber{ get{ return 1041207; } } // medium ship deed
public override BaseBoat Boat{ get{ return new MediumBoat(); } }
[Constructable]
public MediumBoatDeed() : base( 0x8, Point3D.Zero )
{
}
public MediumBoatDeed( Serial serial ) : base( serial )
{
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
}
public class MediumDockedBoat : BaseDockedBoat
{
public override BaseBoat Boat{ get{ return new MediumBoat(); } }
public MediumDockedBoat( BaseBoat boat ) : base( 0x8, Point3D.Zero, boat )
{
}
public MediumDockedBoat( Serial serial ) : base( serial )
{
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
}
}

View file

@ -0,0 +1,103 @@
using System;
using Server;
using Server.Items;
namespace Server.Multis
{
public class MediumDragonBoat : BaseBoat
{
public override int NorthID{ get{ return 0xC; } }
public override int EastID{ get{ return 0xD; } }
public override int SouthID{ get{ return 0xE; } }
public override int WestID{ get{ return 0xF; } }
public override int HoldDistance{ get{ return 4; } }
public override int TillerManDistance{ get{ return -5; } }
public override Point2D StarboardOffset{ get{ return new Point2D( 2, 0 ); } }
public override Point2D PortOffset{ get{ return new Point2D( -2, 0 ); } }
public override Point3D MarkOffset{ get{ return new Point3D( 0, 1, 3 ); } }
public override BaseDockedBoat DockedBoat{ get{ return new MediumDockedDragonBoat( this ); } }
[Constructable]
public MediumDragonBoat()
{
}
public MediumDragonBoat( Serial serial ) : base( serial )
{
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
}
public class MediumDragonBoatDeed : BaseBoatDeed
{
public override int LabelNumber{ get{ return 1041208; } } // medium dragon ship deed
public override BaseBoat Boat{ get{ return new MediumDragonBoat(); } }
[Constructable]
public MediumDragonBoatDeed() : base( 0xC, Point3D.Zero )
{
}
public MediumDragonBoatDeed( Serial serial ) : base( serial )
{
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
}
public class MediumDockedDragonBoat : BaseDockedBoat
{
public override BaseBoat Boat{ get{ return new MediumDragonBoat(); } }
public MediumDockedDragonBoat( BaseBoat boat ) : base( 0xC, Point3D.Zero, boat )
{
}
public MediumDockedDragonBoat( Serial serial ) : base( serial )
{
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
}
}

View file

@ -0,0 +1,310 @@
using System;
using System.Collections;
using Server;
using Server.Multis;
namespace Server.Items
{
public enum PlankSide{ Port, Starboard }
public class Plank : Item, ILockable
{
private BaseBoat m_Boat;
private PlankSide m_Side;
private bool m_Locked;
private uint m_KeyValue;
private Timer m_CloseTimer;
public Plank( BaseBoat boat, PlankSide side, uint keyValue ) : base( 0x3EB1 + (int)side )
{
m_Boat = boat;
m_Side = side;
m_KeyValue = keyValue;
m_Locked = true;
Movable = false;
}
public Plank( Serial serial ) : base(serial)
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 );//version
writer.Write( m_Boat );
writer.Write( (int) m_Side );
writer.Write( m_Locked );
writer.Write( m_KeyValue );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
m_Boat = reader.ReadItem() as BaseBoat;
m_Side = (PlankSide) reader.ReadInt();
m_Locked = reader.ReadBool();
m_KeyValue = reader.ReadUInt();
if ( m_Boat == null )
Delete();
break;
}
}
if ( IsOpen )
{
m_CloseTimer = new CloseTimer( this );
m_CloseTimer.Start();
}
}
[CommandProperty( AccessLevel.GameMaster )]
public BaseBoat Boat{ get{ return m_Boat; } set{ m_Boat = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public PlankSide Side{ get{ return m_Side; } set{ m_Side = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public bool Locked{ get{ return m_Locked; } set{ m_Locked = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public uint KeyValue{ get{ return m_KeyValue; } set{ m_KeyValue = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public bool IsOpen{ get{ return ( ItemID == 0x3ED5 || ItemID == 0x3ED4 || ItemID == 0x3E84 || ItemID == 0x3E89 ); } }
[CommandProperty( AccessLevel.GameMaster )]
public bool Starboard{ get{ return ( m_Side == PlankSide.Starboard ); } }
public void SetFacing( Direction dir )
{
if ( IsOpen )
{
switch ( dir )
{
case Direction.North: ItemID = Starboard ? 0x3ED4 : 0x3ED5; break;
case Direction.East: ItemID = Starboard ? 0x3E84 : 0x3E89; break;
case Direction.South: ItemID = Starboard ? 0x3ED5 : 0x3ED4; break;
case Direction.West: ItemID = Starboard ? 0x3E89 : 0x3E84; break;
}
}
else
{
switch ( dir )
{
case Direction.North: ItemID = Starboard ? 0x3EB2 : 0x3EB1; break;
case Direction.East: ItemID = Starboard ? 0x3E85 : 0x3E8A; break;
case Direction.South: ItemID = Starboard ? 0x3EB1 : 0x3EB2; break;
case Direction.West: ItemID = Starboard ? 0x3E8A : 0x3E85; break;
}
}
}
public void Open()
{
if ( IsOpen || Deleted )
return;
if ( m_CloseTimer != null )
m_CloseTimer.Stop();
m_CloseTimer = new CloseTimer( this );
m_CloseTimer.Start();
switch ( ItemID )
{
case 0x3EB1: ItemID = 0x3ED5; break;
case 0x3E8A: ItemID = 0x3E89; break;
case 0x3EB2: ItemID = 0x3ED4; break;
case 0x3E85: ItemID = 0x3E84; break;
}
if ( m_Boat != null )
m_Boat.Refresh();
}
public override bool OnMoveOver( Mobile from )
{
if ( IsOpen )
{
if ( (from.Direction & Direction.Running) != 0 || (m_Boat != null && !m_Boat.Contains( from )) )
return true;
Map map = Map;
if ( map == null )
return false;
int rx = 0, ry = 0;
if ( ItemID == 0x3ED4 )
rx = 1;
else if ( ItemID == 0x3ED5 )
rx = -1;
else if ( ItemID == 0x3E84 )
ry = 1;
else if ( ItemID == 0x3E89 )
ry = -1;
for ( int i = 1; i <= 6; ++i )
{
int x = X + (i*rx);
int y = Y + (i*ry);
int z;
for ( int j = -8; j <= 8; ++j )
{
z = from.Z + j;
if ( map.CanFit( x, y, z, 16, false, false ) && !Server.Spells.SpellHelper.CheckMulti( new Point3D( x, y, z ), map ) )
{
if ( i == 1 && j >= -2 && j <= 2 )
return true;
from.Location = new Point3D( x, y, z );
return false;
}
}
z = map.GetAverageZ( x, y );
if ( map.CanFit( x, y, z, 16, false, false ) && !Server.Spells.SpellHelper.CheckMulti( new Point3D( x, y, z ), map ) )
{
if ( i == 1 )
return true;
from.Location = new Point3D( x, y, z );
return false;
}
}
return true;
}
else
{
return false;
}
}
public bool CanClose()
{
Map map = Map;
if ( map == null || Deleted )
return false;
foreach ( object o in this.GetObjectsInRange( 0 ) )
{
if ( o != this )
return false;
}
return true;
}
public void Close()
{
if ( !IsOpen || !CanClose() || Deleted )
return;
if ( m_CloseTimer != null )
m_CloseTimer.Stop();
m_CloseTimer = null;
switch ( ItemID )
{
case 0x3ED5: ItemID = 0x3EB1; break;
case 0x3E89: ItemID = 0x3E8A; break;
case 0x3ED4: ItemID = 0x3EB2; break;
case 0x3E84: ItemID = 0x3E85; break;
}
if ( m_Boat != null )
m_Boat.Refresh();
}
public override void OnDoubleClickDead( Mobile from )
{
OnDoubleClick( from );
}
public override void OnDoubleClick( Mobile from )
{
if ( m_Boat == null )
return;
if ( from.InRange( GetWorldLocation(), 8 ) )
{
if ( m_Boat.Contains( from ) )
{
if ( IsOpen )
Close();
else
Open();
}
else
{
if ( !IsOpen )
{
if ( !Locked )
{
Open();
}
else if ( from.AccessLevel >= AccessLevel.GameMaster )
{
from.LocalOverheadMessage( Network.MessageType.Regular, 0x00, 502502 ); // That is locked but your godly powers allow access
Open();
}
else
{
from.LocalOverheadMessage( Network.MessageType.Regular, 0x00, 502503 ); // That is locked.
}
}
else if ( !Locked )
{
from.Location = new Point3D( this.X, this.Y, this.Z + 3 );
}
else if ( from.AccessLevel >= AccessLevel.GameMaster )
{
from.LocalOverheadMessage( Network.MessageType.Regular, 0x00, 502502 ); // That is locked but your godly powers allow access
from.Location = new Point3D( this.X, this.Y, this.Z + 3 );
}
else
{
from.LocalOverheadMessage( Network.MessageType.Regular, 0x00, 502503 ); // That is locked.
}
}
}
}
private class CloseTimer : Timer
{
private Plank m_Plank;
public CloseTimer( Plank plank ) : base( TimeSpan.FromSeconds( 5.0 ), TimeSpan.FromSeconds( 5.0 ) )
{
m_Plank = plank;
Priority = TimerPriority.OneSecond;
}
protected override void OnTick()
{
m_Plank.Close();
}
}
}
}

View file

@ -0,0 +1,21 @@
using System;
using Server;
using Server.Prompts;
namespace Server.Multis
{
public class RenameBoatPrompt : Prompt
{
private BaseBoat m_Boat;
public RenameBoatPrompt( BaseBoat boat )
{
m_Boat = boat;
}
public override void OnResponse( Mobile from, string text )
{
m_Boat.EndRename( from, text );
}
}
}

View file

@ -0,0 +1,103 @@
using System;
using Server;
using Server.Items;
namespace Server.Multis
{
public class SmallBoat : BaseBoat
{
public override int NorthID{ get{ return 0x0; } }
public override int EastID{ get{ return 0x1; } }
public override int SouthID{ get{ return 0x2; } }
public override int WestID{ get{ return 0x3; } }
public override int HoldDistance{ get{ return 4; } }
public override int TillerManDistance{ get{ return -4; } }
public override Point2D StarboardOffset{ get{ return new Point2D( 2, 0 ); } }
public override Point2D PortOffset{ get{ return new Point2D( -2, 0 ); } }
public override Point3D MarkOffset{ get{ return new Point3D( 0, 1, 3 ); } }
public override BaseDockedBoat DockedBoat{ get{ return new SmallDockedBoat( this ); } }
[Constructable]
public SmallBoat()
{
}
public SmallBoat( Serial serial ) : base( serial )
{
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
}
public class SmallBoatDeed : BaseBoatDeed
{
public override int LabelNumber{ get{ return 1041205; } } // small ship deed
public override BaseBoat Boat{ get{ return new SmallBoat(); } }
[Constructable]
public SmallBoatDeed() : base( 0x0, Point3D.Zero )
{
}
public SmallBoatDeed( Serial serial ) : base( serial )
{
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
}
public class SmallDockedBoat : BaseDockedBoat
{
public override BaseBoat Boat{ get{ return new SmallBoat(); } }
public SmallDockedBoat( BaseBoat boat ) : base( 0x0, Point3D.Zero, boat )
{
}
public SmallDockedBoat( Serial serial ) : base( serial )
{
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
}
}

View file

@ -0,0 +1,103 @@
using System;
using Server;
using Server.Items;
namespace Server.Multis
{
public class SmallDragonBoat : BaseBoat
{
public override int NorthID{ get{ return 0x4; } }
public override int EastID{ get{ return 0x5; } }
public override int SouthID{ get{ return 0x6; } }
public override int WestID{ get{ return 0x7; } }
public override int HoldDistance{ get{ return 4; } }
public override int TillerManDistance{ get{ return -4; } }
public override Point2D StarboardOffset{ get{ return new Point2D( 2, 0 ); } }
public override Point2D PortOffset{ get{ return new Point2D( -2, 0 ); } }
public override Point3D MarkOffset{ get{ return new Point3D( 0, 1, 3 ); } }
public override BaseDockedBoat DockedBoat{ get{ return new SmallDockedDragonBoat( this ); } }
[Constructable]
public SmallDragonBoat()
{
}
public SmallDragonBoat( Serial serial ) : base( serial )
{
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
}
public class SmallDragonBoatDeed : BaseBoatDeed
{
public override int LabelNumber{ get{ return 1041206; } } // small dragon ship deed
public override BaseBoat Boat{ get{ return new SmallDragonBoat(); } }
[Constructable]
public SmallDragonBoatDeed() : base( 0x4, Point3D.Zero )
{
}
public SmallDragonBoatDeed( Serial serial ) : base( serial )
{
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
}
public class SmallDockedDragonBoat : BaseDockedBoat
{
public override BaseBoat Boat{ get{ return new SmallDragonBoat(); } }
public SmallDockedDragonBoat( BaseBoat boat ) : base( 0x4, Point3D.Zero, boat )
{
}
public SmallDockedDragonBoat( Serial serial ) : base( serial )
{
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
}
}

View file

@ -0,0 +1,166 @@
using System;
using System.IO;
using Server;
namespace Server.Misc
{
public class Strandedness
{
private static Point2D[] m_Britannia = new Point2D[]
{
new Point2D( 582, 874 ),
new Point2D( 606, 924 ),
new Point2D( 723, 1026 ),
new Point2D( 683, 1125 ),
new Point2D( 731, 1210 ),
new Point2D( 873, 1191 ),
new Point2D( 952, 1221 ),
new Point2D( 974, 1268 ),
new Point2D( 970, 1319 ),
new Point2D( 880, 1276 ),
new Point2D( 758, 1360 ),
new Point2D( 637, 1495 ),
new Point2D( 690, 1596 ),
new Point2D( 769, 1685 ),
new Point2D( 905, 1765 ),
new Point2D( 922, 1875 ),
new Point2D( 934, 2060 ),
new Point2D( 989, 2165 ),
new Point2D( 1025, 2310 ),
new Point2D( 1073, 2487 ),
new Point2D( 1189, 2536 ),
new Point2D( 1357, 2588 ),
new Point2D( 1452, 2668 ),
new Point2D( 1578, 2717 ),
new Point2D( 1696, 2834 ),
new Point2D( 1692, 2989 ),
new Point2D( 1830, 3088 ),
new Point2D( 1997, 3190 ),
new Point2D( 1966, 3042 ),
new Point2D( 1978, 2933 ),
new Point2D( 2060, 3060 ),
new Point2D( 2147, 2980 ),
new Point2D( 2199, 2824 ),
new Point2D( 2086, 2466 ),
new Point2D( 2088, 2274 ),
new Point2D( 1861, 2033 ),
new Point2D( 1777, 1946 ),
new Point2D( 1682, 1816 ),
new Point2D( 2418, 1566 ),
new Point2D( 2536, 1579 ),
new Point2D( 2671, 1578 ),
new Point2D( 2844, 1511 ),
new Point2D( 3052, 1430 ),
new Point2D( 3134, 1346 ),
new Point2D( 3269, 1311 ),
new Point2D( 3549, 1118 ),
new Point2D( 3607, 1217 ),
new Point2D( 3736, 1198 ),
new Point2D( 3874, 1148 ),
new Point2D( 3957, 964 ),
new Point2D( 4091, 886 ),
new Point2D( 4037, 771 ),
new Point2D( 3823, 736 ),
new Point2D( 3620, 725 ),
new Point2D( 3481, 609 ),
new Point2D( 3364, 561 ),
new Point2D( 3192, 562 ),
new Point2D( 3071, 580 ),
new Point2D( 2515, 629 ),
new Point2D( 2370, 533 ),
new Point2D( 2029, 592 ),
new Point2D( 1874, 565 ),
new Point2D( 1673, 640 ),
new Point2D( 1534, 676 ),
new Point2D( 1473, 551 ),
new Point2D( 1389, 498 ),
new Point2D( 1301, 438 ),
new Point2D( 1225, 577 ),
new Point2D( 1153, 677 ),
new Point2D( 1026, 783 ),
new Point2D( 1008, 887 ),
new Point2D( 805, 923 )
};
public static void Initialize()
{
EventSink.Login += new LoginEventHandler( EventSink_Login );
}
private static bool IsStranded( Mobile from )
{
Map map = from.Map;
if ( map != Map.Britannia )
return false;
object surface = map.GetTopSurface( from.Location );
if ( surface is LandTile ) {
int id = ((LandTile)surface).ID;
return (id >= 168 && id <= 171)
|| (id >= 310 && id <= 311);
} else if ( surface is StaticTile ) {
int id = ((StaticTile)surface).ID;
return (id >= 0x1796 && id <= 0x17B2);
}
return false;
}
public static void EventSink_Login( LoginEventArgs e )
{
Mobile from = e.Mobile;
if ( !IsStranded( from ) )
return;
Map map = from.Map;
Point2D[] list = m_Britannia;
Point2D p = Point2D.Zero;
double pdist = double.MaxValue;
for ( int i = 0; i < list.Length; ++i )
{
double dist = from.GetDistanceToSqrt( list[i] );
if ( dist < pdist )
{
p = list[i];
pdist = dist;
}
}
int x = p.X, y = p.Y;
int z;
bool canFit = false;
z = map.GetAverageZ( x, y );
canFit = map.CanSpawnMobile( x, y, z );
for ( int i = 1; !canFit && i <= 40; i += 2 )
{
for ( int xo = -1; !canFit && xo <= 1; ++xo )
{
for ( int yo = -1; !canFit && yo <= 1; ++yo )
{
if ( xo == 0 && yo == 0 )
continue;
x = p.X + (xo * i);
y = p.Y + (yo * i);
z = map.GetAverageZ( x, y );
canFit = map.CanSpawnMobile( x, y, z );
}
}
}
if ( canFit )
from.Location = new Point3D( x, y, z );
}
}
}

View file

@ -0,0 +1,136 @@
using System;
using Server;
using Server.Multis;
using Server.Network;
using Server.Misc;
namespace Server.Items
{
public class TillerMan : Item
{
private BaseBoat m_Boat;
public TillerMan( BaseBoat boat ) : base( 0x3E4E )
{
m_Boat = boat;
Movable = false;
}
public TillerMan( Serial serial ) : base(serial)
{
}
public void SetFacing( Direction dir )
{
switch ( dir )
{
case Direction.South: ItemID = 0x3E4B; break;
case Direction.North: ItemID = 0x3E4E; break;
case Direction.West: ItemID = 0x3E50; break;
case Direction.East: ItemID = 0x3E55; break;
}
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
list.Add( m_Boat.Status );
}
public void Say( int number )
{
PublicOverheadMessage( MessageType.Regular, 0x3B2, number );
}
public void Say( int number, string args )
{
PublicOverheadMessage( MessageType.Regular, 0x3B2, number, args );
}
public override void AddNameProperty( ObjectPropertyList list )
{
if ( m_Boat != null && m_Boat.ShipName != null )
list.Add( 1042884, m_Boat.ShipName ); // the tiller man of the ~1_SHIP_NAME~
else
base.AddNameProperty( list );
}
public override void OnSingleClick( Mobile from )
{
if ( m_Boat != null && m_Boat.ShipName != null )
LabelTo( from, 1042884, m_Boat.ShipName ); // the tiller man of the ~1_SHIP_NAME~
else
base.OnSingleClick( from );
}
public override void OnDoubleClick( Mobile from )
{
if ( m_Boat != null )
{
if( m_Boat.Owner == from || from.AccessLevel >= AccessLevel.Administrator )
{
if( m_Boat.Contains( from ) )
{
from.CloseGump( typeof( BoatNavigationControl ) );
from.SendGump( new BoatNavigationControl( from ) );
}
else if ( !BaseBoat.NearDock(from) )
{
from.SendMessage( "You cannot dock a ship here" );
}
else
{
m_Boat.BeginDryDock( from );
}
}
else from.SendLocalizedMessage( 501023 ); // You must be the owner to use this item
}
}
public override bool OnDragDrop( Mobile from, Item dropped )
{
if ( dropped is MapItem && m_Boat != null && m_Boat.CanCommand( from ) && m_Boat.Contains( from ) )
{
m_Boat.AssociateMap( (MapItem) dropped );
}
return false;
}
public override void OnAfterDelete()
{
if ( m_Boat != null )
m_Boat.Delete();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 );//version
writer.Write( m_Boat );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
m_Boat = reader.ReadItem() as BaseBoat;
if ( m_Boat == null )
Delete();
break;
}
}
}
}
}

View file

@ -0,0 +1,57 @@
using System;
using Server.Misc;
namespace Server.Items
{
public class ShipNS : BaseMulti
{
[Constructable]
public ShipNS() : base( 0x18 )
{
Movable = false;
ItemID = Utility.RandomList( 0x18, 0x1A, 0x1C, 0x1E, 0x20, 0x22, 0x24, 0x26, 0x28, 0x2A, 0x2C, 0x2E );
}
public ShipNS( 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 class ShipEW : BaseMulti
{
[Constructable]
public ShipEW() : base( 0x19 )
{
Movable = false;
ItemID = Utility.RandomList( 0x19, 0x1B, 0x1D, 0x1F, 0x21, 0x23, 0x25, 0x27, 0x29, 0x2B, 0x2D, 0x2F );
}
public ShipEW( 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();
}
}
}