Fixes brace style (#248)

This commit is contained in:
Kamron Batman 2020-09-13 21:49:46 -07:00 • committed by GitHub
parent a236617ad9
commit 8149620b0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1503 changed files with 28575 additions and 1717 deletions

View file

@ -191,7 +191,9 @@ namespace Server.Items
base.Hue = value;
if (Addon?.ShareHue == true)
{
Addon.Hue = value;
}
}
}
@ -201,9 +203,13 @@ namespace Server.Items
public void OnChop(Mobile from)
{
if (Addon != null && from.InRange(GetWorldLocation(), 3))
Addon.OnChop(from);
{
Addon.OnChop(@from);
}
else
from.SendLocalizedMessage(500446); // That is too far away.
{
@from.SendLocalizedMessage(500446); // That is too far away.
}
}
public override void OnDoubleClick(Mobile from)
@ -214,13 +220,17 @@ namespace Server.Items
public override void OnLocationChange(Point3D old)
{
if (Addon != null)
{
Addon.Location = new Point3D(X - Offset.X, Y - Offset.Y, Z - Offset.Z);
}
}
public override void OnMapChange()
{
if (Addon != null)
{
Addon.Map = Map;
}
}
public override void OnAfterDelete()
@ -263,13 +273,17 @@ namespace Server.Items
}
if (version < 1 && Weight == 0)
{
Weight = -1;
}
}
public static void ApplyLightTo(Item item)
{
if ((item.ItemData.Flags & TileFlag.LightSource) == 0)
{
return; // not a light source
}
var itemID = item.ItemID;
@ -280,7 +294,9 @@ namespace Server.Items
var contains = false;
for (var j = 0; !contains && j < toMatch.Length; ++j)
{
contains = itemID == toMatch[j];
}
if (contains)
{

View file

@ -36,22 +36,30 @@ namespace Server.Items
base.Hue = value;
if (Addon?.ShareHue == true)
{
Addon.Hue = value;
}
}
}
public virtual void OnChop(Mobile from)
{
if (Addon != null && from.InRange(GetWorldLocation(), 3))
Addon.OnChop(from);
{
Addon.OnChop(@from);
}
else
from.SendLocalizedMessage(500446); // That is too far away.
{
@from.SendLocalizedMessage(500446); // That is too far away.
}
}
public override bool OnDragDrop(Mobile from, Item dropped)
{
if (Addon != null)
return Addon.OnDragDrop(from, dropped);
{
return Addon.OnDragDrop(@from, dropped);
}
return false;
}
@ -64,7 +72,9 @@ namespace Server.Items
public override void OnLocationChange(Point3D old)
{
if (Addon != null)
{
Addon.Location = new Point3D(X - Offset.X, Y - Offset.Y, Z - Offset.Z);
}
}
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
@ -75,7 +85,9 @@ namespace Server.Items
public override void OnMapChange()
{
if (Addon != null)
{
Addon.Map = Map;
}
}
public override void OnAfterDelete()
@ -125,7 +137,9 @@ namespace Server.Items
get
{
if (m_LabelNumber > 0)
{
return m_LabelNumber;
}
return base.LabelNumber;
}

View file

@ -36,17 +36,21 @@ namespace Server.Items
var version = reader.ReadEncodedInt();
if (version == 0)
{
ValidationQueue<ArcaneCircleAddon>.Add(this);
}
}
public void Validate()
{
foreach (var c in Components)
{
if (c.ItemID == 0x3083)
{
c.Offset = new Point3D(-1, -1, 0);
c.MoveToWorld(new Point3D(X + c.Offset.X, Y + c.Offset.Y, Z + c.Offset.Z), Map);
}
}
}
}

View file

@ -47,9 +47,13 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if ((Arrows > 0 || Bolts > 0) && from.InRange(GetWorldLocation(), 1))
Gather(from);
{
Gather(@from);
}
else
Fire(from);
{
Fire(@from);
}
}
public void Gather(Mobile from)
@ -57,10 +61,14 @@ namespace Server.Items
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500592); // You gather the arrows and bolts.
if (Arrows > 0)
from.AddToBackpack(new Arrow(Arrows));
{
@from.AddToBackpack(new Arrow(Arrows));
}
if (Bolts > 0)
from.AddToBackpack(new Bolt(Bolts));
{
@from.AddToBackpack(new Bolt(Bolts));
}
Arrows = 0;
Bolts = 0;
@ -71,10 +79,14 @@ namespace Server.Items
private ScoreEntry GetEntryFor(Mobile from)
{
if (m_Entries == null)
{
m_Entries = new Dictionary<Mobile, ScoreEntry>();
}
if (!m_Entries.TryGetValue(from, out var e))
m_Entries[from] = e = new ScoreEntry();
{
m_Entries[@from] = e = new ScoreEntry();
}
return e;
}
@ -88,7 +100,9 @@ namespace Server.Items
}
if (DateTime.UtcNow < LastUse + UseDelay)
{
return;
}
var worldLoc = GetWorldLocation();
@ -138,19 +152,25 @@ namespace Server.Items
if (pack?.ConsumeTotal(ammoType) != true)
{
if (isArrow)
from.LocalOverheadMessage(
{
@from.LocalOverheadMessage(
MessageType.Regular,
0x3B2,
500594
); // You do not have any arrows with which to practice.
}
else if (isBolt)
from.LocalOverheadMessage(
{
@from.LocalOverheadMessage(
MessageType.Regular,
0x3B2,
500595
); // You do not have any crossbow bolts with which to practice.
}
else
SendLocalizedMessageTo(from, 500593); // You must practice with ranged weapons on this.
{
SendLocalizedMessageTo(@from, 500593); // You must practice with ranged weapons on this.
}
return;
}
@ -172,9 +192,13 @@ namespace Server.Items
se.Record(0);
if (se.Count == 1)
{
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1062719, se.Total.ToString());
}
else
{
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1042683, $"{se.Total}\t{se.Count}");
}
return;
}
@ -226,17 +250,25 @@ namespace Server.Items
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1010035 + area, from.Name);
if (isArrow)
{
++Arrows;
}
else if (isBolt)
{
++Bolts;
}
}
se.Record(split ? splitScore : score);
if (se.Count == 1)
{
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1062719, se.Total.ToString());
}
else
{
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1042683, $"{se.Total}\t{se.Count}");
}
}
public override void Serialize(IGenericWriter writer)

View file

@ -41,7 +41,9 @@ namespace Server.Items
public void AddLineToTopic(string line)
{
if (Topic.Length >= MaxTopicLines)
{
return;
}
var newTopic = new string[Topic.Length + 1];
Topic.CopyTo(newTopic, 0);
@ -61,7 +63,9 @@ namespace Server.Items
public bool IsOwner(Mobile from)
{
if (from.AccessLevel >= AccessLevel.GameMaster)
{
return true;
}
var house = BaseHouse.FindHouseAt(this);
return house?.IsOwner(from) == true;
@ -97,7 +101,9 @@ namespace Server.Items
writer.WriteEncodedInt(Topic.Length);
for (var i = 0; i < Topic.Length; i++)
{
writer.Write(Topic[i]);
}
writer.Write(Yes, true);
writer.Write(No, true);
@ -112,7 +118,9 @@ namespace Server.Items
Topic = new string[reader.ReadEncodedInt()];
for (var i = 0; i < Topic.Length; i++)
{
Topic[i] = reader.ReadString();
}
Yes = reader.ReadStrongMobileList();
No = reader.ReadStrongMobileList();
@ -129,9 +137,13 @@ namespace Server.Items
AddBackground(0, 0, 400, 350, 0xA28);
if (isOwner)
{
AddHtmlLocalized(0, 15, 400, 35, 1011000); // <center>Ballot Box Owner's Menu</center>
}
else
{
AddHtmlLocalized(0, 15, 400, 35, 1011001); // <center>Ballot Box -- Vote Here!</center>
}
AddHtmlLocalized(0, 50, 400, 35, 1011002); // <center>Topic</center>
@ -143,7 +155,9 @@ namespace Server.Items
var line = box.Topic[i];
if (!string.IsNullOrEmpty(line))
{
AddLabelCropped(30, 90 + i * 20, 340, 20, 0x3E3, line);
}
}
var yesCount = box.Yes.Count;
@ -153,12 +167,18 @@ namespace Server.Items
AddHtmlLocalized(0, 215, 400, 35, 1011003); // <center>votes</center>
if (!isOwner)
{
AddButton(20, 240, 0xFA5, 0xFA7, 3);
}
AddHtmlLocalized(55, 242, 25, 35, 1011004); // aye:
AddLabel(78, 242, 0x0, $"[{yesCount}]");
if (!isOwner)
{
AddButton(20, 275, 0xFA5, 0xFA7, 4);
}
AddHtmlLocalized(55, 277, 25, 35, 1011005); // nay:
AddLabel(78, 277, 0x0, $"[{noCount}]");
@ -184,7 +204,9 @@ namespace Server.Items
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Box.Deleted || info.ButtonID == 0)
{
return;
}
var from = sender.Mobile;
@ -276,7 +298,9 @@ namespace Server.Items
public override void OnResponse(Mobile from, string text)
{
if (m_Box.Deleted || !m_Box.IsOwner(from))
{
return;
}
if (from.Map != m_Box.Map || !from.InRange(m_Box.GetWorldLocation(), 2))
{
@ -301,7 +325,9 @@ namespace Server.Items
public override void OnCancel(Mobile from)
{
if (m_Box.Deleted || !m_Box.IsOwner(from))
{
return;
}
if (from.Map != m_Box.Map || !from.InRange(m_Box.GetWorldLocation(), 2))
{

View file

@ -56,8 +56,12 @@ namespace Server.Items
base.Hue = value;
if (!Deleted && ShareHue && Components != null)
{
foreach (var c in Components)
{
c.Hue = value;
}
}
}
}
}
@ -98,13 +102,17 @@ namespace Server.Items
var hue = 0;
if (RetainDeedHue)
{
for (var i = 0; hue == 0 && i < Components.Count; ++i)
{
var c = Components[i];
if (c.Hue != 0)
{
hue = c.Hue;
}
}
}
Delete();
@ -115,7 +123,9 @@ namespace Server.Items
if (deed != null)
{
if (RetainDeedHue)
{
deed.Hue = hue;
}
from.AddToBackpack(deed);
}
@ -125,7 +135,9 @@ namespace Server.Items
public void AddComponent(AddonComponent c, int x, int y, int z)
{
if (Deleted)
{
return;
}
Components.Add(c);
@ -137,23 +149,32 @@ namespace Server.Items
public virtual AddonFitResult CouldFit(IPoint3D p, Map map, Mobile from, ref BaseHouse house)
{
if (Deleted)
{
return AddonFitResult.Blocked;
}
foreach (var c in Components)
{
var p3D = new Point3D(p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z);
if (!map.CanFit(p3D.X, p3D.Y, p3D.Z, c.ItemData.Height, false, true, c.Z == 0))
{
return AddonFitResult.Blocked;
}
if (!CheckHouse(from, p3D, map, c.ItemData.Height, ref house))
{
return AddonFitResult.NotInHouse;
}
if (c.NeedsWall)
{
var wall = c.WallPosition;
if (!IsWall(p3D.X + wall.X, p3D.Y + wall.Y, p3D.Z + wall.Z, map))
{
return AddonFitResult.NoWall;
}
}
}
@ -174,7 +195,9 @@ namespace Server.Items
if (Utility.InRange(doorLoc, addonLoc, 1) &&
(addonLoc.Z == doorLoc.Z ||
addonLoc.Z + addonHeight > doorLoc.Z && doorLoc.Z + doorHeight > addonLoc.Z))
{
return AddonFitResult.DoorTooClose;
}
}
}
@ -187,7 +210,9 @@ namespace Server.Items
public static bool IsWall(int x, int y, int z, Map map)
{
if (map == null)
{
return false;
}
var tiles = map.Tiles.GetStaticTiles(x, y, true);
@ -197,7 +222,9 @@ namespace Server.Items
var id = TileData.ItemTable[t.ID & TileData.MaxItemValue];
if ((id.Flags & TileFlag.Wall) != 0 && z + 16 > t.Z && t.Z + t.Height > z)
{
return true;
}
}
return false;
@ -214,19 +241,27 @@ namespace Server.Items
public override void OnLocationChange(Point3D oldLoc)
{
if (Deleted)
{
return;
}
foreach (var c in Components)
{
c.Location = new Point3D(X + c.Offset.X, Y + c.Offset.Y, Z + c.Offset.Z);
}
}
public override void OnMapChange()
{
if (Deleted)
{
return;
}
foreach (var c in Components)
{
c.Map = Map;
}
}
public override void OnAfterDelete()
@ -234,7 +269,9 @@ namespace Server.Items
base.OnAfterDelete();
foreach (var c in Components)
{
c.Delete();
}
}
public override void Serialize(IGenericWriter writer)
@ -263,7 +300,9 @@ namespace Server.Items
}
if (version < 1 && Weight == 0)
{
Weight = -1;
}
}
}
}

View file

@ -36,7 +36,9 @@ namespace Server.Items
Hue = value;
foreach (var c in Components)
{
c.Hue = value;
}
}
}
}
@ -89,13 +91,17 @@ namespace Server.Items
var hue = 0;
if (RetainDeedHue)
{
for (var i = 0; hue == 0 && i < Components.Count; ++i)
{
var c = Components[i];
if (c.Hue != 0)
{
hue = c.Hue;
}
}
}
DropItemsToGround();
@ -110,7 +116,9 @@ namespace Server.Items
deed.Resource = Resource;
if (RetainDeedHue)
{
deed.Hue = hue;
}
from.AddToBackpack(deed);
}
@ -127,10 +135,14 @@ namespace Server.Items
base.OnLocationChange(oldLoc);
if (Deleted)
{
return;
}
foreach (var c in Components)
{
c.Location = new Point3D(X + c.Offset.X, Y + c.Offset.Y, Z + c.Offset.Z);
}
}
public override void OnMapChange()
@ -138,10 +150,14 @@ namespace Server.Items
base.OnMapChange();
if (Deleted)
{
return;
}
foreach (var c in Components)
{
c.Map = Map;
}
}
public override void OnDelete()
@ -158,7 +174,9 @@ namespace Server.Items
base.GetProperties(list);
if (!CraftResources.IsStandard(m_Resource))
{
list.Add(CraftResources.GetLocalizationNumber(m_Resource));
}
}
public override void OnAfterDelete()
@ -166,7 +184,9 @@ namespace Server.Items
base.OnAfterDelete();
foreach (var c in Components)
{
c.Delete();
}
}
public override void Serialize(IGenericWriter writer)
@ -194,13 +214,17 @@ namespace Server.Items
public virtual void DropItemsToGround()
{
for (var i = Items.Count - 1; i >= 0; i--)
{
Items[i].MoveToWorld(Location);
}
}
public void AddComponent(AddonContainerComponent c, int x, int y, int z)
{
if (Deleted)
{
return;
}
Components.Add(c);
@ -212,39 +236,55 @@ namespace Server.Items
public AddonFitResult CouldFit(IPoint3D p, Map map, Mobile from, ref BaseHouse house)
{
if (Deleted)
{
return AddonFitResult.Blocked;
}
foreach (var c in Components)
{
var p3D = new Point3D(p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z);
if (!map.CanFit(p3D.X, p3D.Y, p3D.Z, c.ItemData.Height, false, true, c.Z == 0))
{
return AddonFitResult.Blocked;
}
if (!BaseAddon.CheckHouse(from, p3D, map, c.ItemData.Height, ref house))
{
return AddonFitResult.NotInHouse;
}
if (c.NeedsWall)
{
var wall = c.WallPosition;
if (!BaseAddon.IsWall(p3D.X + wall.X, p3D.Y + wall.Y, p3D.Z + wall.Z, map))
{
return AddonFitResult.NoWall;
}
}
}
var p3 = new Point3D(p.X, p.Y, p.Z);
if (!map.CanFit(p3.X, p3.Y, p3.Z, ItemData.Height, false, true, Z == 0))
{
return AddonFitResult.Blocked;
}
if (!BaseAddon.CheckHouse(from, p3, map, ItemData.Height, ref house))
{
return AddonFitResult.NotInHouse;
}
if (NeedsWall)
{
var wall = WallPosition;
if (!BaseAddon.IsWall(p3.X + wall.X, p3.Y + wall.Y, p3.Z + wall.Z, map))
{
return AddonFitResult.NoWall;
}
}
if (house != null)
@ -256,7 +296,9 @@ namespace Server.Items
var door = doors[i];
if (door?.Open == true)
{
return AddonFitResult.DoorsNotClosed;
}
var doorLoc = door.GetWorldLocation();
var doorHeight = door.ItemData.CalcHeight;
@ -270,7 +312,9 @@ namespace Server.Items
if (Utility.InRange(doorLoc, addonLoc, 1) &&
(addonLoc.Z == doorLoc.Z ||
addonLoc.Z + addonHeight > doorLoc.Z && doorLoc.Z + doorHeight > addonLoc.Z))
{
return AddonFitResult.DoorTooClose;
}
}
var addonLo = new Point3D(p.X, p.Y, p.Z);
@ -279,7 +323,9 @@ namespace Server.Items
if (Utility.InRange(doorLoc, addonLo, 1) &&
(addonLo.Z == doorLoc.Z ||
addonLo.Z + addonHeight > doorLoc.Z && doorLoc.Z + doorHeight > addonLo.Z))
{
return AddonFitResult.DoorTooClose;
}
}
}

View file

@ -16,7 +16,9 @@ namespace Server.Items
Weight = 1.0;
if (!Core.AOS)
{
LootType = LootType.Newbied;
}
}
public BaseAddonContainerDeed(Serial serial) : base(serial)
@ -53,7 +55,9 @@ namespace Server.Items
var context = craftSystem.GetContext(from);
if (context?.DoNotColor == true)
{
Hue = 0;
}
return quality;
}
@ -84,9 +88,13 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
from.Target = new InternalTarget(this);
{
@from.Target = new InternalTarget(this);
}
else
from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
{
@from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
}
}
public override void GetProperties(ObjectPropertyList list)
@ -94,7 +102,9 @@ namespace Server.Items
base.GetProperties(list);
if (!CraftResources.IsStandard(m_Resource))
{
list.Add(CraftResources.GetLocalizationNumber(m_Resource));
}
}
private class InternalTarget : Target
@ -114,7 +124,9 @@ namespace Server.Items
var map = from.Map;
if (p == null || map == null || m_Deed.Deleted)
{
return;
}
if (m_Deed.IsChildOf(from.Backpack))
{
@ -128,17 +140,29 @@ namespace Server.Items
var res = addon.CouldFit(p, map, from, ref house);
if (res == AddonFitResult.Valid)
{
addon.MoveToWorld(new Point3D(p), map);
}
else if (res == AddonFitResult.Blocked)
from.SendLocalizedMessage(500269); // You cannot build that there.
{
@from.SendLocalizedMessage(500269); // You cannot build that there.
}
else if (res == AddonFitResult.NotInHouse)
from.SendLocalizedMessage(500274); // You can only place this in a house that you own!
{
@from.SendLocalizedMessage(500274); // You can only place this in a house that you own!
}
else if (res == AddonFitResult.DoorsNotClosed)
from.SendMessage("You must close all house doors before placing this.");
{
@from.SendMessage("You must close all house doors before placing this.");
}
else if (res == AddonFitResult.DoorTooClose)
from.SendLocalizedMessage(500271); // You cannot build near the door.
{
@from.SendLocalizedMessage(500271); // You cannot build near the door.
}
else if (res == AddonFitResult.NoWall)
from.SendLocalizedMessage(500268); // This object needs to be mounted on something.
{
@from.SendLocalizedMessage(500268); // This object needs to be mounted on something.
}
if (res == AddonFitResult.Valid)
{

View file

@ -14,7 +14,9 @@ namespace Server.Items
Weight = 1.0;
if (!Core.AOS)
{
LootType = LootType.Newbied;
}
}
public BaseAddonDeed(Serial serial) : base(serial)
@ -53,15 +55,21 @@ namespace Server.Items
var version = reader.ReadInt();
if (Weight == 0.0)
{
Weight = 1.0;
}
}
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
from.Target = new InternalTarget(this);
{
@from.Target = new InternalTarget(this);
}
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.
}
}
private class InternalTarget : Target
@ -81,7 +89,9 @@ namespace Server.Items
var map = from.Map;
if (p == null || map == null || m_Deed.Deleted)
{
return;
}
if (m_Deed.IsChildOf(from.Backpack))
{
@ -94,15 +104,25 @@ namespace Server.Items
var res = addon.CouldFit(p, map, from, ref house);
if (res == AddonFitResult.Valid)
{
addon.MoveToWorld(new Point3D(p), map);
}
else if (res == AddonFitResult.Blocked)
from.SendLocalizedMessage(500269); // You cannot build that there.
{
@from.SendLocalizedMessage(500269); // You cannot build that there.
}
else if (res == AddonFitResult.NotInHouse)
from.SendLocalizedMessage(500274); // You can only place this in a house that you own!
{
@from.SendLocalizedMessage(500274); // You can only place this in a house that you own!
}
else if (res == AddonFitResult.DoorTooClose)
from.SendLocalizedMessage(500271); // You cannot build near the door.
{
@from.SendLocalizedMessage(500271); // You cannot build near the door.
}
else if (res == AddonFitResult.NoWall)
from.SendLocalizedMessage(500268); // This object needs to be mounted on something.
{
@from.SendLocalizedMessage(500268); // This object needs to be mounted on something.
}
if (res == AddonFitResult.Valid)
{

View file

@ -22,27 +22,43 @@ namespace Server.Items
{
Direction dir;
if (from.Location != Location)
dir = from.GetDirectionTo(this);
{
dir = @from.GetDirectionTo(this);
}
else if (East)
{
dir = Direction.West;
}
else
{
dir = Direction.North;
}
from.Direction = dir;
bool canThrow;
if (!from.InRange(this, 4) || !from.InLOS(this))
{
canThrow = false;
}
else if (East)
{
canThrow = dir == Direction.Left || dir == Direction.West || dir == Direction.Up;
}
else
{
canThrow = dir == Direction.Up || dir == Direction.North || dir == Direction.Right;
}
if (canThrow)
Throw(from);
{
Throw(@from);
}
else
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
{
@from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
}
public void Throw(Mobile from)
@ -61,17 +77,29 @@ namespace Server.Items
int message;
if (rand < 0.05)
{
message = 500752; // BULLSEYE! 50 Points!
}
else if (rand < 0.20)
{
message = 500753; // Just missed the center! 20 points.
}
else if (rand < 0.45)
{
message = 500754; // 10 point shot.
}
else if (rand < 0.70)
{
message = 500755; // 5 pointer.
}
else if (rand < 0.85)
{
message = 500756; // 1 point. Bad throw.
}
else
{
message = 500757; // Missed.
}
PublicOverheadMessage(MessageType.Regular, 0x3B2, message);
}

View file

@ -26,6 +26,7 @@ namespace Server.Items
m_Timer.Start();
foreach (var c in Components)
{
switch (c.ItemID)
{
case 0x2DD9:
@ -34,6 +35,7 @@ namespace Server.Items
++c.ItemID;
break;
}
}
}
public override void Serialize(IGenericWriter writer)
@ -69,6 +71,7 @@ namespace Server.Items
m_Timer = null;
foreach (var c in Components)
{
switch (c.ItemID)
{
case 0x1016:
@ -78,6 +81,7 @@ namespace Server.Items
--c.ItemID;
break;
}
}
callback?.Invoke(this, from, hue);
}

View file

@ -26,6 +26,7 @@ namespace Server.Items
m_Timer.Start();
foreach (var c in Components)
{
switch (c.ItemID)
{
case 0x1015:
@ -35,6 +36,7 @@ namespace Server.Items
++c.ItemID;
break;
}
}
}
public override void Serialize(IGenericWriter writer)
@ -71,6 +73,7 @@ namespace Server.Items
m_Timer = null;
foreach (var c in Components)
{
switch (c.ItemID)
{
case 0x1016:
@ -80,6 +83,7 @@ namespace Server.Items
--c.ItemID;
break;
}
}
callback?.Invoke(this, from, hue);
}

View file

@ -68,7 +68,9 @@ namespace Server.Items
public void StartWorking(Mobile from)
{
if (IsWorking)
{
return;
}
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), FinishWorking_Callback, from);
UpdateStage();
@ -107,8 +109,12 @@ namespace Server.Items
var itemTable = m_StageTable[i];
for (var j = 0; j < itemTable.Length; ++j)
{
if (itemTable[j] == itemID)
{
return itemTable;
}
}
}
return null;
@ -117,11 +123,17 @@ namespace Server.Items
public void UpdateStage()
{
if (IsWorking)
{
UpdateStage(FlourMillStage.Working);
}
else if (HasFlour)
{
UpdateStage(FlourMillStage.Filled);
}
else
{
UpdateStage(FlourMillStage.Empty);
}
}
public void UpdateStage(FlourMillStage stage)
@ -133,23 +145,33 @@ namespace Server.Items
for (var i = 0; i < components.Count; ++i)
{
if (!(components[i] is AddonComponent component))
{
continue;
}
var itemTable = FindItemTable(component.ItemID);
if (itemTable != null)
{
component.ItemID = itemTable[(int)stage];
}
}
}
public override void OnComponentUsed(AddonComponent c, Mobile from)
{
if (!from.InRange(GetWorldLocation(), 4) || !from.InLOS(this))
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
{
@from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
else if (!IsFull)
from.SendLocalizedMessage(500997); // You need more wheat to make a sack of flour.
{
@from.SendLocalizedMessage(500997); // You need more wheat to make a sack of flour.
}
else
StartWorking(from);
{
StartWorking(@from);
}
}
public override void Serialize(IGenericWriter writer)

View file

@ -55,7 +55,9 @@ namespace Server.Items
public void StartWorking(Mobile from)
{
if (IsWorking)
{
return;
}
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), FinishWorking_Callback, from);
UpdateStage();
@ -96,8 +98,12 @@ namespace Server.Items
var itemTable = m_StageTable[i];
for (var j = 0; j < itemTable.Length; ++j)
{
if (itemTable[j] == itemID)
{
return itemTable;
}
}
}
return null;
@ -106,11 +112,17 @@ namespace Server.Items
public void UpdateStage()
{
if (IsWorking)
{
UpdateStage(FlourMillStage.Working);
}
else if (HasFlour)
{
UpdateStage(FlourMillStage.Filled);
}
else
{
UpdateStage(FlourMillStage.Empty);
}
}
public void UpdateStage(FlourMillStage stage)
@ -122,23 +134,33 @@ namespace Server.Items
for (var i = 0; i < components.Count; ++i)
{
if (!(components[i] is AddonComponent component))
{
continue;
}
var itemTable = FindItemTable(component.ItemID);
if (itemTable != null)
{
component.ItemID = itemTable[(int)stage];
}
}
}
public override void OnComponentUsed(AddonComponent c, Mobile from)
{
if (!from.InRange(GetWorldLocation(), 4) || !from.InLOS(this))
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
{
@from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
else if (!IsFull)
from.SendLocalizedMessage(500997); // You need more wheat to make a sack of flour.
{
@from.SendLocalizedMessage(500997); // You need more wheat to make a sack of flour.
}
else
StartWorking(from);
{
StartWorking(@from);
}
}
public override void Serialize(IGenericWriter writer)

View file

@ -9,12 +9,14 @@ namespace Server.Items
var count = 5;
for (var i = 0; i < count; ++i)
{
AddComponent(
new AddonComponent(itemID++),
count - 1 - i,
-(count - 1 - i),
0
);
}
}
public GiantWeb1(Serial serial)
@ -46,12 +48,14 @@ namespace Server.Items
var count = 5;
for (var i = 0; i < count; ++i)
{
AddComponent(
new AddonComponent(itemID++),
i,
-i,
0
);
}
}
public GiantWeb2(Serial serial)
@ -83,12 +87,14 @@ namespace Server.Items
var count = 4;
for (var i = 0; i < count; ++i)
{
AddComponent(
new AddonComponent(itemID++),
i,
-i,
0
);
}
}
public GiantWeb3(Serial serial)
@ -120,12 +126,14 @@ namespace Server.Items
var count = 4;
for (var i = 0; i < count; ++i)
{
AddComponent(
new AddonComponent(itemID++),
count - 1 - i,
-(count - 1 - i),
0
);
}
}
public GiantWeb4(Serial serial)
@ -157,12 +165,14 @@ namespace Server.Items
var count = 4;
for (var i = 0; i < count; ++i)
{
AddComponent(
new AddonComponent(itemID++),
i,
-i,
0
);
}
}
public GiantWeb5(Serial serial)
@ -194,12 +204,14 @@ namespace Server.Items
var count = 4;
for (var i = 0; i < count; ++i)
{
AddComponent(
new AddonComponent(itemID++),
count - 1 - i,
-(count - 1 - i),
0
);
}
}
public GiantWeb6(Serial serial)

View file

@ -59,7 +59,9 @@ namespace Server.Items
if (version <= 1)
{
Timer.DelayCall(Fix, version);
}
}
private void Fix(int version)
@ -77,7 +79,10 @@ namespace Server.Items
case 0:
{
if (ac.Hue == 2118)
{
ac.Hue = 1161;
}
break;
}
}

View file

@ -75,18 +75,28 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (!from.InRange(GetWorldLocation(), 1))
SendLocalizedMessageTo(from, 501816); // You are too far away to do that.
{
SendLocalizedMessageTo(@from, 501816); // You are too far away to do that.
}
else if (Swinging)
SendLocalizedMessageTo(from, 501815); // You have to wait until it stops swinging.
{
SendLocalizedMessageTo(@from, 501815); // You have to wait until it stops swinging.
}
else if (from.Skills.Stealing.Base >= MaxSkill)
{
SendLocalizedMessageTo(
from,
@from,
501830
); // Your ability to steal cannot improve any further by simply practicing on a dummy.
}
else if (from.Mounted)
SendLocalizedMessageTo(from, 501829); // You can't practice on this while on a mount.
{
SendLocalizedMessageTo(@from, 501829); // You can't practice on this while on a mount.
}
else
Use(from);
{
Use(@from);
}
}
public override void Serialize(IGenericWriter writer)

View file

@ -89,13 +89,17 @@ namespace Server.Items
base.OnMovement(m, oldLocation);
if (m.Player && Utility.InRange(Location, m.Location, 3) && !Utility.InRange(Location, oldLocation, 3))
{
if (DateTime.UtcNow >= m_NextMessage)
{
if (Components.Count > 0)
{
Components[0].SendLocalizedMessageTo(m, 1010061); // An overwhelming sense of peace fills you.
}
m_NextMessage = DateTime.UtcNow + TimeSpan.FromSeconds(25.0);
}
}
}
public override void Serialize(IGenericWriter writer)

View file

@ -37,7 +37,9 @@ namespace Server.Items
m_Active = value;
if (Addon is SHTeleporter sourceAddon)
{
sourceAddon.ChangeActive(value);
}
}
}
@ -60,7 +62,9 @@ namespace Server.Items
m_TeleDest = value;
if (Addon is SHTeleporter sourceAddon)
{
sourceAddon.ChangeDest(value);
}
}
}
@ -69,7 +73,9 @@ namespace Server.Items
public override void OnDoubleClick(Mobile m)
{
if (!m_Active || m_TeleDest?.Deleted != false || m_TeleDest.Map == Map.Internal)
{
return;
}
if (m.InRange(this, 3))
{
@ -205,7 +211,9 @@ namespace Server.Items
public void ChangeActive(bool active)
{
if (m_Changing)
{
return;
}
m_Changing = true;
@ -220,7 +228,9 @@ namespace Server.Items
public void ChangeDest(SHTeleComponent dest)
{
if (m_Changing)
{
return;
}
m_Changing = true;
@ -247,7 +257,9 @@ namespace Server.Items
public void ChangeDest(SHTeleporter destAddon)
{
if (m_Changing)
{
return;
}
m_Changing = true;

View file

@ -84,17 +84,23 @@ namespace Server.Items
public override void OnMovement(Mobile m, Point3D oldLocation)
{
if (!m.Player || !m.Alive || m.Hidden || !SpawnKilled())
{
return;
}
if (Utility.InRange(Location, m.Location, 3) && !Utility.InRange(Location, oldLocation, 3))
{
var count = 1 + Utility.Random(4);
for (var i = 0; i < count; i++)
{
SpawnAnt();
}
if (Utility.RandomDouble() < 0.05)
{
SpawnAnt(new Beetle());
}
}
}
@ -113,16 +119,24 @@ namespace Server.Items
if (map == Map.Trammel)
{
if (random < 2)
{
SpawnAnt(new RedSolenWorker());
}
else
{
SpawnAnt(new RedSolenWarrior());
}
}
else if (map == Map.Felucca)
{
if (random < 2)
{
SpawnAnt(new BlackSolenWorker());
}
else
{
SpawnAnt(new BlackSolenWarrior());
}
}
}
@ -134,8 +148,12 @@ namespace Server.Items
var p = Location;
for (var i = 0; i < 5; i++)
{
if (SpellHelper.FindValidSpawnLocation(map, ref p, false))
{
break;
}
}
ant.MoveToWorld(p, map);
ant.Home = Location;
@ -145,8 +163,12 @@ namespace Server.Items
public bool SpawnKilled()
{
for (var i = m_Spawned.Count - 1; i >= 0; i--)
{
if (!m_Spawned[i].Alive || m_Spawned[i].Deleted)
{
m_Spawned.RemoveAt(i);
}
}
return m_Spawned.Count < 2;
}

View file

@ -34,6 +34,7 @@ namespace Server.Items
m_Timer.Start();
foreach (var c in Components)
{
switch (c.ItemID)
{
case 0x1015:
@ -43,6 +44,7 @@ namespace Server.Items
++c.ItemID;
break;
}
}
}
public override void Serialize(IGenericWriter writer)
@ -79,6 +81,7 @@ namespace Server.Items
m_Timer = null;
foreach (var c in Components)
{
switch (c.ItemID)
{
case 0x1016:
@ -88,6 +91,7 @@ namespace Server.Items
--c.ItemID;
break;
}
}
callback?.Invoke(this, from, hue);
}

View file

@ -26,6 +26,7 @@ namespace Server.Items
m_Timer.Start();
foreach (var c in Components)
{
switch (c.ItemID)
{
case 0x1015:
@ -35,6 +36,7 @@ namespace Server.Items
++c.ItemID;
break;
}
}
}
public override void Serialize(IGenericWriter writer)
@ -71,6 +73,7 @@ namespace Server.Items
m_Timer = null;
foreach (var c in Components)
{
switch (c.ItemID)
{
case 0x1016:
@ -80,6 +83,7 @@ namespace Server.Items
--c.ItemID;
break;
}
}
callback?.Invoke(this, from, hue);
}

View file

@ -72,20 +72,32 @@ namespace Server.Items
var weapon = from.Weapon as BaseWeapon;
if (weapon is BaseRanged)
SendLocalizedMessageTo(from, 501822); // You can't practice ranged weapons on this.
{
SendLocalizedMessageTo(@from, 501822); // You can't practice ranged weapons on this.
}
else if (weapon == null || !from.InRange(GetWorldLocation(), weapon.MaxRange))
SendLocalizedMessageTo(from, 501816); // You are too far away to do that.
{
SendLocalizedMessageTo(@from, 501816); // You are too far away to do that.
}
else if (Swinging)
SendLocalizedMessageTo(from, 501815); // You have to wait until it stops swinging.
{
SendLocalizedMessageTo(@from, 501815); // You have to wait until it stops swinging.
}
else if (from.Skills[weapon.Skill].Base >= MaxSkill)
{
SendLocalizedMessageTo(
from,
@from,
501828
); // Your skill cannot improve any further by simply practicing with a dummy.
}
else if (from.Mounted)
SendLocalizedMessageTo(from, 501829); // You can't practice on this while on a mount.
{
SendLocalizedMessageTo(@from, 501829); // You can't practice on this while on a mount.
}
else
Use(from, weapon);
{
Use(@from, weapon);
}
}
public override void Serialize(IGenericWriter writer)
@ -138,9 +150,13 @@ namespace Server.Items
protected override void OnTick()
{
if (m_Delay)
{
m_Dummy.OnHit();
}
else
{
m_Dummy.EndSwing();
}
m_Delay = !m_Delay;
}