Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,179 +1,177 @@
|
|||
using Server.Regions;
|
||||
using Server.Targeting;
|
||||
using Server.Engines.CannedEvil;
|
||||
using Server.Network;
|
||||
using Server.Regions;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public abstract class BaseBoatDeed : Item
|
||||
{
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int MultiID { get; set; }
|
||||
public abstract class BaseBoatDeed : Item
|
||||
{
|
||||
public BaseBoatDeed(int id, Point3D offset) : base(0x14F2)
|
||||
{
|
||||
Weight = 1.0;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D Offset { get; set; }
|
||||
if (!Core.AOS)
|
||||
LootType = LootType.Newbied;
|
||||
|
||||
public BaseBoatDeed( int id, Point3D offset ) : base( 0x14F2 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
MultiID = id;
|
||||
Offset = offset;
|
||||
}
|
||||
|
||||
if ( !Core.AOS )
|
||||
LootType = LootType.Newbied;
|
||||
public BaseBoatDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
MultiID = id;
|
||||
Offset = offset;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int MultiID{ get; set; }
|
||||
|
||||
public BaseBoatDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Point3D Offset{ get; set; }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public abstract BaseBoat Boat{ get; }
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( MultiID );
|
||||
writer.Write( Offset );
|
||||
}
|
||||
writer.Write(0); // version
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
writer.Write(MultiID);
|
||||
writer.Write(Offset);
|
||||
}
|
||||
|
||||
int version = reader.ReadInt();
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
MultiID = reader.ReadInt();
|
||||
Offset = reader.ReadPoint3D();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
MultiID = reader.ReadInt();
|
||||
Offset = reader.ReadPoint3D();
|
||||
|
||||
if ( Weight == 0.0 )
|
||||
Weight = 1.0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
else if ( from.AccessLevel < AccessLevel.GameMaster && (from.Map == Map.Ilshenar || from.Map == Map.Malas) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1010567, null, 0x25 ); // You may not place a boat from this location.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( Core.SE )
|
||||
from.SendLocalizedMessage( 502482 ); // Where do you wish to place the ship?
|
||||
else
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502482 ); // Where do you wish to place the ship?
|
||||
if (Weight == 0.0)
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
from.Target = new InternalTarget( this );
|
||||
}
|
||||
}
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
else if (from.AccessLevel < AccessLevel.GameMaster && (from.Map == Map.Ilshenar || from.Map == Map.Malas))
|
||||
{
|
||||
from.SendLocalizedMessage(1010567, null, 0x25); // You may not place a boat from this location.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Core.SE)
|
||||
from.SendLocalizedMessage(502482); // Where do you wish to place the ship?
|
||||
else
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 502482); // Where do you wish to place the ship?
|
||||
|
||||
public abstract BaseBoat Boat{ get; }
|
||||
from.Target = new InternalTarget(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPlacement( Mobile from, Point3D p )
|
||||
{
|
||||
if ( Deleted )
|
||||
{
|
||||
return;
|
||||
}
|
||||
public void OnPlacement(Mobile from, Point3D p)
|
||||
{
|
||||
if (Deleted) return;
|
||||
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
else
|
||||
{
|
||||
Map map = from.Map;
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
else
|
||||
{
|
||||
Map map = from.Map;
|
||||
|
||||
if ( map == null )
|
||||
return;
|
||||
if (map == null)
|
||||
return;
|
||||
|
||||
if ( from.AccessLevel < AccessLevel.GameMaster && (map == Map.Ilshenar || map == Map.Malas) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1043284 ); // A ship can not be created here.
|
||||
return;
|
||||
}
|
||||
if (from.AccessLevel < AccessLevel.GameMaster && (map == Map.Ilshenar || map == Map.Malas))
|
||||
{
|
||||
from.SendLocalizedMessage(1043284); // A ship can not be created here.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( from.Region.IsPartOf( typeof( HouseRegion ) ) || BaseBoat.FindBoatAt( from, from.Map ) != null )
|
||||
{
|
||||
from.SendLocalizedMessage( 1010568, null, 0x25 ); // You may not place a ship while on another ship or inside a house.
|
||||
return;
|
||||
}
|
||||
if (from.Region.IsPartOf(typeof(HouseRegion)) || BaseBoat.FindBoatAt(from, from.Map) != null)
|
||||
{
|
||||
from.SendLocalizedMessage(1010568, null,
|
||||
0x25); // You may not place a ship while on another ship or inside a house.
|
||||
return;
|
||||
}
|
||||
|
||||
BaseBoat boat = Boat;
|
||||
BaseBoat boat = Boat;
|
||||
|
||||
if ( boat == null )
|
||||
return;
|
||||
if (boat == null)
|
||||
return;
|
||||
|
||||
p = new Point3D( p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z );
|
||||
p = new Point3D(p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z);
|
||||
|
||||
if ( BaseBoat.IsValidLocation( p, map ) && boat.CanFit( p, map, boat.ItemID ) )
|
||||
{
|
||||
Delete();
|
||||
if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, boat.ItemID))
|
||||
{
|
||||
Delete();
|
||||
|
||||
boat.Owner = from;
|
||||
boat.Anchored = true;
|
||||
boat.Owner = from;
|
||||
boat.Anchored = true;
|
||||
|
||||
uint keyValue = boat.CreateKeys( from );
|
||||
uint keyValue = boat.CreateKeys(from);
|
||||
|
||||
if ( boat.PPlank != null )
|
||||
boat.PPlank.KeyValue = keyValue;
|
||||
if (boat.PPlank != null)
|
||||
boat.PPlank.KeyValue = keyValue;
|
||||
|
||||
if ( boat.SPlank != null )
|
||||
boat.SPlank.KeyValue = keyValue;
|
||||
if (boat.SPlank != null)
|
||||
boat.SPlank.KeyValue = keyValue;
|
||||
|
||||
boat.MoveToWorld( p, map );
|
||||
}
|
||||
else
|
||||
{
|
||||
boat.Delete();
|
||||
from.SendLocalizedMessage( 1043284 ); // A ship can not be created here.
|
||||
}
|
||||
}
|
||||
}
|
||||
boat.MoveToWorld(p, map);
|
||||
}
|
||||
else
|
||||
{
|
||||
boat.Delete();
|
||||
from.SendLocalizedMessage(1043284); // A ship can not be created here.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : MultiTarget
|
||||
{
|
||||
private BaseBoatDeed m_Deed;
|
||||
private class InternalTarget : MultiTarget
|
||||
{
|
||||
private BaseBoatDeed m_Deed;
|
||||
|
||||
public InternalTarget( BaseBoatDeed deed ) : base( deed.MultiID, deed.Offset )
|
||||
{
|
||||
m_Deed = deed;
|
||||
}
|
||||
public InternalTarget(BaseBoatDeed deed) : base(deed.MultiID, deed.Offset)
|
||||
{
|
||||
m_Deed = deed;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object o )
|
||||
{
|
||||
IPoint3D ip = o as IPoint3D;
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
IPoint3D ip = o as IPoint3D;
|
||||
|
||||
if ( ip != null )
|
||||
{
|
||||
if ( ip is Item )
|
||||
ip = ((Item)ip).GetWorldTop();
|
||||
if (ip != null)
|
||||
{
|
||||
if (ip is Item)
|
||||
ip = ((Item)ip).GetWorldTop();
|
||||
|
||||
Point3D p = new Point3D( ip );
|
||||
Point3D p = new Point3D(ip);
|
||||
|
||||
Region region = Region.Find( p, from.Map );
|
||||
Region region = Region.Find(p, from.Map);
|
||||
|
||||
if ( region.IsPartOf( typeof( DungeonRegion ) ) )
|
||||
from.SendLocalizedMessage( 502488 ); // You can not place a ship inside a dungeon.
|
||||
else if ( region.IsPartOf( typeof( HouseRegion ) ) || region.IsPartOf( typeof( ChampionSpawnRegion ) ) )
|
||||
from.SendLocalizedMessage( 1042549 ); // A boat may not be placed in this area.
|
||||
else
|
||||
m_Deed.OnPlacement( from, p );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (region.IsPartOf(typeof(DungeonRegion)))
|
||||
from.SendLocalizedMessage(502488); // You can not place a ship inside a dungeon.
|
||||
else if (region.IsPartOf(typeof(HouseRegion)) || region.IsPartOf(typeof(ChampionSpawnRegion)))
|
||||
from.SendLocalizedMessage(1042549); // A boat may not be placed in this area.
|
||||
else
|
||||
m_Deed.OnPlacement(from, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,191 +1,196 @@
|
|||
using Server.Engines.CannedEvil;
|
||||
using Server.Regions;
|
||||
using Server.Targeting;
|
||||
using Server.Engines.CannedEvil;
|
||||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public abstract class BaseDockedBoat : Item
|
||||
{
|
||||
private string m_ShipName;
|
||||
public abstract class BaseDockedBoat : Item
|
||||
{
|
||||
private string m_ShipName;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int MultiID { get; set; }
|
||||
public BaseDockedBoat(int id, Point3D offset, BaseBoat boat) : base(0x14F4)
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D Offset { get; set; }
|
||||
MultiID = id;
|
||||
Offset = offset;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string ShipName{ get => m_ShipName;
|
||||
set{ m_ShipName = value; InvalidateProperties(); } }
|
||||
m_ShipName = boat.ShipName;
|
||||
}
|
||||
|
||||
public BaseDockedBoat( int id, Point3D offset, BaseBoat boat ) : base( 0x14F4 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
public BaseDockedBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
MultiID = id;
|
||||
Offset = offset;
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int MultiID{ get; set; }
|
||||
|
||||
m_ShipName = boat.ShipName;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Point3D Offset{ get; set; }
|
||||
|
||||
public BaseDockedBoat( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string ShipName
|
||||
{
|
||||
get => m_ShipName;
|
||||
set
|
||||
{
|
||||
m_ShipName = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public abstract BaseBoat Boat{ get; }
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( MultiID );
|
||||
writer.Write( Offset );
|
||||
writer.Write( m_ShipName );
|
||||
}
|
||||
writer.Write(1); // version
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
writer.Write(MultiID);
|
||||
writer.Write(Offset);
|
||||
writer.Write(m_ShipName);
|
||||
}
|
||||
|
||||
int version = reader.ReadInt();
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
case 0:
|
||||
{
|
||||
MultiID = reader.ReadInt();
|
||||
Offset = reader.ReadPoint3D();
|
||||
m_ShipName = reader.ReadString();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( version == 0 )
|
||||
reader.ReadUInt();
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
case 0:
|
||||
{
|
||||
MultiID = reader.ReadInt();
|
||||
Offset = reader.ReadPoint3D();
|
||||
m_ShipName = reader.ReadString();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (version == 0)
|
||||
reader.ReadUInt();
|
||||
|
||||
if ( LootType == LootType.Newbied )
|
||||
LootType = LootType.Blessed;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Weight == 0.0 )
|
||||
Weight = 1.0;
|
||||
}
|
||||
if (LootType == LootType.Newbied)
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
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
|
||||
{
|
||||
from.SendLocalizedMessage( 502482 ); // Where do you wish to place the ship?
|
||||
if (Weight == 0.0)
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
from.Target = new InternalTarget( this );
|
||||
}
|
||||
}
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502482); // Where do you wish to place the ship?
|
||||
|
||||
public abstract BaseBoat Boat{ get; }
|
||||
from.Target = new InternalTarget(this);
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddNameProperty( ObjectPropertyList list )
|
||||
{
|
||||
if ( m_ShipName != null )
|
||||
list.Add( m_ShipName );
|
||||
else
|
||||
base.AddNameProperty( list );
|
||||
}
|
||||
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 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;
|
||||
}
|
||||
public void OnPlacement(Mobile from, Point3D p)
|
||||
{
|
||||
if (Deleted) return;
|
||||
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
else
|
||||
{
|
||||
Map map = from.Map;
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
else
|
||||
{
|
||||
Map map = from.Map;
|
||||
|
||||
if ( map == null )
|
||||
return;
|
||||
if (map == null)
|
||||
return;
|
||||
|
||||
BaseBoat boat = Boat;
|
||||
BaseBoat boat = Boat;
|
||||
|
||||
if ( boat == null )
|
||||
return;
|
||||
if (boat == null)
|
||||
return;
|
||||
|
||||
p = new Point3D( p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z );
|
||||
p = new Point3D(p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z);
|
||||
|
||||
if ( BaseBoat.IsValidLocation( p, map ) && boat.CanFit( p, map, boat.ItemID ) && map != Map.Ilshenar && map != Map.Malas )
|
||||
{
|
||||
Delete();
|
||||
if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, boat.ItemID) && map != Map.Ilshenar &&
|
||||
map != Map.Malas)
|
||||
{
|
||||
Delete();
|
||||
|
||||
boat.Owner = from;
|
||||
boat.Anchored = true;
|
||||
boat.ShipName = m_ShipName;
|
||||
boat.Owner = from;
|
||||
boat.Anchored = true;
|
||||
boat.ShipName = m_ShipName;
|
||||
|
||||
uint keyValue = boat.CreateKeys( from );
|
||||
uint keyValue = boat.CreateKeys(from);
|
||||
|
||||
if ( boat.PPlank != null )
|
||||
boat.PPlank.KeyValue = keyValue;
|
||||
if (boat.PPlank != null)
|
||||
boat.PPlank.KeyValue = keyValue;
|
||||
|
||||
if ( boat.SPlank != null )
|
||||
boat.SPlank.KeyValue = keyValue;
|
||||
if (boat.SPlank != null)
|
||||
boat.SPlank.KeyValue = keyValue;
|
||||
|
||||
boat.MoveToWorld( p, map );
|
||||
}
|
||||
else
|
||||
{
|
||||
boat.Delete();
|
||||
from.SendLocalizedMessage( 1043284 ); // A ship can not be created here.
|
||||
}
|
||||
}
|
||||
}
|
||||
boat.MoveToWorld(p, map);
|
||||
}
|
||||
else
|
||||
{
|
||||
boat.Delete();
|
||||
from.SendLocalizedMessage(1043284); // A ship can not be created here.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : MultiTarget
|
||||
{
|
||||
private BaseDockedBoat m_Model;
|
||||
private class InternalTarget : MultiTarget
|
||||
{
|
||||
private BaseDockedBoat m_Model;
|
||||
|
||||
public InternalTarget( BaseDockedBoat model ) : base( model.MultiID, model.Offset )
|
||||
{
|
||||
m_Model = 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;
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
IPoint3D ip = o as IPoint3D;
|
||||
|
||||
if ( ip != null )
|
||||
{
|
||||
if ( ip is Item )
|
||||
ip = ((Item)ip).GetWorldTop();
|
||||
if (ip != null)
|
||||
{
|
||||
if (ip is Item)
|
||||
ip = ((Item)ip).GetWorldTop();
|
||||
|
||||
Point3D p = new Point3D( ip );
|
||||
Point3D p = new Point3D(ip);
|
||||
|
||||
Region region = Region.Find( p, from.Map );
|
||||
Region region = Region.Find(p, from.Map);
|
||||
|
||||
if ( region.IsPartOf( typeof( DungeonRegion ) ) )
|
||||
from.SendLocalizedMessage( 502488 ); // You can not place a ship inside a dungeon.
|
||||
else if ( region.IsPartOf( typeof( HouseRegion ) ) || region.IsPartOf( typeof( ChampionSpawnRegion ) ) )
|
||||
from.SendLocalizedMessage( 1042549 ); // A boat may not be placed in this area.
|
||||
else
|
||||
m_Model.OnPlacement( from, p );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (region.IsPartOf(typeof(DungeonRegion)))
|
||||
from.SendLocalizedMessage(502488); // You can not place a ship inside a dungeon.
|
||||
else if (region.IsPartOf(typeof(HouseRegion)) || region.IsPartOf(typeof(ChampionSpawnRegion)))
|
||||
from.SendLocalizedMessage(1042549); // A boat may not be placed in this area.
|
||||
else
|
||||
m_Model.OnPlacement(from, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,36 +3,36 @@ using Server.Network;
|
|||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class ConfirmDryDockGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private BaseBoat m_Boat;
|
||||
public class ConfirmDryDockGump : Gump
|
||||
{
|
||||
private BaseBoat m_Boat;
|
||||
private Mobile m_From;
|
||||
|
||||
public ConfirmDryDockGump( Mobile from, BaseBoat boat ) : base( 150, 200 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Boat = boat;
|
||||
public ConfirmDryDockGump(Mobile from, BaseBoat boat) : base(150, 200)
|
||||
{
|
||||
m_From = from;
|
||||
m_Boat = boat;
|
||||
|
||||
m_From.CloseGump( typeof( ConfirmDryDockGump ) );
|
||||
m_From.CloseGump(typeof(ConfirmDryDockGump));
|
||||
|
||||
AddPage( 0 );
|
||||
AddPage(0);
|
||||
|
||||
AddBackground( 0, 0, 220, 170, 5054 );
|
||||
AddBackground( 10, 10, 200, 150, 3000 );
|
||||
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(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, 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 );
|
||||
}
|
||||
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 );
|
||||
}
|
||||
}
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 2)
|
||||
m_Boat.EndDryDock(m_From);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,115 +3,117 @@ using Server.Network;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Hold : Container
|
||||
{
|
||||
private BaseBoat m_Boat;
|
||||
public class Hold : Container
|
||||
{
|
||||
private BaseBoat m_Boat;
|
||||
|
||||
public Hold( BaseBoat boat ) : base( 0x3EAE )
|
||||
{
|
||||
m_Boat = boat;
|
||||
Movable = false;
|
||||
}
|
||||
public Hold(BaseBoat boat) : base(0x3EAE)
|
||||
{
|
||||
m_Boat = boat;
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public Hold( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
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 IsDecoContainer => false;
|
||||
|
||||
public override bool OnDragDrop( Mobile from, Item item )
|
||||
{
|
||||
if ( m_Boat == null || !m_Boat.Contains( from ) || m_Boat.IsMoving )
|
||||
return false;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnDragDrop( from, item );
|
||||
}
|
||||
public override bool OnDragDrop(Mobile from, Item item)
|
||||
{
|
||||
if (m_Boat == null || !m_Boat.Contains(from) || m_Boat.IsMoving)
|
||||
return false;
|
||||
|
||||
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.OnDragDrop(from, item);
|
||||
}
|
||||
|
||||
return base.OnDragDropInto( from, item, p );
|
||||
}
|
||||
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
|
||||
{
|
||||
if (m_Boat == null || !m_Boat.Contains(from) || m_Boat.IsMoving)
|
||||
return false;
|
||||
|
||||
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.OnDragDropInto(from, item, p);
|
||||
}
|
||||
|
||||
return base.CheckItemUse( from, item );
|
||||
}
|
||||
public override bool CheckItemUse(Mobile from, Item item)
|
||||
{
|
||||
if (item != this && (m_Boat == null || !m_Boat.Contains(from) || m_Boat.IsMoving))
|
||||
return false;
|
||||
|
||||
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.CheckItemUse(from, item);
|
||||
}
|
||||
|
||||
return base.CheckLift( from, item, ref reject );
|
||||
}
|
||||
public override bool CheckLift(Mobile from, Item item, ref LRReason reject)
|
||||
{
|
||||
if (m_Boat == null || !m_Boat.Contains(from) || m_Boat.IsMoving)
|
||||
return false;
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
m_Boat?.Delete();
|
||||
}
|
||||
return base.CheckLift(from, item, ref reject);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( m_Boat == null || !m_Boat.Contains( from ) )
|
||||
{
|
||||
m_Boat.TillerMan?.Say( 502490 ); // You must be on the ship to open the hold.
|
||||
}
|
||||
else if ( m_Boat.IsMoving )
|
||||
{
|
||||
m_Boat.TillerMan?.Say( 502491 ); // I can not open the hold while the ship is moving.
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnDoubleClick( from );
|
||||
}
|
||||
}
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
m_Boat?.Delete();
|
||||
}
|
||||
|
||||
public override bool IsDecoContainer => false;
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (m_Boat == null || !m_Boat.Contains(from))
|
||||
m_Boat.TillerMan?.Say(502490); // You must be on the ship to open the hold.
|
||||
else if (m_Boat.IsMoving)
|
||||
m_Boat.TillerMan?.Say(502491); // I can not open the hold while the ship is moving.
|
||||
else
|
||||
base.OnDoubleClick(from);
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write( m_Boat );
|
||||
}
|
||||
writer.Write(m_Boat);
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Boat = reader.ReadItem() as BaseBoat;
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Boat = reader.ReadItem() as BaseBoat;
|
||||
|
||||
if ( m_Boat == null || Parent != null )
|
||||
Delete();
|
||||
if (m_Boat == null || Parent != null)
|
||||
Delete();
|
||||
|
||||
Movable = false;
|
||||
Movable = false;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,99 +1,99 @@
|
|||
namespace Server.Multis
|
||||
{
|
||||
public class LargeBoat : BaseBoat
|
||||
{
|
||||
public override int NorthID => 0x10;
|
||||
public override int EastID => 0x11;
|
||||
public override int SouthID => 0x12;
|
||||
public override int WestID => 0x13;
|
||||
public class LargeBoat : BaseBoat
|
||||
{
|
||||
[Constructible]
|
||||
public LargeBoat()
|
||||
{
|
||||
}
|
||||
|
||||
public override int HoldDistance => 5;
|
||||
public override int TillerManDistance => -5;
|
||||
public LargeBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override Point2D StarboardOffset => new Point2D( 2, -1 );
|
||||
public override Point2D PortOffset => new Point2D( -2, -1 );
|
||||
public override int NorthID => 0x10;
|
||||
public override int EastID => 0x11;
|
||||
public override int SouthID => 0x12;
|
||||
public override int WestID => 0x13;
|
||||
|
||||
public override Point3D MarkOffset => new Point3D( 0, 0, 3 );
|
||||
public override int HoldDistance => 5;
|
||||
public override int TillerManDistance => -5;
|
||||
|
||||
public override BaseDockedBoat DockedBoat => new LargeDockedBoat( this );
|
||||
public override Point2D StarboardOffset => new Point2D(2, -1);
|
||||
public override Point2D PortOffset => new Point2D(-2, -1);
|
||||
|
||||
[Constructible]
|
||||
public LargeBoat()
|
||||
{
|
||||
}
|
||||
public override Point3D MarkOffset => new Point3D(0, 0, 3);
|
||||
|
||||
public LargeBoat( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override BaseDockedBoat DockedBoat => new LargeDockedBoat(this);
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
}
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class LargeBoatDeed : BaseBoatDeed
|
||||
{
|
||||
public override int LabelNumber => 1041209; // large ship deed
|
||||
public override BaseBoat Boat => new LargeBoat();
|
||||
public class LargeBoatDeed : BaseBoatDeed
|
||||
{
|
||||
[Constructible]
|
||||
public LargeBoatDeed() : base(0x10, new Point3D(0, -1, 0))
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public LargeBoatDeed() : base( 0x10, new Point3D( 0, -1, 0 ) )
|
||||
{
|
||||
}
|
||||
public LargeBoatDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public LargeBoatDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1041209; // large ship deed
|
||||
public override BaseBoat Boat => new LargeBoat();
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
}
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class LargeDockedBoat : BaseDockedBoat
|
||||
{
|
||||
public override BaseBoat Boat => new LargeBoat();
|
||||
public class LargeDockedBoat : BaseDockedBoat
|
||||
{
|
||||
public LargeDockedBoat(BaseBoat boat) : base(0x10, new Point3D(0, -1, 0), boat)
|
||||
{
|
||||
}
|
||||
|
||||
public LargeDockedBoat( BaseBoat boat ) : base( 0x10, new Point3D( 0, -1, 0 ), boat )
|
||||
{
|
||||
}
|
||||
public LargeDockedBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public LargeDockedBoat( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override BaseBoat Boat => new LargeBoat();
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,99 +1,99 @@
|
|||
namespace Server.Multis
|
||||
{
|
||||
public class LargeDragonBoat : BaseBoat
|
||||
{
|
||||
public override int NorthID => 0x14;
|
||||
public override int EastID => 0x15;
|
||||
public override int SouthID => 0x16;
|
||||
public override int WestID => 0x17;
|
||||
public class LargeDragonBoat : BaseBoat
|
||||
{
|
||||
[Constructible]
|
||||
public LargeDragonBoat()
|
||||
{
|
||||
}
|
||||
|
||||
public override int HoldDistance => 5;
|
||||
public override int TillerManDistance => -5;
|
||||
public LargeDragonBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override Point2D StarboardOffset => new Point2D( 2, -1 );
|
||||
public override Point2D PortOffset => new Point2D( -2, -1 );
|
||||
public override int NorthID => 0x14;
|
||||
public override int EastID => 0x15;
|
||||
public override int SouthID => 0x16;
|
||||
public override int WestID => 0x17;
|
||||
|
||||
public override Point3D MarkOffset => new Point3D( 0, 0, 3 );
|
||||
public override int HoldDistance => 5;
|
||||
public override int TillerManDistance => -5;
|
||||
|
||||
public override BaseDockedBoat DockedBoat => new LargeDockedDragonBoat( this );
|
||||
public override Point2D StarboardOffset => new Point2D(2, -1);
|
||||
public override Point2D PortOffset => new Point2D(-2, -1);
|
||||
|
||||
[Constructible]
|
||||
public LargeDragonBoat()
|
||||
{
|
||||
}
|
||||
public override Point3D MarkOffset => new Point3D(0, 0, 3);
|
||||
|
||||
public LargeDragonBoat( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override BaseDockedBoat DockedBoat => new LargeDockedDragonBoat(this);
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
}
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class LargeDragonBoatDeed : BaseBoatDeed
|
||||
{
|
||||
public override int LabelNumber => 1041210;// large dragon ship deed
|
||||
public override BaseBoat Boat => new LargeDragonBoat();
|
||||
public class LargeDragonBoatDeed : BaseBoatDeed
|
||||
{
|
||||
[Constructible]
|
||||
public LargeDragonBoatDeed() : base(0x14, new Point3D(0, -1, 0))
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public LargeDragonBoatDeed() : base( 0x14, new Point3D( 0, -1, 0 ) )
|
||||
{
|
||||
}
|
||||
public LargeDragonBoatDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public LargeDragonBoatDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1041210; // large dragon ship deed
|
||||
public override BaseBoat Boat => new LargeDragonBoat();
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
}
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class LargeDockedDragonBoat : BaseDockedBoat
|
||||
{
|
||||
public override BaseBoat Boat => new LargeDragonBoat();
|
||||
public class LargeDockedDragonBoat : BaseDockedBoat
|
||||
{
|
||||
public LargeDockedDragonBoat(BaseBoat boat) : base(0x14, new Point3D(0, -1, 0), boat)
|
||||
{
|
||||
}
|
||||
|
||||
public LargeDockedDragonBoat( BaseBoat boat ) : base( 0x14, new Point3D( 0, -1, 0 ), boat )
|
||||
{
|
||||
}
|
||||
public LargeDockedDragonBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public LargeDockedDragonBoat( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override BaseBoat Boat => new LargeDragonBoat();
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,99 +1,99 @@
|
|||
namespace Server.Multis
|
||||
{
|
||||
public class MediumBoat : BaseBoat
|
||||
{
|
||||
public override int NorthID => 0x8;
|
||||
public override int EastID => 0x9;
|
||||
public override int SouthID => 0xA;
|
||||
public override int WestID => 0xB;
|
||||
public class MediumBoat : BaseBoat
|
||||
{
|
||||
[Constructible]
|
||||
public MediumBoat()
|
||||
{
|
||||
}
|
||||
|
||||
public override int HoldDistance => 4;
|
||||
public override int TillerManDistance => -5;
|
||||
public MediumBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override Point2D StarboardOffset => new Point2D( 2, 0 );
|
||||
public override Point2D PortOffset => new Point2D( -2, 0 );
|
||||
public override int NorthID => 0x8;
|
||||
public override int EastID => 0x9;
|
||||
public override int SouthID => 0xA;
|
||||
public override int WestID => 0xB;
|
||||
|
||||
public override Point3D MarkOffset => new Point3D( 0, 1, 3 );
|
||||
public override int HoldDistance => 4;
|
||||
public override int TillerManDistance => -5;
|
||||
|
||||
public override BaseDockedBoat DockedBoat => new MediumDockedBoat( this );
|
||||
public override Point2D StarboardOffset => new Point2D(2, 0);
|
||||
public override Point2D PortOffset => new Point2D(-2, 0);
|
||||
|
||||
[Constructible]
|
||||
public MediumBoat()
|
||||
{
|
||||
}
|
||||
public override Point3D MarkOffset => new Point3D(0, 1, 3);
|
||||
|
||||
public MediumBoat( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override BaseDockedBoat DockedBoat => new MediumDockedBoat(this);
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
}
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class MediumBoatDeed : BaseBoatDeed
|
||||
{
|
||||
public override int LabelNumber => 1041207; // medium ship deed
|
||||
public override BaseBoat Boat => new MediumBoat();
|
||||
public class MediumBoatDeed : BaseBoatDeed
|
||||
{
|
||||
[Constructible]
|
||||
public MediumBoatDeed() : base(0x8, Point3D.Zero)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public MediumBoatDeed() : base( 0x8, Point3D.Zero )
|
||||
{
|
||||
}
|
||||
public MediumBoatDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public MediumBoatDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1041207; // medium ship deed
|
||||
public override BaseBoat Boat => new MediumBoat();
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
}
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class MediumDockedBoat : BaseDockedBoat
|
||||
{
|
||||
public override BaseBoat Boat => new MediumBoat();
|
||||
public class MediumDockedBoat : BaseDockedBoat
|
||||
{
|
||||
public MediumDockedBoat(BaseBoat boat) : base(0x8, Point3D.Zero, boat)
|
||||
{
|
||||
}
|
||||
|
||||
public MediumDockedBoat( BaseBoat boat ) : base( 0x8, Point3D.Zero, boat )
|
||||
{
|
||||
}
|
||||
public MediumDockedBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public MediumDockedBoat( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override BaseBoat Boat => new MediumBoat();
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,99 +1,99 @@
|
|||
namespace Server.Multis
|
||||
{
|
||||
public class MediumDragonBoat : BaseBoat
|
||||
{
|
||||
public override int NorthID => 0xC;
|
||||
public override int EastID => 0xD;
|
||||
public override int SouthID => 0xE;
|
||||
public override int WestID => 0xF;
|
||||
public class MediumDragonBoat : BaseBoat
|
||||
{
|
||||
[Constructible]
|
||||
public MediumDragonBoat()
|
||||
{
|
||||
}
|
||||
|
||||
public override int HoldDistance => 4;
|
||||
public override int TillerManDistance => -5;
|
||||
public MediumDragonBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override Point2D StarboardOffset => new Point2D( 2, 0 );
|
||||
public override Point2D PortOffset => new Point2D( -2, 0 );
|
||||
public override int NorthID => 0xC;
|
||||
public override int EastID => 0xD;
|
||||
public override int SouthID => 0xE;
|
||||
public override int WestID => 0xF;
|
||||
|
||||
public override Point3D MarkOffset => new Point3D( 0, 1, 3 );
|
||||
public override int HoldDistance => 4;
|
||||
public override int TillerManDistance => -5;
|
||||
|
||||
public override BaseDockedBoat DockedBoat => new MediumDockedDragonBoat( this );
|
||||
public override Point2D StarboardOffset => new Point2D(2, 0);
|
||||
public override Point2D PortOffset => new Point2D(-2, 0);
|
||||
|
||||
[Constructible]
|
||||
public MediumDragonBoat()
|
||||
{
|
||||
}
|
||||
public override Point3D MarkOffset => new Point3D(0, 1, 3);
|
||||
|
||||
public MediumDragonBoat( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override BaseDockedBoat DockedBoat => new MediumDockedDragonBoat(this);
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
}
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class MediumDragonBoatDeed : BaseBoatDeed
|
||||
{
|
||||
public override int LabelNumber => 1041208; // medium dragon ship deed
|
||||
public override BaseBoat Boat => new MediumDragonBoat();
|
||||
public class MediumDragonBoatDeed : BaseBoatDeed
|
||||
{
|
||||
[Constructible]
|
||||
public MediumDragonBoatDeed() : base(0xC, Point3D.Zero)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public MediumDragonBoatDeed() : base( 0xC, Point3D.Zero )
|
||||
{
|
||||
}
|
||||
public MediumDragonBoatDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public MediumDragonBoatDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1041208; // medium dragon ship deed
|
||||
public override BaseBoat Boat => new MediumDragonBoat();
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
}
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class MediumDockedDragonBoat : BaseDockedBoat
|
||||
{
|
||||
public override BaseBoat Boat => new MediumDragonBoat();
|
||||
public class MediumDockedDragonBoat : BaseDockedBoat
|
||||
{
|
||||
public MediumDockedDragonBoat(BaseBoat boat) : base(0xC, Point3D.Zero, boat)
|
||||
{
|
||||
}
|
||||
|
||||
public MediumDockedDragonBoat( BaseBoat boat ) : base( 0xC, Point3D.Zero, boat )
|
||||
{
|
||||
}
|
||||
public MediumDockedDragonBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public MediumDockedDragonBoat( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override BaseBoat Boat => new MediumDragonBoat();
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,301 +1,337 @@
|
|||
using System;
|
||||
using Server.Factions;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum PlankSide{ Port, Starboard }
|
||||
public enum PlankSide
|
||||
{
|
||||
Port,
|
||||
Starboard
|
||||
}
|
||||
|
||||
public class Plank : Item, ILockable
|
||||
{
|
||||
private Timer m_CloseTimer;
|
||||
public class Plank : Item, ILockable
|
||||
{
|
||||
private Timer m_CloseTimer;
|
||||
|
||||
public Plank( BaseBoat boat, PlankSide side, uint keyValue ) : base( 0x3EB1 + (int)side )
|
||||
{
|
||||
Boat = boat;
|
||||
Side = side;
|
||||
KeyValue = keyValue;
|
||||
Locked = true;
|
||||
public Plank(BaseBoat boat, PlankSide side, uint keyValue) : base(0x3EB1 + (int)side)
|
||||
{
|
||||
Boat = boat;
|
||||
Side = side;
|
||||
KeyValue = keyValue;
|
||||
Locked = true;
|
||||
|
||||
Movable = false;
|
||||
}
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public Plank( Serial serial ) : base(serial)
|
||||
{
|
||||
}
|
||||
public Plank(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public BaseBoat Boat{ get; set; }
|
||||
|
||||
writer.Write( (int) 0 );//version
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public PlankSide Side{ get; set; }
|
||||
|
||||
writer.Write( Boat );
|
||||
writer.Write( (int) Side );
|
||||
writer.Write( Locked );
|
||||
writer.Write( KeyValue );
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool IsOpen => ItemID == 0x3ED5 || ItemID == 0x3ED4 || ItemID == 0x3E84 || ItemID == 0x3E89;
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Starboard => Side == PlankSide.Starboard;
|
||||
|
||||
int version = reader.ReadInt();
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Locked{ get; set; }
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Boat = reader.ReadItem() as BaseBoat;
|
||||
Side = (PlankSide) reader.ReadInt();
|
||||
Locked = reader.ReadBool();
|
||||
KeyValue = reader.ReadUInt();
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public uint KeyValue{ get; set; }
|
||||
|
||||
if ( Boat == null )
|
||||
Delete();
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
writer.Write(0); //version
|
||||
|
||||
if ( IsOpen )
|
||||
{
|
||||
m_CloseTimer = new CloseTimer( this );
|
||||
m_CloseTimer.Start();
|
||||
}
|
||||
}
|
||||
writer.Write(Boat);
|
||||
writer.Write((int)Side);
|
||||
writer.Write(Locked);
|
||||
writer.Write(KeyValue);
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BaseBoat Boat { get; set; }
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public PlankSide Side { get; set; }
|
||||
int version = reader.ReadInt();
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Locked { get; set; }
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Boat = reader.ReadItem() as BaseBoat;
|
||||
Side = (PlankSide)reader.ReadInt();
|
||||
Locked = reader.ReadBool();
|
||||
KeyValue = reader.ReadUInt();
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public uint KeyValue { get; set; }
|
||||
if (Boat == null)
|
||||
Delete();
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsOpen => ( ItemID == 0x3ED5 || ItemID == 0x3ED4 || ItemID == 0x3E84 || ItemID == 0x3E89 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Starboard => ( Side == PlankSide.Starboard );
|
||||
if (IsOpen)
|
||||
{
|
||||
m_CloseTimer = new CloseTimer(this);
|
||||
m_CloseTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
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 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;
|
||||
public void Open()
|
||||
{
|
||||
if (IsOpen || Deleted)
|
||||
return;
|
||||
|
||||
m_CloseTimer?.Stop();
|
||||
m_CloseTimer?.Stop();
|
||||
|
||||
m_CloseTimer = new CloseTimer( this );
|
||||
m_CloseTimer.Start();
|
||||
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;
|
||||
}
|
||||
switch (ItemID)
|
||||
{
|
||||
case 0x3EB1:
|
||||
ItemID = 0x3ED5;
|
||||
break;
|
||||
case 0x3E8A:
|
||||
ItemID = 0x3E89;
|
||||
break;
|
||||
case 0x3EB2:
|
||||
ItemID = 0x3ED4;
|
||||
break;
|
||||
case 0x3E85:
|
||||
ItemID = 0x3E84;
|
||||
break;
|
||||
}
|
||||
|
||||
Boat?.Refresh();
|
||||
}
|
||||
Boat?.Refresh();
|
||||
}
|
||||
|
||||
public override bool OnMoveOver( Mobile from )
|
||||
{
|
||||
if ( IsOpen )
|
||||
{
|
||||
if ( from is BaseFactionGuard )
|
||||
return false;
|
||||
public override bool OnMoveOver(Mobile from)
|
||||
{
|
||||
if (IsOpen)
|
||||
{
|
||||
if (from is BaseFactionGuard)
|
||||
return false;
|
||||
|
||||
if ( (from.Direction & Direction.Running) != 0 || (Boat != null && !Boat.Contains( from )) )
|
||||
return true;
|
||||
if ((from.Direction & Direction.Running) != 0 || Boat != null && !Boat.Contains(from))
|
||||
return true;
|
||||
|
||||
Map map = Map;
|
||||
Map map = Map;
|
||||
|
||||
if ( map == null )
|
||||
return false;
|
||||
if (map == null)
|
||||
return false;
|
||||
|
||||
int rx = 0, ry = 0;
|
||||
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;
|
||||
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 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;
|
||||
for (int j = -8; j <= 8; ++j)
|
||||
{
|
||||
z = from.Z + j;
|
||||
|
||||
if ( map.CanFit( x, y, z, 16, false, false ) && !Spells.SpellHelper.CheckMulti( new Point3D( x, y, z ), map ) && !Region.Find( new Point3D( x, y, z ), map ).IsPartOf( typeof( StrongholdRegion ) ) )
|
||||
{
|
||||
if ( i == 1 && j >= -2 && j <= 2 )
|
||||
return true;
|
||||
if (map.CanFit(x, y, z, 16, false, false) && !SpellHelper.CheckMulti(new Point3D(x, y, z), map) &&
|
||||
!Region.Find(new Point3D(x, y, z), map).IsPartOf(typeof(StrongholdRegion)))
|
||||
{
|
||||
if (i == 1 && j >= -2 && j <= 2)
|
||||
return true;
|
||||
|
||||
from.Location = new Point3D( x, y, z );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
from.Location = new Point3D(x, y, z);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
z = map.GetAverageZ( x, y );
|
||||
z = map.GetAverageZ(x, y);
|
||||
|
||||
if ( map.CanFit( x, y, z, 16, false, false ) && !Spells.SpellHelper.CheckMulti( new Point3D( x, y, z ), map ) && !Region.Find( new Point3D( x, y, z ), map ).IsPartOf( typeof( StrongholdRegion ) ) )
|
||||
{
|
||||
if ( i == 1 )
|
||||
return true;
|
||||
if (map.CanFit(x, y, z, 16, false, false) && !SpellHelper.CheckMulti(new Point3D(x, y, z), map) &&
|
||||
!Region.Find(new Point3D(x, y, z), map).IsPartOf(typeof(StrongholdRegion)))
|
||||
{
|
||||
if (i == 1)
|
||||
return true;
|
||||
|
||||
from.Location = new Point3D( x, y, z );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
from.Location = new Point3D(x, y, z);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CanClose()
|
||||
{
|
||||
Map map = Map;
|
||||
public bool CanClose()
|
||||
{
|
||||
Map map = Map;
|
||||
|
||||
if ( map == null || Deleted )
|
||||
return false;
|
||||
if (map == null || Deleted)
|
||||
return false;
|
||||
|
||||
foreach ( object o in GetObjectsInRange( 0 ) )
|
||||
{
|
||||
if ( o != this )
|
||||
return false;
|
||||
}
|
||||
foreach (object o in GetObjectsInRange(0))
|
||||
if (o != this)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
if ( !IsOpen || !CanClose() || Deleted )
|
||||
return;
|
||||
public void Close()
|
||||
{
|
||||
if (!IsOpen || !CanClose() || Deleted)
|
||||
return;
|
||||
|
||||
m_CloseTimer?.Stop();
|
||||
m_CloseTimer?.Stop();
|
||||
|
||||
m_CloseTimer = null;
|
||||
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;
|
||||
}
|
||||
switch (ItemID)
|
||||
{
|
||||
case 0x3ED5:
|
||||
ItemID = 0x3EB1;
|
||||
break;
|
||||
case 0x3E89:
|
||||
ItemID = 0x3E8A;
|
||||
break;
|
||||
case 0x3ED4:
|
||||
ItemID = 0x3EB2;
|
||||
break;
|
||||
case 0x3E84:
|
||||
ItemID = 0x3E85;
|
||||
break;
|
||||
}
|
||||
|
||||
Boat?.Refresh();
|
||||
}
|
||||
Boat?.Refresh();
|
||||
}
|
||||
|
||||
public override void OnDoubleClickDead( Mobile from )
|
||||
{
|
||||
OnDoubleClick( from );
|
||||
}
|
||||
public override void OnDoubleClickDead(Mobile from)
|
||||
{
|
||||
OnDoubleClick(from);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( Boat == null )
|
||||
return;
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (Boat == null)
|
||||
return;
|
||||
|
||||
if ( from.InRange( GetWorldLocation(), 8 ) )
|
||||
{
|
||||
if ( 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( X, Y, 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( X, Y, Z + 3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 0x00, 502503 ); // That is locked.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (from.InRange(GetWorldLocation(), 8))
|
||||
{
|
||||
if (Boat.Contains(from))
|
||||
{
|
||||
if (IsOpen)
|
||||
Close();
|
||||
else
|
||||
Open();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsOpen)
|
||||
{
|
||||
if (!Locked)
|
||||
{
|
||||
Open();
|
||||
}
|
||||
else if (from.AccessLevel >= AccessLevel.GameMaster)
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x00,
|
||||
502502); // That is locked but your godly powers allow access
|
||||
Open();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x00, 502503); // That is locked.
|
||||
}
|
||||
}
|
||||
else if (!Locked)
|
||||
{
|
||||
from.Location = new Point3D(X, Y, Z + 3);
|
||||
}
|
||||
else if (from.AccessLevel >= AccessLevel.GameMaster)
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x00,
|
||||
502502); // That is locked but your godly powers allow access
|
||||
from.Location = new Point3D(X, Y, Z + 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x00, 502503); // That is locked.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class CloseTimer : Timer
|
||||
{
|
||||
private Plank m_Plank;
|
||||
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;
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Plank.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,18 +2,18 @@ using Server.Prompts;
|
|||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class RenameBoatPrompt : Prompt
|
||||
{
|
||||
private BaseBoat m_Boat;
|
||||
public class RenameBoatPrompt : Prompt
|
||||
{
|
||||
private BaseBoat m_Boat;
|
||||
|
||||
public RenameBoatPrompt( BaseBoat boat )
|
||||
{
|
||||
m_Boat = boat;
|
||||
}
|
||||
public RenameBoatPrompt(BaseBoat boat)
|
||||
{
|
||||
m_Boat = boat;
|
||||
}
|
||||
|
||||
public override void OnResponse( Mobile from, string text )
|
||||
{
|
||||
m_Boat.EndRename( from, text );
|
||||
}
|
||||
}
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
m_Boat.EndRename(from, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,99 +1,99 @@
|
|||
namespace Server.Multis
|
||||
{
|
||||
public class SmallBoat : BaseBoat
|
||||
{
|
||||
public override int NorthID => 0x0;
|
||||
public override int EastID => 0x1;
|
||||
public override int SouthID => 0x2;
|
||||
public override int WestID => 0x3;
|
||||
public class SmallBoat : BaseBoat
|
||||
{
|
||||
[Constructible]
|
||||
public SmallBoat()
|
||||
{
|
||||
}
|
||||
|
||||
public override int HoldDistance => 4;
|
||||
public override int TillerManDistance => -4;
|
||||
public SmallBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override Point2D StarboardOffset => new Point2D( 2, 0 );
|
||||
public override Point2D PortOffset => new Point2D( -2, 0 );
|
||||
public override int NorthID => 0x0;
|
||||
public override int EastID => 0x1;
|
||||
public override int SouthID => 0x2;
|
||||
public override int WestID => 0x3;
|
||||
|
||||
public override Point3D MarkOffset => new Point3D( 0, 1, 3 );
|
||||
public override int HoldDistance => 4;
|
||||
public override int TillerManDistance => -4;
|
||||
|
||||
public override BaseDockedBoat DockedBoat => new SmallDockedBoat( this );
|
||||
public override Point2D StarboardOffset => new Point2D(2, 0);
|
||||
public override Point2D PortOffset => new Point2D(-2, 0);
|
||||
|
||||
[Constructible]
|
||||
public SmallBoat()
|
||||
{
|
||||
}
|
||||
public override Point3D MarkOffset => new Point3D(0, 1, 3);
|
||||
|
||||
public SmallBoat( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override BaseDockedBoat DockedBoat => new SmallDockedBoat(this);
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
}
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class SmallBoatDeed : BaseBoatDeed
|
||||
{
|
||||
public override int LabelNumber => 1041205; // small ship deed
|
||||
public override BaseBoat Boat => new SmallBoat();
|
||||
public class SmallBoatDeed : BaseBoatDeed
|
||||
{
|
||||
[Constructible]
|
||||
public SmallBoatDeed() : base(0x0, Point3D.Zero)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SmallBoatDeed() : base( 0x0, Point3D.Zero )
|
||||
{
|
||||
}
|
||||
public SmallBoatDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public SmallBoatDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1041205; // small ship deed
|
||||
public override BaseBoat Boat => new SmallBoat();
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
}
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class SmallDockedBoat : BaseDockedBoat
|
||||
{
|
||||
public override BaseBoat Boat => new SmallBoat();
|
||||
public class SmallDockedBoat : BaseDockedBoat
|
||||
{
|
||||
public SmallDockedBoat(BaseBoat boat) : base(0x0, Point3D.Zero, boat)
|
||||
{
|
||||
}
|
||||
|
||||
public SmallDockedBoat( BaseBoat boat ) : base( 0x0, Point3D.Zero, boat )
|
||||
{
|
||||
}
|
||||
public SmallDockedBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public SmallDockedBoat( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override BaseBoat Boat => new SmallBoat();
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,99 +1,99 @@
|
|||
namespace Server.Multis
|
||||
{
|
||||
public class SmallDragonBoat : BaseBoat
|
||||
{
|
||||
public override int NorthID => 0x4;
|
||||
public override int EastID => 0x5;
|
||||
public override int SouthID => 0x6;
|
||||
public override int WestID => 0x7;
|
||||
public class SmallDragonBoat : BaseBoat
|
||||
{
|
||||
[Constructible]
|
||||
public SmallDragonBoat()
|
||||
{
|
||||
}
|
||||
|
||||
public override int HoldDistance => 4;
|
||||
public override int TillerManDistance => -4;
|
||||
public SmallDragonBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override Point2D StarboardOffset => new Point2D( 2, 0 );
|
||||
public override Point2D PortOffset => new Point2D( -2, 0 );
|
||||
public override int NorthID => 0x4;
|
||||
public override int EastID => 0x5;
|
||||
public override int SouthID => 0x6;
|
||||
public override int WestID => 0x7;
|
||||
|
||||
public override Point3D MarkOffset => new Point3D( 0, 1, 3 );
|
||||
public override int HoldDistance => 4;
|
||||
public override int TillerManDistance => -4;
|
||||
|
||||
public override BaseDockedBoat DockedBoat => new SmallDockedDragonBoat( this );
|
||||
public override Point2D StarboardOffset => new Point2D(2, 0);
|
||||
public override Point2D PortOffset => new Point2D(-2, 0);
|
||||
|
||||
[Constructible]
|
||||
public SmallDragonBoat()
|
||||
{
|
||||
}
|
||||
public override Point3D MarkOffset => new Point3D(0, 1, 3);
|
||||
|
||||
public SmallDragonBoat( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override BaseDockedBoat DockedBoat => new SmallDockedDragonBoat(this);
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
}
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class SmallDragonBoatDeed : BaseBoatDeed
|
||||
{
|
||||
public override int LabelNumber => 1041206; // small dragon ship deed
|
||||
public override BaseBoat Boat => new SmallDragonBoat();
|
||||
public class SmallDragonBoatDeed : BaseBoatDeed
|
||||
{
|
||||
[Constructible]
|
||||
public SmallDragonBoatDeed() : base(0x4, Point3D.Zero)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SmallDragonBoatDeed() : base( 0x4, Point3D.Zero )
|
||||
{
|
||||
}
|
||||
public SmallDragonBoatDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public SmallDragonBoatDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1041206; // small dragon ship deed
|
||||
public override BaseBoat Boat => new SmallDragonBoat();
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
}
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
|
||||
public class SmallDockedDragonBoat : BaseDockedBoat
|
||||
{
|
||||
public override BaseBoat Boat => new SmallDragonBoat();
|
||||
public class SmallDockedDragonBoat : BaseDockedBoat
|
||||
{
|
||||
public SmallDockedDragonBoat(BaseBoat boat) : base(0x4, Point3D.Zero, boat)
|
||||
{
|
||||
}
|
||||
|
||||
public SmallDockedDragonBoat( BaseBoat boat ) : base( 0x4, Point3D.Zero, boat )
|
||||
{
|
||||
}
|
||||
public SmallDockedDragonBoat(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public SmallDockedDragonBoat( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override BaseBoat Boat => new SmallDragonBoat();
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
writer.Write(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,179 +1,178 @@
|
|||
namespace Server.Misc
|
||||
{
|
||||
public class Strandedness
|
||||
{
|
||||
private static Point2D[] m_Felucca = {
|
||||
new Point2D( 2528, 3568 ), new Point2D( 2376, 3400 ), new Point2D( 2528, 3896 ),
|
||||
new Point2D( 2168, 3904 ), new Point2D( 1136, 3416 ), new Point2D( 1432, 3648 ),
|
||||
new Point2D( 1416, 4000 ), new Point2D( 4512, 3936 ), new Point2D( 4440, 3120 ),
|
||||
new Point2D( 4192, 3672 ), new Point2D( 4720, 3472 ), new Point2D( 3744, 2768 ),
|
||||
new Point2D( 3480, 2432 ), new Point2D( 3560, 2136 ), new Point2D( 3792, 2112 ),
|
||||
new Point2D( 2800, 2296 ), new Point2D( 2736, 2016 ), new Point2D( 4576, 1456 ),
|
||||
new Point2D( 4680, 1152 ), new Point2D( 4304, 1104 ), new Point2D( 4496, 984 ),
|
||||
new Point2D( 4248, 696 ), new Point2D( 4040, 616 ), new Point2D( 3896, 248 ),
|
||||
new Point2D( 4176, 384 ), new Point2D( 3672, 1104 ), new Point2D( 3520, 1152 ),
|
||||
new Point2D( 3720, 1360 ), new Point2D( 2184, 2152 ), new Point2D( 1952, 2088 ),
|
||||
new Point2D( 2056, 1936 ), new Point2D( 1720, 1992 ), new Point2D( 472, 2064 ),
|
||||
new Point2D( 656, 2096 ), new Point2D( 3008, 3592 ), new Point2D( 2784, 3472 ),
|
||||
new Point2D( 5456, 2400 ), new Point2D( 5976, 2424 ), new Point2D( 5328, 3112 ),
|
||||
new Point2D( 5792, 3152 ), new Point2D( 2120, 3616 ), new Point2D( 2136, 3128 ),
|
||||
new Point2D( 1632, 3528 ), new Point2D( 1328, 3160 ), new Point2D( 1072, 3136 ),
|
||||
new Point2D( 1128, 2976 ), new Point2D( 960, 2576 ), new Point2D( 752, 1832 ),
|
||||
new Point2D( 184, 1488 ), new Point2D( 592, 1440 ), new Point2D( 368, 1216 ),
|
||||
new Point2D( 232, 752 ), new Point2D( 696, 744 ), new Point2D( 304, 1000 ),
|
||||
new Point2D( 840, 376 ), new Point2D( 1192, 624 ), new Point2D( 1200, 192 ),
|
||||
new Point2D( 1512, 240 ), new Point2D( 1336, 456 ), new Point2D( 1536, 648 ),
|
||||
new Point2D( 1104, 952 ), new Point2D( 1864, 264 ), new Point2D( 2136, 200 ),
|
||||
new Point2D( 2160, 528 ), new Point2D( 1904, 512 ), new Point2D( 2240, 784 ),
|
||||
new Point2D( 2536, 776 ), new Point2D( 2488, 216 ), new Point2D( 2336, 72 ),
|
||||
new Point2D( 2648, 288 ), new Point2D( 2680, 576 ), new Point2D( 2896, 88 ),
|
||||
new Point2D( 2840, 344 ), new Point2D( 3136, 72 ), new Point2D( 2968, 520 ),
|
||||
new Point2D( 3192, 328 ), new Point2D( 3448, 208 ), new Point2D( 3432, 608 ),
|
||||
new Point2D( 3184, 752 ), new Point2D( 2800, 704 ), new Point2D( 2768, 1016 ),
|
||||
new Point2D( 2448, 1232 ), new Point2D( 2272, 920 ), new Point2D( 2072, 1080 ),
|
||||
new Point2D( 2048, 1264 ), new Point2D( 1808, 1528 ), new Point2D( 1496, 1880 ),
|
||||
new Point2D( 1656, 2168 ), new Point2D( 2096, 2320 ), new Point2D( 1816, 2528 ),
|
||||
new Point2D( 1840, 2640 ), new Point2D( 1928, 2952 ), new Point2D( 2120, 2712 )
|
||||
};
|
||||
public class Strandedness
|
||||
{
|
||||
private static Point2D[] m_Felucca =
|
||||
{
|
||||
new Point2D(2528, 3568), new Point2D(2376, 3400), new Point2D(2528, 3896),
|
||||
new Point2D(2168, 3904), new Point2D(1136, 3416), new Point2D(1432, 3648),
|
||||
new Point2D(1416, 4000), new Point2D(4512, 3936), new Point2D(4440, 3120),
|
||||
new Point2D(4192, 3672), new Point2D(4720, 3472), new Point2D(3744, 2768),
|
||||
new Point2D(3480, 2432), new Point2D(3560, 2136), new Point2D(3792, 2112),
|
||||
new Point2D(2800, 2296), new Point2D(2736, 2016), new Point2D(4576, 1456),
|
||||
new Point2D(4680, 1152), new Point2D(4304, 1104), new Point2D(4496, 984),
|
||||
new Point2D(4248, 696), new Point2D(4040, 616), new Point2D(3896, 248),
|
||||
new Point2D(4176, 384), new Point2D(3672, 1104), new Point2D(3520, 1152),
|
||||
new Point2D(3720, 1360), new Point2D(2184, 2152), new Point2D(1952, 2088),
|
||||
new Point2D(2056, 1936), new Point2D(1720, 1992), new Point2D(472, 2064),
|
||||
new Point2D(656, 2096), new Point2D(3008, 3592), new Point2D(2784, 3472),
|
||||
new Point2D(5456, 2400), new Point2D(5976, 2424), new Point2D(5328, 3112),
|
||||
new Point2D(5792, 3152), new Point2D(2120, 3616), new Point2D(2136, 3128),
|
||||
new Point2D(1632, 3528), new Point2D(1328, 3160), new Point2D(1072, 3136),
|
||||
new Point2D(1128, 2976), new Point2D(960, 2576), new Point2D(752, 1832),
|
||||
new Point2D(184, 1488), new Point2D(592, 1440), new Point2D(368, 1216),
|
||||
new Point2D(232, 752), new Point2D(696, 744), new Point2D(304, 1000),
|
||||
new Point2D(840, 376), new Point2D(1192, 624), new Point2D(1200, 192),
|
||||
new Point2D(1512, 240), new Point2D(1336, 456), new Point2D(1536, 648),
|
||||
new Point2D(1104, 952), new Point2D(1864, 264), new Point2D(2136, 200),
|
||||
new Point2D(2160, 528), new Point2D(1904, 512), new Point2D(2240, 784),
|
||||
new Point2D(2536, 776), new Point2D(2488, 216), new Point2D(2336, 72),
|
||||
new Point2D(2648, 288), new Point2D(2680, 576), new Point2D(2896, 88),
|
||||
new Point2D(2840, 344), new Point2D(3136, 72), new Point2D(2968, 520),
|
||||
new Point2D(3192, 328), new Point2D(3448, 208), new Point2D(3432, 608),
|
||||
new Point2D(3184, 752), new Point2D(2800, 704), new Point2D(2768, 1016),
|
||||
new Point2D(2448, 1232), new Point2D(2272, 920), new Point2D(2072, 1080),
|
||||
new Point2D(2048, 1264), new Point2D(1808, 1528), new Point2D(1496, 1880),
|
||||
new Point2D(1656, 2168), new Point2D(2096, 2320), new Point2D(1816, 2528),
|
||||
new Point2D(1840, 2640), new Point2D(1928, 2952), new Point2D(2120, 2712)
|
||||
};
|
||||
|
||||
private static Point2D[] m_Trammel = m_Felucca;
|
||||
private static Point2D[] m_Trammel = m_Felucca;
|
||||
|
||||
private static Point2D[] m_Ilshenar = {
|
||||
new Point2D( 1252, 1180 ), new Point2D( 1562, 1090 ), new Point2D( 1444, 1016 ),
|
||||
new Point2D( 1324, 968 ), new Point2D( 1418, 806 ), new Point2D( 1722, 874 ),
|
||||
new Point2D( 1456, 684 ), new Point2D( 1036, 866 ), new Point2D( 612, 476 ),
|
||||
new Point2D( 1476, 372 ), new Point2D( 762, 472 ), new Point2D( 812, 1162 ),
|
||||
new Point2D( 1422, 1144 ), new Point2D( 1254, 1066 ), new Point2D( 1598, 870 ),
|
||||
new Point2D( 1358, 866 ), new Point2D( 510, 302 ), new Point2D( 510, 392 )
|
||||
};
|
||||
private static Point2D[] m_Ilshenar =
|
||||
{
|
||||
new Point2D(1252, 1180), new Point2D(1562, 1090), new Point2D(1444, 1016),
|
||||
new Point2D(1324, 968), new Point2D(1418, 806), new Point2D(1722, 874),
|
||||
new Point2D(1456, 684), new Point2D(1036, 866), new Point2D(612, 476),
|
||||
new Point2D(1476, 372), new Point2D(762, 472), new Point2D(812, 1162),
|
||||
new Point2D(1422, 1144), new Point2D(1254, 1066), new Point2D(1598, 870),
|
||||
new Point2D(1358, 866), new Point2D(510, 302), new Point2D(510, 392)
|
||||
};
|
||||
|
||||
private static Point2D[] m_Tokuno = {
|
||||
//Makoto-Jima
|
||||
new Point2D( 837, 1351 ), new Point2D( 941, 1241 ), new Point2D( 959, 1185 ),
|
||||
new Point2D( 923, 1091 ), new Point2D( 904, 983 ), new Point2D( 845, 944 ),
|
||||
new Point2D( 829, 896 ), new Point2D( 794, 852 ), new Point2D( 766, 821 ),
|
||||
new Point2D( 695, 814 ), new Point2D( 576, 835 ), new Point2D( 518, 840 ),
|
||||
new Point2D( 519, 902 ), new Point2D( 502, 950 ), new Point2D( 503, 1045 ),
|
||||
new Point2D( 547, 1131 ), new Point2D( 518, 1204 ), new Point2D( 506, 1243 ),
|
||||
new Point2D( 526, 1271 ), new Point2D( 562, 1295 ), new Point2D( 616, 1335 ),
|
||||
new Point2D( 789, 1347 ), new Point2D( 712, 1359 ),
|
||||
private static Point2D[] m_Tokuno =
|
||||
{
|
||||
//Makoto-Jima
|
||||
new Point2D(837, 1351), new Point2D(941, 1241), new Point2D(959, 1185),
|
||||
new Point2D(923, 1091), new Point2D(904, 983), new Point2D(845, 944),
|
||||
new Point2D(829, 896), new Point2D(794, 852), new Point2D(766, 821),
|
||||
new Point2D(695, 814), new Point2D(576, 835), new Point2D(518, 840),
|
||||
new Point2D(519, 902), new Point2D(502, 950), new Point2D(503, 1045),
|
||||
new Point2D(547, 1131), new Point2D(518, 1204), new Point2D(506, 1243),
|
||||
new Point2D(526, 1271), new Point2D(562, 1295), new Point2D(616, 1335),
|
||||
new Point2D(789, 1347), new Point2D(712, 1359),
|
||||
|
||||
//Homare-Jima
|
||||
new Point2D( 202, 498 ), new Point2D( 116, 600 ), new Point2D( 107, 699 ),
|
||||
new Point2D( 162, 799 ), new Point2D( 158, 889 ), new Point2D( 169, 989 ),
|
||||
new Point2D( 194, 1101 ), new Point2D( 250, 1163 ), new Point2D( 295, 1176 ),
|
||||
new Point2D( 280, 1194 ), new Point2D( 286, 1102 ), new Point2D( 250, 1000 ),
|
||||
new Point2D( 260, 906 ), new Point2D( 360, 838 ), new Point2D( 389, 763 ),
|
||||
new Point2D( 415, 662 ), new Point2D( 500, 597 ), new Point2D( 570, 572 ),
|
||||
new Point2D( 631, 577 ), new Point2D( 692, 500 ), new Point2D( 723, 445 ),
|
||||
new Point2D( 672, 379 ), new Point2D( 626, 332 ), new Point2D( 494, 291 ),
|
||||
new Point2D( 371, 336 ), new Point2D( 324, 334 ), new Point2D( 270, 362 ),
|
||||
//Homare-Jima
|
||||
new Point2D(202, 498), new Point2D(116, 600), new Point2D(107, 699),
|
||||
new Point2D(162, 799), new Point2D(158, 889), new Point2D(169, 989),
|
||||
new Point2D(194, 1101), new Point2D(250, 1163), new Point2D(295, 1176),
|
||||
new Point2D(280, 1194), new Point2D(286, 1102), new Point2D(250, 1000),
|
||||
new Point2D(260, 906), new Point2D(360, 838), new Point2D(389, 763),
|
||||
new Point2D(415, 662), new Point2D(500, 597), new Point2D(570, 572),
|
||||
new Point2D(631, 577), new Point2D(692, 500), new Point2D(723, 445),
|
||||
new Point2D(672, 379), new Point2D(626, 332), new Point2D(494, 291),
|
||||
new Point2D(371, 336), new Point2D(324, 334), new Point2D(270, 362),
|
||||
|
||||
//Isamu-Jima
|
||||
new Point2D( 1240, 1076 ), new Point2D( 1189, 1115 ), new Point2D( 1046, 1039 ),
|
||||
new Point2D( 1025, 885 ), new Point2D( 907, 809 ), new Point2D( 840, 506 ),
|
||||
new Point2D( 799, 396 ), new Point2D( 720, 258 ), new Point2D( 744, 158 ),
|
||||
new Point2D( 904, 37 ), new Point2D( 974, 91 ), new Point2D( 1020, 187 ),
|
||||
new Point2D( 1035, 288 ), new Point2D( 1104, 395 ), new Point2D( 1215, 462 ),
|
||||
new Point2D( 1275, 488 ), new Point2D( 1348, 611 ), new Point2D( 1363, 739 ),
|
||||
new Point2D( 1364, 765 ), new Point2D( 1364, 876 ), new Point2D( 1300, 936 ),
|
||||
new Point2D( 1240, 1003 )
|
||||
//Isamu-Jima
|
||||
new Point2D(1240, 1076), new Point2D(1189, 1115), new Point2D(1046, 1039),
|
||||
new Point2D(1025, 885), new Point2D(907, 809), new Point2D(840, 506),
|
||||
new Point2D(799, 396), new Point2D(720, 258), new Point2D(744, 158),
|
||||
new Point2D(904, 37), new Point2D(974, 91), new Point2D(1020, 187),
|
||||
new Point2D(1035, 288), new Point2D(1104, 395), new Point2D(1215, 462),
|
||||
new Point2D(1275, 488), new Point2D(1348, 611), new Point2D(1363, 739),
|
||||
new Point2D(1364, 765), new Point2D(1364, 876), new Point2D(1300, 936),
|
||||
new Point2D(1240, 1003)
|
||||
};
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
EventSink.Login += EventSink_Login;
|
||||
}
|
||||
|
||||
};
|
||||
private static bool IsStranded(Mobile from)
|
||||
{
|
||||
Map map = from.Map;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
EventSink.Login += EventSink_Login;
|
||||
}
|
||||
if (map == null)
|
||||
return false;
|
||||
|
||||
private static bool IsStranded( Mobile from )
|
||||
{
|
||||
Map map = from.Map;
|
||||
object surface = map.GetTopSurface(from.Location);
|
||||
|
||||
if ( map == null )
|
||||
return false;
|
||||
if (surface is LandTile)
|
||||
{
|
||||
int id = ((LandTile)surface).ID;
|
||||
|
||||
object surface = map.GetTopSurface( from.Location );
|
||||
return id >= 168 && id <= 171
|
||||
|| id >= 310 && id <= 311;
|
||||
}
|
||||
|
||||
if ( surface is LandTile ) {
|
||||
int id = ((LandTile)surface).ID;
|
||||
if (surface is StaticTile)
|
||||
{
|
||||
int id = ((StaticTile)surface).ID;
|
||||
|
||||
return (id >= 168 && id <= 171)
|
||||
|| (id >= 310 && id <= 311);
|
||||
}
|
||||
return id >= 0x1796 && id <= 0x17B2;
|
||||
}
|
||||
|
||||
if ( surface is StaticTile ) {
|
||||
int id = ((StaticTile)surface).ID;
|
||||
return false;
|
||||
}
|
||||
|
||||
return (id >= 0x1796 && id <= 0x17B2);
|
||||
}
|
||||
public static void EventSink_Login(LoginEventArgs e)
|
||||
{
|
||||
Mobile from = e.Mobile;
|
||||
|
||||
return false;
|
||||
}
|
||||
if (!IsStranded(from))
|
||||
return;
|
||||
|
||||
public static void EventSink_Login( LoginEventArgs e )
|
||||
{
|
||||
Mobile from = e.Mobile;
|
||||
Map map = from.Map;
|
||||
|
||||
if ( !IsStranded( from ) )
|
||||
return;
|
||||
Point2D[] list;
|
||||
|
||||
Map map = from.Map;
|
||||
if (map == Map.Felucca)
|
||||
list = m_Felucca;
|
||||
else if (map == Map.Trammel)
|
||||
list = m_Trammel;
|
||||
else if (map == Map.Ilshenar)
|
||||
list = m_Ilshenar;
|
||||
else if (map == Map.Tokuno)
|
||||
list = m_Tokuno;
|
||||
else
|
||||
return;
|
||||
|
||||
Point2D[] list;
|
||||
Point2D p = Point2D.Zero;
|
||||
double pdist = double.MaxValue;
|
||||
|
||||
if ( map == Map.Felucca )
|
||||
list = m_Felucca;
|
||||
else if ( map == Map.Trammel )
|
||||
list = m_Trammel;
|
||||
else if ( map == Map.Ilshenar )
|
||||
list = m_Ilshenar;
|
||||
else if ( map == Map.Tokuno )
|
||||
list = m_Tokuno;
|
||||
else
|
||||
return;
|
||||
for (int i = 0; i < list.Length; ++i)
|
||||
{
|
||||
double dist = from.GetDistanceToSqrt(list[i]);
|
||||
|
||||
Point2D p = Point2D.Zero;
|
||||
double pdist = double.MaxValue;
|
||||
if (dist < pdist)
|
||||
{
|
||||
p = list[i];
|
||||
pdist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i < list.Length; ++i )
|
||||
{
|
||||
double dist = from.GetDistanceToSqrt( list[i] );
|
||||
int x = p.X, y = p.Y;
|
||||
int z;
|
||||
bool canFit = false;
|
||||
|
||||
if ( dist < pdist )
|
||||
{
|
||||
p = list[i];
|
||||
pdist = dist;
|
||||
}
|
||||
}
|
||||
z = map.GetAverageZ(x, y);
|
||||
canFit = map.CanSpawnMobile(x, y, z);
|
||||
|
||||
int x = p.X, y = p.Y;
|
||||
int z;
|
||||
bool canFit = false;
|
||||
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;
|
||||
|
||||
z = map.GetAverageZ( x, y );
|
||||
canFit = map.CanSpawnMobile( x, y, z );
|
||||
x = p.X + xo * i;
|
||||
y = p.Y + yo * i;
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (canFit)
|
||||
from.Location = new Point3D(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,116 +3,120 @@ using Server.Network;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TillerMan : Item
|
||||
{
|
||||
private BaseBoat m_Boat;
|
||||
public class TillerMan : Item
|
||||
{
|
||||
private BaseBoat m_Boat;
|
||||
|
||||
public TillerMan( BaseBoat boat ) : base( 0x3E4E )
|
||||
{
|
||||
m_Boat = boat;
|
||||
Movable = false;
|
||||
}
|
||||
public TillerMan(BaseBoat boat) : base(0x3E4E)
|
||||
{
|
||||
m_Boat = boat;
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public TillerMan( Serial serial ) : base(serial)
|
||||
{
|
||||
}
|
||||
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 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 );
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add( m_Boat.Status );
|
||||
}
|
||||
list.Add(m_Boat.Status);
|
||||
}
|
||||
|
||||
public void Say( int number )
|
||||
{
|
||||
PublicOverheadMessage( MessageType.Regular, 0x3B2, number );
|
||||
}
|
||||
public void Say(int number)
|
||||
{
|
||||
PublicOverheadMessage(MessageType.Regular, 0x3B2, number);
|
||||
}
|
||||
|
||||
public void Say( int number, string args )
|
||||
{
|
||||
PublicOverheadMessage( MessageType.Regular, 0x3B2, number, args );
|
||||
}
|
||||
public void Say(int number, string args)
|
||||
{
|
||||
PublicOverheadMessage(MessageType.Regular, 0x3B2, number, args);
|
||||
}
|
||||
|
||||
public override void AddNameProperty( ObjectPropertyList list )
|
||||
{
|
||||
if ( 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 AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
if (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?.ShipName != null )
|
||||
LabelTo( from, 1042884, m_Boat.ShipName ); // the tiller man of the ~1_SHIP_NAME~
|
||||
else
|
||||
base.OnSingleClick( from );
|
||||
}
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
if (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 && m_Boat.Contains( from ) )
|
||||
m_Boat.BeginRename( from );
|
||||
else
|
||||
{
|
||||
m_Boat?.BeginDryDock( from );
|
||||
}
|
||||
}
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (m_Boat != null && m_Boat.Contains(from))
|
||||
m_Boat.BeginRename(from);
|
||||
else
|
||||
m_Boat?.BeginDryDock(from);
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
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;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
m_Boat?.Delete();
|
||||
}
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
m_Boat?.Delete();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 );//version
|
||||
writer.Write(0); //version
|
||||
|
||||
writer.Write( m_Boat );
|
||||
}
|
||||
writer.Write(m_Boat);
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Boat = reader.ReadItem() as BaseBoat;
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Boat = reader.ReadItem() as BaseBoat;
|
||||
|
||||
if ( m_Boat == null )
|
||||
Delete();
|
||||
if (m_Boat == null)
|
||||
Delete();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,45 +3,45 @@ using Server.Mobiles;
|
|||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class BankerCamp : BaseCamp
|
||||
{
|
||||
[Constructible]
|
||||
public BankerCamp() : base( 0x1F6 )
|
||||
{
|
||||
}
|
||||
public class BankerCamp : BaseCamp
|
||||
{
|
||||
[Constructible]
|
||||
public BankerCamp() : base(0x1F6)
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddComponents()
|
||||
{
|
||||
BaseDoor west, east;
|
||||
public BankerCamp(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
AddItem( west = new LightWoodGate( DoorFacing.WestCW ), -4, 4, 7 );
|
||||
AddItem( east = new LightWoodGate( DoorFacing.EastCCW ), -3, 4, 7 );
|
||||
public override void AddComponents()
|
||||
{
|
||||
BaseDoor west, east;
|
||||
|
||||
west.Link = east;
|
||||
east.Link = west;
|
||||
AddItem(west = new LightWoodGate(DoorFacing.WestCW), -4, 4, 7);
|
||||
AddItem(east = new LightWoodGate(DoorFacing.EastCCW), -3, 4, 7);
|
||||
|
||||
AddItem( new Sign( SignType.Bank, SignFacing.West ), -5, 5, -4 );
|
||||
west.Link = east;
|
||||
east.Link = west;
|
||||
|
||||
AddMobile( new Banker(), 4, -4, 3, 7 );
|
||||
AddMobile( new Banker(), 5, 4, -2, 0 );
|
||||
}
|
||||
AddItem(new Sign(SignType.Bank, SignFacing.West), -5, 5, -4);
|
||||
|
||||
public BankerCamp( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
AddMobile(new Banker(), 4, -4, 3, 7);
|
||||
AddMobile(new Banker(), 5, 4, -2, 0);
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,201 +1,201 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public abstract class BaseCamp : BaseMulti
|
||||
{
|
||||
private List<Item> m_Items;
|
||||
private List<Mobile> m_Mobiles;
|
||||
private DateTime m_DecayTime;
|
||||
private Timer m_DecayTimer;
|
||||
private TimeSpan m_DecayDelay;
|
||||
public abstract class BaseCamp : BaseMulti
|
||||
{
|
||||
private TimeSpan m_DecayDelay;
|
||||
private DateTime m_DecayTime;
|
||||
private Timer m_DecayTimer;
|
||||
private List<Item> m_Items;
|
||||
private List<Mobile> m_Mobiles;
|
||||
|
||||
public virtual int EventRange => 10;
|
||||
public BaseCamp(int multiID) : base(multiID)
|
||||
{
|
||||
m_Items = new List<Item>();
|
||||
m_Mobiles = new List<Mobile>();
|
||||
m_DecayDelay = TimeSpan.FromMinutes(30.0);
|
||||
RefreshDecay(true);
|
||||
|
||||
public virtual TimeSpan DecayDelay
|
||||
{
|
||||
get => m_DecayDelay;
|
||||
set
|
||||
{
|
||||
m_DecayDelay = value;
|
||||
RefreshDecay( true );
|
||||
}
|
||||
}
|
||||
Timer.DelayCall(TimeSpan.Zero, CheckAddComponents);
|
||||
}
|
||||
|
||||
public BaseCamp( int multiID ) : base( multiID )
|
||||
{
|
||||
m_Items = new List<Item>();
|
||||
m_Mobiles = new List<Mobile>();
|
||||
m_DecayDelay = TimeSpan.FromMinutes( 30.0 );
|
||||
RefreshDecay( true );
|
||||
public BaseCamp(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
Timer.DelayCall( TimeSpan.Zero, CheckAddComponents );
|
||||
}
|
||||
public virtual int EventRange => 10;
|
||||
|
||||
public void CheckAddComponents()
|
||||
{
|
||||
if ( Deleted )
|
||||
return;
|
||||
public virtual TimeSpan DecayDelay
|
||||
{
|
||||
get => m_DecayDelay;
|
||||
set
|
||||
{
|
||||
m_DecayDelay = value;
|
||||
RefreshDecay(true);
|
||||
}
|
||||
}
|
||||
|
||||
AddComponents();
|
||||
}
|
||||
public override bool HandlesOnMovement => true;
|
||||
|
||||
public virtual void AddComponents()
|
||||
{
|
||||
}
|
||||
public void CheckAddComponents()
|
||||
{
|
||||
if (Deleted)
|
||||
return;
|
||||
|
||||
public virtual void RefreshDecay( bool setDecayTime )
|
||||
{
|
||||
if ( Deleted )
|
||||
return;
|
||||
AddComponents();
|
||||
}
|
||||
|
||||
m_DecayTimer?.Stop();
|
||||
public virtual void AddComponents()
|
||||
{
|
||||
}
|
||||
|
||||
if ( setDecayTime )
|
||||
m_DecayTime = DateTime.UtcNow + DecayDelay;
|
||||
public virtual void RefreshDecay(bool setDecayTime)
|
||||
{
|
||||
if (Deleted)
|
||||
return;
|
||||
|
||||
m_DecayTimer = Timer.DelayCall( DecayDelay, Delete );
|
||||
}
|
||||
m_DecayTimer?.Stop();
|
||||
|
||||
public virtual void AddItem( Item item, int xOffset, int yOffset, int zOffset )
|
||||
{
|
||||
m_Items.Add( item );
|
||||
if (setDecayTime)
|
||||
m_DecayTime = DateTime.UtcNow + DecayDelay;
|
||||
|
||||
int zavg = Map.GetAverageZ(X + xOffset, Y + yOffset);
|
||||
item.MoveToWorld( new Point3D( X + xOffset, Y + yOffset, zavg + zOffset ), Map );
|
||||
}
|
||||
m_DecayTimer = Timer.DelayCall(DecayDelay, Delete);
|
||||
}
|
||||
|
||||
public virtual void AddMobile( Mobile m, int wanderRange, int xOffset, int yOffset, int zOffset )
|
||||
{
|
||||
m_Mobiles.Add(m);
|
||||
public virtual void AddItem(Item item, int xOffset, int yOffset, int zOffset)
|
||||
{
|
||||
m_Items.Add(item);
|
||||
|
||||
int zavg = Map.GetAverageZ(X + xOffset, Y + yOffset);
|
||||
Point3D loc = new Point3D(X + xOffset, Y + yOffset, zavg + zOffset);
|
||||
BaseCreature bc = m as BaseCreature;
|
||||
int zavg = Map.GetAverageZ(X + xOffset, Y + yOffset);
|
||||
item.MoveToWorld(new Point3D(X + xOffset, Y + yOffset, zavg + zOffset), Map);
|
||||
}
|
||||
|
||||
if ( bc != null )
|
||||
{
|
||||
bc.RangeHome = wanderRange;
|
||||
bc.Home = loc;
|
||||
}
|
||||
public virtual void AddMobile(Mobile m, int wanderRange, int xOffset, int yOffset, int zOffset)
|
||||
{
|
||||
m_Mobiles.Add(m);
|
||||
|
||||
if ( m is BaseVendor || m is Banker )
|
||||
m.Direction = Direction.South;
|
||||
int zavg = Map.GetAverageZ(X + xOffset, Y + yOffset);
|
||||
Point3D loc = new Point3D(X + xOffset, Y + yOffset, zavg + zOffset);
|
||||
BaseCreature bc = m as BaseCreature;
|
||||
|
||||
m.MoveToWorld( loc, Map );
|
||||
}
|
||||
if (bc != null)
|
||||
{
|
||||
bc.RangeHome = wanderRange;
|
||||
bc.Home = loc;
|
||||
}
|
||||
|
||||
public virtual void OnEnter( Mobile m )
|
||||
{
|
||||
RefreshDecay( true );
|
||||
}
|
||||
if (m is BaseVendor || m is Banker)
|
||||
m.Direction = Direction.South;
|
||||
|
||||
public virtual void OnExit( Mobile m )
|
||||
{
|
||||
RefreshDecay( true );
|
||||
}
|
||||
m.MoveToWorld(loc, Map);
|
||||
}
|
||||
|
||||
public override bool HandlesOnMovement => true;
|
||||
public virtual void OnEnter(Mobile m)
|
||||
{
|
||||
RefreshDecay(true);
|
||||
}
|
||||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
bool inOldRange = Utility.InRange( oldLocation, Location, EventRange );
|
||||
bool inNewRange = Utility.InRange( m.Location, Location, EventRange );
|
||||
public virtual void OnExit(Mobile m)
|
||||
{
|
||||
RefreshDecay(true);
|
||||
}
|
||||
|
||||
if ( inNewRange && !inOldRange )
|
||||
OnEnter( m );
|
||||
else if ( inOldRange && !inNewRange )
|
||||
OnExit( m );
|
||||
}
|
||||
public override void OnMovement(Mobile m, Point3D oldLocation)
|
||||
{
|
||||
bool inOldRange = Utility.InRange(oldLocation, Location, EventRange);
|
||||
bool inNewRange = Utility.InRange(m.Location, Location, EventRange);
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
if (inNewRange && !inOldRange)
|
||||
OnEnter(m);
|
||||
else if (inOldRange && !inNewRange)
|
||||
OnExit(m);
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Items.Count; ++i )
|
||||
m_Items[i].Delete();
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
for ( int i = 0; i < m_Mobiles.Count; ++i )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)m_Mobiles[i];
|
||||
for (int i = 0; i < m_Items.Count; ++i)
|
||||
m_Items[i].Delete();
|
||||
|
||||
if ( bc.IsPrisoner == false )
|
||||
m_Mobiles[i].Delete();
|
||||
else if ( m_Mobiles[i].CantWalk == true )
|
||||
m_Mobiles[i].Delete();
|
||||
}
|
||||
for (int i = 0; i < m_Mobiles.Count; ++i)
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)m_Mobiles[i];
|
||||
|
||||
m_Items.Clear();
|
||||
m_Mobiles.Clear();
|
||||
}
|
||||
if (bc.IsPrisoner == false)
|
||||
m_Mobiles[i].Delete();
|
||||
else if (m_Mobiles[i].CantWalk)
|
||||
m_Mobiles[i].Delete();
|
||||
}
|
||||
|
||||
public BaseCamp( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
m_Items.Clear();
|
||||
m_Mobiles.Clear();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write( m_Items, true );
|
||||
writer.Write( m_Mobiles, true );
|
||||
writer.WriteDeltaTime( m_DecayTime );
|
||||
}
|
||||
writer.Write(m_Items, true);
|
||||
writer.Write(m_Mobiles, true);
|
||||
writer.WriteDeltaTime(m_DecayTime);
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Items = reader.ReadStrongItemList();
|
||||
m_Mobiles = reader.ReadStrongMobileList();
|
||||
m_DecayTime = reader.ReadDeltaTime();
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Items = reader.ReadStrongItemList();
|
||||
m_Mobiles = reader.ReadStrongMobileList();
|
||||
m_DecayTime = reader.ReadDeltaTime();
|
||||
|
||||
RefreshDecay( false );
|
||||
RefreshDecay(false);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class LockableBarrel : LockableContainer
|
||||
{
|
||||
[Constructible]
|
||||
public LockableBarrel() : base(0xE77)
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
public class LockableBarrel : LockableContainer
|
||||
{
|
||||
[Constructible]
|
||||
public LockableBarrel() : base(0xE77)
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public LockableBarrel(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
public LockableBarrel(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if (Weight == 8.0)
|
||||
Weight = 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Weight == 8.0)
|
||||
Weight = 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,192 +3,230 @@ using Server.Items;
|
|||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class BrigandCamp : BaseCamp
|
||||
{
|
||||
public virtual Mobile Brigands => new Brigand();
|
||||
public virtual Mobile Executioners => new Executioner();
|
||||
{
|
||||
public class BrigandCamp : BaseCamp
|
||||
{
|
||||
private Mobile m_Prisoner;
|
||||
|
||||
private Mobile m_Prisoner;
|
||||
|
||||
[Constructible]
|
||||
public BrigandCamp() : base( 0x10EE ) // dummy garbage at center
|
||||
{
|
||||
}
|
||||
[Constructible]
|
||||
public BrigandCamp() : base(0x10EE) // dummy garbage at center
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddComponents()
|
||||
{
|
||||
BaseCreature bc;
|
||||
//BaseEscortable be;
|
||||
public BrigandCamp(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
Visible = false;
|
||||
DecayDelay = TimeSpan.FromMinutes( 5.0 );
|
||||
public virtual Mobile Brigands => new Brigand();
|
||||
public virtual Mobile Executioners => new Executioner();
|
||||
|
||||
AddItem(new Static(0x10ee), 0, 0, 0);
|
||||
AddItem(new Static(0xfac), 0, 7, 0);
|
||||
|
||||
switch ( Utility.Random( 3 ) )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
AddItem( new Item( 0xDE3 ), 0, 7, 0 ); // Campfire
|
||||
AddItem( new Item( 0x974 ), 0, 7, 1 ); // Cauldron
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
AddItem( new Item( 0x1E95 ), 0, 7, 1 ); // Rabbit on a spit
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
AddItem( new Item( 0x1E94 ), 0, 7, 1 ); // Chicken on a spit
|
||||
break;
|
||||
}
|
||||
}
|
||||
public override void AddComponents()
|
||||
{
|
||||
BaseCreature bc;
|
||||
//BaseEscortable be;
|
||||
|
||||
AddCampChests();
|
||||
|
||||
for ( int i = 0; i < 4; i ++ )
|
||||
{
|
||||
AddMobile( Brigands, 6, Utility.RandomMinMax( -7, 7 ), Utility.RandomMinMax( -7, 7 ), 0 );
|
||||
}
|
||||
|
||||
switch ( Utility.Random( 2 ) )
|
||||
{
|
||||
case 0: m_Prisoner = new Noble(); break;
|
||||
default: m_Prisoner = new SeekerOfAdventure(); break;
|
||||
}
|
||||
|
||||
//be = (BaseEscortable)m_Prisoner;
|
||||
//be.m_Captive = true;
|
||||
|
||||
bc = (BaseCreature)m_Prisoner;
|
||||
bc.IsPrisoner = true;
|
||||
bc.CantWalk = true;
|
||||
|
||||
m_Prisoner.YellHue = Utility.RandomList( 0x57, 0x67, 0x77, 0x87, 0x117 );
|
||||
AddMobile( m_Prisoner, 2, Utility.RandomMinMax( -2, 2 ), Utility.RandomMinMax( -2, 2 ), 0 );
|
||||
}
|
||||
Visible = false;
|
||||
DecayDelay = TimeSpan.FromMinutes(5.0);
|
||||
|
||||
private void AddCampChests()
|
||||
{
|
||||
LockableContainer chest = null;
|
||||
AddItem(new Static(0x10ee), 0, 0, 0);
|
||||
AddItem(new Static(0xfac), 0, 7, 0);
|
||||
|
||||
switch (Utility.Random(3))
|
||||
{
|
||||
case 0: chest = new MetalChest(); break;
|
||||
case 1: chest = new MetalGoldenChest(); break;
|
||||
default: chest = new WoodenChest(); break;
|
||||
}
|
||||
switch (Utility.Random(3))
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
AddItem(new Item(0xDE3), 0, 7, 0); // Campfire
|
||||
AddItem(new Item(0x974), 0, 7, 1); // Cauldron
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
AddItem(new Item(0x1E95), 0, 7, 1); // Rabbit on a spit
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
AddItem(new Item(0x1E94), 0, 7, 1); // Chicken on a spit
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
chest.LiftOverride = true;
|
||||
AddCampChests();
|
||||
|
||||
TreasureMapChest.Fill(chest, 1);
|
||||
for (int i = 0; i < 4; i++) AddMobile(Brigands, 6, Utility.RandomMinMax(-7, 7), Utility.RandomMinMax(-7, 7), 0);
|
||||
|
||||
AddItem(chest, -2, -2, 0);
|
||||
switch (Utility.Random(2))
|
||||
{
|
||||
case 0:
|
||||
m_Prisoner = new Noble();
|
||||
break;
|
||||
default:
|
||||
m_Prisoner = new SeekerOfAdventure();
|
||||
break;
|
||||
}
|
||||
|
||||
LockableContainer crates = null;
|
||||
//be = (BaseEscortable)m_Prisoner;
|
||||
//be.m_Captive = true;
|
||||
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
case 0: crates = new SmallCrate(); break;
|
||||
case 1: crates = new MediumCrate(); break;
|
||||
case 2: crates = new LargeCrate(); break;
|
||||
default: crates = new LockableBarrel(); break;
|
||||
}
|
||||
bc = (BaseCreature)m_Prisoner;
|
||||
bc.IsPrisoner = true;
|
||||
bc.CantWalk = true;
|
||||
|
||||
crates.TrapType = TrapType.ExplosionTrap;
|
||||
crates.TrapPower = Utility.RandomMinMax(30, 40);
|
||||
crates.TrapLevel = 2;
|
||||
m_Prisoner.YellHue = Utility.RandomList(0x57, 0x67, 0x77, 0x87, 0x117);
|
||||
AddMobile(m_Prisoner, 2, Utility.RandomMinMax(-2, 2), Utility.RandomMinMax(-2, 2), 0);
|
||||
}
|
||||
|
||||
crates.RequiredSkill = 76;
|
||||
crates.LockLevel = 66;
|
||||
crates.MaxLockLevel = 116;
|
||||
crates.Locked = true;
|
||||
private void AddCampChests()
|
||||
{
|
||||
LockableContainer chest = null;
|
||||
|
||||
crates.DropItem(new Gold(Utility.RandomMinMax(100, 400)));
|
||||
crates.DropItem(new Arrow(10));
|
||||
crates.DropItem(new Bolt(10));
|
||||
switch (Utility.Random(3))
|
||||
{
|
||||
case 0:
|
||||
chest = new MetalChest();
|
||||
break;
|
||||
case 1:
|
||||
chest = new MetalGoldenChest();
|
||||
break;
|
||||
default:
|
||||
chest = new WoodenChest();
|
||||
break;
|
||||
}
|
||||
|
||||
crates.LiftOverride = true;
|
||||
chest.LiftOverride = true;
|
||||
|
||||
if (Utility.RandomDouble() < 0.8)
|
||||
{
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
case 0: crates.DropItem(new LesserCurePotion()); break;
|
||||
case 1: crates.DropItem(new LesserExplosionPotion()); break;
|
||||
case 2: crates.DropItem(new LesserHealPotion()); break;
|
||||
default: crates.DropItem(new LesserPoisonPotion()); break;
|
||||
}
|
||||
}
|
||||
TreasureMapChest.Fill(chest, 1);
|
||||
|
||||
AddItem(crates, 2, 2, 0);
|
||||
}
|
||||
AddItem(chest, -2, -2, 0);
|
||||
|
||||
// Don't refresh decay timer
|
||||
public override void OnEnter( Mobile m )
|
||||
{
|
||||
if ( m.Player && m_Prisoner != null && m_Prisoner.CantWalk )
|
||||
{
|
||||
int number;
|
||||
LockableContainer crates = null;
|
||||
|
||||
switch ( Utility.Random( 8 ) )
|
||||
{
|
||||
case 0: number = 502261; break; // HELP!
|
||||
case 1: number = 502262; break; // Help me!
|
||||
case 2: number = 502263; break; // Canst thou aid me?!
|
||||
case 3: number = 502264; break; // Help a poor prisoner!
|
||||
case 4: number = 502265; break; // Help! Please!
|
||||
case 5: number = 502266; break; // Aaah! Help me!
|
||||
case 6: number = 502267; break; // Go and get some help!
|
||||
default: number = 502268; break; // Quickly, I beg thee! Unlock my chains! If thou dost look at me close thou canst see them.
|
||||
}
|
||||
m_Prisoner.Yell( number );
|
||||
}
|
||||
}
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
case 0:
|
||||
crates = new SmallCrate();
|
||||
break;
|
||||
case 1:
|
||||
crates = new MediumCrate();
|
||||
break;
|
||||
case 2:
|
||||
crates = new LargeCrate();
|
||||
break;
|
||||
default:
|
||||
crates = new LockableBarrel();
|
||||
break;
|
||||
}
|
||||
|
||||
// Don't refresh decay timer
|
||||
public override void OnExit(Mobile m)
|
||||
{
|
||||
}
|
||||
crates.TrapType = TrapType.ExplosionTrap;
|
||||
crates.TrapPower = Utility.RandomMinMax(30, 40);
|
||||
crates.TrapLevel = 2;
|
||||
|
||||
public BrigandCamp( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddItem( Item item, int xOffset, int yOffset, int zOffset )
|
||||
{
|
||||
if ( item != null )
|
||||
item.Movable = false;
|
||||
|
||||
base.AddItem( item, xOffset, yOffset, zOffset );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
crates.RequiredSkill = 76;
|
||||
crates.LockLevel = 66;
|
||||
crates.MaxLockLevel = 116;
|
||||
crates.Locked = true;
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
crates.DropItem(new Gold(Utility.RandomMinMax(100, 400)));
|
||||
crates.DropItem(new Arrow(10));
|
||||
crates.DropItem(new Bolt(10));
|
||||
|
||||
writer.Write( m_Prisoner );
|
||||
}
|
||||
crates.LiftOverride = true;
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
if (Utility.RandomDouble() < 0.8)
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
case 0:
|
||||
crates.DropItem(new LesserCurePotion());
|
||||
break;
|
||||
case 1:
|
||||
crates.DropItem(new LesserExplosionPotion());
|
||||
break;
|
||||
case 2:
|
||||
crates.DropItem(new LesserHealPotion());
|
||||
break;
|
||||
default:
|
||||
crates.DropItem(new LesserPoisonPotion());
|
||||
break;
|
||||
}
|
||||
|
||||
int version = reader.ReadInt();
|
||||
AddItem(crates, 2, 2, 0);
|
||||
}
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Prisoner = reader.ReadMobile();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Don't refresh decay timer
|
||||
public override void OnEnter(Mobile m)
|
||||
{
|
||||
if (m.Player && m_Prisoner != null && m_Prisoner.CantWalk)
|
||||
{
|
||||
int number;
|
||||
|
||||
switch (Utility.Random(8))
|
||||
{
|
||||
case 0:
|
||||
number = 502261;
|
||||
break; // HELP!
|
||||
case 1:
|
||||
number = 502262;
|
||||
break; // Help me!
|
||||
case 2:
|
||||
number = 502263;
|
||||
break; // Canst thou aid me?!
|
||||
case 3:
|
||||
number = 502264;
|
||||
break; // Help a poor prisoner!
|
||||
case 4:
|
||||
number = 502265;
|
||||
break; // Help! Please!
|
||||
case 5:
|
||||
number = 502266;
|
||||
break; // Aaah! Help me!
|
||||
case 6:
|
||||
number = 502267;
|
||||
break; // Go and get some help!
|
||||
default:
|
||||
number = 502268;
|
||||
break; // Quickly, I beg thee! Unlock my chains! If thou dost look at me close thou canst see them.
|
||||
}
|
||||
|
||||
m_Prisoner.Yell(number);
|
||||
}
|
||||
}
|
||||
|
||||
// Don't refresh decay timer
|
||||
public override void OnExit(Mobile m)
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddItem(Item item, int xOffset, int yOffset, int zOffset)
|
||||
{
|
||||
if (item != null)
|
||||
item.Movable = false;
|
||||
|
||||
base.AddItem(item, xOffset, yOffset, zOffset);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write(m_Prisoner);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Prisoner = reader.ReadMobile();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,45 +3,45 @@ using Server.Mobiles;
|
|||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class HealerCamp : BaseCamp
|
||||
{
|
||||
[Constructible]
|
||||
public HealerCamp() : base( 0x1F4 )
|
||||
{
|
||||
}
|
||||
public class HealerCamp : BaseCamp
|
||||
{
|
||||
[Constructible]
|
||||
public HealerCamp() : base(0x1F4)
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddComponents()
|
||||
{
|
||||
BaseDoor west, east;
|
||||
public HealerCamp(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
AddItem( west = new LightWoodGate( DoorFacing.WestCW ), -4, 4, 7 );
|
||||
AddItem( east = new LightWoodGate( DoorFacing.EastCCW ), -3, 4, 7 );
|
||||
public override void AddComponents()
|
||||
{
|
||||
BaseDoor west, east;
|
||||
|
||||
west.Link = east;
|
||||
east.Link = west;
|
||||
AddItem(west = new LightWoodGate(DoorFacing.WestCW), -4, 4, 7);
|
||||
AddItem(east = new LightWoodGate(DoorFacing.EastCCW), -3, 4, 7);
|
||||
|
||||
AddItem( new Sign( SignType.Healer, SignFacing.West ), -5, 5, -4 );
|
||||
west.Link = east;
|
||||
east.Link = west;
|
||||
|
||||
AddMobile( new Healer(), 4, -4, 3, 7 );
|
||||
AddMobile( new Healer(), 5, 4, -2, 0 );
|
||||
}
|
||||
AddItem(new Sign(SignType.Healer, SignFacing.West), -5, 5, -4);
|
||||
|
||||
public HealerCamp( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
AddMobile(new Healer(), 4, -4, 3, 7);
|
||||
AddMobile(new Healer(), 5, 4, -2, 0);
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,191 +3,230 @@ using Server.Items;
|
|||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class LizardmenCamp : BaseCamp
|
||||
{
|
||||
public virtual Mobile Lizardmen => new Lizardman();
|
||||
{
|
||||
public class LizardmenCamp : BaseCamp
|
||||
{
|
||||
private Mobile m_Prisoner;
|
||||
|
||||
private Mobile m_Prisoner;
|
||||
|
||||
[Constructible]
|
||||
public LizardmenCamp() : base( 0x10EE ) // dummy garbage at center
|
||||
{
|
||||
}
|
||||
[Constructible]
|
||||
public LizardmenCamp() : base(0x10EE) // dummy garbage at center
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddComponents()
|
||||
{
|
||||
BaseCreature bc;
|
||||
//BaseEscortable be;
|
||||
public LizardmenCamp(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
Visible = false;
|
||||
DecayDelay = TimeSpan.FromMinutes( 5.0 );
|
||||
AddItem(new Static(0x10ee), 0, 0, 0);
|
||||
AddItem(new Static(0xfac), 0, 7, 0);
|
||||
public virtual Mobile Lizardmen => new Lizardman();
|
||||
|
||||
switch ( Utility.Random( 3 ) )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
AddItem( new Item( 0xDE3 ), 0, 7, 0 ); // Campfire
|
||||
AddItem( new Item( 0x974 ), 0, 7, 1); // Cauldron
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
AddItem( new Item( 0x1E95 ), 0, 7, 1); // Rabbit on a spit
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
AddItem( new Item( 0x1E94 ), 0, 7, 1); // Chicken on a spit
|
||||
break;
|
||||
}
|
||||
}
|
||||
AddItem(new Item(0x41F), 4, 4, 0); // Gruesome Standart South
|
||||
public override void AddComponents()
|
||||
{
|
||||
BaseCreature bc;
|
||||
//BaseEscortable be;
|
||||
|
||||
AddCampChests();
|
||||
Visible = false;
|
||||
DecayDelay = TimeSpan.FromMinutes(5.0);
|
||||
AddItem(new Static(0x10ee), 0, 0, 0);
|
||||
AddItem(new Static(0xfac), 0, 7, 0);
|
||||
|
||||
for ( int i = 0; i < 4; i ++ )
|
||||
{
|
||||
AddMobile( Lizardmen, 6, Utility.RandomMinMax( -7, 7 ), Utility.RandomMinMax( -7, 7 ), 0 );
|
||||
}
|
||||
|
||||
switch ( Utility.Random( 2 ) )
|
||||
{
|
||||
case 0: m_Prisoner = new Noble(); break;
|
||||
default: m_Prisoner = new SeekerOfAdventure(); break;
|
||||
}
|
||||
|
||||
//be = (BaseEscortable)m_Prisoner;
|
||||
//be.m_Captive = true;
|
||||
|
||||
bc = (BaseCreature)m_Prisoner;
|
||||
bc.IsPrisoner = true;
|
||||
bc.CantWalk = true;
|
||||
|
||||
m_Prisoner.YellHue = Utility.RandomList( 0x57, 0x67, 0x77, 0x87, 0x117 );
|
||||
AddMobile( m_Prisoner, 2, Utility.RandomMinMax( -2, 2 ), Utility.RandomMinMax( -2, 2 ), 0 );
|
||||
}
|
||||
switch (Utility.Random(3))
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
AddItem(new Item(0xDE3), 0, 7, 0); // Campfire
|
||||
AddItem(new Item(0x974), 0, 7, 1); // Cauldron
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
AddItem(new Item(0x1E95), 0, 7, 1); // Rabbit on a spit
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
AddItem(new Item(0x1E94), 0, 7, 1); // Chicken on a spit
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void AddCampChests()
|
||||
{
|
||||
LockableContainer chest = null;
|
||||
|
||||
switch ( Utility.Random( 3 ) )
|
||||
{
|
||||
case 0: chest = new MetalChest(); break;
|
||||
case 1: chest = new MetalGoldenChest(); break;
|
||||
default: chest = new WoodenChest(); break;
|
||||
}
|
||||
AddItem(new Item(0x41F), 4, 4, 0); // Gruesome Standart South
|
||||
|
||||
chest.LiftOverride = true;
|
||||
AddCampChests();
|
||||
|
||||
TreasureMapChest.Fill( chest, 1 );
|
||||
|
||||
AddItem( chest, 2, -2, 0 );
|
||||
|
||||
LockableContainer crates = null;
|
||||
for (int i = 0; i < 4; i++) AddMobile(Lizardmen, 6, Utility.RandomMinMax(-7, 7), Utility.RandomMinMax(-7, 7), 0);
|
||||
|
||||
switch ( Utility.Random( 4 ) )
|
||||
{
|
||||
case 0: crates = new SmallCrate(); break;
|
||||
case 1: crates = new MediumCrate(); break;
|
||||
case 2: crates = new LargeCrate(); break;
|
||||
default: crates = new LockableBarrel(); break;
|
||||
}
|
||||
|
||||
crates.TrapType = TrapType.ExplosionTrap;
|
||||
crates.TrapPower = Utility.RandomMinMax( 30, 40 );
|
||||
crates.TrapLevel = 2;
|
||||
|
||||
crates.RequiredSkill = 76;
|
||||
crates.LockLevel = 66;
|
||||
crates.MaxLockLevel = 116;
|
||||
crates.Locked = true;
|
||||
|
||||
crates.DropItem( new Gold( Utility.RandomMinMax( 100, 400 ) ) );
|
||||
crates.DropItem( new Arrow( 10 ) );
|
||||
crates.DropItem( new Bolt( 10 ) );
|
||||
switch (Utility.Random(2))
|
||||
{
|
||||
case 0:
|
||||
m_Prisoner = new Noble();
|
||||
break;
|
||||
default:
|
||||
m_Prisoner = new SeekerOfAdventure();
|
||||
break;
|
||||
}
|
||||
|
||||
crates.LiftOverride = true;
|
||||
|
||||
if ( Utility.RandomDouble() < 0.8 )
|
||||
{
|
||||
switch ( Utility.Random( 4 ) )
|
||||
{
|
||||
case 0: crates.DropItem( new LesserCurePotion() ); break;
|
||||
case 1: crates.DropItem( new LesserExplosionPotion() ); break;
|
||||
case 2: crates.DropItem( new LesserHealPotion() ); break;
|
||||
default: crates.DropItem(new LesserPoisonPotion()); break;
|
||||
}
|
||||
}
|
||||
|
||||
AddItem( crates, -2, 2, 0 );
|
||||
}
|
||||
//be = (BaseEscortable)m_Prisoner;
|
||||
//be.m_Captive = true;
|
||||
|
||||
// Don't refresh decay timer
|
||||
public override void OnEnter(Mobile m)
|
||||
{
|
||||
if ( m.Player && m_Prisoner != null && m_Prisoner.CantWalk )
|
||||
{
|
||||
int number;
|
||||
bc = (BaseCreature)m_Prisoner;
|
||||
bc.IsPrisoner = true;
|
||||
bc.CantWalk = true;
|
||||
|
||||
switch ( Utility.Random( 8 ) )
|
||||
{
|
||||
case 0: number = 502261; break; // HELP!
|
||||
case 1: number = 502262; break; // Help me!
|
||||
case 2: number = 502263; break; // Canst thou aid me?!
|
||||
case 3: number = 502264; break; // Help a poor prisoner!
|
||||
case 4: number = 502265; break; // Help! Please!
|
||||
case 5: number = 502266; break; // Aaah! Help me!
|
||||
case 6: number = 502267; break; // Go and get some help!
|
||||
default: number = 502268; break; // Quickly, I beg thee! Unlock my chains! If thou dost look at me close thou canst see them.
|
||||
}
|
||||
m_Prisoner.Yell( number );
|
||||
}
|
||||
}
|
||||
m_Prisoner.YellHue = Utility.RandomList(0x57, 0x67, 0x77, 0x87, 0x117);
|
||||
AddMobile(m_Prisoner, 2, Utility.RandomMinMax(-2, 2), Utility.RandomMinMax(-2, 2), 0);
|
||||
}
|
||||
|
||||
// Don't refresh decay timer
|
||||
public override void OnExit(Mobile m)
|
||||
{
|
||||
}
|
||||
private void AddCampChests()
|
||||
{
|
||||
LockableContainer chest = null;
|
||||
|
||||
public LizardmenCamp( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddItem( Item item, int xOffset, int yOffset, int zOffset )
|
||||
{
|
||||
if ( item != null )
|
||||
item.Movable = false;
|
||||
|
||||
base.AddItem( item, xOffset, yOffset, zOffset );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
switch (Utility.Random(3))
|
||||
{
|
||||
case 0:
|
||||
chest = new MetalChest();
|
||||
break;
|
||||
case 1:
|
||||
chest = new MetalGoldenChest();
|
||||
break;
|
||||
default:
|
||||
chest = new WoodenChest();
|
||||
break;
|
||||
}
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
chest.LiftOverride = true;
|
||||
|
||||
writer.Write( m_Prisoner );
|
||||
}
|
||||
TreasureMapChest.Fill(chest, 1);
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
AddItem(chest, 2, -2, 0);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
LockableContainer crates = null;
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Prisoner = reader.ReadMobile();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
case 0:
|
||||
crates = new SmallCrate();
|
||||
break;
|
||||
case 1:
|
||||
crates = new MediumCrate();
|
||||
break;
|
||||
case 2:
|
||||
crates = new LargeCrate();
|
||||
break;
|
||||
default:
|
||||
crates = new LockableBarrel();
|
||||
break;
|
||||
}
|
||||
|
||||
crates.TrapType = TrapType.ExplosionTrap;
|
||||
crates.TrapPower = Utility.RandomMinMax(30, 40);
|
||||
crates.TrapLevel = 2;
|
||||
|
||||
crates.RequiredSkill = 76;
|
||||
crates.LockLevel = 66;
|
||||
crates.MaxLockLevel = 116;
|
||||
crates.Locked = true;
|
||||
|
||||
crates.DropItem(new Gold(Utility.RandomMinMax(100, 400)));
|
||||
crates.DropItem(new Arrow(10));
|
||||
crates.DropItem(new Bolt(10));
|
||||
|
||||
crates.LiftOverride = true;
|
||||
|
||||
if (Utility.RandomDouble() < 0.8)
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
case 0:
|
||||
crates.DropItem(new LesserCurePotion());
|
||||
break;
|
||||
case 1:
|
||||
crates.DropItem(new LesserExplosionPotion());
|
||||
break;
|
||||
case 2:
|
||||
crates.DropItem(new LesserHealPotion());
|
||||
break;
|
||||
default:
|
||||
crates.DropItem(new LesserPoisonPotion());
|
||||
break;
|
||||
}
|
||||
|
||||
AddItem(crates, -2, 2, 0);
|
||||
}
|
||||
|
||||
// Don't refresh decay timer
|
||||
public override void OnEnter(Mobile m)
|
||||
{
|
||||
if (m.Player && m_Prisoner != null && m_Prisoner.CantWalk)
|
||||
{
|
||||
int number;
|
||||
|
||||
switch (Utility.Random(8))
|
||||
{
|
||||
case 0:
|
||||
number = 502261;
|
||||
break; // HELP!
|
||||
case 1:
|
||||
number = 502262;
|
||||
break; // Help me!
|
||||
case 2:
|
||||
number = 502263;
|
||||
break; // Canst thou aid me?!
|
||||
case 3:
|
||||
number = 502264;
|
||||
break; // Help a poor prisoner!
|
||||
case 4:
|
||||
number = 502265;
|
||||
break; // Help! Please!
|
||||
case 5:
|
||||
number = 502266;
|
||||
break; // Aaah! Help me!
|
||||
case 6:
|
||||
number = 502267;
|
||||
break; // Go and get some help!
|
||||
default:
|
||||
number = 502268;
|
||||
break; // Quickly, I beg thee! Unlock my chains! If thou dost look at me close thou canst see them.
|
||||
}
|
||||
|
||||
m_Prisoner.Yell(number);
|
||||
}
|
||||
}
|
||||
|
||||
// Don't refresh decay timer
|
||||
public override void OnExit(Mobile m)
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddItem(Item item, int xOffset, int yOffset, int zOffset)
|
||||
{
|
||||
if (item != null)
|
||||
item.Movable = false;
|
||||
|
||||
base.AddItem(item, xOffset, yOffset, zOffset);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write(m_Prisoner);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Prisoner = reader.ReadMobile();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,45 +3,45 @@ using Server.Mobiles;
|
|||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class MageCamp : BaseCamp
|
||||
{
|
||||
[Constructible]
|
||||
public MageCamp() : base( 0x1F5 )
|
||||
{
|
||||
}
|
||||
public class MageCamp : BaseCamp
|
||||
{
|
||||
[Constructible]
|
||||
public MageCamp() : base(0x1F5)
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddComponents()
|
||||
{
|
||||
BaseDoor west, east;
|
||||
public MageCamp(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
AddItem( west = new LightWoodGate( DoorFacing.WestCW ), -4, 4, 7 );
|
||||
AddItem( east = new LightWoodGate( DoorFacing.EastCCW ), -3, 4, 7 );
|
||||
public override void AddComponents()
|
||||
{
|
||||
BaseDoor west, east;
|
||||
|
||||
west.Link = east;
|
||||
east.Link = west;
|
||||
AddItem(west = new LightWoodGate(DoorFacing.WestCW), -4, 4, 7);
|
||||
AddItem(east = new LightWoodGate(DoorFacing.EastCCW), -3, 4, 7);
|
||||
|
||||
AddItem( new Sign( SignType.Mage, SignFacing.West ), -5, 5, -4 );
|
||||
west.Link = east;
|
||||
east.Link = west;
|
||||
|
||||
AddMobile( new Mage(), 4, -4, 3, 7 );
|
||||
AddMobile( new Mage(), 5, 4, -2, 0 );
|
||||
}
|
||||
AddItem(new Sign(SignType.Mage, SignFacing.West), -5, 5, -4);
|
||||
|
||||
public MageCamp( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
AddMobile(new Mage(), 4, -4, 3, 7);
|
||||
AddMobile(new Mage(), 5, 4, -2, 0);
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,197 +4,236 @@ using Server.Mobiles;
|
|||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class OrcCamp : BaseCamp
|
||||
{
|
||||
public virtual Mobile Orcs => new Orc();
|
||||
public class OrcCamp : BaseCamp
|
||||
{
|
||||
private Mobile m_Prisoner;
|
||||
|
||||
private Mobile m_Prisoner;
|
||||
|
||||
[Constructible]
|
||||
public OrcCamp() : base( 0x10EE ) // dummy garbage at center
|
||||
{
|
||||
}
|
||||
[Constructible]
|
||||
public OrcCamp() : base(0x10EE) // dummy garbage at center
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddComponents()
|
||||
{
|
||||
BaseCreature bc;
|
||||
//BaseEscortable be;
|
||||
public OrcCamp(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
Visible = false;
|
||||
DecayDelay = TimeSpan.FromMinutes(5.0);
|
||||
AddItem(new Static(0x10ee), 0, 0, 0);
|
||||
AddItem(new Static(0xfac), 0, 7, 0);
|
||||
|
||||
switch ( Utility.Random( 3 ) )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
AddItem( new Item( 0xDE3 ), 0, 7, 0 ); // Campfire
|
||||
AddItem( new Item( 0x974 ), 0, 7, 1 ); // Cauldron
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
AddItem( new Item( 0x1E95 ), 0, 7, 1 ); // Rabbit on a spit
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
AddItem( new Item( 0x1E94 ), 0, 7, 1 ); // Chicken on a spit
|
||||
break;
|
||||
}
|
||||
}
|
||||
AddItem(new Item(0x428), -5, -4, 0); // Gruesome Standart West
|
||||
public virtual Mobile Orcs => new Orc();
|
||||
|
||||
AddCampChests();
|
||||
|
||||
for ( int i = 0; i < 3; i ++ )
|
||||
{
|
||||
AddMobile( Orcs, 6, Utility.RandomMinMax( -7, 7 ), Utility.RandomMinMax( -7, 7 ), 0 );
|
||||
}
|
||||
AddMobile( new OrcCaptain(), 2, Utility.RandomMinMax( -7, 7 ), Utility.RandomMinMax( -7, 7 ), 0 );
|
||||
|
||||
switch ( Utility.Random( 2 ) )
|
||||
{
|
||||
case 0: m_Prisoner = new Noble(); break;
|
||||
default: m_Prisoner = new SeekerOfAdventure(); break;
|
||||
}
|
||||
|
||||
//be = (BaseEscortable)m_Prisoner;
|
||||
//be.m_Captive = true;
|
||||
|
||||
bc = (BaseCreature)m_Prisoner;
|
||||
bc.IsPrisoner = true;
|
||||
bc.CantWalk = true;
|
||||
|
||||
m_Prisoner.YellHue = Utility.RandomList( 0x57, 0x67, 0x77, 0x87, 0x117 );
|
||||
AddMobile( m_Prisoner, 2, Utility.RandomMinMax( -2, 2 ), Utility.RandomMinMax( -2, 2 ), 0 );
|
||||
}
|
||||
public override void AddComponents()
|
||||
{
|
||||
BaseCreature bc;
|
||||
//BaseEscortable be;
|
||||
|
||||
private void AddCampChests()
|
||||
{
|
||||
LockableContainer chest = null;
|
||||
Visible = false;
|
||||
DecayDelay = TimeSpan.FromMinutes(5.0);
|
||||
AddItem(new Static(0x10ee), 0, 0, 0);
|
||||
AddItem(new Static(0xfac), 0, 7, 0);
|
||||
|
||||
switch (Utility.Random(3))
|
||||
{
|
||||
case 0: chest = new MetalChest(); break;
|
||||
case 1: chest = new MetalGoldenChest(); break;
|
||||
default: chest = new WoodenChest(); break;
|
||||
}
|
||||
switch (Utility.Random(3))
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
AddItem(new Item(0xDE3), 0, 7, 0); // Campfire
|
||||
AddItem(new Item(0x974), 0, 7, 1); // Cauldron
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
AddItem(new Item(0x1E95), 0, 7, 1); // Rabbit on a spit
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
AddItem(new Item(0x1E94), 0, 7, 1); // Chicken on a spit
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
chest.LiftOverride = true;
|
||||
AddItem(new Item(0x428), -5, -4, 0); // Gruesome Standart West
|
||||
|
||||
TreasureMapChest.Fill(chest, 1);
|
||||
AddCampChests();
|
||||
|
||||
AddItem(chest, -2, 2, 0);
|
||||
for (int i = 0; i < 3; i++) AddMobile(Orcs, 6, Utility.RandomMinMax(-7, 7), Utility.RandomMinMax(-7, 7), 0);
|
||||
AddMobile(new OrcCaptain(), 2, Utility.RandomMinMax(-7, 7), Utility.RandomMinMax(-7, 7), 0);
|
||||
|
||||
LockableContainer crates = null;
|
||||
switch (Utility.Random(2))
|
||||
{
|
||||
case 0:
|
||||
m_Prisoner = new Noble();
|
||||
break;
|
||||
default:
|
||||
m_Prisoner = new SeekerOfAdventure();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
case 0: crates = new SmallCrate(); break;
|
||||
case 1: crates = new MediumCrate(); break;
|
||||
case 2: crates = new LargeCrate(); break;
|
||||
default: crates = new LockableBarrel(); break;
|
||||
}
|
||||
//be = (BaseEscortable)m_Prisoner;
|
||||
//be.m_Captive = true;
|
||||
|
||||
crates.TrapType = TrapType.ExplosionTrap;
|
||||
crates.TrapPower = Utility.RandomMinMax(30, 40);
|
||||
crates.TrapLevel = 2;
|
||||
bc = (BaseCreature)m_Prisoner;
|
||||
bc.IsPrisoner = true;
|
||||
bc.CantWalk = true;
|
||||
|
||||
crates.RequiredSkill = 76;
|
||||
crates.LockLevel = 66;
|
||||
crates.MaxLockLevel = 116;
|
||||
crates.Locked = true;
|
||||
m_Prisoner.YellHue = Utility.RandomList(0x57, 0x67, 0x77, 0x87, 0x117);
|
||||
AddMobile(m_Prisoner, 2, Utility.RandomMinMax(-2, 2), Utility.RandomMinMax(-2, 2), 0);
|
||||
}
|
||||
|
||||
crates.DropItem(new Gold(Utility.RandomMinMax(100, 400)));
|
||||
crates.DropItem(new Arrow(10));
|
||||
crates.DropItem(new Bolt(10));
|
||||
private void AddCampChests()
|
||||
{
|
||||
LockableContainer chest = null;
|
||||
|
||||
crates.LiftOverride = true;
|
||||
switch (Utility.Random(3))
|
||||
{
|
||||
case 0:
|
||||
chest = new MetalChest();
|
||||
break;
|
||||
case 1:
|
||||
chest = new MetalGoldenChest();
|
||||
break;
|
||||
default:
|
||||
chest = new WoodenChest();
|
||||
break;
|
||||
}
|
||||
|
||||
if (Utility.RandomDouble() < 0.8)
|
||||
{
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
case 0: crates.DropItem(new LesserCurePotion()); break;
|
||||
case 1: crates.DropItem(new LesserExplosionPotion()); break;
|
||||
case 2: crates.DropItem(new LesserHealPotion()); break;
|
||||
default: crates.DropItem(new LesserPoisonPotion()); break;
|
||||
}
|
||||
}
|
||||
chest.LiftOverride = true;
|
||||
|
||||
AddItem(crates, 2, -2, 0);
|
||||
}
|
||||
TreasureMapChest.Fill(chest, 1);
|
||||
|
||||
// Don't refresh decay timer
|
||||
public override void OnEnter(Mobile m)
|
||||
{
|
||||
if ( m.Player && m_Prisoner != null && m_Prisoner.CantWalk )
|
||||
{
|
||||
int number;
|
||||
AddItem(chest, -2, 2, 0);
|
||||
|
||||
switch ( Utility.Random( 8 ) )
|
||||
{
|
||||
case 0: number = 502261; break; // HELP!
|
||||
case 1: number = 502262; break; // Help me!
|
||||
case 2: number = 502263; break; // Canst thou aid me?!
|
||||
case 3: number = 502264; break; // Help a poor prisoner!
|
||||
case 4: number = 502265; break; // Help! Please!
|
||||
case 5: number = 502266; break; // Aaah! Help me!
|
||||
case 6: number = 502267; break; // Go and get some help!
|
||||
default: number = 502268; break; // Quickly, I beg thee! Unlock my chains! If thou dost look at me close thou canst see them.
|
||||
}
|
||||
m_Prisoner.Yell( number );
|
||||
}
|
||||
}
|
||||
LockableContainer crates = null;
|
||||
|
||||
// Don't refresh decay timer
|
||||
public override void OnExit(Mobile m)
|
||||
{
|
||||
}
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
case 0:
|
||||
crates = new SmallCrate();
|
||||
break;
|
||||
case 1:
|
||||
crates = new MediumCrate();
|
||||
break;
|
||||
case 2:
|
||||
crates = new LargeCrate();
|
||||
break;
|
||||
default:
|
||||
crates = new LockableBarrel();
|
||||
break;
|
||||
}
|
||||
|
||||
public OrcCamp( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddItem( Item item, int xOffset, int yOffset, int zOffset )
|
||||
{
|
||||
if ( item != null )
|
||||
item.Movable = false;
|
||||
|
||||
base.AddItem( item, xOffset, yOffset, zOffset );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
crates.TrapType = TrapType.ExplosionTrap;
|
||||
crates.TrapPower = Utility.RandomMinMax(30, 40);
|
||||
crates.TrapLevel = 2;
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
crates.RequiredSkill = 76;
|
||||
crates.LockLevel = 66;
|
||||
crates.MaxLockLevel = 116;
|
||||
crates.Locked = true;
|
||||
|
||||
writer.Write( m_Prisoner );
|
||||
}
|
||||
crates.DropItem(new Gold(Utility.RandomMinMax(100, 400)));
|
||||
crates.DropItem(new Arrow(10));
|
||||
crates.DropItem(new Bolt(10));
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
crates.LiftOverride = true;
|
||||
|
||||
int version = reader.ReadInt();
|
||||
if (Utility.RandomDouble() < 0.8)
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
case 0:
|
||||
crates.DropItem(new LesserCurePotion());
|
||||
break;
|
||||
case 1:
|
||||
crates.DropItem(new LesserExplosionPotion());
|
||||
break;
|
||||
case 2:
|
||||
crates.DropItem(new LesserHealPotion());
|
||||
break;
|
||||
default:
|
||||
crates.DropItem(new LesserPoisonPotion());
|
||||
break;
|
||||
}
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Prisoner = reader.ReadMobile();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Prisoner = reader.ReadMobile();
|
||||
reader.ReadItem();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
AddItem(crates, 2, -2, 0);
|
||||
}
|
||||
|
||||
// Don't refresh decay timer
|
||||
public override void OnEnter(Mobile m)
|
||||
{
|
||||
if (m.Player && m_Prisoner != null && m_Prisoner.CantWalk)
|
||||
{
|
||||
int number;
|
||||
|
||||
switch (Utility.Random(8))
|
||||
{
|
||||
case 0:
|
||||
number = 502261;
|
||||
break; // HELP!
|
||||
case 1:
|
||||
number = 502262;
|
||||
break; // Help me!
|
||||
case 2:
|
||||
number = 502263;
|
||||
break; // Canst thou aid me?!
|
||||
case 3:
|
||||
number = 502264;
|
||||
break; // Help a poor prisoner!
|
||||
case 4:
|
||||
number = 502265;
|
||||
break; // Help! Please!
|
||||
case 5:
|
||||
number = 502266;
|
||||
break; // Aaah! Help me!
|
||||
case 6:
|
||||
number = 502267;
|
||||
break; // Go and get some help!
|
||||
default:
|
||||
number = 502268;
|
||||
break; // Quickly, I beg thee! Unlock my chains! If thou dost look at me close thou canst see them.
|
||||
}
|
||||
|
||||
m_Prisoner.Yell(number);
|
||||
}
|
||||
}
|
||||
|
||||
// Don't refresh decay timer
|
||||
public override void OnExit(Mobile m)
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddItem(Item item, int xOffset, int yOffset, int zOffset)
|
||||
{
|
||||
if (item != null)
|
||||
item.Movable = false;
|
||||
|
||||
base.AddItem(item, xOffset, yOffset, zOffset);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(1); // version
|
||||
|
||||
writer.Write(m_Prisoner);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Prisoner = reader.ReadMobile();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Prisoner = reader.ReadMobile();
|
||||
reader.ReadItem();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,196 +4,235 @@ using Server.Mobiles;
|
|||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class RatCamp : BaseCamp
|
||||
{
|
||||
public virtual Mobile Ratmen => new Ratman();
|
||||
public class RatCamp : BaseCamp
|
||||
{
|
||||
private Mobile m_Prisoner;
|
||||
|
||||
private Mobile m_Prisoner;
|
||||
|
||||
[Constructible]
|
||||
public RatCamp() : base( 0x10EE ) // dummy garbage at center
|
||||
{
|
||||
}
|
||||
[Constructible]
|
||||
public RatCamp() : base(0x10EE) // dummy garbage at center
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddComponents()
|
||||
{
|
||||
BaseCreature bc;
|
||||
//BaseEscortable be;
|
||||
public RatCamp(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
Visible = false;
|
||||
DecayDelay = TimeSpan.FromMinutes(5.0);
|
||||
AddItem(new Static(0x10ee), 0, 0, 0);
|
||||
AddItem(new Static(0xfac), 0, 6, 0);
|
||||
|
||||
switch ( Utility.Random( 3 ) )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
AddItem( new Item( 0xDE3 ), 0, 6, 0 ); // Campfire
|
||||
AddItem( new Item( 0x974 ), 0, 6, 1 ); // Cauldron
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
AddItem( new Item( 0x1E95 ), 0, 6, 1 ); // Rabbit on a spit
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
AddItem( new Item( 0x1E94 ), 0, 6, 1 ); // Chicken on a spit
|
||||
break;
|
||||
}
|
||||
}
|
||||
AddItem(new Item(0x41F), 5, 5, 0); // Gruesome Standart South
|
||||
public virtual Mobile Ratmen => new Ratman();
|
||||
|
||||
AddCampChests();
|
||||
|
||||
for ( int i = 0; i < 4; i ++ )
|
||||
{
|
||||
AddMobile( Ratmen, 6, Utility.RandomMinMax( -7, 7 ), Utility.RandomMinMax( -7, 7 ), 0 );
|
||||
}
|
||||
|
||||
switch ( Utility.Random( 2 ) )
|
||||
{
|
||||
case 0: m_Prisoner = new Noble(); break;
|
||||
default: m_Prisoner = new SeekerOfAdventure(); break;
|
||||
}
|
||||
|
||||
//be = (BaseEscortable)m_Prisoner;
|
||||
//be.m_Captive = true;
|
||||
|
||||
bc = (BaseCreature)m_Prisoner;
|
||||
bc.IsPrisoner = true;
|
||||
bc.CantWalk = true;
|
||||
|
||||
m_Prisoner.YellHue = Utility.RandomList( 0x57, 0x67, 0x77, 0x87, 0x117 );
|
||||
AddMobile( m_Prisoner, 2, Utility.RandomMinMax( -2, 2 ), Utility.RandomMinMax( -2, 2 ), 0 );
|
||||
}
|
||||
public override void AddComponents()
|
||||
{
|
||||
BaseCreature bc;
|
||||
//BaseEscortable be;
|
||||
|
||||
private void AddCampChests()
|
||||
{
|
||||
LockableContainer chest = null;
|
||||
Visible = false;
|
||||
DecayDelay = TimeSpan.FromMinutes(5.0);
|
||||
AddItem(new Static(0x10ee), 0, 0, 0);
|
||||
AddItem(new Static(0xfac), 0, 6, 0);
|
||||
|
||||
switch (Utility.Random(3))
|
||||
{
|
||||
case 0: chest = new MetalChest(); break;
|
||||
case 1: chest = new MetalGoldenChest(); break;
|
||||
default: chest = new WoodenChest(); break;
|
||||
}
|
||||
switch (Utility.Random(3))
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
AddItem(new Item(0xDE3), 0, 6, 0); // Campfire
|
||||
AddItem(new Item(0x974), 0, 6, 1); // Cauldron
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
AddItem(new Item(0x1E95), 0, 6, 1); // Rabbit on a spit
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
AddItem(new Item(0x1E94), 0, 6, 1); // Chicken on a spit
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
chest.LiftOverride = true;
|
||||
AddItem(new Item(0x41F), 5, 5, 0); // Gruesome Standart South
|
||||
|
||||
TreasureMapChest.Fill(chest, 1);
|
||||
AddCampChests();
|
||||
|
||||
AddItem(chest, -2, -2, 0);
|
||||
for (int i = 0; i < 4; i++) AddMobile(Ratmen, 6, Utility.RandomMinMax(-7, 7), Utility.RandomMinMax(-7, 7), 0);
|
||||
|
||||
LockableContainer crates = null;
|
||||
switch (Utility.Random(2))
|
||||
{
|
||||
case 0:
|
||||
m_Prisoner = new Noble();
|
||||
break;
|
||||
default:
|
||||
m_Prisoner = new SeekerOfAdventure();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
case 0: crates = new SmallCrate(); break;
|
||||
case 1: crates = new MediumCrate(); break;
|
||||
case 2: crates = new LargeCrate(); break;
|
||||
default: crates = new LockableBarrel(); break;
|
||||
}
|
||||
//be = (BaseEscortable)m_Prisoner;
|
||||
//be.m_Captive = true;
|
||||
|
||||
crates.TrapType = TrapType.ExplosionTrap;
|
||||
crates.TrapPower = Utility.RandomMinMax(30, 40);
|
||||
crates.TrapLevel = 2;
|
||||
bc = (BaseCreature)m_Prisoner;
|
||||
bc.IsPrisoner = true;
|
||||
bc.CantWalk = true;
|
||||
|
||||
crates.RequiredSkill = 76;
|
||||
crates.LockLevel = 66;
|
||||
crates.MaxLockLevel = 116;
|
||||
crates.Locked = true;
|
||||
m_Prisoner.YellHue = Utility.RandomList(0x57, 0x67, 0x77, 0x87, 0x117);
|
||||
AddMobile(m_Prisoner, 2, Utility.RandomMinMax(-2, 2), Utility.RandomMinMax(-2, 2), 0);
|
||||
}
|
||||
|
||||
crates.DropItem(new Gold(Utility.RandomMinMax(100, 400)));
|
||||
crates.DropItem(new Arrow(10));
|
||||
crates.DropItem(new Bolt(10));
|
||||
private void AddCampChests()
|
||||
{
|
||||
LockableContainer chest = null;
|
||||
|
||||
crates.LiftOverride = true;
|
||||
switch (Utility.Random(3))
|
||||
{
|
||||
case 0:
|
||||
chest = new MetalChest();
|
||||
break;
|
||||
case 1:
|
||||
chest = new MetalGoldenChest();
|
||||
break;
|
||||
default:
|
||||
chest = new WoodenChest();
|
||||
break;
|
||||
}
|
||||
|
||||
if (Utility.RandomDouble() < 0.8)
|
||||
{
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
case 0: crates.DropItem(new LesserCurePotion()); break;
|
||||
case 1: crates.DropItem(new LesserExplosionPotion()); break;
|
||||
case 2: crates.DropItem(new LesserHealPotion()); break;
|
||||
default: crates.DropItem(new LesserPoisonPotion()); break;
|
||||
}
|
||||
}
|
||||
chest.LiftOverride = true;
|
||||
|
||||
AddItem(crates, 2, 2, 0);
|
||||
}
|
||||
TreasureMapChest.Fill(chest, 1);
|
||||
|
||||
// Don't refresh decay timer
|
||||
public override void OnEnter(Mobile m)
|
||||
{
|
||||
if ( m.Player && m_Prisoner != null && m_Prisoner.CantWalk )
|
||||
{
|
||||
int number;
|
||||
AddItem(chest, -2, -2, 0);
|
||||
|
||||
switch ( Utility.Random( 8 ) )
|
||||
{
|
||||
case 0: number = 502261; break; // HELP!
|
||||
case 1: number = 502262; break; // Help me!
|
||||
case 2: number = 502263; break; // Canst thou aid me?!
|
||||
case 3: number = 502264; break; // Help a poor prisoner!
|
||||
case 4: number = 502265; break; // Help! Please!
|
||||
case 5: number = 502266; break; // Aaah! Help me!
|
||||
case 6: number = 502267; break; // Go and get some help!
|
||||
default: number = 502268; break; // Quickly, I beg thee! Unlock my chains! If thou dost look at me close thou canst see them.
|
||||
}
|
||||
m_Prisoner.Yell( number );
|
||||
}
|
||||
}
|
||||
LockableContainer crates = null;
|
||||
|
||||
// Don't refresh decay timer
|
||||
public override void OnExit(Mobile m)
|
||||
{
|
||||
}
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
case 0:
|
||||
crates = new SmallCrate();
|
||||
break;
|
||||
case 1:
|
||||
crates = new MediumCrate();
|
||||
break;
|
||||
case 2:
|
||||
crates = new LargeCrate();
|
||||
break;
|
||||
default:
|
||||
crates = new LockableBarrel();
|
||||
break;
|
||||
}
|
||||
|
||||
public RatCamp( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddItem( Item item, int xOffset, int yOffset, int zOffset )
|
||||
{
|
||||
if ( item != null )
|
||||
item.Movable = false;
|
||||
|
||||
base.AddItem( item, xOffset, yOffset, zOffset );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
crates.TrapType = TrapType.ExplosionTrap;
|
||||
crates.TrapPower = Utility.RandomMinMax(30, 40);
|
||||
crates.TrapLevel = 2;
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
crates.RequiredSkill = 76;
|
||||
crates.LockLevel = 66;
|
||||
crates.MaxLockLevel = 116;
|
||||
crates.Locked = true;
|
||||
|
||||
writer.Write( m_Prisoner );
|
||||
}
|
||||
crates.DropItem(new Gold(Utility.RandomMinMax(100, 400)));
|
||||
crates.DropItem(new Arrow(10));
|
||||
crates.DropItem(new Bolt(10));
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
crates.LiftOverride = true;
|
||||
|
||||
int version = reader.ReadInt();
|
||||
if (Utility.RandomDouble() < 0.8)
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
case 0:
|
||||
crates.DropItem(new LesserCurePotion());
|
||||
break;
|
||||
case 1:
|
||||
crates.DropItem(new LesserExplosionPotion());
|
||||
break;
|
||||
case 2:
|
||||
crates.DropItem(new LesserHealPotion());
|
||||
break;
|
||||
default:
|
||||
crates.DropItem(new LesserPoisonPotion());
|
||||
break;
|
||||
}
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Prisoner = reader.ReadMobile();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Prisoner = reader.ReadMobile();
|
||||
reader.ReadItem();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
AddItem(crates, 2, 2, 0);
|
||||
}
|
||||
|
||||
// Don't refresh decay timer
|
||||
public override void OnEnter(Mobile m)
|
||||
{
|
||||
if (m.Player && m_Prisoner != null && m_Prisoner.CantWalk)
|
||||
{
|
||||
int number;
|
||||
|
||||
switch (Utility.Random(8))
|
||||
{
|
||||
case 0:
|
||||
number = 502261;
|
||||
break; // HELP!
|
||||
case 1:
|
||||
number = 502262;
|
||||
break; // Help me!
|
||||
case 2:
|
||||
number = 502263;
|
||||
break; // Canst thou aid me?!
|
||||
case 3:
|
||||
number = 502264;
|
||||
break; // Help a poor prisoner!
|
||||
case 4:
|
||||
number = 502265;
|
||||
break; // Help! Please!
|
||||
case 5:
|
||||
number = 502266;
|
||||
break; // Aaah! Help me!
|
||||
case 6:
|
||||
number = 502267;
|
||||
break; // Go and get some help!
|
||||
default:
|
||||
number = 502268;
|
||||
break; // Quickly, I beg thee! Unlock my chains! If thou dost look at me close thou canst see them.
|
||||
}
|
||||
|
||||
m_Prisoner.Yell(number);
|
||||
}
|
||||
}
|
||||
|
||||
// Don't refresh decay timer
|
||||
public override void OnExit(Mobile m)
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddItem(Item item, int xOffset, int yOffset, int zOffset)
|
||||
{
|
||||
if (item != null)
|
||||
item.Movable = false;
|
||||
|
||||
base.AddItem(item, xOffset, yOffset, zOffset);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(1); // version
|
||||
|
||||
writer.Write(m_Prisoner);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Prisoner = reader.ReadMobile();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Prisoner = reader.ReadMobile();
|
||||
reader.ReadItem();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,242 +3,247 @@ using System.IO;
|
|||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class ComponentVerification
|
||||
{
|
||||
private int[] m_ItemTable;
|
||||
private int[] m_MultiTable;
|
||||
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;
|
||||
public ComponentVerification()
|
||||
{
|
||||
m_ItemTable = CreateTable(TileData.MaxItemValue);
|
||||
m_MultiTable = CreateTable(0x4000);
|
||||
|
||||
return CheckValidity( m_ItemTable[itemID] );
|
||||
}
|
||||
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");
|
||||
|
||||
public bool IsMultiValid( int multiID )
|
||||
{
|
||||
if ( multiID <= 0 || multiID >= m_MultiTable.Length )
|
||||
return false;
|
||||
LoadMultis("Data/Components/stairs.txt", "MultiNorth", "MultiEast", "MultiSouth", "MultiWest");
|
||||
}
|
||||
|
||||
return CheckValidity( m_MultiTable[multiID] );
|
||||
}
|
||||
public bool IsItemValid(int itemID)
|
||||
{
|
||||
if (itemID <= 0 || itemID >= m_ItemTable.Length)
|
||||
return false;
|
||||
|
||||
public bool CheckValidity( int val )
|
||||
{
|
||||
if ( val == -1 )
|
||||
return false;
|
||||
return CheckValidity(m_ItemTable[itemID]);
|
||||
}
|
||||
|
||||
return ( val == 0 || ((int)ExpansionInfo.CoreExpansion.CustomHousingFlag & val) != 0 );
|
||||
}
|
||||
public bool IsMultiValid(int multiID)
|
||||
{
|
||||
if (multiID <= 0 || multiID >= m_MultiTable.Length)
|
||||
return false;
|
||||
|
||||
public ComponentVerification()
|
||||
{
|
||||
m_ItemTable = CreateTable( TileData.MaxItemValue );
|
||||
m_MultiTable = CreateTable( 0x4000 );
|
||||
return CheckValidity(m_MultiTable[multiID]);
|
||||
}
|
||||
|
||||
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" );
|
||||
public bool CheckValidity(int val)
|
||||
{
|
||||
if (val == -1)
|
||||
return false;
|
||||
|
||||
LoadMultis( "Data/Components/stairs.txt", "MultiNorth", "MultiEast", "MultiSouth", "MultiWest" );
|
||||
}
|
||||
return val == 0 || ((int)ExpansionInfo.CoreExpansion.CustomHousingFlag & val) != 0;
|
||||
}
|
||||
|
||||
private int[] CreateTable( int length )
|
||||
{
|
||||
int[] table = new int[length];
|
||||
private int[] CreateTable(int length)
|
||||
{
|
||||
int[] table = new int[length];
|
||||
|
||||
for ( int i = 0; i < table.Length; ++i )
|
||||
table[i] = -1;
|
||||
for (int i = 0; i < table.Length; ++i)
|
||||
table[i] = -1;
|
||||
|
||||
return table;
|
||||
}
|
||||
return table;
|
||||
}
|
||||
|
||||
private void LoadItems( string path, params string[] itemColumns )
|
||||
{
|
||||
LoadSpreadsheet( m_ItemTable, path, itemColumns );
|
||||
}
|
||||
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 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 );
|
||||
private void LoadSpreadsheet(int[] table, string path, params string[] tileColumns)
|
||||
{
|
||||
Spreadsheet ss = new Spreadsheet(path);
|
||||
|
||||
int[] tileCIDs = new int[tileColumns.Length];
|
||||
int[] tileCIDs = new int[tileColumns.Length];
|
||||
|
||||
for ( int i = 0; i < tileColumns.Length; ++i )
|
||||
tileCIDs[i] = ss.GetColumnID( tileColumns[i] );
|
||||
for (int i = 0; i < tileColumns.Length; ++i)
|
||||
tileCIDs[i] = ss.GetColumnID(tileColumns[i]);
|
||||
|
||||
int featureCID = ss.GetColumnID( "FeatureMask" );
|
||||
int featureCID = ss.GetColumnID("FeatureMask");
|
||||
|
||||
for ( int i = 0; i < ss.Records.Length; ++i )
|
||||
{
|
||||
DataRecord record = ss.Records[i];
|
||||
for (int i = 0; i < ss.Records.Length; ++i)
|
||||
{
|
||||
DataRecord record = ss.Records[i];
|
||||
|
||||
int fid = record.GetInt32( featureCID );
|
||||
int fid = record.GetInt32(featureCID);
|
||||
|
||||
for ( int j = 0; j < tileCIDs.Length; ++j )
|
||||
{
|
||||
int itemID = record.GetInt32( tileCIDs[j] );
|
||||
for (int j = 0; j < tileCIDs.Length; ++j)
|
||||
{
|
||||
int itemID = record.GetInt32(tileCIDs[j]);
|
||||
|
||||
if ( itemID <= 0 || itemID >= table.Length )
|
||||
continue;
|
||||
if (itemID <= 0 || itemID >= table.Length)
|
||||
continue;
|
||||
|
||||
table[itemID] = fid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
table[itemID] = fid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Spreadsheet
|
||||
{
|
||||
private class ColumnInfo
|
||||
{
|
||||
public int m_DataIndex;
|
||||
public class Spreadsheet
|
||||
{
|
||||
private ColumnInfo[] m_Columns;
|
||||
|
||||
public string m_Type;
|
||||
public string m_Name;
|
||||
public Spreadsheet(string path)
|
||||
{
|
||||
using (StreamReader ip = new StreamReader(path))
|
||||
{
|
||||
string[] types = ReadLine(ip);
|
||||
string[] names = ReadLine(ip);
|
||||
|
||||
public ColumnInfo( int dataIndex, string type, string name )
|
||||
{
|
||||
m_DataIndex = dataIndex;
|
||||
m_Columns = new ColumnInfo[types.Length];
|
||||
|
||||
m_Type = type;
|
||||
m_Name = name;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < m_Columns.Length; ++i)
|
||||
m_Columns[i] = new ColumnInfo(i, types[i], names[i]);
|
||||
|
||||
private ColumnInfo[] m_Columns;
|
||||
List<DataRecord> records = new List<DataRecord>();
|
||||
|
||||
public DataRecord[] Records { get; }
|
||||
string[] values;
|
||||
|
||||
public int GetColumnID( string name )
|
||||
{
|
||||
for ( int i = 0; i < m_Columns.Length; ++i )
|
||||
{
|
||||
if ( m_Columns[i].m_Name == name )
|
||||
return i;
|
||||
}
|
||||
while ((values = ReadLine(ip)) != null)
|
||||
{
|
||||
object[] data = new object[m_Columns.Length];
|
||||
|
||||
return -1;
|
||||
}
|
||||
for (int i = 0; i < m_Columns.Length; ++i)
|
||||
{
|
||||
ColumnInfo ci = m_Columns[i];
|
||||
|
||||
public Spreadsheet( string path )
|
||||
{
|
||||
using ( StreamReader ip = new StreamReader( path ) )
|
||||
{
|
||||
string[] types = ReadLine( ip );
|
||||
string[] names = ReadLine( ip );
|
||||
switch (ci.m_Type)
|
||||
{
|
||||
case "int":
|
||||
{
|
||||
data[i] = Utility.ToInt32(values[ci.m_DataIndex]);
|
||||
break;
|
||||
}
|
||||
case "string":
|
||||
{
|
||||
data[i] = values[ci.m_DataIndex];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_Columns = new ColumnInfo[types.Length];
|
||||
records.Add(new DataRecord(this, data));
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Columns.Length; ++i )
|
||||
m_Columns[i] = new ColumnInfo( i, types[i], names[i] );
|
||||
Records = records.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
List<DataRecord> records = new List<DataRecord>();
|
||||
public DataRecord[] Records{ get; }
|
||||
|
||||
string[] values;
|
||||
public int GetColumnID(string name)
|
||||
{
|
||||
for (int i = 0; i < m_Columns.Length; ++i)
|
||||
if (m_Columns[i].m_Name == name)
|
||||
return i;
|
||||
|
||||
while ( ( values = ReadLine( ip ) ) != null )
|
||||
{
|
||||
object[] data = new object[m_Columns.Length];
|
||||
return -1;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Columns.Length; ++i )
|
||||
{
|
||||
ColumnInfo ci = m_Columns[i];
|
||||
private string[] ReadLine(StreamReader ip)
|
||||
{
|
||||
string line;
|
||||
|
||||
switch ( ci.m_Type )
|
||||
{
|
||||
case "int":
|
||||
{
|
||||
data[i] = Utility.ToInt32( values[ci.m_DataIndex] );
|
||||
break;
|
||||
}
|
||||
case "string":
|
||||
{
|
||||
data[i] = values[ci.m_DataIndex];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
while ((line = ip.ReadLine()) != null)
|
||||
{
|
||||
if (line.Length == 0)
|
||||
continue;
|
||||
|
||||
records.Add( new DataRecord( this, data ) );
|
||||
}
|
||||
return line.Split('\t');
|
||||
}
|
||||
|
||||
Records = records.ToArray();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private string[] ReadLine( StreamReader ip )
|
||||
{
|
||||
string line;
|
||||
private class ColumnInfo
|
||||
{
|
||||
public int m_DataIndex;
|
||||
public string m_Name;
|
||||
|
||||
while ( ( line = ip.ReadLine() ) != null )
|
||||
{
|
||||
if ( line.Length == 0 )
|
||||
continue;
|
||||
public string m_Type;
|
||||
|
||||
return line.Split( '\t' );
|
||||
}
|
||||
public ColumnInfo(int dataIndex, string type, string name)
|
||||
{
|
||||
m_DataIndex = dataIndex;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
m_Type = type;
|
||||
m_Name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class DataRecord
|
||||
{
|
||||
public Spreadsheet Spreadsheet { get; }
|
||||
public class DataRecord
|
||||
{
|
||||
public DataRecord(Spreadsheet ss, object[] data)
|
||||
{
|
||||
Spreadsheet = ss;
|
||||
Data = data;
|
||||
}
|
||||
|
||||
public object[] Data { get; }
|
||||
public Spreadsheet Spreadsheet{ get; }
|
||||
|
||||
public DataRecord( Spreadsheet ss, object[] data )
|
||||
{
|
||||
Spreadsheet = ss;
|
||||
Data = data;
|
||||
}
|
||||
public object[] Data{ get; }
|
||||
|
||||
public int GetInt32( string name )
|
||||
{
|
||||
return GetInt32( this[name] );
|
||||
}
|
||||
public object this[string name] => this[Spreadsheet.GetColumnID(name)];
|
||||
|
||||
public int GetInt32( int id )
|
||||
{
|
||||
return GetInt32( this[id] );
|
||||
}
|
||||
public object this[int id]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (id < 0)
|
||||
return null;
|
||||
|
||||
public int GetInt32( object obj )
|
||||
{
|
||||
if ( obj is int )
|
||||
return (int) obj;
|
||||
return Data[id];
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
public int GetInt32(string name)
|
||||
{
|
||||
return GetInt32(this[name]);
|
||||
}
|
||||
|
||||
public string GetString( string name )
|
||||
{
|
||||
return this[name] as string;
|
||||
}
|
||||
public int GetInt32(int id)
|
||||
{
|
||||
return GetInt32(this[id]);
|
||||
}
|
||||
|
||||
public object this[string name] => this[Spreadsheet.GetColumnID( name )];
|
||||
public int GetInt32(object obj)
|
||||
{
|
||||
if (obj is int)
|
||||
return (int)obj;
|
||||
|
||||
public object this[int id]
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( id < 0 )
|
||||
return null;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Data[id];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public string GetString(string name)
|
||||
{
|
||||
return this[name] as string;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -3,62 +3,62 @@ using System.Collections.Generic;
|
|||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class DynamicDecay
|
||||
{
|
||||
public static bool Enabled => Core.ML;
|
||||
public class DynamicDecay
|
||||
{
|
||||
private static Dictionary<DecayLevel, DecayStageInfo> m_Stages;
|
||||
|
||||
private static Dictionary<DecayLevel, DecayStageInfo> m_Stages;
|
||||
static DynamicDecay()
|
||||
{
|
||||
m_Stages = new Dictionary<DecayLevel, DecayStageInfo>();
|
||||
|
||||
static DynamicDecay()
|
||||
{
|
||||
m_Stages = new Dictionary<DecayLevel, DecayStageInfo>();
|
||||
Register(DecayLevel.LikeNew, TimeSpan.FromHours(1), TimeSpan.FromHours(1));
|
||||
Register(DecayLevel.Slightly, TimeSpan.FromDays(1), TimeSpan.FromDays(2));
|
||||
Register(DecayLevel.Somewhat, TimeSpan.FromDays(1), TimeSpan.FromDays(2));
|
||||
Register(DecayLevel.Fairly, TimeSpan.FromDays(1), TimeSpan.FromDays(2));
|
||||
Register(DecayLevel.Greatly, TimeSpan.FromDays(1), TimeSpan.FromDays(2));
|
||||
Register(DecayLevel.IDOC, TimeSpan.FromHours(12), TimeSpan.FromHours(24));
|
||||
}
|
||||
|
||||
Register( DecayLevel.LikeNew, TimeSpan.FromHours( 1 ), TimeSpan.FromHours( 1 ) );
|
||||
Register( DecayLevel.Slightly, TimeSpan.FromDays( 1 ), TimeSpan.FromDays( 2 ) );
|
||||
Register( DecayLevel.Somewhat, TimeSpan.FromDays( 1 ), TimeSpan.FromDays( 2 ) );
|
||||
Register( DecayLevel.Fairly, TimeSpan.FromDays( 1 ), TimeSpan.FromDays( 2 ) );
|
||||
Register( DecayLevel.Greatly, TimeSpan.FromDays( 1 ), TimeSpan.FromDays( 2 ) );
|
||||
Register( DecayLevel.IDOC, TimeSpan.FromHours( 12 ), TimeSpan.FromHours( 24 ) );
|
||||
}
|
||||
public static bool Enabled => Core.ML;
|
||||
|
||||
public static void Register( DecayLevel level, TimeSpan min, TimeSpan max )
|
||||
{
|
||||
DecayStageInfo info = new DecayStageInfo( min, max );
|
||||
public static void Register(DecayLevel level, TimeSpan min, TimeSpan max)
|
||||
{
|
||||
DecayStageInfo info = new DecayStageInfo(min, max);
|
||||
|
||||
if ( m_Stages.ContainsKey( level ) )
|
||||
m_Stages[level] = info;
|
||||
else
|
||||
m_Stages.Add( level, info );
|
||||
}
|
||||
if (m_Stages.ContainsKey(level))
|
||||
m_Stages[level] = info;
|
||||
else
|
||||
m_Stages.Add(level, info);
|
||||
}
|
||||
|
||||
public static bool Decays( DecayLevel level )
|
||||
{
|
||||
return m_Stages.ContainsKey( level );
|
||||
}
|
||||
public static bool Decays(DecayLevel level)
|
||||
{
|
||||
return m_Stages.ContainsKey(level);
|
||||
}
|
||||
|
||||
public static TimeSpan GetRandomDuration( DecayLevel level )
|
||||
{
|
||||
if ( !m_Stages.ContainsKey( level ) )
|
||||
return TimeSpan.Zero;
|
||||
public static TimeSpan GetRandomDuration(DecayLevel level)
|
||||
{
|
||||
if (!m_Stages.ContainsKey(level))
|
||||
return TimeSpan.Zero;
|
||||
|
||||
DecayStageInfo info = m_Stages[level];
|
||||
long min = info.MinDuration.Ticks;
|
||||
long max = info.MaxDuration.Ticks;
|
||||
DecayStageInfo info = m_Stages[level];
|
||||
long min = info.MinDuration.Ticks;
|
||||
long max = info.MaxDuration.Ticks;
|
||||
|
||||
return TimeSpan.FromTicks( min + (long)( Utility.RandomDouble() * ( max - min ) ) );
|
||||
}
|
||||
}
|
||||
return TimeSpan.FromTicks(min + (long)(Utility.RandomDouble() * (max - min)));
|
||||
}
|
||||
}
|
||||
|
||||
public class DecayStageInfo
|
||||
{
|
||||
public TimeSpan MinDuration { get; }
|
||||
public class DecayStageInfo
|
||||
{
|
||||
public DecayStageInfo(TimeSpan min, TimeSpan max)
|
||||
{
|
||||
MinDuration = min;
|
||||
MaxDuration = max;
|
||||
}
|
||||
|
||||
public TimeSpan MaxDuration { get; }
|
||||
public TimeSpan MinDuration{ get; }
|
||||
|
||||
public DecayStageInfo( TimeSpan min, TimeSpan max )
|
||||
{
|
||||
MinDuration = min;
|
||||
MaxDuration = max;
|
||||
}
|
||||
}
|
||||
}
|
||||
public TimeSpan MaxDuration{ get; }
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -5,368 +5,361 @@ using Server.Spells;
|
|||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public enum HousePlacementResult
|
||||
{
|
||||
Valid,
|
||||
BadRegion,
|
||||
BadLand,
|
||||
BadStatic,
|
||||
BadItem,
|
||||
NoSurface,
|
||||
BadRegionHidden,
|
||||
BadRegionTemp,
|
||||
InvalidCastleKeep,
|
||||
BadRegionRaffle
|
||||
}
|
||||
|
||||
public class HousePlacement
|
||||
{
|
||||
private const int YardSize = 5;
|
||||
public enum HousePlacementResult
|
||||
{
|
||||
Valid,
|
||||
BadRegion,
|
||||
BadLand,
|
||||
BadStatic,
|
||||
BadItem,
|
||||
NoSurface,
|
||||
BadRegionHidden,
|
||||
BadRegionTemp,
|
||||
InvalidCastleKeep,
|
||||
BadRegionRaffle
|
||||
}
|
||||
|
||||
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 = {
|
||||
0x0071, 0x0078,
|
||||
0x00E8, 0x00EB,
|
||||
0x07AE, 0x07B1,
|
||||
0x3FF4, 0x3FF4,
|
||||
0x3FF8, 0x3FFB,
|
||||
0x0442, 0x0479, // Sand stones
|
||||
0x0501, 0x0510, // Sand stones
|
||||
0x0009, 0x0015, // Furrows
|
||||
0x0150, 0x015C // Furrows
|
||||
};
|
||||
// Any land tile which matches one of these ID numbers is considered a road and cannot be placed over.
|
||||
private static int[] m_RoadIDs =
|
||||
{
|
||||
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();
|
||||
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;
|
||||
Map map = from.Map;
|
||||
|
||||
if ( map == null || map == Map.Internal )
|
||||
return HousePlacementResult.BadLand; // A house cannot go here
|
||||
if (map == null || map == Map.Internal)
|
||||
return HousePlacementResult.BadLand; // A house cannot go here
|
||||
|
||||
if ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
return HousePlacementResult.Valid; // Staff can place anywhere
|
||||
if (from.AccessLevel >= AccessLevel.GameMaster)
|
||||
return HousePlacementResult.Valid; // Staff can place anywhere
|
||||
|
||||
if ( map == Map.Ilshenar || SpellHelper.IsFeluccaT2A( map, center ) )
|
||||
return HousePlacementResult.BadRegion; // No houses in Ilshenar/T2A
|
||||
if (map == Map.Ilshenar || SpellHelper.IsFeluccaT2A(map, center))
|
||||
return HousePlacementResult.BadRegion; // No houses in Ilshenar/T2A
|
||||
|
||||
if ( map == Map.Malas && ( multiID == 0x007C || multiID == 0x007E ) )
|
||||
return HousePlacementResult.InvalidCastleKeep;
|
||||
if (map == Map.Malas && (multiID == 0x007C || multiID == 0x007E))
|
||||
return HousePlacementResult.InvalidCastleKeep;
|
||||
|
||||
NoHousingRegion noHousingRegion = (NoHousingRegion) Region.Find( center, map ).GetRegion( typeof( NoHousingRegion ) );
|
||||
NoHousingRegion noHousingRegion = (NoHousingRegion)Region.Find(center, map).GetRegion(typeof(NoHousingRegion));
|
||||
|
||||
if ( noHousingRegion != null )
|
||||
return HousePlacementResult.BadRegion;
|
||||
if (noHousingRegion != null)
|
||||
return HousePlacementResult.BadRegion;
|
||||
|
||||
// This holds data describing the internal structure of the house
|
||||
MultiComponentList mcl = MultiData.GetComponents( multiID );
|
||||
// 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
|
||||
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 );
|
||||
// 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 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>();
|
||||
// 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.
|
||||
*/
|
||||
/* 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;
|
||||
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];
|
||||
StaticTile[] addTiles = mcl.Tiles[x][y];
|
||||
|
||||
if ( addTiles.Length == 0 )
|
||||
continue; // There are no tiles here, continue checking somewhere else
|
||||
if (addTiles.Length == 0)
|
||||
continue; // There are no tiles here, continue checking somewhere else
|
||||
|
||||
Point3D testPoint = new Point3D( tileX, tileY, center.Z );
|
||||
Point3D testPoint = new Point3D(tileX, tileY, center.Z);
|
||||
|
||||
Region reg = Region.Find( testPoint, map );
|
||||
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.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( HouseRegion ) ) )
|
||||
return HousePlacementResult.BadRegionHidden;
|
||||
if (reg.IsPartOf(typeof(TreasureRegion)) || reg.IsPartOf(typeof(HouseRegion)))
|
||||
return HousePlacementResult.BadRegionHidden;
|
||||
|
||||
if ( reg.IsPartOf( typeof( HouseRaffleRegion ) ) )
|
||||
return HousePlacementResult.BadRegionRaffle;
|
||||
if (reg.IsPartOf(typeof(HouseRaffleRegion)))
|
||||
return HousePlacementResult.BadRegionRaffle;
|
||||
|
||||
return HousePlacementResult.BadRegion;
|
||||
}
|
||||
return HousePlacementResult.BadRegion;
|
||||
}
|
||||
|
||||
LandTile landTile = map.Tiles.GetLandTile( tileX, tileY );
|
||||
int landID = landTile.ID & TileData.MaxLandValue;
|
||||
LandTile landTile = map.Tiles.GetLandTile(tileX, tileY);
|
||||
int landID = landTile.ID & TileData.MaxLandValue;
|
||||
|
||||
StaticTile[] oldTiles = map.Tiles.GetStaticTiles( tileX, tileY, true );
|
||||
StaticTile[] oldTiles = map.Tiles.GetStaticTiles(tileX, tileY, true);
|
||||
|
||||
Sector sector = map.GetSector( tileX, tileY );
|
||||
Sector sector = map.GetSector(tileX, tileY);
|
||||
|
||||
items.Clear();
|
||||
items.Clear();
|
||||
|
||||
for ( int i = 0; i < sector.Items.Count; ++i )
|
||||
{
|
||||
Item item = sector.Items[i];
|
||||
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 );
|
||||
}
|
||||
if (item.Visible && item.X == tileX && item.Y == tileY)
|
||||
items.Add(item);
|
||||
}
|
||||
|
||||
mobiles.Clear();
|
||||
mobiles.Clear();
|
||||
|
||||
for ( int i = 0; i < sector.Mobiles.Count; ++i )
|
||||
{
|
||||
Mobile m = sector.Mobiles[i];
|
||||
for (int i = 0; i < sector.Mobiles.Count; ++i)
|
||||
{
|
||||
Mobile m = sector.Mobiles[i];
|
||||
|
||||
if ( m.X == tileX && m.Y == tileY )
|
||||
mobiles.Add( m );
|
||||
}
|
||||
if (m.X == tileX && m.Y == tileY)
|
||||
mobiles.Add(m);
|
||||
}
|
||||
|
||||
int landStartZ = 0, landAvgZ = 0, landTopZ = 0;
|
||||
int landStartZ = 0, landAvgZ = 0, landTopZ = 0;
|
||||
|
||||
map.GetAverageZ( tileX, tileY, ref landStartZ, ref landAvgZ, ref landTopZ );
|
||||
map.GetAverageZ(tileX, tileY, ref landStartZ, ref landAvgZ, ref landTopZ);
|
||||
|
||||
bool hasFoundation = false;
|
||||
bool hasFoundation = false;
|
||||
|
||||
for ( int i = 0; i < addTiles.Length; ++i )
|
||||
{
|
||||
StaticTile addTile = addTiles[i];
|
||||
for (int i = 0; i < addTiles.Length; ++i)
|
||||
{
|
||||
StaticTile addTile = addTiles[i];
|
||||
|
||||
if ( addTile.ID == 0x1 ) // Nodraw
|
||||
continue;
|
||||
if (addTile.ID == 0x1) // Nodraw
|
||||
continue;
|
||||
|
||||
TileFlag addTileFlags = TileData.ItemTable[addTile.ID & TileData.MaxItemValue].Flags;
|
||||
TileFlag addTileFlags = TileData.ItemTable[addTile.ID & TileData.MaxItemValue].Flags;
|
||||
|
||||
bool isFoundation = ( addTile.Z == 0 && (addTileFlags & TileFlag.Wall) != 0 );
|
||||
bool hasSurface = false;
|
||||
bool isFoundation = addTile.Z == 0 && (addTileFlags & TileFlag.Wall) != 0;
|
||||
bool hasSurface = false;
|
||||
|
||||
if ( isFoundation )
|
||||
hasFoundation = true;
|
||||
if (isFoundation)
|
||||
hasFoundation = true;
|
||||
|
||||
int addTileZ = center.Z + addTile.Z;
|
||||
int addTileTop = addTileZ + addTile.Height;
|
||||
int addTileZ = center.Z + addTile.Z;
|
||||
int addTileTop = addTileZ + addTile.Height;
|
||||
|
||||
if ( (addTileFlags & TileFlag.Surface) != 0 )
|
||||
addTileTop += 16;
|
||||
if ((addTileFlags & TileFlag.Surface) != 0)
|
||||
addTileTop += 16;
|
||||
|
||||
if ( addTileTop > landStartZ && landAvgZ > addTileZ )
|
||||
return HousePlacementResult.BadLand; // Broke rule #2
|
||||
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;
|
||||
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];
|
||||
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;*/
|
||||
}
|
||||
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;
|
||||
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 (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
|
||||
}
|
||||
|
||||
if ( isFoundation && !hasSurface )
|
||||
return HousePlacementResult.NoSurface; // Broke rule #4
|
||||
/*else if ( isFoundation && !hasSurface && (id.Flags & TileFlag.Surface) != 0 && (item.Z + id.CalcHeight) == center.Z )
|
||||
{
|
||||
hasSurface = true;
|
||||
}*/
|
||||
}
|
||||
|
||||
for ( int j = 0; j < mobiles.Count; ++j )
|
||||
{
|
||||
Mobile m = mobiles[j];
|
||||
if (isFoundation && !hasSurface)
|
||||
return HousePlacementResult.NoSurface; // Broke rule #4
|
||||
|
||||
if ( addTileTop > m.Z && (m.Z + 16) > addTileZ )
|
||||
toMove.Add( m );
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < mobiles.Count; ++j)
|
||||
{
|
||||
Mobile m = mobiles[j];
|
||||
|
||||
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 (addTileTop > m.Z && m.Z + 16 > addTileZ)
|
||||
toMove.Add(m);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,283 +1,294 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Gumps;
|
||||
using Server.ContextMenus;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class HouseSign : Item
|
||||
{
|
||||
public HouseSign( BaseHouse owner ) : base( 0xBD2 )
|
||||
{
|
||||
Owner = owner;
|
||||
OriginalOwner = Owner.Owner;
|
||||
Movable = false;
|
||||
}
|
||||
public class HouseSign : Item
|
||||
{
|
||||
public HouseSign(BaseHouse owner) : base(0xBD2)
|
||||
{
|
||||
Owner = owner;
|
||||
OriginalOwner = Owner.Owner;
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public HouseSign( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public HouseSign(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
if ( Name == null )
|
||||
return "An Unnamed House";
|
||||
public BaseHouse Owner{ get; private set; }
|
||||
|
||||
return Name;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool RestrictDecay
|
||||
{
|
||||
get => Owner != null && Owner.RestrictDecay;
|
||||
set
|
||||
{
|
||||
if (Owner != null) Owner.RestrictDecay = value;
|
||||
}
|
||||
}
|
||||
|
||||
public BaseHouse Owner { get; private set; }
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile OriginalOwner{ get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool RestrictDecay
|
||||
{
|
||||
get => ( Owner != null && Owner.RestrictDecay );
|
||||
set{ if ( Owner != null ) Owner.RestrictDecay = value; }
|
||||
}
|
||||
public override bool ForceShowProperties => ObjectPropertyList.Enabled;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile OriginalOwner { get; private set; }
|
||||
public bool GettingProperties{ get; private set; }
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
public string GetName()
|
||||
{
|
||||
if (Name == null)
|
||||
return "An Unnamed House";
|
||||
|
||||
if ( Owner != null && !Owner.Deleted )
|
||||
Owner.Delete();
|
||||
}
|
||||
return Name;
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
list.Add( 1061638 ); // A House Sign
|
||||
}
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
public override bool ForceShowProperties => ObjectPropertyList.Enabled;
|
||||
if (Owner != null && !Owner.Deleted)
|
||||
Owner.Delete();
|
||||
}
|
||||
|
||||
public bool GettingProperties { get; private set; }
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1061638); // A House Sign
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add( 1061639, Utility.FixHtml( GetName() ) ); // Name: ~1_NAME~
|
||||
list.Add( 1061640, (Owner?.Owner == null) ? "nobody" : Owner.Owner.Name ); // Owner: ~1_OWNER~
|
||||
list.Add(1061639, Utility.FixHtml(GetName())); // Name: ~1_NAME~
|
||||
list.Add(1061640, Owner?.Owner == null ? "nobody" : Owner.Owner.Name); // Owner: ~1_OWNER~
|
||||
|
||||
if ( Owner != null )
|
||||
{
|
||||
list.Add( Owner.Public ? 1061641 : 1061642 ); // This House is Open to the Public : This is a Private Home
|
||||
if (Owner != null)
|
||||
{
|
||||
list.Add(Owner.Public ? 1061641 : 1061642); // This House is Open to the Public : This is a Private Home
|
||||
|
||||
GettingProperties = true;
|
||||
DecayLevel level = Owner.DecayLevel;
|
||||
GettingProperties = false;
|
||||
GettingProperties = true;
|
||||
DecayLevel level = Owner.DecayLevel;
|
||||
GettingProperties = false;
|
||||
|
||||
if ( level == DecayLevel.DemolitionPending )
|
||||
{
|
||||
list.Add( 1062497 ); // Demolition Pending
|
||||
}
|
||||
else if ( level != DecayLevel.Ageless )
|
||||
{
|
||||
if ( level == DecayLevel.Collapsed )
|
||||
level = DecayLevel.IDOC;
|
||||
if (level == DecayLevel.DemolitionPending)
|
||||
{
|
||||
list.Add(1062497); // Demolition Pending
|
||||
}
|
||||
else if (level != DecayLevel.Ageless)
|
||||
{
|
||||
if (level == DecayLevel.Collapsed)
|
||||
level = DecayLevel.IDOC;
|
||||
|
||||
list.Add( 1062028, $"#{1043009 + (int) level}"); // Condition: This structure is ...
|
||||
}
|
||||
}
|
||||
}
|
||||
list.Add(1062028, $"#{1043009 + (int)level}"); // Condition: This structure is ...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
if ( Owner != null && BaseHouse.DecayEnabled && Owner.DecayPeriod != TimeSpan.Zero )
|
||||
{
|
||||
string message;
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
if (Owner != null && BaseHouse.DecayEnabled && Owner.DecayPeriod != TimeSpan.Zero)
|
||||
{
|
||||
string message;
|
||||
|
||||
switch ( 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;
|
||||
}
|
||||
switch (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 );
|
||||
}
|
||||
LabelTo(from, "This house is {0}.", message);
|
||||
}
|
||||
|
||||
base.OnSingleClick( from );
|
||||
}
|
||||
base.OnSingleClick(from);
|
||||
}
|
||||
|
||||
public void ShowSign( Mobile m )
|
||||
{
|
||||
if ( Owner != null )
|
||||
{
|
||||
if ( Owner.IsFriend( m ) && m.AccessLevel < AccessLevel.GameMaster )
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
if ( ( Core.ML && Owner.IsOwner( m ) ) || !Core.ML )
|
||||
Owner.RefreshDecay();
|
||||
#endregion
|
||||
if ( !Core.AOS )
|
||||
m.SendLocalizedMessage( 501293 ); // Welcome back to the house, friend!
|
||||
}
|
||||
public void ShowSign(Mobile m)
|
||||
{
|
||||
if (Owner != null)
|
||||
{
|
||||
if (Owner.IsFriend(m) && m.AccessLevel < AccessLevel.GameMaster)
|
||||
{
|
||||
#region Mondain's Legacy
|
||||
|
||||
if ( Owner.IsAosRules )
|
||||
m.SendGump( new HouseGumpAOS( HouseGumpPageAOS.Information, m, Owner ) );
|
||||
else
|
||||
m.SendGump( new HouseGump( m, Owner ) );
|
||||
}
|
||||
}
|
||||
if (Core.ML && Owner.IsOwner(m) || !Core.ML)
|
||||
Owner.RefreshDecay();
|
||||
|
||||
public void ClaimGump_Callback( Mobile from, bool okay, object state )
|
||||
{
|
||||
if ( okay && Owner != null && Owner.Owner == null && Owner.DecayLevel != DecayLevel.DemolitionPending )
|
||||
{
|
||||
bool canClaim = false;
|
||||
#endregion
|
||||
|
||||
if ( Owner.CoOwners == null || Owner.CoOwners.Count == 0 )
|
||||
canClaim = Owner.IsFriend( from );
|
||||
else
|
||||
canClaim = Owner.IsCoOwner( from );
|
||||
if (!Core.AOS)
|
||||
m.SendLocalizedMessage(501293); // Welcome back to the house, friend!
|
||||
}
|
||||
|
||||
if ( canClaim && !BaseHouse.HasAccountHouse( from ) )
|
||||
{
|
||||
Owner.Owner = from;
|
||||
Owner.LastTraded = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
if (Owner.IsAosRules)
|
||||
m.SendGump(new HouseGumpAOS(HouseGumpPageAOS.Information, m, Owner));
|
||||
else
|
||||
m.SendGump(new HouseGump(m, Owner));
|
||||
}
|
||||
}
|
||||
|
||||
ShowSign( from );
|
||||
}
|
||||
public void ClaimGump_Callback(Mobile from, bool okay, object state)
|
||||
{
|
||||
if (okay && Owner != null && Owner.Owner == null && Owner.DecayLevel != DecayLevel.DemolitionPending)
|
||||
{
|
||||
bool canClaim = false;
|
||||
|
||||
public override void OnDoubleClick( Mobile m )
|
||||
{
|
||||
if ( Owner == null )
|
||||
return;
|
||||
if (Owner.CoOwners == null || Owner.CoOwners.Count == 0)
|
||||
canClaim = Owner.IsFriend(from);
|
||||
else
|
||||
canClaim = Owner.IsCoOwner(from);
|
||||
|
||||
if ( m.AccessLevel < AccessLevel.GameMaster && Owner.Owner == null && Owner.DecayLevel != DecayLevel.DemolitionPending )
|
||||
{
|
||||
bool canClaim = false;
|
||||
if (canClaim && !BaseHouse.HasAccountHouse(from))
|
||||
{
|
||||
Owner.Owner = from;
|
||||
Owner.LastTraded = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Owner.CoOwners == null || Owner.CoOwners.Count == 0 )
|
||||
canClaim = Owner.IsFriend( m );
|
||||
else
|
||||
canClaim = Owner.IsCoOwner( m );
|
||||
ShowSign(from);
|
||||
}
|
||||
|
||||
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, ClaimGump_Callback, null ) );
|
||||
}
|
||||
}
|
||||
public override void OnDoubleClick(Mobile m)
|
||||
{
|
||||
if (Owner == null)
|
||||
return;
|
||||
|
||||
ShowSign( m );
|
||||
}
|
||||
if (m.AccessLevel < AccessLevel.GameMaster && Owner.Owner == null &&
|
||||
Owner.DecayLevel != DecayLevel.DemolitionPending)
|
||||
{
|
||||
bool canClaim = false;
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
if (Owner.CoOwners == null || Owner.CoOwners.Count == 0)
|
||||
canClaim = Owner.IsFriend(m);
|
||||
else
|
||||
canClaim = Owner.IsCoOwner(m);
|
||||
|
||||
if ( BaseHouse.NewVendorSystem && from.Alive && Owner != null && Owner.IsAosRules )
|
||||
{
|
||||
if ( Owner.AreThereAvailableVendorsFor( from ) )
|
||||
list.Add( new VendorsEntry( this ) );
|
||||
if (canClaim && !BaseHouse.HasAccountHouse(m))
|
||||
m.SendGump(new WarningGump(501036, 32512, 1049719, 32512, 420, 280, ClaimGump_Callback, null));
|
||||
}
|
||||
|
||||
if ( Owner.VendorInventories.Count > 0 )
|
||||
list.Add( new ReclaimVendorInventoryEntry( this ) );
|
||||
}
|
||||
}
|
||||
ShowSign(m);
|
||||
}
|
||||
|
||||
private class VendorsEntry : ContextMenuEntry
|
||||
{
|
||||
private HouseSign m_Sign;
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
|
||||
public VendorsEntry( HouseSign sign ) : base( 6211 )
|
||||
{
|
||||
m_Sign = sign;
|
||||
}
|
||||
if (BaseHouse.NewVendorSystem && from.Alive && Owner != null && Owner.IsAosRules)
|
||||
{
|
||||
if (Owner.AreThereAvailableVendorsFor(from))
|
||||
list.Add(new VendorsEntry(this));
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
Mobile from = Owner.From;
|
||||
if (Owner.VendorInventories.Count > 0)
|
||||
list.Add(new ReclaimVendorInventoryEntry(this));
|
||||
}
|
||||
}
|
||||
|
||||
if ( !from.CheckAlive() || m_Sign.Deleted || m_Sign.Owner == null || !m_Sign.Owner.AreThereAvailableVendorsFor( from ) )
|
||||
return;
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
writer.Write(0); // version
|
||||
|
||||
private class ReclaimVendorInventoryEntry : ContextMenuEntry
|
||||
{
|
||||
private HouseSign m_Sign;
|
||||
writer.Write(Owner);
|
||||
writer.Write(OriginalOwner);
|
||||
}
|
||||
|
||||
public ReclaimVendorInventoryEntry( HouseSign sign ) : base( 6213 )
|
||||
{
|
||||
m_Sign = sign;
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
Mobile from = Owner.From;
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( m_Sign.Deleted || m_Sign.Owner == null || m_Sign.Owner.VendorInventories.Count == 0 || !from.CheckAlive() )
|
||||
return;
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Owner = reader.ReadItem() as BaseHouse;
|
||||
OriginalOwner = reader.ReadMobile();
|
||||
|
||||
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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
if (Name == "a house sign")
|
||||
Name = null;
|
||||
}
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
private class VendorsEntry : ContextMenuEntry
|
||||
{
|
||||
private HouseSign m_Sign;
|
||||
|
||||
writer.Write( Owner );
|
||||
writer.Write( OriginalOwner );
|
||||
}
|
||||
public VendorsEntry(HouseSign sign) : base(6211)
|
||||
{
|
||||
m_Sign = sign;
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void OnClick()
|
||||
{
|
||||
Mobile from = Owner.From;
|
||||
|
||||
int version = reader.ReadInt();
|
||||
if (!from.CheckAlive() || m_Sign.Deleted || m_Sign.Owner == null ||
|
||||
!m_Sign.Owner.AreThereAvailableVendorsFor(from))
|
||||
return;
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Owner = reader.ReadItem() as BaseHouse;
|
||||
OriginalOwner = reader.ReadMobile();
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
private class ReclaimVendorInventoryEntry : ContextMenuEntry
|
||||
{
|
||||
private HouseSign m_Sign;
|
||||
|
||||
if ( Name == "a house sign" )
|
||||
Name = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
public ReclaimVendorInventoryEntry(HouseSign sign) : base(6213)
|
||||
{
|
||||
m_Sign = sign;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
Mobile from = 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,173 +1,179 @@
|
|||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using System.Collections.Generic;
|
||||
using Server.ContextMenus;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Multis;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class HouseTeleporter : Item, ISecurable
|
||||
{
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Item Target { get; set; }
|
||||
public class HouseTeleporter : Item, ISecurable
|
||||
{
|
||||
[Constructible]
|
||||
public HouseTeleporter(int itemID) : this(itemID, null)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public SecureLevel Level { get; set; }
|
||||
public HouseTeleporter(int itemID, Item target) : base(itemID)
|
||||
{
|
||||
Movable = false;
|
||||
|
||||
[Constructible]
|
||||
public HouseTeleporter( int itemID ) : this( itemID, null )
|
||||
{
|
||||
}
|
||||
Level = SecureLevel.Anyone;
|
||||
|
||||
public HouseTeleporter( int itemID, Item target ) : base( itemID )
|
||||
{
|
||||
Movable = false;
|
||||
Target = target;
|
||||
}
|
||||
|
||||
Level = SecureLevel.Anyone;
|
||||
public HouseTeleporter(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
Target = target;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Item Target{ get; set; }
|
||||
|
||||
public bool CheckAccess( Mobile m )
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt( this );
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public SecureLevel Level{ get; set; }
|
||||
|
||||
if ( house != null && (house.Public ? house.IsBanned( m ) : !house.HasAccess( m )) )
|
||||
return false;
|
||||
public bool CheckAccess(Mobile m)
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt(this);
|
||||
|
||||
return ( house != null && house.HasSecureAccess( m, Level ) );
|
||||
}
|
||||
if (house != null && (house.Public ? house.IsBanned(m) : !house.HasAccess(m)))
|
||||
return false;
|
||||
|
||||
public override bool OnMoveOver( Mobile m )
|
||||
{
|
||||
if ( Target != null && !Target.Deleted )
|
||||
{
|
||||
if ( CheckAccess( m ) )
|
||||
{
|
||||
if ( !m.Hidden || m.AccessLevel == AccessLevel.Player )
|
||||
new EffectTimer( Location, Map, 2023, 0x1F0, TimeSpan.FromSeconds( 0.4 ) ).Start();
|
||||
return house != null && house.HasSecureAccess(m, Level);
|
||||
}
|
||||
|
||||
new DelayTimer( this, m ).Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendLocalizedMessage( 1061637 ); // You are not allowed to access this.
|
||||
}
|
||||
}
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
{
|
||||
if (Target != null && !Target.Deleted)
|
||||
{
|
||||
if (CheckAccess(m))
|
||||
{
|
||||
if (!m.Hidden || m.AccessLevel == AccessLevel.Player)
|
||||
new EffectTimer(Location, Map, 2023, 0x1F0, TimeSpan.FromSeconds(0.4)).Start();
|
||||
|
||||
return true;
|
||||
}
|
||||
new DelayTimer(this, m).Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendLocalizedMessage(1061637); // You are not allowed to access this.
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
SetSecureLevelEntry.AddTo( from, this, list );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public HouseTeleporter( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
SetSecureLevelEntry.AddTo(from, this, list);
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
writer.Write(1); // version
|
||||
|
||||
writer.Write( (int) Level );
|
||||
writer.Write((int)Level);
|
||||
|
||||
writer.Write( (Item) Target );
|
||||
}
|
||||
writer.Write(Target);
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
Level = (SecureLevel)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
Target = reader.ReadItem();
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
Level = (SecureLevel)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
Target = reader.ReadItem();
|
||||
|
||||
if ( version < 0 )
|
||||
Level = SecureLevel.Anyone;
|
||||
if (version < 0)
|
||||
Level = SecureLevel.Anyone;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class EffectTimer : Timer
|
||||
{
|
||||
private Point3D m_Location;
|
||||
private Map m_Map;
|
||||
private int m_EffectID;
|
||||
private int m_SoundID;
|
||||
private class EffectTimer : Timer
|
||||
{
|
||||
private int m_EffectID;
|
||||
private Point3D m_Location;
|
||||
private Map m_Map;
|
||||
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;
|
||||
}
|
||||
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 );
|
||||
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 );
|
||||
}
|
||||
}
|
||||
if (m_SoundID != -1)
|
||||
Effects.PlaySound(m_Location, m_Map, m_SoundID);
|
||||
}
|
||||
}
|
||||
|
||||
private class DelayTimer : Timer
|
||||
{
|
||||
private HouseTeleporter m_Teleporter;
|
||||
private Mobile m_Mobile;
|
||||
private class DelayTimer : Timer
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private HouseTeleporter m_Teleporter;
|
||||
|
||||
public DelayTimer( HouseTeleporter tp, Mobile m ) : base( TimeSpan.FromSeconds( 1.0 ) )
|
||||
{
|
||||
m_Teleporter = tp;
|
||||
m_Mobile = m;
|
||||
}
|
||||
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.Target;
|
||||
protected override void OnTick()
|
||||
{
|
||||
Item target = m_Teleporter.Target;
|
||||
|
||||
if ( target != null && !target.Deleted )
|
||||
{
|
||||
Mobile m = m_Mobile;
|
||||
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;
|
||||
if (m.Location == m_Teleporter.Location && m.Map == m_Teleporter.Map)
|
||||
{
|
||||
Point3D p = target.GetWorldTop();
|
||||
Map map = target.Map;
|
||||
|
||||
Mobiles.BaseCreature.TeleportPets( m, p, map );
|
||||
BaseCreature.TeleportPets(m, p, map);
|
||||
|
||||
m.MoveToWorld( p, map );
|
||||
m.MoveToWorld(p, map);
|
||||
|
||||
if ( !m.Hidden || m.AccessLevel == AccessLevel.Player )
|
||||
{
|
||||
Effects.PlaySound( target.Location, target.Map, 0x1FE );
|
||||
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 );
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
new EffectTimer(target.Location, target.Map, 2023, -1, TimeSpan.FromSeconds(0.4)).Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -5,320 +5,310 @@ 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 => 1061690; // Packing Crate
|
||||
|
||||
private Timer m_InternalizeTimer;
|
||||
|
||||
public BaseHouse House { get; set; }
|
||||
|
||||
public override int DefaultMaxItems => 0;
|
||||
public override int DefaultMaxWeight => 0;
|
||||
|
||||
public MovingCrate( BaseHouse house ) : base( 0xE3D )
|
||||
{
|
||||
Hue = 0x8A5;
|
||||
Movable = false;
|
||||
|
||||
House = house;
|
||||
}
|
||||
|
||||
public MovingCrate( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
public override void AddNameProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.AddNameProperties( list );
|
||||
|
||||
if ( House != null && House.InternalizedVendors.Count > 0 )
|
||||
list.Add( 1061833, House.InternalizedVendors.Count.ToString() ); // This packing crate contains ~1_COUNT~ vendors/barkeepers.
|
||||
}
|
||||
*/
|
||||
|
||||
public override void DropItem( Item dropped )
|
||||
{
|
||||
// 1. Try to stack the item
|
||||
foreach ( Item item in 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 Items )
|
||||
{
|
||||
if ( item is PackingBox packingBox )
|
||||
{
|
||||
Container box = packingBox;
|
||||
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 )
|
||||
{
|
||||
AddItem( subContainer );
|
||||
subContainer.Location = location;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.DropItem( subContainer );
|
||||
}
|
||||
}
|
||||
|
||||
private Point3D GetFreeLocation()
|
||||
{
|
||||
bool[,] positions = new bool[Rows, Columns];
|
||||
|
||||
foreach ( Item item in Items )
|
||||
{
|
||||
if ( item is PackingBox )
|
||||
{
|
||||
int i = (item.Y - Bounds.Y) / VerticalSpacing;
|
||||
if ( i < 0 )
|
||||
i = 0;
|
||||
else if ( i >= Rows )
|
||||
i = Rows - 1;
|
||||
|
||||
int j = (item.X - 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 = Bounds.X + j * HorizontalSpacing;
|
||||
int y = Bounds.Y + i * VerticalSpacing;
|
||||
|
||||
return new Point3D( x, y, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Point3D.Zero;
|
||||
}
|
||||
|
||||
public override bool IsDecoContainer => 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 ( 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 Items )
|
||||
if ( item is PackingBox && item.Items.Count == 0 )
|
||||
toRemove.Add( item );
|
||||
|
||||
foreach ( Item item in toRemove )
|
||||
item.Delete();
|
||||
|
||||
if ( TotalItems == 0 )
|
||||
Delete();
|
||||
else
|
||||
Internalize();
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
if ( House != null && House.MovingCrate == this )
|
||||
House.MovingCrate = null;
|
||||
|
||||
m_InternalizeTimer?.Stop();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 1 );
|
||||
|
||||
writer.Write( (Item) House );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
House = reader.ReadItem() as BaseHouse;
|
||||
|
||||
if ( House != null )
|
||||
{
|
||||
House.MovingCrate = this;
|
||||
Timer.DelayCall( TimeSpan.Zero, Hide );
|
||||
}
|
||||
else
|
||||
{
|
||||
Timer.DelayCall( TimeSpan.Zero, 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 => 1061690; // Packing Crate
|
||||
|
||||
public override int DefaultGumpID => 0x4B;
|
||||
public override int DefaultDropSound => 0x42;
|
||||
|
||||
public override Rectangle2D Bounds => new Rectangle2D( 16, 51, 168, 73 );
|
||||
|
||||
public override int DefaultMaxItems => 0;
|
||||
public override int DefaultMaxWeight => 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 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;
|
||||
|
||||
private Timer m_InternalizeTimer;
|
||||
|
||||
public MovingCrate(BaseHouse house) : base(0xE3D)
|
||||
{
|
||||
Hue = 0x8A5;
|
||||
Movable = false;
|
||||
|
||||
House = house;
|
||||
}
|
||||
|
||||
public MovingCrate(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1061690; // Packing Crate
|
||||
|
||||
public BaseHouse House{ get; set; }
|
||||
|
||||
public override int DefaultMaxItems => 0;
|
||||
public override int DefaultMaxWeight => 0;
|
||||
|
||||
public override bool IsDecoContainer => false;
|
||||
|
||||
/*
|
||||
public override void AddNameProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.AddNameProperties( list );
|
||||
|
||||
if ( House != null && House.InternalizedVendors.Count > 0 )
|
||||
list.Add( 1061833, House.InternalizedVendors.Count.ToString() ); // This packing crate contains ~1_COUNT~ vendors/barkeepers.
|
||||
}
|
||||
*/
|
||||
|
||||
public override void DropItem(Item dropped)
|
||||
{
|
||||
// 1. Try to stack the item
|
||||
foreach (Item item in 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 Items)
|
||||
if (item is PackingBox packingBox)
|
||||
{
|
||||
Container box = packingBox;
|
||||
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)
|
||||
{
|
||||
AddItem(subContainer);
|
||||
subContainer.Location = location;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.DropItem(subContainer);
|
||||
}
|
||||
}
|
||||
|
||||
private Point3D GetFreeLocation()
|
||||
{
|
||||
bool[,] positions = new bool[Rows, Columns];
|
||||
|
||||
foreach (Item item in Items)
|
||||
if (item is PackingBox)
|
||||
{
|
||||
int i = (item.Y - Bounds.Y) / VerticalSpacing;
|
||||
if (i < 0)
|
||||
i = 0;
|
||||
else if (i >= Rows)
|
||||
i = Rows - 1;
|
||||
|
||||
int j = (item.X - 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 = Bounds.X + j * HorizontalSpacing;
|
||||
int y = Bounds.Y + i * VerticalSpacing;
|
||||
|
||||
return new Point3D(x, y, 0);
|
||||
}
|
||||
|
||||
return Point3D.Zero;
|
||||
}
|
||||
|
||||
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 (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 Items)
|
||||
if (item is PackingBox && item.Items.Count == 0)
|
||||
toRemove.Add(item);
|
||||
|
||||
foreach (Item item in toRemove)
|
||||
item.Delete();
|
||||
|
||||
if (TotalItems == 0)
|
||||
Delete();
|
||||
else
|
||||
Internalize();
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
if (House != null && House.MovingCrate == this)
|
||||
House.MovingCrate = null;
|
||||
|
||||
m_InternalizeTimer?.Stop();
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(1);
|
||||
|
||||
writer.Write(House);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
House = reader.ReadItem() as BaseHouse;
|
||||
|
||||
if (House != null)
|
||||
{
|
||||
House.MovingCrate = this;
|
||||
Timer.DelayCall(TimeSpan.Zero, Hide);
|
||||
}
|
||||
else
|
||||
{
|
||||
Timer.DelayCall(TimeSpan.Zero, 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 PackingBox() : base(0x9A8)
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public PackingBox(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1061690; // Packing Crate
|
||||
|
||||
public override int DefaultGumpID => 0x4B;
|
||||
public override int DefaultDropSound => 0x42;
|
||||
|
||||
public override Rectangle2D Bounds => new Rectangle2D(16, 51, 168, 73);
|
||||
|
||||
public override void OnItemRemoved( Item item )
|
||||
{
|
||||
base.OnItemRemoved( item );
|
||||
public override int DefaultMaxItems => 0;
|
||||
public override int DefaultMaxWeight => 0;
|
||||
|
||||
public override void SendCantStoreMessage(Mobile to, Item item)
|
||||
{
|
||||
to.SendLocalizedMessage(1061145); // You cannot place items into a house moving crate.
|
||||
}
|
||||
|
||||
if ( item.GetBounce() == null && TotalItems == 0 )
|
||||
Delete();
|
||||
}
|
||||
public override void OnItemRemoved(Item item)
|
||||
{
|
||||
base.OnItemRemoved(item);
|
||||
|
||||
public override void OnItemBounceCleared( Item item )
|
||||
{
|
||||
base.OnItemBounceCleared( item );
|
||||
if (item.GetBounce() == null && TotalItems == 0)
|
||||
Delete();
|
||||
}
|
||||
|
||||
if ( TotalItems == 0 )
|
||||
Delete();
|
||||
}
|
||||
public override void OnItemBounceCleared(Item item)
|
||||
{
|
||||
base.OnItemBounceCleared(item);
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
if (TotalItems == 0)
|
||||
Delete();
|
||||
}
|
||||
|
||||
writer.WriteEncodedInt( 1 ); // version
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
writer.WriteEncodedInt(1); // version
|
||||
}
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
if ( version == 0 )
|
||||
MaxItems = -1; // reset to default
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
if (version == 0)
|
||||
MaxItems = -1; // reset to default
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,139 +4,139 @@ using Server.Items;
|
|||
|
||||
namespace Server.Multis
|
||||
{
|
||||
public class PreviewHouse : BaseMulti
|
||||
{
|
||||
private List<Item> m_Components;
|
||||
private Timer m_Timer;
|
||||
public class PreviewHouse : BaseMulti
|
||||
{
|
||||
private List<Item> m_Components;
|
||||
private Timer m_Timer;
|
||||
|
||||
public PreviewHouse( int multiID ) : base( multiID )
|
||||
{
|
||||
m_Components = new List<Item>();
|
||||
public PreviewHouse(int multiID) : base(multiID)
|
||||
{
|
||||
m_Components = new List<Item>();
|
||||
|
||||
MultiComponentList mcl = Components;
|
||||
MultiComponentList mcl = Components;
|
||||
|
||||
for ( int i = 1; i < mcl.List.Length; ++i )
|
||||
{
|
||||
MultiTileEntry entry = mcl.List[i];
|
||||
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 );
|
||||
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 );
|
||||
item.MoveToWorld(new Point3D(X + entry.m_OffsetX, Y + entry.m_OffsetY, Z + entry.m_OffsetZ), Map);
|
||||
|
||||
m_Components.Add( item );
|
||||
}
|
||||
}
|
||||
m_Components.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
m_Timer = new DecayTimer( this );
|
||||
m_Timer.Start();
|
||||
}
|
||||
m_Timer = new DecayTimer(this);
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
public override void OnLocationChange( Point3D oldLocation )
|
||||
{
|
||||
base.OnLocationChange( oldLocation );
|
||||
public PreviewHouse(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
if ( m_Components == null )
|
||||
return;
|
||||
public override void OnLocationChange(Point3D oldLocation)
|
||||
{
|
||||
base.OnLocationChange(oldLocation);
|
||||
|
||||
int xOffset = X - oldLocation.X;
|
||||
int yOffset = Y - oldLocation.Y;
|
||||
int zOffset = Z - oldLocation.Z;
|
||||
if (m_Components == null)
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < m_Components.Count; ++i )
|
||||
{
|
||||
Item item = m_Components[i];
|
||||
int xOffset = X - oldLocation.X;
|
||||
int yOffset = Y - oldLocation.Y;
|
||||
int zOffset = Z - oldLocation.Z;
|
||||
|
||||
item.MoveToWorld( new Point3D( item.X + xOffset, item.Y + yOffset, item.Z + zOffset ), Map );
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < m_Components.Count; ++i)
|
||||
{
|
||||
Item item = m_Components[i];
|
||||
|
||||
public override void OnMapChange()
|
||||
{
|
||||
base.OnMapChange();
|
||||
item.MoveToWorld(new Point3D(item.X + xOffset, item.Y + yOffset, item.Z + zOffset), Map);
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_Components == null )
|
||||
return;
|
||||
public override void OnMapChange()
|
||||
{
|
||||
base.OnMapChange();
|
||||
|
||||
for ( int i = 0; i < m_Components.Count; ++i )
|
||||
{
|
||||
Item item = m_Components[i];
|
||||
if (m_Components == null)
|
||||
return;
|
||||
|
||||
item.Map = Map;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < m_Components.Count; ++i)
|
||||
{
|
||||
Item item = m_Components[i];
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
item.Map = Map;
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_Components == null )
|
||||
return;
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
|
||||
for ( int i = 0; i < m_Components.Count; ++i )
|
||||
{
|
||||
Item item = m_Components[i];
|
||||
if (m_Components == null)
|
||||
return;
|
||||
|
||||
item.Delete();
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < m_Components.Count; ++i)
|
||||
{
|
||||
Item item = m_Components[i];
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
m_Timer?.Stop();
|
||||
item.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
m_Timer = null;
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
m_Timer?.Stop();
|
||||
|
||||
base.OnAfterDelete();
|
||||
}
|
||||
m_Timer = null;
|
||||
|
||||
public PreviewHouse( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
base.OnAfterDelete();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write( m_Components );
|
||||
}
|
||||
writer.Write(m_Components);
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Components = reader.ReadStrongItemList();
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Components = reader.ReadStrongItemList();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Timer.DelayCall( TimeSpan.Zero, Delete );
|
||||
}
|
||||
Timer.DelayCall(TimeSpan.Zero, Delete);
|
||||
}
|
||||
|
||||
private class DecayTimer : Timer
|
||||
{
|
||||
private Item m_Item;
|
||||
private class DecayTimer : Timer
|
||||
{
|
||||
private Item m_Item;
|
||||
|
||||
public DecayTimer( Item item ) : base( TimeSpan.FromSeconds( 20.0 ) )
|
||||
{
|
||||
m_Item = item;
|
||||
Priority = TimerPriority.OneSecond;
|
||||
}
|
||||
public DecayTimer(Item item) : base(TimeSpan.FromSeconds(20.0))
|
||||
{
|
||||
m_Item = item;
|
||||
Priority = TimerPriority.OneSecond;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Item.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Item.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue