Fixes brace style (#248)
This commit is contained in:
parent
a236617ad9
commit
8149620b0c
1503 changed files with 28575 additions and 1717 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -12,7 +12,9 @@ namespace Server.Multis
|
|||
Weight = 1.0;
|
||||
|
||||
if (!Core.AOS)
|
||||
{
|
||||
LootType = LootType.Newbied;
|
||||
}
|
||||
|
||||
MultiID = id;
|
||||
Offset = offset;
|
||||
|
|
@ -58,7 +60,9 @@ namespace Server.Multis
|
|||
}
|
||||
|
||||
if (Weight == 0.0)
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
|
|
@ -74,9 +78,13 @@ namespace Server.Multis
|
|||
else
|
||||
{
|
||||
if (Core.SE)
|
||||
from.SendLocalizedMessage(502482); // Where do you wish to place the ship?
|
||||
{
|
||||
@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?
|
||||
{
|
||||
@from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 502482); // Where do you wish to place the ship?
|
||||
}
|
||||
|
||||
from.Target = new InternalTarget(this);
|
||||
}
|
||||
|
|
@ -84,7 +92,10 @@ namespace Server.Multis
|
|||
|
||||
public void OnPlacement(Mobile from, Point3D p)
|
||||
{
|
||||
if (Deleted) return;
|
||||
if (Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
|
|
@ -95,7 +106,9 @@ namespace Server.Multis
|
|||
var map = from.Map;
|
||||
|
||||
if (map == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (from.AccessLevel < AccessLevel.GameMaster && (map == Map.Ilshenar || map == Map.Malas))
|
||||
{
|
||||
|
|
@ -116,7 +129,9 @@ namespace Server.Multis
|
|||
var boat = Boat;
|
||||
|
||||
if (boat == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
p = new Point3D(p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z);
|
||||
|
||||
|
|
@ -130,10 +145,14 @@ namespace Server.Multis
|
|||
var keyValue = boat.CreateKeys(from);
|
||||
|
||||
if (boat.PPlank != null)
|
||||
{
|
||||
boat.PPlank.KeyValue = keyValue;
|
||||
}
|
||||
|
||||
if (boat.SPlank != null)
|
||||
{
|
||||
boat.SPlank.KeyValue = keyValue;
|
||||
}
|
||||
|
||||
boat.MoveToWorld(p, map);
|
||||
}
|
||||
|
|
@ -156,18 +175,26 @@ namespace Server.Multis
|
|||
if (o is IPoint3D ip)
|
||||
{
|
||||
if (ip is Item item)
|
||||
{
|
||||
ip = item.GetWorldTop();
|
||||
}
|
||||
|
||||
var p = new Point3D(ip);
|
||||
|
||||
var region = Region.Find(p, from.Map);
|
||||
|
||||
if (region.IsPartOf<DungeonRegion>())
|
||||
from.SendLocalizedMessage(502488); // You can not place a ship inside a dungeon.
|
||||
{
|
||||
@from.SendLocalizedMessage(502488); // You can not place a ship inside a dungeon.
|
||||
}
|
||||
else if (region.IsPartOf<HouseRegion>() || region.IsPartOf<ChampionSpawnRegion>())
|
||||
from.SendLocalizedMessage(1042549); // A boat may not be placed in this area.
|
||||
{
|
||||
@from.SendLocalizedMessage(1042549); // A boat may not be placed in this area.
|
||||
}
|
||||
else
|
||||
m_Deed.OnPlacement(from, p);
|
||||
{
|
||||
m_Deed.OnPlacement(@from, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,17 +69,23 @@ namespace Server.Multis
|
|||
m_ShipName = reader.ReadString();
|
||||
|
||||
if (version == 0)
|
||||
{
|
||||
reader.ReadUInt();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (LootType == LootType.Newbied)
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
if (Weight == 0.0)
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
|
|
@ -99,22 +105,33 @@ namespace Server.Multis
|
|||
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);
|
||||
{
|
||||
LabelTo(@from, m_ShipName);
|
||||
}
|
||||
else
|
||||
base.OnSingleClick(from);
|
||||
{
|
||||
base.OnSingleClick(@from);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPlacement(Mobile from, Point3D p)
|
||||
{
|
||||
if (Deleted) return;
|
||||
if (Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
|
|
@ -125,12 +142,16 @@ namespace Server.Multis
|
|||
var map = from.Map;
|
||||
|
||||
if (map == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var boat = Boat;
|
||||
|
||||
if (boat == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
p = new Point3D(p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z);
|
||||
|
||||
|
|
@ -146,10 +167,14 @@ namespace Server.Multis
|
|||
var keyValue = boat.CreateKeys(from);
|
||||
|
||||
if (boat.PPlank != null)
|
||||
{
|
||||
boat.PPlank.KeyValue = keyValue;
|
||||
}
|
||||
|
||||
if (boat.SPlank != null)
|
||||
{
|
||||
boat.SPlank.KeyValue = keyValue;
|
||||
}
|
||||
|
||||
boat.MoveToWorld(p, map);
|
||||
}
|
||||
|
|
@ -172,18 +197,26 @@ namespace Server.Multis
|
|||
if (o is IPoint3D ip)
|
||||
{
|
||||
if (ip is Item item)
|
||||
{
|
||||
ip = item.GetWorldTop();
|
||||
}
|
||||
|
||||
var p = new Point3D(ip);
|
||||
|
||||
var region = Region.Find(p, from.Map);
|
||||
|
||||
if (region.IsPartOf<DungeonRegion>())
|
||||
from.SendLocalizedMessage(502488); // You can not place a ship inside a dungeon.
|
||||
{
|
||||
@from.SendLocalizedMessage(502488); // You can not place a ship inside a dungeon.
|
||||
}
|
||||
else if (region.IsPartOf<HouseRegion>() || region.IsPartOf<ChampionSpawnRegion>())
|
||||
from.SendLocalizedMessage(1042549); // A boat may not be placed in this area.
|
||||
{
|
||||
@from.SendLocalizedMessage(1042549); // A boat may not be placed in this area.
|
||||
}
|
||||
else
|
||||
m_Model.OnPlacement(from, p);
|
||||
{
|
||||
m_Model.OnPlacement(@from, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,9 @@ namespace Server.Multis
|
|||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 2)
|
||||
{
|
||||
m_Boat.EndDryDock(m_From);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,9 @@ namespace Server.Items
|
|||
public override bool OnDragDrop(Mobile from, Item item)
|
||||
{
|
||||
if (m_Boat?.Contains(from) != true || m_Boat.IsMoving)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.OnDragDrop(from, item);
|
||||
}
|
||||
|
|
@ -42,7 +44,9 @@ namespace Server.Items
|
|||
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
|
||||
{
|
||||
if (m_Boat?.Contains(from) != true || m_Boat.IsMoving)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.OnDragDropInto(from, item, p);
|
||||
}
|
||||
|
|
@ -50,7 +54,9 @@ namespace Server.Items
|
|||
public override bool CheckItemUse(Mobile from, Item item)
|
||||
{
|
||||
if (item != this && (m_Boat?.Contains(from) != true || m_Boat.IsMoving))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckItemUse(from, item);
|
||||
}
|
||||
|
|
@ -58,7 +64,9 @@ namespace Server.Items
|
|||
public override bool CheckLift(Mobile from, Item item, ref LRReason reject)
|
||||
{
|
||||
if (m_Boat?.Contains(from) != true || m_Boat.IsMoving)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckLift(from, item, ref reject);
|
||||
}
|
||||
|
|
@ -71,11 +79,17 @@ namespace Server.Items
|
|||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (m_Boat?.Contains(from) != true)
|
||||
{
|
||||
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);
|
||||
{
|
||||
base.OnDoubleClick(@from);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
|
|
@ -100,7 +114,9 @@ namespace Server.Items
|
|||
m_Boat = reader.ReadItem() as BaseBoat;
|
||||
|
||||
if (m_Boat == null || Parent != null)
|
||||
{
|
||||
Delete();
|
||||
}
|
||||
|
||||
Movable = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,9 @@ namespace Server.Items
|
|||
KeyValue = reader.ReadUInt();
|
||||
|
||||
if (Boat == null)
|
||||
{
|
||||
Delete();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -93,6 +95,7 @@ namespace Server.Items
|
|||
public void SetFacing(Direction dir)
|
||||
{
|
||||
if (IsOpen)
|
||||
{
|
||||
ItemID = dir switch
|
||||
{
|
||||
Direction.North => Starboard ? 0x3ED4 : 0x3ED5,
|
||||
|
|
@ -101,7 +104,9 @@ namespace Server.Items
|
|||
Direction.West => Starboard ? 0x3E89 : 0x3E84,
|
||||
_ => ItemID
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemID = dir switch
|
||||
{
|
||||
Direction.North => Starboard ? 0x3EB2 : 0x3EB1,
|
||||
|
|
@ -110,12 +115,15 @@ namespace Server.Items
|
|||
Direction.West => Starboard ? 0x3E8A : 0x3E85,
|
||||
_ => ItemID
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public void Open()
|
||||
{
|
||||
if (IsOpen || Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_CloseTimer?.Stop();
|
||||
|
||||
|
|
@ -139,26 +147,40 @@ namespace Server.Items
|
|||
if (IsOpen)
|
||||
{
|
||||
if (from is BaseFactionGuard)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((from.Direction & Direction.Running) != 0 || Boat?.Contains(from) == false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var map = Map;
|
||||
|
||||
if (map == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int rx = 0, ry = 0;
|
||||
|
||||
if (ItemID == 0x3ED4)
|
||||
{
|
||||
rx = 1;
|
||||
}
|
||||
else if (ItemID == 0x3ED5)
|
||||
{
|
||||
rx = -1;
|
||||
}
|
||||
else if (ItemID == 0x3E84)
|
||||
{
|
||||
ry = 1;
|
||||
}
|
||||
else if (ItemID == 0x3E89)
|
||||
{
|
||||
ry = -1;
|
||||
}
|
||||
|
||||
for (var i = 1; i <= 6; ++i)
|
||||
{
|
||||
|
|
@ -174,7 +196,9 @@ namespace Server.Items
|
|||
!Region.Find(new Point3D(x, y, z), map).IsPartOf<StrongholdRegion>())
|
||||
{
|
||||
if (i == 1 && j >= -2 && j <= 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
from.Location = new Point3D(x, y, z);
|
||||
return false;
|
||||
|
|
@ -187,7 +211,9 @@ namespace Server.Items
|
|||
!Region.Find(new Point3D(x, y, z), map).IsPartOf<StrongholdRegion>())
|
||||
{
|
||||
if (i == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
from.Location = new Point3D(x, y, z);
|
||||
return false;
|
||||
|
|
@ -205,7 +231,9 @@ namespace Server.Items
|
|||
public void Close()
|
||||
{
|
||||
if (!IsOpen || !CanClose() || Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_CloseTimer?.Stop();
|
||||
|
||||
|
|
@ -231,16 +259,22 @@ namespace Server.Items
|
|||
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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -93,7 +93,9 @@ namespace Server.Misc
|
|||
var map = from.Map;
|
||||
|
||||
if (map == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var surface = map.GetTopSurface(from.Location);
|
||||
|
||||
|
|
@ -118,22 +120,34 @@ namespace Server.Misc
|
|||
public static void EventSink_Login(Mobile from)
|
||||
{
|
||||
if (!IsStranded(from))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var map = from.Map;
|
||||
|
||||
Point2D[] list;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
var p = Point2D.Zero;
|
||||
var pdist = double.MaxValue;
|
||||
|
|
@ -157,20 +171,28 @@ namespace Server.Misc
|
|||
canFit = map.CanSpawnMobile(x, y, z);
|
||||
|
||||
for (var i = 1; !canFit && i <= 40; i += 2)
|
||||
{
|
||||
for (var xo = -1; !canFit && xo <= 1; ++xo)
|
||||
{
|
||||
for (var 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);
|
||||
{
|
||||
@from.Location = new Point3D(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,31 +49,45 @@ namespace Server.Items
|
|||
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~
|
||||
{
|
||||
LabelTo(@from, 1042884, m_Boat.ShipName); // the tiller man of the ~1_SHIP_NAME~
|
||||
}
|
||||
else
|
||||
base.OnSingleClick(from);
|
||||
{
|
||||
base.OnSingleClick(@from);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (m_Boat?.Contains(from) == true)
|
||||
m_Boat.BeginRename(from);
|
||||
{
|
||||
m_Boat.BeginRename(@from);
|
||||
}
|
||||
else
|
||||
m_Boat?.BeginDryDock(from);
|
||||
{
|
||||
m_Boat?.BeginDryDock(@from);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
if (dropped is MapItem item && m_Boat?.CanCommand(from) == true && m_Boat.Contains(from))
|
||||
{
|
||||
m_Boat.AssociateMap(item);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -105,7 +119,9 @@ namespace Server.Items
|
|||
m_Boat = reader.ReadItem() as BaseBoat;
|
||||
|
||||
if (m_Boat == null)
|
||||
{
|
||||
Delete();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,9 @@ namespace Server.Multis
|
|||
public void CheckAddComponents()
|
||||
{
|
||||
if (Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AddComponents();
|
||||
}
|
||||
|
|
@ -56,12 +58,16 @@ namespace Server.Multis
|
|||
public virtual void RefreshDecay(bool setDecayTime)
|
||||
{
|
||||
if (Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_DecayTimer?.Stop();
|
||||
|
||||
if (setDecayTime)
|
||||
{
|
||||
m_DecayTime = DateTime.UtcNow + DecayDelay;
|
||||
}
|
||||
|
||||
m_DecayTimer = Timer.DelayCall(DecayDelay, Delete);
|
||||
}
|
||||
|
|
@ -88,7 +94,9 @@ namespace Server.Multis
|
|||
}
|
||||
|
||||
if (m is BaseVendor)
|
||||
{
|
||||
m.Direction = Direction.South;
|
||||
}
|
||||
|
||||
m.MoveToWorld(loc, Map);
|
||||
}
|
||||
|
|
@ -109,9 +117,13 @@ namespace Server.Multis
|
|||
var inNewRange = Utility.InRange(m.Location, Location, EventRange);
|
||||
|
||||
if (inNewRange && !inOldRange)
|
||||
{
|
||||
OnEnter(m);
|
||||
}
|
||||
else if (inOldRange && !inNewRange)
|
||||
{
|
||||
OnExit(m);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
|
|
@ -119,16 +131,22 @@ namespace Server.Multis
|
|||
base.OnAfterDelete();
|
||||
|
||||
for (var i = 0; i < m_Items.Count; ++i)
|
||||
{
|
||||
m_Items[i].Delete();
|
||||
}
|
||||
|
||||
for (var i = 0; i < m_Mobiles.Count; ++i)
|
||||
{
|
||||
var bc = (BaseCreature)m_Mobiles[i];
|
||||
|
||||
if (bc.IsPrisoner == false)
|
||||
{
|
||||
m_Mobiles[i].Delete();
|
||||
}
|
||||
else if (m_Mobiles[i].CantWalk)
|
||||
{
|
||||
m_Mobiles[i].Delete();
|
||||
}
|
||||
}
|
||||
|
||||
m_Items.Clear();
|
||||
|
|
@ -191,7 +209,9 @@ namespace Server.Multis
|
|||
var version = reader.ReadInt();
|
||||
|
||||
if (Weight == 8.0)
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,10 @@ namespace Server.Multis
|
|||
|
||||
AddCampChests();
|
||||
|
||||
for (var i = 0; i < 4; i++) AddMobile(Brigands, 6, Utility.RandomMinMax(-7, 7), Utility.RandomMinMax(-7, 7), 0);
|
||||
for (var i = 0; i < 4; i++)
|
||||
{
|
||||
AddMobile(Brigands, 6, Utility.RandomMinMax(-7, 7), Utility.RandomMinMax(-7, 7), 0);
|
||||
}
|
||||
|
||||
BaseCreature bc = Utility.Random(2) switch
|
||||
{
|
||||
|
|
@ -147,7 +150,9 @@ namespace Server.Multis
|
|||
public override void AddItem(Item item, int xOffset, int yOffset, int zOffset)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
item.Movable = false;
|
||||
}
|
||||
|
||||
base.AddItem(item, xOffset, yOffset, zOffset);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,10 @@ namespace Server.Multis
|
|||
|
||||
AddCampChests();
|
||||
|
||||
for (var i = 0; i < 4; i++) AddMobile(Lizardmen, 6, Utility.RandomMinMax(-7, 7), Utility.RandomMinMax(-7, 7), 0);
|
||||
for (var i = 0; i < 4; i++)
|
||||
{
|
||||
AddMobile(Lizardmen, 6, Utility.RandomMinMax(-7, 7), Utility.RandomMinMax(-7, 7), 0);
|
||||
}
|
||||
|
||||
m_Prisoner = Utility.Random(2) switch
|
||||
{
|
||||
|
|
@ -111,6 +114,7 @@ namespace Server.Multis
|
|||
crates.LiftOverride = true;
|
||||
|
||||
if (Utility.RandomDouble() < 0.8)
|
||||
{
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
case 0:
|
||||
|
|
@ -126,6 +130,7 @@ namespace Server.Multis
|
|||
crates.DropItem(new LesserPoisonPotion());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AddItem(crates, -2, 2, 0);
|
||||
}
|
||||
|
|
@ -159,7 +164,9 @@ namespace Server.Multis
|
|||
public override void AddItem(Item item, int xOffset, int yOffset, int zOffset)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
item.Movable = false;
|
||||
}
|
||||
|
||||
base.AddItem(item, xOffset, yOffset, zOffset);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,11 @@ namespace Server.Multis
|
|||
|
||||
AddCampChests();
|
||||
|
||||
for (var i = 0; i < 3; i++) AddMobile(Orcs, 6, Utility.RandomMinMax(-7, 7), Utility.RandomMinMax(-7, 7), 0);
|
||||
for (var 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);
|
||||
|
||||
m_Prisoner = Utility.Random(2) switch
|
||||
|
|
@ -112,6 +116,7 @@ namespace Server.Multis
|
|||
crates.LiftOverride = true;
|
||||
|
||||
if (Utility.RandomDouble() < 0.8)
|
||||
{
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
case 0:
|
||||
|
|
@ -127,6 +132,7 @@ namespace Server.Multis
|
|||
crates.DropItem(new LesserPoisonPotion());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AddItem(crates, 2, -2, 0);
|
||||
}
|
||||
|
|
@ -160,7 +166,9 @@ namespace Server.Multis
|
|||
public override void AddItem(Item item, int xOffset, int yOffset, int zOffset)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
item.Movable = false;
|
||||
}
|
||||
|
||||
base.AddItem(item, xOffset, yOffset, zOffset);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,10 @@ namespace Server.Multis
|
|||
|
||||
AddCampChests();
|
||||
|
||||
for (var i = 0; i < 4; i++) AddMobile(Ratmen, 6, Utility.RandomMinMax(-7, 7), Utility.RandomMinMax(-7, 7), 0);
|
||||
for (var i = 0; i < 4; i++)
|
||||
{
|
||||
AddMobile(Ratmen, 6, Utility.RandomMinMax(-7, 7), Utility.RandomMinMax(-7, 7), 0);
|
||||
}
|
||||
|
||||
m_Prisoner = Utility.Random(2) switch
|
||||
{
|
||||
|
|
@ -111,6 +114,7 @@ namespace Server.Multis
|
|||
crates.LiftOverride = true;
|
||||
|
||||
if (Utility.RandomDouble() < 0.8)
|
||||
{
|
||||
switch (Utility.Random(4))
|
||||
{
|
||||
case 0:
|
||||
|
|
@ -126,6 +130,7 @@ namespace Server.Multis
|
|||
crates.DropItem(new LesserPoisonPotion());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AddItem(crates, 2, 2, 0);
|
||||
}
|
||||
|
|
@ -159,7 +164,9 @@ namespace Server.Multis
|
|||
public override void AddItem(Item item, int xOffset, int yOffset, int zOffset)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
item.Movable = false;
|
||||
}
|
||||
|
||||
base.AddItem(item, xOffset, yOffset, zOffset);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,9 @@ namespace Server.Multis
|
|||
var table = new int[length];
|
||||
|
||||
for (var i = 0; i < table.Length; ++i)
|
||||
{
|
||||
table[i] = -1;
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
|
@ -162,7 +164,9 @@ namespace Server.Multis
|
|||
var tileCIDs = new int[tileColumns.Length];
|
||||
|
||||
for (var i = 0; i < tileColumns.Length; ++i)
|
||||
{
|
||||
tileCIDs[i] = ss.GetColumnID(tileColumns[i]);
|
||||
}
|
||||
|
||||
var featureCID = ss.GetColumnID("FeatureMask");
|
||||
|
||||
|
|
@ -177,7 +181,9 @@ namespace Server.Multis
|
|||
var itemID = record.GetInt32(tileCIDs[j]);
|
||||
|
||||
if (itemID <= 0 || itemID >= table.Length)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
table[itemID] = fid;
|
||||
}
|
||||
|
|
@ -198,7 +204,9 @@ namespace Server.Multis
|
|||
m_Columns = new ColumnInfo[types.Length];
|
||||
|
||||
for (var i = 0; i < m_Columns.Length; ++i)
|
||||
{
|
||||
m_Columns[i] = new ColumnInfo(i, types[i], names[i]);
|
||||
}
|
||||
|
||||
var records = new List<DataRecord>();
|
||||
|
||||
|
|
@ -238,8 +246,12 @@ namespace Server.Multis
|
|||
public int GetColumnID(string name)
|
||||
{
|
||||
for (var i = 0; i < m_Columns.Length; ++i)
|
||||
{
|
||||
if (m_Columns[i].m_Name == name)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -249,8 +261,12 @@ namespace Server.Multis
|
|||
string line;
|
||||
|
||||
while ((line = ip.ReadLine()) != null)
|
||||
{
|
||||
if (line.Length > 0)
|
||||
{
|
||||
return line.Split('\t');
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,26 +14,38 @@ namespace Server.Multis.Deeds
|
|||
if (o is IPoint3D ip)
|
||||
{
|
||||
if (ip is Item item)
|
||||
{
|
||||
ip = item.GetWorldTop();
|
||||
}
|
||||
|
||||
var p = new Point3D(ip);
|
||||
|
||||
var reg = Region.Find(new Point3D(p), from.Map);
|
||||
|
||||
if (from.AccessLevel >= AccessLevel.GameMaster || reg.AllowHousing(from, p))
|
||||
m_Deed.OnPlacement(from, p);
|
||||
{
|
||||
m_Deed.OnPlacement(@from, p);
|
||||
}
|
||||
else if (reg.IsPartOf<TempNoHousingRegion>())
|
||||
from.SendLocalizedMessage(
|
||||
{
|
||||
@from.SendLocalizedMessage(
|
||||
501270
|
||||
); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
|
||||
}
|
||||
else if (reg.IsPartOf<TreasureRegion>() || reg.IsPartOf<HouseRegion>())
|
||||
from.SendLocalizedMessage(
|
||||
{
|
||||
@from.SendLocalizedMessage(
|
||||
1043287
|
||||
); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
|
||||
}
|
||||
else if (reg.IsPartOf<HouseRaffleRegion>())
|
||||
from.SendLocalizedMessage(1150493); // You must have a deed for this plot of land in order to build here.
|
||||
{
|
||||
@from.SendLocalizedMessage(1150493); // You must have a deed for this plot of land in order to build here.
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage(501265); // Housing can not be created in this area.
|
||||
{
|
||||
@from.SendLocalizedMessage(501265); // Housing can not be created in this area.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -95,7 +107,9 @@ namespace Server.Multis.Deeds
|
|||
}
|
||||
|
||||
if (Weight == 0.0)
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
|
|
@ -124,7 +138,9 @@ namespace Server.Multis.Deeds
|
|||
public void OnPlacement(Mobile from, Point3D p)
|
||||
{
|
||||
if (Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
|
|
@ -152,9 +168,13 @@ namespace Server.Multis.Deeds
|
|||
object o = toMove[i];
|
||||
|
||||
if (o is Mobile mobile)
|
||||
{
|
||||
mobile.Location = house.BanLocation;
|
||||
}
|
||||
else if (o is Item item)
|
||||
{
|
||||
item.Location = house.BanLocation;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,9 @@ namespace Server.Multis
|
|||
public static TimeSpan GetRandomDuration(DecayLevel level)
|
||||
{
|
||||
if (!m_Stages.TryGetValue(level, out var info))
|
||||
{
|
||||
return TimeSpan.Zero;
|
||||
}
|
||||
|
||||
var min = info.MinDuration.Ticks;
|
||||
var max = info.MaxDuration.Ticks;
|
||||
|
|
|
|||
|
|
@ -44,25 +44,37 @@ namespace Server.Multis
|
|||
var map = from.Map;
|
||||
|
||||
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 (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 (Region.Find(center, map).IsPartOf<NoHousingRegion>())
|
||||
{
|
||||
return HousePlacementResult.BadRegion;
|
||||
}
|
||||
|
||||
// This holds data describing the internal structure of the house
|
||||
var mcl = MultiData.GetComponents(multiID);
|
||||
|
||||
if (multiID >= 0x13EC && multiID < 0x1D00)
|
||||
{
|
||||
HouseFoundation.AddStairsTo(ref mcl); // this is a AOS house, add the stairs
|
||||
}
|
||||
|
||||
// Location of the nortwest-most corner of the house
|
||||
var start = new Point3D(center.X + mcl.Min.X, center.Y + mcl.Min.Y, center.Z);
|
||||
|
|
@ -84,6 +96,7 @@ namespace Server.Multis
|
|||
*/
|
||||
|
||||
for (var x = 0; x < mcl.Width; ++x)
|
||||
{
|
||||
for (var y = 0; y < mcl.Height; ++y)
|
||||
{
|
||||
var tileX = start.X + x;
|
||||
|
|
@ -92,22 +105,30 @@ namespace Server.Multis
|
|||
var addTiles = mcl.Tiles[x][y];
|
||||
|
||||
if (addTiles.Length == 0)
|
||||
{
|
||||
continue; // There are no tiles here, continue checking somewhere else
|
||||
}
|
||||
|
||||
var testPoint = new Point3D(tileX, tileY, center.Z);
|
||||
|
||||
var reg = Region.Find(testPoint, map);
|
||||
|
||||
if (!reg.AllowHousing(from, testPoint)) // Cannot place houses in dungeons, towns, treasure map areas etc
|
||||
if (!reg.AllowHousing(@from, testPoint)) // Cannot place houses in dungeons, towns, treasure map areas etc
|
||||
{
|
||||
if (reg.IsPartOf<TempNoHousingRegion>())
|
||||
{
|
||||
return HousePlacementResult.BadRegionTemp;
|
||||
}
|
||||
|
||||
if (reg.IsPartOf<TreasureRegion>() || reg.IsPartOf<HouseRegion>())
|
||||
{
|
||||
return HousePlacementResult.BadRegionHidden;
|
||||
}
|
||||
|
||||
if (reg.IsPartOf<HouseRaffleRegion>())
|
||||
{
|
||||
return HousePlacementResult.BadRegionRaffle;
|
||||
}
|
||||
|
||||
return HousePlacementResult.BadRegion;
|
||||
}
|
||||
|
|
@ -126,7 +147,9 @@ namespace Server.Multis
|
|||
var item = sector.Items[i];
|
||||
|
||||
if (item.Visible && item.X == tileX && item.Y == tileY)
|
||||
{
|
||||
items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
mobiles.Clear();
|
||||
|
|
@ -136,7 +159,9 @@ namespace Server.Multis
|
|||
var m = sector.Mobiles[i];
|
||||
|
||||
if (m.X == tileX && m.Y == tileY)
|
||||
{
|
||||
mobiles.Add(m);
|
||||
}
|
||||
}
|
||||
|
||||
int landStartZ = 0, landAvgZ = 0, landTopZ = 0;
|
||||
|
|
@ -150,7 +175,9 @@ namespace Server.Multis
|
|||
var addTile = addTiles[i];
|
||||
|
||||
if (addTile.ID == 0x1) // Nodraw
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var addTileFlags = TileData.ItemTable[addTile.ID & TileData.MaxItemValue].Flags;
|
||||
|
||||
|
|
@ -158,21 +185,29 @@ namespace Server.Multis
|
|||
var hasSurface = false;
|
||||
|
||||
if (isFoundation)
|
||||
{
|
||||
hasFoundation = true;
|
||||
}
|
||||
|
||||
var addTileZ = center.Z + addTile.Z;
|
||||
var addTileTop = addTileZ + addTile.Height;
|
||||
|
||||
if ((addTileFlags & TileFlag.Surface) != 0)
|
||||
{
|
||||
addTileTop += 16;
|
||||
}
|
||||
|
||||
if (addTileTop > landStartZ && landAvgZ > addTileZ)
|
||||
{
|
||||
return HousePlacementResult.BadLand; // Broke rule #2
|
||||
}
|
||||
|
||||
if (isFoundation &&
|
||||
(TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Impassable) == 0 &&
|
||||
landAvgZ == center.Z)
|
||||
{
|
||||
hasSurface = true;
|
||||
}
|
||||
|
||||
for (var j = 0; j < oldTiles.Length; ++j)
|
||||
{
|
||||
|
|
@ -181,7 +216,10 @@ namespace Server.Multis
|
|||
|
||||
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;*/
|
||||
}
|
||||
|
|
@ -194,9 +232,13 @@ namespace Server.Multis
|
|||
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)
|
||||
|
|
@ -206,37 +248,52 @@ namespace Server.Multis
|
|||
}
|
||||
|
||||
if (isFoundation && !hasSurface)
|
||||
{
|
||||
return HousePlacementResult.NoSurface; // Broke rule #4
|
||||
}
|
||||
|
||||
for (var j = 0; j < mobiles.Count; ++j)
|
||||
{
|
||||
var m = mobiles[j];
|
||||
|
||||
if (addTileTop > m.Z && m.Z + 16 > addTileZ)
|
||||
{
|
||||
toMove.Add(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var 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 (var xOffset = -1; xOffset <= 1; ++xOffset)
|
||||
{
|
||||
for (var yOffset = -YardSize; yOffset <= YardSize; ++yOffset)
|
||||
{
|
||||
var yardPoint = new Point2D(tileX + xOffset, tileY + yOffset);
|
||||
|
||||
if (!yard.Contains(yardPoint))
|
||||
{
|
||||
yard.Add(yardPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var xOffset = -1; xOffset <= 1; ++xOffset)
|
||||
{
|
||||
for (var 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)
|
||||
|
||||
|
|
@ -254,20 +311,28 @@ namespace Server.Multis
|
|||
|
||||
if (breakTile.Height == 0 && breakTile.Z <= 8 &&
|
||||
TileData.ItemTable[breakTile.ID & TileData.MaxItemValue].Surface)
|
||||
{
|
||||
shouldBreak = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldBreak)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
var borderPoint = new Point2D(tileX + xOffset, tileY + yOffset);
|
||||
|
||||
if (!borders.Contains(borderPoint))
|
||||
{
|
||||
borders.Add(borderPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < borders.Count; ++i)
|
||||
{
|
||||
|
|
@ -277,11 +342,17 @@ namespace Server.Multis
|
|||
var landID = landTile.ID & TileData.MaxLandValue;
|
||||
|
||||
if ((TileData.LandTable[landID].Flags & TileFlag.Impassable) != 0)
|
||||
{
|
||||
return HousePlacementResult.BadLand;
|
||||
}
|
||||
|
||||
for (var j = 0; j < m_RoadIDs.Length; j += 2)
|
||||
{
|
||||
if (landID >= m_RoadIDs[j] && landID <= m_RoadIDs[j + 1])
|
||||
{
|
||||
return HousePlacementResult.BadLand; // Broke rule #5
|
||||
}
|
||||
}
|
||||
|
||||
var tiles = map.Tiles.GetStaticTiles(borderPoint.X, borderPoint.Y, true);
|
||||
|
||||
|
|
@ -292,7 +363,9 @@ namespace Server.Multis
|
|||
|
||||
if (id.Impassable || id.Surface && (id.Flags & TileFlag.Background) == 0 &&
|
||||
tile.Z + id.CalcHeight > center.Z + 2)
|
||||
{
|
||||
return HousePlacementResult.BadStatic; // Broke rule #1
|
||||
}
|
||||
}
|
||||
|
||||
var sector = map.GetSector(borderPoint.X, borderPoint.Y);
|
||||
|
|
@ -303,13 +376,17 @@ namespace Server.Multis
|
|||
var item = sectorItems[j];
|
||||
|
||||
if (item.X != borderPoint.X || item.Y != borderPoint.Y || item.Movable)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -325,18 +402,29 @@ namespace Server.Multis
|
|||
_sectors.Add(sector);
|
||||
|
||||
for (var j = 0; j < sector.Multis?.Count; j++)
|
||||
{
|
||||
if (sector.Multis[j] is BaseHouse)
|
||||
{
|
||||
var _house = (BaseHouse)sector.Multis[j];
|
||||
if (!_houses.Contains(_house)) _houses.Add(_house);
|
||||
if (!_houses.Contains(_house))
|
||||
{
|
||||
_houses.Add(_house);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < yard.Count; ++i)
|
||||
{
|
||||
foreach (var 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 );
|
||||
|
|
|
|||
|
|
@ -29,9 +29,13 @@ namespace Server.Items
|
|||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack))
|
||||
from.SendGump(new HousePlacementCategoryGump(from));
|
||||
{
|
||||
@from.SendGump(new HousePlacementCategoryGump(@from));
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
{
|
||||
@from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
|
|
@ -48,7 +52,9 @@ namespace Server.Items
|
|||
var version = reader.ReadInt();
|
||||
|
||||
if (Weight == 0.0)
|
||||
{
|
||||
Weight = 3.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -90,7 +96,9 @@ namespace Server.Items
|
|||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (!m_From.CheckAlive() || m_From.Backpack?.FindItemByType<HousePlacementTool>() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
|
|
@ -198,16 +206,22 @@ namespace Server.Items
|
|||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (!m_From.CheckAlive() || m_From.Backpack?.FindItemByType<HousePlacementTool>() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var index = info.ButtonID - 1;
|
||||
|
||||
if (index >= 0 && index < m_Entries.Length)
|
||||
{
|
||||
if (m_From.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse(m_From))
|
||||
{
|
||||
m_From.SendLocalizedMessage(501271); // You already own a house, you may not place another!
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.Target = new NewHousePlacementTarget(m_Entries, m_Entries[index]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -237,41 +251,59 @@ namespace Server.Items
|
|||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (!from.CheckAlive() || from.Backpack?.FindItemByType<HousePlacementTool>() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (o is IPoint3D ip)
|
||||
{
|
||||
if (ip is Item item)
|
||||
{
|
||||
ip = item.GetWorldTop();
|
||||
}
|
||||
|
||||
var p = new Point3D(ip);
|
||||
|
||||
var reg = Region.Find(new Point3D(p), from.Map);
|
||||
|
||||
if (from.AccessLevel >= AccessLevel.GameMaster || reg.AllowHousing(from, p))
|
||||
m_Placed = m_Entry.OnPlacement(from, p);
|
||||
{
|
||||
m_Placed = m_Entry.OnPlacement(@from, p);
|
||||
}
|
||||
else if (reg.IsPartOf<TempNoHousingRegion>())
|
||||
from.SendLocalizedMessage(
|
||||
{
|
||||
@from.SendLocalizedMessage(
|
||||
501270
|
||||
); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
|
||||
}
|
||||
else if (reg.IsPartOf<TreasureRegion>() || reg.IsPartOf<HouseRegion>())
|
||||
from.SendLocalizedMessage(
|
||||
{
|
||||
@from.SendLocalizedMessage(
|
||||
1043287
|
||||
); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
|
||||
}
|
||||
else if (reg.IsPartOf<HouseRaffleRegion>())
|
||||
from.SendLocalizedMessage(1150493); // You must have a deed for this plot of land in order to build here.
|
||||
{
|
||||
@from.SendLocalizedMessage(1150493); // You must have a deed for this plot of land in order to build here.
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage(501265); // Housing can not be created in this area.
|
||||
{
|
||||
@from.SendLocalizedMessage(501265); // Housing can not be created in this area.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
if (!from.CheckAlive() || from.Backpack?.FindItemByType<HousePlacementTool>() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_Placed)
|
||||
from.SendGump(new HousePlacementListGump(from, m_Entries));
|
||||
{
|
||||
@from.SendGump(new HousePlacementListGump(@from, m_Entries));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1927,11 +1959,17 @@ namespace Server.Items
|
|||
object[] args;
|
||||
|
||||
if (Type == typeof(HouseFoundation))
|
||||
args = new object[] { from, MultiID, m_Storage, m_Lockdowns };
|
||||
{
|
||||
args = new object[] { @from, MultiID, m_Storage, m_Lockdowns };
|
||||
}
|
||||
else if (Type == typeof(SmallOldHouse) || Type == typeof(SmallShop) || Type == typeof(TwoStoryHouse))
|
||||
args = new object[] { from, MultiID };
|
||||
{
|
||||
args = new object[] { @from, MultiID };
|
||||
}
|
||||
else
|
||||
args = new object[] { from };
|
||||
{
|
||||
args = new object[] { @from };
|
||||
}
|
||||
|
||||
return ActivatorUtil.CreateInstance(Type, args) as BaseHouse;
|
||||
}
|
||||
|
|
@ -1946,7 +1984,9 @@ namespace Server.Items
|
|||
public void PlacementWarning_Callback(Mobile from, bool okay, PreviewHouse prevHouse)
|
||||
{
|
||||
if (!from.CheckAlive() || from.Backpack?.FindItemByType<HousePlacementTool>() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!okay)
|
||||
{
|
||||
|
|
@ -1984,7 +2024,9 @@ namespace Server.Items
|
|||
var house = ConstructHouse(from);
|
||||
|
||||
if (house == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
house.Price = Cost;
|
||||
|
||||
|
|
@ -2022,9 +2064,13 @@ namespace Server.Items
|
|||
object o = toMove[i];
|
||||
|
||||
if (o is Mobile mobile)
|
||||
{
|
||||
mobile.Location = house.BanLocation;
|
||||
}
|
||||
else if (o is Item item)
|
||||
{
|
||||
item.Location = house.BanLocation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2071,7 +2117,9 @@ namespace Server.Items
|
|||
public bool OnPlacement(Mobile from, Point3D p)
|
||||
{
|
||||
if (!from.CheckAlive() || from.Backpack?.FindItemByType<HousePlacementTool>() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var center = new Point3D(p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z);
|
||||
var res = HousePlacement.Check(from, MultiID, center, out var toMove);
|
||||
|
|
@ -2112,9 +2160,13 @@ namespace Server.Items
|
|||
object o = toMove[i];
|
||||
|
||||
if (o is Mobile mobile)
|
||||
{
|
||||
mobile.Location = banLoc;
|
||||
}
|
||||
else if (o is Item item)
|
||||
{
|
||||
item.Location = banLoc;
|
||||
}
|
||||
}
|
||||
|
||||
prev.MoveToWorld(center, from.Map);
|
||||
|
|
@ -2193,13 +2245,19 @@ namespace Server.Items
|
|||
m_Table.TryGetValue(house.GetType(), out var obj);
|
||||
|
||||
if (obj is HousePlacementEntry entry)
|
||||
{
|
||||
return entry;
|
||||
}
|
||||
|
||||
if (obj is List<HousePlacementEntry> list)
|
||||
{
|
||||
return list.FirstOrDefault(e => e.MultiID == house.ItemID);
|
||||
}
|
||||
|
||||
if (obj is Dictionary<int, HousePlacementEntry> table)
|
||||
{
|
||||
return table[house.ItemID];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -2227,7 +2285,9 @@ namespace Server.Items
|
|||
var table = new Dictionary<int, HousePlacementEntry>();
|
||||
|
||||
foreach (var t in list)
|
||||
{
|
||||
table[t.MultiID] = t;
|
||||
}
|
||||
|
||||
table[e.MultiID] = e;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@ namespace Server.Multis
|
|||
set
|
||||
{
|
||||
if (Owner != null)
|
||||
{
|
||||
Owner.RestrictDecay = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -45,7 +47,9 @@ namespace Server.Multis
|
|||
base.OnAfterDelete();
|
||||
|
||||
if (Owner?.Deleted == false)
|
||||
{
|
||||
Owner.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
|
|
@ -75,7 +79,9 @@ namespace Server.Multis
|
|||
else if (level != DecayLevel.Ageless)
|
||||
{
|
||||
if (level == DecayLevel.Collapsed)
|
||||
{
|
||||
level = DecayLevel.IDOC;
|
||||
}
|
||||
|
||||
list.Add(1062028, $"#{1043009 + (int)level}"); // Condition: This structure is ...
|
||||
}
|
||||
|
|
@ -110,16 +116,24 @@ namespace Server.Multis
|
|||
if (Owner.IsFriend(m) && m.AccessLevel < AccessLevel.GameMaster)
|
||||
{
|
||||
if (Core.ML && Owner.IsOwner(m) || !Core.ML)
|
||||
{
|
||||
Owner.RefreshDecay();
|
||||
}
|
||||
|
||||
if (!Core.AOS)
|
||||
{
|
||||
m.SendLocalizedMessage(501293); // Welcome back to the house, friend!
|
||||
}
|
||||
}
|
||||
|
||||
if (Owner.IsAosRules)
|
||||
{
|
||||
m.SendGump(new HouseGumpAOS(HouseGumpPageAOS.Information, m, Owner));
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendGump(new HouseGump(m, Owner));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -142,7 +156,9 @@ namespace Server.Multis
|
|||
public override void OnDoubleClick(Mobile m)
|
||||
{
|
||||
if (Owner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m.AccessLevel < AccessLevel.GameMaster && Owner.Owner == null &&
|
||||
Owner.DecayLevel != DecayLevel.DemolitionPending)
|
||||
|
|
@ -150,9 +166,11 @@ namespace Server.Multis
|
|||
var canClaim = Owner?.CoOwners.Count > 0 && Owner.IsCoOwner(m) || Owner.IsFriend(m);
|
||||
|
||||
if (canClaim && !BaseHouse.HasAccountHouse(m))
|
||||
{
|
||||
m.SendGump(
|
||||
new WarningGump(501036, 32512, 1049719, 32512, 420, 280, okay => ClaimGump_Callback(m, okay))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ShowSign(m);
|
||||
|
|
@ -163,13 +181,19 @@ namespace Server.Multis
|
|||
base.GetContextMenuEntries(from, list);
|
||||
|
||||
if (!BaseHouse.NewVendorSystem || !from.Alive || Owner?.IsAosRules != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Owner.AreThereAvailableVendorsFor(from))
|
||||
{
|
||||
list.Add(new VendorsEntry(this));
|
||||
}
|
||||
|
||||
if (Owner.VendorInventories.Count > 0)
|
||||
{
|
||||
list.Add(new ReclaimVendorInventoryEntry(this));
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
|
|
@ -200,7 +224,9 @@ namespace Server.Multis
|
|||
}
|
||||
|
||||
if (Name == "a house sign")
|
||||
{
|
||||
Name = null;
|
||||
}
|
||||
}
|
||||
|
||||
private class VendorsEntry : ContextMenuEntry
|
||||
|
|
@ -214,14 +240,20 @@ namespace Server.Multis
|
|||
var from = Owner.From;
|
||||
|
||||
if (!from.CheckAlive() || m_Sign.Deleted || m_Sign.Owner?.AreThereAvailableVendorsFor(from) != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (from.Map != m_Sign.Map || !from.InRange(m_Sign, 5))
|
||||
from.SendLocalizedMessage(
|
||||
{
|
||||
@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));
|
||||
{
|
||||
@from.SendGump(new HouseGumpAOS(HouseGumpPageAOS.Vendors, @from, m_Sign.Owner));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -237,7 +269,9 @@ namespace Server.Multis
|
|||
|
||||
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))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,7 +43,9 @@ namespace Server.Items
|
|||
if (CheckAccess(m))
|
||||
{
|
||||
if (!m.Hidden || m.AccessLevel == AccessLevel.Player)
|
||||
{
|
||||
new EffectTimer(Location, Map, 2023, 0x1F0, TimeSpan.FromSeconds(0.4)).Start();
|
||||
}
|
||||
|
||||
new DelayTimer(this, m).Start();
|
||||
}
|
||||
|
|
@ -91,7 +93,9 @@ namespace Server.Items
|
|||
Target = reader.ReadItem();
|
||||
|
||||
if (version < 1)
|
||||
{
|
||||
Level = SecureLevel.Anyone;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -125,7 +129,9 @@ namespace Server.Items
|
|||
);
|
||||
|
||||
if (m_SoundID != -1)
|
||||
{
|
||||
Effects.PlaySound(m_Location, m_Map, m_SoundID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -145,12 +151,16 @@ namespace Server.Items
|
|||
var target = m_Teleporter.Target;
|
||||
|
||||
if (target?.Deleted != false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var m = m_Mobile;
|
||||
|
||||
if (m.Location != m_Teleporter.Location || m.Map != m_Teleporter.Map)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var p = target.GetWorldTop();
|
||||
var map = target.Map;
|
||||
|
|
@ -160,7 +170,9 @@ namespace Server.Items
|
|||
m.MoveToWorld(p, map);
|
||||
|
||||
if (m.Hidden && m.AccessLevel != AccessLevel.Player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Effects.PlaySound(target.Location, target.Map, 0x1FE);
|
||||
|
||||
|
|
|
|||
|
|
@ -539,7 +539,9 @@ namespace Server.Multis
|
|||
door.KeyValue = keyValue;
|
||||
|
||||
if (door is BaseHouseDoor houseDoor)
|
||||
{
|
||||
houseDoor.Facing = DoorFacing.EastCCW;
|
||||
}
|
||||
|
||||
AddDoor(door, -2, 0, id == 0xA2 ? 24 : 27);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ namespace Server.Multis
|
|||
{
|
||||
// 1. Try to stack the item
|
||||
foreach (var item in Items)
|
||||
{
|
||||
if (item is PackingBox)
|
||||
{
|
||||
var subItems = item.Items;
|
||||
|
|
@ -59,12 +60,16 @@ namespace Server.Multis
|
|||
var subItem = subItems[i];
|
||||
|
||||
if (!(subItem is Container) && subItem.StackWith(null, dropped, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Try to drop the item into an existing container
|
||||
foreach (var item in Items)
|
||||
{
|
||||
if (item is PackingBox packingBox)
|
||||
{
|
||||
Container box = packingBox;
|
||||
|
|
@ -76,6 +81,7 @@ namespace Server.Multis
|
|||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Drop the item into a new container
|
||||
Container subContainer = new PackingBox();
|
||||
|
|
@ -98,25 +104,37 @@ namespace Server.Multis
|
|||
var positions = new bool[Rows, Columns];
|
||||
|
||||
foreach (var item in Items)
|
||||
{
|
||||
if (item is PackingBox)
|
||||
{
|
||||
var i = (item.Y - Bounds.Y) / VerticalSpacing;
|
||||
if (i < 0)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
else if (i >= Rows)
|
||||
{
|
||||
i = Rows - 1;
|
||||
}
|
||||
|
||||
var j = (item.X - Bounds.X) / HorizontalSpacing;
|
||||
if (j < 0)
|
||||
{
|
||||
j = 0;
|
||||
}
|
||||
else if (j >= Columns)
|
||||
{
|
||||
j = Columns - 1;
|
||||
}
|
||||
|
||||
positions[i, j] = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < Rows; i++)
|
||||
{
|
||||
for (var j = 0; j < Columns; j++)
|
||||
{
|
||||
if (!positions[i, j])
|
||||
{
|
||||
var x = Bounds.X + j * HorizontalSpacing;
|
||||
|
|
@ -124,6 +142,8 @@ namespace Server.Multis
|
|||
|
||||
return new Point3D(x, y, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Point3D.Zero;
|
||||
}
|
||||
|
|
@ -150,7 +170,9 @@ namespace Server.Multis
|
|||
base.OnItemRemoved(item);
|
||||
|
||||
if (TotalItems == 0)
|
||||
{
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public void RestartTimer()
|
||||
|
|
@ -177,16 +199,26 @@ namespace Server.Multis
|
|||
|
||||
var toRemove = new List<Item>();
|
||||
foreach (var item in Items)
|
||||
{
|
||||
if (item is PackingBox && item.Items.Count == 0)
|
||||
{
|
||||
toRemove.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in toRemove)
|
||||
{
|
||||
item.Delete();
|
||||
}
|
||||
|
||||
if (TotalItems == 0)
|
||||
{
|
||||
Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
Internalize();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
|
|
@ -194,7 +226,9 @@ namespace Server.Multis
|
|||
base.OnAfterDelete();
|
||||
|
||||
if (House?.MovingCrate == this)
|
||||
{
|
||||
House.MovingCrate = null;
|
||||
}
|
||||
|
||||
m_InternalizeTimer?.Stop();
|
||||
}
|
||||
|
|
@ -227,7 +261,9 @@ namespace Server.Multis
|
|||
}
|
||||
|
||||
if (version == 0)
|
||||
{
|
||||
MaxItems = -1; // reset to default
|
||||
}
|
||||
}
|
||||
|
||||
public class InternalizeTimer : Timer
|
||||
|
|
@ -276,7 +312,9 @@ namespace Server.Multis
|
|||
base.OnItemRemoved(item);
|
||||
|
||||
if (item.GetBounce() == null && TotalItems == 0)
|
||||
{
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnItemBounceCleared(Item item)
|
||||
|
|
@ -284,7 +322,9 @@ namespace Server.Multis
|
|||
base.OnItemBounceCleared(item);
|
||||
|
||||
if (TotalItems == 0)
|
||||
{
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
|
|
@ -301,7 +341,9 @@ namespace Server.Multis
|
|||
var version = reader.ReadEncodedInt();
|
||||
|
||||
if (version == 0)
|
||||
{
|
||||
MaxItems = -1; // reset to default
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@ namespace Server.Multis
|
|||
base.OnLocationChange(oldLocation);
|
||||
|
||||
if (m_Components == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var xOffset = X - oldLocation.X;
|
||||
var yOffset = Y - oldLocation.Y;
|
||||
|
|
@ -61,7 +63,9 @@ namespace Server.Multis
|
|||
base.OnMapChange();
|
||||
|
||||
if (m_Components == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < m_Components.Count; ++i)
|
||||
{
|
||||
|
|
@ -76,7 +80,9 @@ namespace Server.Multis
|
|||
base.OnDelete();
|
||||
|
||||
if (m_Components == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < m_Components.Count; ++i)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue