Fixes brace style (#248)
This commit is contained in:
parent
a236617ad9
commit
8149620b0c
1503 changed files with 28575 additions and 1717 deletions
|
|
@ -33,7 +33,10 @@ namespace Server.Tests.Network.Packets
|
||||||
var packLength = (ulong)dest.Length - 8;
|
var packLength = (ulong)dest.Length - 8;
|
||||||
|
|
||||||
ZlibError ce = Zlib.Pack(dest.Slice(pos + 8), ref packLength, source, ZlibQuality.Default);
|
ZlibError ce = Zlib.Pack(dest.Slice(pos + 8), ref packLength, source, ZlibQuality.Default);
|
||||||
if (ce != ZlibError.Okay) Console.WriteLine("ZLib error: {0} (#{1})", ce, (int)ce);
|
if (ce != ZlibError.Okay)
|
||||||
|
{
|
||||||
|
Console.WriteLine("ZLib error: {0} (#{1})", ce, (int)ce);
|
||||||
|
}
|
||||||
|
|
||||||
dest.Write(ref pos, (int)(4 + packLength));
|
dest.Write(ref pos, (int)(4 + packLength));
|
||||||
dest.Write(ref pos, length);
|
dest.Write(ref pos, length);
|
||||||
|
|
|
||||||
|
|
@ -137,15 +137,23 @@ namespace Server.Tests.Network.Packets
|
||||||
flags &= ~FeatureFlags.UOTD;
|
flags &= ~FeatureFlags.UOTD;
|
||||||
|
|
||||||
if (ns.Account.Limit > 6)
|
if (ns.Account.Limit > 6)
|
||||||
|
{
|
||||||
flags |= FeatureFlags.SeventhCharacterSlot;
|
flags |= FeatureFlags.SeventhCharacterSlot;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
flags |= FeatureFlags.SixthCharacterSlot;
|
flags |= FeatureFlags.SixthCharacterSlot;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ns.ExtendedSupportedFeatures)
|
if (ns.ExtendedSupportedFeatures)
|
||||||
|
{
|
||||||
expectedData.Write(ref pos, (uint)flags);
|
expectedData.Write(ref pos, (uint)flags);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
expectedData.Write(ref pos, (ushort)flags);
|
expectedData.Write(ref pos, (ushort)flags);
|
||||||
|
}
|
||||||
|
|
||||||
AssertThat.Equal(data, expectedData);
|
AssertThat.Equal(data, expectedData);
|
||||||
}
|
}
|
||||||
|
|
@ -194,7 +202,9 @@ namespace Server.Tests.Network.Packets
|
||||||
var map = m.Map;
|
var map = m.Map;
|
||||||
|
|
||||||
if (map == null || map == Map.Internal)
|
if (map == null || map == Map.Internal)
|
||||||
|
{
|
||||||
map = m.LogoutMap;
|
map = m.LogoutMap;
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.Write(ref pos, (ushort)(map?.Width ?? Map.Felucca.Width));
|
expectedData.Write(ref pos, (ushort)(map?.Width ?? Map.Felucca.Width));
|
||||||
expectedData.Write(ref pos, (ushort)(map?.Height ?? Map.Felucca.Height));
|
expectedData.Write(ref pos, (ushort)(map?.Height ?? Map.Felucca.Height));
|
||||||
|
|
@ -234,11 +244,13 @@ namespace Server.Tests.Network.Packets
|
||||||
|
|
||||||
var highSlot = -1;
|
var highSlot = -1;
|
||||||
for (var i = account.Length - 1; i >= 0; i--)
|
for (var i = account.Length - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
if (account[i] != null)
|
if (account[i] != null)
|
||||||
{
|
{
|
||||||
highSlot = i;
|
highSlot = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var count = Math.Max(Math.Max(highSlot + 1, account.Limit), 5);
|
var count = Math.Max(Math.Max(highSlot + 1, account.Limit), 5);
|
||||||
expectedData.Write(ref pos, (byte)count);
|
expectedData.Write(ref pos, (byte)count);
|
||||||
|
|
@ -303,11 +315,13 @@ namespace Server.Tests.Network.Packets
|
||||||
|
|
||||||
var highSlot = -1;
|
var highSlot = -1;
|
||||||
for (var i = account.Length - 1; i >= 0; i--)
|
for (var i = account.Length - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
if (account[i] != null)
|
if (account[i] != null)
|
||||||
{
|
{
|
||||||
highSlot = i;
|
highSlot = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var count = Math.Max(Math.Max(highSlot + 1, account.Limit), 5);
|
var count = Math.Max(Math.Max(highSlot + 1, account.Limit), 5);
|
||||||
expectedData.Write(ref pos, (byte)count);
|
expectedData.Write(ref pos, (byte)count);
|
||||||
|
|
@ -367,13 +381,19 @@ namespace Server.Tests.Network.Packets
|
||||||
|
|
||||||
var flags = ExpansionInfo.GetInfo(Expansion.EJ).CharacterListFlags;
|
var flags = ExpansionInfo.GetInfo(Expansion.EJ).CharacterListFlags;
|
||||||
if (count > 6)
|
if (count > 6)
|
||||||
|
{
|
||||||
flags |= CharacterListFlags.SeventhCharacterSlot |
|
flags |= CharacterListFlags.SeventhCharacterSlot |
|
||||||
CharacterListFlags.SixthCharacterSlot; // 7th Character Slot
|
CharacterListFlags.SixthCharacterSlot; // 7th Character Slot
|
||||||
|
}
|
||||||
else if (count == 6)
|
else if (count == 6)
|
||||||
|
{
|
||||||
flags |= CharacterListFlags.SixthCharacterSlot; // 6th Character Slot
|
flags |= CharacterListFlags.SixthCharacterSlot; // 6th Character Slot
|
||||||
|
}
|
||||||
else if (account.Limit == 1)
|
else if (account.Limit == 1)
|
||||||
|
{
|
||||||
flags |= CharacterListFlags.SlotLimit &
|
flags |= CharacterListFlags.SlotLimit &
|
||||||
CharacterListFlags.OneCharacterSlot; // Limit Characters & One Character
|
CharacterListFlags.OneCharacterSlot; // Limit Characters & One Character
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.Write(ref pos, (int)flags);
|
expectedData.Write(ref pos, (int)flags);
|
||||||
expectedData.Write(ref pos, (short)-1);
|
expectedData.Write(ref pos, (short)-1);
|
||||||
|
|
@ -404,11 +424,13 @@ namespace Server.Tests.Network.Packets
|
||||||
|
|
||||||
var highSlot = -1;
|
var highSlot = -1;
|
||||||
for (var i = account.Length - 1; i >= 0; i--)
|
for (var i = account.Length - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
if (account[i] != null)
|
if (account[i] != null)
|
||||||
{
|
{
|
||||||
highSlot = i;
|
highSlot = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var count = Math.Max(Math.Max(highSlot + 1, account.Limit), 5);
|
var count = Math.Max(Math.Max(highSlot + 1, account.Limit), 5);
|
||||||
expectedData.Write(ref pos, (byte)count);
|
expectedData.Write(ref pos, (byte)count);
|
||||||
|
|
@ -458,13 +480,19 @@ namespace Server.Tests.Network.Packets
|
||||||
|
|
||||||
var flags = ExpansionInfo.GetInfo(Expansion.EJ).CharacterListFlags;
|
var flags = ExpansionInfo.GetInfo(Expansion.EJ).CharacterListFlags;
|
||||||
if (count > 6)
|
if (count > 6)
|
||||||
|
{
|
||||||
flags |= CharacterListFlags.SeventhCharacterSlot |
|
flags |= CharacterListFlags.SeventhCharacterSlot |
|
||||||
CharacterListFlags.SixthCharacterSlot; // 7th Character Slot
|
CharacterListFlags.SixthCharacterSlot; // 7th Character Slot
|
||||||
|
}
|
||||||
else if (count == 6)
|
else if (count == 6)
|
||||||
|
{
|
||||||
flags |= CharacterListFlags.SixthCharacterSlot; // 6th Character Slot
|
flags |= CharacterListFlags.SixthCharacterSlot; // 6th Character Slot
|
||||||
|
}
|
||||||
else if (account.Limit == 1)
|
else if (account.Limit == 1)
|
||||||
|
{
|
||||||
flags |= CharacterListFlags.SlotLimit &
|
flags |= CharacterListFlags.SlotLimit &
|
||||||
CharacterListFlags.OneCharacterSlot; // Limit Characters & One Character
|
CharacterListFlags.OneCharacterSlot; // Limit Characters & One Character
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.Write(ref pos, (int)flags);
|
expectedData.Write(ref pos, (int)flags);
|
||||||
|
|
||||||
|
|
@ -546,8 +574,12 @@ namespace Server.Tests.Network.Packets
|
||||||
{
|
{
|
||||||
m_Mobiles = mobiles;
|
m_Mobiles = mobiles;
|
||||||
foreach (var mobile in mobiles)
|
foreach (var mobile in mobiles)
|
||||||
|
{
|
||||||
if (mobile != null)
|
if (mobile != null)
|
||||||
|
{
|
||||||
mobile.Account = this;
|
mobile.Account = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Length = mobiles.Length;
|
Length = mobiles.Length;
|
||||||
Count = mobiles.Count(t => t != null);
|
Count = mobiles.Count(t => t != null);
|
||||||
|
|
@ -571,7 +603,10 @@ namespace Server.Tests.Network.Packets
|
||||||
|
|
||||||
public bool WithdrawGold(int amount)
|
public bool WithdrawGold(int amount)
|
||||||
{
|
{
|
||||||
if (TotalGold - amount < 0) return false;
|
if (TotalGold - amount < 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
TotalGold -= amount;
|
TotalGold -= amount;
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -579,7 +614,10 @@ namespace Server.Tests.Network.Packets
|
||||||
|
|
||||||
public bool WithdrawPlat(int amount)
|
public bool WithdrawPlat(int amount)
|
||||||
{
|
{
|
||||||
if (TotalPlat - amount < 0) return false;
|
if (TotalPlat - amount < 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
TotalPlat -= amount;
|
TotalPlat -= amount;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,10 @@ namespace Server.Tests.Network.Packets
|
||||||
var attrs = info.Attributes;
|
var attrs = info.Attributes;
|
||||||
|
|
||||||
var length = 17 + (info.Unidentified ? 4 : 0) + attrs.Length * 6;
|
var length = 17 + (info.Unidentified ? 4 : 0) + attrs.Length * 6;
|
||||||
if (info.Crafter != null) length += 6 + (info.Crafter.Name?.Length ?? 0);
|
if (info.Crafter != null)
|
||||||
|
{
|
||||||
|
length += 6 + (info.Crafter.Name?.Length ?? 0);
|
||||||
|
}
|
||||||
|
|
||||||
Span<byte> expectedData = stackalloc byte[length];
|
Span<byte> expectedData = stackalloc byte[length];
|
||||||
|
|
||||||
|
|
@ -51,7 +54,10 @@ namespace Server.Tests.Network.Packets
|
||||||
expectedData.WriteAscii(ref pos, name);
|
expectedData.WriteAscii(ref pos, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.Unidentified) expectedData.Write(ref pos, -4);
|
if (info.Unidentified)
|
||||||
|
{
|
||||||
|
expectedData.Write(ref pos, -4);
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < attrs.Length; i++)
|
for (var i = 0; i < attrs.Length; i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,9 @@ namespace Server.Tests.Network.Packets
|
||||||
expectedData.Write(ref pos, (ushort)gump.Strings.Count);
|
expectedData.Write(ref pos, (ushort)gump.Strings.Count);
|
||||||
|
|
||||||
for (var i = 0; i < gump.Strings.Count; ++i)
|
for (var i = 0; i < gump.Strings.Count; ++i)
|
||||||
|
{
|
||||||
expectedData.WriteBigUni(ref pos, gump.Strings[i] ?? "");
|
expectedData.WriteBigUni(ref pos, gump.Strings[i] ?? "");
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.Slice(1, 2).Write((ushort)pos); // Length
|
expectedData.Slice(1, 2).Write((ushort)pos); // Length
|
||||||
|
|
||||||
|
|
@ -198,7 +200,9 @@ namespace Server.Tests.Network.Packets
|
||||||
var bufferPos = 0;
|
var bufferPos = 0;
|
||||||
|
|
||||||
foreach (var layout in layoutList)
|
foreach (var layout in layoutList)
|
||||||
|
{
|
||||||
buffer.WriteAscii(ref bufferPos, layout);
|
buffer.WriteAscii(ref bufferPos, layout);
|
||||||
|
}
|
||||||
|
|
||||||
#if NO_LOCAL_INIT
|
#if NO_LOCAL_INIT
|
||||||
buffer.Write(ref bufferPos, (byte)0); // Layout terminator
|
buffer.Write(ref bufferPos, (byte)0); // Layout terminator
|
||||||
|
|
@ -216,7 +220,9 @@ namespace Server.Tests.Network.Packets
|
||||||
bufferPos = 0;
|
bufferPos = 0;
|
||||||
|
|
||||||
foreach (var str in gump.Strings)
|
foreach (var str in gump.Strings)
|
||||||
|
{
|
||||||
buffer.WriteBigUni(ref bufferPos, str);
|
buffer.WriteBigUni(ref bufferPos, str);
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.WritePacked(ref pos, buffer.Slice(0, bufferPos));
|
expectedData.WritePacked(ref pos, buffer.Slice(0, bufferPos));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,23 +43,35 @@ namespace Server.Tests.Network.Packets
|
||||||
pos += 2; // Length
|
pos += 2; // Length
|
||||||
|
|
||||||
if (item.Amount != 0)
|
if (item.Amount != 0)
|
||||||
|
{
|
||||||
expectedData.Write(ref pos, serial | 0x80000000);
|
expectedData.Write(ref pos, serial | 0x80000000);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
expectedData.Write(ref pos, serial & 0x7FFFFFFF);
|
expectedData.Write(ref pos, serial & 0x7FFFFFFF);
|
||||||
|
}
|
||||||
|
|
||||||
if (item is BaseMulti)
|
if (item is BaseMulti)
|
||||||
|
{
|
||||||
expectedData.Write(ref pos, (ushort)(item.ItemID | 0x4000));
|
expectedData.Write(ref pos, (ushort)(item.ItemID | 0x4000));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
expectedData.Write(ref pos, (ushort)item.ItemID);
|
expectedData.Write(ref pos, (ushort)item.ItemID);
|
||||||
|
}
|
||||||
|
|
||||||
if (item.Amount != 0)
|
if (item.Amount != 0)
|
||||||
|
{
|
||||||
expectedData.Write(ref pos, (ushort)item.Amount);
|
expectedData.Write(ref pos, (ushort)item.Amount);
|
||||||
|
}
|
||||||
|
|
||||||
var direction = (byte)item.Direction;
|
var direction = (byte)item.Direction;
|
||||||
var x = (ushort)(item.X & 0x7FFF);
|
var x = (ushort)(item.X & 0x7FFF);
|
||||||
|
|
||||||
if (direction != 0)
|
if (direction != 0)
|
||||||
|
{
|
||||||
x |= 0x8000;
|
x |= 0x8000;
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.Write(ref pos, x);
|
expectedData.Write(ref pos, x);
|
||||||
|
|
||||||
|
|
@ -67,21 +79,34 @@ namespace Server.Tests.Network.Packets
|
||||||
var flags = item.GetPacketFlags();
|
var flags = item.GetPacketFlags();
|
||||||
var y = (ushort)(item.Y & 0x3FFF);
|
var y = (ushort)(item.Y & 0x3FFF);
|
||||||
|
|
||||||
if (hue != 0) y |= 0x8000;
|
if (hue != 0)
|
||||||
if (flags != 0) y |= 0x4000;
|
{
|
||||||
|
y |= 0x8000;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags != 0)
|
||||||
|
{
|
||||||
|
y |= 0x4000;
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.Write(ref pos, y);
|
expectedData.Write(ref pos, y);
|
||||||
|
|
||||||
if (direction != 0)
|
if (direction != 0)
|
||||||
|
{
|
||||||
expectedData.Write(ref pos, direction);
|
expectedData.Write(ref pos, direction);
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.Write(ref pos, (byte)item.Z);
|
expectedData.Write(ref pos, (byte)item.Z);
|
||||||
|
|
||||||
if (hue != 0)
|
if (hue != 0)
|
||||||
|
{
|
||||||
expectedData.Write(ref pos, (ushort)hue);
|
expectedData.Write(ref pos, (ushort)hue);
|
||||||
|
}
|
||||||
|
|
||||||
if (flags != 0)
|
if (flags != 0)
|
||||||
|
{
|
||||||
expectedData.Write(ref pos, (byte)flags);
|
expectedData.Write(ref pos, (byte)flags);
|
||||||
|
}
|
||||||
|
|
||||||
// Length
|
// Length
|
||||||
expectedData.Slice(1, 2).Write((ushort)pos);
|
expectedData.Slice(1, 2).Write((ushort)pos);
|
||||||
|
|
@ -321,6 +346,7 @@ namespace Server.Tests.Network.Packets
|
||||||
ushort count = 0;
|
ushort count = 0;
|
||||||
|
|
||||||
for (var i = 0; i < 64; i++)
|
for (var i = 0; i < 64; i++)
|
||||||
|
{
|
||||||
if ((content & (1ul << i)) != 0)
|
if ((content & (1ul << i)) != 0)
|
||||||
{
|
{
|
||||||
expectedData.Write(ref pos, 0x7FFFFFFF - i);
|
expectedData.Write(ref pos, 0x7FFFFFFF - i);
|
||||||
|
|
@ -344,6 +370,7 @@ namespace Server.Tests.Network.Packets
|
||||||
#endif
|
#endif
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.Slice(1, 2).Write((ushort)pos); // Length
|
expectedData.Slice(1, 2).Write((ushort)pos); // Length
|
||||||
expectedData.Slice(3, 2).Write(count); // Count
|
expectedData.Slice(3, 2).Write(count); // Count
|
||||||
|
|
@ -371,6 +398,7 @@ namespace Server.Tests.Network.Packets
|
||||||
ushort count = 0;
|
ushort count = 0;
|
||||||
|
|
||||||
for (var i = 0; i < 64; i++)
|
for (var i = 0; i < 64; i++)
|
||||||
|
{
|
||||||
if ((content & (1ul << i)) != 0)
|
if ((content & (1ul << i)) != 0)
|
||||||
{
|
{
|
||||||
expectedData.Write(ref pos, 0x7FFFFFFF - i);
|
expectedData.Write(ref pos, 0x7FFFFFFF - i);
|
||||||
|
|
@ -395,6 +423,7 @@ namespace Server.Tests.Network.Packets
|
||||||
#endif
|
#endif
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.Slice(1, 2).Write((ushort)pos); // Length
|
expectedData.Slice(1, 2).Write((ushort)pos); // Length
|
||||||
expectedData.Slice(3, 2).Write(count); // Count
|
expectedData.Slice(3, 2).Write(count); // Count
|
||||||
|
|
@ -489,7 +518,9 @@ namespace Server.Tests.Network.Packets
|
||||||
{
|
{
|
||||||
var child = cont.Items[i];
|
var child = cont.Items[i];
|
||||||
if (child.Deleted || !m.CanSee(child))
|
if (child.Deleted || !m.CanSee(child))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.Write(ref pos, child.Serial);
|
expectedData.Write(ref pos, child.Serial);
|
||||||
expectedData.Write(ref pos, (ushort)child.ItemID);
|
expectedData.Write(ref pos, (ushort)child.ItemID);
|
||||||
|
|
@ -539,7 +570,9 @@ namespace Server.Tests.Network.Packets
|
||||||
{
|
{
|
||||||
var child = cont.Items[i];
|
var child = cont.Items[i];
|
||||||
if (child.Deleted || !m.CanSee(child))
|
if (child.Deleted || !m.CanSee(child))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.Write(ref pos, child.Serial);
|
expectedData.Write(ref pos, child.Serial);
|
||||||
expectedData.Write(ref pos, (ushort)child.ItemID);
|
expectedData.Write(ref pos, (ushort)child.ItemID);
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,9 @@ namespace Server.Tests.Network.Packets
|
||||||
{
|
{
|
||||||
length += 5 + entry.Name.Length;
|
length += 5 + entry.Name.Length;
|
||||||
if (entriesCount == 255)
|
if (entriesCount == 255)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
entriesCount++;
|
entriesCount++;
|
||||||
}
|
}
|
||||||
|
|
@ -104,7 +106,9 @@ namespace Server.Tests.Network.Packets
|
||||||
{
|
{
|
||||||
length += 5 + answer.Length;
|
length += 5 + answer.Length;
|
||||||
if (answersCount == 255)
|
if (answersCount == 255)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
answersCount++;
|
answersCount++;
|
||||||
}
|
}
|
||||||
|
|
@ -171,10 +175,14 @@ namespace Server.Tests.Network.Packets
|
||||||
var range = entry.Range;
|
var range = entry.Range;
|
||||||
|
|
||||||
if (range == -1)
|
if (range == -1)
|
||||||
|
{
|
||||||
range = 18;
|
range = 18;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(entry.Enabled && menu.From.InRange(item.GetWorldLocation(), range)))
|
if (!(entry.Enabled && menu.From.InRange(item.GetWorldLocation(), range)))
|
||||||
|
{
|
||||||
flags |= CMEFlags.Disabled;
|
flags |= CMEFlags.Disabled;
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.Write(ref pos, (ushort)flags);
|
expectedData.Write(ref pos, (ushort)flags);
|
||||||
}
|
}
|
||||||
|
|
@ -218,20 +226,28 @@ namespace Server.Tests.Network.Packets
|
||||||
var color = entry.Color & 0xFFFF;
|
var color = entry.Color & 0xFFFF;
|
||||||
|
|
||||||
if (color != 0xFFFF)
|
if (color != 0xFFFF)
|
||||||
|
{
|
||||||
flags |= CMEFlags.Colored;
|
flags |= CMEFlags.Colored;
|
||||||
|
}
|
||||||
|
|
||||||
var range = entry.Range;
|
var range = entry.Range;
|
||||||
|
|
||||||
if (range == -1)
|
if (range == -1)
|
||||||
|
{
|
||||||
range = 18;
|
range = 18;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(entry.Enabled && menu.From.InRange(item.GetWorldLocation(), range)))
|
if (!(entry.Enabled && menu.From.InRange(item.GetWorldLocation(), range)))
|
||||||
|
{
|
||||||
flags |= CMEFlags.Disabled;
|
flags |= CMEFlags.Disabled;
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.Write(ref pos, (ushort)flags);
|
expectedData.Write(ref pos, (ushort)flags);
|
||||||
|
|
||||||
if ((flags & CMEFlags.Colored) != 0)
|
if ((flags & CMEFlags.Colored) != 0)
|
||||||
|
{
|
||||||
expectedData.Write(ref pos, (ushort)color);
|
expectedData.Write(ref pos, (ushort)color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AssertThat.Equal(data, expectedData);
|
AssertThat.Equal(data, expectedData);
|
||||||
|
|
|
||||||
|
|
@ -261,10 +261,22 @@ namespace Server.Tests.Network.Packets
|
||||||
int type;
|
int type;
|
||||||
var notSelf = beholder != beheld;
|
var notSelf = beholder != beheld;
|
||||||
|
|
||||||
if (notSelf) type = 0;
|
if (notSelf)
|
||||||
else if (Core.HS && ns.ExtendedStatus) type = 6;
|
{
|
||||||
else if (Core.ML && ns.SupportsExpansion(Expansion.ML)) type = 5;
|
type = 0;
|
||||||
else type = Core.AOS ? 4 : 3;
|
}
|
||||||
|
else if (Core.HS && ns.ExtendedStatus)
|
||||||
|
{
|
||||||
|
type = 6;
|
||||||
|
}
|
||||||
|
else if (Core.ML && ns.SupportsExpansion(Expansion.ML))
|
||||||
|
{
|
||||||
|
type = 5;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
type = Core.AOS ? 4 : 3;
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.Write(ref pos, beheld.Serial);
|
expectedData.Write(ref pos, beheld.Serial);
|
||||||
expectedData.WriteAsciiFixed(ref pos, beheld.Name, 30);
|
expectedData.WriteAsciiFixed(ref pos, beheld.Name, 30);
|
||||||
|
|
@ -320,8 +332,12 @@ namespace Server.Tests.Network.Packets
|
||||||
expectedData.Write(ref pos, beheld.TithingPoints);
|
expectedData.Write(ref pos, beheld.TithingPoints);
|
||||||
|
|
||||||
if (type >= 6)
|
if (type >= 6)
|
||||||
|
{
|
||||||
for (var i = 0; i < 15; ++i)
|
for (var i = 0; i < 15; ++i)
|
||||||
|
{
|
||||||
expectedData.Write(ref pos, (ushort)beheld.GetAOSStatus(i));
|
expectedData.Write(ref pos, (ushort)beheld.GetAOSStatus(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedData.Slice(1, 2).Write((ushort)pos); // Length
|
expectedData.Slice(1, 2).Write((ushort)pos); // Length
|
||||||
|
|
@ -502,9 +518,14 @@ namespace Server.Tests.Network.Packets
|
||||||
var count = items.Count;
|
var count = items.Count;
|
||||||
|
|
||||||
if (beheld.HairItemID > 0)
|
if (beheld.HairItemID > 0)
|
||||||
|
{
|
||||||
count++;
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
if (beheld.FacialHairItemID > 0)
|
if (beheld.FacialHairItemID > 0)
|
||||||
|
{
|
||||||
count++;
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
var length = 23 + count * 9; // Max Size
|
var length = 23 + count * 9; // Max Size
|
||||||
|
|
||||||
|
|
@ -645,9 +666,14 @@ namespace Server.Tests.Network.Packets
|
||||||
var count = items.Count;
|
var count = items.Count;
|
||||||
|
|
||||||
if (beheld.HairItemID > 0)
|
if (beheld.HairItemID > 0)
|
||||||
|
{
|
||||||
count++;
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
if (beheld.FacialHairItemID > 0)
|
if (beheld.FacialHairItemID > 0)
|
||||||
|
{
|
||||||
count++;
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
var length = 23 + count * 9; // Max Size
|
var length = 23 + count * 9; // Max Size
|
||||||
|
|
||||||
|
|
@ -686,7 +712,9 @@ namespace Server.Tests.Network.Packets
|
||||||
hue = isSolidHue ? beheld.SolidHueOverride : item.Hue;
|
hue = isSolidHue ? beheld.SolidHueOverride : item.Hue;
|
||||||
|
|
||||||
if (hue != 0)
|
if (hue != 0)
|
||||||
|
{
|
||||||
itemId |= 0x8000;
|
itemId |= 0x8000;
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.Write(ref pos, item.Serial);
|
expectedData.Write(ref pos, item.Serial);
|
||||||
expectedData.Write(ref pos, (ushort)itemId);
|
expectedData.Write(ref pos, (ushort)itemId);
|
||||||
|
|
@ -703,7 +731,9 @@ namespace Server.Tests.Network.Packets
|
||||||
hue = isSolidHue ? beheld.SolidHueOverride : beheld.HairHue;
|
hue = isSolidHue ? beheld.SolidHueOverride : beheld.HairHue;
|
||||||
|
|
||||||
if (hue != 0)
|
if (hue != 0)
|
||||||
|
{
|
||||||
itemId |= 0x8000;
|
itemId |= 0x8000;
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.Write(ref pos, HairInfo.FakeSerial(beheld));
|
expectedData.Write(ref pos, HairInfo.FakeSerial(beheld));
|
||||||
expectedData.Write(ref pos, (ushort)itemId);
|
expectedData.Write(ref pos, (ushort)itemId);
|
||||||
|
|
@ -719,7 +749,9 @@ namespace Server.Tests.Network.Packets
|
||||||
hue = isSolidHue ? beheld.SolidHueOverride : beheld.FacialHairHue;
|
hue = isSolidHue ? beheld.SolidHueOverride : beheld.FacialHairHue;
|
||||||
|
|
||||||
if (hue != 0)
|
if (hue != 0)
|
||||||
|
{
|
||||||
itemId |= 0x8000;
|
itemId |= 0x8000;
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.Write(ref pos, FacialHairInfo.FakeSerial(beheld));
|
expectedData.Write(ref pos, FacialHairInfo.FakeSerial(beheld));
|
||||||
expectedData.Write(ref pos, (ushort)itemId);
|
expectedData.Write(ref pos, (ushort)itemId);
|
||||||
|
|
|
||||||
|
|
@ -374,9 +374,14 @@ namespace Server.Tests.Network.Packets
|
||||||
expectedData.WriteAsciiFixed(ref pos, title, 60);
|
expectedData.WriteAsciiFixed(ref pos, title, 60);
|
||||||
byte flags = 0x00;
|
byte flags = 0x00;
|
||||||
if (warmode)
|
if (warmode)
|
||||||
|
{
|
||||||
flags |= 0x01;
|
flags |= 0x01;
|
||||||
|
}
|
||||||
|
|
||||||
if (canLift)
|
if (canLift)
|
||||||
|
{
|
||||||
flags |= 0x02;
|
flags |= 0x02;
|
||||||
|
}
|
||||||
|
|
||||||
expectedData.Write(ref pos, flags);
|
expectedData.Write(ref pos, flags);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,9 @@ namespace Server.Tests.Network.Packets
|
||||||
expectedData.Write(ref pos, secondCont.Serial);
|
expectedData.Write(ref pos, secondCont.Serial);
|
||||||
expectedData.Write(ref pos, hasName);
|
expectedData.Write(ref pos, hasName);
|
||||||
if (hasName)
|
if (hasName)
|
||||||
|
{
|
||||||
expectedData.WriteAsciiFixed(ref pos, name, 30);
|
expectedData.WriteAsciiFixed(ref pos, name, 30);
|
||||||
|
}
|
||||||
|
|
||||||
AssertThat.Equal(data, expectedData);
|
AssertThat.Equal(data, expectedData);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,9 @@ namespace Server.Tests.Accounting.Security
|
||||||
{
|
{
|
||||||
var passwordProtection = Activator.CreateInstance(protectionType) as IPasswordProtection;
|
var passwordProtection = Activator.CreateInstance(protectionType) as IPasswordProtection;
|
||||||
if (passwordProtection == null)
|
if (passwordProtection == null)
|
||||||
|
{
|
||||||
Assert.False(true, $"{protectionType.Name} is not an IPasswordProtection.");
|
Assert.False(true, $"{protectionType.Name} is not an IPasswordProtection.");
|
||||||
|
}
|
||||||
|
|
||||||
var encryptedPassword = passwordProtection.EncryptPassword(plainPassword);
|
var encryptedPassword = passwordProtection.EncryptPassword(plainPassword);
|
||||||
|
|
||||||
|
|
@ -36,7 +38,9 @@ namespace Server.Tests.Accounting.Security
|
||||||
{
|
{
|
||||||
var passwordProtection = Activator.CreateInstance(protectionType) as IPasswordProtection;
|
var passwordProtection = Activator.CreateInstance(protectionType) as IPasswordProtection;
|
||||||
if (passwordProtection == null)
|
if (passwordProtection == null)
|
||||||
|
{
|
||||||
Assert.False(true, $"{protectionType.Name} is not an IPasswordProtection.");
|
Assert.False(true, $"{protectionType.Name} is not an IPasswordProtection.");
|
||||||
|
}
|
||||||
|
|
||||||
var encryptedPassword = passwordProtection.EncryptPassword(plainPassword);
|
var encryptedPassword = passwordProtection.EncryptPassword(plainPassword);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,9 @@ namespace Server.Accounting
|
||||||
var filePath = Path.Combine("Saves/Accounts", "accounts.xml");
|
var filePath = Path.Combine("Saves/Accounts", "accounts.xml");
|
||||||
|
|
||||||
if (!File.Exists(filePath))
|
if (!File.Exists(filePath))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var doc = new XmlDocument();
|
var doc = new XmlDocument();
|
||||||
doc.Load(filePath);
|
doc.Load(filePath);
|
||||||
|
|
@ -55,6 +57,7 @@ namespace Server.Accounting
|
||||||
var root = doc["accounts"];
|
var root = doc["accounts"];
|
||||||
|
|
||||||
foreach (XmlElement account in root.GetElementsByTagName("account"))
|
foreach (XmlElement account in root.GetElementsByTagName("account"))
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
new Account(account);
|
new Account(account);
|
||||||
|
|
@ -63,12 +66,15 @@ namespace Server.Accounting
|
||||||
{
|
{
|
||||||
Console.WriteLine("Warning: Account instance load failed");
|
Console.WriteLine("Warning: Account instance load failed");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Save(bool message)
|
public static void Save(bool message)
|
||||||
{
|
{
|
||||||
if (!Directory.Exists("Saves/Accounts"))
|
if (!Directory.Exists("Saves/Accounts"))
|
||||||
|
{
|
||||||
Directory.CreateDirectory("Saves/Accounts");
|
Directory.CreateDirectory("Saves/Accounts");
|
||||||
|
}
|
||||||
|
|
||||||
var filePath = Path.Combine("Saves/Accounts", "accounts.xml");
|
var filePath = Path.Combine("Saves/Accounts", "accounts.xml");
|
||||||
|
|
||||||
|
|
@ -82,7 +88,9 @@ namespace Server.Accounting
|
||||||
xml.WriteAttributeString("count", m_Accounts.Count.ToString());
|
xml.WriteAttributeString("count", m_Accounts.Count.ToString());
|
||||||
|
|
||||||
foreach (Account a in GetAccounts())
|
foreach (Account a in GetAccounts())
|
||||||
|
{
|
||||||
a.Save(xml);
|
a.Save(xml);
|
||||||
|
}
|
||||||
|
|
||||||
xml.WriteEndElement();
|
xml.WriteEndElement();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,9 @@ namespace Server
|
||||||
line = line.Trim();
|
line = line.Trim();
|
||||||
|
|
||||||
if (line.Length == 0)
|
if (line.Length == 0)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
List.Add(ToFirewallEntry(line));
|
List.Add(ToFirewallEntry(line));
|
||||||
|
|
||||||
|
|
@ -46,11 +48,19 @@ namespace Server
|
||||||
public static IFirewallEntry ToFirewallEntry(object entry)
|
public static IFirewallEntry ToFirewallEntry(object entry)
|
||||||
{
|
{
|
||||||
if (entry is IFirewallEntry firewallEntry)
|
if (entry is IFirewallEntry firewallEntry)
|
||||||
|
{
|
||||||
return firewallEntry;
|
return firewallEntry;
|
||||||
|
}
|
||||||
|
|
||||||
if (entry is IPAddress address)
|
if (entry is IPAddress address)
|
||||||
|
{
|
||||||
return new IPFirewallEntry(address);
|
return new IPFirewallEntry(address);
|
||||||
|
}
|
||||||
|
|
||||||
if (entry is string s)
|
if (entry is string s)
|
||||||
|
{
|
||||||
return ToFirewallEntry(s);
|
return ToFirewallEntry(s);
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -58,15 +68,23 @@ namespace Server
|
||||||
public static IFirewallEntry ToFirewallEntry(string entry)
|
public static IFirewallEntry ToFirewallEntry(string entry)
|
||||||
{
|
{
|
||||||
if (IPAddress.TryParse(entry, out var addr))
|
if (IPAddress.TryParse(entry, out var addr))
|
||||||
|
{
|
||||||
return new IPFirewallEntry(addr);
|
return new IPFirewallEntry(addr);
|
||||||
|
}
|
||||||
|
|
||||||
// Try CIDR parse
|
// Try CIDR parse
|
||||||
var str = entry.Split('/');
|
var str = entry.Split('/');
|
||||||
|
|
||||||
if (str.Length == 2)
|
if (str.Length == 2)
|
||||||
|
{
|
||||||
if (IPAddress.TryParse(str[0], out var cidrPrefix))
|
if (IPAddress.TryParse(str[0], out var cidrPrefix))
|
||||||
|
{
|
||||||
if (int.TryParse(str[1], out var cidrLength))
|
if (int.TryParse(str[1], out var cidrLength))
|
||||||
|
{
|
||||||
return new CIDRFirewallEntry(cidrPrefix, cidrLength);
|
return new CIDRFirewallEntry(cidrPrefix, cidrLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new WildcardIPFirewallEntry(entry);
|
return new WildcardIPFirewallEntry(entry);
|
||||||
}
|
}
|
||||||
|
|
@ -91,17 +109,25 @@ namespace Server
|
||||||
public static void Add(object obj)
|
public static void Add(object obj)
|
||||||
{
|
{
|
||||||
if (obj is IPAddress address)
|
if (obj is IPAddress address)
|
||||||
|
{
|
||||||
Add(address);
|
Add(address);
|
||||||
|
}
|
||||||
else if (obj is string s)
|
else if (obj is string s)
|
||||||
|
{
|
||||||
Add(s);
|
Add(s);
|
||||||
|
}
|
||||||
else if (obj is IFirewallEntry entry)
|
else if (obj is IFirewallEntry entry)
|
||||||
|
{
|
||||||
Add(entry);
|
Add(entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Add(IFirewallEntry entry)
|
public static void Add(IFirewallEntry entry)
|
||||||
{
|
{
|
||||||
if (!List.Contains(entry))
|
if (!List.Contains(entry))
|
||||||
|
{
|
||||||
List.Add(entry);
|
List.Add(entry);
|
||||||
|
}
|
||||||
|
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
@ -111,7 +137,9 @@ namespace Server
|
||||||
var entry = ToFirewallEntry(pattern);
|
var entry = ToFirewallEntry(pattern);
|
||||||
|
|
||||||
if (!List.Contains(entry))
|
if (!List.Contains(entry))
|
||||||
|
{
|
||||||
List.Add(entry);
|
List.Add(entry);
|
||||||
|
}
|
||||||
|
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
@ -121,7 +149,9 @@ namespace Server
|
||||||
IFirewallEntry entry = new IPFirewallEntry(ip);
|
IFirewallEntry entry = new IPFirewallEntry(ip);
|
||||||
|
|
||||||
if (!List.Contains(entry))
|
if (!List.Contains(entry))
|
||||||
|
{
|
||||||
List.Add(entry);
|
List.Add(entry);
|
||||||
|
}
|
||||||
|
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
@ -132,14 +162,20 @@ namespace Server
|
||||||
|
|
||||||
using var op = new StreamWriter(path);
|
using var op = new StreamWriter(path);
|
||||||
for (var i = 0; i < List.Count; ++i)
|
for (var i = 0; i < List.Count; ++i)
|
||||||
|
{
|
||||||
op.WriteLine(List[i]);
|
op.WriteLine(List[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsBlocked(IPAddress ip)
|
public static bool IsBlocked(IPAddress ip)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < List.Count; i++)
|
for (var i = 0; i < List.Count; i++)
|
||||||
|
{
|
||||||
if (List[i].IsBlocked(ip))
|
if (List[i].IsBlocked(ip))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
/*
|
/*
|
||||||
|
|
@ -182,11 +218,16 @@ namespace Server
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
{
|
{
|
||||||
if (obj is IPAddress)
|
if (obj is IPAddress)
|
||||||
|
{
|
||||||
return obj.Equals(m_Address);
|
return obj.Equals(m_Address);
|
||||||
|
}
|
||||||
|
|
||||||
if (obj is string s)
|
if (obj is string s)
|
||||||
{
|
{
|
||||||
if (IPAddress.TryParse(s, out var otherAddress))
|
if (IPAddress.TryParse(s, out var otherAddress))
|
||||||
|
{
|
||||||
return otherAddress.Equals(m_Address);
|
return otherAddress.Equals(m_Address);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (obj is IPFirewallEntry entry)
|
else if (obj is IPFirewallEntry entry)
|
||||||
{
|
{
|
||||||
|
|
@ -221,9 +262,15 @@ namespace Server
|
||||||
var str = entry.Split('/');
|
var str = entry.Split('/');
|
||||||
|
|
||||||
if (str.Length == 2)
|
if (str.Length == 2)
|
||||||
|
{
|
||||||
if (IPAddress.TryParse(str[0], out var cidrPrefix))
|
if (IPAddress.TryParse(str[0], out var cidrPrefix))
|
||||||
|
{
|
||||||
if (int.TryParse(str[1], out var cidrLength))
|
if (int.TryParse(str[1], out var cidrLength))
|
||||||
|
{
|
||||||
return m_CIDRPrefix.Equals(cidrPrefix) && m_CIDRLength.Equals(cidrLength);
|
return m_CIDRPrefix.Equals(cidrPrefix) && m_CIDRLength.Equals(cidrLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (obj is CIDRFirewallEntry cidrEntry)
|
else if (obj is CIDRFirewallEntry cidrEntry)
|
||||||
{
|
{
|
||||||
|
|
@ -247,7 +294,9 @@ namespace Server
|
||||||
public bool IsBlocked(IPAddress address)
|
public bool IsBlocked(IPAddress address)
|
||||||
{
|
{
|
||||||
if (!m_Valid)
|
if (!m_Valid)
|
||||||
|
{
|
||||||
return false; // Why process if it's invalid? it'll return false anyway after processing it.
|
return false; // Why process if it's invalid? it'll return false anyway after processing it.
|
||||||
|
}
|
||||||
|
|
||||||
var matched = Utility.IPMatch(m_Entry, address, out var valid);
|
var matched = Utility.IPMatch(m_Entry, address, out var valid);
|
||||||
m_Valid = valid;
|
m_Valid = valid;
|
||||||
|
|
@ -259,7 +308,9 @@ namespace Server
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
{
|
{
|
||||||
if (obj is string)
|
if (obj is string)
|
||||||
|
{
|
||||||
return obj.Equals(m_Entry);
|
return obj.Equals(m_Entry);
|
||||||
|
}
|
||||||
|
|
||||||
return obj is WildcardIPFirewallEntry entry && m_Entry.Equals(entry.m_Entry);
|
return obj is WildcardIPFirewallEntry entry && m_Entry.Equals(entry.m_Entry);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,9 @@ namespace Server.Misc
|
||||||
public static bool Verify(IPAddress ourAddress)
|
public static bool Verify(IPAddress ourAddress)
|
||||||
{
|
{
|
||||||
if (!Enabled || IsExempt(ourAddress))
|
if (!Enabled || IsExempt(ourAddress))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
var netStates = TcpServer.Instances;
|
var netStates = TcpServer.Instances;
|
||||||
|
|
||||||
|
|
@ -42,7 +44,9 @@ namespace Server.Misc
|
||||||
++count;
|
++count;
|
||||||
|
|
||||||
if (count >= MaxAddresses)
|
if (count >= MaxAddresses)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,9 @@ namespace Server.Accounting.Security
|
||||||
);
|
);
|
||||||
|
|
||||||
if (CurrentAlgorithm < PasswordProtectionAlgorithm.SHA2)
|
if (CurrentAlgorithm < PasswordProtectionAlgorithm.SHA2)
|
||||||
|
{
|
||||||
throw new Exception($"Security: {CurrentAlgorithm} is obsolete and not secure. Do not use it.");
|
throw new Exception($"Security: {CurrentAlgorithm} is obsolete and not secure. Do not use it.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IPasswordProtection GetPasswordProtection(PasswordProtectionAlgorithm algorithm)
|
public static IPasswordProtection GetPasswordProtection(PasswordProtectionAlgorithm algorithm)
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,10 @@ namespace Server.Commands
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!command.ValidateArgs(Scope, eventArgs[i])) return;
|
if (!command.ValidateArgs(Scope, eventArgs[i]))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < commands.Length; ++i)
|
for (var i = 0; i < commands.Length; ++i)
|
||||||
|
|
@ -69,7 +72,9 @@ namespace Server.Commands
|
||||||
var bc = BatchCommands[i];
|
var bc = BatchCommands[i];
|
||||||
|
|
||||||
if (list.Count > 20)
|
if (list.Count > 20)
|
||||||
|
{
|
||||||
CommandLogging.Enabled = false;
|
CommandLogging.Enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
List<object> usedList;
|
List<object> usedList;
|
||||||
|
|
||||||
|
|
@ -88,12 +93,15 @@ namespace Server.Commands
|
||||||
var obj = list[j];
|
var obj = list[j];
|
||||||
|
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var type = obj.GetType();
|
var type = obj.GetType();
|
||||||
var failReason = "";
|
var failReason = "";
|
||||||
|
|
||||||
if (!propertyChains.TryGetValue(type, out var chain))
|
if (!propertyChains.TryGetValue(type, out var chain))
|
||||||
|
{
|
||||||
propertyChains[type] = chain = Properties.GetPropertyInfoChain(
|
propertyChains[type] = chain = Properties.GetPropertyInfoChain(
|
||||||
e.Mobile,
|
e.Mobile,
|
||||||
type,
|
type,
|
||||||
|
|
@ -101,21 +109,28 @@ namespace Server.Commands
|
||||||
PropertyAccess.Read,
|
PropertyAccess.Read,
|
||||||
ref failReason
|
ref failReason
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (chain == null)
|
if (chain == null)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var endProp = Properties.GetPropertyInfo(ref obj, chain, ref failReason);
|
var endProp = Properties.GetPropertyInfo(ref obj, chain, ref failReason);
|
||||||
|
|
||||||
if (endProp == null)
|
if (endProp == null)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
obj = endProp.GetValue(obj, null);
|
obj = endProp.GetValue(obj, null);
|
||||||
|
|
||||||
if (obj != null)
|
if (obj != null)
|
||||||
|
{
|
||||||
usedList.Add(obj);
|
usedList.Add(obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
@ -127,7 +142,9 @@ namespace Server.Commands
|
||||||
command.ExecuteList(eventArgs[i], usedList);
|
command.ExecuteList(eventArgs[i], usedList);
|
||||||
|
|
||||||
if (list.Count > 20)
|
if (list.Count > 20)
|
||||||
|
{
|
||||||
CommandLogging.Enabled = true;
|
CommandLogging.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
command.Flush(e.Mobile, list.Count > 20);
|
command.Flush(e.Mobile, list.Count > 20);
|
||||||
}
|
}
|
||||||
|
|
@ -304,12 +321,16 @@ namespace Server.Commands
|
||||||
public override void OnResponse(NetState sender, RelayInfo info)
|
public override void OnResponse(NetState sender, RelayInfo info)
|
||||||
{
|
{
|
||||||
if (!SplitButtonID(info.ButtonID, 1, out var type, out var index))
|
if (!SplitButtonID(info.ButtonID, 1, out var type, out var index))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var entry = info.GetTextEntry(0);
|
var entry = info.GetTextEntry(0);
|
||||||
|
|
||||||
if (entry != null)
|
if (entry != null)
|
||||||
|
{
|
||||||
m_Batch.Condition = entry.Text;
|
m_Batch.Condition = entry.Text;
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = m_Batch.BatchCommands.Count - 1; i >= 0; --i)
|
for (var i = m_Batch.BatchCommands.Count - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
|
|
@ -318,15 +339,21 @@ namespace Server.Commands
|
||||||
entry = info.GetTextEntry(1 + i * 2);
|
entry = info.GetTextEntry(1 + i * 2);
|
||||||
|
|
||||||
if (entry != null)
|
if (entry != null)
|
||||||
|
{
|
||||||
sc.Command = entry.Text;
|
sc.Command = entry.Text;
|
||||||
|
}
|
||||||
|
|
||||||
entry = info.GetTextEntry(2 + i * 2);
|
entry = info.GetTextEntry(2 + i * 2);
|
||||||
|
|
||||||
if (entry != null)
|
if (entry != null)
|
||||||
|
{
|
||||||
sc.Object = entry.Text;
|
sc.Object = entry.Text;
|
||||||
|
}
|
||||||
|
|
||||||
if (sc.Command.Length == 0 && sc.Object.Length == 0)
|
if (sc.Command.Length == 0 && sc.Object.Length == 0)
|
||||||
|
{
|
||||||
m_Batch.BatchCommands.RemoveAt(i);
|
m_Batch.BatchCommands.RemoveAt(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
|
|
@ -388,7 +415,9 @@ namespace Server.Commands
|
||||||
var impl = BaseCommandImplementor.Implementors[i];
|
var impl = BaseCommandImplementor.Implementors[i];
|
||||||
|
|
||||||
if (m_From.AccessLevel < impl.AccessLevel)
|
if (m_From.AccessLevel < impl.AccessLevel)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
AddNewLine();
|
AddNewLine();
|
||||||
|
|
||||||
|
|
@ -402,6 +431,7 @@ namespace Server.Commands
|
||||||
public override void OnResponse(NetState sender, RelayInfo info)
|
public override void OnResponse(NetState sender, RelayInfo info)
|
||||||
{
|
{
|
||||||
if (SplitButtonID(info.ButtonID, 1, out var type, out var index))
|
if (SplitButtonID(info.ButtonID, 1, out var type, out var index))
|
||||||
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
|
@ -411,12 +441,15 @@ namespace Server.Commands
|
||||||
var impl = BaseCommandImplementor.Implementors[index];
|
var impl = BaseCommandImplementor.Implementors[index];
|
||||||
|
|
||||||
if (m_From.AccessLevel >= impl.AccessLevel)
|
if (m_From.AccessLevel >= impl.AccessLevel)
|
||||||
|
{
|
||||||
m_Batch.Scope = impl;
|
m_Batch.Scope = impl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_From.SendGump(new BatchGump(m_From, m_Batch));
|
m_From.SendGump(new BatchGump(m_From, m_Batch));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,14 @@ namespace Server
|
||||||
protected override void OnTarget(Mobile from, object targeted)
|
protected override void OnTarget(Mobile from, object targeted)
|
||||||
{
|
{
|
||||||
if (!(targeted is IPoint3D p))
|
if (!(targeted is IPoint3D p))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (p is Item item)
|
if (p is Item item)
|
||||||
|
{
|
||||||
p = item.GetWorldTop();
|
p = item.GetWorldTop();
|
||||||
|
}
|
||||||
|
|
||||||
if (m_First)
|
if (m_First)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -19,7 +19,10 @@ namespace Server.Commands
|
||||||
{
|
{
|
||||||
var amount = 1;
|
var amount = 1;
|
||||||
if (e.Length >= 1)
|
if (e.Length >= 1)
|
||||||
|
{
|
||||||
amount = e.GetInt32(0);
|
amount = e.GetInt32(0);
|
||||||
|
}
|
||||||
|
|
||||||
e.Mobile.Target = new DupeTarget(false, amount > 0 ? amount : 1);
|
e.Mobile.Target = new DupeTarget(false, amount > 0 ? amount : 1);
|
||||||
e.Mobile.SendMessage("What do you wish to dupe?");
|
e.Mobile.SendMessage("What do you wish to dupe?");
|
||||||
}
|
}
|
||||||
|
|
@ -30,7 +33,9 @@ namespace Server.Commands
|
||||||
{
|
{
|
||||||
var amount = 1;
|
var amount = 1;
|
||||||
if (e.Length >= 1)
|
if (e.Length >= 1)
|
||||||
|
{
|
||||||
amount = e.GetInt32(0);
|
amount = e.GetInt32(0);
|
||||||
|
}
|
||||||
|
|
||||||
e.Mobile.Target = new DupeTarget(true, amount > 0 ? amount : 1);
|
e.Mobile.Target = new DupeTarget(true, amount > 0 ? amount : 1);
|
||||||
e.Mobile.SendMessage("What do you wish to dupe?");
|
e.Mobile.SendMessage("What do you wish to dupe?");
|
||||||
|
|
@ -41,14 +46,19 @@ namespace Server.Commands
|
||||||
var props = src.GetType().GetProperties();
|
var props = src.GetType().GetProperties();
|
||||||
|
|
||||||
for (var i = 0; i < props.Length; i++)
|
for (var i = 0; i < props.Length; i++)
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (props[i].CanRead && props[i].CanWrite) props[i].SetValue(dest, props[i].GetValue(src, null), null);
|
if (props[i].CanRead && props[i].CanWrite)
|
||||||
|
{
|
||||||
|
props[i].SetValue(dest, props[i].GetValue(src, null), null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
// Console.WriteLine( "Denied" );
|
// Console.WriteLine( "Denied" );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DupeTarget : Target
|
private class DupeTarget : Target
|
||||||
|
|
@ -88,9 +98,13 @@ namespace Server.Commands
|
||||||
if (m_InBag)
|
if (m_InBag)
|
||||||
{
|
{
|
||||||
if (copy.Parent is Container cont)
|
if (copy.Parent is Container cont)
|
||||||
|
{
|
||||||
pack = cont;
|
pack = cont;
|
||||||
|
}
|
||||||
else if (copy.Parent is Mobile m)
|
else if (copy.Parent is Mobile m)
|
||||||
|
{
|
||||||
pack = m.Backpack;
|
pack = m.Backpack;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -102,11 +116,16 @@ namespace Server.Commands
|
||||||
{
|
{
|
||||||
var paramList = c.GetParameters();
|
var paramList = c.GetParameters();
|
||||||
var args = paramList.Length == 0 ? null : new object[paramList.Length];
|
var args = paramList.Length == 0 ? null : new object[paramList.Length];
|
||||||
if (args != null) Array.Fill(args, Type.Missing);
|
if (args != null)
|
||||||
|
{
|
||||||
|
Array.Fill(args, Type.Missing);
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
from.SendMessage("Duping {0}...", m_Amount);
|
from.SendMessage("Duping {0}...", m_Amount);
|
||||||
for (var i = 0; i < m_Amount; i++)
|
for (var i = 0; i < m_Amount; i++)
|
||||||
|
{
|
||||||
if (c.Invoke(args) is Item newItem)
|
if (c.Invoke(args) is Item newItem)
|
||||||
{
|
{
|
||||||
CopyProperties(newItem, copy); // copy.Dupe( item, copy.Amount );
|
CopyProperties(newItem, copy); // copy.Dupe( item, copy.Amount );
|
||||||
|
|
@ -114,21 +133,26 @@ namespace Server.Commands
|
||||||
newItem.Parent = null;
|
newItem.Parent = null;
|
||||||
|
|
||||||
if (pack != null)
|
if (pack != null)
|
||||||
|
{
|
||||||
pack.DropItem(newItem);
|
pack.DropItem(newItem);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
newItem.MoveToWorld(from.Location, from.Map);
|
{
|
||||||
|
newItem.MoveToWorld(@from.Location, @from.Map);
|
||||||
|
}
|
||||||
|
|
||||||
newItem.InvalidateProperties();
|
newItem.InvalidateProperties();
|
||||||
|
|
||||||
CommandLogging.WriteLine(
|
CommandLogging.WriteLine(
|
||||||
from,
|
@from,
|
||||||
"{0} {1} duped {2} creating {3}",
|
"{0} {1} duped {2} creating {3}",
|
||||||
from.AccessLevel,
|
@from.AccessLevel,
|
||||||
CommandLogging.Format(from),
|
CommandLogging.Format(@from),
|
||||||
CommandLogging.Format(targ),
|
CommandLogging.Format(targ),
|
||||||
CommandLogging.Format(newItem)
|
CommandLogging.Format(newItem)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
from.SendMessage("Done");
|
from.SendMessage("Done");
|
||||||
done = true;
|
done = true;
|
||||||
|
|
@ -140,7 +164,10 @@ namespace Server.Commands
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!done) from.SendMessage("Unable to dupe. Item must have a 0 parameter constructor.");
|
if (!done)
|
||||||
|
{
|
||||||
|
@from.SendMessage("Unable to dupe. Item must have a 0 parameter constructor.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ namespace Server.Commands
|
||||||
e.Mobile.SendMessage("This will delete all static items in the world. Please make a backup.");
|
e.Mobile.SendMessage("This will delete all static items in the world. Please make a backup.");
|
||||||
|
|
||||||
foreach (var item in World.Items.Values)
|
foreach (var item in World.Items.Values)
|
||||||
|
{
|
||||||
if ((item is Static || item is BaseFloor || item is BaseWall)
|
if ((item is Static || item is BaseFloor || item is BaseWall)
|
||||||
&& item.RootParent == null)
|
&& item.RootParent == null)
|
||||||
{
|
{
|
||||||
|
|
@ -50,11 +51,14 @@ namespace Server.Commands
|
||||||
remove.Add(item);
|
remove.Add(item);
|
||||||
w.Flush();
|
w.Flush();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
w.Close();
|
w.Close();
|
||||||
|
|
||||||
foreach (var item in remove)
|
foreach (var item in remove)
|
||||||
|
{
|
||||||
item.Delete();
|
item.Delete();
|
||||||
|
}
|
||||||
|
|
||||||
e.Mobile.SendMessage("Export complete. Exported {0} statics.", count);
|
e.Mobile.SendMessage("Export complete. Exported {0} statics.", count);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,14 +32,20 @@ namespace Server.Commands.Generic
|
||||||
public static bool IsAccessible(Mobile from, object obj)
|
public static bool IsAccessible(Mobile from, object obj)
|
||||||
{
|
{
|
||||||
if (from.AccessLevel >= AccessLevel.Administrator || obj == null)
|
if (from.AccessLevel >= AccessLevel.Administrator || obj == null)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Mobile mob = null;
|
Mobile mob = null;
|
||||||
|
|
||||||
if (obj is Mobile m)
|
if (obj is Mobile m)
|
||||||
|
{
|
||||||
mob = m;
|
mob = m;
|
||||||
|
}
|
||||||
else if (obj is Item item)
|
else if (obj is Item item)
|
||||||
|
{
|
||||||
mob = item.RootParent as Mobile;
|
mob = item.RootParent as Mobile;
|
||||||
|
}
|
||||||
|
|
||||||
return mob == null || mob == from || from.AccessLevel > mob.AccessLevel;
|
return mob == null || mob == from || from.AccessLevel > mob.AccessLevel;
|
||||||
}
|
}
|
||||||
|
|
@ -47,7 +53,9 @@ namespace Server.Commands.Generic
|
||||||
public virtual void ExecuteList(CommandEventArgs e, List<object> list)
|
public virtual void ExecuteList(CommandEventArgs e, List<object> list)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < list.Count; ++i)
|
for (var i = 0; i < list.Count; ++i)
|
||||||
|
{
|
||||||
Execute(e, list[i]);
|
Execute(e, list[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Execute(CommandEventArgs e, object obj)
|
public virtual void Execute(CommandEventArgs e, object obj)
|
||||||
|
|
@ -70,7 +78,9 @@ namespace Server.Commands.Generic
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Responses.Count == 10)
|
if (m_Responses.Count == 10)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_Responses.Add(new MessageEntry(message));
|
m_Responses.Add(new MessageEntry(message));
|
||||||
}
|
}
|
||||||
|
|
@ -89,7 +99,9 @@ namespace Server.Commands.Generic
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Failures.Count == 10)
|
if (m_Failures.Count == 10)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_Failures.Add(new MessageEntry(message));
|
m_Failures.Add(new MessageEntry(message));
|
||||||
}
|
}
|
||||||
|
|
@ -97,18 +109,26 @@ namespace Server.Commands.Generic
|
||||||
public void Flush(Mobile from, bool flushToLog)
|
public void Flush(Mobile from, bool flushToLog)
|
||||||
{
|
{
|
||||||
if (m_Responses.Count > 0)
|
if (m_Responses.Count > 0)
|
||||||
|
{
|
||||||
for (var i = 0; i < m_Responses.Count; ++i)
|
for (var i = 0; i < m_Responses.Count; ++i)
|
||||||
{
|
{
|
||||||
var entry = m_Responses[i];
|
var entry = m_Responses[i];
|
||||||
|
|
||||||
from.SendMessage(entry.ToString());
|
@from.SendMessage(entry.ToString());
|
||||||
|
|
||||||
if (flushToLog)
|
if (flushToLog)
|
||||||
CommandLogging.WriteLine(from, entry.ToString());
|
{
|
||||||
|
CommandLogging.WriteLine(@from, entry.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
for (var i = 0; i < m_Failures.Count; ++i)
|
for (var i = 0; i < m_Failures.Count; ++i)
|
||||||
from.SendMessage(m_Failures[i].ToString());
|
{
|
||||||
|
@from.SendMessage(m_Failures[i].ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_Responses.Clear();
|
m_Responses.Clear();
|
||||||
m_Failures.Clear();
|
m_Failures.Clear();
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,9 @@ namespace Server.Commands.Generic
|
||||||
var impl = impls[i];
|
var impl = impls[i];
|
||||||
|
|
||||||
if ((command.Supports & impl.SupportRequirement) != 0)
|
if ((command.Supports & impl.SupportRequirement) != 0)
|
||||||
|
{
|
||||||
impl.Register(command);
|
impl.Register(command);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -106,10 +108,16 @@ namespace Server.Commands.Generic
|
||||||
var condition = ObjectConditional.Parse(e.Mobile, ref args);
|
var condition = ObjectConditional.Parse(e.Mobile, ref args);
|
||||||
|
|
||||||
for (var i = 0; i < list.Count; ++i)
|
for (var i = 0; i < list.Count; ++i)
|
||||||
|
{
|
||||||
if (condition.CheckCondition(list[i]))
|
if (condition.CheckCondition(list[i]))
|
||||||
|
{
|
||||||
AddResponse("True - that object matches the condition.");
|
AddResponse("True - that object matches the condition.");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddResponse("False - that object does not match the condition.");
|
AddResponse("False - that object does not match the condition.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
@ -135,9 +143,13 @@ namespace Server.Commands.Generic
|
||||||
if (obj is Item item)
|
if (obj is Item item)
|
||||||
{
|
{
|
||||||
if (e.Mobile.PlaceInBackpack(item))
|
if (e.Mobile.PlaceInBackpack(item))
|
||||||
|
{
|
||||||
AddResponse("The item has been placed in your backpack.");
|
AddResponse("The item has been placed in your backpack.");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddResponse("Your backpack could not hold the item.");
|
AddResponse("Your backpack could not hold the item.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -194,9 +206,13 @@ namespace Server.Commands.Generic
|
||||||
public override void ExecuteList(CommandEventArgs e, List<object> list)
|
public override void ExecuteList(CommandEventArgs e, List<object> list)
|
||||||
{
|
{
|
||||||
if (list.Count == 1)
|
if (list.Count == 1)
|
||||||
|
{
|
||||||
AddResponse("There is one matching object.");
|
AddResponse("There is one matching object.");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddResponse($"There are {list.Count} matching objects.");
|
AddResponse($"There are {list.Count} matching objects.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -217,14 +233,18 @@ namespace Server.Commands.Generic
|
||||||
if (okay)
|
if (okay)
|
||||||
{
|
{
|
||||||
if (echo)
|
if (echo)
|
||||||
gm.SendMessage("{0} : has opened their web browser to : {1}", from.Name, url);
|
{
|
||||||
|
gm.SendMessage("{0} : has opened their web browser to : {1}", @from.Name, url);
|
||||||
|
}
|
||||||
|
|
||||||
from.LaunchBrowser(url);
|
from.LaunchBrowser(url);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (echo)
|
if (echo)
|
||||||
gm.SendMessage("{0} : has chosen not to open their web browser to : {1}", from.Name, url);
|
{
|
||||||
|
gm.SendMessage("{0} : has chosen not to open their web browser to : {1}", @from.Name, url);
|
||||||
|
}
|
||||||
|
|
||||||
from.SendMessage("You have chosen not to open your web browser.");
|
from.SendMessage("You have chosen not to open your web browser.");
|
||||||
}
|
}
|
||||||
|
|
@ -259,9 +279,13 @@ namespace Server.Commands.Generic
|
||||||
);
|
);
|
||||||
|
|
||||||
if (echo)
|
if (echo)
|
||||||
|
{
|
||||||
AddResponse("Awaiting user confirmation...");
|
AddResponse("Awaiting user confirmation...");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddResponse("Open web browser request sent.");
|
AddResponse("Open web browser request sent.");
|
||||||
|
}
|
||||||
|
|
||||||
mob.SendGump(
|
mob.SendGump(
|
||||||
new WarningGump(
|
new WarningGump(
|
||||||
|
|
@ -295,7 +319,9 @@ namespace Server.Commands.Generic
|
||||||
public override void ExecuteList(CommandEventArgs e, List<object> list)
|
public override void ExecuteList(CommandEventArgs e, List<object> list)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < list.Count; ++i)
|
for (var i = 0; i < list.Count; ++i)
|
||||||
|
{
|
||||||
Execute(e, list[i], false);
|
Execute(e, list[i], false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -324,9 +350,13 @@ namespace Server.Commands.Generic
|
||||||
if (result == "The property has been increased." || result == "The properties have been increased." ||
|
if (result == "The property has been increased." || result == "The properties have been increased." ||
|
||||||
result == "The property has been decreased." || result == "The properties have been decreased." ||
|
result == "The property has been decreased." || result == "The properties have been decreased." ||
|
||||||
result == "The properties have been changed.")
|
result == "The properties have been changed.")
|
||||||
|
{
|
||||||
AddResponse(result);
|
AddResponse(result);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
LogFailure(result);
|
LogFailure(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -415,9 +445,13 @@ namespace Server.Commands.Generic
|
||||||
);
|
);
|
||||||
|
|
||||||
if (m_InGump)
|
if (m_InGump)
|
||||||
mob.SendGump(new MessageSentGump(mob, from.Name, e.ArgString));
|
{
|
||||||
|
mob.SendGump(new MessageSentGump(mob, @from.Name, e.ArgString));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
mob.SendMessage(e.ArgString);
|
mob.SendMessage(e.ArgString);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -438,7 +472,9 @@ namespace Server.Commands.Generic
|
||||||
public override void ExecuteList(CommandEventArgs e, List<object> list)
|
public override void ExecuteList(CommandEventArgs e, List<object> list)
|
||||||
{
|
{
|
||||||
if (e.Arguments.Length == 0)
|
if (e.Arguments.Length == 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var packs = new List<Container>(list.Count);
|
var packs = new List<Container>(list.Count);
|
||||||
|
|
||||||
|
|
@ -448,14 +484,22 @@ namespace Server.Commands.Generic
|
||||||
Container cont = null;
|
Container cont = null;
|
||||||
|
|
||||||
if (obj is Mobile mobile)
|
if (obj is Mobile mobile)
|
||||||
|
{
|
||||||
cont = mobile.Backpack;
|
cont = mobile.Backpack;
|
||||||
|
}
|
||||||
else if (obj is Container container)
|
else if (obj is Container container)
|
||||||
|
{
|
||||||
cont = container;
|
cont = container;
|
||||||
|
}
|
||||||
|
|
||||||
if (cont != null)
|
if (cont != null)
|
||||||
|
{
|
||||||
packs.Add(cont);
|
packs.Add(cont);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
LogFailure("That is not a container.");
|
LogFailure("That is not a container.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Add.Invoke(e.Mobile, e.Mobile.Location, e.Mobile.Location, e.Arguments, packs);
|
Add.Invoke(e.Mobile, e.Mobile.Location, e.Mobile.Location, e.Arguments, packs);
|
||||||
|
|
@ -513,12 +557,18 @@ namespace Server.Commands.Generic
|
||||||
public override void Execute(CommandEventArgs e, object obj)
|
public override void Execute(CommandEventArgs e, object obj)
|
||||||
{
|
{
|
||||||
if (!(obj is IPoint3D p))
|
if (!(obj is IPoint3D p))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (p is Item item)
|
if (p is Item item)
|
||||||
|
{
|
||||||
p = item.GetWorldTop();
|
p = item.GetWorldTop();
|
||||||
|
}
|
||||||
else if (p is Mobile m)
|
else if (p is Mobile m)
|
||||||
|
{
|
||||||
p = m.Location;
|
p = m.Location;
|
||||||
|
}
|
||||||
|
|
||||||
Add.Invoke(e.Mobile, new Point3D(p), new Point3D(p), e.Arguments);
|
Add.Invoke(e.Mobile, new Point3D(p), new Point3D(p), e.Arguments);
|
||||||
}
|
}
|
||||||
|
|
@ -539,7 +589,9 @@ namespace Server.Commands.Generic
|
||||||
public override void Execute(CommandEventArgs e, object obj)
|
public override void Execute(CommandEventArgs e, object obj)
|
||||||
{
|
{
|
||||||
if (!(obj is IPoint3D p))
|
if (!(obj is IPoint3D p))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var from = e.Mobile;
|
var from = e.Mobile;
|
||||||
|
|
||||||
|
|
@ -617,7 +669,9 @@ namespace Server.Commands.Generic
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mob.Items.IndexOf(item) == -1)
|
if (mob.Items.IndexOf(item) == -1)
|
||||||
|
{
|
||||||
--i;
|
--i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -634,9 +688,13 @@ namespace Server.Commands.Generic
|
||||||
}
|
}
|
||||||
|
|
||||||
if (takenAction)
|
if (takenAction)
|
||||||
|
{
|
||||||
AddResponse("They have been dismounted.");
|
AddResponse("They have been dismounted.");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
LogFailure("They were not mounted.");
|
LogFailure("They were not mounted.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -698,9 +756,13 @@ namespace Server.Commands.Generic
|
||||||
var type = obj.GetType();
|
var type = obj.GetType();
|
||||||
|
|
||||||
if (type.DeclaringType == null)
|
if (type.DeclaringType == null)
|
||||||
|
{
|
||||||
AddResponse($"The type of that object is {type.Name}.");
|
AddResponse($"The type of that object is {type.Name}.");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddResponse($"The type of that object is {type.FullName}.");
|
AddResponse($"The type of that object is {type.FullName}.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -720,18 +782,26 @@ namespace Server.Commands.Generic
|
||||||
public override void Execute(CommandEventArgs e, object obj)
|
public override void Execute(CommandEventArgs e, object obj)
|
||||||
{
|
{
|
||||||
if (e.Length >= 1)
|
if (e.Length >= 1)
|
||||||
|
{
|
||||||
for (var i = 0; i < e.Length; ++i)
|
for (var i = 0; i < e.Length; ++i)
|
||||||
{
|
{
|
||||||
var result = Properties.GetValue(e.Mobile, obj, e.GetString(i));
|
var result = Properties.GetValue(e.Mobile, obj, e.GetString(i));
|
||||||
|
|
||||||
if (result == "Property not found." || result == "Property is write only." ||
|
if (result == "Property not found." || result == "Property is write only." ||
|
||||||
result.StartsWith("Getting this property"))
|
result.StartsWith("Getting this property"))
|
||||||
|
{
|
||||||
LogFailure(result);
|
LogFailure(result);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddResponse(result);
|
AddResponse(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
LogFailure("Format: Get <propertyName>");
|
LogFailure("Format: Get <propertyName>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -748,11 +818,17 @@ namespace Server.Commands.Generic
|
||||||
AccessLevel = level;
|
AccessLevel = level;
|
||||||
|
|
||||||
if (objects == ObjectTypes.Items)
|
if (objects == ObjectTypes.Items)
|
||||||
|
{
|
||||||
Supports = CommandSupport.AllItems;
|
Supports = CommandSupport.AllItems;
|
||||||
|
}
|
||||||
else if (objects == ObjectTypes.Mobiles)
|
else if (objects == ObjectTypes.Mobiles)
|
||||||
|
{
|
||||||
Supports = CommandSupport.AllMobiles;
|
Supports = CommandSupport.AllMobiles;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
Supports = CommandSupport.All;
|
Supports = CommandSupport.All;
|
||||||
|
}
|
||||||
|
|
||||||
Commands = new[] { command };
|
Commands = new[] { command };
|
||||||
ObjectTypes = objects;
|
ObjectTypes = objects;
|
||||||
|
|
@ -765,9 +841,13 @@ namespace Server.Commands.Generic
|
||||||
var result = Properties.SetValue(e.Mobile, obj, m_Name, m_Value);
|
var result = Properties.SetValue(e.Mobile, obj, m_Name, m_Value);
|
||||||
|
|
||||||
if (result == "Property has been set.")
|
if (result == "Property has been set.")
|
||||||
|
{
|
||||||
AddResponse(result);
|
AddResponse(result);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
LogFailure(result);
|
LogFailure(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -786,17 +866,25 @@ namespace Server.Commands.Generic
|
||||||
public override void Execute(CommandEventArgs e, object obj)
|
public override void Execute(CommandEventArgs e, object obj)
|
||||||
{
|
{
|
||||||
if (e.Length >= 2)
|
if (e.Length >= 2)
|
||||||
|
{
|
||||||
for (var i = 0; i + 1 < e.Length; i += 2)
|
for (var i = 0; i + 1 < e.Length; i += 2)
|
||||||
{
|
{
|
||||||
var result = Properties.SetValue(e.Mobile, obj, e.GetString(i), e.GetString(i + 1));
|
var result = Properties.SetValue(e.Mobile, obj, e.GetString(i), e.GetString(i + 1));
|
||||||
|
|
||||||
if (result == "Property has been set.")
|
if (result == "Property has been set.")
|
||||||
|
{
|
||||||
AddResponse(result);
|
AddResponse(result);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
LogFailure(result);
|
LogFailure(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
LogFailure("Format: Set <propertyName> <value>");
|
LogFailure("Format: Set <propertyName> <value>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1055,9 +1143,13 @@ namespace Server.Commands.Generic
|
||||||
m.Hidden = m_Value;
|
m.Hidden = m_Value;
|
||||||
|
|
||||||
if (m_Value)
|
if (m_Value)
|
||||||
|
{
|
||||||
AddResponse("They have been hidden.");
|
AddResponse("They have been hidden.");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddResponse("They have been revealed.");
|
AddResponse("They have been revealed.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1195,7 +1287,9 @@ namespace Server.Commands.Generic
|
||||||
public override void Execute(CommandEventArgs e, object obj)
|
public override void Execute(CommandEventArgs e, object obj)
|
||||||
{
|
{
|
||||||
if (!(obj is Item item))
|
if (!(obj is Item item))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!item.IsLockedDown && !item.IsSecure)
|
if (!item.IsLockedDown && !item.IsSecure)
|
||||||
{
|
{
|
||||||
|
|
@ -1204,11 +1298,13 @@ namespace Server.Commands.Generic
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var house in BaseHouse.AllHouses)
|
foreach (var house in BaseHouse.AllHouses)
|
||||||
|
{
|
||||||
if (house.HasSecureItem(item) || house.HasLockedDownItem(item))
|
if (house.HasSecureItem(item) || house.HasLockedDownItem(item))
|
||||||
{
|
{
|
||||||
e.Mobile.SendGump(new PropertiesGump(e.Mobile, house));
|
e.Mobile.SendGump(new PropertiesGump(e.Mobile, house));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LogFailure("No house was found.");
|
LogFailure("No house was found.");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,19 +36,25 @@ namespace Server.Commands.Generic
|
||||||
house = null;
|
house = null;
|
||||||
|
|
||||||
if (item == null || item is BaseMulti || item is HouseSign || staticsOnly && !(item is Static))
|
if (item == null || item is BaseMulti || item is HouseSign || staticsOnly && !(item is Static))
|
||||||
|
{
|
||||||
return DesignInsertResult.InvalidItem;
|
return DesignInsertResult.InvalidItem;
|
||||||
|
}
|
||||||
|
|
||||||
house = BaseHouse.FindHouseAt(item) as HouseFoundation;
|
house = BaseHouse.FindHouseAt(item) as HouseFoundation;
|
||||||
|
|
||||||
if (house == null)
|
if (house == null)
|
||||||
|
{
|
||||||
return DesignInsertResult.NotInHouse;
|
return DesignInsertResult.NotInHouse;
|
||||||
|
}
|
||||||
|
|
||||||
var x = item.X - house.X;
|
var x = item.X - house.X;
|
||||||
var y = item.Y - house.Y;
|
var y = item.Y - house.Y;
|
||||||
var z = item.Z - house.Z;
|
var z = item.Z - house.Z;
|
||||||
|
|
||||||
if (!TryInsertIntoState(house.CurrentState, item.ItemID, x, y, z))
|
if (!TryInsertIntoState(house.CurrentState, item.ItemID, x, y, z))
|
||||||
|
{
|
||||||
return DesignInsertResult.OutsideHouseBounds;
|
return DesignInsertResult.OutsideHouseBounds;
|
||||||
|
}
|
||||||
|
|
||||||
TryInsertIntoState(house.DesignState, item.ItemID, x, y, z);
|
TryInsertIntoState(house.DesignState, item.ItemID, x, y, z);
|
||||||
item.Delete();
|
item.Delete();
|
||||||
|
|
@ -61,7 +67,9 @@ namespace Server.Commands.Generic
|
||||||
var mcl = state.Components;
|
var mcl = state.Components;
|
||||||
|
|
||||||
if (x < mcl.Min.X || y < mcl.Min.Y || x > mcl.Max.X || y > mcl.Max.Y)
|
if (x < mcl.Min.X || y < mcl.Min.Y || x > mcl.Max.X || y > mcl.Max.Y)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
mcl.Add(itemID, x, y, z);
|
mcl.Add(itemID, x, y, z);
|
||||||
state.OnRevised();
|
state.OnRevised();
|
||||||
|
|
@ -112,7 +120,9 @@ namespace Server.Commands.Generic
|
||||||
AddResponse("The item has been inserted into the house design.");
|
AddResponse("The item has been inserted into the house design.");
|
||||||
|
|
||||||
if (!foundations.Contains(house))
|
if (!foundations.Contains(house))
|
||||||
|
{
|
||||||
foundations.Add(house);
|
foundations.Add(house);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -131,7 +141,9 @@ namespace Server.Commands.Generic
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var house in foundations)
|
foreach (var house in foundations)
|
||||||
|
{
|
||||||
house.Delta(ItemDelta.Update);
|
house.Delta(ItemDelta.Update);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -160,7 +172,9 @@ namespace Server.Commands.Generic
|
||||||
from.SendMessage("Your changes have been committed. Updating...");
|
from.SendMessage("Your changes have been committed. Updating...");
|
||||||
|
|
||||||
foreach (var house in m_Foundations)
|
foreach (var house in m_Foundations)
|
||||||
|
{
|
||||||
house.Delta(ItemDelta.Update);
|
house.Delta(ItemDelta.Update);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -173,14 +187,20 @@ namespace Server.Commands.Generic
|
||||||
case DesignInsertResult.Valid:
|
case DesignInsertResult.Valid:
|
||||||
{
|
{
|
||||||
if (m_Foundations.Count == 0)
|
if (m_Foundations.Count == 0)
|
||||||
from.SendMessage(
|
{
|
||||||
|
@from.SendMessage(
|
||||||
"The item has been inserted into the house design. Press ESC when you are finished."
|
"The item has been inserted into the house design. Press ESC when you are finished."
|
||||||
);
|
);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
from.SendMessage("The item has been inserted into the house design.");
|
{
|
||||||
|
@from.SendMessage("The item has been inserted into the house design.");
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_Foundations.Contains(house))
|
if (!m_Foundations.Contains(house))
|
||||||
|
{
|
||||||
m_Foundations.Add(house);
|
m_Foundations.Add(house);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,14 @@ namespace Server.Commands.Generic
|
||||||
var offset = 0;
|
var offset = 0;
|
||||||
|
|
||||||
if (Insensitive.Equals(e.GetString(0), "view"))
|
if (Insensitive.Equals(e.GetString(0), "view"))
|
||||||
|
{
|
||||||
++offset;
|
++offset;
|
||||||
|
}
|
||||||
|
|
||||||
while (offset < e.Length)
|
while (offset < e.Length)
|
||||||
|
{
|
||||||
columns.Add(e.GetString(offset++));
|
columns.Add(e.GetString(offset++));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
e.Mobile.SendGump(new InterfaceGump(e.Mobile, columns.ToArray(), list, 0, null));
|
e.Mobile.SendGump(new InterfaceGump(e.Mobile, columns.ToArray(), list, 0, null));
|
||||||
|
|
@ -75,9 +79,13 @@ namespace Server.Commands.Generic
|
||||||
AddNewPage();
|
AddNewPage();
|
||||||
|
|
||||||
if (m_Page > 0)
|
if (m_Page > 0)
|
||||||
|
{
|
||||||
AddEntryButton(20, ArrowLeftID1, ArrowLeftID2, 1, ArrowLeftWidth, ArrowLeftHeight);
|
AddEntryButton(20, ArrowLeftID1, ArrowLeftID2, 1, ArrowLeftWidth, ArrowLeftHeight);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddEntryHeader(20);
|
AddEntryHeader(20);
|
||||||
|
}
|
||||||
|
|
||||||
AddEntryHtml(
|
AddEntryHtml(
|
||||||
40 + m_Columns.Length * 130 - 20 + (m_Columns.Length - 2) * OffsetSize,
|
40 + m_Columns.Length * 130 - 20 + (m_Columns.Length - 2) * OffsetSize,
|
||||||
|
|
@ -87,9 +95,13 @@ namespace Server.Commands.Generic
|
||||||
);
|
);
|
||||||
|
|
||||||
if ((m_Page + 1) * EntriesPerPage < m_List.Count)
|
if ((m_Page + 1) * EntriesPerPage < m_List.Count)
|
||||||
|
{
|
||||||
AddEntryButton(20, ArrowRightID1, ArrowRightID2, 2, ArrowRightWidth, ArrowRightHeight);
|
AddEntryButton(20, ArrowRightID1, ArrowRightID2, 2, ArrowRightWidth, ArrowRightHeight);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddEntryHeader(20);
|
AddEntryHeader(20);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Columns.Length > 1)
|
if (m_Columns.Length > 1)
|
||||||
{
|
{
|
||||||
|
|
@ -119,7 +131,9 @@ namespace Server.Commands.Generic
|
||||||
for (var j = 0; j < chain.Length; ++j)
|
for (var j = 0; j < chain.Length; ++j)
|
||||||
{
|
{
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
|
{
|
||||||
m_Columns[i] += '.';
|
m_Columns[i] += '.';
|
||||||
|
}
|
||||||
|
|
||||||
m_Columns[i] += chain[j].Name;
|
m_Columns[i] += chain[j].Name;
|
||||||
}
|
}
|
||||||
|
|
@ -143,12 +157,16 @@ namespace Server.Commands.Generic
|
||||||
if (obj is Item item)
|
if (obj is Item item)
|
||||||
{
|
{
|
||||||
if (!(isDeleted = item.Deleted))
|
if (!(isDeleted = item.Deleted))
|
||||||
|
{
|
||||||
AddEntryHtml(40 + 130, item.GetType().Name);
|
AddEntryHtml(40 + 130, item.GetType().Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (obj is Mobile mob)
|
else if (obj is Mobile mob)
|
||||||
{
|
{
|
||||||
if (!(isDeleted = mob.Deleted))
|
if (!(isDeleted = mob.Deleted))
|
||||||
|
{
|
||||||
AddEntryHtml(40 + 130, mob.Name);
|
AddEntryHtml(40 + 130, mob.Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isDeleted)
|
if (isDeleted)
|
||||||
|
|
@ -156,7 +174,9 @@ namespace Server.Commands.Generic
|
||||||
AddEntryHtml(40 + 130, "(deleted)");
|
AddEntryHtml(40 + 130, "(deleted)");
|
||||||
|
|
||||||
for (var j = 1; j < m_Columns.Length; ++j)
|
for (var j = 1; j < m_Columns.Length; ++j)
|
||||||
|
{
|
||||||
AddEntryHtml(130, "---");
|
AddEntryHtml(130, "---");
|
||||||
|
}
|
||||||
|
|
||||||
AddEntryHeader(20);
|
AddEntryHeader(20);
|
||||||
}
|
}
|
||||||
|
|
@ -186,9 +206,13 @@ namespace Server.Commands.Generic
|
||||||
var p = Properties.GetPropertyInfo(ref src, chain, ref failReason);
|
var p = Properties.GetPropertyInfo(ref src, chain, ref failReason);
|
||||||
|
|
||||||
if (p == null)
|
if (p == null)
|
||||||
|
{
|
||||||
value = "---";
|
value = "---";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
value = PropertiesGump.ValueToString(src, p);
|
value = PropertiesGump.ValueToString(src, p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AddEntryHtml(130, value);
|
AddEntryHtml(130, value);
|
||||||
|
|
@ -217,14 +241,18 @@ namespace Server.Commands.Generic
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (m_Page > 0)
|
if (m_Page > 0)
|
||||||
|
{
|
||||||
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page - 1, m_Select));
|
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page - 1, m_Select));
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
if ((m_Page + 1) * EntriesPerPage < m_List.Count)
|
if ((m_Page + 1) * EntriesPerPage < m_List.Count)
|
||||||
|
{
|
||||||
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page + 1, m_Select));
|
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page + 1, m_Select));
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -244,11 +272,17 @@ namespace Server.Commands.Generic
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj is Item item && !item.Deleted)
|
if (obj is Item item && !item.Deleted)
|
||||||
|
{
|
||||||
m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, item));
|
m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, item));
|
||||||
|
}
|
||||||
else if (obj is Mobile mobile && !mobile.Deleted)
|
else if (obj is Mobile mobile && !mobile.Deleted)
|
||||||
|
{
|
||||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, mobile));
|
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, mobile));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Select));
|
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Select));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -561,7 +595,9 @@ namespace Server.Commands.Generic
|
||||||
case 7: // Kill
|
case 7: // Kill
|
||||||
{
|
{
|
||||||
if (m_From == m_Mobile || m_From.AccessLevel > m_Mobile.AccessLevel)
|
if (m_From == m_Mobile || m_From.AccessLevel > m_Mobile.AccessLevel)
|
||||||
|
{
|
||||||
m_Mobile.Kill();
|
m_Mobile.Kill();
|
||||||
|
}
|
||||||
|
|
||||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||||
|
|
||||||
|
|
@ -586,7 +622,9 @@ namespace Server.Commands.Generic
|
||||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||||
|
|
||||||
if (m_Mobile.NetState != null)
|
if (m_Mobile.NetState != null)
|
||||||
|
{
|
||||||
m_From.SendGump(new ClientGump(m_From, m_Mobile.NetState));
|
m_From.SendGump(new ClientGump(m_From, m_Mobile.NetState));
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,12 @@ namespace Server.Commands.Generic
|
||||||
public bool IsValid(object obj)
|
public bool IsValid(object obj)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < Count; ++i)
|
for (var i = 0; i < Count; ++i)
|
||||||
|
{
|
||||||
if (!this[i].IsValid(obj))
|
if (!this[i].IsValid(obj))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -50,7 +54,9 @@ namespace Server.Commands.Generic
|
||||||
public void Filter(List<object> list)
|
public void Filter(List<object> list)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < Count; ++i)
|
for (var i = 0; i < Count; ++i)
|
||||||
|
{
|
||||||
this[i].Filter(list);
|
this[i].Filter(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Extensions Parse(Mobile from, ref string[] args)
|
public static Extensions Parse(Mobile from, ref string[] args)
|
||||||
|
|
@ -64,17 +70,23 @@ namespace Server.Commands.Generic
|
||||||
for (var i = args.Length - 1; i >= 0; --i)
|
for (var i = args.Length - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
if (!ExtensionInfo.Table.TryGetValue(args[i], out var extInfo))
|
if (!ExtensionInfo.Table.TryGetValue(args[i], out var extInfo))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (extInfo.IsFixedSize && i != size - extInfo.Size - 1)
|
if (extInfo.IsFixedSize && i != size - extInfo.Size - 1)
|
||||||
|
{
|
||||||
throw new Exception("Invalid extended argument count.");
|
throw new Exception("Invalid extended argument count.");
|
||||||
|
}
|
||||||
|
|
||||||
var ext = extInfo.Constructor();
|
var ext = extInfo.Constructor();
|
||||||
|
|
||||||
ext.Parse(from, args, i + 1, size - i - 1);
|
ext.Parse(from, args, i + 1, size - i - 1);
|
||||||
|
|
||||||
if (ext is WhereExtension extension)
|
if (ext is WhereExtension extension)
|
||||||
|
{
|
||||||
baseType = extension.Conditional.Type;
|
baseType = extension.Conditional.Type;
|
||||||
|
}
|
||||||
|
|
||||||
parsed.Add(ext);
|
parsed.Add(ext);
|
||||||
|
|
||||||
|
|
@ -86,7 +98,9 @@ namespace Server.Commands.Generic
|
||||||
AssemblyEmitter emitter = null;
|
AssemblyEmitter emitter = null;
|
||||||
|
|
||||||
foreach (var update in parsed)
|
foreach (var update in parsed)
|
||||||
update.Optimize(from, baseType, ref emitter);
|
{
|
||||||
|
update.Optimize(@from, baseType, ref emitter);
|
||||||
|
}
|
||||||
|
|
||||||
if (size != args.Length)
|
if (size != args.Length)
|
||||||
{
|
{
|
||||||
|
|
@ -94,7 +108,9 @@ namespace Server.Commands.Generic
|
||||||
args = new string[size];
|
args = new string[size];
|
||||||
|
|
||||||
for (var i = 0; i < args.Length; ++i)
|
for (var i = 0; i < args.Length; ++i)
|
||||||
|
{
|
||||||
args[i] = old[i];
|
args[i] = old[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return parsed;
|
return parsed;
|
||||||
|
|
|
||||||
|
|
@ -69,30 +69,50 @@ namespace Server.Commands.Generic
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Value is int i)
|
if (Value is int i)
|
||||||
|
{
|
||||||
method.Load(i);
|
method.Load(i);
|
||||||
|
}
|
||||||
else if (Value is long l)
|
else if (Value is long l)
|
||||||
|
{
|
||||||
method.Load(l);
|
method.Load(l);
|
||||||
|
}
|
||||||
else if (Value is float f)
|
else if (Value is float f)
|
||||||
|
{
|
||||||
method.Load(f);
|
method.Load(f);
|
||||||
|
}
|
||||||
else if (Value is double d)
|
else if (Value is double d)
|
||||||
|
{
|
||||||
method.Load(d);
|
method.Load(d);
|
||||||
|
}
|
||||||
else if (Value is char c)
|
else if (Value is char c)
|
||||||
|
{
|
||||||
method.Load(c);
|
method.Load(c);
|
||||||
|
}
|
||||||
else if (Value is bool b)
|
else if (Value is bool b)
|
||||||
|
{
|
||||||
method.Load(b);
|
method.Load(b);
|
||||||
|
}
|
||||||
else if (Value is string s)
|
else if (Value is string s)
|
||||||
|
{
|
||||||
method.Load(s);
|
method.Load(s);
|
||||||
|
}
|
||||||
else if (Value is Enum e)
|
else if (Value is Enum e)
|
||||||
|
{
|
||||||
method.Load(e);
|
method.Load(e);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
throw new InvalidOperationException("Unrecognized comparison value.");
|
throw new InvalidOperationException("Unrecognized comparison value.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Acquire(TypeBuilder typeBuilder, ILGenerator il, string fieldName)
|
public void Acquire(TypeBuilder typeBuilder, ILGenerator il, string fieldName)
|
||||||
{
|
{
|
||||||
if (!(Value is string toParse))
|
if (!(Value is string toParse))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Type.IsValueType && toParse == "null")
|
if (!Type.IsValueType && toParse == "null")
|
||||||
{
|
{
|
||||||
|
|
@ -101,7 +121,9 @@ namespace Server.Commands.Generic
|
||||||
else if (Type == typeof(string))
|
else if (Type == typeof(string))
|
||||||
{
|
{
|
||||||
if (toParse == @"@""null""")
|
if (toParse == @"@""null""")
|
||||||
|
{
|
||||||
toParse = "null";
|
toParse = "null";
|
||||||
|
}
|
||||||
|
|
||||||
Value = toParse;
|
Value = toParse;
|
||||||
}
|
}
|
||||||
|
|
@ -169,7 +191,9 @@ namespace Server.Commands.Generic
|
||||||
il.Emit(OpCodes.Ldstr, toParse);
|
il.Emit(OpCodes.Ldstr, toParse);
|
||||||
|
|
||||||
if (parseArgs.Length == 2) // dirty evil hack :-(
|
if (parseArgs.Length == 2) // dirty evil hack :-(
|
||||||
|
{
|
||||||
il.Emit(OpCodes.Ldc_I4, (int)parseArgs[1]);
|
il.Emit(OpCodes.Ldc_I4, (int)parseArgs[1]);
|
||||||
|
}
|
||||||
|
|
||||||
il.Emit(OpCodes.Call, parseMethod);
|
il.Emit(OpCodes.Call, parseMethod);
|
||||||
il.Emit(OpCodes.Stfld, Field);
|
il.Emit(OpCodes.Stfld, Field);
|
||||||
|
|
@ -330,7 +354,9 @@ namespace Server.Commands.Generic
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Not != inverse)
|
if (m_Not != inverse)
|
||||||
|
{
|
||||||
emitter.LogicalNot();
|
emitter.LogicalNot();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -437,7 +463,9 @@ namespace Server.Commands.Generic
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Not != inverse)
|
if (m_Not != inverse)
|
||||||
|
{
|
||||||
emitter.LogicalNot();
|
emitter.LogicalNot();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -464,7 +492,9 @@ namespace Server.Commands.Generic
|
||||||
il.Emit(OpCodes.Call, typeof(object).GetConstructor(Type.EmptyTypes));
|
il.Emit(OpCodes.Call, typeof(object).GetConstructor(Type.EmptyTypes));
|
||||||
|
|
||||||
for (var i = 0; i < conditions.Length; ++i)
|
for (var i = 0; i < conditions.Length; ++i)
|
||||||
|
{
|
||||||
conditions[i].Construct(typeBuilder, il, i);
|
conditions[i].Construct(typeBuilder, il, i);
|
||||||
|
}
|
||||||
|
|
||||||
// return;
|
// return;
|
||||||
il.Emit(OpCodes.Ret);
|
il.Emit(OpCodes.Ret);
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,9 @@ namespace Server.Commands.Generic
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!couldCompare)
|
if (!couldCompare)
|
||||||
|
{
|
||||||
throw new InvalidOperationException("Property is not comparable.");
|
throw new InvalidOperationException("Property is not comparable.");
|
||||||
|
}
|
||||||
|
|
||||||
emitter.StoreLocal(v);
|
emitter.StoreLocal(v);
|
||||||
}
|
}
|
||||||
|
|
@ -225,7 +227,9 @@ namespace Server.Commands.Generic
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
|
{
|
||||||
emitter.Xor();
|
emitter.Xor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emitter.Return();
|
emitter.Return();
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,9 @@ namespace Server.Commands.Generic
|
||||||
m_Order = Math.Sign(value);
|
m_Order = Math.Sign(value);
|
||||||
|
|
||||||
if (m_Order == 0)
|
if (m_Order == 0)
|
||||||
|
{
|
||||||
throw new InvalidOperationException("Sign cannot be zero.");
|
throw new InvalidOperationException("Sign cannot be zero.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -133,7 +135,9 @@ namespace Server.Commands.Generic
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!couldCompare)
|
if (!couldCompare)
|
||||||
|
{
|
||||||
throw new InvalidOperationException("Property is not comparable.");
|
throw new InvalidOperationException("Property is not comparable.");
|
||||||
|
}
|
||||||
|
|
||||||
emitter.StoreLocal(v);
|
emitter.StoreLocal(v);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,9 @@ namespace Server.Commands.Generic
|
||||||
public override void Optimize(Mobile from, Type baseType, ref AssemblyEmitter assembly)
|
public override void Optimize(Mobile from, Type baseType, ref AssemblyEmitter assembly)
|
||||||
{
|
{
|
||||||
if (baseType == null)
|
if (baseType == null)
|
||||||
|
{
|
||||||
throw new Exception("Distinct extension may only be used in combination with an object conditional.");
|
throw new Exception("Distinct extension may only be used in combination with an object conditional.");
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var prop in m_Properties)
|
foreach (var prop in m_Properties)
|
||||||
{
|
{
|
||||||
|
|
@ -40,7 +42,9 @@ namespace Server.Commands.Generic
|
||||||
public override void Parse(Mobile from, string[] arguments, int offset, int size)
|
public override void Parse(Mobile from, string[] arguments, int offset, int size)
|
||||||
{
|
{
|
||||||
if (size < 1)
|
if (size < 1)
|
||||||
|
{
|
||||||
throw new Exception("Invalid distinction syntax.");
|
throw new Exception("Invalid distinction syntax.");
|
||||||
|
}
|
||||||
|
|
||||||
var end = offset + size;
|
var end = offset + size;
|
||||||
|
|
||||||
|
|
@ -55,7 +59,9 @@ namespace Server.Commands.Generic
|
||||||
public override void Filter(List<object> list)
|
public override void Filter(List<object> list)
|
||||||
{
|
{
|
||||||
if (m_Comparer == null)
|
if (m_Comparer == null)
|
||||||
|
{
|
||||||
throw new InvalidOperationException("The extension must first be optimized.");
|
throw new InvalidOperationException("The extension must first be optimized.");
|
||||||
|
}
|
||||||
|
|
||||||
var copy = new List<object>(list);
|
var copy = new List<object>(list);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,17 @@ namespace Server.Commands.Generic
|
||||||
Limit = Utility.ToInt32(arguments[offset]);
|
Limit = Utility.ToInt32(arguments[offset]);
|
||||||
|
|
||||||
if (Limit < 0)
|
if (Limit < 0)
|
||||||
|
{
|
||||||
throw new Exception("Limit cannot be less than zero.");
|
throw new Exception("Limit cannot be less than zero.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Filter(List<object> list)
|
public override void Filter(List<object> list)
|
||||||
{
|
{
|
||||||
if (list.Count > Limit)
|
if (list.Count > Limit)
|
||||||
|
{
|
||||||
list.RemoveRange(Limit, list.Count - Limit);
|
list.RemoveRange(Limit, list.Count - Limit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,9 @@ namespace Server.Commands.Generic
|
||||||
public override void Optimize(Mobile from, Type baseType, ref AssemblyEmitter assembly)
|
public override void Optimize(Mobile from, Type baseType, ref AssemblyEmitter assembly)
|
||||||
{
|
{
|
||||||
if (baseType == null)
|
if (baseType == null)
|
||||||
|
{
|
||||||
throw new Exception("The ordering extension may only be used in combination with an object conditional.");
|
throw new Exception("The ordering extension may only be used in combination with an object conditional.");
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var order in m_Orders)
|
foreach (var order in m_Orders)
|
||||||
{
|
{
|
||||||
|
|
@ -39,7 +41,9 @@ namespace Server.Commands.Generic
|
||||||
public override void Parse(Mobile from, string[] arguments, int offset, int size)
|
public override void Parse(Mobile from, string[] arguments, int offset, int size)
|
||||||
{
|
{
|
||||||
if (size < 1)
|
if (size < 1)
|
||||||
|
{
|
||||||
throw new Exception("Invalid ordering syntax.");
|
throw new Exception("Invalid ordering syntax.");
|
||||||
|
}
|
||||||
|
|
||||||
if (Insensitive.Equals(arguments[offset], "by"))
|
if (Insensitive.Equals(arguments[offset], "by"))
|
||||||
{
|
{
|
||||||
|
|
@ -47,7 +51,9 @@ namespace Server.Commands.Generic
|
||||||
--size;
|
--size;
|
||||||
|
|
||||||
if (size < 1)
|
if (size < 1)
|
||||||
|
{
|
||||||
throw new Exception("Invalid ordering syntax.");
|
throw new Exception("Invalid ordering syntax.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var end = offset + size;
|
var end = offset + size;
|
||||||
|
|
@ -91,7 +97,9 @@ namespace Server.Commands.Generic
|
||||||
public override void Filter(List<object> list)
|
public override void Filter(List<object> list)
|
||||||
{
|
{
|
||||||
if (m_Comparer == null)
|
if (m_Comparer == null)
|
||||||
|
{
|
||||||
throw new InvalidOperationException("The extension must first be optimized.");
|
throw new InvalidOperationException("The extension must first be optimized.");
|
||||||
|
}
|
||||||
|
|
||||||
list.Sort(m_Comparer);
|
list.Sort(m_Comparer);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,9 @@ namespace Server.Commands.Generic
|
||||||
public override void Optimize(Mobile from, Type baseType, ref AssemblyEmitter assembly)
|
public override void Optimize(Mobile from, Type baseType, ref AssemblyEmitter assembly)
|
||||||
{
|
{
|
||||||
if (baseType == null)
|
if (baseType == null)
|
||||||
|
{
|
||||||
throw new InvalidOperationException("Insanity.");
|
throw new InvalidOperationException("Insanity.");
|
||||||
|
}
|
||||||
|
|
||||||
Conditional.Compile(ref assembly);
|
Conditional.Compile(ref assembly);
|
||||||
}
|
}
|
||||||
|
|
@ -26,7 +28,9 @@ namespace Server.Commands.Generic
|
||||||
public override void Parse(Mobile from, string[] arguments, int offset, int size)
|
public override void Parse(Mobile from, string[] arguments, int offset, int size)
|
||||||
{
|
{
|
||||||
if (size < 1)
|
if (size < 1)
|
||||||
|
{
|
||||||
throw new Exception("Invalid condition syntax.");
|
throw new Exception("Invalid condition syntax.");
|
||||||
|
}
|
||||||
|
|
||||||
Conditional = ObjectConditional.ParseDirect(from, arguments, offset, size);
|
Conditional = ObjectConditional.ParseDirect(from, arguments, offset, size);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,18 +34,26 @@ namespace Server.Commands.Generic
|
||||||
var ext = Extensions.Parse(from, ref args);
|
var ext = Extensions.Parse(from, ref args);
|
||||||
|
|
||||||
if (!CheckObjectTypes(from, command, ext, out var items, out var mobiles))
|
if (!CheckObjectTypes(from, command, ext, out var items, out var mobiles))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(items || mobiles))
|
if (!(items || mobiles))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var eable = map.GetObjectsInBounds(rect, items, mobiles);
|
var eable = map.GetObjectsInBounds(rect, items, mobiles);
|
||||||
|
|
||||||
var objs = new List<object>();
|
var objs = new List<object>();
|
||||||
|
|
||||||
foreach (var obj in eable)
|
foreach (var obj in eable)
|
||||||
if ((!mobiles || obj is Mobile) && BaseCommand.IsAccessible(from, obj) && ext.IsValid(obj))
|
{
|
||||||
|
if ((!mobiles || obj is Mobile) && BaseCommand.IsAccessible(@from, obj) && ext.IsValid(obj))
|
||||||
|
{
|
||||||
objs.Add(obj);
|
objs.Add(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
eable.Free();
|
eable.Free();
|
||||||
ext.Filter(objs);
|
ext.Filter(objs);
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,9 @@ namespace Server.Commands.Generic
|
||||||
public virtual void Register(BaseCommand command)
|
public virtual void Register(BaseCommand command)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < command.Commands.Length; ++i)
|
for (var i = 0; i < command.Commands.Length; ++i)
|
||||||
|
{
|
||||||
Commands[command.Commands[i]] = command;
|
Commands[command.Commands[i]] = command;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CheckObjectTypes(Mobile from, BaseCommand command, Extensions ext, out bool items, out bool mobiles)
|
public bool CheckObjectTypes(Mobile from, BaseCommand command, Extensions ext, out bool items, out bool mobiles)
|
||||||
|
|
@ -96,12 +98,14 @@ namespace Server.Commands.Generic
|
||||||
var cond = ObjectConditional.Empty;
|
var cond = ObjectConditional.Empty;
|
||||||
|
|
||||||
foreach (var check in ext)
|
foreach (var check in ext)
|
||||||
|
{
|
||||||
if (check is WhereExtension extension)
|
if (check is WhereExtension extension)
|
||||||
{
|
{
|
||||||
cond = extension.Conditional;
|
cond = extension.Conditional;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var condIsItem = cond.IsItem;
|
var condIsItem = cond.IsItem;
|
||||||
var condIsMobile = cond.IsMobile;
|
var condIsMobile = cond.IsMobile;
|
||||||
|
|
@ -112,10 +116,14 @@ namespace Server.Commands.Generic
|
||||||
case ObjectTypes.Both:
|
case ObjectTypes.Both:
|
||||||
{
|
{
|
||||||
if (condIsItem)
|
if (condIsItem)
|
||||||
|
{
|
||||||
items = true;
|
items = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (condIsMobile)
|
if (condIsMobile)
|
||||||
|
{
|
||||||
mobiles = true;
|
mobiles = true;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -171,7 +179,9 @@ namespace Server.Commands.Generic
|
||||||
public string GenerateArgString(string[] args)
|
public string GenerateArgString(string[] args)
|
||||||
{
|
{
|
||||||
if (args.Length == 0)
|
if (args.Length == 0)
|
||||||
|
{
|
||||||
return "";
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: this does not preserve the case where quotation marks are used on a single word
|
// NOTE: this does not preserve the case where quotation marks are used on a single word
|
||||||
|
|
||||||
|
|
@ -180,7 +190,9 @@ namespace Server.Commands.Generic
|
||||||
for (var i = 0; i < args.Length; ++i)
|
for (var i = 0; i < args.Length; ++i)
|
||||||
{
|
{
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
|
{
|
||||||
sb.Append(' ');
|
sb.Append(' ');
|
||||||
|
}
|
||||||
|
|
||||||
if (args[i].IndexOf(' ') >= 0)
|
if (args[i].IndexOf(' ') >= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -204,16 +216,22 @@ namespace Server.Commands.Generic
|
||||||
var e = new CommandEventArgs(from, command.Commands[0], GenerateArgString(args), args);
|
var e = new CommandEventArgs(from, command.Commands[0], GenerateArgString(args), args);
|
||||||
|
|
||||||
if (!command.ValidateArgs(this, e))
|
if (!command.ValidateArgs(this, e))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var flushToLog = false;
|
var flushToLog = false;
|
||||||
|
|
||||||
if (obj is List<object> list)
|
if (obj is List<object> list)
|
||||||
{
|
{
|
||||||
if (list.Count > 20)
|
if (list.Count > 20)
|
||||||
|
{
|
||||||
CommandLogging.Enabled = false;
|
CommandLogging.Enabled = false;
|
||||||
|
}
|
||||||
else if (list.Count == 0)
|
else if (list.Count == 0)
|
||||||
|
{
|
||||||
command.LogFailure("Nothing was found to use this command on.");
|
command.LogFailure("Nothing was found to use this command on.");
|
||||||
|
}
|
||||||
|
|
||||||
command.ExecuteList(e, list);
|
command.ExecuteList(e, list);
|
||||||
|
|
||||||
|
|
@ -226,9 +244,13 @@ namespace Server.Commands.Generic
|
||||||
else if (obj != null)
|
else if (obj != null)
|
||||||
{
|
{
|
||||||
if (command.ListOptimized)
|
if (command.ListOptimized)
|
||||||
|
{
|
||||||
command.ExecuteList(e, new List<object> { obj });
|
command.ExecuteList(e, new List<object> { obj });
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
command.Execute(e, obj);
|
command.Execute(e, obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
command.Flush(from, flushToLog);
|
command.Flush(from, flushToLog);
|
||||||
|
|
@ -264,7 +286,9 @@ namespace Server.Commands.Generic
|
||||||
var args = new string[oldArgs.Length - 1];
|
var args = new string[oldArgs.Length - 1];
|
||||||
|
|
||||||
for (var i = 0; i < args.Length; ++i)
|
for (var i = 0; i < args.Length; ++i)
|
||||||
|
{
|
||||||
args[i] = oldArgs[i + 1];
|
args[i] = oldArgs[i + 1];
|
||||||
|
}
|
||||||
|
|
||||||
Process(e.Mobile, command, args);
|
Process(e.Mobile, command, args);
|
||||||
}
|
}
|
||||||
|
|
@ -278,10 +302,14 @@ namespace Server.Commands.Generic
|
||||||
public void Register()
|
public void Register()
|
||||||
{
|
{
|
||||||
if (Accessors == null)
|
if (Accessors == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < Accessors.Length; ++i)
|
for (var i = 0; i < Accessors.Length; ++i)
|
||||||
|
{
|
||||||
CommandSystem.Register(Accessors[i], AccessLevel, Execute);
|
CommandSystem.Register(Accessors[i], AccessLevel, Execute);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Register(BaseCommandImplementor impl)
|
public static void Register(BaseCommandImplementor impl)
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,15 @@ namespace Server.Commands.Generic
|
||||||
public override void Process(Mobile from, BaseCommand command, string[] args)
|
public override void Process(Mobile from, BaseCommand command, string[] args)
|
||||||
{
|
{
|
||||||
if (command.ValidateArgs(this, new CommandEventArgs(from, command.Commands[0], GenerateArgString(args), args)))
|
if (command.ValidateArgs(this, new CommandEventArgs(from, command.Commands[0], GenerateArgString(args), args)))
|
||||||
from.BeginTarget(
|
{
|
||||||
|
@from.BeginTarget(
|
||||||
-1,
|
-1,
|
||||||
command.ObjectTypes == ObjectTypes.All,
|
command.ObjectTypes == ObjectTypes.All,
|
||||||
TargetFlags.None,
|
TargetFlags.None,
|
||||||
(m, targeted, a) => OnTarget(m, targeted, command, a),
|
(m, targeted, a) => OnTarget(m, targeted, command, a),
|
||||||
args
|
args
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnTarget(Mobile from, object targeted, BaseCommand command, string[] args)
|
public void OnTarget(Mobile from, object targeted, BaseCommand command, string[] args)
|
||||||
|
|
@ -38,7 +40,9 @@ namespace Server.Commands.Generic
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.ObjectTypes == ObjectTypes.Mobiles)
|
if (command.ObjectTypes == ObjectTypes.Mobiles)
|
||||||
|
{
|
||||||
return; // sanity check
|
return; // sanity check
|
||||||
|
}
|
||||||
|
|
||||||
if (!(targeted is Container cont))
|
if (!(targeted is Container cont))
|
||||||
{
|
{
|
||||||
|
|
@ -51,7 +55,9 @@ namespace Server.Commands.Generic
|
||||||
var ext = Extensions.Parse(from, ref args);
|
var ext = Extensions.Parse(from, ref args);
|
||||||
|
|
||||||
if (!CheckObjectTypes(from, command, ext, out var items, out var _))
|
if (!CheckObjectTypes(from, command, ext, out var items, out var _))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!items)
|
if (!items)
|
||||||
{
|
{
|
||||||
|
|
@ -62,8 +68,12 @@ namespace Server.Commands.Generic
|
||||||
var list = new List<object>();
|
var list = new List<object>();
|
||||||
|
|
||||||
foreach (var item in cont.FindItemsByType<Item>())
|
foreach (var item in cont.FindItemsByType<Item>())
|
||||||
|
{
|
||||||
if (ext.IsValid(item))
|
if (ext.IsValid(item))
|
||||||
|
{
|
||||||
list.Add(item);
|
list.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ext.Filter(list);
|
ext.Filter(list);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,16 @@ namespace Server.Commands.Generic
|
||||||
var impl = AreaCommandImplementor.Instance;
|
var impl = AreaCommandImplementor.Instance;
|
||||||
|
|
||||||
if (impl == null)
|
if (impl == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var map = from.Map;
|
var map = from.Map;
|
||||||
|
|
||||||
if (map == null || map == Map.Internal)
|
if (map == null || map == Map.Internal)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
impl.OnTarget(from, map, Point3D.Zero, new Point3D(map.Width - 1, map.Height - 1, 0), command, args);
|
impl.OnTarget(from, map, Point3D.Zero, new Point3D(map.Width - 1, map.Height - 1, 0), command, args);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,19 +23,33 @@ namespace Server.Commands.Generic
|
||||||
var ext = Extensions.Parse(from, ref args);
|
var ext = Extensions.Parse(from, ref args);
|
||||||
|
|
||||||
if (!CheckObjectTypes(from, command, ext, out var items, out var mobiles))
|
if (!CheckObjectTypes(from, command, ext, out var items, out var mobiles))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var list = new List<object>();
|
var list = new List<object>();
|
||||||
|
|
||||||
if (items)
|
if (items)
|
||||||
|
{
|
||||||
foreach (var item in World.Items.Values)
|
foreach (var item in World.Items.Values)
|
||||||
|
{
|
||||||
if (ext.IsValid(item))
|
if (ext.IsValid(item))
|
||||||
|
{
|
||||||
list.Add(item);
|
list.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mobiles)
|
if (mobiles)
|
||||||
|
{
|
||||||
foreach (var mob in World.Mobiles.Values)
|
foreach (var mob in World.Mobiles.Values)
|
||||||
|
{
|
||||||
if (ext.IsValid(mob))
|
if (ext.IsValid(mob))
|
||||||
|
{
|
||||||
list.Add(mob);
|
list.Add(mob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ext.Filter(list);
|
ext.Filter(list);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,9 @@ namespace Server.Commands.Generic
|
||||||
var ext = Extensions.Parse(from, ref args);
|
var ext = Extensions.Parse(from, ref args);
|
||||||
|
|
||||||
if (!CheckObjectTypes(from, command, ext, out var _, out var mobiles))
|
if (!CheckObjectTypes(from, command, ext, out var _, out var mobiles))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!mobiles) // sanity check
|
if (!mobiles) // sanity check
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,15 @@ namespace Server.Commands.Generic
|
||||||
public override void Process(Mobile from, BaseCommand command, string[] args)
|
public override void Process(Mobile from, BaseCommand command, string[] args)
|
||||||
{
|
{
|
||||||
if (command.ValidateArgs(this, new CommandEventArgs(from, command.Commands[0], GenerateArgString(args), args)))
|
if (command.ValidateArgs(this, new CommandEventArgs(from, command.Commands[0], GenerateArgString(args), args)))
|
||||||
from.BeginTarget(
|
{
|
||||||
|
@from.BeginTarget(
|
||||||
-1,
|
-1,
|
||||||
command.ObjectTypes == ObjectTypes.All,
|
command.ObjectTypes == ObjectTypes.All,
|
||||||
TargetFlags.None,
|
TargetFlags.None,
|
||||||
(m, targeted, a) => OnTarget(m, targeted, command, a),
|
(m, targeted, a) => OnTarget(m, targeted, command, a),
|
||||||
args
|
args
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnTarget(Mobile from, object targeted, BaseCommand command, string[] args)
|
public void OnTarget(Mobile from, object targeted, BaseCommand command, string[] args)
|
||||||
|
|
|
||||||
|
|
@ -35,13 +35,17 @@ namespace Server.Commands.Generic
|
||||||
m_Conditionals = new IConditional[m_Conditions.Length];
|
m_Conditionals = new IConditional[m_Conditions.Length];
|
||||||
|
|
||||||
for (var i = 0; i < m_Conditionals.Length; ++i)
|
for (var i = 0; i < m_Conditionals.Length; ++i)
|
||||||
|
{
|
||||||
m_Conditionals[i] = ConditionalCompiler.Compile(emitter, Type, m_Conditions[i], i);
|
m_Conditionals[i] = ConditionalCompiler.Compile(emitter, Type, m_Conditions[i], i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CheckCondition(object obj)
|
public bool CheckCondition(object obj)
|
||||||
{
|
{
|
||||||
if (Type == null)
|
if (Type == null)
|
||||||
|
{
|
||||||
return true; // null type means no condition
|
return true; // null type means no condition
|
||||||
|
}
|
||||||
|
|
||||||
if (!HasCompiled)
|
if (!HasCompiled)
|
||||||
{
|
{
|
||||||
|
|
@ -51,8 +55,12 @@ namespace Server.Commands.Generic
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < m_Conditionals.Length; ++i)
|
for (var i = 0; i < m_Conditionals.Length; ++i)
|
||||||
|
{
|
||||||
if (m_Conditionals[i].Verify(obj))
|
if (m_Conditionals[i].Verify(obj))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false; // all conditions false
|
return false; // all conditions false
|
||||||
}
|
}
|
||||||
|
|
@ -62,6 +70,7 @@ namespace Server.Commands.Generic
|
||||||
string[] conditionArgs = null;
|
string[] conditionArgs = null;
|
||||||
|
|
||||||
for (var i = 0; i < args.Length; ++i)
|
for (var i = 0; i < args.Length; ++i)
|
||||||
|
{
|
||||||
if (Insensitive.Equals(args[i], "where"))
|
if (Insensitive.Equals(args[i], "where"))
|
||||||
{
|
{
|
||||||
var origArgs = args;
|
var origArgs = args;
|
||||||
|
|
@ -69,15 +78,20 @@ namespace Server.Commands.Generic
|
||||||
args = new string[i];
|
args = new string[i];
|
||||||
|
|
||||||
for (var j = 0; j < args.Length; ++j)
|
for (var j = 0; j < args.Length; ++j)
|
||||||
|
{
|
||||||
args[j] = origArgs[j];
|
args[j] = origArgs[j];
|
||||||
|
}
|
||||||
|
|
||||||
conditionArgs = new string[origArgs.Length - i - 1];
|
conditionArgs = new string[origArgs.Length - i - 1];
|
||||||
|
|
||||||
for (var j = 0; j < conditionArgs.Length; ++j)
|
for (var j = 0; j < conditionArgs.Length; ++j)
|
||||||
|
{
|
||||||
conditionArgs[j] = origArgs[i + j + 1];
|
conditionArgs[j] = origArgs[i + j + 1];
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ParseDirect(from, conditionArgs, 0, conditionArgs?.Length ?? 0);
|
return ParseDirect(from, conditionArgs, 0, conditionArgs?.Length ?? 0);
|
||||||
}
|
}
|
||||||
|
|
@ -85,14 +99,18 @@ namespace Server.Commands.Generic
|
||||||
public static ObjectConditional ParseDirect(Mobile from, string[] args, int offset, int size)
|
public static ObjectConditional ParseDirect(Mobile from, string[] args, int offset, int size)
|
||||||
{
|
{
|
||||||
if (args == null || size == 0)
|
if (args == null || size == 0)
|
||||||
|
{
|
||||||
return Empty;
|
return Empty;
|
||||||
|
}
|
||||||
|
|
||||||
var index = 0;
|
var index = 0;
|
||||||
|
|
||||||
var objectType = AssemblyHandler.FindFirstTypeForName(args[offset + index], true);
|
var objectType = AssemblyHandler.FindFirstTypeForName(args[offset + index], true);
|
||||||
|
|
||||||
if (objectType == null)
|
if (objectType == null)
|
||||||
|
{
|
||||||
throw new Exception($"No type with that name ({args[offset + index]}) was found.");
|
throw new Exception($"No type with that name ({args[offset + index]}) was found.");
|
||||||
|
}
|
||||||
|
|
||||||
++index;
|
++index;
|
||||||
|
|
||||||
|
|
@ -113,7 +131,9 @@ namespace Server.Commands.Generic
|
||||||
++index;
|
++index;
|
||||||
|
|
||||||
if (index >= size)
|
if (index >= size)
|
||||||
|
{
|
||||||
throw new Exception("Improperly formatted object conditional.");
|
throw new Exception("Improperly formatted object conditional.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (Insensitive.Equals(cur, "or") || cur == "||")
|
else if (Insensitive.Equals(cur, "or") || cur == "||")
|
||||||
{
|
{
|
||||||
|
|
@ -134,13 +154,17 @@ namespace Server.Commands.Generic
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
if (index >= size)
|
if (index >= size)
|
||||||
|
{
|
||||||
throw new Exception("Improperly formatted object conditional.");
|
throw new Exception("Improperly formatted object conditional.");
|
||||||
|
}
|
||||||
|
|
||||||
var oper = args[offset + index];
|
var oper = args[offset + index];
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
if (index >= size)
|
if (index >= size)
|
||||||
|
{
|
||||||
throw new Exception("Improperly formatted object conditional.");
|
throw new Exception("Improperly formatted object conditional.");
|
||||||
|
}
|
||||||
|
|
||||||
var val = args[offset + index];
|
var val = args[offset + index];
|
||||||
index++;
|
index++;
|
||||||
|
|
@ -181,7 +205,9 @@ namespace Server.Commands.Generic
|
||||||
};
|
};
|
||||||
|
|
||||||
if (condition == null)
|
if (condition == null)
|
||||||
|
{
|
||||||
throw new InvalidOperationException($"Unrecognized operator (\"{oper}\").");
|
throw new InvalidOperationException($"Unrecognized operator (\"{oper}\").");
|
||||||
|
}
|
||||||
|
|
||||||
current.Add(condition);
|
current.Add(condition);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,9 @@ namespace Server.Commands.Generic
|
||||||
var ext = Extensions.Parse(from, ref args);
|
var ext = Extensions.Parse(from, ref args);
|
||||||
|
|
||||||
if (!CheckObjectTypes(from, command, ext, out var _, out var mobiles))
|
if (!CheckObjectTypes(from, command, ext, out var _, out var mobiles))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!mobiles) // sanity check
|
if (!mobiles) // sanity check
|
||||||
{
|
{
|
||||||
|
|
@ -42,13 +44,19 @@ namespace Server.Commands.Generic
|
||||||
var mob = ns.Mobile;
|
var mob = ns.Mobile;
|
||||||
|
|
||||||
if (mob == null)
|
if (mob == null)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!BaseCommand.IsAccessible(from, mob))
|
if (!BaseCommand.IsAccessible(from, mob))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (ext.IsValid(mob))
|
if (ext.IsValid(mob))
|
||||||
|
{
|
||||||
list.Add(mob);
|
list.Add(mob);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ext.Filter(list);
|
ext.Filter(list);
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,9 @@ namespace Server.Commands.Generic
|
||||||
var args = new string[oldArgs.Length - 2];
|
var args = new string[oldArgs.Length - 2];
|
||||||
|
|
||||||
for (var i = 0; i < args.Length; ++i)
|
for (var i = 0; i < args.Length; ++i)
|
||||||
|
{
|
||||||
args[i] = oldArgs[i + 2];
|
args[i] = oldArgs[i + 2];
|
||||||
|
}
|
||||||
|
|
||||||
Process(range, e.Mobile, command, args);
|
Process(range, e.Mobile, command, args);
|
||||||
}
|
}
|
||||||
|
|
@ -64,12 +66,16 @@ namespace Server.Commands.Generic
|
||||||
var impl = AreaCommandImplementor.Instance;
|
var impl = AreaCommandImplementor.Instance;
|
||||||
|
|
||||||
if (impl == null)
|
if (impl == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var map = from.Map;
|
var map = from.Map;
|
||||||
|
|
||||||
if (map == null || map == Map.Internal)
|
if (map == null || map == Map.Internal)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var start = new Point3D(from.X - range, from.Y - range, from.Z);
|
var start = new Point3D(from.X - range, from.Y - range, from.Z);
|
||||||
var end = new Point3D(from.X + range, from.Y + range, from.Z);
|
var end = new Point3D(from.X + range, from.Y + range, from.Z);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,9 @@ namespace Server.Commands.Generic
|
||||||
var ext = Extensions.Parse(from, ref args);
|
var ext = Extensions.Parse(from, ref args);
|
||||||
|
|
||||||
if (!CheckObjectTypes(from, command, ext, out var _, out var mobiles))
|
if (!CheckObjectTypes(from, command, ext, out var _, out var mobiles))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var reg = from.Region;
|
var reg = from.Region;
|
||||||
|
|
||||||
|
|
@ -34,10 +36,14 @@ namespace Server.Commands.Generic
|
||||||
foreach (var mob in reg.GetMobiles())
|
foreach (var mob in reg.GetMobiles())
|
||||||
{
|
{
|
||||||
if (!BaseCommand.IsAccessible(from, mob))
|
if (!BaseCommand.IsAccessible(from, mob))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (ext.IsValid(mob))
|
if (ext.IsValid(mob))
|
||||||
|
{
|
||||||
list.Add(mob);
|
list.Add(mob);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,9 @@ namespace Server.Commands.Generic
|
||||||
public override void Compile(Mobile from, BaseCommand command, ref string[] args, ref object obj)
|
public override void Compile(Mobile from, BaseCommand command, ref string[] args, ref object obj)
|
||||||
{
|
{
|
||||||
if (command.ObjectTypes == ObjectTypes.Items)
|
if (command.ObjectTypes == ObjectTypes.Items)
|
||||||
|
{
|
||||||
return; // sanity check
|
return; // sanity check
|
||||||
|
}
|
||||||
|
|
||||||
obj = from;
|
obj = from;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,13 @@ namespace Server.Commands.Generic
|
||||||
object obj = null;
|
object obj = null;
|
||||||
|
|
||||||
if (serial.IsItem)
|
if (serial.IsItem)
|
||||||
|
{
|
||||||
obj = World.FindItem(serial);
|
obj = World.FindItem(serial);
|
||||||
|
}
|
||||||
else if (serial.IsMobile)
|
else if (serial.IsMobile)
|
||||||
|
{
|
||||||
obj = World.FindMobile(serial);
|
obj = World.FindMobile(serial);
|
||||||
|
}
|
||||||
|
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
{
|
{
|
||||||
|
|
@ -72,7 +76,9 @@ namespace Server.Commands.Generic
|
||||||
var args = new string[oldArgs.Length - 2];
|
var args = new string[oldArgs.Length - 2];
|
||||||
|
|
||||||
for (var i = 0; i < args.Length; ++i)
|
for (var i = 0; i < args.Length; ++i)
|
||||||
|
{
|
||||||
args[i] = oldArgs[i + 2];
|
args[i] = oldArgs[i + 2];
|
||||||
|
}
|
||||||
|
|
||||||
RunCommand(e.Mobile, obj, command, args);
|
RunCommand(e.Mobile, obj, command, args);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,9 @@ namespace Server.Commands.Generic
|
||||||
base.Register(command);
|
base.Register(command);
|
||||||
|
|
||||||
for (var i = 0; i < command.Commands.Length; ++i)
|
for (var i = 0; i < command.Commands.Length; ++i)
|
||||||
|
{
|
||||||
CommandSystem.Register(command.Commands[i], command.AccessLevel, Redirect);
|
CommandSystem.Register(command.Commands[i], command.AccessLevel, Redirect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Redirect(CommandEventArgs e)
|
public void Redirect(CommandEventArgs e)
|
||||||
|
|
@ -27,23 +29,31 @@ namespace Server.Commands.Generic
|
||||||
Commands.TryGetValue(e.Command, out var command);
|
Commands.TryGetValue(e.Command, out var command);
|
||||||
|
|
||||||
if (command == null)
|
if (command == null)
|
||||||
|
{
|
||||||
e.Mobile.SendMessage("That is either an invalid command name or one that does not support this modifier.");
|
e.Mobile.SendMessage("That is either an invalid command name or one that does not support this modifier.");
|
||||||
|
}
|
||||||
else if (e.Mobile.AccessLevel < command.AccessLevel)
|
else if (e.Mobile.AccessLevel < command.AccessLevel)
|
||||||
|
{
|
||||||
e.Mobile.SendMessage("You do not have access to that command.");
|
e.Mobile.SendMessage("You do not have access to that command.");
|
||||||
|
}
|
||||||
else if (command.ValidateArgs(this, e))
|
else if (command.ValidateArgs(this, e))
|
||||||
|
{
|
||||||
Process(e.Mobile, command, e.Arguments);
|
Process(e.Mobile, command, e.Arguments);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Process(Mobile from, BaseCommand command, string[] args)
|
public override void Process(Mobile from, BaseCommand command, string[] args)
|
||||||
{
|
{
|
||||||
if (command.ValidateArgs(this, new CommandEventArgs(from, command.Commands[0], GenerateArgString(args), args)))
|
if (command.ValidateArgs(this, new CommandEventArgs(from, command.Commands[0], GenerateArgString(args), args)))
|
||||||
from.BeginTarget(
|
{
|
||||||
|
@from.BeginTarget(
|
||||||
-1,
|
-1,
|
||||||
command.ObjectTypes == ObjectTypes.All,
|
command.ObjectTypes == ObjectTypes.All,
|
||||||
TargetFlags.None,
|
TargetFlags.None,
|
||||||
(m, targeted, a) => OnTarget(m, targeted, command, a),
|
(m, targeted, a) => OnTarget(m, targeted, command, a),
|
||||||
args
|
args
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnTarget(Mobile from, object targeted, BaseCommand command, string[] args)
|
public void OnTarget(Mobile from, object targeted, BaseCommand command, string[] args)
|
||||||
|
|
|
||||||
|
|
@ -161,17 +161,25 @@ namespace Server.Commands
|
||||||
var pe = PageQueue.GetEntry(targ);
|
var pe = PageQueue.GetEntry(targ);
|
||||||
|
|
||||||
if (pe?.Handler == from)
|
if (pe?.Handler == from)
|
||||||
from.SendMessage("You may only use this command if you are handling their help page.");
|
{
|
||||||
|
@from.SendMessage("You may only use this command if you are handling their help page.");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
from.SendMessage("You may only use this command on someone who has paged you.");
|
{
|
||||||
|
@from.SendMessage("You may only use this command on someone who has paged you.");
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targ.AddToBackpack(held))
|
if (targ.AddToBackpack(held))
|
||||||
from.SendMessage("The item they were holding has been placed into their backpack.");
|
{
|
||||||
|
@from.SendMessage("The item they were holding has been placed into their backpack.");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
from.SendMessage("The item they were holding has been placed at their feet.");
|
{
|
||||||
|
@from.SendMessage("The item they were holding has been placed at their feet.");
|
||||||
|
}
|
||||||
|
|
||||||
held.ClearBounce();
|
held.ClearBounce();
|
||||||
|
|
||||||
|
|
@ -201,7 +209,9 @@ namespace Server.Commands
|
||||||
NetState.Pause();
|
NetState.Pause();
|
||||||
|
|
||||||
for (var i = 0; i < list.Count; ++i)
|
for (var i = 0; i < list.Count; ++i)
|
||||||
|
{
|
||||||
list[i].Delete();
|
list[i].Delete();
|
||||||
|
}
|
||||||
|
|
||||||
NetState.Resume();
|
NetState.Resume();
|
||||||
|
|
||||||
|
|
@ -229,12 +239,20 @@ namespace Server.Commands
|
||||||
var list = new List<IEntity>();
|
var list = new List<IEntity>();
|
||||||
|
|
||||||
foreach (var item in World.Items.Values)
|
foreach (var item in World.Items.Values)
|
||||||
|
{
|
||||||
if (item.Map == map && item.Parent == null)
|
if (item.Map == map && item.Parent == null)
|
||||||
|
{
|
||||||
list.Add(item);
|
list.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var m in World.Mobiles.Values)
|
foreach (var m in World.Mobiles.Values)
|
||||||
|
{
|
||||||
if (m.Map == map && !m.Player)
|
if (m.Map == map && !m.Player)
|
||||||
|
{
|
||||||
list.Add(m);
|
list.Add(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -297,7 +315,9 @@ namespace Server.Commands
|
||||||
var pet = pets[i];
|
var pet = pets[i];
|
||||||
|
|
||||||
if (pet is IMount mount)
|
if (pet is IMount mount)
|
||||||
|
{
|
||||||
mount.Rider = null; // make sure it's dismounted
|
mount.Rider = null; // make sure it's dismounted
|
||||||
|
}
|
||||||
|
|
||||||
pet.MoveToWorld(from.Location, from.Map);
|
pet.MoveToWorld(from.Location, from.Map);
|
||||||
}
|
}
|
||||||
|
|
@ -312,9 +332,15 @@ namespace Server.Commands
|
||||||
var pets = new List<BaseCreature>();
|
var pets = new List<BaseCreature>();
|
||||||
|
|
||||||
foreach (var m in World.Mobiles.Values)
|
foreach (var m in World.Mobiles.Values)
|
||||||
|
{
|
||||||
if (m is BaseCreature bc)
|
if (m is BaseCreature bc)
|
||||||
|
{
|
||||||
if (bc.Controlled && bc.ControlMaster == master || bc.Summoned && bc.SummonMaster == master)
|
if (bc.Controlled && bc.ControlMaster == master || bc.Summoned && bc.SummonMaster == master)
|
||||||
|
{
|
||||||
pets.Add(bc);
|
pets.Add(bc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (pets.Count > 0)
|
if (pets.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -333,7 +359,9 @@ namespace Server.Commands
|
||||||
Mobile pet = pets[i];
|
Mobile pet = pets[i];
|
||||||
|
|
||||||
if (pet is IMount mount)
|
if (pet is IMount mount)
|
||||||
|
{
|
||||||
mount.Rider = null; // make sure it's dismounted
|
mount.Rider = null; // make sure it's dismounted
|
||||||
|
}
|
||||||
|
|
||||||
pet.MoveToWorld(from.Location, from.Map);
|
pet.MoveToWorld(from.Location, from.Map);
|
||||||
}
|
}
|
||||||
|
|
@ -364,11 +392,17 @@ namespace Server.Commands
|
||||||
public static void Sound_OnCommand(CommandEventArgs e)
|
public static void Sound_OnCommand(CommandEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Length == 1)
|
if (e.Length == 1)
|
||||||
|
{
|
||||||
PlaySound(e.Mobile, e.GetInt32(0), true);
|
PlaySound(e.Mobile, e.GetInt32(0), true);
|
||||||
|
}
|
||||||
else if (e.Length == 2)
|
else if (e.Length == 2)
|
||||||
|
{
|
||||||
PlaySound(e.Mobile, e.GetInt32(0), e.GetBoolean(1));
|
PlaySound(e.Mobile, e.GetInt32(0), e.GetBoolean(1));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
e.Mobile.SendMessage("Format: Sound <index> [toAll]");
|
e.Mobile.SendMessage("Format: Sound <index> [toAll]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void PlaySound(Mobile m, int index, bool toAll)
|
private static void PlaySound(Mobile m, int index, bool toAll)
|
||||||
|
|
@ -376,7 +410,9 @@ namespace Server.Commands
|
||||||
var map = m.Map;
|
var map = m.Map;
|
||||||
|
|
||||||
if (map == null)
|
if (map == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CommandLogging.WriteLine(
|
CommandLogging.WriteLine(
|
||||||
m,
|
m,
|
||||||
|
|
@ -392,8 +428,12 @@ namespace Server.Commands
|
||||||
p.Acquire();
|
p.Acquire();
|
||||||
|
|
||||||
foreach (var state in m.GetClientsInRange(12))
|
foreach (var state in m.GetClientsInRange(12))
|
||||||
|
{
|
||||||
if (toAll || state.Mobile.CanSee(m))
|
if (toAll || state.Mobile.CanSee(m))
|
||||||
|
{
|
||||||
state.Send(p);
|
state.Send(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
p.Release();
|
p.Release();
|
||||||
}
|
}
|
||||||
|
|
@ -405,9 +445,13 @@ namespace Server.Commands
|
||||||
var toEcho = e.ArgString.Trim();
|
var toEcho = e.ArgString.Trim();
|
||||||
|
|
||||||
if (toEcho.Length > 0)
|
if (toEcho.Length > 0)
|
||||||
|
{
|
||||||
e.Mobile.SendMessage(toEcho);
|
e.Mobile.SendMessage(toEcho);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
e.Mobile.SendMessage("Format: Echo \"<text>\"");
|
e.Mobile.SendMessage("Format: Echo \"<text>\"");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Usage("Bank")]
|
[Usage("Bank")]
|
||||||
|
|
@ -561,7 +605,9 @@ namespace Server.Commands
|
||||||
map = Map.AllMaps[i];
|
map = Map.AllMaps[i];
|
||||||
|
|
||||||
if (map.MapIndex == 0x7F || map.MapIndex == 0xFF)
|
if (map.MapIndex == 0x7F || map.MapIndex == 0xFF)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (Insensitive.Equals(name, map.Name))
|
if (Insensitive.Equals(name, map.Name))
|
||||||
{
|
{
|
||||||
|
|
@ -588,20 +634,28 @@ namespace Server.Commands
|
||||||
map = Map.AllMaps[i];
|
map = Map.AllMaps[i];
|
||||||
|
|
||||||
if (map.MapIndex == 0x7F || map.MapIndex == 0xFF || from.Map == map)
|
if (map.MapIndex == 0x7F || map.MapIndex == 0xFF || from.Map == map)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var r in map.Regions.Values)
|
foreach (var r in map.Regions.Values)
|
||||||
|
{
|
||||||
if (Insensitive.Equals(r.Name, name))
|
if (Insensitive.Equals(r.Name, name))
|
||||||
{
|
{
|
||||||
from.MoveToWorld(r.GoLocation, map);
|
@from.MoveToWorld(r.GoLocation, map);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ser != 0)
|
if (ser != 0)
|
||||||
from.SendMessage("No object with that serial was found.");
|
{
|
||||||
|
@from.SendMessage("No object with that serial was found.");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
from.SendMessage("No region with that name was found.");
|
{
|
||||||
|
@from.SendMessage("No region with that name was found.");
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -618,6 +672,7 @@ namespace Server.Commands
|
||||||
var map = from.Map;
|
var map = from.Map;
|
||||||
|
|
||||||
if (map != null)
|
if (map != null)
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|
@ -628,12 +683,13 @@ namespace Server.Commands
|
||||||
var y = int.Parse(e.GetString(1));
|
var y = int.Parse(e.GetString(1));
|
||||||
var z = e.Length == 3 ? int.Parse(e.GetString(2)) : map.GetAverageZ(x, y);
|
var z = e.Length == 3 ? int.Parse(e.GetString(2)) : map.GetAverageZ(x, y);
|
||||||
|
|
||||||
from.Location = new Point3D(x, y, z);
|
@from.Location = new Point3D(x, y, z);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
from.SendMessage("Region name not found.");
|
@from.SendMessage("Region name not found.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (e.Length == 6)
|
else if (e.Length == 6)
|
||||||
{
|
{
|
||||||
|
|
@ -652,9 +708,13 @@ namespace Server.Commands
|
||||||
);
|
);
|
||||||
|
|
||||||
if (p != Point3D.Zero)
|
if (p != Point3D.Zero)
|
||||||
from.Location = p;
|
{
|
||||||
|
@from.Location = p;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
from.SendMessage("Sextant reverse lookup failed.");
|
{
|
||||||
|
@from.SendMessage("Sextant reverse lookup failed.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -672,15 +732,21 @@ namespace Server.Commands
|
||||||
var list = new List<CommandEntry>();
|
var list = new List<CommandEntry>();
|
||||||
|
|
||||||
foreach (var entry in CommandSystem.Entries.Values)
|
foreach (var entry in CommandSystem.Entries.Values)
|
||||||
|
{
|
||||||
if (m.AccessLevel >= entry.AccessLevel)
|
if (m.AccessLevel >= entry.AccessLevel)
|
||||||
|
{
|
||||||
list.Add(entry);
|
list.Add(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
list.Sort();
|
list.Sort();
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
|
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
|
{
|
||||||
sb.Append(list[0].Command);
|
sb.Append(list[0].Command);
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 1; i < list.Count; ++i)
|
for (var i = 1; i < list.Count; ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -700,7 +766,9 @@ namespace Server.Commands
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sb.Length > 0)
|
if (sb.Length > 0)
|
||||||
|
{
|
||||||
m.SendAsciiMessage(0x482, sb.ToString());
|
m.SendAsciiMessage(0x482, sb.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Usage("SMsg <text>")]
|
[Usage("SMsg <text>")]
|
||||||
|
|
@ -727,7 +795,9 @@ namespace Server.Commands
|
||||||
var m = state.Mobile;
|
var m = state.Mobile;
|
||||||
|
|
||||||
if (m?.AccessLevel >= ac)
|
if (m?.AccessLevel >= ac)
|
||||||
|
{
|
||||||
m.SendMessage(hue, message);
|
m.SendMessage(hue, message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -748,6 +818,7 @@ namespace Server.Commands
|
||||||
public static void Animate_OnCommand(CommandEventArgs e)
|
public static void Animate_OnCommand(CommandEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Length == 6)
|
if (e.Length == 6)
|
||||||
|
{
|
||||||
e.Mobile.Animate(
|
e.Mobile.Animate(
|
||||||
e.GetInt32(0),
|
e.GetInt32(0),
|
||||||
e.GetInt32(1),
|
e.GetInt32(1),
|
||||||
|
|
@ -756,8 +827,11 @@ namespace Server.Commands
|
||||||
e.GetBoolean(4),
|
e.GetBoolean(4),
|
||||||
e.GetInt32(5)
|
e.GetInt32(5)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
e.Mobile.SendMessage("Format: Animate <action> <frameCount> <repeatCount> <forward> <repeat> <delay>");
|
e.Mobile.SendMessage("Format: Animate <action> <frameCount> <repeatCount> <forward> <repeat> <delay>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Usage("Cast <name>")]
|
[Usage("Cast <name>")]
|
||||||
|
|
@ -767,14 +841,20 @@ namespace Server.Commands
|
||||||
if (e.Length == 1)
|
if (e.Length == 1)
|
||||||
{
|
{
|
||||||
if (!DesignContext.Check(e.Mobile))
|
if (!DesignContext.Check(e.Mobile))
|
||||||
|
{
|
||||||
return; // They are customizing
|
return; // They are customizing
|
||||||
|
}
|
||||||
|
|
||||||
var spell = SpellRegistry.NewSpell(e.GetString(0), e.Mobile, null);
|
var spell = SpellRegistry.NewSpell(e.GetString(0), e.Mobile, null);
|
||||||
|
|
||||||
if (spell != null)
|
if (spell != null)
|
||||||
|
{
|
||||||
spell.Cast();
|
spell.Cast();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
e.Mobile.SendMessage("That spell was not found.");
|
e.Mobile.SendMessage("That spell was not found.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -820,7 +900,9 @@ namespace Server.Commands
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targeted is Mobile mobile)
|
if (targeted is Mobile mobile)
|
||||||
from.SendMenu(new EquipMenu(from, mobile, GetEquip(mobile)));
|
{
|
||||||
|
@from.SendMenu(new EquipMenu(@from, mobile, GetEquip(mobile)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ItemListEntry[] GetEquip(Mobile m)
|
private static ItemListEntry[] GetEquip(Mobile m)
|
||||||
|
|
@ -949,9 +1031,13 @@ namespace Server.Commands
|
||||||
);
|
);
|
||||||
|
|
||||||
if (from == m)
|
if (from == m)
|
||||||
|
{
|
||||||
box.Open();
|
box.Open();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
box.DisplayTo(from);
|
{
|
||||||
|
box.DisplayTo(@from);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -988,10 +1074,14 @@ namespace Server.Commands
|
||||||
var mount = mountItem.Mount;
|
var mount = mountItem.Mount;
|
||||||
|
|
||||||
if (mount != null)
|
if (mount != null)
|
||||||
|
{
|
||||||
mount.Rider = null;
|
mount.Rider = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (targ.Items.IndexOf(item) == -1)
|
if (targ.Items.IndexOf(item) == -1)
|
||||||
|
{
|
||||||
--i;
|
--i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1042,9 +1132,13 @@ namespace Server.Commands
|
||||||
if (targeted is Mobile mobile)
|
if (targeted is Mobile mobile)
|
||||||
{
|
{
|
||||||
if (mobile.AccessLevel >= from.AccessLevel && mobile != from)
|
if (mobile.AccessLevel >= from.AccessLevel && mobile != from)
|
||||||
from.SendMessage("You can't do that to someone with higher Accesslevel than you!");
|
{
|
||||||
|
@from.SendMessage("You can't do that to someone with higher Accesslevel than you!");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
from.SendGump(new StuckMenu(from, mobile, false));
|
{
|
||||||
|
@from.SendGump(new StuckMenu(@from, mobile, false));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,17 @@ namespace Server.Commands
|
||||||
var numberStyles = arg.ToLower().StartsWith("0x") ? NumberStyles.HexNumber : NumberStyles.Integer;
|
var numberStyles = arg.ToLower().StartsWith("0x") ? NumberStyles.HexNumber : NumberStyles.Integer;
|
||||||
|
|
||||||
if (int.TryParse(arg, numberStyles, CultureInfo.InvariantCulture, out var result))
|
if (int.TryParse(arg, numberStyles, CultureInfo.InvariantCulture, out var result))
|
||||||
|
{
|
||||||
graphics.Add(result);
|
graphics.Add(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var item = EffectItem.Create(new Point3D(point), e.Mobile.Map, EffectItem.DefaultDuration);
|
var item = EffectItem.Create(new Point3D(point), e.Mobile.Map, EffectItem.DefaultDuration);
|
||||||
foreach (var graphic in graphics)
|
foreach (var graphic in graphics)
|
||||||
|
{
|
||||||
Effects.SendLocationParticles(item, graphic, 10, 50, 2023);
|
Effects.SendLocationParticles(item, graphic, 10, 50, 2023);
|
||||||
|
}
|
||||||
|
|
||||||
item.LabelTo(e.Mobile, label);
|
item.LabelTo(e.Mobile, label);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,16 @@ namespace Server.Commands
|
||||||
EventSink.Command += EventSink_Command;
|
EventSink.Command += EventSink_Command;
|
||||||
|
|
||||||
if (!Directory.Exists("Logs"))
|
if (!Directory.Exists("Logs"))
|
||||||
|
{
|
||||||
Directory.CreateDirectory("Logs");
|
Directory.CreateDirectory("Logs");
|
||||||
|
}
|
||||||
|
|
||||||
var directory = "Logs/Commands";
|
var directory = "Logs/Commands";
|
||||||
|
|
||||||
if (!Directory.Exists(directory))
|
if (!Directory.Exists(directory))
|
||||||
|
{
|
||||||
Directory.CreateDirectory(directory);
|
Directory.CreateDirectory(directory);
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -45,12 +49,17 @@ namespace Server.Commands
|
||||||
if (o is Mobile m)
|
if (o is Mobile m)
|
||||||
{
|
{
|
||||||
if (m.Account == null)
|
if (m.Account == null)
|
||||||
|
{
|
||||||
return $"{m} (no account)";
|
return $"{m} (no account)";
|
||||||
|
}
|
||||||
|
|
||||||
return $"{m} ('{m.Account.Username}')";
|
return $"{m} ('{m.Account.Username}')";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (o is Item item) return $"0x{item.Serial.Value:X} ({item.GetType().Name})";
|
if (o is Item item)
|
||||||
|
{
|
||||||
|
return $"0x{item.Serial.Value:X} ({item.GetType().Name})";
|
||||||
|
}
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
@ -58,7 +67,9 @@ namespace Server.Commands
|
||||||
public static void WriteLine(Mobile from, string format, params object[] args)
|
public static void WriteLine(Mobile from, string format, params object[] args)
|
||||||
{
|
{
|
||||||
if (!Enabled)
|
if (!Enabled)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
WriteLine(from, string.Format(format, args));
|
WriteLine(from, string.Format(format, args));
|
||||||
}
|
}
|
||||||
|
|
@ -66,7 +77,9 @@ namespace Server.Commands
|
||||||
public static void WriteLine(Mobile from, string text)
|
public static void WriteLine(Mobile from, string text)
|
||||||
{
|
{
|
||||||
if (!Enabled)
|
if (!Enabled)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -95,28 +108,38 @@ namespace Server.Commands
|
||||||
path = Path.Combine(path, toAppend);
|
path = Path.Combine(path, toAppend);
|
||||||
|
|
||||||
if (!Directory.Exists(path))
|
if (!Directory.Exists(path))
|
||||||
|
{
|
||||||
Directory.CreateDirectory(path);
|
Directory.CreateDirectory(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string Safe(string ip)
|
public static string Safe(string ip)
|
||||||
{
|
{
|
||||||
if (ip == null)
|
if (ip == null)
|
||||||
|
{
|
||||||
return "null";
|
return "null";
|
||||||
|
}
|
||||||
|
|
||||||
ip = ip.Trim().IsNullOrDefault("empty");
|
ip = ip.Trim().IsNullOrDefault("empty");
|
||||||
|
|
||||||
var isSafe = true;
|
var isSafe = true;
|
||||||
|
|
||||||
for (var i = 0; isSafe && i < m_NotSafe.Length; ++i)
|
for (var i = 0; isSafe && i < m_NotSafe.Length; ++i)
|
||||||
|
{
|
||||||
isSafe = ip.IndexOf(m_NotSafe[i]) == -1;
|
isSafe = ip.IndexOf(m_NotSafe[i]) == -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (isSafe)
|
if (isSafe)
|
||||||
|
{
|
||||||
return ip;
|
return ip;
|
||||||
|
}
|
||||||
|
|
||||||
var sb = new StringBuilder(ip);
|
var sb = new StringBuilder(ip);
|
||||||
|
|
||||||
for (var i = 0; i < m_NotSafe.Length; ++i)
|
for (var i = 0; i < m_NotSafe.Length; ++i)
|
||||||
|
{
|
||||||
sb.Replace(m_NotSafe[i], '_');
|
sb.Replace(m_NotSafe[i], '_');
|
||||||
|
}
|
||||||
|
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,14 +64,20 @@ namespace Server.Commands
|
||||||
sb.AppendFormat("{0} {1} building ", from.AccessLevel, CommandLogging.Format(from));
|
sb.AppendFormat("{0} {1} building ", from.AccessLevel, CommandLogging.Format(from));
|
||||||
|
|
||||||
if (start == end)
|
if (start == end)
|
||||||
sb.AppendFormat("at {0} in {1}", start, from.Map);
|
{
|
||||||
|
sb.AppendFormat("at {0} in {1}", start, @from.Map);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sb.AppendFormat("from {0} to {1} in {2}", start, end, from.Map);
|
{
|
||||||
|
sb.AppendFormat("from {0} to {1} in {2}", start, end, @from.Map);
|
||||||
|
}
|
||||||
|
|
||||||
sb.Append(":");
|
sb.Append(":");
|
||||||
|
|
||||||
for (var i = 0; i < args.Length; ++i)
|
for (var i = 0; i < args.Length; ++i)
|
||||||
|
{
|
||||||
sb.AppendFormat(" \"{0}\"", args[i]);
|
sb.AppendFormat(" \"{0}\"", args[i]);
|
||||||
|
}
|
||||||
|
|
||||||
CommandLogging.WriteLine(from, sb.ToString());
|
CommandLogging.WriteLine(from, sb.ToString());
|
||||||
|
|
||||||
|
|
@ -82,6 +88,7 @@ namespace Server.Commands
|
||||||
string[,] props = null;
|
string[,] props = null;
|
||||||
|
|
||||||
for (var i = 0; i < args.Length; ++i)
|
for (var i = 0; i < args.Length; ++i)
|
||||||
|
{
|
||||||
if (Insensitive.Equals(args[i], "set"))
|
if (Insensitive.Equals(args[i], "set"))
|
||||||
{
|
{
|
||||||
var remains = args.Length - i - 1;
|
var remains = args.Length - i - 1;
|
||||||
|
|
@ -103,6 +110,7 @@ namespace Server.Commands
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var type = AssemblyHandler.FindFirstTypeForName(name);
|
var type = AssemblyHandler.FindFirstTypeForName(name);
|
||||||
|
|
||||||
|
|
@ -117,14 +125,18 @@ namespace Server.Commands
|
||||||
var built = BuildObjects(from, type, start, end, args, props, packs, outline, mapAvg);
|
var built = BuildObjects(from, type, start, end, args, props, packs, outline, mapAvg);
|
||||||
|
|
||||||
if (built > 0)
|
if (built > 0)
|
||||||
from.SendMessage(
|
{
|
||||||
|
@from.SendMessage(
|
||||||
"{0} object{1} generated in {2:F1} seconds.",
|
"{0} object{1} generated in {2:F1} seconds.",
|
||||||
built,
|
built,
|
||||||
built != 1 ? "s" : "",
|
built != 1 ? "s" : "",
|
||||||
(DateTime.UtcNow - time).TotalSeconds
|
(DateTime.UtcNow - time).TotalSeconds
|
||||||
);
|
);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
SendUsage(type, from);
|
{
|
||||||
|
SendUsage(type, @from);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void FixSetString(ref string[] args, int index)
|
public static void FixSetString(ref string[] args, int index)
|
||||||
|
|
@ -166,8 +178,12 @@ namespace Server.Commands
|
||||||
var propName = props[i, 0];
|
var propName = props[i, 0];
|
||||||
|
|
||||||
for (var j = 0; thisProp == null && j < allProps.Length; ++j)
|
for (var j = 0; thisProp == null && j < allProps.Length; ++j)
|
||||||
|
{
|
||||||
if (Insensitive.Equals(propName, allProps[j].Name))
|
if (Insensitive.Equals(propName, allProps[j].Name))
|
||||||
|
{
|
||||||
thisProp = allProps[j];
|
thisProp = allProps[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (thisProp == null)
|
if (thisProp == null)
|
||||||
{
|
{
|
||||||
|
|
@ -178,17 +194,25 @@ namespace Server.Commands
|
||||||
var attr = Properties.GetCPA(thisProp);
|
var attr = Properties.GetCPA(thisProp);
|
||||||
|
|
||||||
if (attr == null)
|
if (attr == null)
|
||||||
from.SendMessage("Property ({0}) not found.", propName);
|
{
|
||||||
|
@from.SendMessage("Property ({0}) not found.", propName);
|
||||||
|
}
|
||||||
else if (from.AccessLevel < attr.WriteLevel)
|
else if (from.AccessLevel < attr.WriteLevel)
|
||||||
from.SendMessage(
|
{
|
||||||
|
@from.SendMessage(
|
||||||
"Setting this property ({0}) requires at least {1} access level.",
|
"Setting this property ({0}) requires at least {1} access level.",
|
||||||
propName,
|
propName,
|
||||||
Mobile.GetAccessLevelName(attr.WriteLevel)
|
Mobile.GetAccessLevelName(attr.WriteLevel)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
else if (!thisProp.CanWrite || attr.ReadOnly)
|
else if (!thisProp.CanWrite || attr.ReadOnly)
|
||||||
from.SendMessage("Property ({0}) is read only.", propName);
|
{
|
||||||
|
@from.SendMessage("Property ({0}) is read only.", propName);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
realProps[i] = thisProp;
|
realProps[i] = thisProp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -200,7 +224,9 @@ namespace Server.Commands
|
||||||
var ctor = ctors[i];
|
var ctor = ctors[i];
|
||||||
|
|
||||||
if (!IsConstructible(ctor, from.AccessLevel))
|
if (!IsConstructible(ctor, from.AccessLevel))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Handle optional constructors
|
// Handle optional constructors
|
||||||
var paramList = ctor.GetParameters();
|
var paramList = ctor.GetParameters();
|
||||||
|
|
@ -211,12 +237,16 @@ namespace Server.Commands
|
||||||
var paramValues = ParseValues(paramList, args);
|
var paramValues = ParseValues(paramList, args);
|
||||||
|
|
||||||
if (paramValues == null)
|
if (paramValues == null)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var built = Build(from, start, end, ctor, paramValues, props, realProps, packs, outline, mapAvg);
|
var built = Build(from, start, end, ctor, paramValues, props, realProps, packs, outline, mapAvg);
|
||||||
|
|
||||||
if (built > 0)
|
if (built > 0)
|
||||||
|
{
|
||||||
return built;
|
return built;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -233,11 +263,17 @@ namespace Server.Commands
|
||||||
var value = ParseValue(param.ParameterType, a < args.Length ? args[a++] : null);
|
var value = ParseValue(param.ParameterType, a < args.Length ? args[a++] : null);
|
||||||
|
|
||||||
if (value != null)
|
if (value != null)
|
||||||
|
{
|
||||||
values[i] = value;
|
values[i] = value;
|
||||||
|
}
|
||||||
else if (param.HasDefaultValue)
|
else if (param.HasDefaultValue)
|
||||||
|
{
|
||||||
values[i] = Type.Missing;
|
values[i] = Type.Missing;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return values;
|
return values;
|
||||||
|
|
@ -247,23 +283,43 @@ namespace Server.Commands
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (IsEnum(type)) return Enum.Parse(type, value, true);
|
if (IsEnum(type))
|
||||||
if (IsType(type)) return AssemblyHandler.FindFirstTypeForName(value);
|
{
|
||||||
if (IsParsable(type)) return ParseParsable(type, value);
|
return Enum.Parse(type, value, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsType(type))
|
||||||
|
{
|
||||||
|
return AssemblyHandler.FindFirstTypeForName(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsParsable(type))
|
||||||
|
{
|
||||||
|
return ParseParsable(type, value);
|
||||||
|
}
|
||||||
|
|
||||||
object obj = value;
|
object obj = value;
|
||||||
|
|
||||||
if (value?.StartsWith("0x") == true)
|
if (value?.StartsWith("0x") == true)
|
||||||
{
|
{
|
||||||
if (IsSignedNumeric(type))
|
if (IsSignedNumeric(type))
|
||||||
|
{
|
||||||
obj = Convert.ToInt64(value.Substring(2), 16);
|
obj = Convert.ToInt64(value.Substring(2), 16);
|
||||||
|
}
|
||||||
else if (IsUnsignedNumeric(type))
|
else if (IsUnsignedNumeric(type))
|
||||||
|
{
|
||||||
obj = Convert.ToUInt64(value.Substring(2), 16);
|
obj = Convert.ToUInt64(value.Substring(2), 16);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
obj = Convert.ToInt32(value.Substring(2), 16);
|
obj = Convert.ToInt32(value.Substring(2), 16);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj == null && !type.IsValueType)
|
if (obj == null && !type.IsValueType)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return Convert.ChangeType(obj, type);
|
return Convert.ChangeType(obj, type);
|
||||||
}
|
}
|
||||||
|
|
@ -287,7 +343,9 @@ namespace Server.Commands
|
||||||
for (var i = 0; i < realProps.Length; ++i)
|
for (var i = 0; i < realProps.Length; ++i)
|
||||||
{
|
{
|
||||||
if (realProps[i] == null)
|
if (realProps[i] == null)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var result =
|
var result =
|
||||||
Properties.InternalSetValue(from, built, built, realProps[i], props[i, 1], props[i, 1], false);
|
Properties.InternalSetValue(from, built, built, realProps[i], props[i, 1], props[i, 1], false);
|
||||||
|
|
@ -295,14 +353,18 @@ namespace Server.Commands
|
||||||
if (result != "Property has been set.")
|
if (result != "Property has been set.")
|
||||||
{
|
{
|
||||||
if (sendError)
|
if (sendError)
|
||||||
from.SendMessage(result);
|
{
|
||||||
|
@from.SendMessage(result);
|
||||||
|
}
|
||||||
|
|
||||||
hadError = true;
|
hadError = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hadError)
|
if (hadError)
|
||||||
|
{
|
||||||
sendError = false;
|
sendError = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (IEntity)built;
|
return (IEntity)built;
|
||||||
|
|
@ -321,19 +383,29 @@ namespace Server.Commands
|
||||||
var height = end.Y - start.Y + 1;
|
var height = end.Y - start.Y + 1;
|
||||||
|
|
||||||
if (outline && (width < 3 || height < 3))
|
if (outline && (width < 3 || height < 3))
|
||||||
|
{
|
||||||
outline = false;
|
outline = false;
|
||||||
|
}
|
||||||
|
|
||||||
int objectCount;
|
int objectCount;
|
||||||
|
|
||||||
if (packs != null)
|
if (packs != null)
|
||||||
|
{
|
||||||
objectCount = packs.Count;
|
objectCount = packs.Count;
|
||||||
|
}
|
||||||
else if (outline)
|
else if (outline)
|
||||||
|
{
|
||||||
objectCount = (width + height - 2) * 2;
|
objectCount = (width + height - 2) * 2;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
objectCount = width * height;
|
objectCount = width * height;
|
||||||
|
}
|
||||||
|
|
||||||
if (objectCount >= 20)
|
if (objectCount >= 20)
|
||||||
from.SendMessage("Constructing {0} objects, please wait.", objectCount);
|
{
|
||||||
|
@from.SendMessage("Constructing {0} objects, please wait.", objectCount);
|
||||||
|
}
|
||||||
|
|
||||||
var sendError = true;
|
var sendError = true;
|
||||||
|
|
||||||
|
|
@ -349,9 +421,13 @@ namespace Server.Commands
|
||||||
sb.AppendFormat("0x{0:X}; ", built.Serial.Value);
|
sb.AppendFormat("0x{0:X}; ", built.Serial.Value);
|
||||||
|
|
||||||
if (built is Item item)
|
if (built is Item item)
|
||||||
|
{
|
||||||
packs[i].DropItem(item);
|
packs[i].DropItem(item);
|
||||||
|
}
|
||||||
else if (built is Mobile m)
|
else if (built is Mobile m)
|
||||||
|
{
|
||||||
m.MoveToWorld(new Point3D(start.X, start.Y, start.Z), map);
|
m.MoveToWorld(new Point3D(start.X, start.Y, start.Z), map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -359,23 +435,33 @@ namespace Server.Commands
|
||||||
var z = start.Z;
|
var z = start.Z;
|
||||||
|
|
||||||
for (var x = start.X; x <= end.X; ++x)
|
for (var x = start.X; x <= end.X; ++x)
|
||||||
|
{
|
||||||
for (var y = start.Y; y <= end.Y; ++y)
|
for (var y = start.Y; y <= end.Y; ++y)
|
||||||
{
|
{
|
||||||
if (outline && x != start.X && x != end.X && y != start.Y && y != end.Y)
|
if (outline && x != start.X && x != end.X && y != start.Y && y != end.Y)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (mapAvg)
|
if (mapAvg)
|
||||||
|
{
|
||||||
z = map.GetAverageZ(x, y);
|
z = map.GetAverageZ(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
var built = Build(from, ctor, values, props, realProps, ref sendError);
|
var built = Build(@from, ctor, values, props, realProps, ref sendError);
|
||||||
|
|
||||||
sb.AppendFormat("0x{0:X}; ", built.Serial.Value);
|
sb.AppendFormat("0x{0:X}; ", built.Serial.Value);
|
||||||
|
|
||||||
if (built is Item item)
|
if (built is Item item)
|
||||||
|
{
|
||||||
item.MoveToWorld(new Point3D(x, y, z), map);
|
item.MoveToWorld(new Point3D(x, y, z), map);
|
||||||
|
}
|
||||||
else if (built is Mobile m)
|
else if (built is Mobile m)
|
||||||
|
{
|
||||||
m.MoveToWorld(new Point3D(x, y, z), map);
|
m.MoveToWorld(new Point3D(x, y, z), map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandLogging.WriteLine(from, sb.ToString());
|
CommandLogging.WriteLine(from, sb.ToString());
|
||||||
|
|
@ -399,7 +485,9 @@ namespace Server.Commands
|
||||||
var ctor = ctors[i];
|
var ctor = ctors[i];
|
||||||
|
|
||||||
if (!IsConstructible(ctor, from.AccessLevel))
|
if (!IsConstructible(ctor, from.AccessLevel))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!foundCtor)
|
if (!foundCtor)
|
||||||
{
|
{
|
||||||
|
|
@ -411,7 +499,9 @@ namespace Server.Commands
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foundCtor)
|
if (!foundCtor)
|
||||||
from.SendMessage("That type is not marked constructible.");
|
{
|
||||||
|
@from.SendMessage("That type is not marked constructible.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SendCtor(Type type, ConstructorInfo ctor, Mobile from)
|
public static void SendCtor(Type type, ConstructorInfo ctor, Mobile from)
|
||||||
|
|
@ -425,7 +515,9 @@ namespace Server.Commands
|
||||||
for (var i = 0; i < paramList.Length; ++i)
|
for (var i = 0; i < paramList.Length; ++i)
|
||||||
{
|
{
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
|
{
|
||||||
sb.Append(',');
|
sb.Append(',');
|
||||||
|
}
|
||||||
|
|
||||||
sb.Append(' ');
|
sb.Append(' ');
|
||||||
|
|
||||||
|
|
@ -463,16 +555,20 @@ namespace Server.Commands
|
||||||
var from = e.Mobile;
|
var from = e.Mobile;
|
||||||
|
|
||||||
if (e.Length >= 1)
|
if (e.Length >= 1)
|
||||||
|
{
|
||||||
BoundingBoxPicker.Begin(
|
BoundingBoxPicker.Begin(
|
||||||
from,
|
@from,
|
||||||
(map, start, end) =>
|
(map, start, end) =>
|
||||||
TileBox_Callback(from, start, end, new TileState(TileZType.Start, 0, e.Arguments, outline))
|
TileBox_Callback(@from, start, end, new TileState(TileZType.Start, 0, e.Arguments, outline))
|
||||||
);
|
);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
from.SendMessage(
|
{
|
||||||
|
@from.SendMessage(
|
||||||
"Format: {0} <type> [params] [set {{<propertyName> <value> ...}}]",
|
"Format: {0} <type> [params] [set {{<propertyName> <value> ...}}]",
|
||||||
outline ? "Outline" : "Tile"
|
outline ? "Outline" : "Tile"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void InternalRXYZ_OnCommand(CommandEventArgs e, bool outline)
|
private static void InternalRXYZ_OnCommand(CommandEventArgs e, bool outline)
|
||||||
|
|
@ -485,7 +581,9 @@ namespace Server.Commands
|
||||||
var subArgs = new string[e.Length - 5];
|
var subArgs = new string[e.Length - 5];
|
||||||
|
|
||||||
for (var i = 0; i < subArgs.Length; ++i)
|
for (var i = 0; i < subArgs.Length; ++i)
|
||||||
|
{
|
||||||
subArgs[i] = e.Arguments[i + 5];
|
subArgs[i] = e.Arguments[i + 5];
|
||||||
|
}
|
||||||
|
|
||||||
Invoke(e.Mobile, p, p2, subArgs, null, outline);
|
Invoke(e.Mobile, p, p2, subArgs, null, outline);
|
||||||
}
|
}
|
||||||
|
|
@ -508,7 +606,9 @@ namespace Server.Commands
|
||||||
var subArgs = new string[e.Length - 5];
|
var subArgs = new string[e.Length - 5];
|
||||||
|
|
||||||
for (var i = 0; i < subArgs.Length; ++i)
|
for (var i = 0; i < subArgs.Length; ++i)
|
||||||
|
{
|
||||||
subArgs[i] = e.Arguments[i + 5];
|
subArgs[i] = e.Arguments[i + 5];
|
||||||
|
}
|
||||||
|
|
||||||
Invoke(e.Mobile, p, p2, subArgs, null, outline);
|
Invoke(e.Mobile, p, p2, subArgs, null, outline);
|
||||||
}
|
}
|
||||||
|
|
@ -530,7 +630,9 @@ namespace Server.Commands
|
||||||
var subArgs = new string[e.Length - 1];
|
var subArgs = new string[e.Length - 1];
|
||||||
|
|
||||||
for (var i = 0; i < subArgs.Length; ++i)
|
for (var i = 0; i < subArgs.Length; ++i)
|
||||||
|
{
|
||||||
subArgs[i] = e.Arguments[i + 1];
|
subArgs[i] = e.Arguments[i + 1];
|
||||||
|
}
|
||||||
|
|
||||||
BoundingBoxPicker.Begin(
|
BoundingBoxPicker.Begin(
|
||||||
from,
|
from,
|
||||||
|
|
@ -552,16 +654,20 @@ namespace Server.Commands
|
||||||
var from = e.Mobile;
|
var from = e.Mobile;
|
||||||
|
|
||||||
if (e.Length >= 1)
|
if (e.Length >= 1)
|
||||||
|
{
|
||||||
BoundingBoxPicker.Begin(
|
BoundingBoxPicker.Begin(
|
||||||
from,
|
@from,
|
||||||
(map, start, end) =>
|
(map, start, end) =>
|
||||||
TileBox_Callback(from, start, end, new TileState(TileZType.MapAverage, 0, e.Arguments, outline))
|
TileBox_Callback(@from, start, end, new TileState(TileZType.MapAverage, 0, e.Arguments, outline))
|
||||||
);
|
);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
from.SendMessage(
|
{
|
||||||
|
@from.SendMessage(
|
||||||
"Format: {0}Avg <type> [params] [set {{<propertyName> <value> ...}}]",
|
"Format: {0}Avg <type> [params] [set {{<propertyName> <value> ...}}]",
|
||||||
outline ? "Outline" : "Tile"
|
outline ? "Outline" : "Tile"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Usage("Tile <name> [params] [set {<propertyName> <value> ...}]")]
|
[Usage("Tile <name> [params] [set {<propertyName> <value> ...}]")]
|
||||||
|
|
@ -681,8 +787,12 @@ namespace Server.Commands
|
||||||
public static bool IsSignedNumeric(Type type)
|
public static bool IsSignedNumeric(Type type)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < m_SignedNumerics.Length; ++i)
|
for (var i = 0; i < m_SignedNumerics.Length; ++i)
|
||||||
|
{
|
||||||
if (type == m_SignedNumerics[i])
|
if (type == m_SignedNumerics[i])
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -690,8 +800,12 @@ namespace Server.Commands
|
||||||
public static bool IsUnsignedNumeric(Type type)
|
public static bool IsUnsignedNumeric(Type type)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < m_UnsignedNumerics.Length; ++i)
|
for (var i = 0; i < m_UnsignedNumerics.Length; ++i)
|
||||||
|
{
|
||||||
if (type == m_UnsignedNumerics[i])
|
if (type == m_UnsignedNumerics[i])
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ namespace Server.Gumps
|
||||||
AddAlphaRegion(10, 40, 400, 200);
|
AddAlphaRegion(10, 40, 400, 200);
|
||||||
|
|
||||||
if (searchResults.Length > 0)
|
if (searchResults.Length > 0)
|
||||||
|
{
|
||||||
for (var i = page * 10; i < (page + 1) * 10 && i < searchResults.Length; ++i)
|
for (var i = page * 10; i < (page + 1) * 10 && i < searchResults.Length; ++i)
|
||||||
{
|
{
|
||||||
var index = i % 10;
|
var index = i % 10;
|
||||||
|
|
@ -48,23 +49,34 @@ namespace Server.Gumps
|
||||||
AddLabel(44, 39 + index * 20, 0x480, searchResults[i].Name);
|
AddLabel(44, 39 + index * 20, 0x480, searchResults[i].Name);
|
||||||
AddButton(10, 39 + index * 20, 4023, 4025, 4 + i);
|
AddButton(10, 39 + index * 20, 4023, 4025, 4 + i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddLabel(15, 44, 0x480, explicitSearch ? "Nothing matched your search terms." : "No results to display.");
|
AddLabel(15, 44, 0x480, explicitSearch ? "Nothing matched your search terms." : "No results to display.");
|
||||||
|
}
|
||||||
|
|
||||||
AddImageTiled(10, 250, 400, 20, 2624);
|
AddImageTiled(10, 250, 400, 20, 2624);
|
||||||
AddAlphaRegion(10, 250, 400, 20);
|
AddAlphaRegion(10, 250, 400, 20);
|
||||||
|
|
||||||
if (m_Page > 0)
|
if (m_Page > 0)
|
||||||
|
{
|
||||||
AddButton(10, 249, 4014, 4016, 2);
|
AddButton(10, 249, 4014, 4016, 2);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddImage(10, 249, 4014);
|
AddImage(10, 249, 4014);
|
||||||
|
}
|
||||||
|
|
||||||
AddHtmlLocalized(44, 250, 170, 20, 1061028, m_Page > 0 ? 0x7FFF : 0x5EF7); // Previous page
|
AddHtmlLocalized(44, 250, 170, 20, 1061028, m_Page > 0 ? 0x7FFF : 0x5EF7); // Previous page
|
||||||
|
|
||||||
if ((m_Page + 1) * 10 < searchResults.Length)
|
if ((m_Page + 1) * 10 < searchResults.Length)
|
||||||
|
{
|
||||||
AddButton(210, 249, 4005, 4007, 3);
|
AddButton(210, 249, 4005, 4007, 3);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddImage(210, 249, 4005);
|
AddImage(210, 249, 4005);
|
||||||
|
}
|
||||||
|
|
||||||
AddHtmlLocalized(
|
AddHtmlLocalized(
|
||||||
244,
|
244,
|
||||||
|
|
@ -112,7 +124,9 @@ namespace Server.Gumps
|
||||||
private static void Match(string match, Type[] types, List<Type> results)
|
private static void Match(string match, Type[] types, List<Type> results)
|
||||||
{
|
{
|
||||||
if (match.Length == 0)
|
if (match.Length == 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
match = match.ToLower();
|
match = match.ToLower();
|
||||||
|
|
||||||
|
|
@ -126,12 +140,14 @@ namespace Server.Gumps
|
||||||
var ctors = t.GetConstructors();
|
var ctors = t.GetConstructors();
|
||||||
|
|
||||||
for (var j = 0; j < ctors.Length; ++j)
|
for (var j = 0; j < ctors.Length; ++j)
|
||||||
|
{
|
||||||
if (ctors[j].GetParameters().Length == 0 &&
|
if (ctors[j].GetParameters().Length == 0 &&
|
||||||
ctors[j].IsDefined(typeof(ConstructibleAttribute), false))
|
ctors[j].IsDefined(typeof(ConstructibleAttribute), false))
|
||||||
{
|
{
|
||||||
results.Add(t);
|
results.Add(t);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -183,14 +199,18 @@ namespace Server.Gumps
|
||||||
case 2: // Previous page
|
case 2: // Previous page
|
||||||
{
|
{
|
||||||
if (m_Page > 0)
|
if (m_Page > 0)
|
||||||
from.SendGump(new AddGump(from, m_SearchString, m_Page - 1, m_SearchResults, true));
|
{
|
||||||
|
@from.SendGump(new AddGump(@from, m_SearchString, m_Page - 1, m_SearchResults, true));
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: // Next page
|
case 3: // Next page
|
||||||
{
|
{
|
||||||
if ((m_Page + 1) * 10 < m_SearchResults.Length)
|
if ((m_Page + 1) * 10 < m_SearchResults.Length)
|
||||||
from.SendGump(new AddGump(from, m_SearchString, m_Page + 1, m_SearchResults, true));
|
{
|
||||||
|
@from.SendGump(new AddGump(@from, m_SearchString, m_Page + 1, m_SearchResults, true));
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -258,7 +278,9 @@ namespace Server.Gumps
|
||||||
protected override void OnTargetCancel(Mobile from, TargetCancelType cancelType)
|
protected override void OnTargetCancel(Mobile from, TargetCancelType cancelType)
|
||||||
{
|
{
|
||||||
if (cancelType == TargetCancelType.Canceled)
|
if (cancelType == TargetCancelType.Canceled)
|
||||||
from.SendGump(new AddGump(from, m_SearchString, m_Page, m_SearchResults, true));
|
{
|
||||||
|
@from.SendGump(new AddGump(@from, m_SearchString, m_Page, m_SearchResults, true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,9 @@ namespace Server.Commands
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (m_RootItems == null)
|
if (m_RootItems == null)
|
||||||
|
{
|
||||||
Load();
|
Load();
|
||||||
|
}
|
||||||
|
|
||||||
return m_RootItems;
|
return m_RootItems;
|
||||||
}
|
}
|
||||||
|
|
@ -33,7 +35,9 @@ namespace Server.Commands
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (m_RootMobiles == null)
|
if (m_RootMobiles == null)
|
||||||
|
{
|
||||||
Load();
|
Load();
|
||||||
|
}
|
||||||
|
|
||||||
return m_RootMobiles;
|
return m_RootMobiles;
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +66,9 @@ namespace Server.Commands
|
||||||
{
|
{
|
||||||
var list = new List<CAGJson>();
|
var list = new List<CAGJson>();
|
||||||
foreach (var ce in ceList)
|
foreach (var ce in ceList)
|
||||||
|
{
|
||||||
RecurseExport(list, ce, null);
|
RecurseExport(list, ce, null);
|
||||||
|
}
|
||||||
|
|
||||||
JsonConfig.Serialize(fileName, list);
|
JsonConfig.Serialize(fileName, list);
|
||||||
}
|
}
|
||||||
|
|
@ -72,6 +78,7 @@ namespace Server.Commands
|
||||||
category = string.IsNullOrWhiteSpace(category) ? ce.Title : $"{category}{ce.Title}";
|
category = string.IsNullOrWhiteSpace(category) ? ce.Title : $"{category}{ce.Title}";
|
||||||
|
|
||||||
if (ce.Matched.Count > 0)
|
if (ce.Matched.Count > 0)
|
||||||
|
{
|
||||||
list.Add(
|
list.Add(
|
||||||
new CAGJson
|
new CAGJson
|
||||||
{
|
{
|
||||||
|
|
@ -84,15 +91,21 @@ namespace Server.Commands
|
||||||
var itemID = item.ItemID;
|
var itemID = item.ItemID;
|
||||||
|
|
||||||
if (item is BaseAddon addon && addon.Components.Count == 1)
|
if (item is BaseAddon addon && addon.Components.Count == 1)
|
||||||
|
{
|
||||||
itemID = addon.Components[0].ItemID;
|
itemID = addon.Components[0].ItemID;
|
||||||
|
}
|
||||||
|
|
||||||
if (itemID > TileData.MaxItemValue)
|
if (itemID > TileData.MaxItemValue)
|
||||||
|
{
|
||||||
itemID = 1;
|
itemID = 1;
|
||||||
|
}
|
||||||
|
|
||||||
int? hue = item.Hue & 0x7FFF;
|
int? hue = item.Hue & 0x7FFF;
|
||||||
|
|
||||||
if ((hue & 0x4000) != 0)
|
if ((hue & 0x4000) != 0)
|
||||||
|
{
|
||||||
hue = 0;
|
hue = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return new CAGObject
|
return new CAGObject
|
||||||
{
|
{
|
||||||
|
|
@ -109,7 +122,9 @@ namespace Server.Commands
|
||||||
int? hue = m.Hue & 0x7FFF;
|
int? hue = m.Hue & 0x7FFF;
|
||||||
|
|
||||||
if ((hue & 0x4000) != 0)
|
if ((hue & 0x4000) != 0)
|
||||||
|
{
|
||||||
hue = 0;
|
hue = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return new CAGObject
|
return new CAGObject
|
||||||
{
|
{
|
||||||
|
|
@ -127,6 +142,7 @@ namespace Server.Commands
|
||||||
.ToArray()
|
.ToArray()
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
var subCats = new List<CategoryEntry>(ce.SubCategories);
|
var subCats = new List<CategoryEntry>(ce.SubCategories);
|
||||||
|
|
||||||
|
|
@ -146,7 +162,9 @@ namespace Server.Commands
|
||||||
AddTypes(Core.Assembly, types);
|
AddTypes(Core.Assembly, types);
|
||||||
|
|
||||||
for (var i = 0; i < AssemblyHandler.Assemblies.Length; ++i)
|
for (var i = 0; i < AssemblyHandler.Assemblies.Length; ++i)
|
||||||
|
{
|
||||||
AddTypes(AssemblyHandler.Assemblies[i], types);
|
AddTypes(AssemblyHandler.Assemblies[i], types);
|
||||||
|
}
|
||||||
|
|
||||||
m_RootItems = Load(types, "Data/items.cfg");
|
m_RootItems = Load(types, "Data/items.cfg");
|
||||||
m_RootMobiles = Load(types, "Data/mobiles.cfg");
|
m_RootMobiles = Load(types, "Data/mobiles.cfg");
|
||||||
|
|
@ -156,7 +174,10 @@ namespace Server.Commands
|
||||||
{
|
{
|
||||||
var lines = CategoryLine.Load(config);
|
var lines = CategoryLine.Load(config);
|
||||||
|
|
||||||
if (lines.Length <= 0) return new CategoryEntry();
|
if (lines.Length <= 0)
|
||||||
|
{
|
||||||
|
return new CategoryEntry();
|
||||||
|
}
|
||||||
|
|
||||||
var index = 0;
|
var index = 0;
|
||||||
var root = new CategoryEntry(null, lines, ref index);
|
var root = new CategoryEntry(null, lines, ref index);
|
||||||
|
|
@ -169,7 +190,9 @@ namespace Server.Commands
|
||||||
private static bool IsConstructible(Type type)
|
private static bool IsConstructible(Type type)
|
||||||
{
|
{
|
||||||
if (!type.IsSubclassOf(typeofItem) && !type.IsSubclassOf(typeofMobile))
|
if (!type.IsSubclassOf(typeofItem) && !type.IsSubclassOf(typeofMobile))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var ctor = type.GetConstructor(Type.EmptyTypes);
|
var ctor = type.GetConstructor(Type.EmptyTypes);
|
||||||
|
|
||||||
|
|
@ -185,10 +208,14 @@ namespace Server.Commands
|
||||||
var type = allTypes[i];
|
var type = allTypes[i];
|
||||||
|
|
||||||
if (type.IsAbstract)
|
if (type.IsAbstract)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsConstructible(type))
|
if (IsConstructible(type))
|
||||||
|
{
|
||||||
types.Add(type);
|
types.Add(type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -200,7 +227,9 @@ namespace Server.Commands
|
||||||
var match = GetDeepestMatch(root, type);
|
var match = GetDeepestMatch(root, type);
|
||||||
|
|
||||||
if (match == null)
|
if (match == null)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -216,14 +245,18 @@ namespace Server.Commands
|
||||||
private static CategoryEntry GetDeepestMatch(CategoryEntry root, Type type)
|
private static CategoryEntry GetDeepestMatch(CategoryEntry root, Type type)
|
||||||
{
|
{
|
||||||
if (!root.IsMatch(type))
|
if (!root.IsMatch(type))
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < root.SubCategories.Length; ++i)
|
for (var i = 0; i < root.SubCategories.Length; ++i)
|
||||||
{
|
{
|
||||||
var check = GetDeepestMatch(root.SubCategories[i], type);
|
var check = GetDeepestMatch(root.SubCategories[i], type);
|
||||||
|
|
||||||
if (check != null)
|
if (check != null)
|
||||||
|
{
|
||||||
return check;
|
return check;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
|
|
@ -295,14 +328,18 @@ namespace Server.Commands
|
||||||
var start = text.IndexOf('(');
|
var start = text.IndexOf('(');
|
||||||
|
|
||||||
if (start < 0)
|
if (start < 0)
|
||||||
|
{
|
||||||
throw new FormatException($"Input string not correctly formatted ('{text}')");
|
throw new FormatException($"Input string not correctly formatted ('{text}')");
|
||||||
|
}
|
||||||
|
|
||||||
Title = text.Substring(0, start).Trim();
|
Title = text.Substring(0, start).Trim();
|
||||||
|
|
||||||
var end = text.IndexOf(')', ++start);
|
var end = text.IndexOf(')', ++start);
|
||||||
|
|
||||||
if (end < start)
|
if (end < start)
|
||||||
|
{
|
||||||
throw new FormatException($"Input string not correctly formatted ('{text}')");
|
throw new FormatException($"Input string not correctly formatted ('{text}')");
|
||||||
|
}
|
||||||
|
|
||||||
text = text.Substring(start, end - start);
|
text = text.Substring(start, end - start);
|
||||||
var split = text.Split(';');
|
var split = text.Split(';');
|
||||||
|
|
@ -314,9 +351,13 @@ namespace Server.Commands
|
||||||
var type = AssemblyHandler.FindFirstTypeForName(split[i].Trim());
|
var type = AssemblyHandler.FindFirstTypeForName(split[i].Trim());
|
||||||
|
|
||||||
if (type == null)
|
if (type == null)
|
||||||
|
{
|
||||||
Console.WriteLine("Match type not found ('{0}')", split[i].Trim());
|
Console.WriteLine("Match type not found ('{0}')", split[i].Trim());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
list.Add(type);
|
list.Add(type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Matches = list.ToArray();
|
Matches = list.ToArray();
|
||||||
|
|
@ -329,7 +370,9 @@ namespace Server.Commands
|
||||||
var entryList = new List<CategoryEntry>();
|
var entryList = new List<CategoryEntry>();
|
||||||
|
|
||||||
while (index < lines.Length && lines[index].Indentation > ourIndentation)
|
while (index < lines.Length && lines[index].Indentation > ourIndentation)
|
||||||
|
{
|
||||||
entryList.Add(new CategoryEntry(this, lines, ref index));
|
entryList.Add(new CategoryEntry(this, lines, ref index));
|
||||||
|
}
|
||||||
|
|
||||||
SubCategories = entryList.ToArray();
|
SubCategories = entryList.ToArray();
|
||||||
entryList.Clear();
|
entryList.Clear();
|
||||||
|
|
@ -352,7 +395,9 @@ namespace Server.Commands
|
||||||
var isMatch = false;
|
var isMatch = false;
|
||||||
|
|
||||||
for (var i = 0; !isMatch && i < Matches.Length; ++i)
|
for (var i = 0; !isMatch && i < Matches.Length; ++i)
|
||||||
|
{
|
||||||
isMatch = type == Matches[i] || type.IsSubclassOf(Matches[i]);
|
isMatch = type == Matches[i] || type.IsSubclassOf(Matches[i]);
|
||||||
|
}
|
||||||
|
|
||||||
return isMatch;
|
return isMatch;
|
||||||
}
|
}
|
||||||
|
|
@ -365,11 +410,17 @@ namespace Server.Commands
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
for (index = 0; index < input.Length; ++index)
|
for (index = 0; index < input.Length; ++index)
|
||||||
|
{
|
||||||
if (char.IsLetter(input, index))
|
if (char.IsLetter(input, index))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (index >= input.Length)
|
if (index >= input.Length)
|
||||||
|
{
|
||||||
throw new FormatException($"Input string not correctly formatted ('{input}')");
|
throw new FormatException($"Input string not correctly formatted ('{input}')");
|
||||||
|
}
|
||||||
|
|
||||||
Indentation = index;
|
Indentation = index;
|
||||||
Text = input.Substring(index);
|
Text = input.Substring(index);
|
||||||
|
|
@ -389,7 +440,9 @@ namespace Server.Commands
|
||||||
string line;
|
string line;
|
||||||
|
|
||||||
while ((line = ip.ReadLine()) != null)
|
while ((line = ip.ReadLine()) != null)
|
||||||
|
{
|
||||||
list.Add(new CategoryLine(line));
|
list.Add(new CategoryLine(line));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return list.ToArray();
|
return list.ToArray();
|
||||||
|
|
|
||||||
|
|
@ -110,16 +110,22 @@ namespace Server.Gumps
|
||||||
var y = BorderSize + OffsetSize;
|
var y = BorderSize + OffsetSize;
|
||||||
|
|
||||||
if (OldStyle)
|
if (OldStyle)
|
||||||
|
{
|
||||||
AddImageTiled(x, y, TotalWidth - OffsetSize * 3 - SetWidth, EntryHeight, HeaderGumpID);
|
AddImageTiled(x, y, TotalWidth - OffsetSize * 3 - SetWidth, EntryHeight, HeaderGumpID);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
|
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Category.Parent != null)
|
if (m_Category.Parent != null)
|
||||||
{
|
{
|
||||||
AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1);
|
AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1);
|
||||||
|
|
||||||
if (PrevLabel)
|
if (PrevLabel)
|
||||||
|
{
|
||||||
AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
|
AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x += PrevWidth + OffsetSize;
|
x += PrevWidth + OffsetSize;
|
||||||
|
|
@ -128,6 +134,7 @@ namespace Server.Gumps
|
||||||
(OldStyle ? SetWidth + OffsetSize : 0);
|
(OldStyle ? SetWidth + OffsetSize : 0);
|
||||||
|
|
||||||
if (!OldStyle)
|
if (!OldStyle)
|
||||||
|
{
|
||||||
AddImageTiled(
|
AddImageTiled(
|
||||||
x - (OldStyle ? OffsetSize : 0),
|
x - (OldStyle ? OffsetSize : 0),
|
||||||
y,
|
y,
|
||||||
|
|
@ -135,6 +142,7 @@ namespace Server.Gumps
|
||||||
EntryHeight,
|
EntryHeight,
|
||||||
EntryGumpID
|
EntryGumpID
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
AddHtml(
|
AddHtml(
|
||||||
x + TextOffsetX,
|
x + TextOffsetX,
|
||||||
|
|
@ -147,29 +155,39 @@ namespace Server.Gumps
|
||||||
x += emptyWidth + OffsetSize;
|
x += emptyWidth + OffsetSize;
|
||||||
|
|
||||||
if (OldStyle)
|
if (OldStyle)
|
||||||
|
{
|
||||||
AddImageTiled(x, y, TotalWidth - OffsetSize * 3 - SetWidth, EntryHeight, HeaderGumpID);
|
AddImageTiled(x, y, TotalWidth - OffsetSize * 3 - SetWidth, EntryHeight, HeaderGumpID);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
|
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
|
||||||
|
}
|
||||||
|
|
||||||
if (page > 0)
|
if (page > 0)
|
||||||
{
|
{
|
||||||
AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 2);
|
AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 2);
|
||||||
|
|
||||||
if (PrevLabel)
|
if (PrevLabel)
|
||||||
|
{
|
||||||
AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
|
AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x += PrevWidth + OffsetSize;
|
x += PrevWidth + OffsetSize;
|
||||||
|
|
||||||
if (!OldStyle)
|
if (!OldStyle)
|
||||||
|
{
|
||||||
AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
|
AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
|
||||||
|
}
|
||||||
|
|
||||||
if ((page + 1) * EntryCount < nodes.Length)
|
if ((page + 1) * EntryCount < nodes.Length)
|
||||||
{
|
{
|
||||||
AddButton(x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 3, GumpButtonType.Reply, 1);
|
AddButton(x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 3, GumpButtonType.Reply, 1);
|
||||||
|
|
||||||
if (NextLabel)
|
if (NextLabel)
|
||||||
|
{
|
||||||
AddLabel(x + NextLabelOffsetX, y + NextLabelOffsetY, TextHue, "Next");
|
AddLabel(x + NextLabelOffsetX, y + NextLabelOffsetY, TextHue, "Next");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0, index = page * EntryCount; i < EntryCount && index < nodes.Length; ++i, ++index)
|
for (int i = 0, index = page * EntryCount; i < EntryCount && index < nodes.Length; ++i, ++index)
|
||||||
|
|
@ -192,7 +210,9 @@ namespace Server.Gumps
|
||||||
x += EntryWidth + OffsetSize;
|
x += EntryWidth + OffsetSize;
|
||||||
|
|
||||||
if (SetGumpID != 0)
|
if (SetGumpID != 0)
|
||||||
|
{
|
||||||
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
|
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, i + 4);
|
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, i + 4);
|
||||||
|
|
||||||
|
|
@ -205,17 +225,21 @@ namespace Server.Gumps
|
||||||
if (itemID != 1 && bounds.Height < EntryHeight * 2)
|
if (itemID != 1 && bounds.Height < EntryHeight * 2)
|
||||||
{
|
{
|
||||||
if (bounds.Height < EntryHeight)
|
if (bounds.Height < EntryHeight)
|
||||||
|
{
|
||||||
AddItem(
|
AddItem(
|
||||||
x - OffsetSize - 22 - i % 2 * 44 - bounds.Width / 2 - bounds.X,
|
x - OffsetSize - 22 - i % 2 * 44 - bounds.Width / 2 - bounds.X,
|
||||||
y + EntryHeight / 2 - bounds.Height / 2 - bounds.Y,
|
y + EntryHeight / 2 - bounds.Height / 2 - bounds.Y,
|
||||||
itemID
|
itemID
|
||||||
);
|
);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddItem(
|
AddItem(
|
||||||
x - OffsetSize - 22 - i % 2 * 44 - bounds.Width / 2 - bounds.X,
|
x - OffsetSize - 22 - i % 2 * 44 - bounds.Width / 2 - bounds.X,
|
||||||
y + EntryHeight - 1 - bounds.Height - bounds.Y,
|
y + EntryHeight - 1 - bounds.Height - bounds.Y,
|
||||||
itemID
|
itemID
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -238,7 +262,9 @@ namespace Server.Gumps
|
||||||
var index = Array.IndexOf(m_Category.Parent.Nodes, m_Category) / EntryCount;
|
var index = Array.IndexOf(m_Category.Parent.Nodes, m_Category) / EntryCount;
|
||||||
|
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
|
{
|
||||||
index = 0;
|
index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
from.SendGump(new CategorizedAddGump(from, m_Category.Parent, index));
|
from.SendGump(new CategorizedAddGump(from, m_Category.Parent, index));
|
||||||
}
|
}
|
||||||
|
|
@ -248,14 +274,18 @@ namespace Server.Gumps
|
||||||
case 2: // Previous
|
case 2: // Previous
|
||||||
{
|
{
|
||||||
if (m_Page > 0)
|
if (m_Page > 0)
|
||||||
from.SendGump(new CategorizedAddGump(from, m_Category, m_Page - 1));
|
{
|
||||||
|
@from.SendGump(new CategorizedAddGump(@from, m_Category, m_Page - 1));
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: // Next
|
case 3: // Next
|
||||||
{
|
{
|
||||||
if ((m_Page + 1) * EntryCount < m_Category.Nodes.Length)
|
if ((m_Page + 1) * EntryCount < m_Category.Nodes.Length)
|
||||||
from.SendGump(new CategorizedAddGump(from, m_Category, m_Page + 1));
|
{
|
||||||
|
@from.SendGump(new CategorizedAddGump(@from, m_Category, m_Page + 1));
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -264,7 +294,9 @@ namespace Server.Gumps
|
||||||
var index = m_Page * EntryCount + (info.ButtonID - 4);
|
var index = m_Page * EntryCount + (info.ButtonID - 4);
|
||||||
|
|
||||||
if (index >= 0 && index < m_Category.Nodes.Length)
|
if (index >= 0 && index < m_Category.Nodes.Length)
|
||||||
m_Category.Nodes[index].OnClick(from, m_Page);
|
{
|
||||||
|
m_Category.Nodes[index].OnClick(@from, m_Page);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -56,13 +56,19 @@ namespace Server.Commands
|
||||||
void ProcessDeletion(TeleporterDefinition x)
|
void ProcessDeletion(TeleporterDefinition x)
|
||||||
{
|
{
|
||||||
count += TeleportersCreator.DeleteTeleporters(x.Source);
|
count += TeleportersCreator.DeleteTeleporters(x.Source);
|
||||||
if (x.Back) count += TeleportersCreator.DeleteTeleporters(x.Destination);
|
if (x.Back)
|
||||||
|
{
|
||||||
|
count += TeleportersCreator.DeleteTeleporters(x.Destination);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ProcessTeleporterData(from, ProcessDeletion))
|
if (!ProcessTeleporterData(from, ProcessDeletion))
|
||||||
{
|
{
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
from.SendMessage(WarningHue, $"Partial Completion, {count} Teleporters Removed.");
|
{
|
||||||
|
@from.SendMessage(WarningHue, $"Partial Completion, {count} Teleporters Removed.");
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -81,9 +87,15 @@ namespace Server.Commands
|
||||||
if (!ProcessTeleporterData(from, c.CreateTeleporter))
|
if (!ProcessTeleporterData(from, c.CreateTeleporter))
|
||||||
{
|
{
|
||||||
if (c.DelCount > 0)
|
if (c.DelCount > 0)
|
||||||
from.SendMessage(WarningHue, $"Partial Completion: {c.DelCount} Teleporters Removed.");
|
{
|
||||||
|
@from.SendMessage(WarningHue, $"Partial Completion: {c.DelCount} Teleporters Removed.");
|
||||||
|
}
|
||||||
|
|
||||||
if (c.Count > 0)
|
if (c.Count > 0)
|
||||||
from.SendMessage(WarningHue, $"Partial Completion: {c.Count} Teleporters Added.");
|
{
|
||||||
|
@from.SendMessage(WarningHue, $"Partial Completion: {c.Count} Teleporters Added.");
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,7 +116,9 @@ namespace Server.Commands
|
||||||
|
|
||||||
var teleporters = JsonSerializer.Deserialize<List<TeleporterDefinition>>(json, JsonOptions);
|
var teleporters = JsonSerializer.Deserialize<List<TeleporterDefinition>>(json, JsonOptions);
|
||||||
for (var i = 0; i < teleporters.Count; i++)
|
for (var i = 0; i < teleporters.Count; i++)
|
||||||
|
{
|
||||||
processor(teleporters[i]);
|
processor(teleporters[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
@ -144,7 +158,11 @@ namespace Server.Commands
|
||||||
DelCount += DeleteTeleporters(telDef.Source);
|
DelCount += DeleteTeleporters(telDef.Source);
|
||||||
Count++;
|
Count++;
|
||||||
new Teleporter(telDef.Destination, telDef.Destination.Map).MoveToWorld(telDef.Source, telDef.Source.Map);
|
new Teleporter(telDef.Destination, telDef.Destination.Map).MoveToWorld(telDef.Source, telDef.Source.Map);
|
||||||
if (!telDef.Back) return;
|
if (!telDef.Back)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DelCount += DeleteTeleporters(telDef.Destination);
|
DelCount += DeleteTeleporters(telDef.Destination);
|
||||||
Count++;
|
Count++;
|
||||||
new Teleporter(telDef.Source, telDef.Source.Map).MoveToWorld(telDef.Destination, telDef.Destination.Map);
|
new Teleporter(telDef.Source, telDef.Source.Map).MoveToWorld(telDef.Destination, telDef.Destination.Map);
|
||||||
|
|
|
||||||
|
|
@ -60,9 +60,13 @@ namespace Server.Commands
|
||||||
public static void SetProfiles_OnCommand(CommandEventArgs e)
|
public static void SetProfiles_OnCommand(CommandEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Length == 1)
|
if (e.Length == 1)
|
||||||
|
{
|
||||||
Core.Profiling = e.GetBoolean(0);
|
Core.Profiling = e.GetBoolean(0);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
Core.Profiling = !Core.Profiling;
|
Core.Profiling = !Core.Profiling;
|
||||||
|
}
|
||||||
|
|
||||||
e.Mobile.SendMessage("Profiling has been {0}.", Core.Profiling ? "enabled" : "disabled");
|
e.Mobile.SendMessage("Profiling has been {0}.", Core.Profiling ? "enabled" : "disabled");
|
||||||
}
|
}
|
||||||
|
|
@ -148,29 +152,43 @@ namespace Server.Commands
|
||||||
var flags = item.GetExpandFlags();
|
var flags = item.GetExpandFlags();
|
||||||
|
|
||||||
if ((flags & ~(ExpandFlag.TempFlag | ExpandFlag.SaveFlag)) == 0)
|
if ((flags & ~(ExpandFlag.TempFlag | ExpandFlag.SaveFlag)) == 0)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var itemType = item.GetType();
|
var itemType = item.GetType();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (!typeTable.TryGetValue(itemType, out var countTable))
|
if (!typeTable.TryGetValue(itemType, out var countTable))
|
||||||
|
{
|
||||||
typeTable[itemType] = countTable = new int[9];
|
typeTable[itemType] = countTable = new int[9];
|
||||||
|
}
|
||||||
|
|
||||||
if ((flags & ExpandFlag.Name) != 0)
|
if ((flags & ExpandFlag.Name) != 0)
|
||||||
|
{
|
||||||
++countTable[0];
|
++countTable[0];
|
||||||
|
}
|
||||||
|
|
||||||
if ((flags & ExpandFlag.Items) != 0)
|
if ((flags & ExpandFlag.Items) != 0)
|
||||||
|
{
|
||||||
++countTable[1];
|
++countTable[1];
|
||||||
|
}
|
||||||
|
|
||||||
if ((flags & ExpandFlag.Bounce) != 0)
|
if ((flags & ExpandFlag.Bounce) != 0)
|
||||||
|
{
|
||||||
++countTable[2];
|
++countTable[2];
|
||||||
|
}
|
||||||
|
|
||||||
if ((flags & ExpandFlag.Holder) != 0)
|
if ((flags & ExpandFlag.Holder) != 0)
|
||||||
|
{
|
||||||
++countTable[3];
|
++countTable[3];
|
||||||
|
}
|
||||||
|
|
||||||
if ((flags & ExpandFlag.Blessed) != 0)
|
if ((flags & ExpandFlag.Blessed) != 0)
|
||||||
|
{
|
||||||
++countTable[4];
|
++countTable[4];
|
||||||
|
}
|
||||||
|
|
||||||
/*if (( flags & ExpandFlag.TempFlag ) != 0)
|
/*if (( flags & ExpandFlag.TempFlag ) != 0)
|
||||||
++countTable[5];
|
++countTable[5];
|
||||||
|
|
@ -179,10 +197,14 @@ namespace Server.Commands
|
||||||
++countTable[6];*/
|
++countTable[6];*/
|
||||||
|
|
||||||
if ((flags & ExpandFlag.Weight) != 0)
|
if ((flags & ExpandFlag.Weight) != 0)
|
||||||
|
{
|
||||||
++countTable[7];
|
++countTable[7];
|
||||||
|
}
|
||||||
|
|
||||||
if ((flags & ExpandFlag.Spawner) != 0)
|
if ((flags & ExpandFlag.Spawner) != 0)
|
||||||
|
{
|
||||||
++countTable[8];
|
++countTable[8];
|
||||||
|
}
|
||||||
|
|
||||||
itemType = itemType.BaseType;
|
itemType = itemType.BaseType;
|
||||||
} while (itemType != typeof(object));
|
} while (itemType != typeof(object));
|
||||||
|
|
@ -215,8 +237,12 @@ namespace Server.Commands
|
||||||
op.WriteLine("# {0}", kvp.Key.FullName);
|
op.WriteLine("# {0}", kvp.Key.FullName);
|
||||||
|
|
||||||
for (var i = 0; i < countTable.Length; ++i)
|
for (var i = 0; i < countTable.Length; ++i)
|
||||||
|
{
|
||||||
if (countTable[i] > 0)
|
if (countTable[i] > 0)
|
||||||
|
{
|
||||||
op.WriteLine("{0}\t{1:N0}", names[i], countTable[i]);
|
op.WriteLine("{0}\t{1:N0}", names[i], countTable[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
op.WriteLine();
|
op.WriteLine();
|
||||||
}
|
}
|
||||||
|
|
@ -237,7 +263,9 @@ namespace Server.Commands
|
||||||
foreach (var item in World.Items.Values)
|
foreach (var item in World.Items.Values)
|
||||||
{
|
{
|
||||||
if (item.Parent != null || item.Map != Map.Internal)
|
if (item.Parent != null || item.Map != Map.Internal)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
++totalCount;
|
++totalCount;
|
||||||
|
|
||||||
|
|
@ -295,7 +323,9 @@ namespace Server.Commands
|
||||||
var count = bin.ReadInt32();
|
var count = bin.ReadInt32();
|
||||||
|
|
||||||
for (var i = 0; i < count; ++i)
|
for (var i = 0; i < count; ++i)
|
||||||
|
{
|
||||||
types.Add(AssemblyHandler.FindFirstTypeForName(bin.ReadString()));
|
types.Add(AssemblyHandler.FindFirstTypeForName(bin.ReadString()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long total = 0;
|
long total = 0;
|
||||||
|
|
|
||||||
|
|
@ -58,11 +58,17 @@ namespace Server.Commands
|
||||||
var ent = World.FindEntity(e.GetUInt32(0));
|
var ent = World.FindEntity(e.GetUInt32(0));
|
||||||
|
|
||||||
if (ent == null)
|
if (ent == null)
|
||||||
|
{
|
||||||
e.Mobile.SendMessage("No object with that serial was found.");
|
e.Mobile.SendMessage("No object with that serial was found.");
|
||||||
|
}
|
||||||
else if (!BaseCommand.IsAccessible(e.Mobile, ent))
|
else if (!BaseCommand.IsAccessible(e.Mobile, ent))
|
||||||
|
{
|
||||||
e.Mobile.SendLocalizedMessage(500447); // That is not accessible.
|
e.Mobile.SendLocalizedMessage(500447); // That is not accessible.
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
e.Mobile.SendGump(new PropertiesGump(e.Mobile, ent));
|
e.Mobile.SendGump(new PropertiesGump(e.Mobile, ent));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -77,7 +83,9 @@ namespace Server.Commands
|
||||||
var attrs = p.GetCustomAttributes(typeofCPA, false);
|
var attrs = p.GetCustomAttributes(typeofCPA, false);
|
||||||
|
|
||||||
if (attrs.Length == 0)
|
if (attrs.Length == 0)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return attrs[0] as CPA;
|
return attrs[0] as CPA;
|
||||||
}
|
}
|
||||||
|
|
@ -90,7 +98,9 @@ namespace Server.Commands
|
||||||
var split = propertyString.Split('.');
|
var split = propertyString.Split('.');
|
||||||
|
|
||||||
if (split.Length == 0)
|
if (split.Length == 0)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var info = new PropertyInfo[split.Length];
|
var info = new PropertyInfo[split.Length];
|
||||||
|
|
||||||
|
|
@ -99,7 +109,9 @@ namespace Server.Commands
|
||||||
var propertyName = split[i];
|
var propertyName = split[i];
|
||||||
|
|
||||||
if (CIEqual(propertyName, "current"))
|
if (CIEqual(propertyName, "current"))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var props = type.GetProperties(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public);
|
var props = type.GetProperties(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public);
|
||||||
|
|
||||||
|
|
@ -108,7 +120,9 @@ namespace Server.Commands
|
||||||
var access = endAccess;
|
var access = endAccess;
|
||||||
|
|
||||||
if (!isFinal)
|
if (!isFinal)
|
||||||
|
{
|
||||||
access |= PropertyAccess.Read;
|
access |= PropertyAccess.Read;
|
||||||
|
}
|
||||||
|
|
||||||
for (var j = 0; j < props.Length; ++j)
|
for (var j = 0; j < props.Length; ++j)
|
||||||
{
|
{
|
||||||
|
|
@ -189,7 +203,9 @@ namespace Server.Commands
|
||||||
for (var i = 0; i < chain.Length - 1; ++i)
|
for (var i = 0; i < chain.Length - 1; ++i)
|
||||||
{
|
{
|
||||||
if (chain[i] == null)
|
if (chain[i] == null)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
obj = chain[i].GetValue(obj, null);
|
obj = chain[i].GetValue(obj, null);
|
||||||
|
|
||||||
|
|
@ -210,7 +226,9 @@ namespace Server.Commands
|
||||||
var chain = GetPropertyInfoChain(from, o.GetType(), name, PropertyAccess.Read, ref failReason);
|
var chain = GetPropertyInfoChain(from, o.GetType(), name, PropertyAccess.Read, ref failReason);
|
||||||
|
|
||||||
if (chain == null || chain.Length == 0)
|
if (chain == null || chain.Length == 0)
|
||||||
|
{
|
||||||
return failReason;
|
return failReason;
|
||||||
|
}
|
||||||
|
|
||||||
var p = GetPropertyInfo(ref o, chain, ref failReason);
|
var p = GetPropertyInfo(ref o, chain, ref failReason);
|
||||||
|
|
||||||
|
|
@ -237,9 +255,13 @@ namespace Server.Commands
|
||||||
var valueString = args[1 + i * 2];
|
var valueString = args[1 + i * 2];
|
||||||
|
|
||||||
if (valueString.StartsWith("0x"))
|
if (valueString.StartsWith("0x"))
|
||||||
|
{
|
||||||
realValues[i] = Convert.ToInt32(valueString.Substring(2), 16);
|
realValues[i] = Convert.ToInt32(valueString.Substring(2), 16);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
realValues[i] = Convert.ToInt32(valueString);
|
realValues[i] = Convert.ToInt32(valueString);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
@ -247,21 +269,31 @@ namespace Server.Commands
|
||||||
}
|
}
|
||||||
|
|
||||||
if (realValues[i] > 0)
|
if (realValues[i] > 0)
|
||||||
|
{
|
||||||
positive = true;
|
positive = true;
|
||||||
|
}
|
||||||
else if (realValues[i] < 0)
|
else if (realValues[i] < 0)
|
||||||
|
{
|
||||||
negative = true;
|
negative = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return "Zero is not a valid value to offset.";
|
return "Zero is not a valid value to offset.";
|
||||||
|
}
|
||||||
|
|
||||||
string failReason = null;
|
string failReason = null;
|
||||||
realObjs[i] = o;
|
realObjs[i] = o;
|
||||||
realProps[i] = GetPropertyInfo(from, ref realObjs[i], name, PropertyAccess.ReadWrite, ref failReason);
|
realProps[i] = GetPropertyInfo(from, ref realObjs[i], name, PropertyAccess.ReadWrite, ref failReason);
|
||||||
|
|
||||||
if (failReason != null)
|
if (failReason != null)
|
||||||
|
{
|
||||||
return failReason;
|
return failReason;
|
||||||
|
}
|
||||||
|
|
||||||
if (realProps[i] == null)
|
if (realProps[i] == null)
|
||||||
|
{
|
||||||
return "Property not found.";
|
return "Property not found.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < realProps.Length; ++i)
|
for (var i = 0; i < realProps.Length; ++i)
|
||||||
|
|
@ -269,7 +301,9 @@ namespace Server.Commands
|
||||||
var obj = realProps[i].GetValue(realObjs[i], null);
|
var obj = realProps[i].GetValue(realObjs[i], null);
|
||||||
|
|
||||||
if (!(obj is IConvertible))
|
if (!(obj is IConvertible))
|
||||||
|
{
|
||||||
return "Property is not IConvertable.";
|
return "Property is not IConvertable.";
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -287,16 +321,22 @@ namespace Server.Commands
|
||||||
if (realProps.Length == 1)
|
if (realProps.Length == 1)
|
||||||
{
|
{
|
||||||
if (positive)
|
if (positive)
|
||||||
|
{
|
||||||
return "The property has been increased.";
|
return "The property has been increased.";
|
||||||
|
}
|
||||||
|
|
||||||
return "The property has been decreased.";
|
return "The property has been decreased.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (positive && negative)
|
if (positive && negative)
|
||||||
|
{
|
||||||
return "The properties have been changed.";
|
return "The properties have been changed.";
|
||||||
|
}
|
||||||
|
|
||||||
if (positive)
|
if (positive)
|
||||||
|
{
|
||||||
return "The properties have been increased.";
|
return "The properties have been increased.";
|
||||||
|
}
|
||||||
|
|
||||||
return "The properties have been decreased.";
|
return "The properties have been decreased.";
|
||||||
}
|
}
|
||||||
|
|
@ -309,20 +349,34 @@ namespace Server.Commands
|
||||||
string toString;
|
string toString;
|
||||||
|
|
||||||
if (value == null)
|
if (value == null)
|
||||||
|
{
|
||||||
toString = "null";
|
toString = "null";
|
||||||
|
}
|
||||||
else if (IsNumeric(type))
|
else if (IsNumeric(type))
|
||||||
|
{
|
||||||
toString = $"{value} (0x{value:X})";
|
toString = $"{value} (0x{value:X})";
|
||||||
|
}
|
||||||
else if (IsChar(type))
|
else if (IsChar(type))
|
||||||
|
{
|
||||||
toString = $"'{value}' ({(int)value} [0x{(int)value:X}])";
|
toString = $"'{value}' ({(int)value} [0x{(int)value:X}])";
|
||||||
|
}
|
||||||
else if (IsString(type))
|
else if (IsString(type))
|
||||||
|
{
|
||||||
toString = (string)value == "null" ? @"@""null""" : $"\"{value}\"";
|
toString = (string)value == "null" ? @"@""null""" : $"\"{value}\"";
|
||||||
|
}
|
||||||
else if (IsText(type))
|
else if (IsText(type))
|
||||||
|
{
|
||||||
toString = ((TextDefinition)value).Format(false);
|
toString = ((TextDefinition)value).Format(false);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
toString = value.ToString();
|
toString = value.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
if (chain == null)
|
if (chain == null)
|
||||||
|
{
|
||||||
return $"{p.Name} = {toString}";
|
return $"{p.Name} = {toString}";
|
||||||
|
}
|
||||||
|
|
||||||
var concat = new string[chain.Length * 2 + 1];
|
var concat = new string[chain.Length * 2 + 1];
|
||||||
|
|
||||||
|
|
@ -378,12 +432,17 @@ namespace Server.Commands
|
||||||
var isSerial = IsSerial(type);
|
var isSerial = IsSerial(type);
|
||||||
|
|
||||||
if (isSerial) // mutate into int32
|
if (isSerial) // mutate into int32
|
||||||
|
{
|
||||||
type = m_NumericTypes[4];
|
type = m_NumericTypes[4];
|
||||||
|
}
|
||||||
|
|
||||||
if (value == "(-null-)" && !type.IsValueType)
|
if (value == "(-null-)" && !type.IsValueType)
|
||||||
|
{
|
||||||
value = null;
|
value = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsEnum(type))
|
if (IsEnum(type))
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
toSet = Enum.Parse(type, value ?? "", true);
|
toSet = Enum.Parse(type, value ?? "", true);
|
||||||
|
|
@ -392,19 +451,25 @@ namespace Server.Commands
|
||||||
{
|
{
|
||||||
return "That is not a valid enumeration member.";
|
return "That is not a valid enumeration member.";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (IsType(type))
|
else if (IsType(type))
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
toSet = AssemblyHandler.FindFirstTypeForName(value);
|
toSet = AssemblyHandler.FindFirstTypeForName(value);
|
||||||
|
|
||||||
if (toSet == null)
|
if (toSet == null)
|
||||||
|
{
|
||||||
return "No type with that name was found.";
|
return "No type with that name was found.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return "No type with that name was found.";
|
return "No type with that name was found.";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (IsParsable(type))
|
else if (IsParsable(type))
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
toSet = Parse(obj, type, value);
|
toSet = Parse(obj, type, value);
|
||||||
|
|
@ -413,9 +478,13 @@ namespace Server.Commands
|
||||||
{
|
{
|
||||||
return "That is not properly formatted.";
|
return "That is not properly formatted.";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (value == null)
|
else if (value == null)
|
||||||
|
{
|
||||||
toSet = null;
|
toSet = null;
|
||||||
|
}
|
||||||
else if (value.StartsWith("0x") && IsNumeric(type))
|
else if (value.StartsWith("0x") && IsNumeric(type))
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
toSet = Convert.ChangeType(Convert.ToUInt64(value.Substring(2), 16), type);
|
toSet = Convert.ChangeType(Convert.ToUInt64(value.Substring(2), 16), type);
|
||||||
|
|
@ -424,7 +493,9 @@ namespace Server.Commands
|
||||||
{
|
{
|
||||||
return "That is not properly formatted.";
|
return "That is not properly formatted.";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
toSet = Convert.ChangeType(value, type);
|
toSet = Convert.ChangeType(value, type);
|
||||||
|
|
@ -433,9 +504,12 @@ namespace Server.Commands
|
||||||
{
|
{
|
||||||
return "That is not properly formatted.";
|
return "That is not properly formatted.";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isSerial) // mutate back
|
if (isSerial) // mutate back
|
||||||
|
{
|
||||||
toSet = (Serial)(toSet ?? Serial.MinusOne);
|
toSet = (Serial)(toSet ?? Serial.MinusOne);
|
||||||
|
}
|
||||||
|
|
||||||
constructed = toSet;
|
constructed = toSet;
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -453,21 +527,29 @@ namespace Server.Commands
|
||||||
var reqLevel = AccessLevel.Administrator;
|
var reqLevel = AccessLevel.Administrator;
|
||||||
|
|
||||||
if (newLevel == AccessLevel.Administrator)
|
if (newLevel == AccessLevel.Administrator)
|
||||||
|
{
|
||||||
reqLevel = AccessLevel.Developer;
|
reqLevel = AccessLevel.Developer;
|
||||||
|
}
|
||||||
else if (newLevel >= AccessLevel.Developer)
|
else if (newLevel >= AccessLevel.Developer)
|
||||||
|
{
|
||||||
reqLevel = AccessLevel.Owner;
|
reqLevel = AccessLevel.Owner;
|
||||||
|
}
|
||||||
|
|
||||||
if (from.AccessLevel < reqLevel)
|
if (from.AccessLevel < reqLevel)
|
||||||
|
{
|
||||||
return "You do not have access to that level.";
|
return "You do not have access to that level.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldLog)
|
if (shouldLog)
|
||||||
|
{
|
||||||
CommandLogging.LogChangeProperty(
|
CommandLogging.LogChangeProperty(
|
||||||
from,
|
@from,
|
||||||
logObject,
|
logObject,
|
||||||
givenName,
|
givenName,
|
||||||
toSet?.ToString() ?? "(-null-)"
|
toSet?.ToString() ?? "(-null-)"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
prop.SetValue(obj, toSet, null);
|
prop.SetValue(obj, toSet, null);
|
||||||
return "Property has been set.";
|
return "Property has been set.";
|
||||||
|
|
@ -482,7 +564,10 @@ namespace Server.Commands
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (toSet is AccessLevel) return "You do not have access to that level.";
|
if (toSet is AccessLevel)
|
||||||
|
{
|
||||||
|
return "You do not have access to that level.";
|
||||||
|
}
|
||||||
|
|
||||||
prop.SetValue(obj, toSet, null);
|
prop.SetValue(obj, toSet, null);
|
||||||
return "Property has been set.";
|
return "Property has been set.";
|
||||||
|
|
@ -521,9 +606,13 @@ namespace Server.Commands
|
||||||
protected override void OnTarget(Mobile from, object o)
|
protected override void OnTarget(Mobile from, object o)
|
||||||
{
|
{
|
||||||
if (!BaseCommand.IsAccessible(from, o))
|
if (!BaseCommand.IsAccessible(from, o))
|
||||||
from.SendLocalizedMessage(500447); // That is not accessible.
|
{
|
||||||
|
@from.SendLocalizedMessage(500447); // That is not accessible.
|
||||||
|
}
|
||||||
else
|
else
|
||||||
from.SendGump(new PropertiesGump(from, o));
|
{
|
||||||
|
@from.SendGump(new PropertiesGump(@from, o));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -655,7 +744,9 @@ namespace Server
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!IsBound)
|
if (!IsBound)
|
||||||
|
{
|
||||||
throw new NotYetBoundException(this);
|
throw new NotYetBoundException(this);
|
||||||
|
}
|
||||||
|
|
||||||
return m_Chain;
|
return m_Chain;
|
||||||
}
|
}
|
||||||
|
|
@ -666,7 +757,9 @@ namespace Server
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!IsBound)
|
if (!IsBound)
|
||||||
|
{
|
||||||
throw new NotYetBoundException(this);
|
throw new NotYetBoundException(this);
|
||||||
|
}
|
||||||
|
|
||||||
return m_Chain[^1].PropertyType;
|
return m_Chain[^1].PropertyType;
|
||||||
}
|
}
|
||||||
|
|
@ -675,7 +768,9 @@ namespace Server
|
||||||
public bool CheckAccess(Mobile from)
|
public bool CheckAccess(Mobile from)
|
||||||
{
|
{
|
||||||
if (!IsBound)
|
if (!IsBound)
|
||||||
|
{
|
||||||
throw new NotYetBoundException(this);
|
throw new NotYetBoundException(this);
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < m_Chain.Length; ++i)
|
for (var i = 0; i < m_Chain.Length; ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -686,18 +781,26 @@ namespace Server
|
||||||
var access = Access;
|
var access = Access;
|
||||||
|
|
||||||
if (!isFinal)
|
if (!isFinal)
|
||||||
|
{
|
||||||
access |= PropertyAccess.Read;
|
access |= PropertyAccess.Read;
|
||||||
|
}
|
||||||
|
|
||||||
var security = Properties.GetCPA(prop);
|
var security = Properties.GetCPA(prop);
|
||||||
|
|
||||||
if (security == null)
|
if (security == null)
|
||||||
|
{
|
||||||
throw new InternalAccessException(this);
|
throw new InternalAccessException(this);
|
||||||
|
}
|
||||||
|
|
||||||
if ((access & PropertyAccess.Read) != 0 && from.AccessLevel < security.ReadLevel)
|
if ((access & PropertyAccess.Read) != 0 && from.AccessLevel < security.ReadLevel)
|
||||||
throw new ReadAccessException(this, from.AccessLevel, security.ReadLevel);
|
{
|
||||||
|
throw new ReadAccessException(this, @from.AccessLevel, security.ReadLevel);
|
||||||
|
}
|
||||||
|
|
||||||
if ((access & PropertyAccess.Write) != 0 && (from.AccessLevel < security.WriteLevel || security.ReadOnly))
|
if ((access & PropertyAccess.Write) != 0 && (from.AccessLevel < security.WriteLevel || security.ReadOnly))
|
||||||
throw new WriteAccessException(this, from.AccessLevel, security.ReadLevel);
|
{
|
||||||
|
throw new WriteAccessException(this, @from.AccessLevel, security.ReadLevel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -706,7 +809,9 @@ namespace Server
|
||||||
public void BindTo(Type objectType, PropertyAccess desiredAccess)
|
public void BindTo(Type objectType, PropertyAccess desiredAccess)
|
||||||
{
|
{
|
||||||
if (IsBound)
|
if (IsBound)
|
||||||
|
{
|
||||||
throw new AlreadyBoundException(this);
|
throw new AlreadyBoundException(this);
|
||||||
|
}
|
||||||
|
|
||||||
var split = Binding.Split('.');
|
var split = Binding.Split('.');
|
||||||
|
|
||||||
|
|
@ -722,20 +827,28 @@ namespace Server
|
||||||
);
|
);
|
||||||
|
|
||||||
if (chain[i] == null)
|
if (chain[i] == null)
|
||||||
|
{
|
||||||
throw new UnknownPropertyException(this, split[i]);
|
throw new UnknownPropertyException(this, split[i]);
|
||||||
|
}
|
||||||
|
|
||||||
objectType = chain[i].PropertyType;
|
objectType = chain[i].PropertyType;
|
||||||
|
|
||||||
var access = desiredAccess;
|
var access = desiredAccess;
|
||||||
|
|
||||||
if (!isFinal)
|
if (!isFinal)
|
||||||
|
{
|
||||||
access |= PropertyAccess.Read;
|
access |= PropertyAccess.Read;
|
||||||
|
}
|
||||||
|
|
||||||
if ((access & PropertyAccess.Read) != 0 && !chain[i].CanRead)
|
if ((access & PropertyAccess.Read) != 0 && !chain[i].CanRead)
|
||||||
|
{
|
||||||
throw new WriteOnlyException(this);
|
throw new WriteOnlyException(this);
|
||||||
|
}
|
||||||
|
|
||||||
if ((access & PropertyAccess.Write) != 0 && !chain[i].CanWrite)
|
if ((access & PropertyAccess.Write) != 0 && !chain[i].CanWrite)
|
||||||
|
{
|
||||||
throw new ReadOnlyException(this);
|
throw new ReadOnlyException(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Access = desiredAccess;
|
Access = desiredAccess;
|
||||||
|
|
@ -745,12 +858,16 @@ namespace Server
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
if (!IsBound)
|
if (!IsBound)
|
||||||
|
{
|
||||||
return Binding;
|
return Binding;
|
||||||
|
}
|
||||||
|
|
||||||
var toJoin = new string[m_Chain.Length];
|
var toJoin = new string[m_Chain.Length];
|
||||||
|
|
||||||
for (var i = 0; i < toJoin.Length; ++i)
|
for (var i = 0; i < toJoin.Length; ++i)
|
||||||
|
{
|
||||||
toJoin[i] = m_Chain[i].Name;
|
toJoin[i] = m_Chain[i].Name;
|
||||||
|
}
|
||||||
|
|
||||||
return string.Join(".", toJoin);
|
return string.Join(".", toJoin);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,9 @@ namespace Server.Commands
|
||||||
};
|
};
|
||||||
|
|
||||||
for (var j = 0; maps?.Length > j; ++j)
|
for (var j = 0; maps?.Length > j; ++j)
|
||||||
|
{
|
||||||
Add_Static(e.m_ItemID, e.m_Location, maps[j], e.m_Text);
|
Add_Static(e.m_ItemID, e.m_Location, maps[j], e.m_Text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
from.SendMessage("Sign generating complete.");
|
from.SendMessage("Sign generating complete.");
|
||||||
|
|
@ -90,13 +92,19 @@ namespace Server.Commands
|
||||||
var eable = map.GetItemsInRange(location, 0);
|
var eable = map.GetItemsInRange(location, 0);
|
||||||
|
|
||||||
foreach (var item in eable)
|
foreach (var item in eable)
|
||||||
|
{
|
||||||
if (item is Sign && item.Z == location.Z && item.ItemID == itemID)
|
if (item is Sign && item.Z == location.Z && item.ItemID == itemID)
|
||||||
|
{
|
||||||
m_ToDelete.Enqueue(item);
|
m_ToDelete.Enqueue(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
eable.Free();
|
eable.Free();
|
||||||
|
|
||||||
while (m_ToDelete.Count > 0)
|
while (m_ToDelete.Count > 0)
|
||||||
|
{
|
||||||
m_ToDelete.Dequeue().Delete();
|
m_ToDelete.Dequeue().Delete();
|
||||||
|
}
|
||||||
|
|
||||||
Item sign;
|
Item sign;
|
||||||
|
|
||||||
|
|
@ -113,9 +121,13 @@ namespace Server.Commands
|
||||||
if (map == Map.Malas)
|
if (map == Map.Malas)
|
||||||
{
|
{
|
||||||
if (location.X >= 965 && location.Y >= 502 && location.X <= 1012 && location.Y <= 537)
|
if (location.X >= 965 && location.Y >= 502 && location.X <= 1012 && location.Y <= 537)
|
||||||
|
{
|
||||||
sign.Hue = 0x47E;
|
sign.Hue = 0x47E;
|
||||||
|
}
|
||||||
else if (location.X >= 1960 && location.Y >= 1278 && location.X < 2106 && location.Y < 1413)
|
else if (location.X >= 1960 && location.Y >= 1278 && location.X < 2106 && location.Y < 1413)
|
||||||
|
{
|
||||||
sign.Hue = 0x44E;
|
sign.Hue = 0x44E;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sign.MoveToWorld(location, map);
|
sign.MoveToWorld(location, map);
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,13 @@ namespace Server.Commands
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Enum.TryParse(arg.GetString(0), true, out SkillName skill))
|
if (Enum.TryParse(arg.GetString(0), true, out SkillName skill))
|
||||||
|
{
|
||||||
arg.Mobile.Target = new SkillTarget(skill, arg.GetDouble(1));
|
arg.Mobile.Target = new SkillTarget(skill, arg.GetDouble(1));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
arg.Mobile.SendLocalizedMessage(1005631); // You have specified an invalid skill to set.
|
arg.Mobile.SendLocalizedMessage(1005631); // You have specified an invalid skill to set.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -34,9 +38,13 @@ namespace Server.Commands
|
||||||
public static void SetAllSkills_OnCommand(CommandEventArgs arg)
|
public static void SetAllSkills_OnCommand(CommandEventArgs arg)
|
||||||
{
|
{
|
||||||
if (arg.Length != 1)
|
if (arg.Length != 1)
|
||||||
|
{
|
||||||
arg.Mobile.SendMessage("SetAllSkills <value>");
|
arg.Mobile.SendMessage("SetAllSkills <value>");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
arg.Mobile.Target = new AllSkillsTarget(arg.GetDouble(0));
|
arg.Mobile.Target = new AllSkillsTarget(arg.GetDouble(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Usage("GetSkill <name>")]
|
[Usage("GetSkill <name>")]
|
||||||
|
|
@ -50,9 +58,13 @@ namespace Server.Commands
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Enum.TryParse(arg.GetString(0), true, out SkillName skill))
|
if (Enum.TryParse(arg.GetString(0), true, out SkillName skill))
|
||||||
|
{
|
||||||
arg.Mobile.Target = new SkillTarget(skill);
|
arg.Mobile.Target = new SkillTarget(skill);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
arg.Mobile.SendMessage("You have specified an invalid skill to get.");
|
arg.Mobile.SendMessage("You have specified an invalid skill to get.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,7 +81,9 @@ namespace Server.Commands
|
||||||
var skills = targ.Skills;
|
var skills = targ.Skills;
|
||||||
|
|
||||||
for (var i = 0; i < skills.Length; ++i)
|
for (var i = 0; i < skills.Length; ++i)
|
||||||
|
{
|
||||||
skills[i].Base = m_Value;
|
skills[i].Base = m_Value;
|
||||||
|
}
|
||||||
|
|
||||||
CommandLogging.LogChangeProperty(from, targ, "EverySkill.Base", m_Value.ToString());
|
CommandLogging.LogChangeProperty(from, targ, "EverySkill.Base", m_Value.ToString());
|
||||||
}
|
}
|
||||||
|
|
@ -106,7 +120,9 @@ namespace Server.Commands
|
||||||
var skill = targ.Skills[m_Skill];
|
var skill = targ.Skills[m_Skill];
|
||||||
|
|
||||||
if (skill == null)
|
if (skill == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Set)
|
if (m_Set)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,9 @@ namespace Server.Commands
|
||||||
protected override void OnTarget(Mobile from, object o)
|
protected override void OnTarget(Mobile from, object o)
|
||||||
{
|
{
|
||||||
if (o is Mobile mobile)
|
if (o is Mobile mobile)
|
||||||
from.SendGump(new SkillsGump(from, mobile));
|
{
|
||||||
|
@from.SendGump(new SkillsGump(@from, mobile));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,9 @@ namespace Server
|
||||||
var map = from.Map;
|
var map = from.Map;
|
||||||
|
|
||||||
if (map != null && map != Map.Internal)
|
if (map != null && map != Map.Internal)
|
||||||
|
{
|
||||||
SendWarning(
|
SendWarning(
|
||||||
from,
|
@from,
|
||||||
"You are about to freeze <u>all items in {0}</u>.",
|
"You are about to freeze <u>all items in {0}</u>.",
|
||||||
BaseFreezeWarning,
|
BaseFreezeWarning,
|
||||||
map,
|
map,
|
||||||
|
|
@ -72,6 +73,7 @@ namespace Server
|
||||||
NullP3D,
|
NullP3D,
|
||||||
FreezeWarning_Callback
|
FreezeWarning_Callback
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Usage("FreezeWorld")]
|
[Usage("FreezeWorld")]
|
||||||
|
|
@ -123,7 +125,9 @@ namespace Server
|
||||||
private static void FreezeWarning_Callback(Mobile from, bool okay, StateInfo si)
|
private static void FreezeWarning_Callback(Mobile from, bool okay, StateInfo si)
|
||||||
{
|
{
|
||||||
if (!okay)
|
if (!okay)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Freeze(from, si.m_Map, si.m_Start, si.m_End);
|
Freeze(from, si.m_Map, si.m_Start, si.m_End);
|
||||||
}
|
}
|
||||||
|
|
@ -135,43 +139,57 @@ namespace Server
|
||||||
if (start3d == NullP3D && end3d == NullP3D)
|
if (start3d == NullP3D && end3d == NullP3D)
|
||||||
{
|
{
|
||||||
if (targetMap == null)
|
if (targetMap == null)
|
||||||
|
{
|
||||||
CommandLogging.WriteLine(
|
CommandLogging.WriteLine(
|
||||||
from,
|
@from,
|
||||||
"{0} {1} invoking freeze for every item in every map",
|
"{0} {1} invoking freeze for every item in every map",
|
||||||
from.AccessLevel,
|
@from.AccessLevel,
|
||||||
CommandLogging.Format(from)
|
CommandLogging.Format(@from)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
CommandLogging.WriteLine(
|
CommandLogging.WriteLine(
|
||||||
from,
|
@from,
|
||||||
"{0} {1} invoking freeze for every item in {0}",
|
"{0} {1} invoking freeze for every item in {0}",
|
||||||
from.AccessLevel,
|
@from.AccessLevel,
|
||||||
CommandLogging.Format(from),
|
CommandLogging.Format(@from),
|
||||||
targetMap
|
targetMap
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var item in World.Items.Values)
|
foreach (var item in World.Items.Values)
|
||||||
{
|
{
|
||||||
if (targetMap != null && item.Map != targetMap)
|
if (targetMap != null && item.Map != targetMap)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (item.Parent != null)
|
if (item.Parent != null)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (item is Static || item is BaseFloor || item is BaseWall)
|
if (item is Static || item is BaseFloor || item is BaseWall)
|
||||||
{
|
{
|
||||||
var itemMap = item.Map;
|
var itemMap = item.Map;
|
||||||
|
|
||||||
if (itemMap == null || itemMap == Map.Internal)
|
if (itemMap == null || itemMap == Map.Internal)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!mapTable.TryGetValue(itemMap, out var table))
|
if (!mapTable.TryGetValue(itemMap, out var table))
|
||||||
|
{
|
||||||
mapTable[itemMap] = table = new Dictionary<Point2D, DeltaState>();
|
mapTable[itemMap] = table = new Dictionary<Point2D, DeltaState>();
|
||||||
|
}
|
||||||
|
|
||||||
var p = new Point2D(item.X >> 3, item.Y >> 3);
|
var p = new Point2D(item.X >> 3, item.Y >> 3);
|
||||||
|
|
||||||
if (!table.TryGetValue(p, out var state))
|
if (!table.TryGetValue(p, out var state))
|
||||||
|
{
|
||||||
table[p] = state = new DeltaState(p);
|
table[p] = state = new DeltaState(p);
|
||||||
|
}
|
||||||
|
|
||||||
state.m_List.Add(item);
|
state.m_List.Add(item);
|
||||||
}
|
}
|
||||||
|
|
@ -195,23 +213,31 @@ namespace Server
|
||||||
targetMap.GetItemsInBounds(new Rectangle2D(start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1));
|
targetMap.GetItemsInBounds(new Rectangle2D(start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1));
|
||||||
|
|
||||||
foreach (var item in eable)
|
foreach (var item in eable)
|
||||||
|
{
|
||||||
if (item is Static || item is BaseFloor || item is BaseWall)
|
if (item is Static || item is BaseFloor || item is BaseWall)
|
||||||
{
|
{
|
||||||
var itemMap = item.Map;
|
var itemMap = item.Map;
|
||||||
|
|
||||||
if (itemMap == null || itemMap == Map.Internal)
|
if (itemMap == null || itemMap == Map.Internal)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!mapTable.TryGetValue(itemMap, out var table))
|
if (!mapTable.TryGetValue(itemMap, out var table))
|
||||||
|
{
|
||||||
mapTable[itemMap] = table = new Dictionary<Point2D, DeltaState>();
|
mapTable[itemMap] = table = new Dictionary<Point2D, DeltaState>();
|
||||||
|
}
|
||||||
|
|
||||||
var p = new Point2D(item.X >> 3, item.Y >> 3);
|
var p = new Point2D(item.X >> 3, item.Y >> 3);
|
||||||
|
|
||||||
if (!table.TryGetValue(p, out var state))
|
if (!table.TryGetValue(p, out var state))
|
||||||
|
{
|
||||||
table[p] = state = new DeltaState(p);
|
table[p] = state = new DeltaState(p);
|
||||||
|
}
|
||||||
|
|
||||||
state.m_List.Add(item);
|
state.m_List.Add(item);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
eable.Free();
|
eable.Free();
|
||||||
}
|
}
|
||||||
|
|
@ -268,7 +294,9 @@ namespace Server
|
||||||
);
|
);
|
||||||
|
|
||||||
if (oldTileCount < 0)
|
if (oldTileCount < 0)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var newTileCount = 0;
|
var newTileCount = 0;
|
||||||
var newTiles = new StaticTile[state.m_List.Count];
|
var newTiles = new StaticTile[state.m_List.Count];
|
||||||
|
|
@ -281,7 +309,9 @@ namespace Server
|
||||||
var yOffset = item.Y - state.m_Y * 8;
|
var yOffset = item.Y - state.m_Y * 8;
|
||||||
|
|
||||||
if (xOffset < 0 || xOffset >= 8 || yOffset < 0 || yOffset >= 8)
|
if (xOffset < 0 || xOffset >= 8 || yOffset < 0 || yOffset >= 8)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var newTile = new StaticTile(
|
var newTile = new StaticTile(
|
||||||
(ushort)item.ItemID,
|
(ushort)item.ItemID,
|
||||||
|
|
@ -349,7 +379,8 @@ namespace Server
|
||||||
}
|
}
|
||||||
|
|
||||||
if (totalFrozen == 0 && badDataFile)
|
if (totalFrozen == 0 && badDataFile)
|
||||||
from.SendGump(
|
{
|
||||||
|
@from.SendGump(
|
||||||
new NoticeGump(
|
new NoticeGump(
|
||||||
1060637,
|
1060637,
|
||||||
30720,
|
30720,
|
||||||
|
|
@ -359,8 +390,10 @@ namespace Server
|
||||||
240
|
240
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
from.SendGump(
|
{
|
||||||
|
@from.SendGump(
|
||||||
new NoticeGump(
|
new NoticeGump(
|
||||||
1060637,
|
1060637,
|
||||||
30720,
|
30720,
|
||||||
|
|
@ -370,6 +403,7 @@ namespace Server
|
||||||
240
|
240
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Usage("Unfreeze")]
|
[Usage("Unfreeze")]
|
||||||
|
|
@ -387,6 +421,7 @@ namespace Server
|
||||||
var map = e.Mobile.Map;
|
var map = e.Mobile.Map;
|
||||||
|
|
||||||
if (map != null && map != Map.Internal)
|
if (map != null && map != Map.Internal)
|
||||||
|
{
|
||||||
SendWarning(
|
SendWarning(
|
||||||
e.Mobile,
|
e.Mobile,
|
||||||
"You are about to unfreeze <u>all items in {0}</u>.",
|
"You are about to unfreeze <u>all items in {0}</u>.",
|
||||||
|
|
@ -396,6 +431,7 @@ namespace Server
|
||||||
NullP3D,
|
NullP3D,
|
||||||
UnfreezeWarning_Callback
|
UnfreezeWarning_Callback
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Usage("UnfreezeWorld")]
|
[Usage("UnfreezeWorld")]
|
||||||
|
|
@ -429,7 +465,9 @@ namespace Server
|
||||||
private static void UnfreezeWarning_Callback(Mobile from, bool okay, StateInfo si)
|
private static void UnfreezeWarning_Callback(Mobile from, bool okay, StateInfo si)
|
||||||
{
|
{
|
||||||
if (!okay)
|
if (!okay)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Unfreeze(from, si.m_Map, si.m_Start, si.m_End);
|
Unfreeze(from, si.m_Map, si.m_Start, si.m_End);
|
||||||
}
|
}
|
||||||
|
|
@ -463,6 +501,7 @@ namespace Server
|
||||||
var mulWriter = new BinaryWriter(mulStream);
|
var mulWriter = new BinaryWriter(mulStream);
|
||||||
|
|
||||||
for (var x = xStartBlock; x <= xEndBlock; ++x)
|
for (var x = xStartBlock; x <= xEndBlock; ++x)
|
||||||
|
{
|
||||||
for (var y = yStartBlock; y <= yEndBlock; ++y)
|
for (var y = yStartBlock; y <= yEndBlock; ++y)
|
||||||
{
|
{
|
||||||
var oldTiles = ReadStaticBlock(
|
var oldTiles = ReadStaticBlock(
|
||||||
|
|
@ -476,7 +515,9 @@ namespace Server
|
||||||
);
|
);
|
||||||
|
|
||||||
if (oldTileCount < 0)
|
if (oldTileCount < 0)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var newTileCount = 0;
|
var newTileCount = 0;
|
||||||
var newTiles = new StaticTile[oldTileCount];
|
var newTiles = new StaticTile[oldTileCount];
|
||||||
|
|
@ -543,6 +584,7 @@ namespace Server
|
||||||
|
|
||||||
matrix.SetStaticBlock(x, y, null);
|
matrix.SetStaticBlock(x, y, null);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DoUnfreeze(Map map, ref bool badDataFile, ref int totalUnfrozen)
|
public static void DoUnfreeze(Map map, ref bool badDataFile, ref int totalUnfrozen)
|
||||||
|
|
@ -598,7 +640,8 @@ namespace Server
|
||||||
}
|
}
|
||||||
|
|
||||||
if (totalUnfrozen == 0 && badDataFile)
|
if (totalUnfrozen == 0 && badDataFile)
|
||||||
from.SendGump(
|
{
|
||||||
|
@from.SendGump(
|
||||||
new NoticeGump(
|
new NoticeGump(
|
||||||
1060637,
|
1060637,
|
||||||
30720,
|
30720,
|
||||||
|
|
@ -608,8 +651,10 @@ namespace Server
|
||||||
240
|
240
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
from.SendGump(
|
{
|
||||||
|
@from.SendGump(
|
||||||
new NoticeGump(
|
new NoticeGump(
|
||||||
1060637,
|
1060637,
|
||||||
30720,
|
30720,
|
||||||
|
|
@ -619,12 +664,15 @@ namespace Server
|
||||||
240
|
240
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static FileStream OpenWrite(FileStream orig)
|
private static FileStream OpenWrite(FileStream orig)
|
||||||
{
|
{
|
||||||
if (orig == null)
|
if (orig == null)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -665,18 +713,23 @@ namespace Server
|
||||||
mulStream.Seek(lookup, SeekOrigin.Begin);
|
mulStream.Seek(lookup, SeekOrigin.Begin);
|
||||||
|
|
||||||
if (m_TileBuffer.Length < count)
|
if (m_TileBuffer.Length < count)
|
||||||
|
{
|
||||||
m_TileBuffer = new StaticTile[count];
|
m_TileBuffer = new StaticTile[count];
|
||||||
|
}
|
||||||
|
|
||||||
var staTiles = m_TileBuffer;
|
var staTiles = m_TileBuffer;
|
||||||
|
|
||||||
if (m_Buffer == null || length > m_Buffer.Length)
|
if (m_Buffer == null || length > m_Buffer.Length)
|
||||||
|
{
|
||||||
m_Buffer = new byte[length];
|
m_Buffer = new byte[length];
|
||||||
|
}
|
||||||
|
|
||||||
mulStream.Read(m_Buffer, 0, length);
|
mulStream.Read(m_Buffer, 0, length);
|
||||||
|
|
||||||
var index = 0;
|
var index = 0;
|
||||||
|
|
||||||
for (var i = 0; i < count; ++i)
|
for (var i = 0; i < count; ++i)
|
||||||
|
{
|
||||||
staTiles[i]
|
staTiles[i]
|
||||||
.Set(
|
.Set(
|
||||||
(ushort)(m_Buffer[index++] | (m_Buffer[index++] << 8)),
|
(ushort)(m_Buffer[index++] | (m_Buffer[index++] << 8)),
|
||||||
|
|
@ -685,6 +738,7 @@ namespace Server
|
||||||
(sbyte)m_Buffer[index++],
|
(sbyte)m_Buffer[index++],
|
||||||
(short)(m_Buffer[index++] | (m_Buffer[index++] << 8))
|
(short)(m_Buffer[index++] | (m_Buffer[index++] << 8))
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,9 @@ namespace Server.Commands
|
||||||
pm.SendMessage("You are visible to {0} mobile{1}:", list.Count, list.Count == 1 ? "" : "s");
|
pm.SendMessage("You are visible to {0} mobile{1}:", list.Count, list.Count == 1 ? "" : "s");
|
||||||
|
|
||||||
for (var i = 0; i < list.Count; ++i)
|
for (var i = 0; i < list.Count; ++i)
|
||||||
|
{
|
||||||
pm.SendMessage("#{0}: {1}", i + 1, list[i].Name);
|
pm.SendMessage("#{0}: {1}", i + 1, list[i].Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -72,7 +74,9 @@ namespace Server.Commands
|
||||||
var m = list[i];
|
var m = list[i];
|
||||||
|
|
||||||
if (!m.CanSee(pm) && Utility.InUpdateRange(m, pm))
|
if (!m.CanSee(pm) && Utility.InUpdateRange(m, pm))
|
||||||
|
{
|
||||||
m.Send(pm.RemovePacket);
|
m.Send(pm.RemovePacket);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -117,7 +121,9 @@ namespace Server.Commands
|
||||||
ns.Send(pm.OPLPacket);
|
ns.Send(pm.OPLPacket);
|
||||||
|
|
||||||
foreach (var item in pm.Items)
|
foreach (var item in pm.Items)
|
||||||
|
{
|
||||||
ns.Send(item.OPLPacket);
|
ns.Send(item.OPLPacket);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -81,22 +81,34 @@ namespace Server.Commands
|
||||||
IPooledEnumerable<IEntity> eable;
|
IPooledEnumerable<IEntity> eable;
|
||||||
|
|
||||||
if (!items && !multis || !mobiles)
|
if (!items && !multis || !mobiles)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
eable = map.GetObjectsInBounds(rect);
|
eable = map.GetObjectsInBounds(rect);
|
||||||
|
|
||||||
foreach (var obj in eable)
|
foreach (var obj in eable)
|
||||||
|
{
|
||||||
if (items && obj is Item && !(obj is BaseMulti || obj is HouseSign))
|
if (items && obj is Item && !(obj is BaseMulti || obj is HouseSign))
|
||||||
|
{
|
||||||
toDelete.Add(obj);
|
toDelete.Add(obj);
|
||||||
|
}
|
||||||
else if (multis && obj is BaseMulti)
|
else if (multis && obj is BaseMulti)
|
||||||
|
{
|
||||||
toDelete.Add(obj);
|
toDelete.Add(obj);
|
||||||
|
}
|
||||||
else if (obj is Mobile mobile && !mobile.Player)
|
else if (obj is Mobile mobile && !mobile.Player)
|
||||||
|
{
|
||||||
toDelete.Add(mobile);
|
toDelete.Add(mobile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
eable.Free();
|
eable.Free();
|
||||||
|
|
||||||
for (var i = 0; i < toDelete.Count; ++i)
|
for (var i = 0; i < toDelete.Count; ++i)
|
||||||
|
{
|
||||||
toDelete[i].Delete();
|
toDelete[i].Delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,10 @@ namespace Server
|
||||||
AOS.DisableStatInfluences();
|
AOS.DisableStatInfluences();
|
||||||
|
|
||||||
if (ObjectPropertyList.Enabled)
|
if (ObjectPropertyList.Enabled)
|
||||||
|
{
|
||||||
PacketHandlers.SingleClickProps =
|
PacketHandlers.SingleClickProps =
|
||||||
true; // single click for everything is overridden to check object property list
|
true; // single click for everything is overridden to check object property list
|
||||||
|
}
|
||||||
|
|
||||||
Mobile.AOSStatusHandler = AOS.GetStatus;
|
Mobile.AOSStatusHandler = AOS.GetStatus;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,19 +19,33 @@ namespace Server.ContextMenus
|
||||||
var mp = Party.Get(m_Target);
|
var mp = Party.Get(m_Target);
|
||||||
|
|
||||||
if (m_From == m_Target)
|
if (m_From == m_Target)
|
||||||
|
{
|
||||||
m_From.SendLocalizedMessage(1005439); // You cannot add yourself to a party.
|
m_From.SendLocalizedMessage(1005439); // You cannot add yourself to a party.
|
||||||
|
}
|
||||||
else if (p != null && p.Leader != m_From)
|
else if (p != null && p.Leader != m_From)
|
||||||
|
{
|
||||||
m_From.SendLocalizedMessage(1005453); // You may only add members to the party if you are the leader.
|
m_From.SendLocalizedMessage(1005453); // You may only add members to the party if you are the leader.
|
||||||
|
}
|
||||||
else if (p != null && p.Members.Count + p.Candidates.Count >= Party.Capacity)
|
else if (p != null && p.Members.Count + p.Candidates.Count >= Party.Capacity)
|
||||||
|
{
|
||||||
m_From.SendLocalizedMessage(1008095); // You may only have 10 in your party (this includes candidates).
|
m_From.SendLocalizedMessage(1008095); // You may only have 10 in your party (this includes candidates).
|
||||||
|
}
|
||||||
else if (!m_Target.Player)
|
else if (!m_Target.Player)
|
||||||
|
{
|
||||||
m_From.SendLocalizedMessage(1005444); // The creature ignores your offer.
|
m_From.SendLocalizedMessage(1005444); // The creature ignores your offer.
|
||||||
|
}
|
||||||
else if (mp != null && mp == p)
|
else if (mp != null && mp == p)
|
||||||
|
{
|
||||||
m_From.SendLocalizedMessage(1005440); // This person is already in your party!
|
m_From.SendLocalizedMessage(1005440); // This person is already in your party!
|
||||||
|
}
|
||||||
else if (mp != null)
|
else if (mp != null)
|
||||||
|
{
|
||||||
m_From.SendLocalizedMessage(1005441); // This person is already in a party!
|
m_From.SendLocalizedMessage(1005441); // This person is already in a party!
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
Party.Invite(m_From, m_Target);
|
Party.Invite(m_From, m_Target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,9 @@ namespace Server.ContextMenus
|
||||||
public override void OnClick()
|
public override void OnClick()
|
||||||
{
|
{
|
||||||
if (Owner.From.CheckAlive() && Owner.Target is SpellScroll scroll)
|
if (Owner.From.CheckAlive() && Owner.Target is SpellScroll scroll)
|
||||||
|
{
|
||||||
Owner.From.Target = new InternalTarget(scroll);
|
Owner.From.Target = new InternalTarget(scroll);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class InternalTarget : Target
|
private class InternalTarget : Target
|
||||||
|
|
@ -25,8 +27,9 @@ namespace Server.ContextMenus
|
||||||
protected override void OnTarget(Mobile from, object targeted)
|
protected override void OnTarget(Mobile from, object targeted)
|
||||||
{
|
{
|
||||||
if (targeted is Spellbook book)
|
if (targeted is Spellbook book)
|
||||||
if (from.CheckAlive() && !m_Scroll.Deleted && m_Scroll.Movable && m_Scroll.Amount >= 1 &&
|
{
|
||||||
m_Scroll.CheckItemUse(from))
|
if (@from.CheckAlive() && !m_Scroll.Deleted && m_Scroll.Movable && m_Scroll.Amount >= 1 &&
|
||||||
|
m_Scroll.CheckItemUse(@from))
|
||||||
{
|
{
|
||||||
var type = Spellbook.GetTypeForSpell(m_Scroll.SpellID);
|
var type = Spellbook.GetTypeForSpell(m_Scroll.SpellID);
|
||||||
|
|
||||||
|
|
@ -35,7 +38,7 @@ namespace Server.ContextMenus
|
||||||
}
|
}
|
||||||
else if (book.HasSpell(m_Scroll.SpellID))
|
else if (book.HasSpell(m_Scroll.SpellID))
|
||||||
{
|
{
|
||||||
from.SendLocalizedMessage(500179); // That spell is already present in that spellbook.
|
@from.SendLocalizedMessage(500179); // That spell is already present in that spellbook.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -47,10 +50,11 @@ namespace Server.ContextMenus
|
||||||
|
|
||||||
m_Scroll.Consume();
|
m_Scroll.Consume();
|
||||||
|
|
||||||
from.Send(new PlaySound(0x249, book.GetWorldLocation()));
|
@from.Send(new PlaySound(0x249, book.GetWorldLocation()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,9 @@ namespace Server.ContextMenus
|
||||||
public override void OnClick()
|
public override void OnClick()
|
||||||
{
|
{
|
||||||
if (m_Food?.Deleted != false || !m_Food.Movable || !m_From.CheckAlive() || !m_Food.CheckItemUse(m_From))
|
if (m_Food?.Deleted != false || !m_Food.Movable || !m_From.CheckAlive() || !m_Food.CheckItemUse(m_From))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_Food.Eat(m_From);
|
m_Food.Eat(m_From);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,9 @@ namespace Server.ContextMenus
|
||||||
public override void OnClick()
|
public override void OnClick()
|
||||||
{
|
{
|
||||||
if (!m_From.Alive || m_TargetHouse.Deleted || !m_TargetHouse.IsFriend(m_From))
|
if (!m_From.Alive || m_TargetHouse.Deleted || !m_TargetHouse.IsFriend(m_From))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_TargetHouse.Kick(m_From, m_Target);
|
m_TargetHouse.Kick(m_From, m_Target);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,18 @@ namespace Server.ContextMenus
|
||||||
public override void OnClick()
|
public override void OnClick()
|
||||||
{
|
{
|
||||||
if (!Owner.From.CheckAlive())
|
if (!Owner.From.CheckAlive())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Owner.From.Criminal)
|
if (Owner.From.Criminal)
|
||||||
|
{
|
||||||
m_Banker.Say(500378); // Thou art a criminal and cannot access thy bank box.
|
m_Banker.Say(500378); // Thou art a criminal and cannot access thy bank box.
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
Owner.From.BankBox.Open();
|
Owner.From.BankBox.Open();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,17 @@ namespace Server.ContextMenus
|
||||||
m_From = from;
|
m_From = from;
|
||||||
|
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
|
{
|
||||||
Flags |= CMEFlags.Disabled;
|
Flags |= CMEFlags.Disabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnClick()
|
public override void OnClick()
|
||||||
{
|
{
|
||||||
if (!m_From.CheckAlive())
|
if (!m_From.CheckAlive())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_Mobile.Teach(m_Skill, m_From, 0, false);
|
m_Mobile.Teach(m_Skill, m_From, 0, false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,9 @@ namespace Server.Engines.BulkOrders
|
||||||
protected override void OnTarget(Mobile from, object targeted)
|
protected override void OnTarget(Mobile from, object targeted)
|
||||||
{
|
{
|
||||||
if (m_Deed.Deleted || !m_Deed.IsChildOf(from.Backpack))
|
if (m_Deed.Deleted || !m_Deed.IsChildOf(from.Backpack))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(targeted is Item item && item.IsChildOf(from.Backpack)))
|
if (!(targeted is Item item && item.IsChildOf(from.Backpack)))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,9 @@ namespace Server.Engines.BulkOrders
|
||||||
for (var i = 0; i < chances.Length; ++i)
|
for (var i = 0; i < chances.Length; ++i)
|
||||||
{
|
{
|
||||||
if (random < chances[i])
|
if (random < chances[i])
|
||||||
|
{
|
||||||
return i == 0 ? BulkMaterialType.None : start + (i - 1);
|
return i == 0 ? BulkMaterialType.None : start + (i - 1);
|
||||||
|
}
|
||||||
|
|
||||||
random -= chances[i];
|
random -= chances[i];
|
||||||
}
|
}
|
||||||
|
|
@ -108,7 +110,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var reward = rewardGroup.Items[i];
|
var reward = rewardGroup.Items[i];
|
||||||
|
|
||||||
if (reward != null)
|
if (reward != null)
|
||||||
|
{
|
||||||
list.Add(reward);
|
list.Add(reward);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -116,7 +120,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var reward = rewardGroup.AcquireItem();
|
var reward = rewardGroup.AcquireItem();
|
||||||
|
|
||||||
if (reward != null)
|
if (reward != null)
|
||||||
|
{
|
||||||
list.Add(reward);
|
list.Add(reward);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
@ -125,11 +131,15 @@ namespace Server.Engines.BulkOrders
|
||||||
public virtual void BeginCombine(Mobile from)
|
public virtual void BeginCombine(Mobile from)
|
||||||
{
|
{
|
||||||
if (Complete)
|
if (Complete)
|
||||||
from.SendLocalizedMessage(
|
{
|
||||||
|
@from.SendLocalizedMessage(
|
||||||
1045166
|
1045166
|
||||||
); // The maximum amount of requested items have already been combined to this deed.
|
); // The maximum amount of requested items have already been combined to this deed.
|
||||||
|
}
|
||||||
else
|
else
|
||||||
from.Target = new BODTarget(this);
|
{
|
||||||
|
@from.Target = new BODTarget(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Serialize(IGenericWriter writer)
|
public override void Serialize(IGenericWriter writer)
|
||||||
|
|
@ -161,7 +171,9 @@ namespace Server.Engines.BulkOrders
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Parent == null && Map == Map.Internal && Location == Point3D.Zero)
|
if (Parent == null && Map == Map.Internal && Location == Point3D.Zero)
|
||||||
|
{
|
||||||
Delete();
|
Delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var number = filters[i, 0];
|
var number = filters[i, 0];
|
||||||
|
|
||||||
if (number == 0)
|
if (number == 0)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var isSelected = filters[i, 1] == filterValue ||
|
var isSelected = filters[i, 1] == filterValue ||
|
||||||
i % xOffsets.Length == 0 && filterValue == 0;
|
i % xOffsets.Length == 0 && filterValue == 0;
|
||||||
|
|
@ -201,7 +203,9 @@ namespace Server.Engines.BulkOrders
|
||||||
if (index >= 0 && index < filters.GetLength(0))
|
if (index >= 0 && index < filters.GetLength(0))
|
||||||
{
|
{
|
||||||
if (filters[index, 0] == 0)
|
if (filters[index, 0] == 0)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var entry = book.Entries[i];
|
var entry = book.Entries[i];
|
||||||
|
|
||||||
if (CheckFilter(entry))
|
if (CheckFilter(entry))
|
||||||
|
{
|
||||||
list.Add(entry);
|
list.Add(entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -62,7 +64,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var width = 600;
|
var width = 600;
|
||||||
|
|
||||||
if (!canPrice)
|
if (!canPrice)
|
||||||
|
{
|
||||||
width = 516;
|
width = 516;
|
||||||
|
}
|
||||||
|
|
||||||
X = (624 - width) / 2;
|
X = (624 - width) / 2;
|
||||||
|
|
||||||
|
|
@ -78,7 +82,9 @@ namespace Server.Engines.BulkOrders
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canDrop)
|
if (canDrop)
|
||||||
|
{
|
||||||
AddImageTiled(24, 64, 32, 352, 1416);
|
AddImageTiled(24, 64, 32, 352, 1416);
|
||||||
|
}
|
||||||
|
|
||||||
AddImageTiled(58, 64, 36, 352, 200);
|
AddImageTiled(58, 64, 36, 352, 200);
|
||||||
AddImageTiled(96, 64, 133, 352, 1416);
|
AddImageTiled(96, 64, 133, 352, 1416);
|
||||||
|
|
@ -91,7 +97,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var entry = list[i];
|
var entry = list[i];
|
||||||
|
|
||||||
if (!CheckFilter(entry))
|
if (!CheckFilter(entry))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
AddImageTiled(24, 94 + tableIndex * 32, canPrice ? 573 : 489, 2, 2624);
|
AddImageTiled(24, 94 + tableIndex * 32, canPrice ? 573 : 489, 2, 2624);
|
||||||
tableIndex += entry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
|
tableIndex += entry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
|
||||||
|
|
@ -116,17 +124,25 @@ namespace Server.Engines.BulkOrders
|
||||||
var f = from.UseOwnFilter ? from.BOBFilter : book.Filter;
|
var f = from.UseOwnFilter ? from.BOBFilter : book.Filter;
|
||||||
|
|
||||||
if (f.IsDefault)
|
if (f.IsDefault)
|
||||||
|
{
|
||||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062475, 16927); // Using No Filter
|
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062475, 16927); // Using No Filter
|
||||||
|
}
|
||||||
else if (from.UseOwnFilter)
|
else if (from.UseOwnFilter)
|
||||||
|
{
|
||||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062451, 16927); // Using Your Filter
|
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062451, 16927); // Using Your Filter
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062230, 16927); // Using Book Filter
|
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062230, 16927); // Using Book Filter
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(375, 416, 4017, 4018, 0);
|
AddButton(375, 416, 4017, 4018, 0);
|
||||||
AddHtmlLocalized(410, 416, 120, 20, 1011441, LabelColor); // EXIT
|
AddHtmlLocalized(410, 416, 120, 20, 1011441, LabelColor); // EXIT
|
||||||
|
|
||||||
if (canDrop)
|
if (canDrop)
|
||||||
|
{
|
||||||
AddHtmlLocalized(26, 64, 50, 32, 1062212, LabelColor); // Drop
|
AddHtmlLocalized(26, 64, 50, 32, 1062212, LabelColor); // Drop
|
||||||
|
}
|
||||||
|
|
||||||
if (canPrice)
|
if (canPrice)
|
||||||
{
|
{
|
||||||
|
|
@ -164,14 +180,18 @@ namespace Server.Engines.BulkOrders
|
||||||
var entry = list[i];
|
var entry = list[i];
|
||||||
|
|
||||||
if (!CheckFilter(entry))
|
if (!CheckFilter(entry))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (entry is BOBLargeEntry largeEntry)
|
if (entry is BOBLargeEntry largeEntry)
|
||||||
{
|
{
|
||||||
var y = 96 + tableIndex * 32;
|
var y = 96 + tableIndex * 32;
|
||||||
|
|
||||||
if (canDrop)
|
if (canDrop)
|
||||||
|
{
|
||||||
AddButton(35, y + 2, 5602, 5606, 5 + i * 2);
|
AddButton(35, y + 2, 5602, 5606, 5 + i * 2);
|
||||||
|
}
|
||||||
|
|
||||||
if (canDrop || canBuy && entry.Price > 0)
|
if (canDrop || canBuy && entry.Price > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -188,16 +208,24 @@ namespace Server.Engines.BulkOrders
|
||||||
AddHtmlLocalized(103, y, 130, 32, sub.Number, LabelColor);
|
AddHtmlLocalized(103, y, 130, 32, sub.Number, LabelColor);
|
||||||
|
|
||||||
if (entry.RequireExceptional)
|
if (entry.RequireExceptional)
|
||||||
|
{
|
||||||
AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor); // exceptional
|
AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor); // exceptional
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor); // normal
|
AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor); // normal
|
||||||
|
}
|
||||||
|
|
||||||
var name = GetMaterialName(entry.Material, entry.DeedType, sub.ItemType);
|
var name = GetMaterialName(entry.Material, entry.DeedType, sub.ItemType);
|
||||||
|
|
||||||
if (name.Number > 0)
|
if (name.Number > 0)
|
||||||
|
{
|
||||||
AddHtmlLocalized(316, y, 100, 20, name, LabelColor);
|
AddHtmlLocalized(316, y, 100, 20, name, LabelColor);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddLabel(316, y, 1152, name);
|
AddLabel(316, y, 1152, name);
|
||||||
|
}
|
||||||
|
|
||||||
AddLabel(421, y, 1152, $"{sub.AmountCur} / {entry.AmountMax}");
|
AddLabel(421, y, 1152, $"{sub.AmountCur} / {entry.AmountMax}");
|
||||||
|
|
||||||
|
|
@ -212,7 +240,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var y = 96 + tableIndex++ * 32;
|
var y = 96 + tableIndex++ * 32;
|
||||||
|
|
||||||
if (canDrop)
|
if (canDrop)
|
||||||
|
{
|
||||||
AddButton(35, y + 2, 5602, 5606, 5 + i * 2);
|
AddButton(35, y + 2, 5602, 5606, 5 + i * 2);
|
||||||
|
}
|
||||||
|
|
||||||
if (canDrop || canBuy && smallEntry.Price > 0)
|
if (canDrop || canBuy && smallEntry.Price > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -225,16 +255,24 @@ namespace Server.Engines.BulkOrders
|
||||||
AddHtmlLocalized(103, y, 130, 32, smallEntry.Number, LabelColor);
|
AddHtmlLocalized(103, y, 130, 32, smallEntry.Number, LabelColor);
|
||||||
|
|
||||||
if (smallEntry.RequireExceptional)
|
if (smallEntry.RequireExceptional)
|
||||||
|
{
|
||||||
AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor); // exceptional
|
AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor); // exceptional
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor); // normal
|
AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor); // normal
|
||||||
|
}
|
||||||
|
|
||||||
var name = GetMaterialName(smallEntry.Material, smallEntry.DeedType, smallEntry.ItemType);
|
var name = GetMaterialName(smallEntry.Material, smallEntry.DeedType, smallEntry.ItemType);
|
||||||
|
|
||||||
if (name.Number > 0)
|
if (name.Number > 0)
|
||||||
|
{
|
||||||
AddHtmlLocalized(316, y, 100, 20, name, LabelColor);
|
AddHtmlLocalized(316, y, 100, 20, name, LabelColor);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AddLabel(316, y, 1152, name);
|
AddLabel(316, y, 1152, name);
|
||||||
|
}
|
||||||
|
|
||||||
AddLabel(421, y, 1152, $"{smallEntry.AmountCur} / {smallEntry.AmountMax}");
|
AddLabel(421, y, 1152, $"{smallEntry.AmountCur} / {smallEntry.AmountMax}");
|
||||||
}
|
}
|
||||||
|
|
@ -244,6 +282,7 @@ namespace Server.Engines.BulkOrders
|
||||||
public bool CheckFilter(IBOBEntry entry)
|
public bool CheckFilter(IBOBEntry entry)
|
||||||
{
|
{
|
||||||
if (entry is BOBLargeEntry largeEntry)
|
if (entry is BOBLargeEntry largeEntry)
|
||||||
|
{
|
||||||
return CheckFilter(
|
return CheckFilter(
|
||||||
entry.Material,
|
entry.Material,
|
||||||
entry.AmountMax,
|
entry.AmountMax,
|
||||||
|
|
@ -252,8 +291,10 @@ namespace Server.Engines.BulkOrders
|
||||||
entry.DeedType,
|
entry.DeedType,
|
||||||
largeEntry.Entries.Length > 0 ? largeEntry.Entries[0].ItemType : null
|
largeEntry.Entries.Length > 0 ? largeEntry.Entries[0].ItemType : null
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (entry is BOBSmallEntry smallEntry)
|
if (entry is BOBSmallEntry smallEntry)
|
||||||
|
{
|
||||||
return CheckFilter(
|
return CheckFilter(
|
||||||
entry.Material,
|
entry.Material,
|
||||||
entry.AmountMax,
|
entry.AmountMax,
|
||||||
|
|
@ -262,6 +303,7 @@ namespace Server.Engines.BulkOrders
|
||||||
entry.DeedType,
|
entry.DeedType,
|
||||||
smallEntry.ItemType
|
smallEntry.ItemType
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -274,24 +316,44 @@ namespace Server.Engines.BulkOrders
|
||||||
var f = m_From.UseOwnFilter ? m_From.BOBFilter : m_Book.Filter;
|
var f = m_From.UseOwnFilter ? m_From.BOBFilter : m_Book.Filter;
|
||||||
|
|
||||||
if (f.IsDefault)
|
if (f.IsDefault)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (f.Quality == 1 && reqExc)
|
if (f.Quality == 1 && reqExc)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (f.Quality == 2 && !reqExc)
|
if (f.Quality == 2 && !reqExc)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (f.Quantity == 1 && amountMax != 10)
|
if (f.Quantity == 1 && amountMax != 10)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (f.Quantity == 2 && amountMax != 15)
|
if (f.Quantity == 2 && amountMax != 15)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (f.Quantity == 3 && amountMax != 20)
|
if (f.Quantity == 3 && amountMax != 20)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (f.Type == 1 && isLarge)
|
if (f.Type == 1 && isLarge)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (f.Type == 2 && !isLarge)
|
if (f.Type == 2 && !isLarge)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return f.Material switch
|
return f.Material switch
|
||||||
{
|
{
|
||||||
|
|
@ -320,7 +382,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var index = 0;
|
var index = 0;
|
||||||
|
|
||||||
while (page-- > 0)
|
while (page-- > 0)
|
||||||
|
{
|
||||||
index += GetCountForIndex(index);
|
index += GetCountForIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
@ -341,7 +405,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var add = entry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
|
var add = entry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
|
||||||
|
|
||||||
if (slots + add > 10)
|
if (slots + add > 10)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
slots += add;
|
slots += add;
|
||||||
}
|
}
|
||||||
|
|
@ -355,7 +421,9 @@ namespace Server.Engines.BulkOrders
|
||||||
public int GetPageForIndex(int index, int sizeDropped)
|
public int GetPageForIndex(int index, int sizeDropped)
|
||||||
{
|
{
|
||||||
if (index <= 0)
|
if (index <= 0)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
var count = 0;
|
var count = 0;
|
||||||
var page = 0;
|
var page = 0;
|
||||||
|
|
@ -366,7 +434,9 @@ namespace Server.Engines.BulkOrders
|
||||||
{
|
{
|
||||||
var entry = list[i];
|
var entry = list[i];
|
||||||
if (!CheckFilter(entry))
|
if (!CheckFilter(entry))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var add = entry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
|
var add = entry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
|
||||||
count += add;
|
count += add;
|
||||||
|
|
@ -393,13 +463,17 @@ namespace Server.Engines.BulkOrders
|
||||||
{
|
{
|
||||||
var entry = list[i];
|
var entry = list[i];
|
||||||
if (CheckFilter(entry))
|
if (CheckFilter(entry))
|
||||||
|
{
|
||||||
count += entry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
|
count += entry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
|
||||||
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count > 10)
|
if (count > 10)
|
||||||
|
{
|
||||||
page++;
|
page++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return page;
|
return page;
|
||||||
|
|
@ -433,7 +507,9 @@ namespace Server.Engines.BulkOrders
|
||||||
case BulkMaterialType.None:
|
case BulkMaterialType.None:
|
||||||
{
|
{
|
||||||
if (itemType.IsSubclassOf(typeof(BaseArmor)) || itemType.IsSubclassOf(typeof(BaseShoes)))
|
if (itemType.IsSubclassOf(typeof(BaseArmor)) || itemType.IsSubclassOf(typeof(BaseShoes)))
|
||||||
|
{
|
||||||
return 1062235;
|
return 1062235;
|
||||||
|
}
|
||||||
|
|
||||||
return 1044286;
|
return 1044286;
|
||||||
}
|
}
|
||||||
|
|
@ -468,14 +544,18 @@ namespace Server.Engines.BulkOrders
|
||||||
case 2: // Previous page
|
case 2: // Previous page
|
||||||
{
|
{
|
||||||
if (m_Page > 0)
|
if (m_Page > 0)
|
||||||
|
{
|
||||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page - 1, m_List));
|
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page - 1, m_List));
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case 3: // Next page
|
case 3: // Next page
|
||||||
{
|
{
|
||||||
if (GetIndexForPage(m_Page + 1) < m_List.Count)
|
if (GetIndexForPage(m_Page + 1) < m_List.Count)
|
||||||
|
{
|
||||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page + 1, m_List));
|
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page + 1, m_List));
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -497,7 +577,9 @@ namespace Server.Engines.BulkOrders
|
||||||
index /= 2;
|
index /= 2;
|
||||||
|
|
||||||
if (index < 0 || index >= m_List.Count)
|
if (index < 0 || index >= m_List.Count)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
var bobEntry = m_List[index];
|
var bobEntry = m_List[index];
|
||||||
|
|
||||||
|
|
@ -570,7 +652,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var vi = pv.GetVendorItem(m_Book);
|
var vi = pv.GetVendorItem(m_Book);
|
||||||
|
|
||||||
if (vi?.IsForSale != false)
|
if (vi?.IsForSale != false)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var sizeOfDroppedBod = bobEntry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
|
var sizeOfDroppedBod = bobEntry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
|
||||||
var price = bobEntry.Price;
|
var price = bobEntry.Price;
|
||||||
|
|
@ -635,7 +719,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var entry = m_List[i];
|
var entry = m_List[i];
|
||||||
|
|
||||||
if (!m_Book.Entries.Contains(entry))
|
if (!m_Book.Entries.Contains(entry))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
entry.Price = price;
|
entry.Price = price;
|
||||||
}
|
}
|
||||||
|
|
@ -643,14 +729,18 @@ namespace Server.Engines.BulkOrders
|
||||||
from.SendMessage("Deed prices set.");
|
from.SendMessage("Deed prices set.");
|
||||||
|
|
||||||
if (from is PlayerMobile mobile)
|
if (from is PlayerMobile mobile)
|
||||||
|
{
|
||||||
mobile.SendGump(new BOBGump(mobile, m_Book, m_Page, m_List));
|
mobile.SendGump(new BOBGump(mobile, m_Book, m_Page, m_List));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Entry.Price = price;
|
m_Entry.Price = price;
|
||||||
from.SendLocalizedMessage(1062384); // Deed price set.
|
from.SendLocalizedMessage(1062384); // Deed price set.
|
||||||
if (from is PlayerMobile mobile)
|
if (from is PlayerMobile mobile)
|
||||||
|
{
|
||||||
mobile.SendGump(new BOBGump(mobile, m_Book, m_Page, m_List));
|
mobile.SendGump(new BOBGump(mobile, m_Book, m_Page, m_List));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,13 @@ namespace Server.Engines.BulkOrders
|
||||||
RequireExceptional = bod.RequireExceptional;
|
RequireExceptional = bod.RequireExceptional;
|
||||||
|
|
||||||
if (bod is LargeTailorBOD)
|
if (bod is LargeTailorBOD)
|
||||||
|
{
|
||||||
DeedType = BODType.Tailor;
|
DeedType = BODType.Tailor;
|
||||||
|
}
|
||||||
else if (bod is LargeSmithBOD)
|
else if (bod is LargeSmithBOD)
|
||||||
|
{
|
||||||
DeedType = BODType.Smith;
|
DeedType = BODType.Smith;
|
||||||
|
}
|
||||||
|
|
||||||
Material = bod.Material;
|
Material = bod.Material;
|
||||||
AmountMax = bod.AmountMax;
|
AmountMax = bod.AmountMax;
|
||||||
|
|
@ -17,7 +21,9 @@ namespace Server.Engines.BulkOrders
|
||||||
Entries = new BOBLargeSubEntry[bod.Entries.Length];
|
Entries = new BOBLargeSubEntry[bod.Entries.Length];
|
||||||
|
|
||||||
for (var i = 0; i < Entries.Length; ++i)
|
for (var i = 0; i < Entries.Length; ++i)
|
||||||
|
{
|
||||||
Entries[i] = new BOBLargeSubEntry(bod.Entries[i]);
|
Entries[i] = new BOBLargeSubEntry(bod.Entries[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BOBLargeEntry(IGenericReader reader)
|
public BOBLargeEntry(IGenericReader reader)
|
||||||
|
|
@ -39,7 +45,9 @@ namespace Server.Engines.BulkOrders
|
||||||
Entries = new BOBLargeSubEntry[reader.ReadEncodedInt()];
|
Entries = new BOBLargeSubEntry[reader.ReadEncodedInt()];
|
||||||
|
|
||||||
for (var i = 0; i < Entries.Length; ++i)
|
for (var i = 0; i < Entries.Length; ++i)
|
||||||
|
{
|
||||||
Entries[i] = new BOBLargeSubEntry(reader);
|
Entries[i] = new BOBLargeSubEntry(reader);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -63,12 +71,18 @@ namespace Server.Engines.BulkOrders
|
||||||
LargeBOD bod = null;
|
LargeBOD bod = null;
|
||||||
|
|
||||||
if (DeedType == BODType.Smith)
|
if (DeedType == BODType.Smith)
|
||||||
|
{
|
||||||
bod = new LargeSmithBOD(AmountMax, RequireExceptional, Material, ReconstructEntries());
|
bod = new LargeSmithBOD(AmountMax, RequireExceptional, Material, ReconstructEntries());
|
||||||
|
}
|
||||||
else if (DeedType == BODType.Tailor)
|
else if (DeedType == BODType.Tailor)
|
||||||
|
{
|
||||||
bod = new LargeTailorBOD(AmountMax, RequireExceptional, Material, ReconstructEntries());
|
bod = new LargeTailorBOD(AmountMax, RequireExceptional, Material, ReconstructEntries());
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; bod?.Entries.Length >= i; ++i)
|
for (var i = 0; bod?.Entries.Length >= i; ++i)
|
||||||
|
{
|
||||||
bod.Entries[i].Owner = bod;
|
bod.Entries[i].Owner = bod;
|
||||||
|
}
|
||||||
|
|
||||||
return bod;
|
return bod;
|
||||||
}
|
}
|
||||||
|
|
@ -78,11 +92,13 @@ namespace Server.Engines.BulkOrders
|
||||||
var entries = new LargeBulkEntry[Entries.Length];
|
var entries = new LargeBulkEntry[Entries.Length];
|
||||||
|
|
||||||
for (var i = 0; i < Entries.Length; ++i)
|
for (var i = 0; i < Entries.Length; ++i)
|
||||||
|
{
|
||||||
entries[i] = new LargeBulkEntry(
|
entries[i] = new LargeBulkEntry(
|
||||||
null,
|
null,
|
||||||
new SmallBulkEntry(Entries[i].ItemType, Entries[i].Number, Entries[i].Graphic)
|
new SmallBulkEntry(Entries[i].ItemType, Entries[i].Number, Entries[i].Graphic)
|
||||||
)
|
)
|
||||||
{ Amount = Entries[i].AmountCur };
|
{ Amount = Entries[i].AmountCur };
|
||||||
|
}
|
||||||
|
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
@ -101,7 +117,9 @@ namespace Server.Engines.BulkOrders
|
||||||
writer.WriteEncodedInt(Entries.Length);
|
writer.WriteEncodedInt(Entries.Length);
|
||||||
|
|
||||||
for (var i = 0; i < Entries.Length; ++i)
|
for (var i = 0; i < Entries.Length; ++i)
|
||||||
|
{
|
||||||
Entries[i].Serialize(writer);
|
Entries[i].Serialize(writer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var type = reader.ReadString();
|
var type = reader.ReadString();
|
||||||
|
|
||||||
if (type != null)
|
if (type != null)
|
||||||
|
{
|
||||||
ItemType = AssemblyHandler.FindFirstTypeForName(type);
|
ItemType = AssemblyHandler.FindFirstTypeForName(type);
|
||||||
|
}
|
||||||
|
|
||||||
AmountCur = reader.ReadEncodedInt();
|
AmountCur = reader.ReadEncodedInt();
|
||||||
Number = reader.ReadEncodedInt();
|
Number = reader.ReadEncodedInt();
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,13 @@ namespace Server.Engines.BulkOrders
|
||||||
RequireExceptional = bod.RequireExceptional;
|
RequireExceptional = bod.RequireExceptional;
|
||||||
|
|
||||||
if (bod is SmallTailorBOD)
|
if (bod is SmallTailorBOD)
|
||||||
|
{
|
||||||
DeedType = BODType.Tailor;
|
DeedType = BODType.Tailor;
|
||||||
|
}
|
||||||
else if (bod is SmallSmithBOD)
|
else if (bod is SmallSmithBOD)
|
||||||
|
{
|
||||||
DeedType = BODType.Smith;
|
DeedType = BODType.Smith;
|
||||||
|
}
|
||||||
|
|
||||||
Material = bod.Material;
|
Material = bod.Material;
|
||||||
AmountCur = bod.AmountCur;
|
AmountCur = bod.AmountCur;
|
||||||
|
|
@ -32,7 +36,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var type = reader.ReadString();
|
var type = reader.ReadString();
|
||||||
|
|
||||||
if (type != null)
|
if (type != null)
|
||||||
|
{
|
||||||
ItemType = AssemblyHandler.FindFirstTypeForName(type);
|
ItemType = AssemblyHandler.FindFirstTypeForName(type);
|
||||||
|
}
|
||||||
|
|
||||||
RequireExceptional = reader.ReadBool();
|
RequireExceptional = reader.ReadBool();
|
||||||
|
|
||||||
|
|
@ -73,9 +79,13 @@ namespace Server.Engines.BulkOrders
|
||||||
SmallBOD bod = null;
|
SmallBOD bod = null;
|
||||||
|
|
||||||
if (DeedType == BODType.Smith)
|
if (DeedType == BODType.Smith)
|
||||||
|
{
|
||||||
bod = new SmallSmithBOD(AmountCur, AmountMax, ItemType, Number, Graphic, RequireExceptional, Material);
|
bod = new SmallSmithBOD(AmountCur, AmountMax, ItemType, Number, Graphic, RequireExceptional, Material);
|
||||||
|
}
|
||||||
else if (DeedType == BODType.Tailor)
|
else if (DeedType == BODType.Tailor)
|
||||||
|
{
|
||||||
bod = new SmallTailorBOD(AmountCur, AmountMax, ItemType, Number, Graphic, RequireExceptional, Material);
|
bod = new SmallTailorBOD(AmountCur, AmountMax, ItemType, Number, Graphic, RequireExceptional, Material);
|
||||||
|
}
|
||||||
|
|
||||||
return bod;
|
return bod;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var price = 0;
|
var price = 0;
|
||||||
|
|
||||||
if (pv.GetVendorItem(m_Book)?.IsForSale == false)
|
if (pv.GetVendorItem(m_Book)?.IsForSale == false)
|
||||||
|
{
|
||||||
price = m_Entry.Price;
|
price = m_Entry.Price;
|
||||||
|
}
|
||||||
|
|
||||||
if (price != m_Price)
|
if (price != m_Price)
|
||||||
{
|
{
|
||||||
|
|
@ -116,9 +118,13 @@ namespace Server.Engines.BulkOrders
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Book.Entries.Count > 0)
|
if (m_Book.Entries.Count > 0)
|
||||||
|
{
|
||||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page));
|
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_From.SendLocalizedMessage(1062381); // The book is empty.
|
m_From.SendLocalizedMessage(1062381); // The book is empty.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -52,11 +52,17 @@ namespace Server.Engines.BulkOrders
|
||||||
public override void OnDoubleClick(Mobile from)
|
public override void OnDoubleClick(Mobile from)
|
||||||
{
|
{
|
||||||
if (!from.InRange(GetWorldLocation(), 2))
|
if (!from.InRange(GetWorldLocation(), 2))
|
||||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
{
|
||||||
|
@from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||||
|
}
|
||||||
else if (Entries.Count == 0)
|
else if (Entries.Count == 0)
|
||||||
from.SendLocalizedMessage(1062381); // The book is empty.
|
{
|
||||||
|
@from.SendLocalizedMessage(1062381); // The book is empty.
|
||||||
|
}
|
||||||
else if (from is PlayerMobile mobile)
|
else if (from is PlayerMobile mobile)
|
||||||
|
{
|
||||||
mobile.SendGump(new BOBGump(mobile, this));
|
mobile.SendGump(new BOBGump(mobile, this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnDoubleClickSecureTrade(Mobile from)
|
public override void OnDoubleClickSecureTrade(Mobile from)
|
||||||
|
|
@ -76,9 +82,13 @@ namespace Server.Engines.BulkOrders
|
||||||
var trade = GetSecureTradeCont()?.Trade;
|
var trade = GetSecureTradeCont()?.Trade;
|
||||||
|
|
||||||
if (trade?.From.Mobile == from)
|
if (trade?.From.Mobile == from)
|
||||||
|
{
|
||||||
trade.To.Mobile.SendGump(new BOBGump((PlayerMobile)trade.To.Mobile, this));
|
trade.To.Mobile.SendGump(new BOBGump((PlayerMobile)trade.To.Mobile, this));
|
||||||
|
}
|
||||||
else if (trade?.To.Mobile == from)
|
else if (trade?.To.Mobile == from)
|
||||||
|
{
|
||||||
trade.From.Mobile.SendGump(new BOBGump((PlayerMobile)trade.From.Mobile, this));
|
trade.From.Mobile.SendGump(new BOBGump((PlayerMobile)trade.From.Mobile, this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -93,13 +103,20 @@ namespace Server.Engines.BulkOrders
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!from.Backpack.CheckHold(from, dropped, true, true))
|
if (!from.Backpack.CheckHold(from, dropped, true, true))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (Entries.Count < 500)
|
if (Entries.Count < 500)
|
||||||
{
|
{
|
||||||
if (dropped is LargeBOD bod)
|
if (dropped is LargeBOD bod)
|
||||||
|
{
|
||||||
Entries.Add(new BOBLargeEntry(bod));
|
Entries.Add(new BOBLargeEntry(bod));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
Entries.Add(new BOBSmallEntry((SmallBOD)dropped));
|
Entries.Add(new BOBSmallEntry((SmallBOD)dropped));
|
||||||
|
}
|
||||||
|
|
||||||
InvalidateProperties();
|
InvalidateProperties();
|
||||||
|
|
||||||
|
|
@ -113,7 +130,9 @@ namespace Server.Engines.BulkOrders
|
||||||
from.SendLocalizedMessage(1062386); // Deed added to book.
|
from.SendLocalizedMessage(1062386); // Deed added to book.
|
||||||
|
|
||||||
if (from is PlayerMobile pm)
|
if (from is PlayerMobile pm)
|
||||||
|
{
|
||||||
pm.SendGump(new BOBGump(pm, this));
|
pm.SendGump(new BOBGump(pm, this));
|
||||||
|
}
|
||||||
|
|
||||||
dropped.Delete();
|
dropped.Delete();
|
||||||
|
|
||||||
|
|
@ -133,7 +152,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var total = base.GetTotal(type);
|
var total = base.GetTotal(type);
|
||||||
|
|
||||||
if (type == TotalType.Items)
|
if (type == TotalType.Items)
|
||||||
|
{
|
||||||
total = ItemCount;
|
total = ItemCount;
|
||||||
|
}
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
@ -244,7 +265,9 @@ namespace Server.Engines.BulkOrders
|
||||||
list.Add(1062344, Entries.Count.ToString()); // Deeds in book: ~1_val~
|
list.Add(1062344, Entries.Count.ToString()); // Deeds in book: ~1_val~
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(m_BookName))
|
if (!string.IsNullOrEmpty(m_BookName))
|
||||||
|
{
|
||||||
list.Add(1062481, m_BookName); // Book Name: ~1_val~
|
list.Add(1062481, m_BookName); // Book Name: ~1_val~
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSingleClick(Mobile from)
|
public override void OnSingleClick(Mobile from)
|
||||||
|
|
@ -254,7 +277,9 @@ namespace Server.Engines.BulkOrders
|
||||||
LabelTo(from, 1062344, Entries.Count.ToString()); // Deeds in book: ~1_val~
|
LabelTo(from, 1062344, Entries.Count.ToString()); // Deeds in book: ~1_val~
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(m_BookName))
|
if (!string.IsNullOrEmpty(m_BookName))
|
||||||
LabelTo(from, 1062481, m_BookName);
|
{
|
||||||
|
LabelTo(@from, 1062481, m_BookName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||||
|
|
@ -262,7 +287,9 @@ namespace Server.Engines.BulkOrders
|
||||||
base.GetContextMenuEntries(from, list);
|
base.GetContextMenuEntries(from, list);
|
||||||
|
|
||||||
if (from.CheckAlive() && IsChildOf(from.Backpack))
|
if (from.CheckAlive() && IsChildOf(from.Backpack))
|
||||||
list.Add(new NameBookEntry(from, this));
|
{
|
||||||
|
list.Add(new NameBookEntry(@from, this));
|
||||||
|
}
|
||||||
|
|
||||||
SetSecureLevelEntry.AddTo(from, this, list);
|
SetSecureLevelEntry.AddTo(from, this, list);
|
||||||
}
|
}
|
||||||
|
|
@ -297,7 +324,9 @@ namespace Server.Engines.BulkOrders
|
||||||
public override void OnResponse(Mobile from, string text)
|
public override void OnResponse(Mobile from, string text)
|
||||||
{
|
{
|
||||||
if (text.Length > 40)
|
if (text.Length > 40)
|
||||||
|
{
|
||||||
text = text.Substring(0, 40);
|
text = text.Substring(0, 40);
|
||||||
|
}
|
||||||
|
|
||||||
if (from.CheckAlive() && m_Book.IsChildOf(from.Backpack))
|
if (from.CheckAlive() && m_Book.IsChildOf(from.Backpack))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,9 @@ namespace Server.Engines.BulkOrders
|
||||||
public static BulkGenericType Classify(BODType deedType, Type itemType)
|
public static BulkGenericType Classify(BODType deedType, Type itemType)
|
||||||
{
|
{
|
||||||
if (deedType != BODType.Tailor)
|
if (deedType != BODType.Tailor)
|
||||||
|
{
|
||||||
return BulkGenericType.Iron;
|
return BulkGenericType.Iron;
|
||||||
|
}
|
||||||
|
|
||||||
return itemType == null || itemType.IsSubclassOf(typeof(BaseArmor)) || itemType.IsSubclassOf(typeof(BaseShoes))
|
return itemType == null || itemType.IsSubclassOf(typeof(BaseArmor)) || itemType.IsSubclassOf(typeof(BaseShoes))
|
||||||
? BulkGenericType.Leather
|
? BulkGenericType.Leather
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,12 @@ namespace Server.Engines.BulkOrders
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
for (var i = 0; i < m_Entries.Length; ++i)
|
for (var i = 0; i < m_Entries.Length; ++i)
|
||||||
|
{
|
||||||
if (m_Entries[i].Amount < AmountMax)
|
if (m_Entries[i].Amount < AmountMax)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -51,15 +55,21 @@ namespace Server.Engines.BulkOrders
|
||||||
list.Add(1060655); // large bulk order
|
list.Add(1060655); // large bulk order
|
||||||
|
|
||||||
if (RequireExceptional)
|
if (RequireExceptional)
|
||||||
|
{
|
||||||
list.Add(1045141); // All items must be exceptional.
|
list.Add(1045141); // All items must be exceptional.
|
||||||
|
}
|
||||||
|
|
||||||
if (Material != BulkMaterialType.None)
|
if (Material != BulkMaterialType.None)
|
||||||
|
{
|
||||||
list.Add(LargeBODGump.GetMaterialNumberFor(Material)); // All items must be made with x material.
|
list.Add(LargeBODGump.GetMaterialNumberFor(Material)); // All items must be made with x material.
|
||||||
|
}
|
||||||
|
|
||||||
list.Add(1060656, AmountMax.ToString()); // amount to make: ~1_val~
|
list.Add(1060656, AmountMax.ToString()); // amount to make: ~1_val~
|
||||||
|
|
||||||
for (var i = 0; i < m_Entries.Length; ++i)
|
for (var i = 0; i < m_Entries.Length; ++i)
|
||||||
|
{
|
||||||
list.Add(1060658 + i, "#{0}\t{1}", m_Entries[i].Details.Number, m_Entries[i].Amount); // ~1_val~: ~2_val~
|
list.Add(1060658 + i, "#{0}\t{1}", m_Entries[i].Details.Number, m_Entries[i].Amount); // ~1_val~: ~2_val~
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnDoubleClickNotAccessible(Mobile from)
|
public override void OnDoubleClickNotAccessible(Mobile from)
|
||||||
|
|
@ -75,9 +85,13 @@ namespace Server.Engines.BulkOrders
|
||||||
public override void OnDoubleClick(Mobile from)
|
public override void OnDoubleClick(Mobile from)
|
||||||
{
|
{
|
||||||
if (IsChildOf(from.Backpack) || InSecureTrade || RootParent is PlayerVendor)
|
if (IsChildOf(from.Backpack) || InSecureTrade || RootParent is PlayerVendor)
|
||||||
from.SendGump(new LargeBODGump(from, this));
|
{
|
||||||
|
@from.SendGump(new LargeBODGump(@from, this));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
from.SendLocalizedMessage(1045156); // You must have the deed in your backpack to use it.
|
{
|
||||||
|
@from.SendLocalizedMessage(1045156); // You must have the deed in your backpack to use it.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void EndCombine(Mobile from, Item item)
|
public override void EndCombine(Mobile from, Item item)
|
||||||
|
|
@ -91,11 +105,13 @@ namespace Server.Engines.BulkOrders
|
||||||
LargeBulkEntry entry = null;
|
LargeBulkEntry entry = null;
|
||||||
|
|
||||||
for (var i = 0; i < m_Entries.Length; ++i)
|
for (var i = 0; i < m_Entries.Length; ++i)
|
||||||
|
{
|
||||||
if (m_Entries[i].Details.Type == small.Type)
|
if (m_Entries[i].Details.Type == small.Type)
|
||||||
{
|
{
|
||||||
entry = m_Entries[i];
|
entry = m_Entries[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (entry == null)
|
if (entry == null)
|
||||||
{
|
{
|
||||||
|
|
@ -140,7 +156,9 @@ namespace Server.Engines.BulkOrders
|
||||||
from.SendGump(new LargeBODGump(from, this));
|
from.SendGump(new LargeBODGump(from, this));
|
||||||
|
|
||||||
if (!Complete)
|
if (!Complete)
|
||||||
BeginCombine(from);
|
{
|
||||||
|
BeginCombine(@from);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -153,7 +171,9 @@ namespace Server.Engines.BulkOrders
|
||||||
writer.Write(m_Entries.Length);
|
writer.Write(m_Entries.Length);
|
||||||
|
|
||||||
for (var i = 0; i < m_Entries.Length; ++i)
|
for (var i = 0; i < m_Entries.Length; ++i)
|
||||||
|
{
|
||||||
m_Entries[i].Serialize(writer);
|
m_Entries[i].Serialize(writer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Deserialize(IGenericReader reader)
|
public override void Deserialize(IGenericReader reader)
|
||||||
|
|
@ -169,7 +189,9 @@ namespace Server.Engines.BulkOrders
|
||||||
m_Entries = new LargeBulkEntry[reader.ReadInt()];
|
m_Entries = new LargeBulkEntry[reader.ReadInt()];
|
||||||
|
|
||||||
for (var i = 0; i < m_Entries.Length; ++i)
|
for (var i = 0; i < m_Entries.Length; ++i)
|
||||||
|
{
|
||||||
m_Entries[i] = new LargeBulkEntry(this, reader);
|
m_Entries[i] = new LargeBulkEntry(this, reader);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var y = 120;
|
var y = 120;
|
||||||
|
|
||||||
for (var i = 0; i < entries.Length; ++i, y += 24)
|
for (var i = 0; i < entries.Length; ++i, y += 24)
|
||||||
|
{
|
||||||
AddHtmlLocalized(40, y, 210, 20, entries[i].Details.Number, 0x7FFF);
|
AddHtmlLocalized(40, y, 210, 20, entries[i].Details.Number, 0x7FFF);
|
||||||
|
}
|
||||||
|
|
||||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||||
{
|
{
|
||||||
|
|
@ -101,15 +103,22 @@ namespace Server.Engines.BulkOrders
|
||||||
public override void OnServerClose(NetState owner)
|
public override void OnServerClose(NetState owner)
|
||||||
{
|
{
|
||||||
if (m_Deed?.Deleted == false)
|
if (m_Deed?.Deleted == false)
|
||||||
|
{
|
||||||
m_Deed.Delete();
|
m_Deed.Delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetMaterialNumberFor(BulkMaterialType material)
|
public static int GetMaterialNumberFor(BulkMaterialType material)
|
||||||
{
|
{
|
||||||
if (material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite)
|
if (material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite)
|
||||||
|
{
|
||||||
return 1045142 + (material - BulkMaterialType.DullCopper);
|
return 1045142 + (material - BulkMaterialType.DullCopper);
|
||||||
|
}
|
||||||
|
|
||||||
if (material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed)
|
if (material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed)
|
||||||
|
{
|
||||||
return 1049348 + (material - BulkMaterialType.Spined);
|
return 1049348 + (material - BulkMaterialType.Spined);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ namespace Server.Engines.BulkOrders
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deed.Material != BulkMaterialType.None)
|
if (deed.Material != BulkMaterialType.None)
|
||||||
|
{
|
||||||
AddHtmlLocalized(
|
AddHtmlLocalized(
|
||||||
75,
|
75,
|
||||||
y,
|
y,
|
||||||
|
|
@ -72,6 +73,7 @@ namespace Server.Engines.BulkOrders
|
||||||
GetMaterialNumberFor(deed.Material),
|
GetMaterialNumberFor(deed.Material),
|
||||||
0x7FFF
|
0x7FFF
|
||||||
); // All items must be made with x material.
|
); // All items must be made with x material.
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(125, 168 + entries.Length * 24, 4005, 4007, 2);
|
AddButton(125, 168 + entries.Length * 24, 4005, 4007, 2);
|
||||||
AddHtmlLocalized(
|
AddHtmlLocalized(
|
||||||
|
|
@ -90,7 +92,9 @@ namespace Server.Engines.BulkOrders
|
||||||
public override void OnResponse(NetState sender, RelayInfo info)
|
public override void OnResponse(NetState sender, RelayInfo info)
|
||||||
{
|
{
|
||||||
if (m_Deed.Deleted || !m_Deed.IsChildOf(m_From.Backpack))
|
if (m_Deed.Deleted || !m_Deed.IsChildOf(m_From.Backpack))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (info.ButtonID == 2) // Combine
|
if (info.ButtonID == 2) // Combine
|
||||||
{
|
{
|
||||||
|
|
@ -102,9 +106,14 @@ namespace Server.Engines.BulkOrders
|
||||||
public static int GetMaterialNumberFor(BulkMaterialType material)
|
public static int GetMaterialNumberFor(BulkMaterialType material)
|
||||||
{
|
{
|
||||||
if (material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite)
|
if (material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite)
|
||||||
|
{
|
||||||
return 1045142 + (material - BulkMaterialType.DullCopper);
|
return 1045142 + (material - BulkMaterialType.DullCopper);
|
||||||
|
}
|
||||||
|
|
||||||
if (material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed)
|
if (material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed)
|
||||||
|
{
|
||||||
return 1049348 + (material - BulkMaterialType.Spined);
|
return 1049348 + (material - BulkMaterialType.Spined);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var type = reader.ReadString();
|
var type = reader.ReadString();
|
||||||
|
|
||||||
if (type != null)
|
if (type != null)
|
||||||
|
{
|
||||||
realType = AssemblyHandler.FindFirstTypeForName(type);
|
realType = AssemblyHandler.FindFirstTypeForName(type);
|
||||||
|
}
|
||||||
|
|
||||||
Details = new SmallBulkEntry(realType, reader.ReadInt(), reader.ReadInt());
|
Details = new SmallBulkEntry(realType, reader.ReadInt(), reader.ReadInt());
|
||||||
}
|
}
|
||||||
|
|
@ -92,10 +94,14 @@ namespace Server.Engines.BulkOrders
|
||||||
m_Cache ??= new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
|
m_Cache ??= new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
|
||||||
|
|
||||||
if (!m_Cache.TryGetValue(type, out var table))
|
if (!m_Cache.TryGetValue(type, out var table))
|
||||||
|
{
|
||||||
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
|
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
|
||||||
|
}
|
||||||
|
|
||||||
if (!table.TryGetValue(name, out var entries))
|
if (!table.TryGetValue(name, out var entries))
|
||||||
|
{
|
||||||
table[name] = entries = SmallBulkEntry.LoadEntries(type, name);
|
table[name] = entries = SmallBulkEntry.LoadEntries(type, name);
|
||||||
|
}
|
||||||
|
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
@ -105,7 +111,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var large = new LargeBulkEntry[small.Length];
|
var large = new LargeBulkEntry[small.Length];
|
||||||
|
|
||||||
for (var i = 0; i < small.Length; ++i)
|
for (var i = 0; i < small.Length; ++i)
|
||||||
|
{
|
||||||
large[i] = new LargeBulkEntry(owner, small[i]);
|
large[i] = new LargeBulkEntry(owner, small[i]);
|
||||||
|
}
|
||||||
|
|
||||||
return large;
|
return large;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,9 @@ namespace Server.Engines.BulkOrders
|
||||||
};
|
};
|
||||||
|
|
||||||
if (rand > 2 && rand < 8)
|
if (rand > 2 && rand < 8)
|
||||||
|
{
|
||||||
useMaterials = false;
|
useMaterials = false;
|
||||||
|
}
|
||||||
|
|
||||||
var hue = 0x44E;
|
var hue = 0x44E;
|
||||||
var amountMax = Utility.RandomList(10, 15, 20, 20);
|
var amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,12 @@ namespace Server.Engines.BulkOrders
|
||||||
public bool Contains(Type type)
|
public bool Contains(Type type)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < Types.Length; ++i)
|
for (var i = 0; i < Types.Length; ++i)
|
||||||
|
{
|
||||||
if (Types[i] == type)
|
if (Types[i] == type)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -70,14 +74,21 @@ namespace Server.Engines.BulkOrders
|
||||||
public RewardItem AcquireItem()
|
public RewardItem AcquireItem()
|
||||||
{
|
{
|
||||||
if (Items.Length == 0)
|
if (Items.Length == 0)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (Items.Length == 1)
|
if (Items.Length == 1)
|
||||||
|
{
|
||||||
return Items[0];
|
return Items[0];
|
||||||
|
}
|
||||||
|
|
||||||
var totalWeight = 0;
|
var totalWeight = 0;
|
||||||
|
|
||||||
for (var i = 0; i < Items.Length; ++i)
|
for (var i = 0; i < Items.Length; ++i)
|
||||||
|
{
|
||||||
totalWeight += Items[i].Weight;
|
totalWeight += Items[i].Weight;
|
||||||
|
}
|
||||||
|
|
||||||
var randomWeight = Utility.Random(totalWeight);
|
var randomWeight = Utility.Random(totalWeight);
|
||||||
|
|
||||||
|
|
@ -86,7 +97,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var item = Items[i];
|
var item = Items[i];
|
||||||
|
|
||||||
if (randomWeight < item.Weight)
|
if (randomWeight < item.Weight)
|
||||||
|
{
|
||||||
return item;
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
randomWeight -= item.Weight;
|
randomWeight -= item.Weight;
|
||||||
}
|
}
|
||||||
|
|
@ -159,7 +172,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var group = Groups[i];
|
var group = Groups[i];
|
||||||
|
|
||||||
if (points >= group.Points)
|
if (points >= group.Points)
|
||||||
return group;
|
{
|
||||||
|
return @group;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Groups[0];
|
return Groups[0];
|
||||||
|
|
@ -168,8 +183,12 @@ namespace Server.Engines.BulkOrders
|
||||||
public virtual int LookupTypePoints(RewardType[] types, Type type)
|
public virtual int LookupTypePoints(RewardType[] types, Type type)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < types.Length; ++i)
|
for (var i = 0; i < types.Length; ++i)
|
||||||
|
{
|
||||||
if (types[i].Contains(type))
|
if (types[i].Contains(type))
|
||||||
|
{
|
||||||
return types[i].Points;
|
return types[i].Points;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -394,20 +413,32 @@ namespace Server.Engines.BulkOrders
|
||||||
var points = 0;
|
var points = 0;
|
||||||
|
|
||||||
if (quantity == 10)
|
if (quantity == 10)
|
||||||
|
{
|
||||||
points += 10;
|
points += 10;
|
||||||
|
}
|
||||||
else if (quantity == 15)
|
else if (quantity == 15)
|
||||||
|
{
|
||||||
points += 25;
|
points += 25;
|
||||||
|
}
|
||||||
else if (quantity == 20)
|
else if (quantity == 20)
|
||||||
|
{
|
||||||
points += 50;
|
points += 50;
|
||||||
|
}
|
||||||
|
|
||||||
if (exceptional)
|
if (exceptional)
|
||||||
|
{
|
||||||
points += 200;
|
points += 200;
|
||||||
|
}
|
||||||
|
|
||||||
if (itemCount > 1)
|
if (itemCount > 1)
|
||||||
|
{
|
||||||
points += LookupTypePoints(m_Types, type);
|
points += LookupTypePoints(m_Types, type);
|
||||||
|
}
|
||||||
|
|
||||||
if (material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite)
|
if (material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite)
|
||||||
|
{
|
||||||
points += 200 + 50 * (material - BulkMaterialType.DullCopper);
|
points += 200 + 50 * (material - BulkMaterialType.DullCopper);
|
||||||
|
}
|
||||||
|
|
||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
@ -416,18 +447,26 @@ namespace Server.Engines.BulkOrders
|
||||||
{
|
{
|
||||||
// Item count of 1 means it's a small BOD.
|
// Item count of 1 means it's a small BOD.
|
||||||
if (itemCount == 1)
|
if (itemCount == 1)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
var typeIdx = 0;
|
var typeIdx = 0;
|
||||||
|
|
||||||
// Loop through the RewardTypes defined earlier and find the correct one.
|
// Loop through the RewardTypes defined earlier and find the correct one.
|
||||||
for (; typeIdx < 7; ++typeIdx)
|
for (; typeIdx < 7; ++typeIdx)
|
||||||
|
{
|
||||||
if (m_Types[typeIdx].Contains(type))
|
if (m_Types[typeIdx].Contains(type))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Types 5, 6 and 7 are Large Weapon BODs with the same rewards.
|
// Types 5, 6 and 7 are Large Weapon BODs with the same rewards.
|
||||||
if (typeIdx > 5)
|
if (typeIdx > 5)
|
||||||
|
{
|
||||||
typeIdx = 5;
|
typeIdx = 5;
|
||||||
|
}
|
||||||
|
|
||||||
return (typeIdx + 1) * 2;
|
return (typeIdx + 1) * 2;
|
||||||
}
|
}
|
||||||
|
|
@ -449,7 +488,9 @@ namespace Server.Engines.BulkOrders
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
if (exceptional)
|
if (exceptional)
|
||||||
|
{
|
||||||
typeIndex++;
|
typeIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
var gold = goldTable[typeIndex][quanIndex][mtrlIndex];
|
var gold = goldTable[typeIndex][quanIndex][mtrlIndex];
|
||||||
|
|
||||||
|
|
@ -483,7 +524,9 @@ namespace Server.Engines.BulkOrders
|
||||||
private static Item CreateRunicHammer(int type)
|
private static Item CreateRunicHammer(int type)
|
||||||
{
|
{
|
||||||
if (type >= 1 && type <= 8)
|
if (type >= 1 && type <= 8)
|
||||||
|
{
|
||||||
return new RunicHammer(CraftResource.Iron + type, Core.AOS ? 55 - type * 5 : 50);
|
return new RunicHammer(CraftResource.Iron + type, Core.AOS ? 55 - type * 5 : 50);
|
||||||
|
}
|
||||||
|
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
}
|
}
|
||||||
|
|
@ -491,7 +534,9 @@ namespace Server.Engines.BulkOrders
|
||||||
private static Item CreatePowerScroll(int type)
|
private static Item CreatePowerScroll(int type)
|
||||||
{
|
{
|
||||||
if (type == 5 || type == 10 || type == 15 || type == 20)
|
if (type == 5 || type == 10 || type == 15 || type == 20)
|
||||||
|
{
|
||||||
return new PowerScroll(SkillName.Blacksmith, 100 + type);
|
return new PowerScroll(SkillName.Blacksmith, 100 + type);
|
||||||
|
}
|
||||||
|
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
}
|
}
|
||||||
|
|
@ -501,7 +546,9 @@ namespace Server.Engines.BulkOrders
|
||||||
private static Item CreateAncientHammer(int type)
|
private static Item CreateAncientHammer(int type)
|
||||||
{
|
{
|
||||||
if (type == 10 || type == 15 || type == 30 || type == 60)
|
if (type == 10 || type == 15 || type == 30 || type == 60)
|
||||||
|
{
|
||||||
return new AncientSmithyHammer(type);
|
return new AncientSmithyHammer(type);
|
||||||
|
}
|
||||||
|
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
}
|
}
|
||||||
|
|
@ -669,28 +716,48 @@ namespace Server.Engines.BulkOrders
|
||||||
var points = 0;
|
var points = 0;
|
||||||
|
|
||||||
if (quantity == 10)
|
if (quantity == 10)
|
||||||
|
{
|
||||||
points += 10;
|
points += 10;
|
||||||
|
}
|
||||||
else if (quantity == 15)
|
else if (quantity == 15)
|
||||||
|
{
|
||||||
points += 25;
|
points += 25;
|
||||||
|
}
|
||||||
else if (quantity == 20)
|
else if (quantity == 20)
|
||||||
|
{
|
||||||
points += 50;
|
points += 50;
|
||||||
|
}
|
||||||
|
|
||||||
if (exceptional)
|
if (exceptional)
|
||||||
|
{
|
||||||
points += 100;
|
points += 100;
|
||||||
|
}
|
||||||
|
|
||||||
if (itemCount == 4)
|
if (itemCount == 4)
|
||||||
|
{
|
||||||
points += 300;
|
points += 300;
|
||||||
|
}
|
||||||
else if (itemCount == 5)
|
else if (itemCount == 5)
|
||||||
|
{
|
||||||
points += 400;
|
points += 400;
|
||||||
|
}
|
||||||
else if (itemCount == 6)
|
else if (itemCount == 6)
|
||||||
|
{
|
||||||
points += 500;
|
points += 500;
|
||||||
|
}
|
||||||
|
|
||||||
if (material == BulkMaterialType.Spined)
|
if (material == BulkMaterialType.Spined)
|
||||||
|
{
|
||||||
points += 50;
|
points += 50;
|
||||||
|
}
|
||||||
else if (material == BulkMaterialType.Horned)
|
else if (material == BulkMaterialType.Horned)
|
||||||
|
{
|
||||||
points += 100;
|
points += 100;
|
||||||
|
}
|
||||||
else if (material == BulkMaterialType.Barbed)
|
else if (material == BulkMaterialType.Barbed)
|
||||||
|
{
|
||||||
points += 150;
|
points += 150;
|
||||||
|
}
|
||||||
|
|
||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
@ -733,7 +800,9 @@ namespace Server.Engines.BulkOrders
|
||||||
private static Item CreateCloth(int type)
|
private static Item CreateCloth(int type)
|
||||||
{
|
{
|
||||||
if (type >= 0 && type < m_ClothHues.Length)
|
if (type >= 0 && type < m_ClothHues.Length)
|
||||||
|
{
|
||||||
return new UncutCloth(100) { Hue = m_ClothHues[type].RandomElement() };
|
return new UncutCloth(100) { Hue = m_ClothHues[type].RandomElement() };
|
||||||
|
}
|
||||||
|
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
}
|
}
|
||||||
|
|
@ -770,7 +839,9 @@ namespace Server.Engines.BulkOrders
|
||||||
private static Item CreateRunicKit(int type)
|
private static Item CreateRunicKit(int type)
|
||||||
{
|
{
|
||||||
if (type >= 1 && type <= 3)
|
if (type >= 1 && type <= 3)
|
||||||
|
{
|
||||||
return new RunicSewingKit(CraftResource.RegularLeather + type, 60 - type * 15);
|
return new RunicSewingKit(CraftResource.RegularLeather + type, 60 - type * 15);
|
||||||
|
}
|
||||||
|
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
}
|
}
|
||||||
|
|
@ -778,7 +849,9 @@ namespace Server.Engines.BulkOrders
|
||||||
private static Item CreatePowerScroll(int type)
|
private static Item CreatePowerScroll(int type)
|
||||||
{
|
{
|
||||||
if (type == 5 || type == 10 || type == 15 || type == 20)
|
if (type == 5 || type == 10 || type == 15 || type == 20)
|
||||||
|
{
|
||||||
return new PowerScroll(SkillName.Tailoring, 100 + type);
|
return new PowerScroll(SkillName.Tailoring, 100 + type);
|
||||||
|
}
|
||||||
|
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,10 +68,14 @@ namespace Server.Engines.BulkOrders
|
||||||
list.Add(1060654); // small bulk order
|
list.Add(1060654); // small bulk order
|
||||||
|
|
||||||
if (RequireExceptional)
|
if (RequireExceptional)
|
||||||
|
{
|
||||||
list.Add(1045141); // All items must be exceptional.
|
list.Add(1045141); // All items must be exceptional.
|
||||||
|
}
|
||||||
|
|
||||||
if (Material != BulkMaterialType.None)
|
if (Material != BulkMaterialType.None)
|
||||||
|
{
|
||||||
list.Add(SmallBODGump.GetMaterialNumberFor(Material)); // All items must be made with x material.
|
list.Add(SmallBODGump.GetMaterialNumberFor(Material)); // All items must be made with x material.
|
||||||
|
}
|
||||||
|
|
||||||
list.Add(1060656, AmountMax.ToString()); // amount to make: ~1_val~
|
list.Add(1060656, AmountMax.ToString()); // amount to make: ~1_val~
|
||||||
list.Add(1060658, "#{0}\t{1}", m_Number, m_AmountCur); // ~1_val~: ~2_val~
|
list.Add(1060658, "#{0}\t{1}", m_Number, m_AmountCur); // ~1_val~: ~2_val~
|
||||||
|
|
@ -80,9 +84,13 @@ namespace Server.Engines.BulkOrders
|
||||||
public override void OnDoubleClick(Mobile from)
|
public override void OnDoubleClick(Mobile from)
|
||||||
{
|
{
|
||||||
if (IsChildOf(from.Backpack) || InSecureTrade || RootParent is PlayerVendor)
|
if (IsChildOf(from.Backpack) || InSecureTrade || RootParent is PlayerVendor)
|
||||||
from.SendGump(new SmallBODGump(from, this));
|
{
|
||||||
|
@from.SendGump(new SmallBODGump(@from, this));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
from.SendLocalizedMessage(1045156); // You must have the deed in your backpack to use it.
|
{
|
||||||
|
@from.SendLocalizedMessage(1045156); // You must have the deed in your backpack to use it.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnDoubleClickNotAccessible(Mobile from)
|
public override void OnDoubleClickNotAccessible(Mobile from)
|
||||||
|
|
@ -151,11 +159,17 @@ namespace Server.Engines.BulkOrders
|
||||||
bool isExceptional;
|
bool isExceptional;
|
||||||
|
|
||||||
if (item is BaseWeapon weapon)
|
if (item is BaseWeapon weapon)
|
||||||
|
{
|
||||||
isExceptional = weapon.Quality == WeaponQuality.Exceptional;
|
isExceptional = weapon.Quality == WeaponQuality.Exceptional;
|
||||||
|
}
|
||||||
else if (armor != null)
|
else if (armor != null)
|
||||||
|
{
|
||||||
isExceptional = armor.Quality == ArmorQuality.Exceptional;
|
isExceptional = armor.Quality == ArmorQuality.Exceptional;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
isExceptional = clothing.Quality == ClothingQuality.Exceptional;
|
isExceptional = clothing.Quality == ClothingQuality.Exceptional;
|
||||||
|
}
|
||||||
|
|
||||||
if (RequireExceptional && !isExceptional)
|
if (RequireExceptional && !isExceptional)
|
||||||
{
|
{
|
||||||
|
|
@ -170,7 +184,9 @@ namespace Server.Engines.BulkOrders
|
||||||
from.SendGump(new SmallBODGump(from, this));
|
from.SendGump(new SmallBODGump(from, this));
|
||||||
|
|
||||||
if (m_AmountCur < AmountMax)
|
if (m_AmountCur < AmountMax)
|
||||||
BeginCombine(from);
|
{
|
||||||
|
BeginCombine(@from);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -203,7 +219,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var type = reader.ReadString();
|
var type = reader.ReadString();
|
||||||
|
|
||||||
if (type != null)
|
if (type != null)
|
||||||
|
{
|
||||||
Type = AssemblyHandler.FindFirstTypeForName(type);
|
Type = AssemblyHandler.FindFirstTypeForName(type);
|
||||||
|
}
|
||||||
|
|
||||||
m_Number = reader.ReadInt();
|
m_Number = reader.ReadInt();
|
||||||
Graphic = reader.ReadInt();
|
Graphic = reader.ReadInt();
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,12 @@ namespace Server.Engines.BulkOrders
|
||||||
AddHtmlLocalized(40, 144, 210, 20, 1045140, 0x7FFF); // Special requirements to meet:
|
AddHtmlLocalized(40, 144, 210, 20, 1045140, 0x7FFF); // Special requirements to meet:
|
||||||
|
|
||||||
if (deed.RequireExceptional)
|
if (deed.RequireExceptional)
|
||||||
|
{
|
||||||
AddHtmlLocalized(40, 168, 350, 20, 1045141, 0x7FFF); // All items must be exceptional.
|
AddHtmlLocalized(40, 168, 350, 20, 1045141, 0x7FFF); // All items must be exceptional.
|
||||||
|
}
|
||||||
|
|
||||||
if (deed.Material != BulkMaterialType.None)
|
if (deed.Material != BulkMaterialType.None)
|
||||||
|
{
|
||||||
AddHtmlLocalized(
|
AddHtmlLocalized(
|
||||||
40,
|
40,
|
||||||
deed.RequireExceptional ? 192 : 168,
|
deed.RequireExceptional ? 192 : 168,
|
||||||
|
|
@ -54,6 +57,7 @@ namespace Server.Engines.BulkOrders
|
||||||
GetMaterialNumberFor(deed.Material),
|
GetMaterialNumberFor(deed.Material),
|
||||||
0x7FFF
|
0x7FFF
|
||||||
); // All items must be made with x material.
|
); // All items must be made with x material.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AddHtmlLocalized(40, 216, 350, 20, 1045139, 0x7FFF); // Do you want to accept this order?
|
AddHtmlLocalized(40, 216, 350, 20, 1045139, 0x7FFF); // Do you want to accept this order?
|
||||||
|
|
@ -88,15 +92,22 @@ namespace Server.Engines.BulkOrders
|
||||||
public override void OnServerClose(NetState owner)
|
public override void OnServerClose(NetState owner)
|
||||||
{
|
{
|
||||||
if (m_Deed?.Deleted == false)
|
if (m_Deed?.Deleted == false)
|
||||||
|
{
|
||||||
m_Deed.Delete();
|
m_Deed.Delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetMaterialNumberFor(BulkMaterialType material)
|
public static int GetMaterialNumberFor(BulkMaterialType material)
|
||||||
{
|
{
|
||||||
if (material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite)
|
if (material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite)
|
||||||
|
{
|
||||||
return 1045142 + (material - BulkMaterialType.DullCopper);
|
return 1045142 + (material - BulkMaterialType.DullCopper);
|
||||||
|
}
|
||||||
|
|
||||||
if (material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed)
|
if (material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed)
|
||||||
|
{
|
||||||
return 1049348 + (material - BulkMaterialType.Spined);
|
return 1049348 + (material - BulkMaterialType.Spined);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,12 +41,17 @@ namespace Server.Engines.BulkOrders
|
||||||
AddLabel(275, 96, 0x480, deed.AmountCur.ToString());
|
AddLabel(275, 96, 0x480, deed.AmountCur.ToString());
|
||||||
|
|
||||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||||
|
{
|
||||||
AddHtmlLocalized(75, 120, 200, 20, 1045140, 0x7FFF); // Special requirements to meet:
|
AddHtmlLocalized(75, 120, 200, 20, 1045140, 0x7FFF); // Special requirements to meet:
|
||||||
|
}
|
||||||
|
|
||||||
if (deed.RequireExceptional)
|
if (deed.RequireExceptional)
|
||||||
|
{
|
||||||
AddHtmlLocalized(75, 144, 300, 20, 1045141, 0x7FFF); // All items must be exceptional.
|
AddHtmlLocalized(75, 144, 300, 20, 1045141, 0x7FFF); // All items must be exceptional.
|
||||||
|
}
|
||||||
|
|
||||||
if (deed.Material != BulkMaterialType.None)
|
if (deed.Material != BulkMaterialType.None)
|
||||||
|
{
|
||||||
AddHtmlLocalized(
|
AddHtmlLocalized(
|
||||||
75,
|
75,
|
||||||
deed.RequireExceptional ? 168 : 144,
|
deed.RequireExceptional ? 168 : 144,
|
||||||
|
|
@ -55,6 +60,7 @@ namespace Server.Engines.BulkOrders
|
||||||
GetMaterialNumberFor(deed.Material),
|
GetMaterialNumberFor(deed.Material),
|
||||||
0x7FFF
|
0x7FFF
|
||||||
); // All items must be made with x material.
|
); // All items must be made with x material.
|
||||||
|
}
|
||||||
|
|
||||||
AddButton(125, 192, 4005, 4007, 2);
|
AddButton(125, 192, 4005, 4007, 2);
|
||||||
AddHtmlLocalized(160, 192, 300, 20, 1045154, 0x7FFF); // Combine this deed with the item requested.
|
AddHtmlLocalized(160, 192, 300, 20, 1045154, 0x7FFF); // Combine this deed with the item requested.
|
||||||
|
|
@ -66,7 +72,9 @@ namespace Server.Engines.BulkOrders
|
||||||
public override void OnResponse(NetState sender, RelayInfo info)
|
public override void OnResponse(NetState sender, RelayInfo info)
|
||||||
{
|
{
|
||||||
if (m_Deed.Deleted || !m_Deed.IsChildOf(m_From.Backpack))
|
if (m_Deed.Deleted || !m_Deed.IsChildOf(m_From.Backpack))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (info.ButtonID == 2) // Combine
|
if (info.ButtonID == 2) // Combine
|
||||||
{
|
{
|
||||||
|
|
@ -78,9 +86,14 @@ namespace Server.Engines.BulkOrders
|
||||||
public static int GetMaterialNumberFor(BulkMaterialType material)
|
public static int GetMaterialNumberFor(BulkMaterialType material)
|
||||||
{
|
{
|
||||||
if (material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite)
|
if (material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite)
|
||||||
|
{
|
||||||
return 1045142 + (material - BulkMaterialType.DullCopper);
|
return 1045142 + (material - BulkMaterialType.DullCopper);
|
||||||
|
}
|
||||||
|
|
||||||
if (material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed)
|
if (material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed)
|
||||||
|
{
|
||||||
return 1049348 + (material - BulkMaterialType.Spined);
|
return 1049348 + (material - BulkMaterialType.Spined);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,19 @@ namespace Server.Engines.BulkOrders
|
||||||
public static SmallBulkEntry[] GetEntries(string type, string name)
|
public static SmallBulkEntry[] GetEntries(string type, string name)
|
||||||
{
|
{
|
||||||
if (m_Cache == null)
|
if (m_Cache == null)
|
||||||
|
{
|
||||||
m_Cache = new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
|
m_Cache = new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_Cache.TryGetValue(type, out var table))
|
if (!m_Cache.TryGetValue(type, out var table))
|
||||||
|
{
|
||||||
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
|
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
|
||||||
|
}
|
||||||
|
|
||||||
if (!table.TryGetValue(name, out var entries))
|
if (!table.TryGetValue(name, out var entries))
|
||||||
|
{
|
||||||
table[name] = entries = LoadEntries(type, name);
|
table[name] = entries = LoadEntries(type, name);
|
||||||
|
}
|
||||||
|
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
@ -60,7 +66,9 @@ namespace Server.Engines.BulkOrders
|
||||||
while ((line = ip.ReadLine()) != null)
|
while ((line = ip.ReadLine()) != null)
|
||||||
{
|
{
|
||||||
if (line.Length == 0 || line.StartsWith("#"))
|
if (line.Length == 0 || line.StartsWith("#"))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -72,6 +80,7 @@ namespace Server.Engines.BulkOrders
|
||||||
var graphic = Utility.ToInt32(split[^1]);
|
var graphic = Utility.ToInt32(split[^1]);
|
||||||
|
|
||||||
if (type != null && graphic > 0)
|
if (type != null && graphic > 0)
|
||||||
|
{
|
||||||
list.Add(
|
list.Add(
|
||||||
new SmallBulkEntry(
|
new SmallBulkEntry(
|
||||||
type,
|
type,
|
||||||
|
|
@ -79,6 +88,7 @@ namespace Server.Engines.BulkOrders
|
||||||
graphic
|
graphic
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var entries = useMaterials ? SmallBulkEntry.BlacksmithArmor : SmallBulkEntry.BlacksmithWeapons;
|
var entries = useMaterials ? SmallBulkEntry.BlacksmithArmor : SmallBulkEntry.BlacksmithWeapons;
|
||||||
|
|
||||||
if (entries.Length <= 0)
|
if (entries.Length <= 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var hue = 0x44E;
|
var hue = 0x44E;
|
||||||
var amountMax = Utility.RandomList(10, 15, 20);
|
var amountMax = Utility.RandomList(10, 15, 20);
|
||||||
|
|
@ -79,21 +81,30 @@ namespace Server.Engines.BulkOrders
|
||||||
var entries = useMaterials ? SmallBulkEntry.BlacksmithArmor : SmallBulkEntry.BlacksmithWeapons;
|
var entries = useMaterials ? SmallBulkEntry.BlacksmithArmor : SmallBulkEntry.BlacksmithWeapons;
|
||||||
|
|
||||||
if (entries.Length <= 0)
|
if (entries.Length <= 0)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var theirSkill = m.Skills.Blacksmith.Base;
|
var theirSkill = m.Skills.Blacksmith.Base;
|
||||||
int amountMax;
|
int amountMax;
|
||||||
|
|
||||||
if (theirSkill >= 70.1)
|
if (theirSkill >= 70.1)
|
||||||
|
{
|
||||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||||
|
}
|
||||||
else if (theirSkill >= 50.1)
|
else if (theirSkill >= 50.1)
|
||||||
|
{
|
||||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||||
|
}
|
||||||
|
|
||||||
var material = BulkMaterialType.None;
|
var material = BulkMaterialType.None;
|
||||||
|
|
||||||
if (useMaterials && theirSkill >= 70.1)
|
if (useMaterials && theirSkill >= 70.1)
|
||||||
|
{
|
||||||
for (var i = 0; i < 20; ++i)
|
for (var i = 0; i < 20; ++i)
|
||||||
{
|
{
|
||||||
var check = GetRandomMaterial(BulkMaterialType.DullCopper, m_BlacksmithMaterialChances);
|
var check = GetRandomMaterial(BulkMaterialType.DullCopper, m_BlacksmithMaterialChances);
|
||||||
|
|
@ -120,6 +131,7 @@ namespace Server.Engines.BulkOrders
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var excChance = theirSkill >= 70.1 ? (theirSkill + 80.0) / 200.0 : 0.0;
|
var excChance = theirSkill >= 70.1 ? (theirSkill + 80.0) / 200.0 : 0.0;
|
||||||
|
|
||||||
|
|
@ -141,16 +153,22 @@ namespace Server.Engines.BulkOrders
|
||||||
if (allRequiredSkills && chance >= 0.0)
|
if (allRequiredSkills && chance >= 0.0)
|
||||||
{
|
{
|
||||||
if (reqExceptional)
|
if (reqExceptional)
|
||||||
|
{
|
||||||
chance = item.GetExceptionalChance(system, chance, m);
|
chance = item.GetExceptionalChance(system, chance, m);
|
||||||
|
}
|
||||||
|
|
||||||
if (chance > 0.0)
|
if (chance > 0.0)
|
||||||
|
{
|
||||||
validEntries.Add(entries[i]);
|
validEntries.Add(entries[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (validEntries.Count <= 0)
|
if (validEntries.Count <= 0)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var entry = validEntries.RandomElement();
|
var entry = validEntries.RandomElement();
|
||||||
return new SmallSmithBOD(entry, material, amountMax, reqExceptional);
|
return new SmallSmithBOD(entry, material, amountMax, reqExceptional);
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,9 @@ namespace Server.Engines.BulkOrders
|
||||||
var entries = useMaterials ? SmallBulkEntry.TailorLeather : SmallBulkEntry.TailorCloth;
|
var entries = useMaterials ? SmallBulkEntry.TailorLeather : SmallBulkEntry.TailorCloth;
|
||||||
|
|
||||||
if (entries.Length <= 0)
|
if (entries.Length <= 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var hue = 0x483;
|
var hue = 0x483;
|
||||||
var amountMax = Utility.RandomList(10, 15, 20);
|
var amountMax = Utility.RandomList(10, 15, 20);
|
||||||
|
|
@ -74,24 +76,35 @@ namespace Server.Engines.BulkOrders
|
||||||
|
|
||||||
// Ugly, but the easiest leather BOD is Leather Cap which requires at least 6.2 skill.
|
// Ugly, but the easiest leather BOD is Leather Cap which requires at least 6.2 skill.
|
||||||
if (useMaterials && theirSkill >= 6.2)
|
if (useMaterials && theirSkill >= 6.2)
|
||||||
|
{
|
||||||
entries = SmallBulkEntry.TailorLeather;
|
entries = SmallBulkEntry.TailorLeather;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
entries = SmallBulkEntry.TailorCloth;
|
entries = SmallBulkEntry.TailorCloth;
|
||||||
|
}
|
||||||
|
|
||||||
if (entries.Length > 0)
|
if (entries.Length > 0)
|
||||||
{
|
{
|
||||||
int amountMax;
|
int amountMax;
|
||||||
|
|
||||||
if (theirSkill >= 70.1)
|
if (theirSkill >= 70.1)
|
||||||
|
{
|
||||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||||
|
}
|
||||||
else if (theirSkill >= 50.1)
|
else if (theirSkill >= 50.1)
|
||||||
|
{
|
||||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||||
|
}
|
||||||
|
|
||||||
var material = BulkMaterialType.None;
|
var material = BulkMaterialType.None;
|
||||||
|
|
||||||
if (useMaterials && theirSkill >= 70.1)
|
if (useMaterials && theirSkill >= 70.1)
|
||||||
|
{
|
||||||
for (var i = 0; i < 20; ++i)
|
for (var i = 0; i < 20; ++i)
|
||||||
{
|
{
|
||||||
var check = GetRandomMaterial(BulkMaterialType.Spined, m_TailoringMaterialChances);
|
var check = GetRandomMaterial(BulkMaterialType.Spined, m_TailoringMaterialChances);
|
||||||
|
|
@ -116,11 +129,14 @@ namespace Server.Engines.BulkOrders
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var excChance = 0.0;
|
var excChance = 0.0;
|
||||||
|
|
||||||
if (theirSkill >= 70.1)
|
if (theirSkill >= 70.1)
|
||||||
|
{
|
||||||
excChance = (theirSkill + 80.0) / 200.0;
|
excChance = (theirSkill + 80.0) / 200.0;
|
||||||
|
}
|
||||||
|
|
||||||
var reqExceptional = excChance > Utility.RandomDouble();
|
var reqExceptional = excChance > Utility.RandomDouble();
|
||||||
|
|
||||||
|
|
@ -140,10 +156,14 @@ namespace Server.Engines.BulkOrders
|
||||||
if (allRequiredSkills && chance >= 0.0)
|
if (allRequiredSkills && chance >= 0.0)
|
||||||
{
|
{
|
||||||
if (reqExceptional)
|
if (reqExceptional)
|
||||||
|
{
|
||||||
chance = item.GetExceptionalChance(system, chance, m);
|
chance = item.GetExceptionalChance(system, chance, m);
|
||||||
|
}
|
||||||
|
|
||||||
if (chance > 0.0)
|
if (chance > 0.0)
|
||||||
|
{
|
||||||
validEntries.Add(entries[i]);
|
validEntries.Add(entries[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,9 @@ namespace Server.Engines.CannedEvil
|
||||||
m_Spawn = reader.ReadItem() as ChampionSpawn;
|
m_Spawn = reader.ReadItem() as ChampionSpawn;
|
||||||
|
|
||||||
if (m_Spawn == null)
|
if (m_Spawn == null)
|
||||||
|
{
|
||||||
Delete();
|
Delete();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,20 @@ namespace Server.Engines.CannedEvil
|
||||||
m_Spawn = spawn;
|
m_Spawn = spawn;
|
||||||
|
|
||||||
for (var x = -2; x <= 2; ++x)
|
for (var x = -2; x <= 2; ++x)
|
||||||
|
{
|
||||||
for (var y = -2; y <= 2; ++y)
|
for (var y = -2; y <= 2; ++y)
|
||||||
|
{
|
||||||
AddComponent(0x750, x, y, -5);
|
AddComponent(0x750, x, y, -5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (var x = -1; x <= 1; ++x)
|
for (var x = -1; x <= 1; ++x)
|
||||||
|
{
|
||||||
for (var y = -1; y <= 1; ++y)
|
for (var y = -1; y <= 1; ++y)
|
||||||
|
{
|
||||||
AddComponent(0x750, x, y, 0);
|
AddComponent(0x750, x, y, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = -1; i <= 1; ++i)
|
for (var i = -1; i <= 1; ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -75,7 +83,9 @@ namespace Server.Engines.CannedEvil
|
||||||
m_Spawn = reader.ReadItem() as ChampionSpawn;
|
m_Spawn = reader.ReadItem() as ChampionSpawn;
|
||||||
|
|
||||||
if (m_Spawn == null)
|
if (m_Spawn == null)
|
||||||
|
{
|
||||||
Delete();
|
Delete();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,10 +70,14 @@ namespace Server.Items
|
||||||
if (version == 0)
|
if (version == 0)
|
||||||
{
|
{
|
||||||
if (LootType != LootType.Cursed)
|
if (LootType != LootType.Cursed)
|
||||||
|
{
|
||||||
LootType = LootType.Cursed;
|
LootType = LootType.Cursed;
|
||||||
|
}
|
||||||
|
|
||||||
if (Insured)
|
if (Insured)
|
||||||
|
{
|
||||||
Insured = false;
|
Insured = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,10 +59,14 @@ namespace Server.Engines.CannedEvil
|
||||||
public void BeginSacrifice(Mobile from)
|
public void BeginSacrifice(Mobile from)
|
||||||
{
|
{
|
||||||
if (Deleted)
|
if (Deleted)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Skull?.Deleted == true)
|
if (m_Skull?.Deleted == true)
|
||||||
|
{
|
||||||
Skull = null;
|
Skull = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (from.Map != Map || !from.InRange(GetWorldLocation(), 3))
|
if (from.Map != Map || !from.InRange(GetWorldLocation(), 3))
|
||||||
{
|
{
|
||||||
|
|
@ -86,10 +90,14 @@ namespace Server.Engines.CannedEvil
|
||||||
public void EndSacrifice(Mobile from, ChampionSkull skull)
|
public void EndSacrifice(Mobile from, ChampionSkull skull)
|
||||||
{
|
{
|
||||||
if (Deleted)
|
if (Deleted)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Skull?.Deleted == true)
|
if (m_Skull?.Deleted == true)
|
||||||
|
{
|
||||||
Skull = null;
|
Skull = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (from.Map != Map || !from.InRange(GetWorldLocation(), 3))
|
if (from.Map != Map || !from.InRange(GetWorldLocation(), 3))
|
||||||
{
|
{
|
||||||
|
|
@ -153,17 +161,23 @@ namespace Server.Engines.CannedEvil
|
||||||
m_Skull = reader.ReadItem();
|
m_Skull = reader.ReadItem();
|
||||||
|
|
||||||
if (Platform == null)
|
if (Platform == null)
|
||||||
|
{
|
||||||
Delete();
|
Delete();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Hue == 0x497)
|
if (Hue == 0x497)
|
||||||
|
{
|
||||||
Hue = 0x455;
|
Hue = 0x455;
|
||||||
|
}
|
||||||
|
|
||||||
if (Light != LightType.Circle300)
|
if (Light != LightType.Circle300)
|
||||||
|
{
|
||||||
Light = LightType.Circle300;
|
Light = LightType.Circle300;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SacrificeTarget : Target
|
private class SacrificeTarget : Target
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,9 @@ namespace Server.Engines.CannedEvil
|
||||||
Mobile harrower = Harrower.Spawn(new Point3D(X, Y, Z + 6), Map);
|
Mobile harrower = Harrower.Spawn(new Point3D(X, Y, Z + 6), Map);
|
||||||
|
|
||||||
if (harrower == null)
|
if (harrower == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Clear(m_Power);
|
Clear(m_Power);
|
||||||
Clear(m_Enlightenment);
|
Clear(m_Enlightenment);
|
||||||
|
|
|
||||||
|
|
@ -129,9 +129,13 @@ namespace Server.Engines.CannedEvil
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value)
|
if (value)
|
||||||
|
{
|
||||||
Start();
|
Start();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
Stop();
|
Stop();
|
||||||
|
}
|
||||||
|
|
||||||
InvalidateProperties();
|
InvalidateProperties();
|
||||||
}
|
}
|
||||||
|
|
@ -230,7 +234,9 @@ namespace Server.Engines.CannedEvil
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
if (m_Active || Deleted)
|
if (m_Active || Deleted)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_Active = true;
|
m_Active = true;
|
||||||
HasBeenAdvanced = false;
|
HasBeenAdvanced = false;
|
||||||
|
|
@ -247,19 +253,27 @@ namespace Server.Engines.CannedEvil
|
||||||
if (m_Altar != null)
|
if (m_Altar != null)
|
||||||
{
|
{
|
||||||
if (Champion != null)
|
if (Champion != null)
|
||||||
|
{
|
||||||
m_Altar.Hue = 0x26;
|
m_Altar.Hue = 0x26;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_Altar.Hue = 0;
|
m_Altar.Hue = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Platform != null)
|
if (m_Platform != null)
|
||||||
|
{
|
||||||
m_Platform.Hue = 0x452;
|
m_Platform.Hue = 0x452;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
if (!m_Active || Deleted)
|
if (!m_Active || Deleted)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_Active = false;
|
m_Active = false;
|
||||||
HasBeenAdvanced = false;
|
HasBeenAdvanced = false;
|
||||||
|
|
@ -273,10 +287,14 @@ namespace Server.Engines.CannedEvil
|
||||||
m_RestartTimer = null;
|
m_RestartTimer = null;
|
||||||
|
|
||||||
if (m_Altar != null)
|
if (m_Altar != null)
|
||||||
|
{
|
||||||
m_Altar.Hue = 0;
|
m_Altar.Hue = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Platform != null)
|
if (m_Platform != null)
|
||||||
|
{
|
||||||
m_Platform.Hue = 0x497;
|
m_Platform.Hue = 0x497;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BeginRestart(TimeSpan ts)
|
public void BeginRestart(TimeSpan ts)
|
||||||
|
|
@ -292,6 +310,7 @@ namespace Server.Engines.CannedEvil
|
||||||
public void EndRestart()
|
public void EndRestart()
|
||||||
{
|
{
|
||||||
if (RandomizeType)
|
if (RandomizeType)
|
||||||
|
{
|
||||||
Type = Utility.Random(5) switch
|
Type = Utility.Random(5) switch
|
||||||
{
|
{
|
||||||
0 => ChampionSpawnType.VerminHorde,
|
0 => ChampionSpawnType.VerminHorde,
|
||||||
|
|
@ -301,6 +320,7 @@ namespace Server.Engines.CannedEvil
|
||||||
4 => ChampionSpawnType.Arachnid,
|
4 => ChampionSpawnType.Arachnid,
|
||||||
_ => Type
|
_ => Type
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
HasBeenAdvanced = false;
|
HasBeenAdvanced = false;
|
||||||
|
|
||||||
|
|
@ -312,7 +332,9 @@ namespace Server.Engines.CannedEvil
|
||||||
var level = Utility.RandomMinMax(1, 5);
|
var level = Utility.RandomMinMax(1, 5);
|
||||||
|
|
||||||
if (felucca)
|
if (felucca)
|
||||||
|
{
|
||||||
level += 5;
|
level += 5;
|
||||||
|
}
|
||||||
|
|
||||||
return ScrollofTranscendence.CreateRandom(level, level);
|
return ScrollofTranscendence.CreateRandom(level, level);
|
||||||
}
|
}
|
||||||
|
|
@ -320,12 +342,18 @@ namespace Server.Engines.CannedEvil
|
||||||
public static void GiveScrollTo(Mobile killer, SpecialScroll scroll)
|
public static void GiveScrollTo(Mobile killer, SpecialScroll scroll)
|
||||||
{
|
{
|
||||||
if (scroll == null || killer == null) // sanity
|
if (scroll == null || killer == null) // sanity
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (scroll is ScrollofTranscendence)
|
if (scroll is ScrollofTranscendence)
|
||||||
|
{
|
||||||
killer.SendLocalizedMessage(1094936); // You have received a Scroll of Transcendence!
|
killer.SendLocalizedMessage(1094936); // You have received a Scroll of Transcendence!
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
killer.SendLocalizedMessage(1049524); // You have received a scroll of power!
|
killer.SendLocalizedMessage(1049524); // You have received a scroll of power!
|
||||||
|
}
|
||||||
|
|
||||||
if (killer.Alive)
|
if (killer.Alive)
|
||||||
{
|
{
|
||||||
|
|
@ -334,9 +362,13 @@ namespace Server.Engines.CannedEvil
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (killer.Corpse.Deleted == false)
|
if (killer.Corpse.Deleted == false)
|
||||||
|
{
|
||||||
killer.Corpse.DropItem(scroll);
|
killer.Corpse.DropItem(scroll);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
killer.AddToBackpack(scroll);
|
killer.AddToBackpack(scroll);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Justice reward
|
// Justice reward
|
||||||
|
|
@ -347,7 +379,9 @@ namespace Server.Engines.CannedEvil
|
||||||
|
|
||||||
if (prot.Map != killer.Map || prot.Kills >= 5 || prot.Criminal ||
|
if (prot.Map != killer.Map || prot.Kills >= 5 || prot.Criminal ||
|
||||||
!JusticeVirtue.CheckMapRegion(killer, prot))
|
!JusticeVirtue.CheckMapRegion(killer, prot))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var chance = VirtueHelper.GetLevel(prot, VirtueName.Justice) switch
|
var chance = VirtueHelper.GetLevel(prot, VirtueName.Justice) switch
|
||||||
{
|
{
|
||||||
|
|
@ -358,6 +392,7 @@ namespace Server.Engines.CannedEvil
|
||||||
};
|
};
|
||||||
|
|
||||||
if (chance > Utility.Random(100))
|
if (chance > Utility.Random(100))
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!
|
prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!
|
||||||
|
|
@ -373,13 +408,16 @@ namespace Server.Engines.CannedEvil
|
||||||
{
|
{
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnSlice()
|
public void OnSlice()
|
||||||
{
|
{
|
||||||
if (!m_Active || Deleted)
|
if (!m_Active || Deleted)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Champion != null)
|
if (Champion != null)
|
||||||
{
|
{
|
||||||
|
|
@ -388,19 +426,25 @@ namespace Server.Engines.CannedEvil
|
||||||
RegisterDamageTo(Champion);
|
RegisterDamageTo(Champion);
|
||||||
|
|
||||||
if (Champion is BaseChampion champion)
|
if (Champion is BaseChampion champion)
|
||||||
|
{
|
||||||
AwardArtifact(champion.GetArtifact());
|
AwardArtifact(champion.GetArtifact());
|
||||||
|
}
|
||||||
|
|
||||||
m_DamageEntries.Clear();
|
m_DamageEntries.Clear();
|
||||||
|
|
||||||
if (m_Platform != null)
|
if (m_Platform != null)
|
||||||
|
{
|
||||||
m_Platform.Hue = 0x497;
|
m_Platform.Hue = 0x497;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Altar != null)
|
if (m_Altar != null)
|
||||||
{
|
{
|
||||||
m_Altar.Hue = 0;
|
m_Altar.Hue = 0;
|
||||||
|
|
||||||
if (!Core.ML || Map == Map.Felucca)
|
if (!Core.ML || Map == Map.Felucca)
|
||||||
|
{
|
||||||
new StarRoomGate(m_Altar.Location, m_Altar.Map, true);
|
new StarRoomGate(m_Altar.Location, m_Altar.Map, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Champion = null;
|
Champion = null;
|
||||||
|
|
@ -420,7 +464,9 @@ namespace Server.Engines.CannedEvil
|
||||||
if (m.Deleted)
|
if (m.Deleted)
|
||||||
{
|
{
|
||||||
if (m.Corpse?.Deleted == false)
|
if (m.Corpse?.Deleted == false)
|
||||||
|
{
|
||||||
((Corpse)m.Corpse).BeginDecay(TimeSpan.FromMinutes(1));
|
((Corpse)m.Corpse).BeginDecay(TimeSpan.FromMinutes(1));
|
||||||
|
}
|
||||||
|
|
||||||
m_Creatures.RemoveAt(i);
|
m_Creatures.RemoveAt(i);
|
||||||
--i;
|
--i;
|
||||||
|
|
@ -431,13 +477,16 @@ namespace Server.Engines.CannedEvil
|
||||||
RegisterDamageTo(m);
|
RegisterDamageTo(m);
|
||||||
|
|
||||||
if (killer is BaseCreature bc)
|
if (killer is BaseCreature bc)
|
||||||
|
{
|
||||||
killer = bc.GetMaster();
|
killer = bc.GetMaster();
|
||||||
|
}
|
||||||
|
|
||||||
if (killer is PlayerMobile pm)
|
if (killer is PlayerMobile pm)
|
||||||
{
|
{
|
||||||
if (Core.ML)
|
if (Core.ML)
|
||||||
{
|
{
|
||||||
if (Map == Map.Felucca)
|
if (Map == Map.Felucca)
|
||||||
|
{
|
||||||
if (Utility.RandomDouble() < 0.001)
|
if (Utility.RandomDouble() < 0.001)
|
||||||
{
|
{
|
||||||
double random = Utility.Random(49);
|
double random = Utility.Random(49);
|
||||||
|
|
@ -453,14 +502,17 @@ namespace Server.Engines.CannedEvil
|
||||||
GiveScrollTo(pm, PS);
|
GiveScrollTo(pm, PS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Map == Map.Ilshenar || Map == Map.Tokuno || Map == Map.Malas)
|
if (Map == Map.Ilshenar || Map == Map.Tokuno || Map == Map.Malas)
|
||||||
|
{
|
||||||
if (Utility.RandomDouble() < 0.0015)
|
if (Utility.RandomDouble() < 0.0015)
|
||||||
{
|
{
|
||||||
pm.SendLocalizedMessage(1094936); // You have received a Scroll of Transcendence!
|
pm.SendLocalizedMessage(1094936); // You have received a Scroll of Transcendence!
|
||||||
var SoTT = CreateRandomSoT(false);
|
var SoTT = CreateRandomSoT(false);
|
||||||
pm.AddToBackpack(SoTT);
|
pm.AddToBackpack(SoTT);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var mobSubLevel = GetSubLevelFor(m) + 1;
|
var mobSubLevel = GetSubLevelFor(m) + 1;
|
||||||
|
|
@ -474,9 +526,13 @@ namespace Server.Engines.CannedEvil
|
||||||
if (VirtueHelper.Award(pm, VirtueName.Valor, pointsToGain, ref gainedPath))
|
if (VirtueHelper.Award(pm, VirtueName.Valor, pointsToGain, ref gainedPath))
|
||||||
{
|
{
|
||||||
if (gainedPath)
|
if (gainedPath)
|
||||||
|
{
|
||||||
m.SendLocalizedMessage(1054032); // You have gained a path in Valor!
|
m.SendLocalizedMessage(1054032); // You have gained a path in Valor!
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m.SendLocalizedMessage(1054030); // You have gained in Valor!
|
m.SendLocalizedMessage(1054030); // You have gained in Valor!
|
||||||
|
}
|
||||||
|
|
||||||
// No delay on Valor gains
|
// No delay on Valor gains
|
||||||
}
|
}
|
||||||
|
|
@ -491,18 +547,26 @@ namespace Server.Engines.CannedEvil
|
||||||
|
|
||||||
// Only really needed once.
|
// Only really needed once.
|
||||||
if (m_Kills > kills)
|
if (m_Kills > kills)
|
||||||
|
{
|
||||||
InvalidateProperties();
|
InvalidateProperties();
|
||||||
|
}
|
||||||
|
|
||||||
var n = m_Kills / (double)MaxKills;
|
var n = m_Kills / (double)MaxKills;
|
||||||
var p = (int)(n * 100);
|
var p = (int)(n * 100);
|
||||||
|
|
||||||
if (p >= 90)
|
if (p >= 90)
|
||||||
|
{
|
||||||
AdvanceLevel();
|
AdvanceLevel();
|
||||||
|
}
|
||||||
else if (p > 0)
|
else if (p > 0)
|
||||||
|
{
|
||||||
SetWhiteSkullCount(p / 20);
|
SetWhiteSkullCount(p / 20);
|
||||||
|
}
|
||||||
|
|
||||||
if (DateTime.UtcNow >= ExpireTime)
|
if (DateTime.UtcNow >= ExpireTime)
|
||||||
|
{
|
||||||
Expire();
|
Expire();
|
||||||
|
}
|
||||||
|
|
||||||
Respawn();
|
Respawn();
|
||||||
}
|
}
|
||||||
|
|
@ -539,10 +603,14 @@ namespace Server.Engines.CannedEvil
|
||||||
public void SpawnChampion()
|
public void SpawnChampion()
|
||||||
{
|
{
|
||||||
if (m_Altar != null)
|
if (m_Altar != null)
|
||||||
|
{
|
||||||
m_Altar.Hue = 0x26;
|
m_Altar.Hue = 0x26;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Platform != null)
|
if (m_Platform != null)
|
||||||
|
{
|
||||||
m_Platform.Hue = 0x452;
|
m_Platform.Hue = 0x452;
|
||||||
|
}
|
||||||
|
|
||||||
m_Kills = 0;
|
m_Kills = 0;
|
||||||
Level = 0;
|
Level = 0;
|
||||||
|
|
@ -564,14 +632,18 @@ namespace Server.Engines.CannedEvil
|
||||||
public void Respawn()
|
public void Respawn()
|
||||||
{
|
{
|
||||||
if (!m_Active || Deleted || Champion != null)
|
if (!m_Active || Deleted || Champion != null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
while (m_Creatures.Count < m_SPawnSzMod * (200 / 12) - GetSubLevel() * m_SPawnSzMod * (40 / 12))
|
while (m_Creatures.Count < m_SPawnSzMod * (200 / 12) - GetSubLevel() * m_SPawnSzMod * (40 / 12))
|
||||||
{
|
{
|
||||||
var m = Spawn();
|
var m = Spawn();
|
||||||
|
|
||||||
if (m == null)
|
if (m == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var loc = GetSpawnLocation();
|
var loc = GetSpawnLocation();
|
||||||
|
|
||||||
|
|
@ -617,7 +689,9 @@ namespace Server.Engines.CannedEvil
|
||||||
var map = Map;
|
var map = Map;
|
||||||
|
|
||||||
if (map == null)
|
if (map == null)
|
||||||
|
{
|
||||||
return Location;
|
return Location;
|
||||||
|
}
|
||||||
|
|
||||||
// Try 20 times to find a spawnable location.
|
// Try 20 times to find a spawnable location.
|
||||||
for (var i = 0; i < 20; i++)
|
for (var i = 0; i < 20; i++)
|
||||||
|
|
@ -633,11 +707,15 @@ namespace Server.Engines.CannedEvil
|
||||||
var z = Map.GetAverageZ(x, y);
|
var z = Map.GetAverageZ(x, y);
|
||||||
|
|
||||||
if (Map.CanSpawnMobile(new Point2D(x, y), z))
|
if (Map.CanSpawnMobile(new Point2D(x, y), z))
|
||||||
|
{
|
||||||
return new Point3D(x, y, z);
|
return new Point3D(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
/* try @ platform Z if map z fails */
|
/* try @ platform Z if map z fails */
|
||||||
if (Map.CanSpawnMobile(new Point2D(x, y), m_Platform.Location.Z))
|
if (Map.CanSpawnMobile(new Point2D(x, y), m_Platform.Location.Z))
|
||||||
|
{
|
||||||
return new Point3D(x, y, m_Platform.Location.Z);
|
return new Point3D(x, y, m_Platform.Location.Z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Location;
|
return Location;
|
||||||
|
|
@ -648,11 +726,19 @@ namespace Server.Engines.CannedEvil
|
||||||
var level = Level;
|
var level = Level;
|
||||||
|
|
||||||
if (level <= Level1)
|
if (level <= Level1)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (level <= Level2)
|
if (level <= Level2)
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (level <= Level3)
|
if (level <= Level3)
|
||||||
|
{
|
||||||
return 2;
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
@ -667,8 +753,12 @@ namespace Server.Engines.CannedEvil
|
||||||
var individualTypes = types[i];
|
var individualTypes = types[i];
|
||||||
|
|
||||||
for (var j = 0; j < individualTypes.Length; j++)
|
for (var j = 0; j < individualTypes.Length; j++)
|
||||||
|
{
|
||||||
if (t == individualTypes[j])
|
if (t == individualTypes[j])
|
||||||
|
{
|
||||||
return i;
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -681,7 +771,9 @@ namespace Server.Engines.CannedEvil
|
||||||
var v = GetSubLevel();
|
var v = GetSubLevel();
|
||||||
|
|
||||||
if (v >= 0 && v < types.Length)
|
if (v >= 0 && v < types.Length)
|
||||||
|
{
|
||||||
return Spawn(types[v]);
|
return Spawn(types[v]);
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -707,7 +799,9 @@ namespace Server.Engines.CannedEvil
|
||||||
// They didn't even get 20%, go back a level
|
// They didn't even get 20%, go back a level
|
||||||
|
|
||||||
if (Level > 0)
|
if (Level > 0)
|
||||||
|
{
|
||||||
--Level;
|
--Level;
|
||||||
|
}
|
||||||
|
|
||||||
InvalidateProperties();
|
InvalidateProperties();
|
||||||
}
|
}
|
||||||
|
|
@ -806,9 +900,13 @@ namespace Server.Engines.CannedEvil
|
||||||
public override void OnSingleClick(Mobile from)
|
public override void OnSingleClick(Mobile from)
|
||||||
{
|
{
|
||||||
if (m_Active)
|
if (m_Active)
|
||||||
LabelTo(from, "{0} (Active; Level: {1}; Kills: {2}/{3})", m_Type, Level, m_Kills, MaxKills);
|
{
|
||||||
|
LabelTo(@from, "{0} (Active; Level: {1}; Kills: {2}/{3})", m_Type, Level, m_Kills, MaxKills);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
LabelTo(from, "{0} (Inactive)", m_Type);
|
{
|
||||||
|
LabelTo(@from, "{0} (Inactive)", m_Type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnDoubleClick(Mobile from)
|
public override void OnDoubleClick(Mobile from)
|
||||||
|
|
@ -819,24 +917,40 @@ namespace Server.Engines.CannedEvil
|
||||||
public override void OnLocationChange(Point3D oldLoc)
|
public override void OnLocationChange(Point3D oldLoc)
|
||||||
{
|
{
|
||||||
if (Deleted)
|
if (Deleted)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Platform != null)
|
if (m_Platform != null)
|
||||||
|
{
|
||||||
m_Platform.Location = new Point3D(X, Y, Z - 20);
|
m_Platform.Location = new Point3D(X, Y, Z - 20);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Altar != null)
|
if (m_Altar != null)
|
||||||
|
{
|
||||||
m_Altar.Location = new Point3D(X, Y, Z - 15);
|
m_Altar.Location = new Point3D(X, Y, Z - 15);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Idol != null)
|
if (m_Idol != null)
|
||||||
|
{
|
||||||
m_Idol.Location = new Point3D(X, Y, Z - 15);
|
m_Idol.Location = new Point3D(X, Y, Z - 15);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_RedSkulls != null)
|
if (m_RedSkulls != null)
|
||||||
|
{
|
||||||
for (var i = 0; i < m_RedSkulls.Count; ++i)
|
for (var i = 0; i < m_RedSkulls.Count; ++i)
|
||||||
|
{
|
||||||
m_RedSkulls[i].Location = GetRedSkullLocation(i);
|
m_RedSkulls[i].Location = GetRedSkullLocation(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_WhiteSkulls != null)
|
if (m_WhiteSkulls != null)
|
||||||
|
{
|
||||||
for (var i = 0; i < m_WhiteSkulls.Count; ++i)
|
for (var i = 0; i < m_WhiteSkulls.Count; ++i)
|
||||||
|
{
|
||||||
m_WhiteSkulls[i].Location = GetWhiteSkullLocation(i);
|
m_WhiteSkulls[i].Location = GetWhiteSkullLocation(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_SpawnArea.X += Location.X - oldLoc.X;
|
m_SpawnArea.X += Location.X - oldLoc.X;
|
||||||
m_SpawnArea.Y += Location.Y - oldLoc.Y;
|
m_SpawnArea.Y += Location.Y - oldLoc.Y;
|
||||||
|
|
@ -847,24 +961,40 @@ namespace Server.Engines.CannedEvil
|
||||||
public override void OnMapChange()
|
public override void OnMapChange()
|
||||||
{
|
{
|
||||||
if (Deleted)
|
if (Deleted)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Platform != null)
|
if (m_Platform != null)
|
||||||
|
{
|
||||||
m_Platform.Map = Map;
|
m_Platform.Map = Map;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Altar != null)
|
if (m_Altar != null)
|
||||||
|
{
|
||||||
m_Altar.Map = Map;
|
m_Altar.Map = Map;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Idol != null)
|
if (m_Idol != null)
|
||||||
|
{
|
||||||
m_Idol.Map = Map;
|
m_Idol.Map = Map;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_RedSkulls != null)
|
if (m_RedSkulls != null)
|
||||||
|
{
|
||||||
for (var i = 0; i < m_RedSkulls.Count; ++i)
|
for (var i = 0; i < m_RedSkulls.Count; ++i)
|
||||||
|
{
|
||||||
m_RedSkulls[i].Map = Map;
|
m_RedSkulls[i].Map = Map;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_WhiteSkulls != null)
|
if (m_WhiteSkulls != null)
|
||||||
|
{
|
||||||
for (var i = 0; i < m_WhiteSkulls.Count; ++i)
|
for (var i = 0; i < m_WhiteSkulls.Count; ++i)
|
||||||
|
{
|
||||||
m_WhiteSkulls[i].Map = Map;
|
m_WhiteSkulls[i].Map = Map;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UpdateRegion();
|
UpdateRegion();
|
||||||
}
|
}
|
||||||
|
|
@ -882,7 +1012,9 @@ namespace Server.Engines.CannedEvil
|
||||||
if (m_RedSkulls != null)
|
if (m_RedSkulls != null)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < m_RedSkulls.Count; ++i)
|
for (var i = 0; i < m_RedSkulls.Count; ++i)
|
||||||
|
{
|
||||||
m_RedSkulls[i].Delete();
|
m_RedSkulls[i].Delete();
|
||||||
|
}
|
||||||
|
|
||||||
m_RedSkulls.Clear();
|
m_RedSkulls.Clear();
|
||||||
}
|
}
|
||||||
|
|
@ -890,7 +1022,9 @@ namespace Server.Engines.CannedEvil
|
||||||
if (m_WhiteSkulls != null)
|
if (m_WhiteSkulls != null)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < m_WhiteSkulls.Count; ++i)
|
for (var i = 0; i < m_WhiteSkulls.Count; ++i)
|
||||||
|
{
|
||||||
m_WhiteSkulls[i].Delete();
|
m_WhiteSkulls[i].Delete();
|
||||||
|
}
|
||||||
|
|
||||||
m_WhiteSkulls.Clear();
|
m_WhiteSkulls.Clear();
|
||||||
}
|
}
|
||||||
|
|
@ -902,14 +1036,18 @@ namespace Server.Engines.CannedEvil
|
||||||
var mob = m_Creatures[i];
|
var mob = m_Creatures[i];
|
||||||
|
|
||||||
if (!mob.Player)
|
if (!mob.Player)
|
||||||
|
{
|
||||||
mob.Delete();
|
mob.Delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Creatures.Clear();
|
m_Creatures.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Champion?.Player == false)
|
if (Champion?.Player == false)
|
||||||
|
{
|
||||||
Champion.Delete();
|
Champion.Delete();
|
||||||
|
}
|
||||||
|
|
||||||
Stop();
|
Stop();
|
||||||
|
|
||||||
|
|
@ -919,19 +1057,25 @@ namespace Server.Engines.CannedEvil
|
||||||
public virtual void RegisterDamageTo(Mobile m)
|
public virtual void RegisterDamageTo(Mobile m)
|
||||||
{
|
{
|
||||||
if (m == null)
|
if (m == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var de in m.DamageEntries)
|
foreach (var de in m.DamageEntries)
|
||||||
{
|
{
|
||||||
if (de.HasExpired)
|
if (de.HasExpired)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var damager = de.Damager;
|
var damager = de.Damager;
|
||||||
|
|
||||||
var master = damager.GetDamageMaster(m);
|
var master = damager.GetDamageMaster(m);
|
||||||
|
|
||||||
if (master != null)
|
if (master != null)
|
||||||
|
{
|
||||||
damager = master;
|
damager = master;
|
||||||
|
}
|
||||||
|
|
||||||
RegisterDamage(damager, de.DamageGiven);
|
RegisterDamage(damager, de.DamageGiven);
|
||||||
}
|
}
|
||||||
|
|
@ -940,7 +1084,9 @@ namespace Server.Engines.CannedEvil
|
||||||
public void RegisterDamage(Mobile from, int amount)
|
public void RegisterDamage(Mobile from, int amount)
|
||||||
{
|
{
|
||||||
if (from?.Player != true)
|
if (from?.Player != true)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_DamageEntries[from] = amount + (m_DamageEntries.TryGetValue(from, out var value) ? value : 0);
|
m_DamageEntries[from] = amount + (m_DamageEntries.TryGetValue(from, out var value) ? value : 0);
|
||||||
}
|
}
|
||||||
|
|
@ -948,18 +1094,22 @@ namespace Server.Engines.CannedEvil
|
||||||
public void AwardArtifact(Item artifact)
|
public void AwardArtifact(Item artifact)
|
||||||
{
|
{
|
||||||
if (artifact == null)
|
if (artifact == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var totalDamage = 0;
|
var totalDamage = 0;
|
||||||
|
|
||||||
var validEntries = new Dictionary<Mobile, int>();
|
var validEntries = new Dictionary<Mobile, int>();
|
||||||
|
|
||||||
foreach (var kvp in m_DamageEntries)
|
foreach (var kvp in m_DamageEntries)
|
||||||
|
{
|
||||||
if (IsEligible(kvp.Key, artifact))
|
if (IsEligible(kvp.Key, artifact))
|
||||||
{
|
{
|
||||||
validEntries.Add(kvp.Key, kvp.Value);
|
validEntries.Add(kvp.Key, kvp.Value);
|
||||||
totalDamage += kvp.Value;
|
totalDamage += kvp.Value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var randomDamage = Utility.RandomMinMax(1, totalDamage);
|
var randomDamage = Utility.RandomMinMax(1, totalDamage);
|
||||||
|
|
||||||
|
|
@ -982,16 +1132,22 @@ namespace Server.Engines.CannedEvil
|
||||||
public void GiveArtifact(Mobile to, Item artifact)
|
public void GiveArtifact(Mobile to, Item artifact)
|
||||||
{
|
{
|
||||||
if (to == null || artifact == null)
|
if (to == null || artifact == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var pack = to.Backpack;
|
var pack = to.Backpack;
|
||||||
|
|
||||||
if (pack?.TryDropItem(to, artifact, false) != true)
|
if (pack?.TryDropItem(to, artifact, false) != true)
|
||||||
|
{
|
||||||
artifact.Delete();
|
artifact.Delete();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
to.SendLocalizedMessage(
|
to.SendLocalizedMessage(
|
||||||
1062317
|
1062317
|
||||||
); // For your valor in combating the fallen beast, a special artifact has been bestowed on you.
|
); // For your valor in combating the fallen beast, a special artifact has been bestowed on you.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsEligible(Mobile m, Item artifact) =>
|
public bool IsEligible(Mobile m, Item artifact) =>
|
||||||
|
|
@ -1037,7 +1193,9 @@ namespace Server.Engines.CannedEvil
|
||||||
writer.Write(m_RestartTimer != null);
|
writer.Write(m_RestartTimer != null);
|
||||||
|
|
||||||
if (m_RestartTimer != null)
|
if (m_RestartTimer != null)
|
||||||
|
{
|
||||||
writer.WriteDeltaTime(RestartTime);
|
writer.WriteDeltaTime(RestartTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Deserialize(IGenericReader reader)
|
public override void Deserialize(IGenericReader reader)
|
||||||
|
|
@ -1064,7 +1222,9 @@ namespace Server.Engines.CannedEvil
|
||||||
var damage = reader.ReadInt();
|
var damage = reader.ReadInt();
|
||||||
|
|
||||||
if (m == null)
|
if (m == null)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
m_DamageEntries.Add(m, damage);
|
m_DamageEntries.Add(m, damage);
|
||||||
}
|
}
|
||||||
|
|
@ -1110,8 +1270,10 @@ namespace Server.Engines.CannedEvil
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if (version < 1)
|
if (version < 1)
|
||||||
|
{
|
||||||
m_SpawnArea =
|
m_SpawnArea =
|
||||||
new Rectangle2D(new Point2D(X - 24, Y - 24), new Point2D(X + 24, Y + 24)); // Default was 24
|
new Rectangle2D(new Point2D(X - 24, Y - 24), new Point2D(X + 24, Y + 24)); // Default was 24
|
||||||
|
}
|
||||||
|
|
||||||
var active = reader.ReadBool();
|
var active = reader.ReadBool();
|
||||||
m_Type = (ChampionSpawnType)reader.ReadInt();
|
m_Type = (ChampionSpawnType)reader.ReadInt();
|
||||||
|
|
@ -1138,9 +1300,13 @@ namespace Server.Engines.CannedEvil
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Platform == null || m_Altar == null || m_Idol == null)
|
if (m_Platform == null || m_Altar == null || m_Idol == null)
|
||||||
|
{
|
||||||
Delete();
|
Delete();
|
||||||
|
}
|
||||||
else if (active)
|
else if (active)
|
||||||
|
{
|
||||||
Start();
|
Start();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1222,7 +1388,9 @@ namespace Server.Engines.CannedEvil
|
||||||
Spawn = reader.ReadItem() as ChampionSpawn;
|
Spawn = reader.ReadItem() as ChampionSpawn;
|
||||||
|
|
||||||
if (Spawn == null)
|
if (Spawn == null)
|
||||||
|
{
|
||||||
Delete();
|
Delete();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,9 @@ namespace Server.Engines.CannedEvil
|
||||||
var v = (int)type;
|
var v = (int)type;
|
||||||
|
|
||||||
if (v < 0 || v >= Table.Length)
|
if (v < 0 || v >= Table.Length)
|
||||||
|
{
|
||||||
v = 0;
|
v = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return Table[v];
|
return Table[v];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,14 +43,18 @@ namespace Server.Items
|
||||||
m_Harrower = reader.ReadMobile();
|
m_Harrower = reader.ReadMobile();
|
||||||
|
|
||||||
if (m_Harrower == null)
|
if (m_Harrower == null)
|
||||||
|
{
|
||||||
Delete();
|
Delete();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Light != LightType.Circle300)
|
if (Light != LightType.Circle300)
|
||||||
|
{
|
||||||
Light = LightType.Circle300;
|
Light = LightType.Circle300;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue