Code Cleanup & Fixes Warnings (#74)
This commit is contained in:
parent
e11d1f3ad9
commit
57b14ad690
143 changed files with 2960 additions and 3427 deletions
|
|
@ -21,7 +21,7 @@ namespace Server.Accounting
|
|||
EventSink.WorldSave += Save;
|
||||
}
|
||||
|
||||
public static ICollection<IAccount> GetAccounts() => m_Accounts.Values;
|
||||
public static IEnumerable<IAccount> GetAccounts() => m_Accounts.Values;
|
||||
|
||||
public static IAccount GetAccount(string username)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ namespace Server.Commands
|
|||
from.SendMessage(sb.ToString());
|
||||
}
|
||||
|
||||
private static void TileBox_Callback(Mobile from, Map map, Point3D start, Point3D end, TileState ts)
|
||||
private static void TileBox_Callback(Mobile from, Point3D start, Point3D end, TileState ts)
|
||||
{
|
||||
bool mapAvg = false;
|
||||
|
||||
|
|
@ -453,7 +453,7 @@ namespace Server.Commands
|
|||
|
||||
if (e.Length >= 1)
|
||||
BoundingBoxPicker.Begin(from, (map, start, end) =>
|
||||
TileBox_Callback(from, map, start, end, new TileState(TileZType.Start, 0, e.Arguments, outline)));
|
||||
TileBox_Callback(from, start, end, new TileState(TileZType.Start, 0, e.Arguments, outline)));
|
||||
else
|
||||
from.SendMessage("Format: {0} <type> [params] [set {{<propertyName> <value> ...}}]",
|
||||
outline ? "Outline" : "Tile");
|
||||
|
|
@ -515,7 +515,7 @@ namespace Server.Commands
|
|||
subArgs[i] = e.Arguments[i + 1];
|
||||
|
||||
BoundingBoxPicker.Begin(from, (map, start, end) =>
|
||||
TileBox_Callback(from, map, start, end, new TileState(TileZType.Fixed, e.GetInt32(0), subArgs, outline)));
|
||||
TileBox_Callback(from, start, end, new TileState(TileZType.Fixed, e.GetInt32(0), subArgs, outline)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -530,7 +530,7 @@ namespace Server.Commands
|
|||
|
||||
if (e.Length >= 1)
|
||||
BoundingBoxPicker.Begin(from, (map, start, end) =>
|
||||
TileBox_Callback(from, map, start, end, new TileState(TileZType.MapAverage, 0, e.Arguments, outline)));
|
||||
TileBox_Callback(from, start, end, new TileState(TileZType.MapAverage, 0, e.Arguments, outline)));
|
||||
else
|
||||
from.SendMessage("Format: {0}Avg <type> [params] [set {{<propertyName> <value> ...}}]",
|
||||
outline ? "Outline" : "Tile");
|
||||
|
|
|
|||
|
|
@ -931,8 +931,7 @@ namespace Server.Commands
|
|||
|
||||
for (int j = 0; j < maps.Length; ++j)
|
||||
{
|
||||
if (item == null)
|
||||
item = Construct();
|
||||
item ??= Construct();
|
||||
|
||||
if (item == null)
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -929,8 +929,7 @@ namespace Server.Commands
|
|||
|
||||
for (int j = 0; j < maps.Length; ++j)
|
||||
{
|
||||
if (item == null)
|
||||
item = Construct();
|
||||
item ??= Construct();
|
||||
|
||||
if (item == null)
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -82,8 +82,7 @@ namespace Server.Commands
|
|||
if (baseInfo == null)
|
||||
m_Types[baseType] = baseInfo = new TypeInfo(baseType);
|
||||
|
||||
if (baseInfo.m_Derived == null)
|
||||
baseInfo.m_Derived = new List<TypeInfo>();
|
||||
baseInfo.m_Derived ??= new List<TypeInfo>();
|
||||
|
||||
baseInfo.m_Derived.Add(info);
|
||||
}
|
||||
|
|
@ -97,8 +96,7 @@ namespace Server.Commands
|
|||
if (decInfo == null)
|
||||
m_Types[decType] = decInfo = new TypeInfo(decType);
|
||||
|
||||
if (decInfo.m_Nested == null)
|
||||
decInfo.m_Nested = new List<TypeInfo>();
|
||||
decInfo.m_Nested ??= new List<TypeInfo>();
|
||||
|
||||
decInfo.m_Nested.Add(info);
|
||||
}
|
||||
|
|
@ -115,8 +113,7 @@ namespace Server.Commands
|
|||
if (ifaceInfo == null)
|
||||
m_Types[iface] = ifaceInfo = new TypeInfo(iface);
|
||||
|
||||
if (ifaceInfo.m_Derived == null)
|
||||
ifaceInfo.m_Derived = new List<TypeInfo>();
|
||||
ifaceInfo.m_Derived ??= new List<TypeInfo>();
|
||||
|
||||
ifaceInfo.m_Derived.Add(info);
|
||||
}
|
||||
|
|
@ -265,20 +262,13 @@ namespace Server.Commands
|
|||
|
||||
typeName = name ?? type.Name;
|
||||
|
||||
if (fnam == null) fileName = $"docs/types/{SanitizeType(type.Name)}.html";
|
||||
else fileName = $"{fnam}.html";
|
||||
fileName = fnam == null ? $"docs/types/{SanitizeType(type.Name)}.html" : $"{fnam}.html";
|
||||
|
||||
if (link == null)
|
||||
{
|
||||
if (DontLink(type)) //if ( DontLink( type.Name ) )
|
||||
linkName = $"<font color=\"blue\">{SanitizeType(type.Name)}</font>";
|
||||
else
|
||||
linkName = $"<a href=\"@directory@{SanitizeType(type.Name)}.html\">{SanitizeType(type.Name)}</a>";
|
||||
}
|
||||
linkName = DontLink(type) ? $"<font color=\"blue\">{SanitizeType(type.Name)}</font>"
|
||||
: $"<a href=\"@directory@{SanitizeType(type.Name)}.html\">{SanitizeType(type.Name)}</a>";
|
||||
else
|
||||
{
|
||||
linkName = link;
|
||||
}
|
||||
|
||||
//Console.WriteLine( typeName+":"+fileName+":"+linkName );
|
||||
}
|
||||
|
|
@ -604,8 +594,7 @@ namespace Server.Commands
|
|||
}
|
||||
}
|
||||
|
||||
if (aliased == null)
|
||||
aliased = realType?.Name ?? "";
|
||||
aliased ??= realType?.Name ?? "";
|
||||
}
|
||||
|
||||
return string.Concat(prepend, aliased, append, name);
|
||||
|
|
|
|||
|
|
@ -160,8 +160,8 @@ namespace Server.Commands.Generic
|
|||
FieldAttributes.Private | FieldAttributes.InitOnly
|
||||
);
|
||||
|
||||
// parseMethod.Invoke(null,
|
||||
// parseArgs.Length == 2 ? new object[] {toParse, (int) parseArgs[1]} : new object[] {toParse});
|
||||
// parseMethod.Invoke(null,
|
||||
// parseArgs.Length == 2 ? new object[] {toParse, (int) parseArgs[1]} : new object[] {toParse});
|
||||
|
||||
|
||||
il.Emit(OpCodes.Ldarg_0);
|
||||
|
|
|
|||
|
|
@ -192,8 +192,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
MethodInfo getHashCode = active.GetMethod("GetHashCode", Type.EmptyTypes);
|
||||
|
||||
if (getHashCode == null)
|
||||
getHashCode = typeof(T).GetMethod("GetHashCode", Type.EmptyTypes);
|
||||
getHashCode ??= typeof(T).GetMethod("GetHashCode", Type.EmptyTypes);
|
||||
|
||||
if (active != typeof(int))
|
||||
{
|
||||
|
|
@ -256,4 +255,4 @@ namespace Server.Commands.Generic
|
|||
return (IComparer<T>)Activator.CreateInstance(comparerType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@ namespace Server.Commands.Generic
|
|||
prop.CheckAccess(from);
|
||||
}
|
||||
|
||||
if (assembly == null)
|
||||
assembly = new AssemblyEmitter("__dynamic");
|
||||
assembly ??= new AssemblyEmitter("__dynamic");
|
||||
|
||||
m_Comparer = DistinctCompiler.Compile<object>(assembly, baseType, m_Properties.ToArray());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ namespace Server.Commands.Generic
|
|||
order.Property.CheckAccess(from);
|
||||
}
|
||||
|
||||
if (assembly == null)
|
||||
assembly = new AssemblyEmitter("__dynamic");
|
||||
assembly ??= new AssemblyEmitter("__dynamic");
|
||||
|
||||
m_Comparer = SortCompiler.Compile<object>(assembly, baseType, m_Orders.ToArray());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
public void Compile(ref AssemblyEmitter emitter)
|
||||
{
|
||||
if (emitter == null)
|
||||
emitter = new AssemblyEmitter("__dynamic");
|
||||
emitter ??= new AssemblyEmitter("__dynamic");
|
||||
|
||||
m_Conditionals = new IConditional[m_Conditions.Length];
|
||||
|
||||
|
|
|
|||
|
|
@ -382,7 +382,7 @@ namespace Server.Commands
|
|||
if (IsEnum(type))
|
||||
try
|
||||
{
|
||||
toSet = Enum.Parse(type, value, true);
|
||||
toSet = Enum.Parse(type, value ?? "", true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write(ItemType == null ? null : ItemType.FullName);
|
||||
writer.Write(ItemType?.FullName);
|
||||
|
||||
writer.WriteEncodedInt(AmountCur);
|
||||
writer.WriteEncodedInt(Number);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write(ItemType == null ? null : ItemType.FullName);
|
||||
writer.Write(ItemType?.FullName);
|
||||
|
||||
writer.Write(RequireExceptional);
|
||||
|
||||
|
|
|
|||
|
|
@ -66,8 +66,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public static SmallBulkEntry[] GetEntries( string type, string name )
|
||||
{
|
||||
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 Dictionary<string, SmallBulkEntry[]> table ))
|
||||
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
|
||||
|
|
@ -112,7 +111,7 @@ namespace Server.Engines.BulkOrders
|
|||
public void Serialize(IGenericWriter writer )
|
||||
{
|
||||
writer.Write( m_Amount );
|
||||
writer.Write( Details.Type == null ? null : Details.Type.FullName );
|
||||
writer.Write( Details.Type?.FullName );
|
||||
writer.Write( Details.Number );
|
||||
writer.Write( Details.Graphic );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ namespace Server.Engines.BulkOrders
|
|||
switch (Utility.Random(14))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.Farmer);
|
||||
break;
|
||||
case 1:
|
||||
|
|
|
|||
|
|
@ -357,7 +357,13 @@ namespace Server.Engines.BulkOrders
|
|||
int[][][] goldTable = m_GoldTable;
|
||||
|
||||
int typeIndex = ComputeType(type, itemCount);
|
||||
int quanIndex = quantity == 20 ? 2 : quantity == 15 ? 1 : 0;
|
||||
int quanIndex = quantity switch
|
||||
{
|
||||
20 => 2,
|
||||
15 => 1,
|
||||
_ => 0
|
||||
};
|
||||
|
||||
int mtrlIndex = material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite
|
||||
? 1 + (material - BulkMaterialType.DullCopper)
|
||||
: 0;
|
||||
|
|
@ -599,11 +605,28 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
int[][][] goldTable = Core.AOS ? m_AosGoldTable : m_OldGoldTable;
|
||||
|
||||
int typeIndex = (itemCount == 6 ? 3 : itemCount == 5 ? 2 : itemCount == 4 ? 1 : 0) * 2 + (exceptional ? 1 : 0);
|
||||
int quanIndex = quantity == 20 ? 2 : quantity == 15 ? 1 : 0;
|
||||
int mtrlIndex = material == BulkMaterialType.Barbed ? 3 :
|
||||
material == BulkMaterialType.Horned ? 2 :
|
||||
material == BulkMaterialType.Spined ? 1 : 0;
|
||||
int typeIndex = itemCount switch
|
||||
{
|
||||
6 => 3,
|
||||
5 => 2,
|
||||
4 => 1,
|
||||
_ => 0
|
||||
} * 2 + (exceptional ? 1 : 0);
|
||||
|
||||
int quanIndex = quantity switch
|
||||
{
|
||||
20 => 2,
|
||||
15 => 1,
|
||||
_ => 0
|
||||
};
|
||||
|
||||
int mtrlIndex = material switch
|
||||
{
|
||||
BulkMaterialType.Barbed => 3,
|
||||
BulkMaterialType.Horned => 2,
|
||||
BulkMaterialType.Spined => 1,
|
||||
_ => 0
|
||||
};
|
||||
|
||||
int gold = goldTable[typeIndex][quanIndex][mtrlIndex];
|
||||
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ namespace Server.Engines.BulkOrders
|
|||
writer.Write(0); // version
|
||||
|
||||
writer.Write(m_AmountCur);
|
||||
writer.Write(Type == null ? null : Type.FullName);
|
||||
writer.Write(Type?.FullName);
|
||||
writer.Write(m_Number);
|
||||
writer.Write(Graphic);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ namespace Server.Engines.BulkOrders
|
|||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
double chance = item.GetSuccessChance(m, null, system, false, out allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ namespace Server.Engines.BulkOrders
|
|||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
double chance = item.GetSuccessChance(m, null, system, false, out allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -331,12 +331,10 @@ namespace Server.Engines.CannedEvil
|
|||
killer.SendLocalizedMessage(1049524); // You have received a scroll of power!
|
||||
|
||||
if (killer.Alive)
|
||||
{
|
||||
killer.AddToBackpack(scroll);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (killer?.Corpse.Deleted == false)
|
||||
if (killer.Corpse.Deleted == false)
|
||||
killer.Corpse.DropItem(scroll);
|
||||
else
|
||||
killer.AddToBackpack(scroll);
|
||||
|
|
|
|||
|
|
@ -6,11 +6,8 @@ namespace Server.Engines.Chat
|
|||
{
|
||||
public ChatMessagePacket(Mobile who, int number, string param1, string param2) : base(0xB2)
|
||||
{
|
||||
if (param1 == null)
|
||||
param1 = string.Empty;
|
||||
|
||||
if (param2 == null)
|
||||
param2 = string.Empty;
|
||||
param1 ??= string.Empty;
|
||||
param2 ??= string.Empty;
|
||||
|
||||
EnsureCapacity(13 + (param1.Length + param2.Length) * 2);
|
||||
|
||||
|
|
@ -25,4 +22,4 @@ namespace Server.Engines.Chat
|
|||
m_Stream.WriteBigUniNull(param2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,52 +163,48 @@ namespace Server.Engines.ConPVP
|
|||
string title = null;
|
||||
string option;
|
||||
|
||||
if (spell is ArcanistSpell)
|
||||
switch (spell)
|
||||
{
|
||||
title = "Spellweaving";
|
||||
option = spell.Name;
|
||||
}
|
||||
else if (spell is PaladinSpell)
|
||||
{
|
||||
title = "Chivalry";
|
||||
option = spell.Name;
|
||||
}
|
||||
else if (spell is NecromancerSpell)
|
||||
{
|
||||
title = "Necromancy";
|
||||
option = spell.Name;
|
||||
}
|
||||
else if (spell is NinjaSpell)
|
||||
{
|
||||
title = "Ninjitsu";
|
||||
option = spell.Name;
|
||||
}
|
||||
else if (spell is SamuraiSpell)
|
||||
{
|
||||
title = "Bushido";
|
||||
option = spell.Name;
|
||||
}
|
||||
else if (spell is MagerySpell magerySpell)
|
||||
{
|
||||
title = magerySpell.Circle switch
|
||||
{
|
||||
SpellCircle.First => "1st Circle",
|
||||
SpellCircle.Second => "2nd Circle",
|
||||
SpellCircle.Third => "3rd Circle",
|
||||
SpellCircle.Fourth => "4th Circle",
|
||||
SpellCircle.Fifth => "5th Circle",
|
||||
SpellCircle.Sixth => "6th Circle",
|
||||
SpellCircle.Seventh => "7th Circle",
|
||||
SpellCircle.Eighth => "8th Circle",
|
||||
_ => title
|
||||
};
|
||||
case ArcanistSpell _:
|
||||
title = "Spellweaving";
|
||||
option = spell.Name;
|
||||
break;
|
||||
case PaladinSpell _:
|
||||
title = "Chivalry";
|
||||
option = spell.Name;
|
||||
break;
|
||||
case NecromancerSpell _:
|
||||
title = "Necromancy";
|
||||
option = spell.Name;
|
||||
break;
|
||||
case NinjaSpell _:
|
||||
title = "Ninjitsu";
|
||||
option = spell.Name;
|
||||
break;
|
||||
case SamuraiSpell _:
|
||||
title = "Bushido";
|
||||
option = spell.Name;
|
||||
break;
|
||||
case MagerySpell magerySpell:
|
||||
title = magerySpell.Circle switch
|
||||
{
|
||||
SpellCircle.First => "1st Circle",
|
||||
SpellCircle.Second => "2nd Circle",
|
||||
SpellCircle.Third => "3rd Circle",
|
||||
SpellCircle.Fourth => "4th Circle",
|
||||
SpellCircle.Fifth => "5th Circle",
|
||||
SpellCircle.Sixth => "6th Circle",
|
||||
SpellCircle.Seventh => "7th Circle",
|
||||
SpellCircle.Eighth => "8th Circle",
|
||||
_ => null
|
||||
};
|
||||
|
||||
option = magerySpell.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
title = "Other Spell";
|
||||
option = spell.Name;
|
||||
option = magerySpell.Name;
|
||||
break;
|
||||
default:
|
||||
title = "Other Spell";
|
||||
option = spell.Name;
|
||||
break;
|
||||
}
|
||||
|
||||
if (title == null || option == null || Ruleset.GetOption(title, option))
|
||||
|
|
|
|||
|
|
@ -550,19 +550,21 @@ namespace Server.Engines.ConPVP
|
|||
else if (m_Path.Count > 0)
|
||||
MoveToWorld(m_Path.Last);
|
||||
|
||||
int myZ = Map.GetAverageZ(X, Y);
|
||||
int myZ = Map?.GetAverageZ(X, Y) ?? 0;
|
||||
|
||||
StaticTile[] statics = Map.Tiles.GetStaticTiles(X, Y, true);
|
||||
for (int j = 0; j < statics.Length; j++)
|
||||
{
|
||||
StaticTile t = statics[j];
|
||||
StaticTile[] statics = Map?.Tiles?.GetStaticTiles(X, Y, true);
|
||||
|
||||
ItemData id = TileData.ItemTable[t.ID & TileData.MaxItemValue];
|
||||
height = id.CalcHeight;
|
||||
if (statics != null)
|
||||
for (int j = 0; j < statics.Length; j++)
|
||||
{
|
||||
StaticTile t = statics[j];
|
||||
|
||||
if (t.Z + height > myZ && t.Z + height <= Z)
|
||||
myZ = t.Z + height;
|
||||
}
|
||||
ItemData id = TileData.ItemTable[t.ID & TileData.MaxItemValue];
|
||||
height = id.CalcHeight;
|
||||
|
||||
if (t.Z + height > myZ && t.Z + height <= Z)
|
||||
myZ = t.Z + height;
|
||||
}
|
||||
|
||||
IPooledEnumerable<Item> eable = GetItemsInRange(0);
|
||||
foreach (Item item in eable)
|
||||
|
|
@ -1428,8 +1430,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
if (m_Bomb != null && Controller != null)
|
||||
{
|
||||
if (m_UnhideCallback == null)
|
||||
m_UnhideCallback = UnhideBomb;
|
||||
m_UnhideCallback ??= UnhideBomb;
|
||||
m_Bomb.Visible = false;
|
||||
m_Bomb.MoveToWorld(Controller.BombHome, Controller.Map);
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(Utility.RandomMinMax(5, 15)), m_UnhideCallback);
|
||||
|
|
@ -1504,7 +1505,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private void DelayBounce_Callback(Mobile mob, Container corpse)
|
||||
{
|
||||
DuelPlayer dp = mob is PlayerMobile mobile ? mobile.DuelPlayer : null;
|
||||
DuelPlayer dp = (mob as PlayerMobile)?.DuelPlayer;
|
||||
|
||||
m_Context.RemoveAggressions(mob);
|
||||
|
||||
|
|
@ -1722,7 +1723,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < m_Context.Participants.Count; ++i)
|
||||
{
|
||||
if (!(m_Context.Participants[i] is Participant p) || p.Players == null)
|
||||
Participant p = m_Context.Participants[i];
|
||||
|
||||
if (p?.Players == null)
|
||||
continue;
|
||||
|
||||
for (int j = 0; j < p.Players.Length; ++j)
|
||||
|
|
@ -1736,7 +1739,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
if (i == winner.TeamID)
|
||||
if (i == winner?.TeamID)
|
||||
continue;
|
||||
|
||||
if (p.Players != null)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
|
|
@ -113,6 +114,9 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
CTFTeamInfo teamInfo = entries[i] as CTFTeamInfo;
|
||||
|
||||
if (teamInfo == null)
|
||||
continue;
|
||||
|
||||
AddImage(30, 70 + i * 75, 10152);
|
||||
AddImage(30, 85 + i * 75, 10151);
|
||||
AddImage(30, 100 + i * 75, 10151);
|
||||
|
|
@ -878,7 +882,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private void DelayBounce_Callback(Mobile mob, Container corpse)
|
||||
{
|
||||
DuelPlayer dp = mob is PlayerMobile mobile ? mobile.DuelPlayer : null;
|
||||
DuelPlayer dp = (mob as PlayerMobile)?.DuelPlayer;
|
||||
|
||||
m_Context.RemoveAggressions(mob);
|
||||
|
||||
|
|
@ -943,15 +947,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (ourFlagCarrier != null && GetTeamInfo(ourFlagCarrier) == teamInfo)
|
||||
{
|
||||
for (int j = 0; j < ourFlagCarrier.Aggressors.Count; ++j)
|
||||
{
|
||||
if (!(ourFlagCarrier.Aggressors[j] is AggressorInfo aggr) ||
|
||||
aggr.Defender != ourFlagCarrier || aggr.Attacker != mob)
|
||||
continue;
|
||||
|
||||
if (ourFlagCarrier.Aggressors.Any(aggr => aggr.Defender == ourFlagCarrier && aggr.Attacker == mob))
|
||||
playerInfo.Score += 2; // helped defend guy capturing enemy flag
|
||||
break;
|
||||
}
|
||||
|
||||
if (mob.Map == ourFlagCarrier.Map && ourFlagCarrier.InRange(mob, 12))
|
||||
playerInfo.Score += 1; // helped defend guy capturing enemy flag
|
||||
|
|
@ -1143,7 +1140,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
if (i == winner.TeamID)
|
||||
if (i == winner?.TeamID)
|
||||
continue;
|
||||
|
||||
for (int j = 0; j < p.Players.Length; ++j)
|
||||
|
|
@ -1151,7 +1148,8 @@ namespace Server.Engines.ConPVP
|
|||
p.Players[j].Eliminated = true;
|
||||
}
|
||||
|
||||
m_Context.Finish(m_Context.Participants[winner.TeamID]);
|
||||
if (winner != null)
|
||||
m_Context.Finish(m_Context.Participants[winner.TeamID]);
|
||||
}
|
||||
|
||||
public override void OnStop()
|
||||
|
|
|
|||
|
|
@ -521,7 +521,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private void DelayBounce_Callback(Mobile mob, Container corpse)
|
||||
{
|
||||
DuelPlayer dp = mob is PlayerMobile mobile ? mobile.DuelPlayer : null;
|
||||
DuelPlayer dp = (mob as PlayerMobile)?.DuelPlayer;
|
||||
|
||||
m_Context.RemoveAggressions(mob);
|
||||
|
||||
|
|
|
|||
|
|
@ -171,8 +171,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
King = m;
|
||||
|
||||
if (m_KingTimer == null)
|
||||
m_KingTimer = new KingTimer(this);
|
||||
m_KingTimer ??= new KingTimer(this);
|
||||
m_KingTimer.Stop();
|
||||
m_KingTimer.StartHillTicker();
|
||||
|
||||
|
|
@ -450,11 +449,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBorderedText(160 + 10, 85 + i * 75, 100, 20, "Captures:", 0xFFC000, BlackColor32);
|
||||
AddBorderedText(160 + 15, 105 + i * 75, 100, 20, teamInfo.Captures.ToString("N0"), 0xFFC000, BlackColor32);
|
||||
|
||||
string leader = null;
|
||||
if (teamInfo.Leader != null)
|
||||
leader = teamInfo.Leader.Name;
|
||||
if (leader == null)
|
||||
leader = "(none)";
|
||||
string leader = teamInfo.Leader?.Name ?? "(none)";
|
||||
|
||||
AddBorderedText(235 + 10, 85 + i * 75, 250, 20, "Leader:", 0xFFC000, BlackColor32);
|
||||
AddBorderedText(235 + 15, 105 + i * 75, 250, 20, leader, 0xFFC000, BlackColor32);
|
||||
|
|
@ -893,7 +888,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private void DelayBounce_Callback(Mobile mob, Container corpse)
|
||||
{
|
||||
DuelPlayer dp = mob is PlayerMobile mobile ? mobile.DuelPlayer : null;
|
||||
DuelPlayer dp = (mob as PlayerMobile)?.DuelPlayer;
|
||||
|
||||
m_Context.RemoveAggressions(mob);
|
||||
|
||||
|
|
@ -1113,7 +1108,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < m_Context.Participants.Count; ++i)
|
||||
{
|
||||
if (!(m_Context.Participants[i] is Participant p) || p.Players == null)
|
||||
Participant p = m_Context.Participants[i];
|
||||
if (p.Players == null)
|
||||
continue;
|
||||
|
||||
for (int j = 0; j < p.Players.Length; ++j)
|
||||
|
|
|
|||
|
|
@ -10,533 +10,533 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class ConfirmSignupGump : Gump
|
||||
{
|
||||
private const int BlackColor32 = 0x000008;
|
||||
private const int LabelColor32 = 0xFFFFFF;
|
||||
private Mobile m_From;
|
||||
private List<Mobile> m_Players;
|
||||
private Mobile m_Registrar;
|
||||
private Tournament m_Tournament;
|
||||
|
||||
public ConfirmSignupGump(Mobile from, Mobile registrar, Tournament tourney, List<Mobile> players) : base(50, 50)
|
||||
public class ConfirmSignupGump : Gump
|
||||
{
|
||||
m_From = from;
|
||||
m_Registrar = registrar;
|
||||
m_Tournament = tourney;
|
||||
m_Players = players;
|
||||
private const int BlackColor32 = 0x000008;
|
||||
private const int LabelColor32 = 0xFFFFFF;
|
||||
private Mobile m_From;
|
||||
private List<Mobile> m_Players;
|
||||
private Mobile m_Registrar;
|
||||
private Tournament m_Tournament;
|
||||
|
||||
m_From.CloseGump<AcceptTeamGump>();
|
||||
m_From.CloseGump<AcceptDuelGump>();
|
||||
m_From.CloseGump<DuelContextGump>();
|
||||
m_From.CloseGump<ConfirmSignupGump>();
|
||||
|
||||
#region Rules
|
||||
|
||||
Ruleset ruleset = tourney.Ruleset;
|
||||
Ruleset basedef = ruleset.Base;
|
||||
|
||||
int height = 185 + 60 + 12;
|
||||
|
||||
int changes = 0;
|
||||
|
||||
BitArray defs;
|
||||
|
||||
if (ruleset.Flavors.Count > 0)
|
||||
public ConfirmSignupGump(Mobile from, Mobile registrar, Tournament tourney, List<Mobile> players) : base(50, 50)
|
||||
{
|
||||
defs = new BitArray(basedef.Options);
|
||||
m_From = from;
|
||||
m_Registrar = registrar;
|
||||
m_Tournament = tourney;
|
||||
m_Players = players;
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i)
|
||||
defs.Or(ruleset.Flavors[i].Options);
|
||||
m_From.CloseGump<AcceptTeamGump>();
|
||||
m_From.CloseGump<AcceptDuelGump>();
|
||||
m_From.CloseGump<DuelContextGump>();
|
||||
m_From.CloseGump<ConfirmSignupGump>();
|
||||
|
||||
height += ruleset.Flavors.Count * 18;
|
||||
}
|
||||
else
|
||||
{
|
||||
defs = basedef.Options;
|
||||
}
|
||||
#region Rules
|
||||
|
||||
BitArray opts = ruleset.Options;
|
||||
Ruleset ruleset = tourney.Ruleset;
|
||||
Ruleset basedef = ruleset.Base;
|
||||
|
||||
for (int i = 0; i < opts.Length; ++i)
|
||||
if (defs[i] != opts[i])
|
||||
++changes;
|
||||
int height = 185 + 60 + 12;
|
||||
|
||||
height += changes * 22;
|
||||
int changes = 0;
|
||||
|
||||
height += 10 + 22 + 25 + 25;
|
||||
BitArray defs;
|
||||
|
||||
if (tourney.PlayersPerParticipant > 1)
|
||||
height += 36 + tourney.PlayersPerParticipant * 20;
|
||||
|
||||
#endregion
|
||||
|
||||
Closable = false;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
//AddBackground( 0, 0, 400, 220, 9150 );
|
||||
AddBackground(1, 1, 398, height, 3600);
|
||||
//AddBackground( 16, 15, 369, 189, 9100 );
|
||||
|
||||
AddImageTiled(16, 15, 369, height - 29, 3604);
|
||||
AddAlphaRegion(16, 15, 369, height - 29);
|
||||
|
||||
AddImage(215, -43, 0xEE40);
|
||||
//AddImage( 330, 141, 0x8BA );
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (tourney.TourneyType == TourneyType.FreeForAll)
|
||||
{
|
||||
sb.Append("FFA");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.RandomTeam)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-Team");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.Faction)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-Team Faction");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.RedVsBlue)
|
||||
{
|
||||
sb.Append("Red v Blue");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < tourney.ParticipantsPerMatch; ++i)
|
||||
if (ruleset.Flavors.Count > 0)
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
sb.Append('v');
|
||||
defs = new BitArray(basedef.Options);
|
||||
|
||||
sb.Append(tourney.PlayersPerParticipant);
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i)
|
||||
defs.Or(ruleset.Flavors[i].Options);
|
||||
|
||||
height += ruleset.Flavors.Count * 18;
|
||||
}
|
||||
}
|
||||
|
||||
if (tourney.EventController != null)
|
||||
sb.Append(' ').Append(tourney.EventController.Title);
|
||||
|
||||
sb.Append(" Tournament Signup");
|
||||
|
||||
AddBorderedText(22, 22, 294, 20, Center(sb.ToString()), LabelColor32, BlackColor32);
|
||||
AddBorderedText(22, 50, 294, 40, "You have requested to join the tournament. Do you accept the rules?", 0xB0C868,
|
||||
BlackColor32);
|
||||
|
||||
AddImageTiled(32, 88, 264, 1, 9107);
|
||||
AddImageTiled(42, 90, 264, 1, 9157);
|
||||
|
||||
#region Rules
|
||||
|
||||
int y = 100;
|
||||
|
||||
var groupText = tourney.GroupType switch
|
||||
{
|
||||
GroupingType.HighVsLow => "High vs Low",
|
||||
GroupingType.Nearest => "Closest opponent",
|
||||
GroupingType.Random => "Random",
|
||||
_ => null
|
||||
};
|
||||
|
||||
AddBorderedText(35, y, 190, 20, $"Grouping: {groupText}", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
|
||||
var tieText = tourney.TieType switch
|
||||
{
|
||||
TieType.Random => "Random",
|
||||
TieType.Highest => "Highest advances",
|
||||
TieType.Lowest => "Lowest advances",
|
||||
TieType.FullAdvancement => (tourney.ParticipantsPerMatch == 2 ? "Both advance" : "Everyone advances"),
|
||||
TieType.FullElimination => (tourney.ParticipantsPerMatch == 2 ? "Both eliminated" : "Everyone eliminated"),
|
||||
_ => null
|
||||
};
|
||||
|
||||
AddBorderedText(35, y, 190, 20, $"Tiebreaker: {tieText}", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
|
||||
string sdText = "Off";
|
||||
|
||||
if (tourney.SuddenDeath > TimeSpan.Zero)
|
||||
{
|
||||
sdText = $"{(int)tourney.SuddenDeath.TotalMinutes}:{tourney.SuddenDeath.Seconds:D2}";
|
||||
|
||||
if (tourney.SuddenDeathRounds > 0)
|
||||
sdText = $"{sdText} (first {tourney.SuddenDeathRounds} rounds)";
|
||||
else
|
||||
sdText = $"{sdText} (all rounds)";
|
||||
}
|
||||
{
|
||||
defs = basedef.Options;
|
||||
}
|
||||
|
||||
AddBorderedText(35, y, 240, 20, $"Sudden Death: {sdText}", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
|
||||
y += 6;
|
||||
AddImageTiled(32, y - 1, 264, 1, 9107);
|
||||
AddImageTiled(42, y + 1, 264, 1, 9157);
|
||||
y += 6;
|
||||
|
||||
AddBorderedText(35, y, 190, 20, $"Ruleset: {basedef.Title}", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i, y += 18)
|
||||
AddBorderedText(35, y, 190, 20, $" + {ruleset.Flavors[i].Title}", LabelColor32, BlackColor32);
|
||||
|
||||
y += 4;
|
||||
|
||||
if (changes > 0)
|
||||
{
|
||||
AddBorderedText(35, y, 190, 20, "Modifications:", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
BitArray opts = ruleset.Options;
|
||||
|
||||
for (int i = 0; i < opts.Length; ++i)
|
||||
if (defs[i] != opts[i])
|
||||
++changes;
|
||||
|
||||
height += changes * 22;
|
||||
|
||||
height += 10 + 22 + 25 + 25;
|
||||
|
||||
if (tourney.PlayersPerParticipant > 1)
|
||||
height += 36 + tourney.PlayersPerParticipant * 20;
|
||||
|
||||
#endregion
|
||||
|
||||
Closable = false;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
//AddBackground( 0, 0, 400, 220, 9150 );
|
||||
AddBackground(1, 1, 398, height, 3600);
|
||||
//AddBackground( 16, 15, 369, 189, 9100 );
|
||||
|
||||
AddImageTiled(16, 15, 369, height - 29, 3604);
|
||||
AddAlphaRegion(16, 15, 369, height - 29);
|
||||
|
||||
AddImage(215, -43, 0xEE40);
|
||||
//AddImage( 330, 141, 0x8BA );
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (tourney.TourneyType == TourneyType.FreeForAll)
|
||||
{
|
||||
sb.Append("FFA");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.RandomTeam)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-Team");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.Faction)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-Team Faction");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.RedVsBlue)
|
||||
{
|
||||
sb.Append("Red v Blue");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < tourney.ParticipantsPerMatch; ++i)
|
||||
{
|
||||
string name = ruleset.Layout.FindByIndex(i);
|
||||
if (sb.Length > 0)
|
||||
sb.Append('v');
|
||||
|
||||
if (name != null) // sanity
|
||||
{
|
||||
AddImage(35, y, opts[i] ? 0xD3 : 0xD2);
|
||||
AddBorderedText(60, y, 165, 22, name, LabelColor32, BlackColor32);
|
||||
}
|
||||
|
||||
y += 22;
|
||||
sb.Append(tourney.PlayersPerParticipant);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddBorderedText(35, y, 190, 20, "Modifications: None", LabelColor32, BlackColor32);
|
||||
}
|
||||
|
||||
if (tourney.EventController != null)
|
||||
sb.Append(' ').Append(tourney.EventController.Title);
|
||||
|
||||
sb.Append(" Tournament Signup");
|
||||
|
||||
AddBorderedText(22, 22, 294, 20, Center(sb.ToString()), LabelColor32, BlackColor32);
|
||||
AddBorderedText(22, 50, 294, 40, "You have requested to join the tournament. Do you accept the rules?", 0xB0C868,
|
||||
BlackColor32);
|
||||
|
||||
AddImageTiled(32, 88, 264, 1, 9107);
|
||||
AddImageTiled(42, 90, 264, 1, 9157);
|
||||
|
||||
#region Rules
|
||||
|
||||
int y = 100;
|
||||
|
||||
var groupText = tourney.GroupType switch
|
||||
{
|
||||
GroupingType.HighVsLow => "High vs Low",
|
||||
GroupingType.Nearest => "Closest opponent",
|
||||
GroupingType.Random => "Random",
|
||||
_ => null
|
||||
};
|
||||
|
||||
AddBorderedText(35, y, 190, 20, $"Grouping: {groupText}", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
}
|
||||
|
||||
#endregion
|
||||
var tieText = tourney.TieType switch
|
||||
{
|
||||
TieType.Random => "Random",
|
||||
TieType.Highest => "Highest advances",
|
||||
TieType.Lowest => "Lowest advances",
|
||||
TieType.FullAdvancement => (tourney.ParticipantsPerMatch == 2 ? "Both advance" : "Everyone advances"),
|
||||
TieType.FullElimination => (tourney.ParticipantsPerMatch == 2 ? "Both eliminated" : "Everyone eliminated"),
|
||||
_ => null
|
||||
};
|
||||
|
||||
#region Team
|
||||
AddBorderedText(35, y, 190, 20, $"Tiebreaker: {tieText}", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
|
||||
string sdText = "Off";
|
||||
|
||||
if (tourney.SuddenDeath > TimeSpan.Zero)
|
||||
{
|
||||
sdText = $"{(int)tourney.SuddenDeath.TotalMinutes}:{tourney.SuddenDeath.Seconds:D2}";
|
||||
|
||||
if (tourney.SuddenDeathRounds > 0)
|
||||
sdText = $"{sdText} (first {tourney.SuddenDeathRounds} rounds)";
|
||||
else
|
||||
sdText = $"{sdText} (all rounds)";
|
||||
}
|
||||
|
||||
AddBorderedText(35, y, 240, 20, $"Sudden Death: {sdText}", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
|
||||
y += 6;
|
||||
AddImageTiled(32, y - 1, 264, 1, 9107);
|
||||
AddImageTiled(42, y + 1, 264, 1, 9157);
|
||||
y += 6;
|
||||
|
||||
AddBorderedText(35, y, 190, 20, $"Ruleset: {basedef.Title}", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i, y += 18)
|
||||
AddBorderedText(35, y, 190, 20, $" + {ruleset.Flavors[i].Title}", LabelColor32, BlackColor32);
|
||||
|
||||
y += 4;
|
||||
|
||||
if (changes > 0)
|
||||
{
|
||||
AddBorderedText(35, y, 190, 20, "Modifications:", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < opts.Length; ++i)
|
||||
if (defs[i] != opts[i])
|
||||
{
|
||||
string name = ruleset.Layout.FindByIndex(i);
|
||||
|
||||
if (name != null) // sanity
|
||||
{
|
||||
AddImage(35, y, opts[i] ? 0xD3 : 0xD2);
|
||||
AddBorderedText(60, y, 165, 22, name, LabelColor32, BlackColor32);
|
||||
}
|
||||
|
||||
y += 22;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddBorderedText(35, y, 190, 20, "Modifications: None", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Team
|
||||
|
||||
if (tourney.PlayersPerParticipant > 1)
|
||||
{
|
||||
y += 8;
|
||||
AddImageTiled(32, y - 1, 264, 1, 9107);
|
||||
AddImageTiled(42, y + 1, 264, 1, 9157);
|
||||
y += 8;
|
||||
|
||||
AddBorderedText(35, y, 190, 20, "Your Team", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < players.Count; ++i, y += 20)
|
||||
{
|
||||
if (i == 0)
|
||||
AddImage(35, y, 0xD2);
|
||||
else
|
||||
AddGoldenButton(35, y, 1 + i);
|
||||
|
||||
AddBorderedText(60, y, 200, 20, players[i].Name, LabelColor32, BlackColor32);
|
||||
}
|
||||
|
||||
for (int i = players.Count; i < tourney.PlayersPerParticipant; ++i, y += 20)
|
||||
{
|
||||
if (i == 0)
|
||||
AddImage(35, y, 0xD2);
|
||||
else
|
||||
AddGoldenButton(35, y, 1 + i);
|
||||
|
||||
AddBorderedText(60, y, 200, 20, "(Empty)", LabelColor32, BlackColor32);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
if (tourney.PlayersPerParticipant > 1)
|
||||
{
|
||||
y += 8;
|
||||
AddImageTiled(32, y - 1, 264, 1, 9107);
|
||||
AddImageTiled(42, y + 1, 264, 1, 9157);
|
||||
y += 8;
|
||||
|
||||
AddBorderedText(35, y, 190, 20, "Your Team", LabelColor32, BlackColor32);
|
||||
y += 20;
|
||||
AddRadio(24, y, 9727, 9730, true, 1);
|
||||
AddBorderedText(60, y + 5, 250, 20, "Yes, I wish to join the tournament.", LabelColor32, BlackColor32);
|
||||
y += 35;
|
||||
|
||||
for (int i = 0; i < players.Count; ++i, y += 20)
|
||||
{
|
||||
if (i == 0)
|
||||
AddImage(35, y, 0xD2);
|
||||
else
|
||||
AddGoldenButton(35, y, 1 + i);
|
||||
AddRadio(24, y, 9727, 9730, false, 2);
|
||||
AddBorderedText(60, y + 5, 250, 20, "No, I do not wish to join.", LabelColor32, BlackColor32);
|
||||
y += 35;
|
||||
|
||||
AddBorderedText(60, y, 200, 20, players[i].Name, LabelColor32, BlackColor32);
|
||||
}
|
||||
|
||||
for (int i = players.Count; i < tourney.PlayersPerParticipant; ++i, y += 20)
|
||||
{
|
||||
if (i == 0)
|
||||
AddImage(35, y, 0xD2);
|
||||
else
|
||||
AddGoldenButton(35, y, 1 + i);
|
||||
|
||||
AddBorderedText(60, y, 200, 20, "(Empty)", LabelColor32, BlackColor32);
|
||||
}
|
||||
y -= 3;
|
||||
AddButton(314, y, 247, 248, 1);
|
||||
}
|
||||
|
||||
#endregion
|
||||
public string Center(string text) => $"<CENTER>{text}</CENTER>";
|
||||
|
||||
y += 8;
|
||||
AddImageTiled(32, y - 1, 264, 1, 9107);
|
||||
AddImageTiled(42, y + 1, 264, 1, 9157);
|
||||
y += 8;
|
||||
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
|
||||
|
||||
AddRadio(24, y, 9727, 9730, true, 1);
|
||||
AddBorderedText(60, y + 5, 250, 20, "Yes, I wish to join the tournament.", LabelColor32, BlackColor32);
|
||||
y += 35;
|
||||
|
||||
AddRadio(24, y, 9727, 9730, false, 2);
|
||||
AddBorderedText(60, y + 5, 250, 20, "No, I do not wish to join.", LabelColor32, BlackColor32);
|
||||
y += 35;
|
||||
|
||||
y -= 3;
|
||||
AddButton(314, y, 247, 248, 1);
|
||||
}
|
||||
|
||||
public string Center(string text) => $"<CENTER>{text}</CENTER>";
|
||||
|
||||
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
|
||||
|
||||
private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor)
|
||||
{
|
||||
AddColoredText(x - 1, y - 1, width, height, text, borderColor);
|
||||
AddColoredText(x - 1, y + 1, width, height, text, borderColor);
|
||||
AddColoredText(x + 1, y - 1, width, height, text, borderColor);
|
||||
AddColoredText(x + 1, y + 1, width, height, text, borderColor);
|
||||
AddColoredText(x, y, width, height, text, color);
|
||||
}
|
||||
|
||||
private void AddColoredText(int x, int y, int width, int height, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, height, text);
|
||||
else
|
||||
AddHtml(x, y, width, height, Color(text, color));
|
||||
}
|
||||
|
||||
public void AddGoldenButton(int x, int y, int bid)
|
||||
{
|
||||
AddButton(x, y, 0xD2, 0xD2, bid);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1 && info.IsSwitched(1))
|
||||
private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor)
|
||||
{
|
||||
Tournament tourney = m_Tournament;
|
||||
Mobile from = m_From;
|
||||
AddColoredText(x - 1, y - 1, width, height, text, borderColor);
|
||||
AddColoredText(x - 1, y + 1, width, height, text, borderColor);
|
||||
AddColoredText(x + 1, y - 1, width, height, text, borderColor);
|
||||
AddColoredText(x + 1, y + 1, width, height, text, borderColor);
|
||||
AddColoredText(x, y, width, height, text, color);
|
||||
}
|
||||
|
||||
switch (tourney.Stage)
|
||||
private void AddColoredText(int x, int y, int width, int height, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, height, text);
|
||||
else
|
||||
AddHtml(x, y, width, height, Color(text, color));
|
||||
}
|
||||
|
||||
public void AddGoldenButton(int x, int y, int bid)
|
||||
{
|
||||
AddButton(x, y, 0xD2, 0xD2, bid);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1 && info.IsSwitched(1))
|
||||
{
|
||||
case TournamentStage.Fighting:
|
||||
Tournament tourney = m_Tournament;
|
||||
Mobile from = m_From;
|
||||
|
||||
switch (tourney.Stage)
|
||||
{
|
||||
if (m_Registrar != null)
|
||||
case TournamentStage.Fighting:
|
||||
{
|
||||
if (m_Tournament.HasParticipant(from))
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "Excuse me? You are already signed up.", from.NetState);
|
||||
else
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "The tournament has already begun. You are too late to signup now.",
|
||||
from.NetState);
|
||||
}
|
||||
if (m_Registrar != null)
|
||||
{
|
||||
if (m_Tournament.HasParticipant(from))
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "Excuse me? You are already signed up.", from.NetState);
|
||||
else
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "The tournament has already begun. You are too late to signup now.",
|
||||
from.NetState);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case TournamentStage.Inactive:
|
||||
{
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "The tournament is closed.", from.NetState);
|
||||
|
||||
break;
|
||||
}
|
||||
case TournamentStage.Signup:
|
||||
{
|
||||
if (m_Players.Count != tourney.PlayersPerParticipant)
|
||||
{
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "You have not yet chosen your team.", from.NetState);
|
||||
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
break;
|
||||
}
|
||||
|
||||
Ladder ladder = Ladder.Instance;
|
||||
|
||||
for (int i = 0; i < m_Players.Count; ++i)
|
||||
case TournamentStage.Inactive:
|
||||
{
|
||||
Mobile mob = m_Players[i];
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "The tournament is closed.", from.NetState);
|
||||
|
||||
LadderEntry entry = ladder?.Find(mob);
|
||||
|
||||
if (entry != null && Ladder.GetLevel(entry.Experience) < tourney.LevelRequirement)
|
||||
{
|
||||
if (m_Registrar != null)
|
||||
{
|
||||
if (mob == from)
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "You have not yet proven yourself a worthy dueler.", from.NetState);
|
||||
else
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, $"{mob.Name} has not yet proven themselves a worthy dueler.",
|
||||
from.NetState);
|
||||
}
|
||||
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
return;
|
||||
}
|
||||
|
||||
if (tourney.IsFactionRestricted && Faction.Find(mob) == null)
|
||||
break;
|
||||
}
|
||||
case TournamentStage.Signup:
|
||||
{
|
||||
if (m_Players.Count != tourney.PlayersPerParticipant)
|
||||
{
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "Only those who have declared their faction allegiance may participate.",
|
||||
from.NetState);
|
||||
0x35, false, "You have not yet chosen your team.", from.NetState);
|
||||
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
if (tourney.HasParticipant(mob))
|
||||
Ladder ladder = Ladder.Instance;
|
||||
|
||||
for (int i = 0; i < m_Players.Count; ++i)
|
||||
{
|
||||
if (m_Registrar != null)
|
||||
Mobile mob = m_Players[i];
|
||||
|
||||
LadderEntry entry = ladder?.Find(mob);
|
||||
|
||||
if (entry != null && Ladder.GetLevel(entry.Experience) < tourney.LevelRequirement)
|
||||
{
|
||||
if (mob == from)
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "You have already entered this tournament.", from.NetState);
|
||||
else
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, $"{mob.Name} has already entered this tournament.", from.NetState);
|
||||
if (m_Registrar != null)
|
||||
{
|
||||
if (mob == from)
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "You have not yet proven yourself a worthy dueler.", from.NetState);
|
||||
else
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, $"{mob.Name} has not yet proven themselves a worthy dueler.",
|
||||
from.NetState);
|
||||
}
|
||||
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
return;
|
||||
}
|
||||
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
return;
|
||||
if (tourney.IsFactionRestricted && Faction.Find(mob) == null)
|
||||
{
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "Only those who have declared their faction allegiance may participate.",
|
||||
from.NetState);
|
||||
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
return;
|
||||
}
|
||||
|
||||
if (tourney.HasParticipant(mob))
|
||||
{
|
||||
if (m_Registrar != null)
|
||||
{
|
||||
if (mob == from)
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, "You have already entered this tournament.", from.NetState);
|
||||
else
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, $"{mob.Name} has already entered this tournament.", from.NetState);
|
||||
}
|
||||
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob is PlayerMobile mobile && mobile.DuelContext != null)
|
||||
{
|
||||
if (mob == from)
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false,
|
||||
"You are already assigned to a duel. You must yield it before joining this tournament.",
|
||||
from.NetState);
|
||||
else
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false,
|
||||
$"{mobile.Name} is already assigned to a duel. They must yield it before joining this tournament.",
|
||||
from.NetState);
|
||||
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (mob is PlayerMobile mobile && mobile.DuelContext != null)
|
||||
if (m_Registrar != null)
|
||||
{
|
||||
if (mob == from)
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false,
|
||||
"You are already assigned to a duel. You must yield it before joining this tournament.",
|
||||
from.NetState);
|
||||
string fmt;
|
||||
|
||||
if (tourney.PlayersPerParticipant == 1)
|
||||
fmt =
|
||||
"As you say m'{0}. I've written your name to the bracket. The tournament will begin {1}.";
|
||||
else if (tourney.PlayersPerParticipant == 2)
|
||||
fmt =
|
||||
"As you wish m'{0}. The tournament will begin {1}, but first you must name your partner.";
|
||||
else
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false,
|
||||
$"{mobile.Name} is already assigned to a duel. They must yield it before joining this tournament.",
|
||||
from.NetState);
|
||||
fmt = "As you wish m'{0}. The tournament will begin {1}, but first you must name your team.";
|
||||
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
return;
|
||||
string timeUntil;
|
||||
int minutesUntil = (int)Math.Round((tourney.SignupStart + tourney.SignupPeriod - DateTime.UtcNow)
|
||||
.TotalMinutes);
|
||||
|
||||
if (minutesUntil == 0)
|
||||
timeUntil = "momentarily";
|
||||
else
|
||||
timeUntil = $"in {minutesUntil} minute{(minutesUntil == 1 ? "" : "s")}";
|
||||
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, string.Format(fmt, from.Female ? "Lady" : "Lord", timeUntil), from.NetState);
|
||||
}
|
||||
|
||||
TourneyParticipant part = new TourneyParticipant(from);
|
||||
part.Players.Clear();
|
||||
part.Players.AddRange(m_Players);
|
||||
|
||||
tourney.Participants.Add(part);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (info.ButtonID > 1)
|
||||
{
|
||||
int index = info.ButtonID - 1;
|
||||
|
||||
if (m_Registrar != null)
|
||||
{
|
||||
string fmt;
|
||||
|
||||
if (tourney.PlayersPerParticipant == 1)
|
||||
fmt =
|
||||
"As you say m'{0}. I've written your name to the bracket. The tournament will begin {1}.";
|
||||
else if (tourney.PlayersPerParticipant == 2)
|
||||
fmt =
|
||||
"As you wish m'{0}. The tournament will begin {1}, but first you must name your partner.";
|
||||
else
|
||||
fmt = "As you wish m'{0}. The tournament will begin {1}, but first you must name your team.";
|
||||
|
||||
string timeUntil;
|
||||
int minutesUntil = (int)Math.Round((tourney.SignupStart + tourney.SignupPeriod - DateTime.UtcNow)
|
||||
.TotalMinutes);
|
||||
|
||||
if (minutesUntil == 0)
|
||||
timeUntil = "momentarily";
|
||||
else
|
||||
timeUntil = $"in {minutesUntil} minute{(minutesUntil == 1 ? "" : "s")}";
|
||||
|
||||
m_Registrar.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x35, false, string.Format(fmt, from.Female ? "Lady" : "Lord", timeUntil), from.NetState);
|
||||
}
|
||||
|
||||
TourneyParticipant part = new TourneyParticipant(from);
|
||||
part.Players.Clear();
|
||||
part.Players.AddRange(m_Players);
|
||||
|
||||
tourney.Participants.Add(part);
|
||||
|
||||
break;
|
||||
if (index > 0 && index < m_Players.Count)
|
||||
{
|
||||
m_Players.RemoveAt(index);
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
}
|
||||
else if (m_Players.Count < m_Tournament.PlayersPerParticipant)
|
||||
{
|
||||
m_From.BeginTarget(12, false, TargetFlags.None, AddPlayer_OnTarget);
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (info.ButtonID > 1)
|
||||
|
||||
private void AddPlayer_OnTarget(Mobile from, object obj)
|
||||
{
|
||||
int index = info.ButtonID - 1;
|
||||
|
||||
if (index > 0 && index < m_Players.Count)
|
||||
{
|
||||
m_Players.RemoveAt(index);
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
}
|
||||
else if (m_Players.Count < m_Tournament.PlayersPerParticipant)
|
||||
{
|
||||
m_From.BeginTarget(12, false, TargetFlags.None, AddPlayer_OnTarget);
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddPlayer_OnTarget(Mobile from, object obj)
|
||||
{
|
||||
if (!(obj is Mobile mob) || mob == from)
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "Excuse me?", from.NetState);
|
||||
}
|
||||
else if (!mob.Player)
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
if (mob.Body.IsHuman)
|
||||
mob.SayTo(from, 1005443); // Nay, I would rather stay here and watch a nail rust.
|
||||
else
|
||||
mob.SayTo(from, 1005444); // The creature ignores your offer.
|
||||
}
|
||||
else if (AcceptDuelGump.IsIgnored(mob, from) || mob.Blessed)
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "They ignore your invitation.", from.NetState);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(mob is PlayerMobile pm))
|
||||
return;
|
||||
|
||||
if (pm.DuelContext != null)
|
||||
if (!(obj is Mobile mob) || mob == from)
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "They are already assigned to another duel.", from.NetState);
|
||||
0x22, false, "Excuse me?", from.NetState);
|
||||
}
|
||||
else if (mob.HasGump<AcceptTeamGump>())
|
||||
else if (!mob.Player)
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
if (mob.Body.IsHuman)
|
||||
mob.SayTo(from, 1005443); // Nay, I would rather stay here and watch a nail rust.
|
||||
else
|
||||
mob.SayTo(from, 1005444); // The creature ignores your offer.
|
||||
}
|
||||
else if (AcceptDuelGump.IsIgnored(mob, from) || mob.Blessed)
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "They have already been offered a partnership.", from.NetState);
|
||||
}
|
||||
else if (mob.HasGump<ConfirmSignupGump>())
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "They are already trying to join this tournament.", from.NetState);
|
||||
}
|
||||
else if (m_Players.Contains(mob))
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "You have already named them as a team member.", from.NetState);
|
||||
}
|
||||
else if (m_Tournament.HasParticipant(mob))
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "They have already entered this tournament.", from.NetState);
|
||||
}
|
||||
else if (m_Players.Count >= m_Tournament.PlayersPerParticipant)
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "Your team is full.", from.NetState);
|
||||
0x22, false, "They ignore your invitation.", from.NetState);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
mob.SendGump(new AcceptTeamGump(from, mob, m_Tournament, m_Registrar, m_Players));
|
||||
if (!(mob is PlayerMobile pm))
|
||||
return;
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x59, false,
|
||||
$"As you command m'{(from.Female ? "Lady" : "Lord")}. I've given your offer to {mob.Name}.",
|
||||
from.NetState);
|
||||
if (pm.DuelContext != null)
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "They are already assigned to another duel.", from.NetState);
|
||||
}
|
||||
else if (mob.HasGump<AcceptTeamGump>())
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "They have already been offered a partnership.", from.NetState);
|
||||
}
|
||||
else if (mob.HasGump<ConfirmSignupGump>())
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "They are already trying to join this tournament.", from.NetState);
|
||||
}
|
||||
else if (m_Players.Contains(mob))
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "You have already named them as a team member.", from.NetState);
|
||||
}
|
||||
else if (m_Tournament.HasParticipant(mob))
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "They have already entered this tournament.", from.NetState);
|
||||
}
|
||||
else if (m_Players.Count >= m_Tournament.PlayersPerParticipant)
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x22, false, "Your team is full.", from.NetState);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
|
||||
mob.SendGump(new AcceptTeamGump(from, mob, m_Tournament, m_Registrar, m_Players));
|
||||
|
||||
m_Registrar?.PrivateOverheadMessage(MessageType.Regular,
|
||||
0x59, false,
|
||||
$"As you command m'{(from.Female ? "Lady" : "Lord")}. I've given your offer to {mob.Name}.",
|
||||
from.NetState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,13 +28,9 @@ namespace Server.Engines.ConPVP
|
|||
from.CloseGump<ParticipantGump>();
|
||||
|
||||
RulesetLayout depthCounter = page;
|
||||
int depth = 0;
|
||||
|
||||
while (depthCounter != null)
|
||||
{
|
||||
++depth;
|
||||
depthCounter = depthCounter.Parent;
|
||||
}
|
||||
|
||||
int count = page.Children.Length + page.Options.Length;
|
||||
|
||||
|
|
|
|||
|
|
@ -350,9 +350,10 @@ namespace Server.Engines.ConPVP
|
|||
AddLeftArrow(25, 11, ToButtonID(0, 0));
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"));
|
||||
|
||||
// List<PyramidLevel> levelsList = m_List != null
|
||||
// ? Utility.CastListCovariant<object, PyramidLevel>(m_List)
|
||||
// : new List<PyramidLevel>(tourney.Pyramid.Levels);
|
||||
|
||||
// List<PyramidLevel> levelsList = m_List != null
|
||||
// ? Utility.CastListCovariant<object, PyramidLevel>(m_List)
|
||||
// : new List<PyramidLevel>(tourney.Pyramid.Levels);
|
||||
|
||||
StartPage(out int index, out int count, out int y, 12);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
Ladder = new Ladder();
|
||||
|
||||
if (Ladder.Instance == null)
|
||||
Ladder.Instance = Ladder;
|
||||
Ladder.Instance ??= Ladder;
|
||||
}
|
||||
|
||||
public LadderController(Serial serial) : base(serial)
|
||||
|
|
|
|||
|
|
@ -81,8 +81,7 @@ namespace Server.Items
|
|||
{
|
||||
base.OnAdded(parent);
|
||||
|
||||
if (Owner == null)
|
||||
Owner = RootParent as Mobile;
|
||||
Owner ??= RootParent as Mobile;
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
|
|
@ -111,4 +110,4 @@ namespace Server.Items
|
|||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,9 +154,8 @@ namespace Server.Engines.Craft
|
|||
if (context != null)
|
||||
resIndex = m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex;
|
||||
|
||||
bool allRequiredSkills = true;
|
||||
double chance = m_CraftItem.GetSuccessChance(m_From, resIndex > -1 ? res.GetAt(resIndex).ItemType : null,
|
||||
m_CraftSystem, false, ref allRequiredSkills);
|
||||
m_CraftSystem, false, out _);
|
||||
double excepChance = m_CraftItem.GetExceptionalChance(m_CraftSystem, chance, m_From);
|
||||
|
||||
if (chance < 0.0)
|
||||
|
|
|
|||
|
|
@ -682,12 +682,12 @@ namespace Server.Engines.Craft
|
|||
|
||||
public bool CheckSkills(Mobile from, Type typeRes, CraftSystem craftSystem, ref int quality,
|
||||
ref bool allRequiredSkills) =>
|
||||
CheckSkills(from, typeRes, craftSystem, ref quality, ref allRequiredSkills, true);
|
||||
CheckSkills(from, typeRes, craftSystem, ref quality, out allRequiredSkills, true);
|
||||
|
||||
public bool CheckSkills(Mobile from, Type typeRes, CraftSystem craftSystem, ref int quality,
|
||||
ref bool allRequiredSkills, bool gainSkills)
|
||||
out bool allRequiredSkills, bool gainSkills)
|
||||
{
|
||||
double chance = GetSuccessChance(from, typeRes, craftSystem, gainSkills, ref allRequiredSkills);
|
||||
double chance = GetSuccessChance(from, typeRes, craftSystem, gainSkills, out allRequiredSkills);
|
||||
|
||||
if (GetExceptionalChance(craftSystem, chance, from) > Utility.RandomDouble())
|
||||
quality = 2;
|
||||
|
|
@ -696,7 +696,7 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
|
||||
public double GetSuccessChance(Mobile from, Type typeRes, CraftSystem craftSystem, bool gainSkills,
|
||||
ref bool allRequiredSkills)
|
||||
out bool allRequiredSkills)
|
||||
{
|
||||
double minMainSkill = 0.0;
|
||||
double maxMainSkill = 0.0;
|
||||
|
|
@ -750,8 +750,8 @@ namespace Server.Engines.Craft
|
|||
if (RequiredExpansion == Expansion.None ||
|
||||
from.NetState?.SupportsExpansion(RequiredExpansion) == true)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = GetSuccessChance(from, typeRes, craftSystem, false, ref allRequiredSkills);
|
||||
bool allRequiredSkills;
|
||||
double chance = GetSuccessChance(from, typeRes, craftSystem, false, out allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
|
|
@ -1100,7 +1100,7 @@ namespace Server.Engines.Craft
|
|||
int quality = 1;
|
||||
bool allRequiredSkills = true;
|
||||
|
||||
m_CraftItem.CheckSkills(m_From, m_TypeRes, m_CraftSystem, ref quality, ref allRequiredSkills, false);
|
||||
m_CraftItem.CheckSkills(m_From, m_TypeRes, m_CraftSystem, ref quality, out allRequiredSkills, false);
|
||||
|
||||
CraftContext context = m_CraftSystem.GetContext(m_From);
|
||||
|
||||
|
|
|
|||
|
|
@ -51,8 +51,7 @@ namespace Server.Engines.Craft
|
|||
if (craftItem == null || craftItem.Resources.Count == 0)
|
||||
return EnhanceResult.BadItem;
|
||||
|
||||
bool allRequiredSkills = false;
|
||||
if (craftItem.GetSuccessChance(from, resType, craftSystem, false, ref allRequiredSkills) <= 0.0)
|
||||
if (craftItem.GetSuccessChance(from, resType, craftSystem, false, out _) <= 0.0)
|
||||
return EnhanceResult.NoSkill;
|
||||
|
||||
CraftResourceInfo info = CraftResources.GetInfo(resource);
|
||||
|
|
@ -322,4 +321,4 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,18 +149,18 @@ namespace Server.Engines.Craft
|
|||
public override void InitCraftList()
|
||||
{
|
||||
/*
|
||||
Synthax for a SIMPLE craft item
|
||||
Syntax for a SIMPLE craft item
|
||||
AddCraft( ObjectType, Group, MinSkill, MaxSkill, ResourceType, Amount, Message )
|
||||
|
||||
ObjectType : The type of the object you want to add to the build list.
|
||||
Group : The group in wich the object will be showed in the craft menu.
|
||||
MinSkill : The minimum of skill value
|
||||
MaxSkill : The maximum of skill value
|
||||
Group : The group in which the object will be showed in the craft menu.
|
||||
MinSkill : The minimum of skill value
|
||||
MaxSkill : The maximum of skill value
|
||||
ResourceType : The type of the resource the mobile need to create the item
|
||||
Amount : The amount of the ResourceType it need to create the item
|
||||
Message : String or Int for Localized. The message that will be sent to the mobile, if the specified resource is missing.
|
||||
Amount : The amount of the ResourceType it need to create the item
|
||||
Message : String or Int for Localized. The message that will be sent to the mobile, if the specified resource is missing.
|
||||
|
||||
Synthax for a COMPLEXE craft item. A complexe item is an item that need either more than
|
||||
Syntax for a COMPLEX craft item. A complex item is an item that need either more than
|
||||
only one skill, or more than only one resource.
|
||||
|
||||
Coming soon....
|
||||
|
|
@ -183,7 +183,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
#endregion
|
||||
|
||||
int index = -1;
|
||||
int index;
|
||||
|
||||
#region Platemail
|
||||
|
||||
|
|
|
|||
|
|
@ -898,8 +898,7 @@ namespace Server.Factions
|
|||
|
||||
public static void HandleDeath(Mobile victim, Mobile killer)
|
||||
{
|
||||
if (killer == null)
|
||||
killer = victim.FindMostRecentDamager(true);
|
||||
killer ??= victim.FindMostRecentDamager(true);
|
||||
|
||||
PlayerState killerState = PlayerState.Find(killer);
|
||||
Container killerPack = killer?.Backpack;
|
||||
|
|
|
|||
|
|
@ -260,8 +260,7 @@ namespace Server.Factions
|
|||
|
||||
public void OnGivenSilverTo(Mobile mob)
|
||||
{
|
||||
if (SilverGiven == null)
|
||||
SilverGiven = new List<SilverGivenEntry>();
|
||||
SilverGiven ??= new List<SilverGivenEntry>();
|
||||
|
||||
SilverGiven.Add(new SilverGivenEntry(mob));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ namespace Server.Factions
|
|||
|
||||
public void ConstructGuardLists()
|
||||
{
|
||||
GuardDefinition[] defs = Owner == null ? new GuardDefinition[0] : Owner.Definition.Guards;
|
||||
GuardDefinition[] defs = Owner?.Definition.Guards ?? new GuardDefinition[0];
|
||||
|
||||
GuardLists = new List<GuardList>();
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace Server.Engines.Harvest
|
|||
new MutateEntry(0.0, 125.0, -2375.0, false, typeof(PrizedFish), typeof(WondrousFish), typeof(TrulyRareFish),
|
||||
typeof(PeculiarFish)),
|
||||
new MutateEntry(0.0, 105.0, -420.0, false, typeof(Boots), typeof(Shoes), typeof(Sandals), typeof(ThighBoots)),
|
||||
new MutateEntry(0.0, 200.0, -200.0, false, new Type[1] { null })
|
||||
new MutateEntry(0.0, 200.0, -200.0, false, new Type[] { null })
|
||||
};
|
||||
|
||||
private static int[] m_WaterTiles =
|
||||
|
|
|
|||
|
|
@ -145,8 +145,7 @@ namespace Server.Engines.Help
|
|||
|
||||
public static void Save()
|
||||
{
|
||||
if (List == null)
|
||||
List = Load();
|
||||
List ??= Load();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@ namespace Server.Engines.MLQuests
|
|||
|
||||
public static void EnsureExistence()
|
||||
{
|
||||
if (m_Instance == null)
|
||||
m_Instance = new MLQuestPersistence();
|
||||
m_Instance ??= new MLQuestPersistence();
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
|
|
@ -55,4 +54,4 @@ namespace Server.Engines.MLQuests
|
|||
MLQuest.Deserialize(reader, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -433,8 +433,7 @@ namespace Server.Engines.MLQuests
|
|||
foreach (BaseObjectiveInstance objective in instance.Objectives)
|
||||
if (!objective.Expired && objective is KillObjectiveInstance kill)
|
||||
{
|
||||
if (type == null)
|
||||
type = mob.GetType();
|
||||
type ??= mob.GetType();
|
||||
|
||||
if (kill.AddKill(mob, type))
|
||||
{
|
||||
|
|
@ -477,8 +476,7 @@ namespace Server.Engines.MLQuests
|
|||
instance.Quester = quester;
|
||||
}
|
||||
|
||||
if (deliverInstance == null)
|
||||
deliverInstance = instance;
|
||||
deliverInstance ??= instance;
|
||||
|
||||
break; // don't return, we may have to complete more deliveries
|
||||
}
|
||||
|
|
@ -563,8 +561,7 @@ namespace Server.Engines.MLQuests
|
|||
* Save first quest that reaches the CanOffer call.
|
||||
* If no quests are valid at all, return this quest for displaying the CanOffer error message.
|
||||
*/
|
||||
if (fallback == null)
|
||||
fallback = quest;
|
||||
fallback ??= quest;
|
||||
|
||||
if (quest.CanOffer(quester, pm, context, false))
|
||||
m_EligiblePool.Add(quest);
|
||||
|
|
|
|||
|
|
@ -100,9 +100,8 @@ namespace Server.Engines.MLQuests.Mobiles
|
|||
|
||||
if (m.CanSee(this) && m.InLOS(this) && m.CanBeginAction(this))
|
||||
{
|
||||
if (shoutPacket == null)
|
||||
shoutPacket = Packet.Acquire(new MessageLocalized(Serial, Body, MessageType.Regular, 946, 3,
|
||||
1078099, Name, "")); // Double Click On Me For Help!
|
||||
shoutPacket ??= Packet.Acquire(new MessageLocalized(Serial, Body, MessageType.Regular, 946, 3,
|
||||
1078099, Name, "")); // Double Click On Me For Help!
|
||||
|
||||
state.Send(shoutPacket);
|
||||
}
|
||||
|
|
@ -135,4 +134,4 @@ namespace Server.Engines.MLQuests.Mobiles
|
|||
Frozen = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,7 +162,6 @@ namespace Server.PathAlgorithms.SlowAStar
|
|||
switch (i)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
x = 0;
|
||||
y = -1;
|
||||
break;
|
||||
|
|
@ -272,4 +271,4 @@ namespace Server.PathAlgorithms.SlowAStar
|
|||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,8 +84,7 @@ namespace Server.Engines.Plants
|
|||
}
|
||||
else
|
||||
{
|
||||
if (PlantSystem == null)
|
||||
PlantSystem = new PlantSystem(this, false);
|
||||
PlantSystem ??= new PlantSystem(this, false);
|
||||
|
||||
int hits = (int)(PlantSystem.MaxHits * ratio);
|
||||
|
||||
|
|
|
|||
|
|
@ -326,18 +326,15 @@ namespace Server.Engines.Quests
|
|||
|
||||
if (completed && restartDelay > TimeSpan.Zero || !completed && restartDelay == TimeSpan.MaxValue)
|
||||
{
|
||||
List<QuestRestartInfo> doneQuests = From.DoneQuests;
|
||||
|
||||
if (doneQuests == null)
|
||||
From.DoneQuests = doneQuests = new List<QuestRestartInfo>();
|
||||
From.DoneQuests ??= new List<QuestRestartInfo>();
|
||||
|
||||
bool found = false;
|
||||
|
||||
Type ourQuestType = GetType();
|
||||
|
||||
for (int i = 0; i < doneQuests.Count; ++i)
|
||||
for (int i = 0; i < From.DoneQuests.Count; ++i)
|
||||
{
|
||||
QuestRestartInfo restartInfo = doneQuests[i];
|
||||
QuestRestartInfo restartInfo = From.DoneQuests[i];
|
||||
|
||||
if (restartInfo.QuestType == ourQuestType)
|
||||
{
|
||||
|
|
@ -348,7 +345,7 @@ namespace Server.Engines.Quests
|
|||
}
|
||||
|
||||
if (!found)
|
||||
doneQuests.Add(new QuestRestartInfo(ourQuestType, restartDelay));
|
||||
From.DoneQuests.Add(new QuestRestartInfo(ourQuestType, restartDelay));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -293,8 +293,7 @@ namespace Server.Mobiles
|
|||
|
||||
public void Defrag()
|
||||
{
|
||||
if (Entries == null)
|
||||
Entries = new List<SpawnerEntry>();
|
||||
Entries ??= new List<SpawnerEntry>();
|
||||
|
||||
for (int i = 0; i < Entries.Count; ++i)
|
||||
Entries[i].Defrag(this);
|
||||
|
|
@ -302,8 +301,6 @@ namespace Server.Mobiles
|
|||
|
||||
public void OnTick()
|
||||
{
|
||||
// DoTimer( m_Spawned.Count >= m_Count );
|
||||
|
||||
if (m_Group)
|
||||
{
|
||||
Defrag();
|
||||
|
|
@ -318,15 +315,6 @@ namespace Server.Mobiles
|
|||
Spawn();
|
||||
}
|
||||
|
||||
/*
|
||||
if ( m_Running && m_Timer != null )
|
||||
{
|
||||
if ( m_Spawned.Count >= m_Count && m_Timer.Running )
|
||||
DoTimer( true );
|
||||
else if ( m_Spawned.Count < m_Count && !m_Timer.Running )
|
||||
DoTimer( false );
|
||||
}
|
||||
*/
|
||||
DoTimer();
|
||||
}
|
||||
|
||||
|
|
@ -915,8 +903,7 @@ namespace Server.Mobiles
|
|||
|
||||
if (SpawnerType.GetType(typeName) == null)
|
||||
{
|
||||
if (m_WarnTimer == null)
|
||||
m_WarnTimer = new WarnTimer();
|
||||
m_WarnTimer ??= new WarnTimer();
|
||||
|
||||
m_WarnTimer.Add(Location, Map, typeName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ namespace Server.Misc
|
|||
|
||||
//This is the Exponentional regression with only 2 datapoints.
|
||||
//A log. func would also work, but it didn't make as much sense.
|
||||
//This function isn't OSI exact beign that I don't know OSI's func they used ;p
|
||||
//This function isn't OSI exact being that I don't know OSI's func they used ;p
|
||||
int x = pm.ToTTotalMonsterFame;
|
||||
|
||||
//const double A = 8.63316841 * Math.Pow( 10, -4 );
|
||||
|
|
|
|||
|
|
@ -372,8 +372,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
state.Mobile.ProcessDelta();
|
||||
|
||||
if (p == null)
|
||||
p = Packet.Acquire(new UpdateStatueAnimation(this, 1, m_Animation, m_Frames));
|
||||
p ??= Packet.Acquire(new UpdateStatueAnimation(this, 1, m_Animation, m_Frames));
|
||||
|
||||
state.Send(p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -587,8 +587,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.Accounts:
|
||||
{
|
||||
if (m_List == null)
|
||||
m_List = new List<object>();
|
||||
m_List ??= new List<object>();
|
||||
|
||||
List<Account> rads = state as List<Account>;
|
||||
|
||||
|
|
@ -1214,7 +1213,6 @@ namespace Server.Gumps
|
|||
case AccessLevel.Seer: return 0x144;
|
||||
case AccessLevel.GameMaster: return 0x21;
|
||||
case AccessLevel.Counselor: return 0x2;
|
||||
case AccessLevel.Player:
|
||||
default:
|
||||
{
|
||||
if (m.Kills >= 5)
|
||||
|
|
@ -1525,7 +1523,7 @@ namespace Server.Gumps
|
|||
{
|
||||
IPAddress[] ips = a.LoginIPs;
|
||||
|
||||
if (ips.Length != 0 && ip == ips[0] && AccountHandler.IPTable.ContainsKey(ips[0]))
|
||||
if (ips.Length != 0 && Equals(ip, ips[0]) && AccountHandler.IPTable.ContainsKey(ips[0]))
|
||||
--AccountHandler.IPTable[ip];
|
||||
|
||||
List<IPAddress> newList = new List<IPAddress>(ips);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using Server.Guilds;
|
||||
using Server.Network;
|
||||
|
||||
|
|
@ -48,12 +49,10 @@ namespace Server.Gumps
|
|||
if (fealty == null || !guild.IsMember(fealty))
|
||||
fealty = leader;
|
||||
|
||||
if (fealty == null)
|
||||
fealty = beholder;
|
||||
fealty ??= beholder;
|
||||
|
||||
string fealtyName;
|
||||
|
||||
if ((fealtyName = fealty.Name) == null || (fealtyName = fealtyName.Trim()).Length <= 0)
|
||||
string fealtyName = fealty.Name?.Trim();
|
||||
if (string.IsNullOrWhiteSpace(fealtyName))
|
||||
fealtyName = "(empty)";
|
||||
|
||||
if (beholder == fealty)
|
||||
|
|
|
|||
|
|
@ -185,9 +185,7 @@ namespace Server.Guilds
|
|||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if (!IsMember(pm, guild))
|
||||
if (!(sender.Mobile is PlayerMobile pm && IsMember(pm, guild)))
|
||||
return;
|
||||
|
||||
RankDefinition playerRank = pm.GuildRank;
|
||||
|
|
|
|||
|
|
@ -153,9 +153,7 @@ namespace Server.Gumps
|
|||
|
||||
if (parent != null)
|
||||
{
|
||||
if (m_Stack == null)
|
||||
m_Stack = new Stack<StackEntry>();
|
||||
|
||||
m_Stack ??= new Stack<StackEntry>();
|
||||
m_Stack.Push(parent);
|
||||
}
|
||||
|
||||
|
|
@ -599,7 +597,7 @@ namespace Server.Gumps
|
|||
{
|
||||
MethodInfo parseMethod = t.GetMethod("Parse", new[] { typeof(string) });
|
||||
|
||||
return parseMethod.Invoke(null, new object[] { s });
|
||||
return parseMethod?.Invoke(null, new object[] { s });
|
||||
}
|
||||
|
||||
throw new Exception("bad");
|
||||
|
|
|
|||
|
|
@ -127,7 +127,6 @@ namespace Server.Gumps
|
|||
switch (index)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
type = ModelBodyType.Monsters;
|
||||
list = m_Monster;
|
||||
break;
|
||||
|
|
@ -284,12 +283,12 @@ namespace Server.Gumps
|
|||
|
||||
public int CompareTo(InternalEntry comp)
|
||||
{
|
||||
int v = Name.CompareTo(comp.Name);
|
||||
if (Name == null && comp.Name == null)
|
||||
return 0;
|
||||
|
||||
if (v == 0)
|
||||
Body.CompareTo(comp.Body);
|
||||
int v = Name?.CompareTo(comp.Name) ?? 1;
|
||||
|
||||
return v;
|
||||
return v == 0 ? Body.CompareTo(comp.Body) : v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,14 +71,12 @@ namespace Server.Gumps
|
|||
bool isBody = prop.IsDefined(typeof(BodyAttribute), false);
|
||||
|
||||
object val = prop.GetValue(m_Object, null);
|
||||
string initialText;
|
||||
|
||||
if (val == null)
|
||||
initialText = "";
|
||||
else if (val is TextDefinition definition)
|
||||
initialText = definition.GetValue();
|
||||
else
|
||||
initialText = val.ToString();
|
||||
string initialText = val switch
|
||||
{
|
||||
null => "",
|
||||
TextDefinition definition => definition.GetValue(),
|
||||
_ => val.ToString()
|
||||
};
|
||||
|
||||
AddPage(0);
|
||||
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ namespace Server.Gumps
|
|||
x -= OldStyle ? OffsetSize : 0;
|
||||
|
||||
AddImageTiled(x, y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0), EntryHeight, EntryGumpID);
|
||||
AddLabel(x + TextOffsetX, y, TextHue, group.Name);
|
||||
AddLabel(x + TextOffsetX, y, TextHue, group?.Name ?? "");
|
||||
|
||||
x += emptyWidth + (OldStyle ? OffsetSize * 2 : 0);
|
||||
x += OffsetSize;
|
||||
|
|
@ -306,7 +306,6 @@ namespace Server.Gumps
|
|||
switch (sk.Lock)
|
||||
{
|
||||
default:
|
||||
case SkillLock.Up:
|
||||
buttonID1 = 0x983;
|
||||
buttonID2 = 0x983;
|
||||
xOffset = 6;
|
||||
|
|
|
|||
|
|
@ -46,10 +46,7 @@ namespace Server.Items
|
|||
public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes,
|
||||
BaseTool tool, CraftItem craftItem, int resHue)
|
||||
{
|
||||
Type resourceType = typeRes;
|
||||
|
||||
if (resourceType == null)
|
||||
resourceType = craftItem.Resources.GetAt(0).ItemType;
|
||||
Type resourceType = typeRes ?? craftItem.Resources.GetAt(0).ItemType;
|
||||
|
||||
Resource = CraftResources.GetFromType(resourceType);
|
||||
|
||||
|
|
|
|||
|
|
@ -486,10 +486,7 @@ namespace Server.Items
|
|||
if (makersMark)
|
||||
Crafter = from;
|
||||
|
||||
Type resourceType = typeRes;
|
||||
|
||||
if (resourceType == null)
|
||||
resourceType = craftItem.Resources.GetAt(0).ItemType;
|
||||
Type resourceType = typeRes ?? craftItem.Resources.GetAt(0).ItemType;
|
||||
|
||||
Resource = CraftResources.GetFromType(resourceType);
|
||||
PlayerConstructed = true;
|
||||
|
|
@ -1271,8 +1268,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
if (SkillBonuses == null)
|
||||
SkillBonuses = new AosSkillBonuses(this);
|
||||
SkillBonuses ??= new AosSkillBonuses(this);
|
||||
|
||||
Mobile m = Parent as Mobile;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ElvenGlasses : BaseArmor
|
||||
|
|
@ -126,10 +128,11 @@ namespace Server.Items
|
|||
WeaponAttributes = new AosWeaponAttributes(this);
|
||||
}
|
||||
|
||||
[Flags]
|
||||
private enum SaveFlag
|
||||
{
|
||||
None = 0x00000000,
|
||||
WeaponAttributes = 0x00000001
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
// Intended for defined books only
|
||||
public BaseBook(int itemID, bool writable) : this(itemID, 0)
|
||||
public BaseBook(int itemID, bool writable) : this(itemID, 0, writable)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -152,10 +152,7 @@ namespace Server.Items
|
|||
|
||||
if (DefaultResource != CraftResource.None)
|
||||
{
|
||||
Type resourceType = typeRes;
|
||||
|
||||
if (resourceType == null)
|
||||
resourceType = craftItem.Resources.GetAt(0).ItemType;
|
||||
Type resourceType = typeRes ?? craftItem.Resources.GetAt(0).ItemType;
|
||||
|
||||
Resource = CraftResources.GetFromType(resourceType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,13 +85,9 @@ namespace Server.Items
|
|||
|
||||
if (Commodity != null)
|
||||
{
|
||||
string args;
|
||||
|
||||
if (Commodity.Name == null)
|
||||
args =
|
||||
$"#{(Commodity is ICommodity commodity ? commodity.DescriptionNumber : Commodity.LabelNumber)}\t{Commodity.Amount}";
|
||||
else
|
||||
args = $"{Commodity.Name}\t{Commodity.Amount}";
|
||||
var args = Commodity.Name == null ?
|
||||
$"#{(Commodity is ICommodity commodity ? commodity.DescriptionNumber : Commodity.LabelNumber)}\t{Commodity.Amount}" :
|
||||
$"{Commodity.Name}\t{Commodity.Amount}";
|
||||
|
||||
list.Add(1060658, args); // ~1_val~: ~2_val~
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,10 +64,7 @@ namespace Server.Items
|
|||
if (makersMark)
|
||||
Crafter = from;
|
||||
|
||||
Type resourceType = typeRes;
|
||||
|
||||
if (resourceType == null)
|
||||
resourceType = craftItem.Resources.GetAt(0).ItemType;
|
||||
Type resourceType = typeRes ?? craftItem.Resources.GetAt(0).ItemType;
|
||||
|
||||
Resource = CraftResources.GetFromType(resourceType);
|
||||
|
||||
|
|
|
|||
|
|
@ -131,10 +131,7 @@ namespace Server.Items
|
|||
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
|
||||
CraftItem craftItem, int resHue)
|
||||
{
|
||||
Type resourceType = typeRes;
|
||||
|
||||
if (resourceType == null)
|
||||
resourceType = craftItem.Resources.GetAt(0).ItemType;
|
||||
Type resourceType = typeRes ?? craftItem.Resources.GetAt(0).ItemType;
|
||||
|
||||
Resource = CraftResources.GetFromType(resourceType);
|
||||
|
||||
|
|
|
|||
|
|
@ -347,8 +347,7 @@ namespace Server.Items
|
|||
if (Aggressors.Count == 0 || Items.Count == 0)
|
||||
return;
|
||||
|
||||
if (m_InstancedItems == null)
|
||||
m_InstancedItems = new Dictionary<Item, InstancedItemInfo>();
|
||||
m_InstancedItems ??= new Dictionary<Item, InstancedItemInfo>();
|
||||
|
||||
List<Item> m_Stackables = new List<Item>();
|
||||
List<Item> m_Unstackables = new List<Item>();
|
||||
|
|
@ -427,8 +426,7 @@ namespace Server.Items
|
|||
|
||||
if (InstancedCorpse)
|
||||
{
|
||||
if (m_InstancedItems == null)
|
||||
m_InstancedItems = new Dictionary<Item, InstancedItemInfo>();
|
||||
m_InstancedItems ??= new Dictionary<Item, InstancedItemInfo>();
|
||||
|
||||
m_InstancedItems.Add(carved, new InstancedItemInfo(carved, carver));
|
||||
}
|
||||
|
|
@ -836,8 +834,7 @@ namespace Server.Items
|
|||
if (item == null)
|
||||
return;
|
||||
|
||||
if (m_RestoreTable == null)
|
||||
m_RestoreTable = new Dictionary<Item, Point3D>();
|
||||
m_RestoreTable ??= new Dictionary<Item, Point3D>();
|
||||
|
||||
m_RestoreTable[item] = loc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -261,13 +261,7 @@ namespace Server.Items
|
|||
|
||||
public void PlaySound(IEntity trigger)
|
||||
{
|
||||
IEntity ent = null;
|
||||
|
||||
if (PlaySoundAtTrigger)
|
||||
ent = trigger;
|
||||
|
||||
if (ent == null)
|
||||
ent = this;
|
||||
IEntity ent = PlaySoundAtTrigger ? trigger : this;
|
||||
|
||||
Effects.PlaySound((ent as Item)?.GetWorldLocation() ?? ent.Location, ent.Map, SoundID);
|
||||
}
|
||||
|
|
@ -292,13 +286,8 @@ namespace Server.Items
|
|||
|
||||
public void InternalDoEffect(IEntity trigger)
|
||||
{
|
||||
IEntity from = m_Source, to = m_Target;
|
||||
|
||||
if (from == null)
|
||||
from = trigger;
|
||||
|
||||
if (to == null)
|
||||
to = trigger;
|
||||
IEntity from = m_Source ?? trigger;
|
||||
IEntity to = m_Target ?? trigger;
|
||||
|
||||
switch (EffectType)
|
||||
{
|
||||
|
|
@ -334,4 +323,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,8 +66,7 @@ namespace Server.Items
|
|||
from.SendLocalizedMessage(1060581); // You've already lit it! Better throw it now!
|
||||
}
|
||||
|
||||
if (m_Users == null)
|
||||
m_Users = new List<Mobile>();
|
||||
m_Users ??= new List<Mobile>();
|
||||
|
||||
if (!m_Users.Contains(from))
|
||||
m_Users.Add(from);
|
||||
|
|
|
|||
|
|
@ -76,8 +76,7 @@ namespace Server.Items
|
|||
|
||||
from.RevealingAction();
|
||||
|
||||
if (Users == null)
|
||||
Users = new List<Mobile>();
|
||||
Users ??= new List<Mobile>();
|
||||
|
||||
if (!Users.Contains(from))
|
||||
Users.Add(from);
|
||||
|
|
|
|||
|
|
@ -810,11 +810,8 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
if (Attributes == null)
|
||||
Attributes = new AosAttributes(this);
|
||||
|
||||
if (SkillBonuses == null)
|
||||
SkillBonuses = new AosSkillBonuses(this);
|
||||
Attributes ??= new AosAttributes(this);
|
||||
SkillBonuses ??= new AosSkillBonuses(this);
|
||||
|
||||
if (Core.AOS && Parent is Mobile mobile)
|
||||
SkillBonuses.AddTo(mobile);
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ namespace Server.Items
|
|||
double toHeal = min + Utility.RandomDouble() * (max - min);
|
||||
|
||||
if (Patient.Body.IsMonster || Patient.Body.IsAnimal)
|
||||
toHeal += Patient.HitsMax / 100;
|
||||
toHeal += Patient.HitsMax / 100.0;
|
||||
|
||||
if (Core.AOS)
|
||||
toHeal -= toHeal * Slips * 0.35; // TODO: Verify algorithm
|
||||
|
|
|
|||
|
|
@ -66,8 +66,7 @@ namespace Server.Items
|
|||
{
|
||||
if (!pm.HasRecipe(r))
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = r.CraftItem.GetSuccessChance(pm, null, r.CraftSystem, false, ref allRequiredSkills);
|
||||
double chance = r.CraftItem.GetSuccessChance(pm, null, r.CraftSystem, false, out var allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -274,13 +274,7 @@ namespace Server.Items
|
|||
|
||||
private void InternalUpdatePetName()
|
||||
{
|
||||
BaseCreature pet = Pet;
|
||||
|
||||
if (pet == null)
|
||||
PetName = "";
|
||||
else
|
||||
PetName = pet.Name;
|
||||
|
||||
PetName = Pet?.Name ?? "";
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,8 +63,7 @@ namespace Server.Items
|
|||
|
||||
public void TurnOn()
|
||||
{
|
||||
if (m_Fire == null)
|
||||
m_Fire = new Item();
|
||||
m_Fire ??= new Item();
|
||||
|
||||
m_Fire.ItemID = 0x19AB;
|
||||
m_Fire.Movable = false;
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ namespace Server.Items
|
|||
public static bool Slays(TalismanSlayerName name, Mobile m)
|
||||
{
|
||||
if (m == null || !m_Table.TryGetValue(name, out Type[] types) || types == null)
|
||||
return false;;
|
||||
return false;
|
||||
|
||||
Type type = m.GetType();
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,7 @@ namespace Server.Items
|
|||
|
||||
public virtual void StartTimer()
|
||||
{
|
||||
if (m_Timer == null)
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0), Refresh);
|
||||
m_Timer ??= Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0), Refresh);
|
||||
}
|
||||
|
||||
public virtual void StopTimer()
|
||||
|
|
|
|||
|
|
@ -107,10 +107,7 @@ namespace Server.Items
|
|||
|
||||
PlayerConstructed = true;
|
||||
|
||||
Type resourceType = typeRes;
|
||||
|
||||
if (resourceType == null)
|
||||
resourceType = craftItem.Resources.GetAt(0).ItemType;
|
||||
Type resourceType = typeRes ?? craftItem.Resources.GetAt(0).ItemType;
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -144,8 +144,7 @@ namespace Server.Items
|
|||
|
||||
if (!pm.Warmode)
|
||||
{
|
||||
if (m_RecoveryTimer == null)
|
||||
m_RecoveryTimer = Timer.DelayCall(TimeSpan.FromSeconds(10), pm.RecoverAmmo);
|
||||
m_RecoveryTimer ??= Timer.DelayCall(TimeSpan.FromSeconds(10), pm.RecoverAmmo);
|
||||
|
||||
if (!m_RecoveryTimer.Running)
|
||||
m_RecoveryTimer.Start();
|
||||
|
|
|
|||
|
|
@ -1019,8 +1019,7 @@ namespace Server
|
|||
if (!GetValues(i, out SkillName skill, out double bonus))
|
||||
continue;
|
||||
|
||||
if (m_Mods == null)
|
||||
m_Mods = new List<SkillMod>();
|
||||
m_Mods ??= new List<SkillMod>();
|
||||
|
||||
SkillMod sk = new DefaultSkillMod(skill, true, bonus);
|
||||
sk.ObeyCap = true;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace Server.Misc
|
|||
writer.WriteLine(@$"
|
||||
ModernUO Speech Log Page - {pageType}
|
||||
|
||||
From: '{sender.RawName}', Account: '{((sender.Account is Account accSend) ? accSend.Username : " ??? ")}'
|
||||
From: '{sender.RawName}', Account: '{(sender.Account is Account accSend ? accSend.Username : " ??? ")}'
|
||||
|
||||
Location: {sender.Location} [{sender.Map}]
|
||||
Sent on: {time.Year}/{time.Month:00}/{time.Day:00} {time.Hour}:{time.Minute:00}:{time.Second:00}
|
||||
|
|
|
|||
|
|
@ -345,9 +345,7 @@ namespace Server.Guilds
|
|||
|
||||
if (state != null)
|
||||
{
|
||||
if (p == null)
|
||||
p = Packet.Acquire(new UnicodeMessage(from.Serial, from.Body, MessageType.Alliance, hue, 3,
|
||||
from.Language, from.Name, text));
|
||||
p ??= Packet.Acquire(new UnicodeMessage(from.Serial, from.Body, MessageType.Alliance, hue, 3, from.Language, from.Name, text));
|
||||
|
||||
state.Send(p);
|
||||
}
|
||||
|
|
@ -936,10 +934,9 @@ namespace Server.Guilds
|
|||
if (!NewGuildSystem)
|
||||
return;
|
||||
|
||||
if (killer == null)
|
||||
killer = victim.FindMostRecentDamager(false);
|
||||
killer ??= victim.FindMostRecentDamager(false);
|
||||
|
||||
if (killer == null || victim.Guild == null || killer.Guild == null)
|
||||
if (killer?.Guild == null || victim.Guild == null)
|
||||
return;
|
||||
|
||||
Guild victimGuild = GetAllianceLeader(victim.Guild as Guild);
|
||||
|
|
@ -1148,24 +1145,10 @@ namespace Server.Guilds
|
|||
}
|
||||
}
|
||||
|
||||
if (AllyDeclarations == null)
|
||||
AllyDeclarations = new List<Guild>();
|
||||
|
||||
if (AllyInvitations == null)
|
||||
AllyInvitations = new List<Guild>();
|
||||
|
||||
|
||||
if (AcceptedWars == null)
|
||||
AcceptedWars = new List<WarDeclaration>();
|
||||
|
||||
if (PendingWars == null)
|
||||
PendingWars = new List<WarDeclaration>();
|
||||
|
||||
|
||||
/*
|
||||
if ( ( !NewGuildSystem && m_Guildstone == null )|| m_Members.Count == 0 )
|
||||
Disband();
|
||||
*/
|
||||
AllyDeclarations ??= new List<Guild>();
|
||||
AllyInvitations ??= new List<Guild>();
|
||||
AcceptedWars ??= new List<WarDeclaration>();
|
||||
PendingWars ??= new List<WarDeclaration>();
|
||||
|
||||
Timer.DelayCall(TimeSpan.Zero, VerifyGuild_Callback);
|
||||
}
|
||||
|
|
@ -1343,9 +1326,7 @@ namespace Server.Guilds
|
|||
|
||||
if (state != null)
|
||||
{
|
||||
if (p == null)
|
||||
p = Packet.Acquire(new UnicodeMessage(from.Serial, from.Body, MessageType.Guild, hue, 3,
|
||||
from.Language, from.Name, text));
|
||||
p ??= Packet.Acquire(new UnicodeMessage(from.Serial, from.Body, MessageType.Guild, hue, 3, from.Language, from.Name, text));
|
||||
|
||||
state.Send(p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -465,8 +465,7 @@ namespace Server.Misc
|
|||
|
||||
public void QueuePoll(ShardPoller poller)
|
||||
{
|
||||
if (m_Polls == null)
|
||||
m_Polls = new Queue<ShardPoller>(4);
|
||||
m_Polls ??= new Queue<ShardPoller>(4);
|
||||
|
||||
m_Polls.Enqueue(poller);
|
||||
}
|
||||
|
|
@ -479,11 +478,15 @@ namespace Server.Misc
|
|||
{
|
||||
if (m_Polls?.Count > 0)
|
||||
{
|
||||
ShardPoller poller = m_Polls.Dequeue();
|
||||
ShardPoller shardPoller = m_Polls.Dequeue();
|
||||
|
||||
if (poller != null)
|
||||
if (shardPoller != null)
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0),
|
||||
() => m_From.SendGump(new ShardPollGump(m_From, poller, false, m_Polls)));
|
||||
data =>
|
||||
{
|
||||
var (mobile, poller, polls) = data;
|
||||
m_From.SendGump(new ShardPollGump(mobile, poller, false, polls));
|
||||
}, (m_From, shardPoller, m_Polls));
|
||||
}
|
||||
|
||||
if (info.ButtonID == 1)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
|
|
|
|||
|
|
@ -413,9 +413,9 @@ namespace Server
|
|||
floor.Add(p);
|
||||
|
||||
for (int xo = -1; xo <= 1; ++xo)
|
||||
for (int yo = -1; yo <= 1; ++yo)
|
||||
if ((xo != 0 || yo != 0) && IsFloor(map, x + xo, y + yo, false))
|
||||
RecurseFindFloor(map, x + xo, y + yo, floor);
|
||||
for (int yo = -1; yo <= 1; ++yo)
|
||||
if ((xo != 0 || yo != 0) && IsFloor(map, x + xo, y + yo, false))
|
||||
RecurseFindFloor(map, x + xo, y + yo, floor);
|
||||
}
|
||||
|
||||
[Flags]
|
||||
|
|
|
|||
|
|
@ -121,8 +121,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
AcquireFocusMob(m_Mobile.RangePerception * 2, m_Mobile.FightMode, true, false, true);
|
||||
|
||||
if (m_Mobile.FocusMob == null)
|
||||
m_Mobile.FocusMob = m_Mobile.Combatant;
|
||||
m_Mobile.FocusMob ??= m_Mobile.Combatant;
|
||||
|
||||
return base.DoActionFlee();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -403,9 +403,9 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
|
||||
public virtual bool IsNecroFamiliar => Summoned && m_ControlMaster != null &&
|
||||
SummonFamiliarSpell.Table.TryGetValue(m_ControlMaster, out BaseCreature bc) &&
|
||||
bc == this;
|
||||
public virtual bool IsNecroFamiliar =>
|
||||
Summoned && m_ControlMaster != null &&
|
||||
SummonFamiliarSpell.Table.TryGetValue(m_ControlMaster, out BaseCreature bc) && bc == this;
|
||||
|
||||
public virtual bool DeleteCorpseOnDeath => !Core.AOS && m_bSummoned;
|
||||
|
||||
|
|
@ -3732,8 +3732,7 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual void AddPetFriend(Mobile m)
|
||||
{
|
||||
if (Friends == null)
|
||||
Friends = new List<Mobile>();
|
||||
Friends ??= new List<Mobile>();
|
||||
|
||||
Friends.Add(m);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -326,11 +326,11 @@ namespace Server.Mobiles
|
|||
|
||||
private bool TimeToSpare() => m_Owner.NextCombatTime - Core.TickCount > 1000;
|
||||
|
||||
private bool OutOfMaxDistance(Mobile target) => !m_Owner.InRange(target, m_Owner.Weapon.MaxRange);
|
||||
private bool OutOfMaxDistance(IPoint2D target) => !m_Owner.InRange(target, m_Owner.Weapon.MaxRange);
|
||||
|
||||
private bool InMinDistance(Mobile target) => m_Owner.InRange(target, 4);
|
||||
private bool InMinDistance(IPoint2D target) => m_Owner.InRange(target, 4);
|
||||
|
||||
private void TeleportTo(Mobile target)
|
||||
private void TeleportTo(IEntity target)
|
||||
{
|
||||
Point3D from = m_Owner.Location;
|
||||
Point3D to = target.Location;
|
||||
|
|
|
|||
|
|
@ -61,10 +61,10 @@ namespace Server.Mobiles
|
|||
foreach (Mobile m in eable)
|
||||
{
|
||||
if (m == this || !CanBeHarmful(m) ||
|
||||
!(m is BaseCreature creature && (creature.Controlled || creature.Summoned || creature.Team != Team) ||
|
||||
m.Player))
|
||||
!(m.Player || m is BaseCreature creature &&
|
||||
(creature.Controlled || creature.Summoned || creature.Team != Team)))
|
||||
continue;
|
||||
|
||||
|
||||
DoHarmful(m);
|
||||
|
||||
m.FixedParticles(0x374A, 10, 15, 5013, 0x496, 0, EffectLayer.Waist);
|
||||
|
|
@ -77,7 +77,7 @@ namespace Server.Mobiles
|
|||
Hits += toDrain;
|
||||
m.Damage(toDrain, this);
|
||||
}
|
||||
|
||||
|
||||
eable.Free();
|
||||
}
|
||||
|
||||
|
|
@ -109,4 +109,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ namespace Server.Mobiles
|
|||
continue;
|
||||
|
||||
if (m is PlayerMobile pm && pm.Mounted)
|
||||
pm.Mount.Rider = null;
|
||||
pm.Mount.Rider = null;
|
||||
|
||||
int damage = (int)(m.Hits * 0.6);
|
||||
if (damage < 10)
|
||||
|
|
|
|||
|
|
@ -76,8 +76,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
OpenedBy = from;
|
||||
|
||||
if (m_Timer == null)
|
||||
m_Timer = new DecayTimer(this);
|
||||
m_Timer ??= new DecayTimer(this);
|
||||
|
||||
if (!m_Timer.Running)
|
||||
m_Timer.Start();
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@ namespace Server.Mobiles
|
|||
Body = 0x15;
|
||||
BaseSoundID = 0xDB;
|
||||
break;
|
||||
default:
|
||||
case 5: // slime
|
||||
default: // slime
|
||||
Body = 51;
|
||||
BaseSoundID = 456;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1882,7 +1882,7 @@ namespace Server.Mobiles
|
|||
|
||||
pointsToGain += (int)Math.Sqrt(GameTime.TotalSeconds * 4);
|
||||
pointsToGain *= 5;
|
||||
pointsToGain += (int)Math.Pow(Skills.Total / 250, 2);
|
||||
pointsToGain += (int)Math.Pow(Skills.Total / 250.0, 2);
|
||||
|
||||
if (VirtueHelper.Award(m, VirtueName.Justice, pointsToGain, ref gainedPath))
|
||||
{
|
||||
|
|
@ -1894,7 +1894,7 @@ namespace Server.Mobiles
|
|||
m.FixedParticles(0x375A, 9, 20, 5027, EffectLayer.Waist);
|
||||
m.PlaySound(0x1F7);
|
||||
|
||||
m_NextJustAward = DateTime.UtcNow + TimeSpan.FromMinutes(pointsToGain / 3);
|
||||
m_NextJustAward = DateTime.UtcNow + TimeSpan.FromMinutes(pointsToGain / 3.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2010,9 +2010,7 @@ namespace Server.Mobiles
|
|||
|
||||
if (mob?.AccessLevel >= AccessLevel.GameMaster && mob.AccessLevel > from.AccessLevel)
|
||||
{
|
||||
if (p == null)
|
||||
p = Packet.Acquire(new UnicodeMessage(from.Serial, from.Body, MessageType.Regular, from.SpeechHue, 3,
|
||||
from.Language, from.Name, text));
|
||||
p ??= Packet.Acquire(new UnicodeMessage(from.Serial, from.Body, MessageType.Regular, from.SpeechHue, 3, from.Language, from.Name, text));
|
||||
|
||||
ns.Send(p);
|
||||
}
|
||||
|
|
@ -2358,32 +2356,23 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
|
||||
if (RecentlyReported == null)
|
||||
RecentlyReported = new List<Mobile>();
|
||||
RecentlyReported ??= new List<Mobile>();
|
||||
|
||||
// Professions weren't verified on 1.0 RC0
|
||||
if (!CharacterCreation.VerifyProfession(Profession))
|
||||
Profession = 0;
|
||||
|
||||
if (PermaFlags == null)
|
||||
PermaFlags = new List<Mobile>();
|
||||
PermaFlags ??= new List<Mobile>();
|
||||
JusticeProtectors ??= new List<Mobile>();
|
||||
BOBFilter ??= new BOBFilter();
|
||||
|
||||
if (JusticeProtectors == null)
|
||||
JusticeProtectors = new List<Mobile>();
|
||||
|
||||
if (BOBFilter == null)
|
||||
BOBFilter = new BOBFilter();
|
||||
|
||||
if (m_GuildRank == null)
|
||||
m_GuildRank =
|
||||
RankDefinition
|
||||
.Member; //Default to member if going from older version to new version (only time it should be null)
|
||||
//Default to member if going from older version to new version (only time it should be null)
|
||||
m_GuildRank ??= RankDefinition.Member;
|
||||
|
||||
if (LastOnline == DateTime.MinValue && Account != null)
|
||||
LastOnline = ((Account)Account).LastLogin;
|
||||
|
||||
if (ChampionTitles == null)
|
||||
ChampionTitles = new ChampionTitleInfo();
|
||||
ChampionTitles ??= new ChampionTitleInfo();
|
||||
|
||||
if (AccessLevel > AccessLevel.Player)
|
||||
m_IgnoreMobiles = true;
|
||||
|
|
@ -2797,9 +2786,10 @@ namespace Server.Mobiles
|
|||
|
||||
for (int i = AutoStabled.Count - 1; i >= 0; --i)
|
||||
{
|
||||
BaseCreature pet = AutoStabled[i] as BaseCreature;
|
||||
if (!(AutoStabled[i] is BaseCreature pet))
|
||||
continue;
|
||||
|
||||
if (pet?.Deleted == true)
|
||||
if (pet.Deleted)
|
||||
{
|
||||
pet.IsStabled = false;
|
||||
pet.StabledBy = null;
|
||||
|
|
@ -3099,22 +3089,15 @@ namespace Server.Mobiles
|
|||
|
||||
if (ammo == null)
|
||||
continue;
|
||||
string name = ammo.Name;
|
||||
|
||||
ammo.Amount = kvp.Value;
|
||||
|
||||
if (name == null)
|
||||
string name = ammo.Name ?? ammo switch
|
||||
{
|
||||
if (ammo is Arrow)
|
||||
name = "arrow";
|
||||
else if (ammo is Bolt)
|
||||
name = "bolt";
|
||||
}
|
||||
|
||||
if (name != null && ammo.Amount > 1)
|
||||
name = $"{name}s";
|
||||
|
||||
if (name == null)
|
||||
name = $"#{ammo.LabelNumber}";
|
||||
Arrow _ => $"arrow{(ammo.Amount != 1 ? "s" : "")}",
|
||||
Bolt _ => $"bolt{(ammo.Amount != 1 ? "s" : "")}",
|
||||
_ => $"#{ammo.LabelNumber}"
|
||||
};
|
||||
|
||||
PlaceInBackpack(ammo);
|
||||
SendLocalizedMessage(1073504, $"{ammo.Amount}\t{name}"); // You recover ~1_NUM~ ~2_AMMO~.
|
||||
|
|
@ -3779,10 +3762,7 @@ namespace Server.Mobiles
|
|||
|
||||
m_DuelPlayer = value;
|
||||
|
||||
if (m_DuelPlayer == null)
|
||||
DuelContext = null;
|
||||
else
|
||||
DuelContext = m_DuelPlayer.Participant.Context;
|
||||
DuelContext = m_DuelPlayer?.Participant.Context;
|
||||
|
||||
bool isInTourney = DuelContext?.Finished == false && DuelContext.m_Tournament != null;
|
||||
|
||||
|
|
@ -4435,8 +4415,7 @@ namespace Server.Mobiles
|
|||
if (m_Values == null || index < 0 || index >= m_Values.Length)
|
||||
return 0;
|
||||
|
||||
if (m_Values[index] == null)
|
||||
m_Values[index] = new TitleInfo();
|
||||
m_Values[index] ??= new TitleInfo();
|
||||
|
||||
return m_Values[index].Value;
|
||||
}
|
||||
|
|
@ -4446,16 +4425,14 @@ namespace Server.Mobiles
|
|||
if (m_Values == null || index < 0 || index >= m_Values.Length)
|
||||
return DateTime.MinValue;
|
||||
|
||||
if (m_Values[index] == null)
|
||||
m_Values[index] = new TitleInfo();
|
||||
m_Values[index] ??= new TitleInfo();
|
||||
|
||||
return m_Values[index].LastDecay;
|
||||
}
|
||||
|
||||
public void SetValue(int index, int value)
|
||||
{
|
||||
if (m_Values == null)
|
||||
m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length];
|
||||
m_Values ??= new TitleInfo[ChampionSpawnInfo.Table.Length];
|
||||
|
||||
if (value < 0)
|
||||
value = 0;
|
||||
|
|
@ -4463,36 +4440,31 @@ namespace Server.Mobiles
|
|||
if (index < 0 || index >= m_Values.Length)
|
||||
return;
|
||||
|
||||
if (m_Values[index] == null)
|
||||
m_Values[index] = new TitleInfo();
|
||||
m_Values[index] ??= new TitleInfo();
|
||||
|
||||
m_Values[index].Value = value;
|
||||
}
|
||||
|
||||
public void Award(int index, int value)
|
||||
{
|
||||
if (m_Values == null)
|
||||
m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length];
|
||||
m_Values ??= new TitleInfo[ChampionSpawnInfo.Table.Length];
|
||||
|
||||
if (index < 0 || index >= m_Values.Length || value <= 0)
|
||||
return;
|
||||
|
||||
if (m_Values[index] == null)
|
||||
m_Values[index] = new TitleInfo();
|
||||
m_Values[index] ??= new TitleInfo();
|
||||
|
||||
m_Values[index].Value += value;
|
||||
}
|
||||
|
||||
public void Atrophy(int index, int value)
|
||||
{
|
||||
if (m_Values == null)
|
||||
m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length];
|
||||
m_Values ??= new TitleInfo[ChampionSpawnInfo.Table.Length];
|
||||
|
||||
if (index < 0 || index >= m_Values.Length || value <= 0)
|
||||
return;
|
||||
|
||||
if (m_Values[index] == null)
|
||||
m_Values[index] = new TitleInfo();
|
||||
m_Values[index] ??= new TitleInfo();
|
||||
|
||||
int before = m_Values[index].Value;
|
||||
|
||||
|
|
@ -4518,8 +4490,7 @@ namespace Server.Mobiles
|
|||
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
if (titles.m_Values[i] == null)
|
||||
titles.m_Values[i] = new TitleInfo();
|
||||
titles.m_Values[i] ??= new TitleInfo();
|
||||
|
||||
TitleInfo.Serialize(writer, titles.m_Values[i]);
|
||||
}
|
||||
|
|
@ -4531,8 +4502,7 @@ namespace Server.Mobiles
|
|||
if (t == null)
|
||||
return;
|
||||
|
||||
if (t.m_Values == null)
|
||||
t.m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length];
|
||||
t.m_Values ??= new TitleInfo[ChampionSpawnInfo.Table.Length];
|
||||
|
||||
for (int i = 0; i < t.m_Values.Length; i++)
|
||||
if (t.GetLastDecay(i) + LossDelay < DateTime.UtcNow)
|
||||
|
|
@ -4546,14 +4516,9 @@ namespace Server.Mobiles
|
|||
if (t == null)
|
||||
return;
|
||||
|
||||
if (t.m_Values == null)
|
||||
t.m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length];
|
||||
t.m_Values ??= new TitleInfo[ChampionSpawnInfo.Table.Length];
|
||||
|
||||
int count = 1;
|
||||
|
||||
for (int i = 0; i < t.m_Values.Length; i++)
|
||||
if (t.m_Values[i].Value > 900)
|
||||
count++;
|
||||
int count = 1 + t.m_Values.Count(t1 => t1.Value > 900);
|
||||
|
||||
t.Harrower = Math.Max(count, t.Harrower); //Harrower titles never decay.
|
||||
}
|
||||
|
|
@ -4611,8 +4576,7 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual void AcquireRecipe(int recipeID)
|
||||
{
|
||||
if (m_AcquiredRecipes == null)
|
||||
m_AcquiredRecipes = new Dictionary<int, bool>();
|
||||
m_AcquiredRecipes ??= new Dictionary<int, bool>();
|
||||
|
||||
m_AcquiredRecipes[recipeID] = true;
|
||||
}
|
||||
|
|
@ -4648,8 +4612,7 @@ namespace Server.Mobiles
|
|||
|
||||
RemoveBuff(b); //Check & subsequently remove the old one.
|
||||
|
||||
if (m_BuffTable == null)
|
||||
m_BuffTable = new Dictionary<BuffIcon, BuffInfo>();
|
||||
m_BuffTable ??= new Dictionary<BuffIcon, BuffInfo>();
|
||||
|
||||
m_BuffTable.Add(b.ID, b);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,8 +50,7 @@ namespace Server.Mobiles
|
|||
|
||||
public TownCrierEntry AddEntry(string[] lines, TimeSpan duration)
|
||||
{
|
||||
if (Entries == null)
|
||||
Entries = new List<TownCrierEntry>();
|
||||
Entries ??= new List<TownCrierEntry>();
|
||||
|
||||
TownCrierEntry tce = new TownCrierEntry(lines, duration);
|
||||
|
||||
|
|
@ -204,10 +203,7 @@ namespace Server.Mobiles
|
|||
|
||||
owner.GetRandomEntry(); // force expiration checks
|
||||
|
||||
int count = 0;
|
||||
|
||||
if (entries != null)
|
||||
count = entries.Count;
|
||||
int count = entries?.Count ?? 0;
|
||||
|
||||
AddImageTiled(0, 0, 300, 38 + (count == 0 ? 20 : count * 85), 0xA40);
|
||||
AddAlphaRegion(1, 1, 298, 36 + (count == 0 ? 20 : count * 85));
|
||||
|
|
@ -384,15 +380,13 @@ namespace Server.Mobiles
|
|||
|
||||
public TownCrierEntry AddEntry(string[] lines, TimeSpan duration)
|
||||
{
|
||||
if (Entries == null)
|
||||
Entries = new List<TownCrierEntry>();
|
||||
Entries ??= new List<TownCrierEntry>();
|
||||
|
||||
TownCrierEntry tce = new TownCrierEntry(lines, duration);
|
||||
|
||||
Entries.Add(tce);
|
||||
|
||||
if (m_AutoShoutTimer == null)
|
||||
m_AutoShoutTimer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), TimeSpan.FromMinutes(1.0), AutoShout_Callback);
|
||||
m_AutoShoutTimer ??= Timer.DelayCall(TimeSpan.FromSeconds(5.0), TimeSpan.FromMinutes(1.0), AutoShout_Callback);
|
||||
|
||||
return tce;
|
||||
}
|
||||
|
|
@ -417,8 +411,7 @@ namespace Server.Mobiles
|
|||
|
||||
public void ForceBeginAutoShout()
|
||||
{
|
||||
if (m_AutoShoutTimer == null)
|
||||
m_AutoShoutTimer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), TimeSpan.FromMinutes(1.0), AutoShout_Callback);
|
||||
m_AutoShoutTimer ??= Timer.DelayCall(TimeSpan.FromSeconds(5.0), TimeSpan.FromMinutes(1.0), AutoShout_Callback);
|
||||
}
|
||||
|
||||
private void AutoShout_Callback()
|
||||
|
|
@ -433,9 +426,8 @@ namespace Server.Mobiles
|
|||
}
|
||||
else if (m_NewsTimer == null)
|
||||
{
|
||||
int index = 0;
|
||||
m_NewsTimer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(3.0),
|
||||
() => ShoutNews_Callback(tce, index));
|
||||
() => ShoutNews_Callback(tce, 0));
|
||||
|
||||
PublicOverheadMessage(MessageType.Regular, 0x3B2, 502976); // Hear ye! Hear ye!
|
||||
}
|
||||
|
|
@ -478,9 +470,8 @@ namespace Server.Mobiles
|
|||
}
|
||||
else
|
||||
{
|
||||
int index = 0;
|
||||
m_NewsTimer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(3.0),
|
||||
() => ShoutNews_Callback(tce, index));
|
||||
() => ShoutNews_Callback(tce, 0));
|
||||
|
||||
PublicOverheadMessage(MessageType.Regular, 0x3B2, 502978); // Some of the latest news!
|
||||
}
|
||||
|
|
|
|||
|
|
@ -584,8 +584,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
if (House.IsOwner(Owner)) // Move to moving crate
|
||||
{
|
||||
if (House.MovingCrate == null)
|
||||
House.MovingCrate = new MovingCrate(House);
|
||||
House.MovingCrate ??= new MovingCrate(House);
|
||||
|
||||
if (HoldGold > 0)
|
||||
Banker.Deposit(House.MovingCrate, HoldGold);
|
||||
|
|
|
|||
|
|
@ -129,8 +129,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
if (RentalGold > 0 && House?.IsAosRules == true)
|
||||
{
|
||||
if (House.MovingCrate == null)
|
||||
House.MovingCrate = new MovingCrate(House);
|
||||
House.MovingCrate ??= new MovingCrate(House);
|
||||
|
||||
Banker.Deposit(House.MovingCrate, RentalGold);
|
||||
RentalGold = 0;
|
||||
|
|
|
|||
|
|
@ -116,8 +116,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
if (m_Inventory.Gold > 0)
|
||||
{
|
||||
if (house.MovingCrate == null)
|
||||
house.MovingCrate = new MovingCrate(house);
|
||||
house.MovingCrate ??= new MovingCrate(house);
|
||||
|
||||
Banker.Deposit(house.MovingCrate, m_Inventory.Gold);
|
||||
}
|
||||
|
|
@ -134,4 +133,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -995,8 +995,7 @@ namespace Server.Multis
|
|||
|
||||
public void DropToMovingCrate(Item item)
|
||||
{
|
||||
if (MovingCrate == null)
|
||||
MovingCrate = new MovingCrate(this);
|
||||
MovingCrate ??= new MovingCrate(this);
|
||||
|
||||
MovingCrate.DropItem(item);
|
||||
}
|
||||
|
|
@ -2594,32 +2593,16 @@ namespace Server.Multis
|
|||
Account acct = mob.Account as Account;
|
||||
Mobile trans = null;
|
||||
|
||||
for (int i = 0; i < acct.Length; ++i)
|
||||
if (acct[i] != null && acct[i] != mob)
|
||||
trans = acct[i];
|
||||
if (acct != null)
|
||||
for (int i = 0; i < acct.Length; ++i)
|
||||
if (acct[i] != null && acct[i] != mob)
|
||||
trans = acct[i];
|
||||
|
||||
for (int i = 0; i < houses.Count; ++i)
|
||||
{
|
||||
BaseHouse house = houses[i];
|
||||
|
||||
bool canClaim = false;
|
||||
|
||||
if (trans == null)
|
||||
canClaim = house.CoOwners.Count > 0;
|
||||
/*{
|
||||
for ( int j = 0; j < house.CoOwners.Count; ++j )
|
||||
{
|
||||
Mobile check = house.CoOwners[j] as Mobile;
|
||||
|
||||
if ( check != null && !check.Deleted && !HasAccountHouse( check ) )
|
||||
{
|
||||
canClaim = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if (trans == null && !canClaim)
|
||||
if (trans == null && house.CoOwners.Count == 0)
|
||||
Timer.DelayCall(TimeSpan.Zero, house.Delete);
|
||||
else
|
||||
house.Owner = trans;
|
||||
|
|
@ -2801,21 +2784,8 @@ namespace Server.Multis
|
|||
AllHouses.Remove(this);
|
||||
}
|
||||
|
||||
public static bool HasHouse(Mobile m)
|
||||
{
|
||||
if (m == null || !m_Table.TryGetValue(m, out List<BaseHouse> list))
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
BaseHouse h = list[i];
|
||||
|
||||
if (!h.Deleted)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public static bool HasHouse(Mobile m) =>
|
||||
m != null && m_Table.TryGetValue(m, out List<BaseHouse> list) && list.Any(h => !h.Deleted);
|
||||
|
||||
public static bool HasAccountHouse(Mobile m)
|
||||
{
|
||||
|
|
@ -2829,35 +2799,15 @@ namespace Server.Multis
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool IsOwner(Mobile m)
|
||||
{
|
||||
if (m == null)
|
||||
return false;
|
||||
public bool IsOwner(Mobile m) =>
|
||||
m != null && (m == m_Owner || m.AccessLevel >= AccessLevel.GameMaster ||
|
||||
IsAosRules && AccountHandler.CheckAccount(m, m_Owner));
|
||||
|
||||
if (m == m_Owner || m.AccessLevel >= AccessLevel.GameMaster)
|
||||
return true;
|
||||
public bool IsCoOwner(Mobile m) =>
|
||||
m != null && CoOwners != null &&
|
||||
(IsOwner(m) || CoOwners.Contains(m) || !IsAosRules && AccountHandler.CheckAccount(m, m_Owner));
|
||||
|
||||
return IsAosRules && AccountHandler.CheckAccount(m, m_Owner);
|
||||
}
|
||||
|
||||
public bool IsCoOwner(Mobile m)
|
||||
{
|
||||
if (m == null || CoOwners == null)
|
||||
return false;
|
||||
|
||||
if (IsOwner(m) || CoOwners.Contains(m))
|
||||
return true;
|
||||
|
||||
return !IsAosRules && AccountHandler.CheckAccount(m, m_Owner);
|
||||
}
|
||||
|
||||
public bool IsGuildMember(Mobile m)
|
||||
{
|
||||
if (m == null || Owner?.Guild == null)
|
||||
return false;
|
||||
|
||||
return m.Guild == Owner.Guild;
|
||||
}
|
||||
public bool IsGuildMember(Mobile m) => m != null && Owner?.Guild != null && m.Guild == Owner.Guild;
|
||||
|
||||
public void RemoveKeys(Mobile m)
|
||||
{
|
||||
|
|
@ -2866,8 +2816,7 @@ namespace Server.Multis
|
|||
uint keyValue = 0;
|
||||
|
||||
for (int i = 0; keyValue == 0 && i < Doors.Count; ++i)
|
||||
if (Doors[i] is BaseDoor door)
|
||||
keyValue = door.KeyValue;
|
||||
keyValue = Doors[i].KeyValue;
|
||||
|
||||
Key.RemoveKeys(m, keyValue);
|
||||
}
|
||||
|
|
@ -2879,30 +2828,23 @@ namespace Server.Multis
|
|||
|
||||
if (Doors != null)
|
||||
for (int i = 0; i < Doors.Count; ++i)
|
||||
if (Doors[i] is BaseDoor door)
|
||||
door.KeyValue = keyValue;
|
||||
Doors[i].KeyValue = keyValue;
|
||||
}
|
||||
|
||||
public void RemoveLocks()
|
||||
{
|
||||
if (Doors != null)
|
||||
for (int i = 0; i < Doors.Count; ++i)
|
||||
if (Doors[i] is BaseDoor door)
|
||||
{
|
||||
door.KeyValue = 0;
|
||||
door.Locked = false;
|
||||
}
|
||||
{
|
||||
BaseDoor door = Doors[i];
|
||||
door.KeyValue = 0;
|
||||
door.Locked = false;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual HouseDeed GetDeed() => null;
|
||||
|
||||
public bool IsFriend(Mobile m)
|
||||
{
|
||||
if (m == null || Friends == null)
|
||||
return false;
|
||||
|
||||
return IsCoOwner(m) || Friends.Contains(m);
|
||||
}
|
||||
public bool IsFriend(Mobile m) => m != null && Friends != null && (IsCoOwner(m) || Friends.Contains(m));
|
||||
|
||||
public bool IsBanned(Mobile m)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1185,44 +1185,44 @@ namespace Server.Multis
|
|||
MultiComponentList newComponents = MultiData.GetComponents(itemID);
|
||||
|
||||
for (int x = 0; x < newComponents.Width; ++x)
|
||||
for (int y = 0; y < newComponents.Height; ++y)
|
||||
for (int y = 0; y < newComponents.Height; ++y)
|
||||
{
|
||||
int tx = p.X + newComponents.Min.X + x;
|
||||
int ty = p.Y + newComponents.Min.Y + y;
|
||||
|
||||
if (newComponents.Tiles[x][y].Length == 0 || Contains(tx, ty))
|
||||
continue;
|
||||
|
||||
LandTile landTile = map.Tiles.GetLandTile(tx, ty);
|
||||
StaticTile[] tiles = map.Tiles.GetStaticTiles(tx, ty, true);
|
||||
|
||||
bool hasWater = landTile.Z == p.Z &&
|
||||
(landTile.ID >= 168 && landTile.ID <= 171 || landTile.ID >= 310 && landTile.ID <= 311);
|
||||
|
||||
// int z = p.Z;
|
||||
|
||||
//int landZ = 0, landAvg = 0, landTop = 0;
|
||||
|
||||
//map.GetAverageZ( tx, ty, ref landZ, ref landAvg, ref landTop );
|
||||
|
||||
//if ( !landTile.Ignored && top > landZ && landTop > z )
|
||||
// return false;
|
||||
|
||||
for (int i = 0; i < tiles.Length; ++i)
|
||||
{
|
||||
int tx = p.X + newComponents.Min.X + x;
|
||||
int ty = p.Y + newComponents.Min.Y + y;
|
||||
StaticTile tile = tiles[i];
|
||||
bool isWater = tile.ID >= 0x1796 && tile.ID <= 0x17B2;
|
||||
|
||||
if (newComponents.Tiles[x][y].Length == 0 || Contains(tx, ty))
|
||||
continue;
|
||||
|
||||
LandTile landTile = map.Tiles.GetLandTile(tx, ty);
|
||||
StaticTile[] tiles = map.Tiles.GetStaticTiles(tx, ty, true);
|
||||
|
||||
bool hasWater = landTile.Z == p.Z &&
|
||||
(landTile.ID >= 168 && landTile.ID <= 171 || landTile.ID >= 310 && landTile.ID <= 311);
|
||||
|
||||
// int z = p.Z;
|
||||
|
||||
//int landZ = 0, landAvg = 0, landTop = 0;
|
||||
|
||||
//map.GetAverageZ( tx, ty, ref landZ, ref landAvg, ref landTop );
|
||||
|
||||
//if ( !landTile.Ignored && top > landZ && landTop > z )
|
||||
// return false;
|
||||
|
||||
for (int i = 0; i < tiles.Length; ++i)
|
||||
{
|
||||
StaticTile tile = tiles[i];
|
||||
bool isWater = tile.ID >= 0x1796 && tile.ID <= 0x17B2;
|
||||
|
||||
if (tile.Z == p.Z && isWater)
|
||||
hasWater = true;
|
||||
else if (tile.Z >= p.Z && !isWater)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!hasWater)
|
||||
if (tile.Z == p.Z && isWater)
|
||||
hasWater = true;
|
||||
else if (tile.Z >= p.Z && !isWater)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!hasWater)
|
||||
return false;
|
||||
}
|
||||
|
||||
IPooledEnumerable<Item> eable = map.GetItemsInBounds(new Rectangle2D(p.X + newComponents.Min.X,
|
||||
p.Y + newComponents.Min.Y, newComponents.Width, newComponents.Height));
|
||||
|
||||
|
|
|
|||
|
|
@ -300,8 +300,7 @@ namespace Server.Multis
|
|||
|
||||
public void AddFixtures(Mobile from, MultiTileEntry[] list)
|
||||
{
|
||||
if (Fixtures == null)
|
||||
Fixtures = new List<Item>();
|
||||
Fixtures ??= new List<Item>();
|
||||
|
||||
uint keyValue = 0;
|
||||
|
||||
|
|
@ -530,7 +529,6 @@ namespace Server.Multis
|
|||
switch (door.Facing)
|
||||
{
|
||||
default:
|
||||
case DoorFacing.WestCW:
|
||||
linkFacing = DoorFacing.EastCCW;
|
||||
xOffset = 1;
|
||||
yOffset = 0;
|
||||
|
|
@ -618,7 +616,6 @@ namespace Server.Multis
|
|||
switch (type)
|
||||
{
|
||||
default:
|
||||
case FoundationType.DarkWood:
|
||||
corner = 0x0014;
|
||||
east = 0x0015;
|
||||
south = 0x0016;
|
||||
|
|
@ -1284,7 +1281,6 @@ namespace Server.Multis
|
|||
switch (dir)
|
||||
{
|
||||
default:
|
||||
case 0: // North
|
||||
{
|
||||
xStart = x;
|
||||
yStart = y + height;
|
||||
|
|
|
|||
|
|
@ -195,8 +195,6 @@ namespace Server.Regions
|
|||
|
||||
public override void OnExit(Mobile m)
|
||||
{
|
||||
// if (IsDisabled())
|
||||
return;
|
||||
}
|
||||
|
||||
public override void OnSpeech(SpeechEventArgs args)
|
||||
|
|
|
|||
|
|
@ -264,9 +264,7 @@ namespace Server.Regions
|
|||
|
||||
if (entity != null)
|
||||
{
|
||||
if (m_RemoveList == null)
|
||||
m_RemoveList = new List<IEntity>();
|
||||
|
||||
m_RemoveList ??= new List<IEntity>();
|
||||
m_RemoveList.Add(entity);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
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