#W# Initial Commit: Avatars Conquest
This commit is contained in:
commit
5df497787a
7510 changed files with 416048 additions and 0 deletions
3865
Scripts/Multis/BaseHouse.cs
Normal file
3865
Scripts/Multis/BaseHouse.cs
Normal file
File diff suppressed because it is too large
Load diff
1733
Scripts/Multis/Boats/BaseBoat.cs
Normal file
1733
Scripts/Multis/Boats/BaseBoat.cs
Normal file
File diff suppressed because it is too large
Load diff
173
Scripts/Multis/Boats/BaseBoatDeed.cs
Normal file
173
Scripts/Multis/Boats/BaseBoatDeed.cs
Normal 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
196
Scripts/Multis/Boats/BaseDockedBoat.cs
Normal file
196
Scripts/Multis/Boats/BaseDockedBoat.cs
Normal 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
869
Scripts/Multis/Boats/BoatNavigation.cs
Normal file
869
Scripts/Multis/Boats/BoatNavigation.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
40
Scripts/Multis/Boats/ConfirmDryDockGump.cs
Normal file
40
Scripts/Multis/Boats/ConfirmDryDockGump.cs
Normal 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
147
Scripts/Multis/Boats/Hold.cs
Normal file
147
Scripts/Multis/Boats/Hold.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
103
Scripts/Multis/Boats/LargeBoat.cs
Normal file
103
Scripts/Multis/Boats/LargeBoat.cs
Normal 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
103
Scripts/Multis/Boats/LargeDragonBoat.cs
Normal file
103
Scripts/Multis/Boats/LargeDragonBoat.cs
Normal 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
103
Scripts/Multis/Boats/MediumBoat.cs
Normal file
103
Scripts/Multis/Boats/MediumBoat.cs
Normal 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
103
Scripts/Multis/Boats/MediumDragonBoat.cs
Normal file
103
Scripts/Multis/Boats/MediumDragonBoat.cs
Normal 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
310
Scripts/Multis/Boats/Plank.cs
Normal file
310
Scripts/Multis/Boats/Plank.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
Scripts/Multis/Boats/RenameBoatPrompt.cs
Normal file
21
Scripts/Multis/Boats/RenameBoatPrompt.cs
Normal 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
103
Scripts/Multis/Boats/SmallBoat.cs
Normal file
103
Scripts/Multis/Boats/SmallBoat.cs
Normal 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
103
Scripts/Multis/Boats/SmallDragonBoat.cs
Normal file
103
Scripts/Multis/Boats/SmallDragonBoat.cs
Normal 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
166
Scripts/Multis/Boats/Strandedness.cs
Normal file
166
Scripts/Multis/Boats/Strandedness.cs
Normal 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
136
Scripts/Multis/Boats/TillerMan.cs
Normal file
136
Scripts/Multis/Boats/TillerMan.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
57
Scripts/Multis/Boats/Vessels.cs
Normal file
57
Scripts/Multis/Boats/Vessels.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
254
Scripts/Multis/ComponentVerification.cs
Normal file
254
Scripts/Multis/ComponentVerification.cs
Normal file
|
|
@ -0,0 +1,254 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class ComponentVerification
|
||||
{
|
||||
private int[] m_ItemTable;
|
||||
private int[] m_MultiTable;
|
||||
|
||||
public bool IsItemValid( int itemID )
|
||||
{
|
||||
if ( itemID <= 0 || itemID >= m_ItemTable.Length )
|
||||
return false;
|
||||
|
||||
return CheckValidity( m_ItemTable[itemID] );
|
||||
}
|
||||
|
||||
public bool IsMultiValid( int multiID )
|
||||
{
|
||||
if ( multiID <= 0 || multiID >= m_MultiTable.Length )
|
||||
return false;
|
||||
|
||||
return CheckValidity( m_MultiTable[multiID] );
|
||||
}
|
||||
|
||||
public bool CheckValidity( int val )
|
||||
{
|
||||
if ( val == -1 )
|
||||
return false;
|
||||
|
||||
return ( val == 0 || (ExpansionInfo.CurrentExpansion.CustomHousingFlag & val) != 0 );
|
||||
}
|
||||
|
||||
public ComponentVerification()
|
||||
{
|
||||
m_ItemTable = CreateTable( 0x10000 );
|
||||
m_MultiTable = CreateTable( 0x4000 );
|
||||
|
||||
LoadItems( "Data/Components/walls.txt", "South1", "South2", "South3", "Corner", "East1", "East2", "East3", "Post", "WindowS", "AltWindowS", "WindowE", "AltWindowE", "SecondAltWindowS", "SecondAltWindowE" );
|
||||
LoadItems( "Data/Components/teleprts.txt", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", "F16" );
|
||||
LoadItems( "Data/Components/stairs.txt", "Block", "North", "East", "South", "West", "Squared1", "Squared2", "Rounded1", "Rounded2" );
|
||||
LoadItems( "Data/Components/roof.txt", "North", "East", "South", "West", "NSCrosspiece", "EWCrosspiece", "NDent", "EDent", "SDent", "WDent", "NTPiece", "ETPiece", "STPiece", "WTPiece", "XPiece", "Extra Piece" );
|
||||
LoadItems( "Data/Components/floors.txt", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", "F16" );
|
||||
LoadItems( "Data/Components/misc.txt", "Piece1", "Piece2", "Piece3", "Piece4", "Piece5", "Piece6", "Piece7", "Piece8" );
|
||||
LoadItems( "Data/Components/doors.txt", "Piece1", "Piece2", "Piece3", "Piece4", "Piece5", "Piece6", "Piece7", "Piece8" );
|
||||
|
||||
LoadMultis( "Data/Components/stairs.txt", "MultiNorth", "MultiEast", "MultiSouth", "MultiWest" );
|
||||
}
|
||||
|
||||
private int[] CreateTable( int length )
|
||||
{
|
||||
int[] table = new int[length];
|
||||
|
||||
for ( int i = 0; i < table.Length; ++i )
|
||||
table[i] = -1;
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
private void LoadItems( string path, params string[] itemColumns )
|
||||
{
|
||||
LoadSpreadsheet( m_ItemTable, path, itemColumns );
|
||||
}
|
||||
|
||||
private void LoadMultis( string path, params string[] multiColumns )
|
||||
{
|
||||
LoadSpreadsheet( m_MultiTable, path, multiColumns );
|
||||
}
|
||||
|
||||
private void LoadSpreadsheet( int[] table, string path, params string[] tileColumns )
|
||||
{
|
||||
Spreadsheet ss = new Spreadsheet( path );
|
||||
|
||||
int[] tileCIDs = new int[tileColumns.Length];
|
||||
|
||||
for ( int i = 0; i < tileColumns.Length; ++i )
|
||||
tileCIDs[i] = ss.GetColumnID( tileColumns[i] );
|
||||
|
||||
int featureCID = ss.GetColumnID( "FeatureMask" );
|
||||
|
||||
for ( int i = 0; i < ss.Records.Length; ++i )
|
||||
{
|
||||
DataRecord record = ss.Records[i];
|
||||
|
||||
int fid = record.GetInt32( featureCID );
|
||||
|
||||
for ( int j = 0; j < tileCIDs.Length; ++j )
|
||||
{
|
||||
int itemID = record.GetInt32( tileCIDs[j] );
|
||||
|
||||
if ( itemID <= 0 || itemID >= table.Length )
|
||||
continue;
|
||||
|
||||
table[itemID] = fid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Spreadsheet
|
||||
{
|
||||
private class ColumnInfo
|
||||
{
|
||||
public int m_DataIndex;
|
||||
|
||||
public string m_Type;
|
||||
public string m_Name;
|
||||
|
||||
public ColumnInfo( int dataIndex, string type, string name )
|
||||
{
|
||||
m_DataIndex = dataIndex;
|
||||
|
||||
m_Type = type;
|
||||
m_Name = name;
|
||||
}
|
||||
}
|
||||
|
||||
private ColumnInfo[] m_Columns;
|
||||
private DataRecord[] m_Records;
|
||||
|
||||
public DataRecord[] Records { get { return m_Records; } }
|
||||
|
||||
public int GetColumnID( string name )
|
||||
{
|
||||
for ( int i = 0; i < m_Columns.Length; ++i )
|
||||
{
|
||||
if ( m_Columns[i].m_Name == name )
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public Spreadsheet( string path )
|
||||
{
|
||||
using ( StreamReader ip = new StreamReader( path ) )
|
||||
{
|
||||
string[] types = ReadLine( ip );
|
||||
string[] names = ReadLine( ip );
|
||||
|
||||
m_Columns = new ColumnInfo[types.Length];
|
||||
|
||||
for ( int i = 0; i < m_Columns.Length; ++i )
|
||||
m_Columns[i] = new ColumnInfo( i, types[i], names[i] );
|
||||
|
||||
List<DataRecord> records = new List<DataRecord>();
|
||||
|
||||
string[] values;
|
||||
|
||||
while ( ( values = ReadLine( ip ) ) != null )
|
||||
{
|
||||
object[] data = new object[m_Columns.Length];
|
||||
|
||||
for ( int i = 0; i < m_Columns.Length; ++i )
|
||||
{
|
||||
ColumnInfo ci = m_Columns[i];
|
||||
|
||||
switch ( ci.m_Type )
|
||||
{
|
||||
case "int":
|
||||
{
|
||||
data[i] = Utility.ToInt32( values[ci.m_DataIndex] );
|
||||
break;
|
||||
}
|
||||
case "string":
|
||||
{
|
||||
data[i] = values[ci.m_DataIndex];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
records.Add( new DataRecord( this, data ) );
|
||||
}
|
||||
|
||||
m_Records = records.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
private string[] ReadLine( StreamReader ip )
|
||||
{
|
||||
string line;
|
||||
|
||||
while ( ( line = ip.ReadLine() ) != null )
|
||||
{
|
||||
if ( line.Length == 0 )
|
||||
continue;
|
||||
|
||||
return line.Split( '\t' );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class DataRecord
|
||||
{
|
||||
private Spreadsheet m_Spreadsheet;
|
||||
private object[] m_Data;
|
||||
|
||||
public Spreadsheet Spreadsheet { get { return m_Spreadsheet; } }
|
||||
public object[] Data { get { return m_Data; } }
|
||||
|
||||
public DataRecord( Spreadsheet ss, object[] data )
|
||||
{
|
||||
m_Spreadsheet = ss;
|
||||
m_Data = data;
|
||||
}
|
||||
|
||||
public int GetInt32( string name )
|
||||
{
|
||||
return GetInt32( this[name] );
|
||||
}
|
||||
|
||||
public int GetInt32( int id )
|
||||
{
|
||||
return GetInt32( this[id] );
|
||||
}
|
||||
|
||||
public int GetInt32( object obj )
|
||||
{
|
||||
if ( obj is int )
|
||||
return (int) obj;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public string GetString( string name )
|
||||
{
|
||||
return this[name] as string;
|
||||
}
|
||||
|
||||
public object this[string name]
|
||||
{
|
||||
get
|
||||
{
|
||||
return this[m_Spreadsheet.GetColumnID( name )];
|
||||
}
|
||||
}
|
||||
|
||||
public object this[int id]
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( id < 0 )
|
||||
return null;
|
||||
|
||||
return m_Data[id];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
959
Scripts/Multis/Deeds.cs
Normal file
959
Scripts/Multis/Deeds.cs
Normal file
|
|
@ -0,0 +1,959 @@
|
|||
using Server;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Server.Multis;
|
||||
using Server.Targeting;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Multis.Deeds
|
||||
{
|
||||
public class HousePlacementTarget : MultiTarget
|
||||
{
|
||||
private HouseDeed m_Deed;
|
||||
|
||||
public HousePlacementTarget( HouseDeed 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 reg = Region.Find( new Point3D( p ), from.Map );
|
||||
|
||||
if ( from.AccessLevel >= AccessLevel.GameMaster || reg.AllowHousing( from, p ) )
|
||||
m_Deed.OnPlacement( from, p );
|
||||
else if ( reg.IsPartOf( typeof( TreasureRegion ) ) || reg.IsPartOf( typeof( UnderworldEntrance ) ) )
|
||||
from.SendLocalizedMessage( 1043287 ); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
|
||||
else
|
||||
from.SendLocalizedMessage( 501265 ); // Housing can not be created in this area.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class HouseDeed : 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 HouseDeed( int id, Point3D offset ) : base( 0x14F0 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
|
||||
m_MultiID = id;
|
||||
m_Offset = offset;
|
||||
}
|
||||
|
||||
public HouseDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( m_Offset );
|
||||
|
||||
writer.Write( m_MultiID );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Offset = reader.ReadPoint3D();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_MultiID = reader.ReadInt();
|
||||
|
||||
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 ( from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 501271 ); // You already own a house, you may not place another!
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1010433 ); /* House placement cancellation could result in a
|
||||
* 60 second delay in the return of your deed.
|
||||
*/
|
||||
|
||||
from.Target = new HousePlacementTarget( this );
|
||||
}
|
||||
}
|
||||
|
||||
public abstract BaseHouse GetHouse( Mobile owner );
|
||||
public abstract Rectangle2D[] Area{ get; }
|
||||
|
||||
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 if ( from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 501271 ); // You already own a house, you may not place another!
|
||||
}
|
||||
else
|
||||
{
|
||||
ArrayList toMove;
|
||||
Point3D center = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z );
|
||||
HousePlacementResult res = HousePlacement.Check( from, m_MultiID, center, out toMove );
|
||||
|
||||
switch ( res )
|
||||
{
|
||||
case HousePlacementResult.Valid:
|
||||
{
|
||||
BaseHouse house = GetHouse( from );
|
||||
house.MoveToWorld( center, from.Map );
|
||||
Delete();
|
||||
|
||||
for ( int i = 0; i < toMove.Count; ++i )
|
||||
{
|
||||
object o = toMove[i];
|
||||
|
||||
if ( o is Mobile )
|
||||
((Mobile)o).Location = house.BanLocation;
|
||||
else if ( o is Item )
|
||||
((Item)o).Location = house.BanLocation;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case HousePlacementResult.BadItem:
|
||||
case HousePlacementResult.BadLand:
|
||||
case HousePlacementResult.BadStatic:
|
||||
case HousePlacementResult.BadRegionHidden:
|
||||
{
|
||||
from.SendLocalizedMessage( 1043287 ); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
|
||||
break;
|
||||
}
|
||||
case HousePlacementResult.NoSurface:
|
||||
{
|
||||
from.SendMessage( "The house could not be created here. Part of the foundation would not be on any surface." );
|
||||
break;
|
||||
}
|
||||
case HousePlacementResult.BadRegion:
|
||||
{
|
||||
from.SendLocalizedMessage( 501265 ); // Housing cannot be created in this area.
|
||||
break;
|
||||
}
|
||||
case HousePlacementResult.BadRegionTemp:
|
||||
{
|
||||
from.SendLocalizedMessage( 501270 ); //Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BlueTentDeed : HouseDeed
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1041217; } } // deed to a blue tent
|
||||
[Constructable]
|
||||
public BlueTentDeed() : base( 0x70, new Point3D( 0, 0, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public BlueTentDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new BlueTent( owner );
|
||||
}
|
||||
|
||||
public override Rectangle2D[] Area{ get{ return BlueTent.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class GreenTentDeed : HouseDeed
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1041218; } } // deed to a green tent
|
||||
[Constructable]
|
||||
public GreenTentDeed() : base( 0x72, new Point3D( 0, 0, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public GreenTentDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new GreenTent( owner );
|
||||
}
|
||||
|
||||
public override Rectangle2D[] Area{ get{ return SmallOldHouse.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class StonePlasterHouseDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public StonePlasterHouseDeed() : base( 0x64, new Point3D( 0, 4, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public StonePlasterHouseDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new SmallOldHouse( owner, 0x64 );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041211; } }
|
||||
public override Rectangle2D[] Area{ get{ return SmallOldHouse.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class FieldStoneHouseDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public FieldStoneHouseDeed() : base( 0x66, new Point3D( 0, 4, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public FieldStoneHouseDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new SmallOldHouse( owner, 0x66 );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041212; } }
|
||||
public override Rectangle2D[] Area{ get{ return SmallOldHouse.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class SmallBrickHouseDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public SmallBrickHouseDeed() : base( 0x68, new Point3D( 0, 4, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public SmallBrickHouseDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new SmallOldHouse( owner, 0x68 );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041213; } }
|
||||
public override Rectangle2D[] Area{ get{ return SmallOldHouse.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class WoodHouseDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public WoodHouseDeed() : base( 0x6A, new Point3D( 0, 4, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public WoodHouseDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new SmallOldHouse( owner, 0x6A );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041214; } }
|
||||
public override Rectangle2D[] Area{ get{ return SmallOldHouse.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class WoodPlasterHouseDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public WoodPlasterHouseDeed() : base( 0x6C, new Point3D( 0, 4, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public WoodPlasterHouseDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new SmallOldHouse( owner, 0x6C );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041215; } }
|
||||
public override Rectangle2D[] Area{ get{ return SmallOldHouse.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class ThatchedRoofCottageDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public ThatchedRoofCottageDeed() : base( 0x6E, new Point3D( 0, 4, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public ThatchedRoofCottageDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new SmallOldHouse( owner, 0x6E );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041216; } }
|
||||
public override Rectangle2D[] Area{ get{ return SmallOldHouse.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class BrickHouseDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public BrickHouseDeed() : base( 0x74, new Point3D( -1, 7, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public BrickHouseDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new GuildHouse( owner );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041219; } }
|
||||
public override Rectangle2D[] Area{ get{ return GuildHouse.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class TwoStoryWoodPlasterHouseDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public TwoStoryWoodPlasterHouseDeed() : base( 0x76, new Point3D( -3, 7, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public TwoStoryWoodPlasterHouseDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new TwoStoryHouse( owner, 0x76 );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041220; } }
|
||||
public override Rectangle2D[] Area{ get{ return TwoStoryHouse.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class TwoStoryStonePlasterHouseDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public TwoStoryStonePlasterHouseDeed() : base( 0x78, new Point3D( -3, 7, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public TwoStoryStonePlasterHouseDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new TwoStoryHouse( owner, 0x78 );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041221; } }
|
||||
public override Rectangle2D[] Area{ get{ return TwoStoryHouse.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class TowerDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public TowerDeed() : base( 0x7A, new Point3D( 0, 7, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public TowerDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new Tower( owner );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041222; } }
|
||||
public override Rectangle2D[] Area{ get{ return Tower.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class KeepDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public KeepDeed() : base( 0x7C, new Point3D( 0, 11, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public KeepDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new Keep( owner );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041223; } }
|
||||
public override Rectangle2D[] Area{ get{ return Keep.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class CastleDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public CastleDeed() : base( 0x7E, new Point3D( 0, 16, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public CastleDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new Castle( owner );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041224; } }
|
||||
public override Rectangle2D[] Area{ get{ return Castle.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class LargePatioDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public LargePatioDeed() : base( 0x8C, new Point3D( -4, 7, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public LargePatioDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new LargePatioHouse( owner );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041231; } }
|
||||
public override Rectangle2D[] Area{ get{ return LargePatioHouse.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class LargeMarbleDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public LargeMarbleDeed() : base( 0x96, new Point3D( -4, 7, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public LargeMarbleDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new LargeMarbleHouse( owner );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041236; } }
|
||||
public override Rectangle2D[] Area{ get{ return LargeMarbleHouse.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class SmallTowerDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public SmallTowerDeed() : base( 0x98, new Point3D( 3, 4, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public SmallTowerDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new SmallTower( owner );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041237; } }
|
||||
public override Rectangle2D[] Area{ get{ return SmallTower.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class LogCabinDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public LogCabinDeed() : base( 0x9A, new Point3D( 1, 6, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public LogCabinDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new LogCabin( owner );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041238; } }
|
||||
public override Rectangle2D[] Area{ get{ return LogCabin.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class SandstonePatioDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public SandstonePatioDeed() : base( 0x9C, new Point3D( -1, 4, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public SandstonePatioDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new SandStonePatio( owner );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041239; } }
|
||||
public override Rectangle2D[] Area{ get{ return SandStonePatio.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class VillaDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public VillaDeed() : base( 0x9E, new Point3D( 3, 6, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public VillaDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new TwoStoryVilla( owner );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041240; } }
|
||||
public override Rectangle2D[] Area{ get{ return TwoStoryVilla.AreaArray; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class StoneWorkshopDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public StoneWorkshopDeed() : base( 0xA0, new Point3D( -1, 4, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public StoneWorkshopDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new SmallShop( owner, 0xA0 );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041241; } }
|
||||
public override Rectangle2D[] Area{ get{ return SmallShop.AreaArray2; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class MarbleWorkshopDeed : HouseDeed
|
||||
{
|
||||
[Constructable]
|
||||
public MarbleWorkshopDeed() : base( 0xA2, new Point3D( -1, 4, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public MarbleWorkshopDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseHouse GetHouse( Mobile owner )
|
||||
{
|
||||
return new SmallShop( owner, 0xA2 );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041242; } }
|
||||
public override Rectangle2D[] Area{ get{ return SmallShop.AreaArray1; } }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
2503
Scripts/Multis/HouseFoundation.cs
Normal file
2503
Scripts/Multis/HouseFoundation.cs
Normal file
File diff suppressed because it is too large
Load diff
367
Scripts/Multis/HousePlacement.cs
Normal file
367
Scripts/Multis/HousePlacement.cs
Normal file
|
|
@ -0,0 +1,367 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Guilds;
|
||||
using Server.Items;
|
||||
using Server.Misc;
|
||||
using Server.Regions;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public enum HousePlacementResult
|
||||
{
|
||||
Valid,
|
||||
BadRegion,
|
||||
BadLand,
|
||||
BadStatic,
|
||||
BadItem,
|
||||
NoSurface,
|
||||
BadRegionHidden,
|
||||
BadRegionTemp,
|
||||
}
|
||||
|
||||
public class HousePlacement
|
||||
{
|
||||
private const int YardSize = 5;
|
||||
|
||||
// Any land tile which matches one of these ID numbers is considered a road and cannot be placed over.
|
||||
private static int[] m_RoadIDs = new int[]
|
||||
{
|
||||
0x0071, 0x0078,
|
||||
0x00E8, 0x00EB,
|
||||
0x07AE, 0x07B1,
|
||||
0x3FF4, 0x3FF4,
|
||||
0x3FF8, 0x3FFB,
|
||||
0x0442, 0x0479, // Sand stones
|
||||
0x0501, 0x0510, // Sand stones
|
||||
0x0009, 0x0015, // Furrows
|
||||
0x0150, 0x015C // Furrows
|
||||
};
|
||||
|
||||
public static HousePlacementResult Check( Mobile from, int multiID, Point3D center, out ArrayList toMove )
|
||||
{
|
||||
// If this spot is considered valid, every item and mobile in this list will be moved under the house sign
|
||||
toMove = new ArrayList();
|
||||
|
||||
Map map = from.Map;
|
||||
|
||||
if ( map == null || map == Map.Internal || map == Map.Underworld )
|
||||
return HousePlacementResult.BadLand; // A house cannot go here
|
||||
|
||||
if ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
return HousePlacementResult.Valid; // Staff can place anywhere
|
||||
|
||||
NoHousingRegion noHousingRegion = (NoHousingRegion) Region.Find( center, map ).GetRegion( typeof( NoHousingRegion ) );
|
||||
|
||||
if ( noHousingRegion != null )
|
||||
return HousePlacementResult.BadRegion;
|
||||
|
||||
// This holds data describing the internal structure of the house
|
||||
MultiComponentList mcl = MultiData.GetComponents( multiID );
|
||||
|
||||
if ( multiID >= 0x13EC && multiID < 0x1D00 )
|
||||
HouseFoundation.AddStairsTo( ref mcl ); // this is a AOS house, add the stairs
|
||||
|
||||
// Location of the nortwest-most corner of the house
|
||||
Point3D start = new Point3D( center.X + mcl.Min.X, center.Y + mcl.Min.Y, center.Z );
|
||||
|
||||
// These are storage lists. They hold items and mobiles found in the map for further processing
|
||||
List<Item> items = new List<Item>();
|
||||
List<Mobile> mobiles = new List<Mobile>();
|
||||
|
||||
// These are also storage lists. They hold location values indicating the yard and border locations.
|
||||
List<Point2D> yard = new List<Point2D>(), borders = new List<Point2D>();
|
||||
|
||||
/* RULES:
|
||||
*
|
||||
* 1) All tiles which are around the -outside- of the foundation must not have anything impassable.
|
||||
* 2) No impassable object or land tile may come in direct contact with any part of the house.
|
||||
* 3) Five tiles from the front and back of the house must be completely clear of all house tiles.
|
||||
* 4) The foundation must rest flatly on a surface. Any bumps around the foundation are not allowed.
|
||||
* 5) No foundation tile may reside over terrain which is viewed as a road.
|
||||
*/
|
||||
|
||||
for ( int x = 0; x < mcl.Width; ++x )
|
||||
{
|
||||
for ( int y = 0; y < mcl.Height; ++y )
|
||||
{
|
||||
int tileX = start.X + x;
|
||||
int tileY = start.Y + y;
|
||||
|
||||
StaticTile[] addTiles = mcl.Tiles[x][y];
|
||||
|
||||
if ( addTiles.Length == 0 )
|
||||
continue; // There are no tiles here, continue checking somewhere else
|
||||
|
||||
Point3D testPoint = new Point3D( tileX, tileY, center.Z );
|
||||
|
||||
Region reg = Region.Find( testPoint, map );
|
||||
|
||||
if ( !reg.AllowHousing( from, testPoint ) ) // Cannot place houses in dungeons, towns, treasure map areas etc
|
||||
{
|
||||
if ( reg.IsPartOf( typeof( TempNoHousingRegion ) ) )
|
||||
return HousePlacementResult.BadRegionTemp;
|
||||
|
||||
if ( reg.IsPartOf( typeof( TreasureRegion ) ) || reg.IsPartOf( typeof( UnderworldEntrance ) ) )
|
||||
return HousePlacementResult.BadRegionHidden;
|
||||
|
||||
return HousePlacementResult.BadRegion;
|
||||
}
|
||||
|
||||
LandTile landTile = map.Tiles.GetLandTile( tileX, tileY );
|
||||
int landID = landTile.ID & TileData.MaxLandValue;
|
||||
|
||||
StaticTile[] oldTiles = map.Tiles.GetStaticTiles( tileX, tileY, true );
|
||||
|
||||
Sector sector = map.GetSector( tileX, tileY );
|
||||
|
||||
items.Clear();
|
||||
|
||||
for ( int i = 0; i < sector.Items.Count; ++i )
|
||||
{
|
||||
Item item = sector.Items[i];
|
||||
|
||||
if ( item.Visible && item.X == tileX && item.Y == tileY )
|
||||
items.Add( item );
|
||||
}
|
||||
|
||||
mobiles.Clear();
|
||||
|
||||
for ( int i = 0; i < sector.Mobiles.Count; ++i )
|
||||
{
|
||||
Mobile m = sector.Mobiles[i];
|
||||
|
||||
if ( m.X == tileX && m.Y == tileY )
|
||||
mobiles.Add( m );
|
||||
}
|
||||
|
||||
int landStartZ = 0, landAvgZ = 0, landTopZ = 0;
|
||||
|
||||
map.GetAverageZ( tileX, tileY, ref landStartZ, ref landAvgZ, ref landTopZ );
|
||||
|
||||
bool hasFoundation = false;
|
||||
|
||||
for ( int i = 0; i < addTiles.Length; ++i )
|
||||
{
|
||||
StaticTile addTile = addTiles[i];
|
||||
|
||||
if ( addTile.ID == 0x1 ) // Nodraw
|
||||
continue;
|
||||
|
||||
TileFlag addTileFlags = TileData.ItemTable[addTile.ID & TileData.MaxItemValue].Flags;
|
||||
|
||||
bool isFoundation = ( addTile.Z == 0 && (addTileFlags & TileFlag.Wall) != 0 );
|
||||
bool hasSurface = false;
|
||||
|
||||
if ( isFoundation )
|
||||
hasFoundation = true;
|
||||
|
||||
int addTileZ = center.Z + addTile.Z;
|
||||
int addTileTop = addTileZ + addTile.Height;
|
||||
|
||||
if ( (addTileFlags & TileFlag.Surface) != 0 )
|
||||
addTileTop += 16;
|
||||
|
||||
if ( addTileTop > landStartZ && landAvgZ > addTileZ )
|
||||
return HousePlacementResult.BadLand; // Broke rule #2
|
||||
|
||||
if ( isFoundation && ((TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Impassable) == 0) && landAvgZ == center.Z )
|
||||
hasSurface = true;
|
||||
|
||||
for ( int j = 0; j < oldTiles.Length; ++j )
|
||||
{
|
||||
StaticTile oldTile = oldTiles[j];
|
||||
ItemData id = TileData.ItemTable[oldTile.ID & TileData.MaxItemValue];
|
||||
|
||||
if ( (id.Impassable || (id.Surface && (id.Flags & TileFlag.Background) == 0)) && addTileTop > oldTile.Z && (oldTile.Z + id.CalcHeight) > addTileZ )
|
||||
return HousePlacementResult.BadStatic; // Broke rule #2
|
||||
/*else if ( isFoundation && !hasSurface && (id.Flags & TileFlag.Surface) != 0 && (oldTile.Z + id.CalcHeight) == center.Z )
|
||||
hasSurface = true;*/
|
||||
}
|
||||
|
||||
for ( int j = 0; j < items.Count; ++j )
|
||||
{
|
||||
Item item = items[j];
|
||||
ItemData id = item.ItemData;
|
||||
|
||||
if ( addTileTop > item.Z && (item.Z + id.CalcHeight) > addTileZ )
|
||||
{
|
||||
if ( item.Movable )
|
||||
toMove.Add( item );
|
||||
else if ( (id.Impassable || (id.Surface && (id.Flags & TileFlag.Background) == 0)) )
|
||||
return HousePlacementResult.BadItem; // Broke rule #2
|
||||
}
|
||||
/*else if ( isFoundation && !hasSurface && (id.Flags & TileFlag.Surface) != 0 && (item.Z + id.CalcHeight) == center.Z )
|
||||
{
|
||||
hasSurface = true;
|
||||
}*/
|
||||
}
|
||||
|
||||
if ( isFoundation && !hasSurface )
|
||||
return HousePlacementResult.NoSurface; // Broke rule #4
|
||||
|
||||
for ( int j = 0; j < mobiles.Count; ++j )
|
||||
{
|
||||
Mobile m = mobiles[j];
|
||||
|
||||
if ( addTileTop > m.Z && (m.Z + 16) > addTileZ )
|
||||
toMove.Add( m );
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_RoadIDs.Length; i += 2 )
|
||||
{
|
||||
if ( landID >= m_RoadIDs[i] && landID <= m_RoadIDs[i + 1] )
|
||||
return HousePlacementResult.BadLand; // Broke rule #5
|
||||
}
|
||||
|
||||
if ( hasFoundation )
|
||||
{
|
||||
for ( int xOffset = -1; xOffset <= 1; ++xOffset )
|
||||
{
|
||||
for ( int yOffset = -YardSize; yOffset <= YardSize; ++yOffset )
|
||||
{
|
||||
Point2D yardPoint = new Point2D( tileX + xOffset, tileY + yOffset );
|
||||
|
||||
if ( !yard.Contains( yardPoint ) )
|
||||
yard.Add( yardPoint );
|
||||
}
|
||||
}
|
||||
|
||||
for ( int xOffset = -1; xOffset <= 1; ++xOffset )
|
||||
{
|
||||
for ( int yOffset = -1; yOffset <= 1; ++yOffset )
|
||||
{
|
||||
if ( xOffset == 0 && yOffset == 0 )
|
||||
continue;
|
||||
|
||||
// To ease this rule, we will not add to the border list if the tile here is under a base floor (z<=8)
|
||||
|
||||
int vx = x + xOffset;
|
||||
int vy = y + yOffset;
|
||||
|
||||
if ( vx >= 0 && vx < mcl.Width && vy >= 0 && vy < mcl.Height )
|
||||
{
|
||||
StaticTile[] breakTiles = mcl.Tiles[vx][vy];
|
||||
bool shouldBreak = false;
|
||||
|
||||
for ( int i = 0; !shouldBreak && i < breakTiles.Length; ++i )
|
||||
{
|
||||
StaticTile breakTile = breakTiles[i];
|
||||
|
||||
if ( breakTile.Height == 0 && breakTile.Z <= 8 && TileData.ItemTable[breakTile.ID & TileData.MaxItemValue].Surface )
|
||||
shouldBreak = true;
|
||||
}
|
||||
|
||||
if ( shouldBreak )
|
||||
continue;
|
||||
}
|
||||
|
||||
Point2D borderPoint = new Point2D( tileX + xOffset, tileY + yOffset );
|
||||
|
||||
if ( !borders.Contains( borderPoint ) )
|
||||
borders.Add( borderPoint );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i < borders.Count; ++i )
|
||||
{
|
||||
Point2D borderPoint = borders[i];
|
||||
|
||||
LandTile landTile = map.Tiles.GetLandTile( borderPoint.X, borderPoint.Y );
|
||||
int landID = landTile.ID & TileData.MaxLandValue;
|
||||
|
||||
if ( (TileData.LandTable[landID].Flags & TileFlag.Impassable) != 0 )
|
||||
return HousePlacementResult.BadLand;
|
||||
|
||||
for ( int j = 0; j < m_RoadIDs.Length; j += 2 )
|
||||
{
|
||||
if ( landID >= m_RoadIDs[j] && landID <= m_RoadIDs[j + 1] )
|
||||
return HousePlacementResult.BadLand; // Broke rule #5
|
||||
}
|
||||
|
||||
StaticTile[] tiles = map.Tiles.GetStaticTiles( borderPoint.X, borderPoint.Y, true );
|
||||
|
||||
for ( int j = 0; j < tiles.Length; ++j )
|
||||
{
|
||||
StaticTile tile = tiles[j];
|
||||
ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
|
||||
|
||||
if ( id.Impassable || (id.Surface && (id.Flags & TileFlag.Background) == 0 && (tile.Z + id.CalcHeight) > (center.Z + 2)) )
|
||||
return HousePlacementResult.BadStatic; // Broke rule #1
|
||||
}
|
||||
|
||||
Sector sector = map.GetSector( borderPoint.X, borderPoint.Y );
|
||||
List<Item> sectorItems = sector.Items;
|
||||
|
||||
for ( int j = 0; j < sectorItems.Count; ++j )
|
||||
{
|
||||
Item item = sectorItems[j];
|
||||
|
||||
if ( item.X != borderPoint.X || item.Y != borderPoint.Y || item.Movable )
|
||||
continue;
|
||||
|
||||
ItemData id = item.ItemData;
|
||||
|
||||
if ( id.Impassable || (id.Surface && (id.Flags & TileFlag.Background) == 0 && (item.Z + id.CalcHeight) > (center.Z + 2)) )
|
||||
return HousePlacementResult.BadItem; // Broke rule #1
|
||||
}
|
||||
}
|
||||
|
||||
List<Sector> _sectors = new List<Sector>();
|
||||
List<BaseHouse> _houses = new List<BaseHouse>();
|
||||
|
||||
for ( int i = 0; i < yard.Count; i++ ) {
|
||||
Sector sector = map.GetSector( yard[i] );
|
||||
|
||||
if ( !_sectors.Contains( sector ) ) {
|
||||
_sectors.Add( sector );
|
||||
|
||||
if ( sector.Multis != null ) {
|
||||
for ( int j = 0; j < sector.Multis.Count; j++ ) {
|
||||
if ( sector.Multis[j] is BaseHouse ) {
|
||||
BaseHouse _house = (BaseHouse)sector.Multis[j];
|
||||
if ( !_houses.Contains( _house ) ) {
|
||||
_houses.Add( _house );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i < yard.Count; ++i )
|
||||
{
|
||||
foreach ( BaseHouse b in _houses ) {
|
||||
if ( b.Contains( yard[i] ) )
|
||||
return HousePlacementResult.BadStatic; // Broke rule #3
|
||||
}
|
||||
|
||||
/*Point2D yardPoint = yard[i];
|
||||
|
||||
IPooledEnumerable eable = map.GetMultiTilesAt( yardPoint.X, yardPoint.Y );
|
||||
|
||||
foreach ( StaticTile[] tile in eable )
|
||||
{
|
||||
for ( int j = 0; j < tile.Length; ++j )
|
||||
{
|
||||
if ( (TileData.ItemTable[tile[j].ID & TileData.MaxItemValue].Flags & (TileFlag.Impassable | TileFlag.Surface)) != 0 )
|
||||
{
|
||||
eable.Free();
|
||||
return HousePlacementResult.BadStatic; // Broke rule #3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
eable.Free();*/
|
||||
}
|
||||
|
||||
return HousePlacementResult.Valid;
|
||||
}
|
||||
}
|
||||
}
|
||||
627
Scripts/Multis/HousePlacementTool.cs
Normal file
627
Scripts/Multis/HousePlacementTool.cs
Normal file
|
|
@ -0,0 +1,627 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class HousePlacementTool : Item
|
||||
{
|
||||
[Constructable]
|
||||
public HousePlacementTool() : base( 0x14F0 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
Name = "construction contract";
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsChildOf( from.Backpack ) )
|
||||
from.SendGump( new HousePlacementListGump( from, HousePlacementEntry.ClassicHouses ) );
|
||||
else
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
|
||||
public HousePlacementTool( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( Weight == 0.0 )
|
||||
Weight = 3.0;
|
||||
}
|
||||
}
|
||||
|
||||
public class HousePlacementListGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private HousePlacementEntry[] m_Entries;
|
||||
|
||||
private const int LabelColor = 0x7FFF;
|
||||
private const int LabelHue = 0x480;
|
||||
|
||||
public HousePlacementListGump( Mobile from, HousePlacementEntry[] entries ) : base( 50, 50 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Entries = entries;
|
||||
|
||||
from.CloseGump( typeof( HousePlacementListGump ) );
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 0, 0, 520, 420, 5054 );
|
||||
|
||||
AddImageTiled( 10, 10, 500, 20, 2624 );
|
||||
AddAlphaRegion( 10, 10, 500, 20 );
|
||||
|
||||
AddHtmlLocalized( 10, 10, 500, 20, 1060239, LabelColor, false, false ); // <CENTER>CONSTRUCTION CONTRACT</CENTER>
|
||||
|
||||
AddImageTiled( 10, 40, 500, 20, 2624 );
|
||||
AddAlphaRegion( 10, 40, 500, 20 );
|
||||
|
||||
AddHtmlLocalized( 50, 40, 225, 20, 1060235, LabelColor, false, false ); // House Description
|
||||
AddHtmlLocalized( 275, 40, 75, 20, 1060236, LabelColor, false, false ); // Storage
|
||||
AddHtmlLocalized( 350, 40, 75, 20, 1060237, LabelColor, false, false ); // Lockdowns
|
||||
AddHtmlLocalized( 425, 40, 75, 20, 1060034, LabelColor, false, false ); // Cost
|
||||
|
||||
AddImageTiled( 10, 70, 500, 280, 2624 );
|
||||
AddAlphaRegion( 10, 70, 500, 280 );
|
||||
|
||||
AddImageTiled( 10, 360, 500, 20, 2624 );
|
||||
AddAlphaRegion( 10, 360, 500, 20 );
|
||||
|
||||
AddHtmlLocalized( 10, 360, 250, 20, 1060645, LabelColor, false, false ); // Inn Balance:
|
||||
AddLabel( 250, 360, LabelHue, Innkeeper.GetBalance( from ).ToString() );
|
||||
|
||||
AddImageTiled( 10, 390, 500, 20, 2624 );
|
||||
AddAlphaRegion( 10, 390, 500, 20 );
|
||||
|
||||
AddButton( 10, 390, 4017, 4019, 0, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 50, 390, 100, 20, 3000363, LabelColor, false, false ); // Close
|
||||
|
||||
for ( int i = 0; i < entries.Length; ++i )
|
||||
{
|
||||
int page = 1 + (i / 14);
|
||||
int index = i % 14;
|
||||
|
||||
if ( index == 0 )
|
||||
{
|
||||
if ( page > 1 )
|
||||
{
|
||||
AddButton( 450, 390, 4005, 4007, 0, GumpButtonType.Page, page );
|
||||
AddHtmlLocalized( 400, 390, 100, 20, 3000406, LabelColor, false, false ); // Next
|
||||
}
|
||||
|
||||
AddPage( page );
|
||||
|
||||
if ( page > 1 )
|
||||
{
|
||||
AddButton( 200, 390, 4014, 4016, 0, GumpButtonType.Page, page - 1 );
|
||||
AddHtmlLocalized( 250, 390, 100, 20, 3000405, LabelColor, false, false ); // Previous
|
||||
}
|
||||
}
|
||||
|
||||
HousePlacementEntry entry = entries[i];
|
||||
|
||||
int y = 70 + (index * 20);
|
||||
|
||||
AddButton( 10, y, 4005, 4007, 1 + i, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 50, y, 225, 20, entry.Description, LabelColor, false, false );
|
||||
AddLabel( 275, y, LabelHue, entry.Storage.ToString() );
|
||||
AddLabel( 350, y, LabelHue, entry.Lockdowns.ToString() );
|
||||
AddLabel( 425, y, LabelHue, entry.Cost.ToString() );
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( !m_From.CheckAlive() || m_From.Backpack == null || m_From.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
return;
|
||||
|
||||
int index = info.ButtonID - 1;
|
||||
|
||||
if ( index >= 0 && index < m_Entries.Length )
|
||||
{
|
||||
if ( m_From.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse( m_From ) )
|
||||
m_From.SendLocalizedMessage( 501271 ); // You already own a house, you may not place another!
|
||||
else
|
||||
m_From.Target = new NewHousePlacementTarget( m_Entries, m_Entries[index] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class NewHousePlacementTarget : MultiTarget
|
||||
{
|
||||
private HousePlacementEntry m_Entry;
|
||||
private HousePlacementEntry[] m_Entries;
|
||||
|
||||
private bool m_Placed;
|
||||
|
||||
public NewHousePlacementTarget( HousePlacementEntry[] entries, HousePlacementEntry entry ) : base( entry.MultiID, entry.Offset )
|
||||
{
|
||||
Range = 14;
|
||||
|
||||
m_Entries = entries;
|
||||
m_Entry = entry;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object o )
|
||||
{
|
||||
if ( !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
return;
|
||||
|
||||
IPoint3D ip = o as IPoint3D;
|
||||
|
||||
if ( ip != null )
|
||||
{
|
||||
if ( ip is Item )
|
||||
ip = ((Item)ip).GetWorldTop();
|
||||
|
||||
Point3D p = new Point3D( ip );
|
||||
|
||||
Region reg = Region.Find( new Point3D( p ), from.Map );
|
||||
|
||||
if ( from.AccessLevel >= AccessLevel.GameMaster || reg.AllowHousing( from, p ) )
|
||||
m_Placed = m_Entry.OnPlacement( from, p );
|
||||
else if ( reg.IsPartOf( typeof( TreasureRegion ) ) || reg.IsPartOf( typeof( UnderworldEntrance ) ) )
|
||||
from.SendLocalizedMessage( 1043287 ); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
|
||||
else
|
||||
from.SendLocalizedMessage( 501265 ); // Housing can not be created in this area.
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish( Mobile from )
|
||||
{
|
||||
if ( !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
return;
|
||||
|
||||
if ( !m_Placed )
|
||||
from.SendGump( new HousePlacementListGump( from, m_Entries ) );
|
||||
}
|
||||
}
|
||||
|
||||
public class HousePlacementEntry
|
||||
{
|
||||
private Type m_Type;
|
||||
private int m_Description;
|
||||
private int m_Storage;
|
||||
private int m_Lockdowns;
|
||||
private int m_NewStorage;
|
||||
private int m_NewLockdowns;
|
||||
private int m_Vendors;
|
||||
private int m_Cost;
|
||||
private int m_MultiID;
|
||||
private Point3D m_Offset;
|
||||
|
||||
public Type Type{ get{ return m_Type; } }
|
||||
|
||||
public int Description{ get{ return m_Description; } }
|
||||
public int Storage{ get{ return BaseHouse.NewVendorSystem ? m_NewStorage : m_Storage; } }
|
||||
public int Lockdowns{ get{ return BaseHouse.NewVendorSystem ? m_NewLockdowns : m_Lockdowns; } }
|
||||
public int Vendors{ get{ return m_Vendors; } }
|
||||
public int Cost{ get{ return m_Cost; } }
|
||||
|
||||
public int MultiID{ get{ return m_MultiID; } }
|
||||
public Point3D Offset{ get{ return m_Offset; } }
|
||||
|
||||
public HousePlacementEntry( Type type, int description, int storage, int lockdowns, int newStorage, int newLockdowns, int vendors, int cost, int xOffset, int yOffset, int zOffset, int multiID )
|
||||
{
|
||||
m_Type = type;
|
||||
m_Description = description;
|
||||
m_Storage = storage;
|
||||
m_Lockdowns = lockdowns;
|
||||
m_NewStorage = newStorage;
|
||||
m_NewLockdowns = newLockdowns;
|
||||
m_Vendors = vendors;
|
||||
m_Cost = cost;
|
||||
|
||||
m_Offset = new Point3D( xOffset, yOffset, zOffset );
|
||||
|
||||
m_MultiID = multiID;
|
||||
}
|
||||
|
||||
public BaseHouse ConstructHouse( Mobile from )
|
||||
{
|
||||
try
|
||||
{
|
||||
object[] args;
|
||||
|
||||
if ( m_Type == typeof( HouseFoundation ) )
|
||||
args = new object[4]{ from, m_MultiID, m_Storage, m_Lockdowns };
|
||||
else if ( m_Type == typeof( SmallOldHouse ) || m_Type == typeof( SmallShop ) || m_Type == typeof( TwoStoryHouse ) )
|
||||
args = new object[2]{ from, m_MultiID };
|
||||
else
|
||||
args = new object[1]{ from };
|
||||
|
||||
return Activator.CreateInstance( m_Type, args ) as BaseHouse;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void PlacementWarning_Callback( Mobile from, bool okay, object state )
|
||||
{
|
||||
if ( !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
return;
|
||||
|
||||
PreviewHouse prevHouse = (PreviewHouse)state;
|
||||
|
||||
if ( !okay )
|
||||
{
|
||||
prevHouse.Delete();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( prevHouse.Deleted )
|
||||
{
|
||||
/* Too much time has passed and the test house you created has been deleted.
|
||||
* Please try again!
|
||||
*/
|
||||
from.SendGump( new NoticeGump( 1060637, 30720, 1060647, 32512, 320, 180, null, null ) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Point3D center = prevHouse.Location;
|
||||
Map map = prevHouse.Map;
|
||||
|
||||
prevHouse.Delete();
|
||||
|
||||
ArrayList toMove;
|
||||
//Point3D center = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z );
|
||||
HousePlacementResult res = HousePlacement.Check( from, m_MultiID, center, out toMove );
|
||||
|
||||
switch ( res )
|
||||
{
|
||||
case HousePlacementResult.Valid:
|
||||
{
|
||||
if ( from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 501271 ); // You already own a house, you may not place another!
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseHouse house = ConstructHouse( from );
|
||||
|
||||
if ( house == null )
|
||||
return;
|
||||
|
||||
house.Price = m_Cost;
|
||||
|
||||
if ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
{
|
||||
from.SendMessage( "{0} gold would have been withdrawn from your inn chest if you were not a GM.", m_Cost.ToString() );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( Innkeeper.Withdraw( from, m_Cost ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1060398, m_Cost.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your inn chest.
|
||||
}
|
||||
else
|
||||
{
|
||||
house.RemoveKeys( from );
|
||||
house.Delete();
|
||||
from.SendLocalizedMessage( 1060646 ); // You do not have the funds available in your inn chest to purchase this house. Try placing a smaller house, or adding gold or gold deeds to your inn chest.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
house.MoveToWorld( center, from.Map );
|
||||
|
||||
for ( int i = 0; i < toMove.Count; ++i )
|
||||
{
|
||||
object o = toMove[ i ];
|
||||
|
||||
if ( o is Mobile )
|
||||
( (Mobile) o ).Location = house.BanLocation;
|
||||
else if ( o is Item )
|
||||
( (Item) o ).Location = house.BanLocation;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case HousePlacementResult.BadItem:
|
||||
case HousePlacementResult.BadLand:
|
||||
case HousePlacementResult.BadStatic:
|
||||
case HousePlacementResult.BadRegionHidden:
|
||||
case HousePlacementResult.NoSurface:
|
||||
{
|
||||
from.SendLocalizedMessage( 1043287 ); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
|
||||
break;
|
||||
}
|
||||
case HousePlacementResult.BadRegion:
|
||||
{
|
||||
from.SendLocalizedMessage( 501265 ); // Housing cannot be created in this area.
|
||||
break;
|
||||
}
|
||||
case HousePlacementResult.BadRegionTemp:
|
||||
{
|
||||
from.SendLocalizedMessage( 501270 ); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool OnPlacement( Mobile from, Point3D p )
|
||||
{
|
||||
if ( !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
return false;
|
||||
|
||||
ArrayList toMove;
|
||||
Point3D center = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z );
|
||||
HousePlacementResult res = HousePlacement.Check( from, m_MultiID, center, out toMove );
|
||||
|
||||
switch ( res )
|
||||
{
|
||||
case HousePlacementResult.Valid:
|
||||
{
|
||||
if ( from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 501271 ); // You already own a house, you may not place another!
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1011576 ); // This is a valid location.
|
||||
|
||||
PreviewHouse prev = new PreviewHouse( m_MultiID );
|
||||
|
||||
MultiComponentList mcl = prev.Components;
|
||||
|
||||
Point3D banLoc = new Point3D( center.X + mcl.Min.X, center.Y + mcl.Max.Y + 1, center.Z );
|
||||
|
||||
for ( int i = 0; i < mcl.List.Length; ++i )
|
||||
{
|
||||
MultiTileEntry entry = mcl.List[i];
|
||||
|
||||
int itemID = entry.m_ItemID;
|
||||
|
||||
if ( itemID >= 0xBA3 && itemID <= 0xC0E )
|
||||
{
|
||||
banLoc = new Point3D( center.X + entry.m_OffsetX, center.Y + entry.m_OffsetY, center.Z );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i < toMove.Count; ++i )
|
||||
{
|
||||
object o = toMove[i];
|
||||
|
||||
if ( o is Mobile )
|
||||
((Mobile)o).Location = banLoc;
|
||||
else if ( o is Item )
|
||||
((Item)o).Location = banLoc;
|
||||
}
|
||||
|
||||
prev.MoveToWorld( center, from.Map );
|
||||
|
||||
/* You are about to place a new house.
|
||||
* Placing this house will condemn any and all of your other houses that you may have.
|
||||
* All of your houses on all shards will be affected.
|
||||
*
|
||||
* In addition, you will not be able to place another house or have one transferred to you for one (1) real-life week.
|
||||
*
|
||||
* Once you accept these terms, these effects cannot be reversed.
|
||||
* Re-deeding or transferring your new house will not uncondemn your other house(s) nor will the one week timer be removed.
|
||||
*
|
||||
* If you are absolutely certain you wish to proceed, click the button next to OKAY below.
|
||||
* If you do not wish to trade for this house, click CANCEL.
|
||||
*/
|
||||
from.SendGump( new WarningGump( 1060635, 30720, 1049583, 32512, 420, 280, new WarningGumpCallback( PlacementWarning_Callback ), prev ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case HousePlacementResult.BadItem:
|
||||
case HousePlacementResult.BadLand:
|
||||
case HousePlacementResult.BadStatic:
|
||||
case HousePlacementResult.BadRegionHidden:
|
||||
case HousePlacementResult.NoSurface:
|
||||
{
|
||||
from.SendLocalizedMessage( 1043287 ); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
|
||||
break;
|
||||
}
|
||||
case HousePlacementResult.BadRegion:
|
||||
{
|
||||
from.SendLocalizedMessage( 501265 ); // Housing cannot be created in this area.
|
||||
break;
|
||||
}
|
||||
case HousePlacementResult.BadRegionTemp:
|
||||
{
|
||||
from.SendLocalizedMessage( 501270 ); //Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Hashtable m_Table;
|
||||
|
||||
static HousePlacementEntry()
|
||||
{
|
||||
m_Table = new Hashtable();
|
||||
|
||||
FillTable( m_ClassicHouses );
|
||||
}
|
||||
|
||||
public static HousePlacementEntry Find( BaseHouse house )
|
||||
{
|
||||
object obj = m_Table[house.GetType()];
|
||||
|
||||
if ( obj is HousePlacementEntry )
|
||||
{
|
||||
return ((HousePlacementEntry)obj);
|
||||
}
|
||||
else if ( obj is ArrayList )
|
||||
{
|
||||
ArrayList list = (ArrayList)obj;
|
||||
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
{
|
||||
HousePlacementEntry e = (HousePlacementEntry)list[i];
|
||||
|
||||
if ( e.m_MultiID == house.ItemID )
|
||||
return e;
|
||||
}
|
||||
}
|
||||
else if ( obj is Hashtable )
|
||||
{
|
||||
Hashtable table = (Hashtable)obj;
|
||||
|
||||
obj = table[house.ItemID];
|
||||
|
||||
if ( obj is HousePlacementEntry )
|
||||
return (HousePlacementEntry)obj;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void FillTable( HousePlacementEntry[] entries )
|
||||
{
|
||||
for ( int i = 0; i < entries.Length; ++i )
|
||||
{
|
||||
HousePlacementEntry e = entries[i];
|
||||
|
||||
object obj = m_Table[e.m_Type];
|
||||
|
||||
if ( obj == null )
|
||||
{
|
||||
m_Table[e.m_Type] = e;
|
||||
}
|
||||
else if ( obj is HousePlacementEntry )
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
list.Add( obj );
|
||||
list.Add( e );
|
||||
|
||||
m_Table[e.m_Type] = list;
|
||||
}
|
||||
else if ( obj is ArrayList )
|
||||
{
|
||||
ArrayList list = (ArrayList)obj;
|
||||
|
||||
if ( list.Count == 8 )
|
||||
{
|
||||
Hashtable table = new Hashtable();
|
||||
|
||||
for ( int j = 0; j < list.Count; ++j )
|
||||
table[((HousePlacementEntry)list[j]).m_MultiID] = list[j];
|
||||
|
||||
table[e.m_MultiID] = e;
|
||||
|
||||
m_Table[e.m_Type] = table;
|
||||
}
|
||||
else
|
||||
{
|
||||
list.Add( e );
|
||||
}
|
||||
}
|
||||
else if ( obj is Hashtable )
|
||||
{
|
||||
((Hashtable)obj)[e.m_MultiID] = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static HousePlacementEntry[] m_ClassicHouses = new HousePlacementEntry[]
|
||||
{
|
||||
new HousePlacementEntry( typeof( BlueTent ), 1017341, 351, 81, 351, 81, 1, 15000, 0, 4, 0, 0x70),
|
||||
new HousePlacementEntry( typeof( GreenTent ), 1017342, 351, 81, 351, 81, 1, 15000, 0, 4, 0, 0x72),
|
||||
new HousePlacementEntry( typeof( SmallLogCabinSouth ), 1030871, 382, 112, 382, 112, 2, 30000, 0, 4, 0, 0x5A),
|
||||
new HousePlacementEntry( typeof( SmallLogCabinEast ), 1030871, 382, 112, 382, 112, 2, 30000, 0, 4, 0, 0x59),
|
||||
new HousePlacementEntry( typeof( NewSmallStoneHomeEast ), 1030845, 382, 112, 382, 112, 2, 30000, 4, -2, 0, 0x38),
|
||||
new HousePlacementEntry( typeof( NewSmallStoneHouseEast ), 1030848, 382, 112, 382, 112, 2, 30000, 4, -2, 0, 0x3B),
|
||||
new HousePlacementEntry( typeof( SmallOldHouse ), 1011303, 382, 112, 382, 112, 2, 30000, 0, 4, 0, 0x64),
|
||||
new HousePlacementEntry( typeof( SmallOldHouse ), 1011304, 382, 112, 382, 112, 2, 30000, 0, 4, 0, 0x66),
|
||||
new HousePlacementEntry( typeof( SmallOldHouse ), 1011305, 382, 112, 382, 112, 2, 30000, 0, 4, 0, 0x68),
|
||||
new HousePlacementEntry( typeof( SmallOldHouse ), 1011306, 382, 112, 382, 112, 2, 30000, 0, 4, 0, 0x6A),
|
||||
new HousePlacementEntry( typeof( SmallOldHouse ), 1011307, 382, 112, 382, 112, 2, 30000, 0, 4, 0, 0x6C),
|
||||
new HousePlacementEntry( typeof( SmallOldHouse ), 1011308, 382, 112, 382, 112, 2, 30000, 0, 4, 0, 0x6E),
|
||||
new HousePlacementEntry( typeof( NewSmallStoneStoreFront ), 1030844, 410, 140, 410, 140, 3, 45000, 0, 4, 0, 0x37),
|
||||
new HousePlacementEntry( typeof( NewSmallWoodenShackPorch ), 1030849, 410, 140, 410, 140, 3, 45000, -3, 4, 0, 0x46),
|
||||
new HousePlacementEntry( typeof( SmallShop ), 1011321, 444, 174, 444, 174, 4, 60000, -1, 4, 0, 0xA0),
|
||||
new HousePlacementEntry( typeof( SmallShop ), 1011322, 444, 174, 444, 174, 4, 60000, 0, 4, 0, 0xA2),
|
||||
new HousePlacementEntry( typeof( NewPlainStoneHouse ), 1030851, 456, 186, 456, 186, 5, 65000, -5, 6, 0, 0x48),
|
||||
new HousePlacementEntry( typeof( NewSmallLogCabinWithDeck ), 1030860, 449, 179, 449, 179, 4, 65000, 1, 4, 0, 0x51),
|
||||
new HousePlacementEntry( typeof( NewPlainPlasterHouse ), 1030850, 463, 193, 463, 193, 5, 70000, -5, 4, 0, 0x47),
|
||||
new HousePlacementEntry( typeof( NewSmallSandstoneWorkshop ), 1030857, 458, 188, 458, 188, 5, 70000, 4, 4, 0, 0x4E),
|
||||
new HousePlacementEntry( typeof( NewTwoStorySmallPlasterDwelling ), 1030855, 470, 200, 470, 200, 5, 75000, 3, 3, 0, 0x4C),
|
||||
new HousePlacementEntry( typeof( Wagon ), 1030870, 470, 200, 470, 200, 5, 75000, 0, 0, 0, 0x57),
|
||||
new HousePlacementEntry( typeof( NewTwoStorySmallStoneDwelling ), 1030841, 470, 200, 470, 200, 5, 75000, 3, 3, 0, 0x44),
|
||||
new HousePlacementEntry( typeof( NewTwoStorySmallStoneHome ), 1030839, 470, 200, 470, 200, 5, 75000, 3, 3, 0, 0x42),
|
||||
new HousePlacementEntry( typeof( NewTwoStorySmallStoneHouse ), 1030840, 470, 200, 470, 200, 5, 75000, 3, 3, 0, 0x43),
|
||||
new HousePlacementEntry( typeof( NewTwoStorySmallWoodenDwelling ), 1030842, 470, 200, 470, 200, 5, 75000, 3, 3, 0, 0x45),
|
||||
new HousePlacementEntry( typeof( LogCabin ), 1011318, 478, 208, 478, 208, 5, 80000, 1, 6, 0, 0x9A),
|
||||
new HousePlacementEntry( typeof( NewLogCabin ), 1030859, 488, 218, 488, 218, 6, 80000, 2, 5, 0, 0x50),
|
||||
new HousePlacementEntry( typeof( NewSmallStoneShoppe ), 1030835, 478, 208, 478, 208, 5, 80000, -5, 6, 0, 0x3E),
|
||||
new HousePlacementEntry( typeof( NewWoodenHomePorch ), 1030836, 487, 217, 487, 217, 6, 80000, 2, 5, 0, 0x3F),
|
||||
new HousePlacementEntry( typeof( SmallTower ), 1011317, 500, 230, 500, 230, 6, 85000, 3, 4, 0, 0x98),
|
||||
new HousePlacementEntry( typeof( NewSmallStoneTemple ), 1030856, 504, 234, 504, 234, 6, 90000, 4, -3, 0, 0x4D),
|
||||
new HousePlacementEntry( typeof( NewBrickHomeWithFrontDeck ), 1030867, 518, 248, 518, 248, 7, 95000, 0, 7, 0, 0x54),
|
||||
new HousePlacementEntry( typeof( NewPlasterHousePictureWindow ), 1030832, 515, 245, 515, 245, 7, 95000, 7, -6, 0, 0x35),
|
||||
new HousePlacementEntry( typeof( NewStoneHomeWithEnclosedPatio ), 1030858, 516, 246, 516, 246, 7, 95000, 7, 0, 0, 0x4F),
|
||||
new HousePlacementEntry( typeof( SandStonePatio ), 1011320, 520, 250, 520, 250, 7, 95000, -1, 4, 0, 0x9C),
|
||||
new HousePlacementEntry( typeof( NewOldStoneHomeShoppe ), 1030864, 526, 256, 526, 256, 7, 100000, 8, -5, 0, 0x5F),
|
||||
new HousePlacementEntry( typeof( NewBrickHomeWithLargePorch ), 1030869, 533, 263, 533, 263, 7, 105000, -6, 6, 0, 0x56),
|
||||
new HousePlacementEntry( typeof( GuildHouse ), 1011309, 544, 274, 544, 274, 7, 110000, -1, 7, 0, 0x74),
|
||||
new HousePlacementEntry( typeof( LargePatioHouse ), 1011315, 546, 276, 546, 276, 8, 110000, -4, 7, 0, 0x8C),
|
||||
new HousePlacementEntry( typeof( NewTwoStoryWoodenHomeWithPorch ), 1030834, 562, 292, 562, 292, 8, 115000, 6, 4, 0, 0x3D),
|
||||
new HousePlacementEntry( typeof( TwoStoryVilla ), 1011319, 560, 290, 560, 290, 8, 115000, 3, 6, 0, 0x9E),
|
||||
new HousePlacementEntry( typeof( NewTwoStoryBrickHouse ), 1030831, 568, 298, 568, 298, 8, 120000, -4, 5, 0, 0x34),
|
||||
new HousePlacementEntry( typeof( NewFancyStoneWoodHome ), 1030846, 580, 310, 580, 310, 9, 125000, -4, 5, 0, 0x39),
|
||||
new HousePlacementEntry( typeof( NewTwoStoryStoneVilla ), 1030854, 589, 319, 589, 319, 9, 130000, 4, 8, 0, 0x4B),
|
||||
new HousePlacementEntry( typeof( NewWoodenHomeUpperDeck ), 1030853, 590, 320, 590, 320, 9, 130000, -4, 5, 0, 0x4A),
|
||||
new HousePlacementEntry( typeof( NewBrickArena ), 1030862, 608, 338, 608, 338, 10, 140000, -8, 11, 0, 0x5D),
|
||||
new HousePlacementEntry( typeof( NewMarbleShoppe ), 1030868, 608, 338, 608, 338, 10, 140000, -5, 6, 0, 0x55),
|
||||
new HousePlacementEntry( typeof( NewPlasterHomeDirtDeck ), 1030852, 622, 352, 622, 352, 10, 145000, -2, 7, 0, 0x49),
|
||||
new HousePlacementEntry( typeof( NewTwoStoryBrickHome ), 1030833, 625, 355, 625, 355, 10, 150000, -3, 7, 0, 0x3C),
|
||||
new HousePlacementEntry( typeof( NewBrickHouseWithSteeple ), 1030830, 654, 384, 654, 384, 11, 160000, 0, 6, 0, 0x33),
|
||||
new HousePlacementEntry( typeof( NewFancyWoodenStoneHouse ), 1030847, 653, 383, 653, 383, 11, 160000, 6, -4, 0, 0x3A),
|
||||
new HousePlacementEntry( typeof( TwoStoryHouse ), 1011310, 694, 424, 694, 424, 12, 180000, -3, 7, 0, 0x76),
|
||||
new HousePlacementEntry( typeof( TwoStoryHouse ), 1011311, 694, 424, 694, 424, 12, 180000, -3, 7, 0, 0x78),
|
||||
new HousePlacementEntry( typeof( LargeMarbleHouse ), 1011316, 700, 430, 700, 430, 13, 185000, -4, 7, 0, 0x96),
|
||||
new HousePlacementEntry( typeof( NewTwoStorySandstoneHouse ), 1030829, 725, 455, 725, 455, 14, 195000, 7, -4, 0, 0x32),
|
||||
new HousePlacementEntry( typeof( NewSmallStoneTower ), 1030837, 731, 461, 731, 461, 14, 200000, -2, 6, 0, 0x40),
|
||||
new HousePlacementEntry( typeof( NewSmallBrickCastle ), 1030865, 743, 473, 743, 473, 14, 205000, -5, 6, 0, 0x60),
|
||||
new HousePlacementEntry( typeof( NewStoneFort ), 1030863, 750, 480, 750, 480, 14, 210000, -5, 7, 0, 0x5E),
|
||||
new HousePlacementEntry( typeof( CastleTower ), 1024781, 839, 569, 839, 569, 17, 250000, 5, 7, 0, 0x30),
|
||||
new HousePlacementEntry( typeof( NewRaisedBrickHome ), 1030861, 866, 596, 866, 596, 18, 265000, 3, 7, 0, 0x52),
|
||||
new HousePlacementEntry( typeof( NewSmallWizardTower ), 1030866, 869, 599, 869, 599, 18, 270000, -2, 6, 0, 0x53),
|
||||
new HousePlacementEntry( typeof( NewWoodenMansion ), 1030843, 920, 650, 920, 650, 20, 290000, 6, 7, 0, 0x36),
|
||||
new HousePlacementEntry( typeof( NewThreeStoryStoneVilla ), 1030838, 965, 695, 965, 695, 22, 310000, -6, 7, 0, 0x41),
|
||||
new HousePlacementEntry( typeof( Tower ), 1011312, 1476, 1206, 1476, 1206, 24, 560000, 0, 7, 0, 0x7A),
|
||||
new HousePlacementEntry( typeof( LargeTent ), 1024851, 1572, 1302, 1572, 1302, 28, 610000, 1, 13, 0, 0x5C),
|
||||
new HousePlacementEntry( typeof( Keep ), 1011313, 1847, 1577, 1847, 1577, 30, 740000, 0, 11, 0, 0x7C),
|
||||
new HousePlacementEntry( typeof( Pyramid ), 1024788, 1856, 1586, 1856, 1586, 32, 750000, 3, 16, 0, 0x5B),
|
||||
new HousePlacementEntry( typeof( LogMansion ), 1024875, 2777, 2507, 2777, 2507, 34, 800000, 13, 13, 0, 0x58),
|
||||
new HousePlacementEntry( typeof( Castle ), 1011314, 2777, 2507, 2777, 2507, 34, 800000, 0, 16, 0, 0x7E),
|
||||
new HousePlacementEntry( typeof( Fortress ), 1024869, 4448, 4178, 4448, 4178, 36, 900000, 4, 16, 0, 0x31)
|
||||
};
|
||||
|
||||
public static HousePlacementEntry[] ClassicHouses{ get{ return m_ClassicHouses; } }
|
||||
}
|
||||
}
|
||||
293
Scripts/Multis/HouseSign.cs
Normal file
293
Scripts/Multis/HouseSign.cs
Normal file
|
|
@ -0,0 +1,293 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Multis;
|
||||
using Server.Gumps;
|
||||
using Server.ContextMenus;
|
||||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class HouseSign : Item
|
||||
{
|
||||
private BaseHouse m_Owner;
|
||||
private Mobile m_OrgOwner;
|
||||
|
||||
public HouseSign( BaseHouse owner ) : base( 0xBD2 )
|
||||
{
|
||||
m_Owner = owner;
|
||||
m_OrgOwner = m_Owner.Owner;
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public HouseSign( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
if ( Name == null )
|
||||
return "An Unnamed House";
|
||||
|
||||
return Name;
|
||||
}
|
||||
|
||||
public BaseHouse Owner
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Owner;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool RestrictDecay
|
||||
{
|
||||
get{ return ( m_Owner != null && m_Owner.RestrictDecay ); }
|
||||
set{ if ( m_Owner != null ) m_Owner.RestrictDecay = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile OriginalOwner
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_OrgOwner;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
if ( m_Owner != null && !m_Owner.Deleted )
|
||||
m_Owner.Delete();
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
list.Add( 1061638 ); // A House Sign
|
||||
}
|
||||
|
||||
public override bool ForceShowProperties{ get{ return ObjectPropertyList.Enabled; } }
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
list.Add( 1061639, Utility.FixHtml( GetName() ) ); // Name: ~1_NAME~
|
||||
list.Add( 1061640, (m_Owner == null || m_Owner.Owner == null) ? "nobody" : m_Owner.Owner.Name ); // Owner: ~1_OWNER~
|
||||
|
||||
if ( m_Owner != null )
|
||||
{
|
||||
list.Add( m_Owner.Public ? 1061641 : 1061642 ); // This House is Open to the Public : This is a Private Home
|
||||
|
||||
DecayLevel level = m_Owner.DecayLevel;
|
||||
|
||||
if ( level == DecayLevel.DemolitionPending )
|
||||
{
|
||||
list.Add( 1062497 ); // Demolition Pending
|
||||
}
|
||||
else if ( level != DecayLevel.Ageless )
|
||||
{
|
||||
if ( level == DecayLevel.Collapsed )
|
||||
level = DecayLevel.IDOC;
|
||||
|
||||
list.Add( 1062028, String.Format( "#{0}", 1043009 + (int)level ) ); // Condition: This structure is ...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
if ( m_Owner != null && BaseHouse.DecayEnabled && m_Owner.DecayPeriod != TimeSpan.Zero )
|
||||
{
|
||||
string message;
|
||||
|
||||
switch ( m_Owner.DecayLevel )
|
||||
{
|
||||
case DecayLevel.Ageless: message = "ageless"; break;
|
||||
case DecayLevel.Fairly: message = "fairly worn"; break;
|
||||
case DecayLevel.Greatly: message = "greatly worn"; break;
|
||||
case DecayLevel.LikeNew: message = "like new"; break;
|
||||
case DecayLevel.Slightly: message = "slightly worn"; break;
|
||||
case DecayLevel.Somewhat: message = "somewhat worn"; break;
|
||||
default: message = "in danger of collapsing"; break;
|
||||
}
|
||||
|
||||
LabelTo( from, "This house is {0}.", message );
|
||||
}
|
||||
|
||||
base.OnSingleClick( from );
|
||||
}
|
||||
|
||||
public void ShowSign( Mobile m )
|
||||
{
|
||||
if ( m_Owner != null )
|
||||
{
|
||||
if ( m_Owner.IsFriend( m ) && m.AccessLevel < AccessLevel.GameMaster )
|
||||
{
|
||||
m_Owner.RefreshDecay();
|
||||
m.SendLocalizedMessage( 501293 ); // Welcome back to the house, friend!
|
||||
}
|
||||
|
||||
if ( m_Owner.IsAosRules )
|
||||
m.SendGump( new HouseGumpAOS( HouseGumpPageAOS.Information, m, m_Owner ) );
|
||||
else
|
||||
m.SendGump( new HouseGump( m, m_Owner ) );
|
||||
}
|
||||
}
|
||||
|
||||
public void ClaimGump_Callback( Mobile from, bool okay, object state )
|
||||
{
|
||||
if ( okay && m_Owner != null && m_Owner.Owner == null && m_Owner.DecayLevel != DecayLevel.DemolitionPending )
|
||||
{
|
||||
bool canClaim = false;
|
||||
|
||||
if ( m_Owner.CoOwners == null || m_Owner.CoOwners.Count == 0 )
|
||||
canClaim = m_Owner.IsFriend( from );
|
||||
else
|
||||
canClaim = m_Owner.IsCoOwner( from );
|
||||
|
||||
if ( canClaim && !BaseHouse.HasAccountHouse( from ) )
|
||||
{
|
||||
m_Owner.Owner = from;
|
||||
m_Owner.LastTraded = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
ShowSign( from );
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile m )
|
||||
{
|
||||
if ( m_Owner == null )
|
||||
return;
|
||||
|
||||
if ( m.AccessLevel < AccessLevel.GameMaster && m_Owner.Owner == null && m_Owner.DecayLevel != DecayLevel.DemolitionPending )
|
||||
{
|
||||
bool canClaim = false;
|
||||
|
||||
if ( m_Owner.CoOwners == null || m_Owner.CoOwners.Count == 0 )
|
||||
canClaim = m_Owner.IsFriend( m );
|
||||
else
|
||||
canClaim = m_Owner.IsCoOwner( m );
|
||||
|
||||
if ( canClaim && !BaseHouse.HasAccountHouse( m ) )
|
||||
{
|
||||
/* You do not currently own any house on any shard with this account,
|
||||
* and this house currently does not have an owner. If you wish, you
|
||||
* may choose to claim this house and become its rightful owner. If
|
||||
* you do this, it will become your Primary house and automatically
|
||||
* refresh. If you claim this house, you will be unable to place
|
||||
* another house or have another house transferred to you for the
|
||||
* next 7 days. Do you wish to claim this house?
|
||||
*/
|
||||
m.SendGump( new WarningGump( 501036, 32512, 1049719, 32512, 420, 280, new WarningGumpCallback( ClaimGump_Callback ), null ) );
|
||||
}
|
||||
}
|
||||
|
||||
ShowSign( m );
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
|
||||
if ( BaseHouse.NewVendorSystem && from.Alive && Owner != null && Owner.IsAosRules )
|
||||
{
|
||||
if ( Owner.AreThereAvailableVendorsFor( from ) )
|
||||
list.Add( new VendorsEntry( this ) );
|
||||
|
||||
if ( Owner.VendorInventories.Count > 0 )
|
||||
list.Add( new ReclaimVendorInventoryEntry( this ) );
|
||||
}
|
||||
}
|
||||
|
||||
private class VendorsEntry : ContextMenuEntry
|
||||
{
|
||||
private HouseSign m_Sign;
|
||||
|
||||
public VendorsEntry( HouseSign sign ) : base( 6211 )
|
||||
{
|
||||
m_Sign = sign;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
Mobile from = this.Owner.From;
|
||||
|
||||
if ( !from.CheckAlive() || m_Sign.Deleted || m_Sign.Owner == null || !m_Sign.Owner.AreThereAvailableVendorsFor( from ) )
|
||||
return;
|
||||
|
||||
if ( from.Map != m_Sign.Map || !from.InRange( m_Sign, 5 ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062429 ); // You must be within five paces of the house sign to use this option.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendGump( new HouseGumpAOS( HouseGumpPageAOS.Vendors, from, m_Sign.Owner ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class ReclaimVendorInventoryEntry : ContextMenuEntry
|
||||
{
|
||||
private HouseSign m_Sign;
|
||||
|
||||
public ReclaimVendorInventoryEntry( HouseSign sign ) : base( 6213 )
|
||||
{
|
||||
m_Sign = sign;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
Mobile from = this.Owner.From;
|
||||
|
||||
if ( m_Sign.Deleted || m_Sign.Owner == null || m_Sign.Owner.VendorInventories.Count == 0 || !from.CheckAlive() )
|
||||
return;
|
||||
|
||||
if ( from.Map != m_Sign.Map || !from.InRange( m_Sign, 5 ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062429 ); // You must be within five paces of the house sign to use this option.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.CloseGump( typeof( VendorInventoryGump ) );
|
||||
from.SendGump( new VendorInventoryGump( m_Sign.Owner, from ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( m_Owner );
|
||||
writer.Write( m_OrgOwner );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Owner = reader.ReadItem() as BaseHouse;
|
||||
m_OrgOwner = reader.ReadMobile();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( this.Name == "a house sign" )
|
||||
this.Name = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
187
Scripts/Multis/HouseTeleporter.cs
Normal file
187
Scripts/Multis/HouseTeleporter.cs
Normal file
|
|
@ -0,0 +1,187 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Targeting;
|
||||
using System.Collections.Generic;
|
||||
using Server.ContextMenus;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class HouseTeleporter : Item, ISecurable
|
||||
{
|
||||
private Item m_Target;
|
||||
private SecureLevel m_Level;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Item Target
|
||||
{
|
||||
get{ return m_Target; }
|
||||
set{ m_Target = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public SecureLevel Level
|
||||
{
|
||||
get{ return m_Level; }
|
||||
set{ m_Level = value; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public HouseTeleporter( int itemID ) : this( itemID, null )
|
||||
{
|
||||
}
|
||||
|
||||
public HouseTeleporter( int itemID, Item target ) : base( itemID )
|
||||
{
|
||||
Movable = false;
|
||||
|
||||
m_Level = SecureLevel.Anyone;
|
||||
|
||||
m_Target = target;
|
||||
}
|
||||
|
||||
public bool CheckAccess( Mobile m )
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt( this );
|
||||
|
||||
if ( house != null && (house.Public ? house.IsBanned( m ) : !house.HasAccess( m )) )
|
||||
return false;
|
||||
|
||||
return ( house != null && house.HasSecureAccess( m, m_Level ) );
|
||||
}
|
||||
|
||||
public override bool OnMoveOver( Mobile m )
|
||||
{
|
||||
if ( m_Target != null && !m_Target.Deleted )
|
||||
{
|
||||
if ( CheckAccess( m ) )
|
||||
{
|
||||
if ( !m.Hidden || m.AccessLevel == AccessLevel.Player )
|
||||
new EffectTimer( Location, Map, 2023, 0x1F0, TimeSpan.FromSeconds( 0.4 ) ).Start();
|
||||
|
||||
new DelayTimer( this, m ).Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendLocalizedMessage( 1061637 ); // You are not allowed to access this.
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
SetSecureLevelEntry.AddTo( from, this, list );
|
||||
}
|
||||
|
||||
public HouseTeleporter( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( (int) m_Level );
|
||||
|
||||
writer.Write( (Item) m_Target );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Level = (SecureLevel)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Target = reader.ReadItem();
|
||||
|
||||
if ( version < 0 )
|
||||
m_Level = SecureLevel.Anyone;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class EffectTimer : Timer
|
||||
{
|
||||
private Point3D m_Location;
|
||||
private Map m_Map;
|
||||
private int m_EffectID;
|
||||
private int m_SoundID;
|
||||
|
||||
public EffectTimer( Point3D p, Map map, int effectID, int soundID, TimeSpan delay ) : base( delay )
|
||||
{
|
||||
m_Location = p;
|
||||
m_Map = map;
|
||||
m_EffectID = effectID;
|
||||
m_SoundID = soundID;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
Effects.SendLocationParticles( EffectItem.Create( m_Location, m_Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, m_EffectID, 0 );
|
||||
|
||||
if ( m_SoundID != -1 )
|
||||
Effects.PlaySound( m_Location, m_Map, m_SoundID );
|
||||
}
|
||||
}
|
||||
|
||||
private class DelayTimer : Timer
|
||||
{
|
||||
private HouseTeleporter m_Teleporter;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public DelayTimer( HouseTeleporter tp, Mobile m ) : base( TimeSpan.FromSeconds( 1.0 ) )
|
||||
{
|
||||
m_Teleporter = tp;
|
||||
m_Mobile = m;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
Item target = m_Teleporter.m_Target;
|
||||
|
||||
if ( target != null && !target.Deleted )
|
||||
{
|
||||
Mobile m = m_Mobile;
|
||||
|
||||
if ( m.Location == m_Teleporter.Location && m.Map == m_Teleporter.Map )
|
||||
{
|
||||
Point3D p = target.GetWorldTop();
|
||||
Map map = target.Map;
|
||||
|
||||
Server.Mobiles.BaseCreature.TeleportPets( m, p, map );
|
||||
|
||||
m.MoveToWorld( p, map );
|
||||
|
||||
if ( !m.Hidden || m.AccessLevel == AccessLevel.Player )
|
||||
{
|
||||
Effects.PlaySound( target.Location, target.Map, 0x1FE );
|
||||
|
||||
Effects.SendLocationParticles( EffectItem.Create( m_Teleporter.Location, m_Teleporter.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 2023, 0 );
|
||||
Effects.SendLocationParticles( EffectItem.Create( target.Location, target.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 5023, 0 );
|
||||
|
||||
new EffectTimer( target.Location, target.Map, 2023, -1, TimeSpan.FromSeconds( 0.4 ) ).Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
658
Scripts/Multis/Houses.cs
Normal file
658
Scripts/Multis/Houses.cs
Normal file
|
|
@ -0,0 +1,658 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Multis.Deeds;
|
||||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class SmallOldHouse : BaseHouse
|
||||
{
|
||||
public static Rectangle2D[] AreaArray = new Rectangle2D[]{ new Rectangle2D(-3,-3,7,7 ), new Rectangle2D( -1, 4, 3, 1 ) };
|
||||
|
||||
public override Rectangle2D[] Area{ get{ return AreaArray; } }
|
||||
public override Point3D BaseBanLocation{ get{ return new Point3D( 2, 4, 0 ); } }
|
||||
|
||||
public override int DefaultPrice{ get{ return 43800; } }
|
||||
|
||||
public SmallOldHouse( Mobile owner, int id ) : base( id, owner, 425, 3 )
|
||||
{
|
||||
uint keyValue = CreateKeys( owner );
|
||||
|
||||
AddSouthDoor( 0, 3, 7, keyValue );
|
||||
|
||||
SetSign( 2, 4, 5 );
|
||||
}
|
||||
|
||||
public SmallOldHouse( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override HouseDeed GetDeed()
|
||||
{
|
||||
switch ( ItemID )
|
||||
{
|
||||
case 0x64: return new StonePlasterHouseDeed();
|
||||
case 0x66: return new FieldStoneHouseDeed();
|
||||
case 0x68: return new SmallBrickHouseDeed();
|
||||
case 0x6A: return new WoodHouseDeed();
|
||||
case 0x6C: return new WoodPlasterHouseDeed();
|
||||
case 0x6E:
|
||||
default: return new ThatchedRoofCottageDeed();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int)0 );//version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class GuildHouse : BaseHouse
|
||||
{
|
||||
public static Rectangle2D[] AreaArray = new Rectangle2D[]{ new Rectangle2D( -7, -7, 14, 14 ), new Rectangle2D( -2, 7, 4, 1 ) };
|
||||
|
||||
public override int DefaultPrice{ get{ return 144500; } }
|
||||
|
||||
public override Rectangle2D[] Area{ get{ return AreaArray; } }
|
||||
public override Point3D BaseBanLocation{ get{ return new Point3D( 4, 8, 0 ); } }
|
||||
|
||||
public GuildHouse( Mobile owner ) : base( 0x74, owner, 1100, 8 )
|
||||
{
|
||||
uint keyValue = CreateKeys( owner );
|
||||
|
||||
AddSouthDoors( -1, 6, 7, keyValue );
|
||||
|
||||
SetSign( 4, 8, 16 );
|
||||
|
||||
AddSouthDoor( -3, -1, 7 );
|
||||
AddSouthDoor( 3, -1, 7 );
|
||||
}
|
||||
|
||||
public GuildHouse( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override HouseDeed GetDeed() { return new BrickHouseDeed(); }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int)0 );//version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class TwoStoryHouse : BaseHouse
|
||||
{
|
||||
public static Rectangle2D[] AreaArray = new Rectangle2D[]{ new Rectangle2D( -7, 0, 14, 7 ), new Rectangle2D( -7, -7, 9, 7 ), new Rectangle2D( -4, 7, 4, 1 ) };
|
||||
|
||||
public override Rectangle2D[] Area{ get{ return AreaArray; } }
|
||||
public override Point3D BaseBanLocation{ get{ return new Point3D( 2, 8, 0 ); } }
|
||||
|
||||
public override int DefaultPrice{ get{ return 192400; } }
|
||||
|
||||
public TwoStoryHouse( Mobile owner, int id ) : base( id, owner, 1370, 10 )
|
||||
{
|
||||
uint keyValue = CreateKeys( owner );
|
||||
|
||||
AddSouthDoors( -3, 6, 7, keyValue );
|
||||
|
||||
SetSign( 2, 8, 16 );
|
||||
|
||||
AddSouthDoor( -3, 0, 7 );
|
||||
AddSouthDoor( id == 0x76 ? -2 : -3, 0, 27 );
|
||||
}
|
||||
|
||||
public TwoStoryHouse( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override HouseDeed GetDeed()
|
||||
{
|
||||
switch( ItemID )
|
||||
{
|
||||
case 0x76: return new TwoStoryWoodPlasterHouseDeed();
|
||||
case 0x78:
|
||||
default: return new TwoStoryStonePlasterHouseDeed();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int)0 );//version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class Tower : BaseHouse
|
||||
{
|
||||
public static Rectangle2D[] AreaArray = new Rectangle2D[]{ new Rectangle2D( -7, -7, 16, 14 ), new Rectangle2D( -1, 7, 4, 2 ), new Rectangle2D( -11, 0, 4, 7 ), new Rectangle2D( 9, 0, 4, 7 ) };
|
||||
|
||||
public override int DefaultPrice{ get{ return 433200; } }
|
||||
|
||||
public override Rectangle2D[] Area{ get{ return AreaArray; } }
|
||||
public override Point3D BaseBanLocation{ get{ return new Point3D( 5, 8, 0 ); } }
|
||||
|
||||
public Tower( Mobile owner ) : base( 0x7A, owner, 2119, 15 )
|
||||
{
|
||||
uint keyValue = CreateKeys( owner );
|
||||
|
||||
AddSouthDoors( false, 0, 6, 6, keyValue );
|
||||
|
||||
SetSign( 5, 8, 16 );
|
||||
|
||||
AddSouthDoor( false, 3, -2, 6 );
|
||||
AddEastDoor( false, 1, 4, 26 );
|
||||
AddEastDoor( false, 1, 4, 46 );
|
||||
}
|
||||
|
||||
public Tower( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override HouseDeed GetDeed() { return new TowerDeed(); }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int)0 );//version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class Keep : BaseHouse//warning: ODD shape!
|
||||
{
|
||||
public static Rectangle2D[] AreaArray = new Rectangle2D[]{ new Rectangle2D( -11, -11, 7, 8 ), new Rectangle2D( -11, 5, 7, 8 ), new Rectangle2D( 6, -11, 7, 8 ), new Rectangle2D( 6, 5, 7, 8 ), new Rectangle2D( -9, -3, 5, 8 ), new Rectangle2D( 6, -3, 5, 8 ), new Rectangle2D( -4, -9, 10, 20 ), new Rectangle2D( -1, 11, 4, 1 ) };
|
||||
|
||||
public override int DefaultPrice{ get{ return 665200; } }
|
||||
|
||||
public override Rectangle2D[] Area{ get{ return AreaArray; } }
|
||||
public override Point3D BaseBanLocation{ get{ return new Point3D( 5, 13, 0 ); } }
|
||||
|
||||
public Keep( Mobile owner ) : base( 0x7C, owner, 2625, 18 )
|
||||
{
|
||||
uint keyValue = CreateKeys( owner );
|
||||
|
||||
AddSouthDoors( false, 0, 10, 6, keyValue );
|
||||
|
||||
SetSign( 5, 12, 16 );
|
||||
}
|
||||
|
||||
public Keep( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override HouseDeed GetDeed() { return new KeepDeed(); }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int)0 );//version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class Castle : BaseHouse
|
||||
{
|
||||
public static Rectangle2D[] AreaArray = new Rectangle2D[]{ new Rectangle2D( -15, -15, 31, 31 ), new Rectangle2D( -1, 16, 4, 1 ) };
|
||||
|
||||
public override int DefaultPrice{ get{ return 1022800; } }
|
||||
|
||||
public override Rectangle2D[] Area{ get{ return AreaArray; } }
|
||||
public override Point3D BaseBanLocation{ get{ return new Point3D( 5, 17, 0 ); } }
|
||||
|
||||
public Castle( Mobile owner ) : base( 0x7E, owner, 4076, 28 )
|
||||
{
|
||||
uint keyValue = CreateKeys( owner );
|
||||
|
||||
AddSouthDoors( false, 0, 15, 6, keyValue );
|
||||
|
||||
SetSign( 5, 17, 16 );
|
||||
|
||||
AddSouthDoors( false, 0, 11, 6, true );
|
||||
AddSouthDoors( false, 0, 5, 6, false );
|
||||
AddSouthDoors( false, -1, -11, 6, false );
|
||||
}
|
||||
|
||||
public Castle( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override HouseDeed GetDeed() { return new CastleDeed(); }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int)0 );//version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class LargePatioHouse : BaseHouse
|
||||
{
|
||||
public static Rectangle2D[] AreaArray = new Rectangle2D[]{ new Rectangle2D( -7, -7, 15, 14 ), new Rectangle2D( -5, 7, 4, 1 ) };
|
||||
|
||||
public override int DefaultPrice{ get{ return 152800; } }
|
||||
|
||||
public override Rectangle2D[] Area { get { return AreaArray; } }
|
||||
public override Point3D BaseBanLocation { get { return new Point3D( 1, 8, 0 ); } }
|
||||
|
||||
public LargePatioHouse( Mobile owner ) : base( 0x8C, owner, 1100, 8 )
|
||||
{
|
||||
uint keyValue = CreateKeys( owner );
|
||||
|
||||
AddSouthDoors( -4, 6, 7, keyValue );
|
||||
|
||||
SetSign( 1, 8, 16 );
|
||||
|
||||
AddEastDoor( 1, 4, 7 );
|
||||
AddEastDoor( 1, -4, 7 );
|
||||
AddSouthDoor( 4, -1, 7 );
|
||||
}
|
||||
|
||||
public LargePatioHouse( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override HouseDeed GetDeed() { return new LargePatioDeed(); }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int)0 );//version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class LargeMarbleHouse : BaseHouse
|
||||
{
|
||||
public static Rectangle2D[] AreaArray = new Rectangle2D[]{ new Rectangle2D( -7, -7, 15, 14 ), new Rectangle2D( -6, 7, 6, 1 ) };
|
||||
|
||||
public override int DefaultPrice{ get{ return 192000; } }
|
||||
|
||||
public override Rectangle2D[] Area { get { return AreaArray; } }
|
||||
public override Point3D BaseBanLocation { get { return new Point3D( 1, 8, 0 ); } }
|
||||
|
||||
public LargeMarbleHouse( Mobile owner ) : base( 0x96, owner, 1370, 10 )
|
||||
{
|
||||
uint keyValue = CreateKeys( owner );
|
||||
|
||||
AddSouthDoors( false, -4, 3, 4, keyValue );
|
||||
|
||||
SetSign( 1, 8, 11 );
|
||||
}
|
||||
|
||||
public LargeMarbleHouse( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override HouseDeed GetDeed() { return new LargeMarbleDeed(); }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int)0 );//version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class SmallTower : BaseHouse
|
||||
{
|
||||
public static Rectangle2D[] AreaArray = new Rectangle2D[]{ new Rectangle2D( -3, -3, 8, 7 ), new Rectangle2D( 2, 4, 3, 1 ) };
|
||||
|
||||
public override int DefaultPrice{ get{ return 88500; } }
|
||||
|
||||
public override Rectangle2D[] Area{ get{ return AreaArray; } }
|
||||
public override Point3D BaseBanLocation{ get{ return new Point3D( 1, 4, 0 ); } }
|
||||
|
||||
public SmallTower( Mobile owner ) : base( 0x98, owner, 580, 4 )
|
||||
{
|
||||
uint keyValue = CreateKeys( owner );
|
||||
|
||||
AddSouthDoor( false, 3, 3, 6, keyValue );
|
||||
|
||||
SetSign( 1, 4, 5 );
|
||||
}
|
||||
|
||||
public SmallTower( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override HouseDeed GetDeed() { return new SmallTowerDeed(); }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int)0 );//version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class LogCabin : BaseHouse
|
||||
{
|
||||
public static Rectangle2D[] AreaArray = new Rectangle2D[]{ new Rectangle2D( -3, -6, 8, 13 ) };
|
||||
|
||||
public override int DefaultPrice{ get{ return 97800; } }
|
||||
|
||||
public override Rectangle2D[] Area { get { return AreaArray; } }
|
||||
public override Point3D BaseBanLocation { get { return new Point3D( 5, 8, 0 ); } }
|
||||
|
||||
public LogCabin( Mobile owner ) : base( 0x9A, owner, 1100, 8 )
|
||||
{
|
||||
uint keyValue = CreateKeys( owner );
|
||||
|
||||
AddSouthDoor( 1, 4, 8, keyValue );
|
||||
|
||||
SetSign( 5, 8, 20 );
|
||||
|
||||
AddSouthDoor( 1, 0, 29 );
|
||||
}
|
||||
|
||||
public LogCabin( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override HouseDeed GetDeed() { return new LogCabinDeed(); }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int)0 );//version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class SandStonePatio : BaseHouse
|
||||
{
|
||||
public static Rectangle2D[] AreaArray = new Rectangle2D[]{ new Rectangle2D( -5, -4, 12, 8 ), new Rectangle2D( -2, 4, 3, 1 ) };
|
||||
|
||||
public override int DefaultPrice{ get{ return 90900; } }
|
||||
|
||||
public override Rectangle2D[] Area { get { return AreaArray; } }
|
||||
public override Point3D BaseBanLocation { get { return new Point3D( 4, 6, 0 ); } }
|
||||
|
||||
public SandStonePatio( Mobile owner ) : base( 0x9C, owner, 850, 6 )
|
||||
{
|
||||
uint keyValue = CreateKeys( owner );
|
||||
|
||||
AddSouthDoor( -1, 3, 6, keyValue );
|
||||
|
||||
SetSign( 4, 6, 24 );
|
||||
}
|
||||
|
||||
public SandStonePatio( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override HouseDeed GetDeed() { return new SandstonePatioDeed(); }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int)0 );//version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class TwoStoryVilla : BaseHouse
|
||||
{
|
||||
public static Rectangle2D[] AreaArray = new Rectangle2D[]{ new Rectangle2D( -5, -5, 11, 11 ), new Rectangle2D( 2, 6, 4, 1 ) };
|
||||
|
||||
public override int DefaultPrice{ get{ return 136500; } }
|
||||
|
||||
public override Rectangle2D[] Area{ get{ return AreaArray; } }
|
||||
public override Point3D BaseBanLocation{ get{ return new Point3D( 3, 8, 0 ); } }
|
||||
|
||||
public TwoStoryVilla( Mobile owner ) : base( 0x9E, owner, 1100, 8 )
|
||||
{
|
||||
uint keyValue = CreateKeys( owner );
|
||||
|
||||
AddSouthDoors( 3, 1, 5, keyValue );
|
||||
|
||||
SetSign( 3, 8, 24 );
|
||||
|
||||
AddEastDoor( 1, 0, 25 );
|
||||
AddSouthDoor( -3, -1, 25 );
|
||||
}
|
||||
|
||||
public TwoStoryVilla( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override HouseDeed GetDeed() { return new VillaDeed(); }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int)0 );//version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class BlueTent : BaseHouse
|
||||
{
|
||||
public static Rectangle2D[] AreaArray = new Rectangle2D[]{ new Rectangle2D( -3, -3, 8, 8 )};
|
||||
|
||||
public override int DefaultPrice{ get{ return 40000; } }
|
||||
|
||||
public override Rectangle2D[] Area{ get{ return AreaArray; } }
|
||||
|
||||
public override Point3D BaseBanLocation{ get{ return new Point3D( 1, 4, 0 ); } }
|
||||
|
||||
public BlueTent( Mobile owner ) : base( 0x70, owner, 500, 4 )
|
||||
{
|
||||
Price = 12000;
|
||||
uint keyValue = CreateKeys( owner );
|
||||
|
||||
SetSign( -1, 5, 9 );
|
||||
// Turn sign
|
||||
ChangeSignType(0x0bd1);
|
||||
|
||||
}
|
||||
|
||||
public BlueTent ( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override bool IsInside( Point3D p, int height )
|
||||
{
|
||||
if ( Deleted )
|
||||
return false;
|
||||
|
||||
foreach(Rectangle2D rect in Area)
|
||||
{
|
||||
if(rect.Contains(new Point2D( p.X - X, p.Y - Y )))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override HouseDeed GetDeed() { return new BlueTentDeed(); }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int)0 );//version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class GreenTent : BaseHouse
|
||||
{
|
||||
public static Rectangle2D[] AreaArray = new Rectangle2D[]{ new Rectangle2D( -3, -3, 8, 8 )};
|
||||
|
||||
public override int DefaultPrice{ get{ return 40000; } }
|
||||
|
||||
public override Rectangle2D[] Area{ get{ return AreaArray; } }
|
||||
|
||||
public override Point3D BaseBanLocation{ get{ return new Point3D( 1, 4, 0 ); } }
|
||||
|
||||
public GreenTent( Mobile owner ) : base( 0x72, owner, 500, 4 )
|
||||
{
|
||||
Price = 12000;
|
||||
uint keyValue = CreateKeys( owner );
|
||||
|
||||
SetSign( -1, 5, 9 );
|
||||
// Turn sign
|
||||
ChangeSignType(0x0bd1);
|
||||
}
|
||||
|
||||
public GreenTent ( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override bool IsInside( Point3D p, int height )
|
||||
{
|
||||
if ( Deleted )
|
||||
return false;
|
||||
|
||||
foreach(Rectangle2D rect in Area)
|
||||
{
|
||||
if(rect.Contains(new Point2D( p.X - X, p.Y - Y )))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override HouseDeed GetDeed() { return new GreenTentDeed(); }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int)0 );//version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class SmallShop : BaseHouse
|
||||
{
|
||||
public override Rectangle2D[] Area { get { return ( ItemID == 0x40A2 ? AreaArray1 : AreaArray2 ); } }
|
||||
public override Point3D BaseBanLocation { get { return new Point3D( 3, 4, 0 ); } }
|
||||
|
||||
public override int DefaultPrice{ get{ return 63000; } }
|
||||
|
||||
public static Rectangle2D[] AreaArray1 = new Rectangle2D[]{ new Rectangle2D(-3,-3,7,7), new Rectangle2D( -1, 4, 4, 1 ) };
|
||||
public static Rectangle2D[] AreaArray2 = new Rectangle2D[]{ new Rectangle2D(-3,-3,7,7), new Rectangle2D( -2, 4, 3, 1 ) };
|
||||
|
||||
public SmallShop( Mobile owner, int id ) : base( id, owner, 425, 3 )
|
||||
{
|
||||
uint keyValue = CreateKeys( owner );
|
||||
|
||||
BaseDoor door = MakeDoor( false, DoorFacing.EastCW );
|
||||
|
||||
door.Locked = true;
|
||||
door.KeyValue = keyValue;
|
||||
|
||||
if ( door is BaseHouseDoor )
|
||||
((BaseHouseDoor)door).Facing = DoorFacing.EastCCW;
|
||||
|
||||
AddDoor( door, -2, 0, id == 0xA2 ? 24 : 27 );
|
||||
|
||||
//AddSouthDoor( false, -2, 0, 27 - (id == 0xA2 ? 3 : 0), keyValue );
|
||||
|
||||
SetSign( 3, 4, 7 - (id == 0xA2 ? 2 : 0) );
|
||||
}
|
||||
|
||||
public SmallShop( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override HouseDeed GetDeed()
|
||||
{
|
||||
switch ( ItemID )
|
||||
{
|
||||
case 0xA0: return new StoneWorkshopDeed();
|
||||
case 0xA2:
|
||||
default: return new MarbleWorkshopDeed();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int)0 );//version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
329
Scripts/Multis/MovingCrate.cs
Normal file
329
Scripts/Multis/MovingCrate.cs
Normal file
|
|
@ -0,0 +1,329 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class MovingCrate : Container
|
||||
{
|
||||
public static readonly int MaxItemsPerSubcontainer = 20;
|
||||
public static readonly int Rows = 3;
|
||||
public static readonly int Columns = 5;
|
||||
public static readonly int HorizontalSpacing = 25;
|
||||
public static readonly int VerticalSpacing = 25;
|
||||
|
||||
public override int LabelNumber{ get{ return 1061690; } } // Packing Crate
|
||||
|
||||
private BaseHouse m_House;
|
||||
|
||||
private Timer m_InternalizeTimer;
|
||||
|
||||
public BaseHouse House
|
||||
{
|
||||
get{ return m_House; }
|
||||
set{ m_House = value; }
|
||||
}
|
||||
|
||||
public override int DefaultMaxItems{ get{ return 0; } }
|
||||
public override int DefaultMaxWeight{ get{ return 0; } }
|
||||
|
||||
public MovingCrate( BaseHouse house ) : base( 0xE3D )
|
||||
{
|
||||
Hue = 0x8A5;
|
||||
Movable = false;
|
||||
|
||||
m_House = house;
|
||||
}
|
||||
|
||||
public MovingCrate( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void DropItem( Item dropped )
|
||||
{
|
||||
// 1. Try to stack the item
|
||||
foreach ( Item item in this.Items )
|
||||
{
|
||||
if ( item is PackingBox )
|
||||
{
|
||||
List<Item> subItems = item.Items;
|
||||
|
||||
for ( int i = 0; i < subItems.Count; i++ )
|
||||
{
|
||||
Item subItem = subItems[i];
|
||||
|
||||
if ( !(subItem is Container) && subItem.StackWith( null, dropped, false ) )
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Try to drop the item into an existing container
|
||||
foreach ( Item item in this.Items )
|
||||
{
|
||||
if ( item is PackingBox )
|
||||
{
|
||||
Container box = (Container) item;
|
||||
List<Item> subItems = box.Items;
|
||||
|
||||
if ( subItems.Count < MaxItemsPerSubcontainer )
|
||||
{
|
||||
box.DropItem( dropped );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Drop the item into a new container
|
||||
Container subContainer = new PackingBox();
|
||||
subContainer.DropItem( dropped );
|
||||
|
||||
Point3D location = GetFreeLocation();
|
||||
if ( location != Point3D.Zero )
|
||||
{
|
||||
this.AddItem( subContainer );
|
||||
subContainer.Location = location;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.DropItem( subContainer );
|
||||
}
|
||||
}
|
||||
|
||||
private Point3D GetFreeLocation()
|
||||
{
|
||||
bool[,] positions = new bool[Rows, Columns];
|
||||
|
||||
foreach ( Item item in this.Items )
|
||||
{
|
||||
if ( item is PackingBox )
|
||||
{
|
||||
int i = (item.Y - this.Bounds.Y) / VerticalSpacing;
|
||||
if ( i < 0 )
|
||||
i = 0;
|
||||
else if ( i >= Rows )
|
||||
i = Rows - 1;
|
||||
|
||||
int j = (item.X - this.Bounds.X) / HorizontalSpacing;
|
||||
if ( j < 0 )
|
||||
j = 0;
|
||||
else if ( j >= Columns )
|
||||
j = Columns - 1;
|
||||
|
||||
positions[i, j] = true;
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i < Rows; i++ )
|
||||
{
|
||||
for ( int j = 0; j < Columns; j++ )
|
||||
{
|
||||
if ( !positions[i, j] )
|
||||
{
|
||||
int x = this.Bounds.X + j * HorizontalSpacing;
|
||||
int y = this.Bounds.Y + i * VerticalSpacing;
|
||||
|
||||
return new Point3D( x, y, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Point3D.Zero;
|
||||
}
|
||||
|
||||
public override bool IsDecoContainer
|
||||
{
|
||||
get{ return false; }
|
||||
}
|
||||
|
||||
public override bool CheckHold( Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight )
|
||||
{
|
||||
if ( m.AccessLevel < AccessLevel.GameMaster )
|
||||
{
|
||||
m.SendLocalizedMessage( 1061145 ); // You cannot place items into a house moving crate.
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckHold( m, item, message, checkItems, plusItems, plusWeight );
|
||||
}
|
||||
|
||||
public override bool CheckLift( Mobile from, Item item, ref LRReason reject )
|
||||
{
|
||||
return base.CheckLift( from, item, ref reject ) && House != null && !House.Deleted && House.IsOwner( from );
|
||||
}
|
||||
|
||||
public override bool CheckItemUse( Mobile from, Item item )
|
||||
{
|
||||
return base.CheckItemUse( from, item ) && House != null && !House.Deleted && House.IsOwner( from );
|
||||
}
|
||||
|
||||
public override void OnItemRemoved( Item item )
|
||||
{
|
||||
base.OnItemRemoved( item );
|
||||
|
||||
if ( this.TotalItems == 0 )
|
||||
Delete();
|
||||
}
|
||||
|
||||
public void RestartTimer()
|
||||
{
|
||||
if ( m_InternalizeTimer == null )
|
||||
{
|
||||
m_InternalizeTimer = new InternalizeTimer( this );
|
||||
m_InternalizeTimer.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_InternalizeTimer.Stop();
|
||||
m_InternalizeTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
if ( m_InternalizeTimer != null )
|
||||
{
|
||||
m_InternalizeTimer.Stop();
|
||||
m_InternalizeTimer = null;
|
||||
}
|
||||
|
||||
List<Item> toRemove = new List<Item>();
|
||||
foreach ( Item item in this.Items )
|
||||
if ( item is PackingBox && item.Items.Count == 0 )
|
||||
toRemove.Add( item );
|
||||
|
||||
foreach ( Item item in toRemove )
|
||||
item.Delete();
|
||||
|
||||
if ( this.TotalItems == 0 )
|
||||
Delete();
|
||||
else
|
||||
Internalize();
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
if ( House != null && House.MovingCrate == this )
|
||||
House.MovingCrate = null;
|
||||
|
||||
if ( m_InternalizeTimer != null )
|
||||
m_InternalizeTimer.Stop();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 1 );
|
||||
|
||||
writer.Write( (Item) m_House );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
m_House = reader.ReadItem() as BaseHouse;
|
||||
|
||||
if( m_House != null )
|
||||
{
|
||||
m_House.MovingCrate = this;
|
||||
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( Hide ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Timer.DelayCall( TimeSpan.Zero, this.Delete );
|
||||
}
|
||||
|
||||
if ( version == 0 )
|
||||
MaxItems = -1; // reset to default
|
||||
}
|
||||
|
||||
public class InternalizeTimer : Timer
|
||||
{
|
||||
private MovingCrate m_Crate;
|
||||
|
||||
public InternalizeTimer( MovingCrate crate ) : base( TimeSpan.FromMinutes( 5.0 ) )
|
||||
{
|
||||
m_Crate = crate;
|
||||
|
||||
Priority = TimerPriority.FiveSeconds;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Crate.Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class PackingBox : BaseContainer
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1061690; } } // Packing Crate
|
||||
|
||||
public override int DefaultGumpID{ get{ return 0x4B; } }
|
||||
public override int DefaultDropSound{ get{ return 0x42; } }
|
||||
|
||||
public override Rectangle2D Bounds
|
||||
{
|
||||
get{ return new Rectangle2D( 16, 51, 168, 73 ); }
|
||||
}
|
||||
|
||||
public override int DefaultMaxItems{ get{ return 0; } }
|
||||
public override int DefaultMaxWeight{ get{ return 0; } }
|
||||
|
||||
public PackingBox() : base( 0x9A8 )
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public PackingBox( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void SendCantStoreMessage( Mobile to, Item item )
|
||||
{
|
||||
to.SendLocalizedMessage( 1061145 ); // You cannot place items into a house moving crate.
|
||||
}
|
||||
|
||||
public override void OnItemRemoved( Item item )
|
||||
{
|
||||
base.OnItemRemoved( item );
|
||||
|
||||
if ( item.GetBounce() == null && this.TotalItems == 0 )
|
||||
Delete();
|
||||
}
|
||||
|
||||
public override void OnItemBounceCleared( Item item )
|
||||
{
|
||||
base.OnItemBounceCleared( item );
|
||||
|
||||
if ( this.TotalItems == 0 )
|
||||
Delete();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 1 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
if ( version == 0 )
|
||||
MaxItems = -1; // reset to default
|
||||
}
|
||||
}
|
||||
}
|
||||
1760
Scripts/Multis/NewHouses.cs
Normal file
1760
Scripts/Multis/NewHouses.cs
Normal file
File diff suppressed because it is too large
Load diff
145
Scripts/Multis/PreviewHouse.cs
Normal file
145
Scripts/Multis/PreviewHouse.cs
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class PreviewHouse : BaseMulti
|
||||
{
|
||||
private List<Item> m_Components;
|
||||
private Timer m_Timer;
|
||||
|
||||
public PreviewHouse( int multiID ) : base( multiID )
|
||||
{
|
||||
m_Components = new List<Item>();
|
||||
|
||||
MultiComponentList mcl = this.Components;
|
||||
|
||||
for ( int i = 1; i < mcl.List.Length; ++i )
|
||||
{
|
||||
MultiTileEntry entry = mcl.List[i];
|
||||
|
||||
if ( entry.m_Flags == 0 )
|
||||
{
|
||||
Item item = new Static( (int)entry.m_ItemID );
|
||||
|
||||
item.MoveToWorld( new Point3D( X + entry.m_OffsetX, Y + entry.m_OffsetY, Z + entry.m_OffsetZ ), Map );
|
||||
|
||||
m_Components.Add( item );
|
||||
}
|
||||
}
|
||||
|
||||
m_Timer = new DecayTimer( this );
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
public override void OnLocationChange( Point3D oldLocation )
|
||||
{
|
||||
base.OnLocationChange( oldLocation );
|
||||
|
||||
if ( m_Components == null )
|
||||
return;
|
||||
|
||||
int xOffset = X - oldLocation.X;
|
||||
int yOffset = Y - oldLocation.Y;
|
||||
int zOffset = Z - oldLocation.Z;
|
||||
|
||||
for ( int i = 0; i < m_Components.Count; ++i )
|
||||
{
|
||||
Item item = m_Components[i];
|
||||
|
||||
item.MoveToWorld( new Point3D( item.X + xOffset, item.Y + yOffset, item.Z + zOffset ), this.Map );
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnMapChange()
|
||||
{
|
||||
base.OnMapChange();
|
||||
|
||||
if ( m_Components == null )
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < m_Components.Count; ++i )
|
||||
{
|
||||
Item item = m_Components[i];
|
||||
|
||||
item.Map = this.Map;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
|
||||
if ( m_Components == null )
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < m_Components.Count; ++i )
|
||||
{
|
||||
Item item = m_Components[i];
|
||||
|
||||
item.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
|
||||
base.OnAfterDelete();
|
||||
}
|
||||
|
||||
public PreviewHouse( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( m_Components );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Components = reader.ReadStrongItemList();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( this.Delete ) );
|
||||
}
|
||||
|
||||
private class DecayTimer : Timer
|
||||
{
|
||||
private Item m_Item;
|
||||
|
||||
public DecayTimer( Item item ) : base( TimeSpan.FromSeconds( 20.0 ) )
|
||||
{
|
||||
m_Item = item;
|
||||
Priority = TimerPriority.OneSecond;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Item.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
287
Scripts/Multis/ViewHousesGump.cs
Normal file
287
Scripts/Multis/ViewHousesGump.cs
Normal file
|
|
@ -0,0 +1,287 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Multis;
|
||||
using Server.Targeting;
|
||||
using Server.Accounting;
|
||||
using Server.Commands;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class ViewHousesGump : Gump
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register( "ViewHouses", AccessLevel.GameMaster, new CommandEventHandler( ViewHouses_OnCommand ) );
|
||||
}
|
||||
|
||||
[Usage( "ViewHouses" )]
|
||||
[Description( "Displays a menu listing all houses of a targeted player. The menu also contains specific house details, and options to: go to house, open house menu, and demolish house." )]
|
||||
public static void ViewHouses_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
e.Mobile.BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ViewHouses_OnTarget ) );
|
||||
}
|
||||
|
||||
public static void ViewHouses_OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( targeted is Mobile )
|
||||
from.SendGump( new ViewHousesGump( from, GetHouses( (Mobile)targeted ), null ) );
|
||||
}
|
||||
|
||||
private class HouseComparer : IComparer<BaseHouse>
|
||||
{
|
||||
public static readonly IComparer<BaseHouse> Instance = new HouseComparer();
|
||||
|
||||
public int Compare( BaseHouse x, BaseHouse y )
|
||||
{
|
||||
return x.BuiltOn.CompareTo( y.BuiltOn );
|
||||
}
|
||||
}
|
||||
|
||||
public static List<BaseHouse> GetHouses( Mobile owner )
|
||||
{
|
||||
List<BaseHouse> list = new List<BaseHouse>();
|
||||
|
||||
Account acct = owner.Account as Account;
|
||||
|
||||
if ( acct == null )
|
||||
{
|
||||
list.AddRange( BaseHouse.GetHouses( owner ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( int i = 0; i < acct.Length; ++i )
|
||||
{
|
||||
Mobile mob = acct[i];
|
||||
|
||||
if ( mob != null )
|
||||
list.AddRange( BaseHouse.GetHouses( mob ) );
|
||||
}
|
||||
}
|
||||
|
||||
list.Sort( HouseComparer.Instance );
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private Mobile m_From;
|
||||
private List<BaseHouse> m_List;
|
||||
private BaseHouse m_Selection;
|
||||
|
||||
public ViewHousesGump( Mobile from, List<BaseHouse> list, BaseHouse sel ) : base( 50, 40 )
|
||||
{
|
||||
m_From = from;
|
||||
m_List = list;
|
||||
m_Selection = sel;
|
||||
|
||||
from.CloseGump( typeof( ViewHousesGump ) );
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 0, 0, 240, 360, 5054 );
|
||||
AddBlackAlpha( 10, 10, 220, 340 );
|
||||
|
||||
if ( sel == null || sel.Deleted )
|
||||
{
|
||||
m_Selection = null;
|
||||
|
||||
AddHtml( 35, 15, 120, 20, Color( "House Type", White ), false, false );
|
||||
|
||||
if ( list.Count == 0 )
|
||||
AddHtml( 35, 40, 160, 40, Color( "There were no houses found for that player.", White ), false, false );
|
||||
|
||||
AddImage( 190, 17, 0x25EA );
|
||||
AddImage( 207, 17, 0x25E6 );
|
||||
|
||||
int page = 0;
|
||||
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
{
|
||||
if ( (i % 15) == 0 )
|
||||
{
|
||||
if ( page > 0 )
|
||||
AddButton( 207, 17, 0x15E1, 0x15E5, 0, GumpButtonType.Page, page+1 );
|
||||
|
||||
AddPage( ++page );
|
||||
|
||||
if ( page > 1 )
|
||||
AddButton( 190, 17, 0x15E3, 0x15E7, 0, GumpButtonType.Page, page-1 );
|
||||
}
|
||||
|
||||
object name = FindHouseName( list[i] );
|
||||
|
||||
AddHtml( 15, 40 + ((i % 15) * 20), 20, 20, Color( String.Format( "{0}.", i+1 ), White ), false, false );
|
||||
|
||||
if ( name is int )
|
||||
AddHtmlLocalized( 35, 40 + ((i % 15) * 20), 160, 20, (int)name, White16, false, false );
|
||||
else if ( name is string )
|
||||
AddHtml( 35, 40 + ((i % 15) * 20), 160, 20, Color( (string)name, White ), false, false );
|
||||
|
||||
AddButton( 198, 39 + ((i % 15) * 20), 4005, 4007, i+1, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string houseName, owner, location;
|
||||
Map map = sel.Map;
|
||||
|
||||
houseName = (sel.Sign == null) ? "An Unnamed House" : sel.Sign.GetName();
|
||||
owner = (sel.Owner == null) ? "nobody" : sel.Owner.Name;
|
||||
|
||||
int xLong = 0, yLat = 0, xMins = 0, yMins = 0;
|
||||
bool xEast = false, ySouth = false;
|
||||
|
||||
bool valid = Sextant.Format( sel.Location, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth );
|
||||
|
||||
if ( valid )
|
||||
location = String.Format( "{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W" );
|
||||
else
|
||||
location = "unknown";
|
||||
|
||||
AddHtml( 10, 15, 220, 20, Color( Center( "House Properties" ), White ), false, false );
|
||||
|
||||
AddHtml( 15, 40, 210, 20, Color( "Facet:", White ), false, false );
|
||||
AddHtml( 15, 40, 210, 20, Color( Right( map == null ? "(null)" : map.Name ), White ), false, false );
|
||||
|
||||
AddHtml( 15, 60, 210, 20, Color( "Location:", White ), false, false );
|
||||
AddHtml( 15, 60, 210, 20, Color( Right( sel.Location.ToString() ), White ), false, false );
|
||||
|
||||
AddHtml( 15, 80, 210, 20, Color( "Sextant:", White ), false, false );
|
||||
AddHtml( 15, 80, 210, 20, Color( Right( location ), White ), false, false );
|
||||
|
||||
AddHtml( 15, 100, 210, 20, Color( "Owner:", White ), false, false );
|
||||
AddHtml( 15, 100, 210, 20, Color( Right( owner ), White ), false, false );
|
||||
|
||||
AddHtml( 15, 120, 210, 20, Color( "Name:", White ), false, false );
|
||||
AddHtml( 15, 120, 210, 20, Color( Right( houseName ), White ), false, false );
|
||||
|
||||
AddHtml( 15, 140, 210, 20, Color( "Friends:", White ), false, false );
|
||||
AddHtml( 15, 140, 210, 20, Color( Right( sel.Friends.Count.ToString() ), White ), false, false );
|
||||
|
||||
AddHtml( 15, 160, 210, 20, Color( "Co-Owners:", White ), false, false );
|
||||
AddHtml( 15, 160, 210, 20, Color( Right( sel.CoOwners.Count.ToString() ), White ), false, false );
|
||||
|
||||
AddHtml( 15, 180, 210, 20, Color( "Bans:", White ), false, false );
|
||||
AddHtml( 15, 180, 210, 20, Color( Right( sel.Bans.Count.ToString() ), White ), false, false );
|
||||
|
||||
AddHtml( 15, 200, 210, 20, Color( "Decays:", White ), false, false );
|
||||
AddHtml( 15, 200, 210, 20, Color( Right( sel.CanDecay ? "Yes" : "No" ), White ), false, false );
|
||||
|
||||
AddHtml( 15, 220, 210, 20, Color( "Decay Level:", White ), false, false );
|
||||
AddHtml( 15, 220, 210, 20, Color( Right( sel.DecayLevel.ToString() ), White ), false, false );
|
||||
|
||||
AddButton( 15, 245, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtml( 50, 245, 120, 20, Color( "Go to house", White ), false, false );
|
||||
|
||||
AddButton( 15, 265, 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtml( 50, 265, 120, 20, Color( "Open house menu", White ), false, false );
|
||||
|
||||
AddButton( 15, 285, 4005, 4007, 3, GumpButtonType.Reply, 0 );
|
||||
AddHtml( 50, 285, 120, 20, Color( "Demolish house", White ), false, false );
|
||||
|
||||
AddButton( 15, 305, 4005, 4007, 4, GumpButtonType.Reply, 0 );
|
||||
AddHtml( 50, 305, 120, 20, Color( "Refresh house", White ), false, false );
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( m_Selection == null )
|
||||
{
|
||||
int v = info.ButtonID - 1;
|
||||
|
||||
if ( v >= 0 && v < m_List.Count )
|
||||
m_From.SendGump( new ViewHousesGump( m_From, m_List, m_List[v] ) );
|
||||
}
|
||||
else if ( !m_Selection.Deleted )
|
||||
{
|
||||
switch ( info.ButtonID )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_From.SendGump( new ViewHousesGump( m_From, m_List, null ) );
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
Map map = m_Selection.Map;
|
||||
|
||||
if ( map != null && map != Map.Internal )
|
||||
m_From.MoveToWorld( m_Selection.BanLocation, map );
|
||||
|
||||
m_From.SendGump( new ViewHousesGump( m_From, m_List, m_Selection ) );
|
||||
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
m_From.SendGump( new ViewHousesGump( m_From, m_List, m_Selection ) );
|
||||
|
||||
HouseSign sign = m_Selection.Sign;
|
||||
|
||||
if ( sign != null && !sign.Deleted )
|
||||
sign.OnDoubleClick( m_From );
|
||||
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
m_From.SendGump( new ViewHousesGump( m_From, m_List, m_Selection ) );
|
||||
m_From.SendGump( new HouseDemolishGump( m_From, m_Selection ) );
|
||||
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
m_Selection.RefreshDecay();
|
||||
m_From.SendGump( new ViewHousesGump( m_From, m_List, m_Selection ) );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public object FindHouseName( BaseHouse house )
|
||||
{
|
||||
int multiID = house.ItemID;
|
||||
HousePlacementEntry[] entries;
|
||||
|
||||
entries = HousePlacementEntry.ClassicHouses;
|
||||
|
||||
for ( int i = 0; i < entries.Length; ++i )
|
||||
{
|
||||
if ( entries[i].MultiID == multiID )
|
||||
return entries[i].Description;
|
||||
}
|
||||
|
||||
return house.GetType().Name;
|
||||
}
|
||||
|
||||
private const int White16 = 0x7FFF;
|
||||
private const int White = 0xFFFFFF;
|
||||
|
||||
public string Right( string text )
|
||||
{
|
||||
return String.Format( "<div align=right>{0}</div>", text );
|
||||
}
|
||||
|
||||
public string Center( string text )
|
||||
{
|
||||
return String.Format( "<CENTER>{0}</CENTER>", text );
|
||||
}
|
||||
|
||||
public string Color( string text, int color )
|
||||
{
|
||||
return String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text );
|
||||
}
|
||||
|
||||
public void AddBlackAlpha( int x, int y, int width, int height )
|
||||
{
|
||||
AddImageTiled( x, y, width, height, 2624 );
|
||||
AddAlphaRegion( x, y, width, height );
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue