Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)
This commit is contained in:
parent
e748af4430
commit
513e54f70e
1094 changed files with 15913 additions and 21892 deletions
|
|
@ -1,8 +1,8 @@
|
|||
[*]
|
||||
charset=utf-8
|
||||
end_of_line=lf
|
||||
end_of_line=crlf
|
||||
trim_trailing_whitespace=true
|
||||
insert_final_newline=true
|
||||
indent_style=space
|
||||
indent_size=4
|
||||
indent_size=2
|
||||
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@ ModernUO
|
|||
- Building with Visual Studio for Windows will install `DotNetCompilerPlatform` automatically.
|
||||
|
||||
### Building for Windows (Without Visual Studio)
|
||||
`C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc /optimize /unsafe /t:exe /out:RunUO.exe /win32icon:Server\runuo.ico /d:NEWTIMERS /d:NEWPARENT /recurse:Server\\*.cs`
|
||||
`C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc /optimize /unsafe /t:exe /out:RunUO.exe /win32icon:Server\runuo.ico /d:NEWTIMERS /recurse:Server\\*.cs`
|
||||
- DotNetCompilerPlatform must be installed with the `csc.exe` file in the `roslyn` folder at the root of the repository.
|
||||
|
||||
### Building for Mac/Linux (Without Visual Studio)
|
||||
`mcs -optimize+ -unsafe -t:exe -out:RunUO.exe -win32icon:Server/runuo.ico -nowarn:219,414 -d:NEWTIMERS -d:NEWPARENT -d:MONO -reference:System.Drawing -recurse:Server/*.cs`
|
||||
`mcs -optimize+ -unsafe -t:exe -out:RunUO.exe -win32icon:Server/runuo.ico -nowarn:219,414 -d:NEWTIMERS -d:MONO -recurse:"Server/*".cs`
|
||||
|
||||
### Running on Mac/Linux (MONO)
|
||||
`mono RunUO.exe`
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<gcServer enabled="true" />
|
||||
</runtime>
|
||||
<!--
|
||||
MONO/Linux users will need to uncomment and modify the following line:
|
||||
-->
|
||||
<!--<dllmap dll="libz" target="/lib/x86_64-linux-gnu/libz.so.1" />-->
|
||||
</configuration>
|
||||
|
|
@ -72,20 +72,14 @@ namespace Server.Accounting
|
|||
/// <summary>
|
||||
/// List of account comments. Type of contained objects is AccountComment.
|
||||
/// </summary>
|
||||
public List<AccountComment> Comments
|
||||
{
|
||||
get { if ( m_Comments == null ) m_Comments = new List<AccountComment>(); return m_Comments; }
|
||||
}
|
||||
public List<AccountComment> Comments => m_Comments ?? (m_Comments = new List<AccountComment>());
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// List of account tags. Type of contained objects is AccountTag.
|
||||
/// </summary>
|
||||
public List<AccountTag> Tags
|
||||
{
|
||||
get { if ( m_Tags == null ) m_Tags = new List<AccountTag>(); return m_Tags; }
|
||||
}
|
||||
public List<AccountTag> Tags => m_Tags ?? (m_Tags = new List<AccountTag>());
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Account username. Case insensitive validation.
|
||||
/// </summary>
|
||||
public string Username { get; set; }
|
||||
|
|
@ -136,10 +130,7 @@ namespace Server.Accounting
|
|||
if ( !isBanned )
|
||||
return false;
|
||||
|
||||
DateTime banTime;
|
||||
TimeSpan banDuration;
|
||||
|
||||
if ( GetBanTags( out banTime, out banDuration ) )
|
||||
if ( GetBanTags( out DateTime banTime, out TimeSpan banDuration ) )
|
||||
{
|
||||
if ( banDuration != TimeSpan.MaxValue && DateTime.UtcNow >= ( banTime + banDuration ) )
|
||||
{
|
||||
|
|
@ -164,11 +155,8 @@ namespace Server.Accounting
|
|||
{
|
||||
SetFlag( 1, !value );
|
||||
|
||||
if ( m_YoungTimer != null )
|
||||
{
|
||||
m_YoungTimer.Stop();
|
||||
m_YoungTimer = null;
|
||||
}
|
||||
m_YoungTimer?.Stop();
|
||||
m_YoungTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -704,9 +692,7 @@ namespace Server.Accounting
|
|||
{
|
||||
if ( count < list.Length )
|
||||
{
|
||||
IPAddress address;
|
||||
|
||||
if ( IPAddress.TryParse( Utility.GetText( ip, null ), out address ) )
|
||||
if ( IPAddress.TryParse( Utility.GetText( ip, null ), out IPAddress address ) )
|
||||
{
|
||||
list[count] = Utility.Intern( address );
|
||||
count++;
|
||||
|
|
@ -848,7 +834,7 @@ namespace Server.Accounting
|
|||
{
|
||||
Mobile m = this[i];
|
||||
|
||||
if ( m != null && m.AccessLevel >= level )
|
||||
if ( m?.AccessLevel >= level )
|
||||
hasAccess = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -991,7 +977,7 @@ namespace Server.Accounting
|
|||
{
|
||||
Mobile m = m_Mobiles[i];
|
||||
|
||||
if ( m != null && !m.Deleted )
|
||||
if (m?.Deleted == false)
|
||||
{
|
||||
xml.WriteStartElement( "char" );
|
||||
xml.WriteAttributeString( "index", i.ToString() );
|
||||
|
|
@ -1002,7 +988,7 @@ namespace Server.Accounting
|
|||
|
||||
xml.WriteEndElement();
|
||||
|
||||
if ( m_Comments != null && m_Comments.Count > 0 )
|
||||
if (m_Comments?.Count > 0)
|
||||
{
|
||||
xml.WriteStartElement( "comments" );
|
||||
|
||||
|
|
@ -1012,7 +998,7 @@ namespace Server.Accounting
|
|||
xml.WriteEndElement();
|
||||
}
|
||||
|
||||
if ( m_Tags != null && m_Tags.Count > 0 )
|
||||
if (m_Tags?.Count > 0)
|
||||
{
|
||||
xml.WriteStartElement( "tags" );
|
||||
|
||||
|
|
@ -1103,7 +1089,7 @@ namespace Server.Accounting
|
|||
{
|
||||
Mobile m = m_Mobiles[index];
|
||||
|
||||
if ( m != null && m.Deleted )
|
||||
if (m?.Deleted == true)
|
||||
{
|
||||
m.Account = null;
|
||||
m_Mobiles[index] = m = null;
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ namespace Server.Commands
|
|||
if (IsParsable(type)) return ParseParsable(type, value);
|
||||
object obj = value;
|
||||
|
||||
if (value != null && value.StartsWith("0x"))
|
||||
if (value?.StartsWith("0x") == true)
|
||||
{
|
||||
if (IsSignedNumeric(type))
|
||||
obj = Convert.ToInt64(value.Substring(2), 16);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Server.Commands.Generic;
|
||||
|
|
@ -308,7 +307,7 @@ namespace Server.Commands
|
|||
|
||||
for (int i = m_Batch.BatchCommands.Count - 1; i >= 0; --i)
|
||||
{
|
||||
BatchCommand sc = (BatchCommand)m_Batch.BatchCommands[i];
|
||||
BatchCommand sc = m_Batch.BatchCommands[i];
|
||||
|
||||
entry = info.GetTextEntry(1 + i * 2);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Server.Engines.Quests.Haven;
|
||||
using Server.Engines.Quests.Necro;
|
||||
using Server.Items;
|
||||
|
|
@ -429,7 +430,7 @@ namespace Server.Commands
|
|||
int indexOf = m_Params[i].IndexOf('=');
|
||||
|
||||
if (indexOf >= 0)
|
||||
sp.AddEntry(m_Params[i].Substring(++indexOf), 100, 1);
|
||||
sp.AddEntry(m_Params[i].Substring(++indexOf));
|
||||
}
|
||||
else if (m_Params[i].StartsWith("MinDelay"))
|
||||
{
|
||||
|
|
@ -901,12 +902,11 @@ namespace Server.Commands
|
|||
{
|
||||
eable = map.GetItemsInRange(new Point3D(x, y, z), 0);
|
||||
|
||||
foreach (Item item in eable)
|
||||
if (item.Z == z && item.ItemID == itemID)
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
if (eable.Any(item => item.Z == z && item.ItemID == itemID))
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
|
|
@ -1066,11 +1066,9 @@ namespace Server.Commands
|
|||
{
|
||||
public DecorationEntry(string line)
|
||||
{
|
||||
string x, y, z;
|
||||
|
||||
Pop(out x, ref line);
|
||||
Pop(out y, ref line);
|
||||
Pop(out z, ref line);
|
||||
Pop(out string x, ref line);
|
||||
Pop(out string y, ref line);
|
||||
Pop(out string z, ref line);
|
||||
|
||||
Location = new Point3D(Utility.ToInt32(x), Utility.ToInt32(y), Utility.ToInt32(z));
|
||||
Extra = line;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Server.Engines.Quests.Haven;
|
||||
using Server.Engines.Quests.Necro;
|
||||
using Server.Items;
|
||||
|
|
@ -427,7 +428,7 @@ namespace Server.Commands
|
|||
int indexOf = m_Params[i].IndexOf('=');
|
||||
|
||||
if (indexOf >= 0)
|
||||
sp.AddEntry(m_Params[i].Substring(++indexOf), 100, 1);
|
||||
sp.AddEntry(m_Params[i].Substring(++indexOf));
|
||||
}
|
||||
else if (m_Params[i].StartsWith("MinDelay"))
|
||||
{
|
||||
|
|
@ -899,12 +900,11 @@ namespace Server.Commands
|
|||
{
|
||||
eable = map.GetItemsInRange(new Point3D(x, y, z), 0);
|
||||
|
||||
foreach (Item item in eable)
|
||||
if (item.Z == z && item.ItemID == itemID)
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
if (eable.Any(item => item.Z == z && item.ItemID == itemID))
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
|
|
@ -1064,11 +1064,9 @@ namespace Server.Commands
|
|||
{
|
||||
public DecorationEntryMag(string line)
|
||||
{
|
||||
string x, y, z;
|
||||
|
||||
Pop(out x, ref line);
|
||||
Pop(out y, ref line);
|
||||
Pop(out z, ref line);
|
||||
Pop(out string x, ref line);
|
||||
Pop(out string y, ref line);
|
||||
Pop(out string z, ref line);
|
||||
|
||||
Location = new Point3D(Utility.ToInt32(x), Utility.ToInt32(y), Utility.ToInt32(z));
|
||||
Extra = line;
|
||||
|
|
|
|||
|
|
@ -229,11 +229,9 @@ namespace Server.Commands
|
|||
StringBuilder nameBuilder = new StringBuilder(rootType);
|
||||
StringBuilder fnamBuilder = new StringBuilder("docs/types/" + SanitizeType(rootType));
|
||||
StringBuilder linkBuilder;
|
||||
if (DontLink(type)) //if ( DontLink( rootType ) )
|
||||
linkBuilder = new StringBuilder("<font color=\"blue\">" + rootType + "</font>");
|
||||
else
|
||||
linkBuilder =
|
||||
new StringBuilder("<a href=\"" + "@directory@" + rootType + "-T-.html\">" + rootType + "</a>");
|
||||
linkBuilder = DontLink(type) ?
|
||||
new StringBuilder("<font color=\"blue\">" + rootType + "</font>") :
|
||||
new StringBuilder("<a href=\"" + "@directory@" + rootType + "-T-.html\">" + rootType + "</a>");
|
||||
|
||||
nameBuilder.Append("<");
|
||||
fnamBuilder.Append("-");
|
||||
|
|
@ -272,10 +270,7 @@ namespace Server.Commands
|
|||
}
|
||||
}
|
||||
|
||||
if (name == null)
|
||||
typeName = type.Name;
|
||||
else
|
||||
typeName = name;
|
||||
typeName = name ?? type.Name;
|
||||
|
||||
if (fnam == null) fileName = "docs/types/" + SanitizeType(type.Name) + ".html";
|
||||
else fileName = fnam + ".html";
|
||||
|
|
@ -300,7 +295,8 @@ namespace Server.Commands
|
|||
{
|
||||
bool anonymousType = name.Contains("<");
|
||||
StringBuilder sb = new StringBuilder(name);
|
||||
for (int i = 0; i < ReplaceChars.Length; ++i) sb.Replace(ReplaceChars[i], '-');
|
||||
for (int i = 0; i < ReplaceChars.Length; ++i)
|
||||
sb.Replace(ReplaceChars[i], '-');
|
||||
|
||||
if (anonymousType) return "(Anonymous-Type)" + sb;
|
||||
return sb.ToString();
|
||||
|
|
@ -418,7 +414,7 @@ namespace Server.Commands
|
|||
MethodInfo getMethod = prop.GetGetMethod();
|
||||
MethodInfo setMethod = prop.GetGetMethod();
|
||||
|
||||
return getMethod != null && getMethod.IsStatic || setMethod != null && setMethod.IsStatic;
|
||||
return getMethod?.IsStatic == true || setMethod?.IsStatic == true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -426,13 +422,7 @@ namespace Server.Commands
|
|||
|
||||
private string GetNameFrom(ConstructorInfo ctor, PropertyInfo prop, MethodInfo method)
|
||||
{
|
||||
if (ctor != null)
|
||||
return ctor.DeclaringType?.Name ?? "";
|
||||
if (prop != null)
|
||||
return prop.Name;
|
||||
if (method != null)
|
||||
return method.Name;
|
||||
return "";
|
||||
return ctor?.DeclaringType?.Name ?? prop?.Name ?? method?.Name ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -440,14 +430,8 @@ namespace Server.Commands
|
|||
{
|
||||
public int Compare(TypeInfo x, TypeInfo y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
return -1;
|
||||
if (y == null)
|
||||
return 1;
|
||||
|
||||
return x.TypeName.CompareTo(y.TypeName);
|
||||
return x == null && y == null ? 0 : x == null ? -1 : y == null ? 1 :
|
||||
x.TypeName.CompareTo(y.TypeName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2463,7 +2447,7 @@ namespace Server.Commands
|
|||
|
||||
int extendCount = 0;
|
||||
|
||||
if (baseType != null && baseType != typeof(object) && baseType != typeof(ValueType) && !baseType.IsPrimitive)
|
||||
if (baseType != typeof(object) && baseType != typeof(ValueType) && baseType?.IsPrimitive == false)
|
||||
{
|
||||
typeHtml.Write(" : ");
|
||||
|
||||
|
|
@ -2575,7 +2559,7 @@ namespace Server.Commands
|
|||
MethodInfo getMethod = pi.GetGetMethod();
|
||||
MethodInfo setMethod = pi.GetSetMethod();
|
||||
|
||||
if (getMethod != null && getMethod.IsStatic || setMethod != null && setMethod.IsStatic)
|
||||
if (getMethod?.IsStatic == true || setMethod?.IsStatic == true)
|
||||
html.Write(StaticString);
|
||||
|
||||
html.Write(GetPair(pi.PropertyType, pi.Name, false));
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ namespace Server.Commands
|
|||
|
||||
ConstructorInfo ctor = type.GetConstructor(Type.EmptyTypes);
|
||||
|
||||
return ctor != null && ctor.IsDefined(typeofConstructible, false);
|
||||
return ctor?.IsDefined(typeofConstructible, false) == true;
|
||||
}
|
||||
|
||||
private static void AddTypes(Assembly asm, List<Type> types)
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ namespace Server.Commands.Generic
|
|||
PropertyInfo[] chain = Properties.GetPropertyInfoChain(m_From, obj.GetType(), m_Columns[i],
|
||||
PropertyAccess.Read, ref failReason);
|
||||
|
||||
if (chain != null && chain.Length > 0)
|
||||
if (chain?.Length > 0)
|
||||
{
|
||||
m_Columns[i] = "";
|
||||
|
||||
|
|
|
|||
|
|
@ -90,93 +90,93 @@ namespace Server.Commands.Generic
|
|||
|
||||
public void Acquire(TypeBuilder typeBuilder, ILGenerator il, string fieldName)
|
||||
{
|
||||
if (Value is string toParse)
|
||||
{
|
||||
if (!Type.IsValueType && toParse == "null")
|
||||
{
|
||||
Value = null;
|
||||
}
|
||||
else if (Type == typeof(string))
|
||||
{
|
||||
if (toParse == @"@""null""")
|
||||
toParse = "null";
|
||||
if (!(Value is string toParse))
|
||||
return;
|
||||
|
||||
Value = toParse;
|
||||
}
|
||||
else if (Type.IsEnum)
|
||||
if (!Type.IsValueType && toParse == "null")
|
||||
{
|
||||
Value = null;
|
||||
}
|
||||
else if (Type == typeof(string))
|
||||
{
|
||||
if (toParse == @"@""null""")
|
||||
toParse = "null";
|
||||
|
||||
Value = toParse;
|
||||
}
|
||||
else if (Type.IsEnum)
|
||||
{
|
||||
Value = Enum.Parse(Type, toParse, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
MethodInfo parseMethod;
|
||||
object[] parseArgs;
|
||||
|
||||
MethodInfo parseNumber = Type.GetMethod(
|
||||
"Parse",
|
||||
BindingFlags.Public | BindingFlags.Static,
|
||||
null,
|
||||
new[] { typeof(string), typeof(NumberStyles) },
|
||||
null
|
||||
);
|
||||
|
||||
if (parseNumber != null)
|
||||
{
|
||||
Value = Enum.Parse(Type, toParse, true);
|
||||
NumberStyles style = NumberStyles.Integer;
|
||||
|
||||
if (Insensitive.StartsWith(toParse, "0x"))
|
||||
{
|
||||
style = NumberStyles.HexNumber;
|
||||
toParse = toParse.Substring(2);
|
||||
}
|
||||
|
||||
parseMethod = parseNumber;
|
||||
parseArgs = new object[] { toParse, style };
|
||||
}
|
||||
else
|
||||
{
|
||||
MethodInfo parseMethod;
|
||||
object[] parseArgs;
|
||||
|
||||
MethodInfo parseNumber = Type.GetMethod(
|
||||
MethodInfo parseGeneral = Type.GetMethod(
|
||||
"Parse",
|
||||
BindingFlags.Public | BindingFlags.Static,
|
||||
null,
|
||||
new[] { typeof(string), typeof(NumberStyles) },
|
||||
new[] { typeof(string) },
|
||||
null
|
||||
);
|
||||
|
||||
if (parseNumber != null)
|
||||
{
|
||||
NumberStyles style = NumberStyles.Integer;
|
||||
parseMethod = parseGeneral;
|
||||
parseArgs = new object[] { toParse };
|
||||
}
|
||||
|
||||
if (Insensitive.StartsWith(toParse, "0x"))
|
||||
{
|
||||
style = NumberStyles.HexNumber;
|
||||
toParse = toParse.Substring(2);
|
||||
}
|
||||
if (parseMethod != null)
|
||||
{
|
||||
Value = parseMethod.Invoke(null, parseArgs);
|
||||
|
||||
parseMethod = parseNumber;
|
||||
parseArgs = new object[] { toParse, style };
|
||||
}
|
||||
else
|
||||
if (!Type.IsPrimitive)
|
||||
{
|
||||
MethodInfo parseGeneral = Type.GetMethod(
|
||||
"Parse",
|
||||
BindingFlags.Public | BindingFlags.Static,
|
||||
null,
|
||||
new[] { typeof(string) },
|
||||
null
|
||||
Field = typeBuilder.DefineField(
|
||||
fieldName,
|
||||
Type,
|
||||
FieldAttributes.Private | FieldAttributes.InitOnly
|
||||
);
|
||||
|
||||
parseMethod = parseGeneral;
|
||||
parseArgs = new object[] { toParse };
|
||||
}
|
||||
|
||||
if (parseMethod != null)
|
||||
{
|
||||
Value = parseMethod.Invoke(null, parseArgs);
|
||||
|
||||
if (!Type.IsPrimitive)
|
||||
{
|
||||
Field = typeBuilder.DefineField(
|
||||
fieldName,
|
||||
Type,
|
||||
FieldAttributes.Private | FieldAttributes.InitOnly
|
||||
);
|
||||
|
||||
il.Emit(OpCodes.Ldarg_0);
|
||||
|
||||
il.Emit(OpCodes.Ldstr, toParse);
|
||||
|
||||
if (parseArgs.Length == 2) // dirty evil hack :-(
|
||||
il.Emit(OpCodes.Ldc_I4, (int)parseArgs[1]);
|
||||
|
||||
il.Emit(OpCodes.Call, parseMethod);
|
||||
il.Emit(OpCodes.Stfld, Field);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"Unable to convert string \"{Value}\" into type '{Type}'."
|
||||
);
|
||||
il.Emit(OpCodes.Ldarg_0);
|
||||
|
||||
il.Emit(OpCodes.Ldstr, toParse);
|
||||
|
||||
if (parseArgs.Length == 2) // dirty evil hack :-(
|
||||
il.Emit(OpCodes.Ldc_I4, (int)parseArgs[1]);
|
||||
|
||||
il.Emit(OpCodes.Call, parseMethod);
|
||||
il.Emit(OpCodes.Stfld, Field);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"Unable to convert string \"{Value}\" into type '{Type}'."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Commands.Generic
|
||||
{
|
||||
|
|
@ -36,28 +37,15 @@ namespace Server.Commands.Generic
|
|||
if (!CheckObjectTypes(from, command, ext, out bool items, out bool mobiles))
|
||||
return;
|
||||
|
||||
IPooledEnumerable<IEntity> eable;
|
||||
|
||||
if (items || mobiles)
|
||||
eable = map.GetObjectsInBounds(rect, items, mobiles);
|
||||
else
|
||||
if (!(items || mobiles))
|
||||
return;
|
||||
|
||||
eable.Free();
|
||||
IPooledEnumerable<IEntity> eable = map.GetObjectsInBounds(rect, items, mobiles);
|
||||
|
||||
List<object> objs = new List<object>();
|
||||
|
||||
foreach (IEntity obj in eable)
|
||||
{
|
||||
if (mobiles && obj is Mobile && !BaseCommand.IsAccessible(from, obj))
|
||||
continue;
|
||||
|
||||
if (ext.IsValid(obj))
|
||||
objs.Add(obj);
|
||||
}
|
||||
List<object> objs = eable.Where(obj => !mobiles || !(obj is Mobile) || BaseCommand.IsAccessible(from, obj))
|
||||
.Where(obj => ext.IsValid(obj)).Cast<object>().ToList();
|
||||
|
||||
eable.Free();
|
||||
|
||||
ext.Filter(objs);
|
||||
|
||||
RunCommand(from, objs, command, args);
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ namespace Server.Commands
|
|||
|
||||
for (int i = 0; i < pets.Count; ++i)
|
||||
{
|
||||
Mobile pet = (Mobile)pets[i];
|
||||
Mobile pet = pets[i];
|
||||
|
||||
if (pet is IMount mount)
|
||||
mount.Rider = null; // make sure it's dismounted
|
||||
|
|
@ -410,18 +410,20 @@ namespace Server.Commands
|
|||
|
||||
private static bool FixMap(ref Map map, ref Point3D loc, Item item)
|
||||
{
|
||||
return map == null || map == Map.Internal && item.RootParent is Mobile m && FixMap(ref map, ref loc, m);
|
||||
return map != null && map != Map.Internal || item.RootParent is Mobile m && FixMap(ref map, ref loc, m);
|
||||
}
|
||||
|
||||
private static bool FixMap(ref Map map, ref Point3D loc, Mobile m)
|
||||
{
|
||||
if (map == null || map == Map.Internal)
|
||||
bool validMap = map != null && map != Map.Internal;
|
||||
|
||||
if (!validMap)
|
||||
{
|
||||
map = m.LogoutMap;
|
||||
loc = m.LogoutLocation;
|
||||
}
|
||||
|
||||
return map != null && map != Map.Internal;
|
||||
return validMap;
|
||||
}
|
||||
|
||||
[Usage("Go [name | serial | (x y [z]) | (deg min (N | S) deg min (E | W))]")]
|
||||
|
|
@ -676,7 +678,7 @@ namespace Server.Commands
|
|||
{
|
||||
Mobile m = state.Mobile;
|
||||
|
||||
if (m != null && m.AccessLevel >= ac)
|
||||
if (m?.AccessLevel >= ac)
|
||||
m.SendMessage(hue, message);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -337,12 +337,7 @@ namespace Server.Commands
|
|||
|
||||
public class CommandInfoGump : Gump
|
||||
{
|
||||
public CommandInfoGump(CommandInfo info)
|
||||
: this(info, 320, 200)
|
||||
{
|
||||
}
|
||||
|
||||
public CommandInfoGump(CommandInfo info, int width, int height)
|
||||
public CommandInfoGump(CommandInfo info, int width = 320, int height = 200)
|
||||
: base(300, 50)
|
||||
{
|
||||
AddPage(0);
|
||||
|
|
@ -352,7 +347,7 @@ namespace Server.Commands
|
|||
//AddImageTiled( 10, 10, width - 20, 20, 2624 );
|
||||
//AddAlphaRegion( 10, 10, width - 20, 20 );
|
||||
//AddHtmlLocalized( 10, 10, width - 20, 20, header, headerColor, false, false );
|
||||
AddHtml(10, 10, width - 20, 20, Color(Center(info.Name), 0xFF0000), false, false);
|
||||
AddHtml(10, 10, width - 20, 20, Color(Center(info.Name), 0xFF0000));
|
||||
|
||||
//AddImageTiled( 10, 40, width - 20, height - 80, 2624 );
|
||||
//AddAlphaRegion( 10, 40, width - 20, height - 80 );
|
||||
|
|
@ -365,7 +360,7 @@ namespace Server.Commands
|
|||
|
||||
string[] aliases = info.Aliases;
|
||||
|
||||
if (aliases != null && aliases.Length != 0)
|
||||
if (aliases?.Length > 0)
|
||||
{
|
||||
sb.Append($"Alias{(aliases.Length == 1 ? "" : "es")}: ");
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Server.Commands
|
|||
ReadWrite = Read | Write
|
||||
}
|
||||
|
||||
public class Properties
|
||||
public static class Properties
|
||||
{
|
||||
private static Type typeofCPA = typeof(CPA);
|
||||
|
||||
|
|
@ -174,10 +174,7 @@ namespace Server.Commands
|
|||
{
|
||||
PropertyInfo[] chain = GetPropertyInfoChain(from, obj.GetType(), propertyName, access, ref failReason);
|
||||
|
||||
if (chain == null)
|
||||
return null;
|
||||
|
||||
return GetPropertyInfo(ref obj, chain, ref failReason);
|
||||
return chain == null ? null : GetPropertyInfo(ref obj, chain, ref failReason);
|
||||
}
|
||||
|
||||
public static PropertyInfo GetPropertyInfo(ref object obj, PropertyInfo[] chain, ref string failReason)
|
||||
|
|
@ -216,21 +213,19 @@ namespace Server.Commands
|
|||
|
||||
PropertyInfo p = GetPropertyInfo(ref o, chain, ref failReason);
|
||||
|
||||
if (p == null)
|
||||
return failReason;
|
||||
|
||||
return InternalGetValue(o, p, chain);
|
||||
return p == null ? failReason : InternalGetValue(o, p, chain);
|
||||
}
|
||||
|
||||
public static string IncreaseValue(Mobile from, object o, string[] args)
|
||||
{
|
||||
Type type = o.GetType();
|
||||
// Type type = o.GetType();
|
||||
|
||||
object[] realObjs = new object[args.Length / 2];
|
||||
PropertyInfo[] realProps = new PropertyInfo[args.Length / 2];
|
||||
int[] realValues = new int[args.Length / 2];
|
||||
|
||||
bool positive = false, negative = false;
|
||||
bool positive = false;
|
||||
bool negative = false;
|
||||
|
||||
for (int i = 0; i < realProps.Length; ++i)
|
||||
{
|
||||
|
|
@ -315,9 +310,9 @@ namespace Server.Commands
|
|||
if (value == null)
|
||||
toString = "null";
|
||||
else if (IsNumeric(type))
|
||||
toString = string.Format("{0} (0x{0:X})", value);
|
||||
toString = $"{value} (0x{value:X})";
|
||||
else if (IsChar(type))
|
||||
toString = string.Format("'{0}' ({1} [0x{1:X}])", value, (int)value);
|
||||
toString = $"'{value}' ({(int)value} [0x{(int)value:X}])";
|
||||
else if (IsString(type))
|
||||
toString = (string)value == "null" ? @"@""null""" : $"\"{value}\"";
|
||||
else if (IsText(type))
|
||||
|
|
@ -348,10 +343,7 @@ namespace Server.Commands
|
|||
string failReason = "";
|
||||
PropertyInfo p = GetPropertyInfo(from, ref o, name, PropertyAccess.Write, ref failReason);
|
||||
|
||||
if (p == null)
|
||||
return failReason;
|
||||
|
||||
return InternalSetValue(from, logObject, o, p, name, value, true);
|
||||
return p == null ? failReason : InternalSetValue(from, logObject, o, p, name, value, true);
|
||||
}
|
||||
|
||||
private static bool IsSerial(Type t)
|
||||
|
|
@ -524,10 +516,7 @@ namespace Server.Commands
|
|||
object toSet = null;
|
||||
string result = ConstructFromString(p.PropertyType, o, value, ref toSet);
|
||||
|
||||
if (result != null)
|
||||
return result;
|
||||
|
||||
return SetDirect(from, logobj, o, p, pname, toSet, shouldLog);
|
||||
return result ?? SetDirect(from, logobj, o, p, pname, toSet, shouldLog);
|
||||
}
|
||||
|
||||
public static string InternalSetValue(object o, PropertyInfo p, string value)
|
||||
|
|
@ -535,10 +524,7 @@ namespace Server.Commands
|
|||
object toSet = null;
|
||||
string result = ConstructFromString(p.PropertyType, o, value, ref toSet);
|
||||
|
||||
if (result != null)
|
||||
return result;
|
||||
|
||||
return SetDirect(o, p, toSet);
|
||||
return result ?? SetDirect(o, p, toSet);
|
||||
}
|
||||
|
||||
private class PropsTarget : Target
|
||||
|
|
@ -639,18 +625,14 @@ namespace Server
|
|||
|
||||
public abstract class ClearanceException : AccessException
|
||||
{
|
||||
protected AccessLevel m_NeededAccess;
|
||||
protected AccessLevel m_PlayerAccess;
|
||||
|
||||
public ClearanceException(Property property, AccessLevel playerAccess, AccessLevel neededAccess, string accessType)
|
||||
: base(property,
|
||||
$"You must be at least {Mobile.GetAccessLevelName(neededAccess)} to {accessType} this property.")
|
||||
{
|
||||
}
|
||||
|
||||
public AccessLevel PlayerAccess => m_PlayerAccess;
|
||||
|
||||
public AccessLevel NeededAccess => m_NeededAccess;
|
||||
public AccessLevel PlayerAccess{ get; set; }
|
||||
public AccessLevel NeededAccess{ get; set; }
|
||||
}
|
||||
|
||||
public sealed class ReadAccessException : ClearanceException
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ namespace Server.Commands
|
|||
break; // Tokuno Islands
|
||||
}
|
||||
|
||||
for (int j = 0; maps != null && j < maps.Length; ++j)
|
||||
for (int j = 0; maps?.Length >= j; ++j)
|
||||
Add_Static(e.m_ItemID, e.m_Location, maps[j], e.m_Text);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Server.Commands;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Server.ContextMenus
|
|||
|
||||
public override void OnClick()
|
||||
{
|
||||
if (m_Food.Deleted || !m_Food.Movable || !m_From.CheckAlive() || !m_Food.CheckItemUse(m_From))
|
||||
if (m_Food?.Deleted != false || !m_Food.Movable || !m_From.CheckAlive() || !m_Food.CheckItemUse(m_From))
|
||||
return;
|
||||
|
||||
m_Food.Eat(m_From);
|
||||
|
|
|
|||
|
|
@ -94,33 +94,31 @@ namespace Server.Engines.BulkOrders
|
|||
AddImage(5, 424, 10460);
|
||||
AddImage(585, 424, 10460);
|
||||
|
||||
AddHtmlLocalized(270, 32, 200, 32, 1062223, LabelColor, false, false); // Filter Preference
|
||||
AddHtmlLocalized(270, 32, 200, 32, 1062223, LabelColor); // Filter Preference
|
||||
|
||||
AddHtmlLocalized(26, 64, 120, 32, 1062228, LabelColor, false, false); // Bulk Order Type
|
||||
AddHtmlLocalized(26, 64, 120, 32, 1062228, LabelColor); // Bulk Order Type
|
||||
AddFilterList(25, 96, m_XOffsets_Type, 40, m_TypeFilters, m_XWidths_Small, f.Type, 0);
|
||||
|
||||
AddHtmlLocalized(320, 64, 50, 32, 1062215, LabelColor, false, false); // Quality
|
||||
AddHtmlLocalized(320, 64, 50, 32, 1062215, LabelColor); // Quality
|
||||
AddFilterList(320, 96, m_XOffsets_Quality, 40, m_QualityFilters, m_XWidths_Small, f.Quality, 1);
|
||||
|
||||
AddHtmlLocalized(26, 160, 120, 32, 1062232, LabelColor, false, false); // Material Type
|
||||
AddHtmlLocalized(26, 160, 120, 32, 1062232, LabelColor); // Material Type
|
||||
AddFilterList(25, 192, m_XOffsets_Material, 40, m_MaterialFilters, m_XWidths_Large, f.Material, 2);
|
||||
|
||||
AddHtmlLocalized(26, 320, 120, 32, 1062217, LabelColor, false, false); // Amount
|
||||
AddHtmlLocalized(26, 320, 120, 32, 1062217, LabelColor); // Amount
|
||||
AddFilterList(25, 352, m_XOffsets_Amount, 40, m_AmountFilters, m_XWidths_Small, f.Quantity, 3);
|
||||
|
||||
AddHtmlLocalized(75, 416, 120, 32, 1062477, from.UseOwnFilter ? LabelColor : 16927, false,
|
||||
false); // Set Book Filter
|
||||
AddButton(40, 416, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(75, 416, 120, 32, 1062477, from.UseOwnFilter ? LabelColor : 16927); // Set Book Filter
|
||||
AddButton(40, 416, 4005, 4007, 1);
|
||||
|
||||
AddHtmlLocalized(235, 416, 120, 32, 1062478, from.UseOwnFilter ? 16927 : LabelColor, false,
|
||||
false); // Set Your Filter
|
||||
AddButton(200, 416, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(235, 416, 120, 32, 1062478, from.UseOwnFilter ? 16927 : LabelColor); // Set Your Filter
|
||||
AddButton(200, 416, 4005, 4007, 2);
|
||||
|
||||
AddHtmlLocalized(405, 416, 120, 32, 1062231, LabelColor, false, false); // Clear Filter
|
||||
AddButton(370, 416, 4005, 4007, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(405, 416, 120, 32, 1062231, LabelColor); // Clear Filter
|
||||
AddButton(370, 416, 4005, 4007, 3);
|
||||
|
||||
AddHtmlLocalized(540, 416, 50, 32, 1011046, LabelColor, false, false); // APPLY
|
||||
AddButton(505, 416, 4017, 4018, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(540, 416, 50, 32, 1011046, LabelColor); // APPLY
|
||||
AddButton(505, 416, 4017, 4018, 0);
|
||||
}
|
||||
|
||||
private void AddFilterList(int x, int y, int[] xOffsets, int yOffset, int[,] filters, int[] xWidths, int filterValue,
|
||||
|
|
@ -139,9 +137,9 @@ namespace Server.Engines.BulkOrders
|
|||
isSelected = filterValue == 0;
|
||||
|
||||
AddHtmlLocalized(x + 35 + xOffsets[i % xOffsets.Length], y + i / xOffsets.Length * yOffset,
|
||||
xWidths[i % xOffsets.Length], 32, number, isSelected ? 16927 : LabelColor, false, false);
|
||||
xWidths[i % xOffsets.Length], 32, number, isSelected ? 16927 : LabelColor);
|
||||
AddButton(x + xOffsets[i % xOffsets.Length], y + i / xOffsets.Length * yOffset, 4005, 4007,
|
||||
4 + filterIndex + i * 4, GumpButtonType.Reply, 0);
|
||||
4 + filterIndex + i * 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
VendorItem vi = pv.GetVendorItem(book);
|
||||
|
||||
canBuy = vi != null && !vi.IsForSale;
|
||||
canBuy = vi?.IsForSale == false;
|
||||
}
|
||||
|
||||
int width = 600;
|
||||
|
|
@ -103,45 +103,45 @@ namespace Server.Engines.BulkOrders
|
|||
AddImage(5, 424, 10460);
|
||||
AddImage(width - 15, 424, 10460);
|
||||
|
||||
AddHtmlLocalized(canPrice ? 266 : 224, 32, 200, 32, 1062220, LabelColor, false, false); // Bulk Order Book
|
||||
AddHtmlLocalized(63, 64, 200, 32, 1062213, LabelColor, false, false); // Type
|
||||
AddHtmlLocalized(147, 64, 200, 32, 1062214, LabelColor, false, false); // Item
|
||||
AddHtmlLocalized(246, 64, 200, 32, 1062215, LabelColor, false, false); // Quality
|
||||
AddHtmlLocalized(336, 64, 200, 32, 1062216, LabelColor, false, false); // Material
|
||||
AddHtmlLocalized(429, 64, 200, 32, 1062217, LabelColor, false, false); // Amount
|
||||
AddHtmlLocalized(canPrice ? 266 : 224, 32, 200, 32, 1062220, LabelColor); // Bulk Order Book
|
||||
AddHtmlLocalized(63, 64, 200, 32, 1062213, LabelColor); // Type
|
||||
AddHtmlLocalized(147, 64, 200, 32, 1062214, LabelColor); // Item
|
||||
AddHtmlLocalized(246, 64, 200, 32, 1062215, LabelColor); // Quality
|
||||
AddHtmlLocalized(336, 64, 200, 32, 1062216, LabelColor); // Material
|
||||
AddHtmlLocalized(429, 64, 200, 32, 1062217, LabelColor); // Amount
|
||||
|
||||
AddButton(35, 32, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(70, 32, 200, 32, 1062476, LabelColor, false, false); // Set Filter
|
||||
AddButton(35, 32, 4005, 4007, 1);
|
||||
AddHtmlLocalized(70, 32, 200, 32, 1062476, LabelColor); // Set Filter
|
||||
|
||||
BOBFilter f = from.UseOwnFilter ? from.BOBFilter : book.Filter;
|
||||
|
||||
if (f.IsDefault)
|
||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062475, 16927, false, false); // Using No Filter
|
||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062475, 16927); // Using No Filter
|
||||
else if (from.UseOwnFilter)
|
||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062451, 16927, false, false); // Using Your Filter
|
||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062451, 16927); // Using Your Filter
|
||||
else
|
||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062230, 16927, false, false); // Using Book Filter
|
||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062230, 16927); // Using Book Filter
|
||||
|
||||
AddButton(375, 416, 4017, 4018, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(410, 416, 120, 20, 1011441, LabelColor, false, false); // EXIT
|
||||
AddButton(375, 416, 4017, 4018, 0);
|
||||
AddHtmlLocalized(410, 416, 120, 20, 1011441, LabelColor); // EXIT
|
||||
|
||||
if (canDrop)
|
||||
AddHtmlLocalized(26, 64, 50, 32, 1062212, LabelColor, false, false); // Drop
|
||||
AddHtmlLocalized(26, 64, 50, 32, 1062212, LabelColor); // Drop
|
||||
|
||||
if (canPrice)
|
||||
{
|
||||
AddHtmlLocalized(516, 64, 200, 32, 1062218, LabelColor, false, false); // Price
|
||||
AddHtmlLocalized(516, 64, 200, 32, 1062218, LabelColor); // Price
|
||||
|
||||
if (canBuy)
|
||||
{
|
||||
AddHtmlLocalized(576, 64, 200, 32, 1062219, LabelColor, false, false); // Buy
|
||||
AddHtmlLocalized(576, 64, 200, 32, 1062219, LabelColor); // Buy
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized(576, 64, 200, 32, 1062227, LabelColor, false, false); // Set
|
||||
AddHtmlLocalized(576, 64, 200, 32, 1062227, LabelColor); // Set
|
||||
|
||||
AddButton(450, 416, 4005, 4007, 4, GumpButtonType.Reply, 0);
|
||||
AddHtml(485, 416, 120, 20, "<BASEFONT COLOR=#FFFFFF>Price all</FONT>", false, false);
|
||||
AddButton(450, 416, 4005, 4007, 4);
|
||||
AddHtml(485, 416, 120, 20, "<BASEFONT COLOR=#FFFFFF>Price all</FONT>");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -149,14 +149,14 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
if (page > 0)
|
||||
{
|
||||
AddButton(75, 416, 4014, 4016, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(110, 416, 150, 20, 1011067, LabelColor, false, false); // Previous page
|
||||
AddButton(75, 416, 4014, 4016, 2);
|
||||
AddHtmlLocalized(110, 416, 150, 20, 1011067, LabelColor); // Previous page
|
||||
}
|
||||
|
||||
if (GetIndexForPage(page + 1) < list.Count)
|
||||
{
|
||||
AddButton(225, 416, 4005, 4007, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(260, 416, 150, 20, 1011066, LabelColor, false, false); // Next page
|
||||
AddButton(225, 416, 4005, 4007, 3);
|
||||
AddHtmlLocalized(260, 416, 150, 20, 1011066, LabelColor); // Next page
|
||||
}
|
||||
|
||||
for (int i = index; i < index + count && i >= 0 && i < list.Count; ++i)
|
||||
|
|
@ -171,31 +171,31 @@ namespace Server.Engines.BulkOrders
|
|||
int y = 96 + tableIndex * 32;
|
||||
|
||||
if (canDrop)
|
||||
AddButton(35, y + 2, 5602, 5606, 5 + i * 2, GumpButtonType.Reply, 0);
|
||||
AddButton(35, y + 2, 5602, 5606, 5 + i * 2);
|
||||
|
||||
if (canDrop || canBuy && entry.Price > 0)
|
||||
{
|
||||
AddButton(579, y + 2, 2117, 2118, 6 + i * 2, GumpButtonType.Reply, 0);
|
||||
AddButton(579, y + 2, 2117, 2118, 6 + i * 2);
|
||||
AddLabel(495, y, 1152, entry.Price.ToString());
|
||||
}
|
||||
|
||||
AddHtmlLocalized(61, y, 50, 32, 1062225, LabelColor, false, false); // Large
|
||||
AddHtmlLocalized(61, y, 50, 32, 1062225, LabelColor); // Large
|
||||
|
||||
for (int j = 0; j < largeEntry.Entries.Length; ++j)
|
||||
{
|
||||
BOBLargeSubEntry sub = largeEntry.Entries[j];
|
||||
|
||||
AddHtmlLocalized(103, y, 130, 32, sub.Number, LabelColor, false, false);
|
||||
AddHtmlLocalized(103, y, 130, 32, sub.Number, LabelColor);
|
||||
|
||||
if (entry.RequireExceptional)
|
||||
AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor, false, false); // exceptional
|
||||
AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor); // exceptional
|
||||
else
|
||||
AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor, false, false); // normal
|
||||
AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor); // normal
|
||||
|
||||
object name = GetMaterialName(entry.Material, entry.DeedType, sub.ItemType);
|
||||
|
||||
if (name is int intName)
|
||||
AddHtmlLocalized(316, y, 100, 20, intName, LabelColor, false, false);
|
||||
AddHtmlLocalized(316, y, 100, 20, intName, LabelColor);
|
||||
else
|
||||
AddLabel(316, y, 1152, name.ToString());
|
||||
|
||||
|
|
@ -212,27 +212,27 @@ namespace Server.Engines.BulkOrders
|
|||
int y = 96 + tableIndex++ * 32;
|
||||
|
||||
if (canDrop)
|
||||
AddButton(35, y + 2, 5602, 5606, 5 + i * 2, GumpButtonType.Reply, 0);
|
||||
AddButton(35, y + 2, 5602, 5606, 5 + i * 2);
|
||||
|
||||
if (canDrop || canBuy && smallEntry.Price > 0)
|
||||
{
|
||||
AddButton(579, y + 2, 2117, 2118, 6 + i * 2, GumpButtonType.Reply, 0);
|
||||
AddButton(579, y + 2, 2117, 2118, 6 + i * 2);
|
||||
AddLabel(495, y, 1152, smallEntry.Price.ToString());
|
||||
}
|
||||
|
||||
AddHtmlLocalized(61, y, 50, 32, 1062224, LabelColor, false, false); // Small
|
||||
AddHtmlLocalized(61, y, 50, 32, 1062224, LabelColor); // Small
|
||||
|
||||
AddHtmlLocalized(103, y, 130, 32, smallEntry.Number, LabelColor, false, false);
|
||||
AddHtmlLocalized(103, y, 130, 32, smallEntry.Number, LabelColor);
|
||||
|
||||
if (smallEntry.RequireExceptional)
|
||||
AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor, false, false); // exceptional
|
||||
AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor); // exceptional
|
||||
else
|
||||
AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor, false, false); // normal
|
||||
AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor); // normal
|
||||
|
||||
object name = GetMaterialName(smallEntry.Material, smallEntry.DeedType, smallEntry.ItemType);
|
||||
|
||||
if (name is int intName)
|
||||
AddHtmlLocalized(316, y, 100, 20, intName, LabelColor, false, false);
|
||||
AddHtmlLocalized(316, y, 100, 20, intName, LabelColor);
|
||||
else
|
||||
AddLabel(316, y, 1152, name.ToString());
|
||||
|
||||
|
|
@ -510,8 +510,8 @@ namespace Server.Engines.BulkOrders
|
|||
Item item = bobEntry.Reconstruct();
|
||||
|
||||
Container pack = m_From.Backpack;
|
||||
if (pack == null || !pack.CheckHold(m_From, item, true, true, 0,
|
||||
item.PileWeight + item.TotalWeight))
|
||||
if (pack?.CheckHold(m_From, item, true, true, 0,
|
||||
item.PileWeight + item.TotalWeight) != true)
|
||||
{
|
||||
m_From.SendLocalizedMessage(503204); // You do not have room in your backpack for this
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page));
|
||||
|
|
@ -558,26 +558,26 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
VendorItem vi = pv.GetVendorItem(m_Book);
|
||||
|
||||
if (vi != null && !vi.IsForSale)
|
||||
{
|
||||
int sizeOfDroppedBod = bobEntry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
|
||||
int price = bobEntry.Price;
|
||||
if (vi?.IsForSale != false)
|
||||
return;
|
||||
|
||||
if (price == 0)
|
||||
int sizeOfDroppedBod = bobEntry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
|
||||
int price = bobEntry.Price;
|
||||
|
||||
if (price == 0)
|
||||
{
|
||||
m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Book.Entries.Count > 0)
|
||||
{
|
||||
m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
|
||||
m_Page = GetPageForIndex(index, sizeOfDroppedBod);
|
||||
m_From.SendGump(new BODBuyGump(m_From, m_Book, bobEntry, m_Page, price));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Book.Entries.Count > 0)
|
||||
{
|
||||
m_Page = GetPageForIndex(index, sizeOfDroppedBod);
|
||||
m_From.SendGump(new BODBuyGump(m_From, m_Book, bobEntry, m_Page, price));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage(1062381); // The book is emptz
|
||||
}
|
||||
m_From.SendLocalizedMessage(1062381); // The book is emptz
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ namespace Server.Engines.BulkOrders
|
|||
else if (DeedType == BODType.Tailor)
|
||||
bod = new LargeTailorBOD(AmountMax, RequireExceptional, Material, ReconstructEntries());
|
||||
|
||||
for (int i = 0; bod != null && i < bod.Entries.Length; ++i)
|
||||
for (int i = 0; bod?.Entries.Length >= i; ++i)
|
||||
bod.Entries[i].Owner = bod;
|
||||
|
||||
return bod;
|
||||
|
|
|
|||
|
|
@ -25,17 +25,17 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
AddBackground(100, 10, 300, 150, 5054);
|
||||
|
||||
AddHtmlLocalized(125, 20, 250, 24, 1019070, false, false); // You have agreed to purchase:
|
||||
AddHtmlLocalized(125, 45, 250, 24, 1045151, false, false); // a bulk order deed
|
||||
AddHtmlLocalized(125, 20, 250, 24, 1019070); // You have agreed to purchase:
|
||||
AddHtmlLocalized(125, 45, 250, 24, 1045151); // a bulk order deed
|
||||
|
||||
AddHtmlLocalized(125, 70, 250, 24, 1019071, false, false); // for the amount of:
|
||||
AddHtmlLocalized(125, 70, 250, 24, 1019071); // for the amount of:
|
||||
AddLabel(125, 95, 0, price.ToString());
|
||||
|
||||
AddButton(250, 130, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(282, 130, 100, 24, 1011012, false, false); // CANCEL
|
||||
AddButton(250, 130, 4005, 4007, 1);
|
||||
AddHtmlLocalized(282, 130, 100, 24, 1011012); // CANCEL
|
||||
|
||||
AddButton(120, 130, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(152, 130, 100, 24, 1011036, false, false); // OKAY
|
||||
AddButton(120, 130, 4005, 4007, 2);
|
||||
AddHtmlLocalized(152, 130, 100, 24, 1011036); // OKAY
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -62,7 +62,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
VendorItem vi = pv.GetVendorItem(m_Book);
|
||||
|
||||
if (vi != null && !vi.IsForSale)
|
||||
if (vi?.IsForSale == false)
|
||||
price = m_Entry.Price;
|
||||
|
||||
if (price != m_Price)
|
||||
|
|
@ -84,8 +84,8 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
Container pack = m_From.Backpack;
|
||||
|
||||
if (pack == null || !pack.CheckHold(m_From, item, true, true, 0,
|
||||
item.PileWeight + item.TotalWeight))
|
||||
if (pack?.CheckHold(m_From, item, true, true, 0,
|
||||
item.PileWeight + item.TotalWeight) != true)
|
||||
{
|
||||
pv.SayTo(m_From, 503204); // You do not have room in your backpack for this
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page));
|
||||
|
|
|
|||
|
|
@ -70,9 +70,9 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
SecureTrade trade = cont.Trade;
|
||||
|
||||
if ( trade != null && trade.From.Mobile == from )
|
||||
if (trade?.From.Mobile == from )
|
||||
trade.To.Mobile.SendGump( new BOBGump( (PlayerMobile)trade.To.Mobile, this ) );
|
||||
else if ( trade != null && trade.To.Mobile == from )
|
||||
else if (trade?.To.Mobile == from )
|
||||
trade.From.Mobile.SendGump( new BOBGump( (PlayerMobile)trade.From.Mobile, this ) );
|
||||
}
|
||||
}
|
||||
|
|
@ -159,9 +159,9 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 2 ); // version
|
||||
writer.Write( 2 ); // version
|
||||
|
||||
writer.Write( (int) ItemCount );
|
||||
writer.Write( ItemCount );
|
||||
|
||||
writer.Write( (int) Level );
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
Filter.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( (int) Entries.Count );
|
||||
writer.WriteEncodedInt( Entries.Count );
|
||||
|
||||
for ( int i = 0; i < Entries.Count; ++i )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -218,13 +218,13 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
writer.Write( 0 ); // version
|
||||
|
||||
writer.Write( m_AmountMax );
|
||||
writer.Write( m_RequireExceptional );
|
||||
writer.Write( (int) m_Material );
|
||||
|
||||
writer.Write( (int) m_Entries.Length );
|
||||
writer.Write( m_Entries.Length );
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
m_Entries[i].Serialize( writer );
|
||||
|
|
|
|||
|
|
@ -30,48 +30,45 @@ namespace Server.Engines.BulkOrders
|
|||
AddImage(20, 225 + entries.Length * 24, 10460);
|
||||
AddImage(430, 225 + entries.Length * 24, 10460);
|
||||
|
||||
AddHtmlLocalized(180, 25, 120, 20, 1045134, 0x7FFF, false, false); // A large bulk order
|
||||
AddHtmlLocalized(180, 25, 120, 20, 1045134, 0x7FFF); // A large bulk order
|
||||
|
||||
AddHtmlLocalized(40, 48, 350, 20, 1045135, 0x7FFF, false,
|
||||
false); // Ah! Thanks for the goods! Would you help me out?
|
||||
AddHtmlLocalized(40, 48, 350, 20, 1045135, 0x7FFF); // Ah! Thanks for the goods! Would you help me out?
|
||||
|
||||
AddHtmlLocalized(40, 72, 210, 20, 1045138, 0x7FFF, false, false); // Amount to make:
|
||||
AddHtmlLocalized(40, 72, 210, 20, 1045138, 0x7FFF); // Amount to make:
|
||||
AddLabel(250, 72, 1152, deed.AmountMax.ToString());
|
||||
|
||||
AddHtmlLocalized(40, 96, 120, 20, 1045137, 0x7FFF, false, false); // Items requested:
|
||||
AddHtmlLocalized(40, 96, 120, 20, 1045137, 0x7FFF); // Items requested:
|
||||
|
||||
int y = 120;
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i, y += 24)
|
||||
AddHtmlLocalized(40, y, 210, 20, entries[i].Details.Number, 0x7FFF, false, false);
|
||||
AddHtmlLocalized(40, y, 210, 20, entries[i].Details.Number, 0x7FFF);
|
||||
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
AddHtmlLocalized(40, y, 210, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
|
||||
AddHtmlLocalized(40, y, 210, 20, 1045140, 0x7FFF); // Special requirements to meet:
|
||||
y += 24;
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
{
|
||||
AddHtmlLocalized(40, y, 350, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
|
||||
AddHtmlLocalized(40, y, 350, 20, 1045141, 0x7FFF); // All items must be exceptional.
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
AddHtmlLocalized(40, y, 350, 20, GetMaterialNumberFor(deed.Material), 0x7FFF, false,
|
||||
false); // All items must be made with x material.
|
||||
AddHtmlLocalized(40, y, 350, 20, GetMaterialNumberFor(deed.Material), 0x7FFF); // All items must be made with x material.
|
||||
y += 24;
|
||||
}
|
||||
}
|
||||
|
||||
AddHtmlLocalized(40, 192 + entries.Length * 24, 350, 20, 1045139, 0x7FFF, false,
|
||||
false); // Do you want to accept this order?
|
||||
AddHtmlLocalized(40, 192 + entries.Length * 24, 350, 20, 1045139, 0x7FFF); // Do you want to accept this order?
|
||||
|
||||
AddButton(100, 216 + entries.Length * 24, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(135, 216 + entries.Length * 24, 120, 20, 1006044, 0x7FFF, false, false); // Ok
|
||||
AddButton(100, 216 + entries.Length * 24, 4005, 4007, 1);
|
||||
AddHtmlLocalized(135, 216 + entries.Length * 24, 120, 20, 1006044, 0x7FFF); // Ok
|
||||
|
||||
AddButton(275, 216 + entries.Length * 24, 4005, 4007, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(310, 216 + entries.Length * 24, 120, 20, 1011012, 0x7FFF, false, false); // CANCEL
|
||||
AddButton(275, 216 + entries.Length * 24, 4005, 4007, 0);
|
||||
AddHtmlLocalized(310, 216 + entries.Length * 24, 120, 20, 1011012, 0x7FFF); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ namespace Server.Engines.BulkOrders
|
|||
AddImage(45, 221 + entries.Length * 24, 10460);
|
||||
AddImage(480, 221 + entries.Length * 24, 10460);
|
||||
|
||||
AddHtmlLocalized(225, 25, 120, 20, 1045134, 0x7FFF, false, false); // A large bulk order
|
||||
AddHtmlLocalized(225, 25, 120, 20, 1045134, 0x7FFF); // A large bulk order
|
||||
|
||||
AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF, false, false); // Amount to make:
|
||||
AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF); // Amount to make:
|
||||
AddLabel(275, 48, 1152, deed.AmountMax.ToString());
|
||||
|
||||
AddHtmlLocalized(75, 72, 120, 20, 1045137, 0x7FFF, false, false); // Items requested:
|
||||
AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF, false, false); // Amount finished:
|
||||
AddHtmlLocalized(75, 72, 120, 20, 1045137, 0x7FFF); // Items requested:
|
||||
AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF); // Amount finished:
|
||||
|
||||
int y = 96;
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ namespace Server.Engines.BulkOrders
|
|||
LargeBulkEntry entry = entries[i];
|
||||
SmallBulkEntry details = entry.Details;
|
||||
|
||||
AddHtmlLocalized(75, y, 210, 20, details.Number, 0x7FFF, false, false);
|
||||
AddHtmlLocalized(75, y, 210, 20, details.Number, 0x7FFF);
|
||||
AddLabel(275, y, 0x480, entry.Amount.ToString());
|
||||
|
||||
y += 24;
|
||||
|
|
@ -53,26 +53,24 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
AddHtmlLocalized(75, y, 200, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
|
||||
AddHtmlLocalized(75, y, 200, 20, 1045140, 0x7FFF); // Special requirements to meet:
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
{
|
||||
AddHtmlLocalized(75, y, 300, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
|
||||
AddHtmlLocalized(75, y, 300, 20, 1045141, 0x7FFF); // All items must be exceptional.
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
AddHtmlLocalized(75, y, 300, 20, GetMaterialNumberFor(deed.Material), 0x7FFF, false,
|
||||
false); // All items must be made with x material.
|
||||
AddHtmlLocalized(75, y, 300, 20, GetMaterialNumberFor(deed.Material), 0x7FFF); // All items must be made with x material.
|
||||
|
||||
AddButton(125, 168 + entries.Length * 24, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, 168 + entries.Length * 24, 300, 20, 1045155, 0x7FFF, false,
|
||||
false); // Combine this deed with another deed.
|
||||
AddButton(125, 168 + entries.Length * 24, 4005, 4007, 2);
|
||||
AddHtmlLocalized(160, 168 + entries.Length * 24, 300, 20, 1045155, 0x7FFF); // Combine this deed with another deed.
|
||||
|
||||
AddButton(125, 192 + entries.Length * 24, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, 192 + entries.Length * 24, 120, 20, 1011441, 0x7FFF, false, false); // EXIT
|
||||
AddButton(125, 192 + entries.Length * 24, 4005, 4007, 1);
|
||||
AddHtmlLocalized(160, 192 + entries.Length * 24, 120, 20, 1011441, 0x7FFF); // EXIT
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
|
|||
|
|
@ -29,11 +29,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public sealed class RewardItem
|
||||
{
|
||||
public RewardItem(int weight, ConstructCallback constructor) : this(weight, constructor, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public RewardItem(int weight, ConstructCallback constructor, int type)
|
||||
public RewardItem(int weight, ConstructCallback constructor, int type = 0)
|
||||
{
|
||||
Weight = weight;
|
||||
Constructor = constructor;
|
||||
|
|
@ -583,7 +579,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
Groups = new[]
|
||||
{
|
||||
new RewardGroup(0, new RewardItem(1, Cloth, 0)),
|
||||
new RewardGroup(0, new RewardItem(1, Cloth)),
|
||||
new RewardGroup(50, new RewardItem(1, Cloth, 1)),
|
||||
new RewardGroup(100, new RewardItem(1, Cloth, 2)),
|
||||
new RewardGroup(150, new RewardItem(9, Cloth, 3), new RewardItem(1, Sandals)),
|
||||
|
|
|
|||
|
|
@ -28,36 +28,35 @@ namespace Server.Engines.BulkOrders
|
|||
AddImage(20, 249, 10460);
|
||||
AddImage(430, 249, 10460);
|
||||
|
||||
AddHtmlLocalized(190, 25, 120, 20, 1045133, 0x7FFF, false, false); // A bulk order
|
||||
AddHtmlLocalized(40, 48, 350, 20, 1045135, 0x7FFF, false,
|
||||
false); // Ah! Thanks for the goods! Would you help me out?
|
||||
AddHtmlLocalized(190, 25, 120, 20, 1045133, 0x7FFF); // A bulk order
|
||||
AddHtmlLocalized(40, 48, 350, 20, 1045135, 0x7FFF); // Ah! Thanks for the goods! Would you help me out?
|
||||
|
||||
AddHtmlLocalized(40, 72, 210, 20, 1045138, 0x7FFF, false, false); // Amount to make:
|
||||
AddHtmlLocalized(40, 72, 210, 20, 1045138, 0x7FFF); // Amount to make:
|
||||
AddLabel(250, 72, 1152, deed.AmountMax.ToString());
|
||||
|
||||
AddHtmlLocalized(40, 96, 120, 20, 1045136, 0x7FFF, false, false); // Item requested:
|
||||
AddHtmlLocalized(40, 96, 120, 20, 1045136, 0x7FFF); // Item requested:
|
||||
AddItem(385, 96, deed.Graphic);
|
||||
AddHtmlLocalized(40, 120, 210, 20, deed.Number, 0xFFFFFF, false, false);
|
||||
AddHtmlLocalized(40, 120, 210, 20, deed.Number, 0xFFFFFF);
|
||||
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
AddHtmlLocalized(40, 144, 210, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
|
||||
AddHtmlLocalized(40, 144, 210, 20, 1045140, 0x7FFF); // Special requirements to meet:
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
AddHtmlLocalized(40, 168, 350, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
|
||||
AddHtmlLocalized(40, 168, 350, 20, 1045141, 0x7FFF); // All items must be exceptional.
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
AddHtmlLocalized(40, deed.RequireExceptional ? 192 : 168, 350, 20, GetMaterialNumberFor(deed.Material),
|
||||
0x7FFF, false, false); // All items must be made with x material.
|
||||
0x7FFF); // All items must be made with x material.
|
||||
}
|
||||
|
||||
AddHtmlLocalized(40, 216, 350, 20, 1045139, 0x7FFF, false, false); // Do you want to accept this order?
|
||||
AddHtmlLocalized(40, 216, 350, 20, 1045139, 0x7FFF); // Do you want to accept this order?
|
||||
|
||||
AddButton(100, 240, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(135, 240, 120, 20, 1006044, 0x7FFF, false, false); // Ok
|
||||
AddButton(100, 240, 4005, 4007, 1);
|
||||
AddHtmlLocalized(135, 240, 120, 20, 1006044, 0x7FFF); // Ok
|
||||
|
||||
AddButton(275, 240, 4005, 4007, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(310, 240, 120, 20, 1011012, 0x7FFF, false, false); // CANCEL
|
||||
AddButton(275, 240, 4005, 4007, 0);
|
||||
AddHtmlLocalized(310, 240, 120, 20, 1011012, 0x7FFF); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
|
|||
|
|
@ -27,34 +27,34 @@ namespace Server.Engines.BulkOrders
|
|||
AddImage(45, 245, 10460);
|
||||
AddImage(480, 245, 10460);
|
||||
|
||||
AddHtmlLocalized(225, 25, 120, 20, 1045133, 0x7FFF, false, false); // A bulk order
|
||||
AddHtmlLocalized(225, 25, 120, 20, 1045133, 0x7FFF); // A bulk order
|
||||
|
||||
AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF, false, false); // Amount to make:
|
||||
AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF); // Amount to make:
|
||||
AddLabel(275, 48, 1152, deed.AmountMax.ToString());
|
||||
|
||||
AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF, false, false); // Amount finished:
|
||||
AddHtmlLocalized(75, 72, 120, 20, 1045136, 0x7FFF, false, false); // Item requested:
|
||||
AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF); // Amount finished:
|
||||
AddHtmlLocalized(75, 72, 120, 20, 1045136, 0x7FFF); // Item requested:
|
||||
|
||||
AddItem(410, 72, deed.Graphic);
|
||||
|
||||
AddHtmlLocalized(75, 96, 210, 20, deed.Number, 0x7FFF, false, false);
|
||||
AddHtmlLocalized(75, 96, 210, 20, deed.Number, 0x7FFF);
|
||||
AddLabel(275, 96, 0x480, deed.AmountCur.ToString());
|
||||
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
AddHtmlLocalized(75, 120, 200, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
|
||||
AddHtmlLocalized(75, 120, 200, 20, 1045140, 0x7FFF); // Special requirements to meet:
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
AddHtmlLocalized(75, 144, 300, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
|
||||
AddHtmlLocalized(75, 144, 300, 20, 1045141, 0x7FFF); // All items must be exceptional.
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
AddHtmlLocalized(75, deed.RequireExceptional ? 168 : 144, 300, 20, GetMaterialNumberFor(deed.Material),
|
||||
0x7FFF, false, false); // All items must be made with x material.
|
||||
0x7FFF); // All items must be made with x material.
|
||||
|
||||
AddButton(125, 192, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, 192, 300, 20, 1045154, 0x7FFF, false, false); // Combine this deed with the item requested.
|
||||
AddButton(125, 192, 4005, 4007, 2);
|
||||
AddHtmlLocalized(160, 192, 300, 20, 1045154, 0x7FFF); // Combine this deed with the item requested.
|
||||
|
||||
AddButton(125, 216, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, 216, 120, 20, 1011441, 0x7FFF, false, false); // EXIT
|
||||
AddButton(125, 216, 4005, 4007, 1);
|
||||
AddHtmlLocalized(160, 216, 120, 20, 1011441, 0x7FFF); // EXIT
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
|
|||
|
|
@ -78,10 +78,11 @@ namespace Server.Engines.BulkOrders
|
|||
list.Add( new SmallBulkEntry( type, graphic < 0x4000 ? 1020000 + graphic : 1078872 + graphic, graphic ) );
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace Server.Engines.CannedEvil
|
|||
if (Deleted)
|
||||
return;
|
||||
|
||||
if (m_Skull != null && m_Skull.Deleted)
|
||||
if (m_Skull?.Deleted == true)
|
||||
Skull = null;
|
||||
|
||||
if (from.Map != Map || !from.InRange(GetWorldLocation(), 3))
|
||||
|
|
@ -88,7 +88,7 @@ namespace Server.Engines.CannedEvil
|
|||
if (Deleted)
|
||||
return;
|
||||
|
||||
if (m_Skull != null && m_Skull.Deleted)
|
||||
if (m_Skull?.Deleted == true)
|
||||
Skull = null;
|
||||
|
||||
if (from.Map != Map || !from.InRange(GetWorldLocation(), 3))
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
public bool Validate(ChampionSkullBrazier brazier)
|
||||
{
|
||||
return brazier?.Skull != null && !brazier.Skull.Deleted;
|
||||
return brazier?.Skull?.Deleted == false;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ namespace Server.Engines.CannedEvil
|
|||
}
|
||||
else
|
||||
{
|
||||
if (killer.Corpse != null && !killer.Corpse.Deleted)
|
||||
if (killer?.Corpse.Deleted == false)
|
||||
killer.Corpse.DropItem(scroll);
|
||||
else
|
||||
killer.AddToBackpack(scroll);
|
||||
|
|
@ -421,7 +421,8 @@ namespace Server.Engines.CannedEvil
|
|||
{
|
||||
m_Altar.Hue = 0;
|
||||
|
||||
if (!Core.ML || Map == Map.Felucca) new StarRoomGate(true, m_Altar.Location, m_Altar.Map);
|
||||
if (!Core.ML || Map == Map.Felucca)
|
||||
new StarRoomGate(m_Altar.Location, m_Altar.Map, true);
|
||||
}
|
||||
|
||||
Champion = null;
|
||||
|
|
@ -440,7 +441,9 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
if (m.Deleted)
|
||||
{
|
||||
if (m.Corpse != null && !m.Corpse.Deleted) ((Corpse)m.Corpse).BeginDecay(TimeSpan.FromMinutes(1));
|
||||
if (m.Corpse?.Deleted == false)
|
||||
((Corpse)m.Corpse).BeginDecay(TimeSpan.FromMinutes(1));
|
||||
|
||||
m_Creatures.RemoveAt(i);
|
||||
--i;
|
||||
++m_Kills;
|
||||
|
|
@ -574,6 +577,7 @@ namespace Server.Engines.CannedEvil
|
|||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
Champion?.MoveToWorld(new Point3D(X, Y, Z - 15), Map);
|
||||
|
|
@ -919,7 +923,7 @@ namespace Server.Engines.CannedEvil
|
|||
m_Creatures.Clear();
|
||||
}
|
||||
|
||||
if (Champion != null && !Champion.Player)
|
||||
if (Champion?.Player == false)
|
||||
Champion.Delete();
|
||||
|
||||
Stop();
|
||||
|
|
@ -950,7 +954,7 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
public void RegisterDamage(Mobile from, int amount)
|
||||
{
|
||||
if (from == null || !from.Player)
|
||||
if (from?.Player != true)
|
||||
return;
|
||||
|
||||
m_DamageEntries[from] = amount + (m_DamageEntries.TryGetValue(from, out int value) ? value : 0);
|
||||
|
|
@ -997,7 +1001,7 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
Container pack = to.Backpack;
|
||||
|
||||
if (pack == null || !pack.TryDropItem(to, artifact, false))
|
||||
if (pack?.TryDropItem(to, artifact, false) != true)
|
||||
artifact.Delete();
|
||||
else
|
||||
to.SendLocalizedMessage(
|
||||
|
|
@ -1006,8 +1010,8 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
public bool IsEligible(Mobile m, Item Artifact)
|
||||
{
|
||||
return m.Player && m.Alive && m.Region != null && m.Region == m_Region && m.Backpack != null &&
|
||||
m.Backpack.CheckHold(m, Artifact, false);
|
||||
return m.Player && m.Alive && m.Region != null && m.Region == m_Region &&
|
||||
m.Backpack?.CheckHold(m, Artifact, false) == true;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
|
|||
|
|
@ -9,19 +9,14 @@ namespace Server.Items
|
|||
private Timer m_Timer;
|
||||
|
||||
[Constructible]
|
||||
public StarRoomGate() : this(false)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public StarRoomGate(bool decays, Point3D loc, Map map) : this(decays)
|
||||
public StarRoomGate(Point3D loc, Map map, bool decays) : this(decays)
|
||||
{
|
||||
MoveToWorld(loc, map);
|
||||
Effects.PlaySound(loc, map, 0x20E);
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public StarRoomGate(bool decays) : base(new Point3D(5143, 1774, 0), Map.Felucca)
|
||||
public StarRoomGate(bool decays = false) : base(new Point3D(5143, 1774, 0), Map.Felucca)
|
||||
{
|
||||
Dispellable = false;
|
||||
ItemID = 0x1FD4;
|
||||
|
|
|
|||
|
|
@ -116,21 +116,15 @@ namespace Server.Engines.Chat
|
|||
|
||||
public bool ValidateAccess(ChatUser from, ChatUser target)
|
||||
{
|
||||
if (from != null && target != null && from.Mobile.AccessLevel < target.Mobile.AccessLevel)
|
||||
{
|
||||
from.Mobile.SendMessage("Your access level is too low to do this.");
|
||||
return false;
|
||||
}
|
||||
if (from == null || target == null || from.Mobile.AccessLevel >= target.Mobile.AccessLevel)
|
||||
return true;
|
||||
|
||||
from.Mobile.SendMessage("Your access level is too low to do this.");
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool AddUser(ChatUser user)
|
||||
{
|
||||
return AddUser(user, null);
|
||||
}
|
||||
|
||||
public bool AddUser(ChatUser user, string password)
|
||||
public bool AddUser(ChatUser user, string password = null)
|
||||
{
|
||||
if (Contains(user))
|
||||
{
|
||||
|
|
@ -188,12 +182,7 @@ namespace Server.Engines.Chat
|
|||
}
|
||||
}
|
||||
|
||||
public void AdBan(ChatUser user)
|
||||
{
|
||||
AddBan(user, null);
|
||||
}
|
||||
|
||||
public void AddBan(ChatUser user, ChatUser moderator)
|
||||
public void AddBan(ChatUser user, ChatUser moderator = null)
|
||||
{
|
||||
if (!ValidateModerator(moderator) || !ValidateAccess(moderator, user))
|
||||
return;
|
||||
|
|
@ -210,12 +199,7 @@ namespace Server.Engines.Chat
|
|||
m_Banned.Remove(user);
|
||||
}
|
||||
|
||||
public void Kick(ChatUser user)
|
||||
{
|
||||
Kick(user, null);
|
||||
}
|
||||
|
||||
public void Kick(ChatUser user, ChatUser moderator)
|
||||
public void Kick(ChatUser user, ChatUser moderator = null)
|
||||
{
|
||||
Kick(user, moderator, false);
|
||||
}
|
||||
|
|
@ -248,12 +232,7 @@ namespace Server.Engines.Chat
|
|||
moderator?.SendMessage(62, user.Username); // You are banning %1 from this conference.
|
||||
}
|
||||
|
||||
public void AddVoiced(ChatUser user)
|
||||
{
|
||||
AddVoiced(user, null);
|
||||
}
|
||||
|
||||
public void AddVoiced(ChatUser user, ChatUser moderator)
|
||||
public void AddVoiced(ChatUser user, ChatUser moderator = null)
|
||||
{
|
||||
if (!ValidateModerator(moderator))
|
||||
return;
|
||||
|
|
@ -291,12 +270,7 @@ namespace Server.Engines.Chat
|
|||
}
|
||||
}
|
||||
|
||||
public void AddModerator(ChatUser user)
|
||||
{
|
||||
AddModerator(user, null);
|
||||
}
|
||||
|
||||
public void AddModerator(ChatUser user, ChatUser moderator)
|
||||
public void AddModerator(ChatUser user, ChatUser moderator = null)
|
||||
{
|
||||
if (!ValidateModerator(moderator))
|
||||
return;
|
||||
|
|
@ -316,12 +290,7 @@ namespace Server.Engines.Chat
|
|||
SendCommand(ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username);
|
||||
}
|
||||
|
||||
public void RemoveModerator(ChatUser user)
|
||||
{
|
||||
RemoveModerator(user, null);
|
||||
}
|
||||
|
||||
public void RemoveModerator(ChatUser user, ChatUser moderator)
|
||||
public void RemoveModerator(ChatUser user, ChatUser moderator = null)
|
||||
{
|
||||
if (!ValidateModerator(moderator) || !ValidateAccess(moderator, user))
|
||||
return;
|
||||
|
|
@ -338,32 +307,12 @@ namespace Server.Engines.Chat
|
|||
}
|
||||
}
|
||||
|
||||
public void SendMessage(int number)
|
||||
public void SendMessage(int number, string param1 = null)
|
||||
{
|
||||
SendMessage(number, null, null, null);
|
||||
SendMessage(number, null, param1);
|
||||
}
|
||||
|
||||
public void SendMessage(int number, string param1)
|
||||
{
|
||||
SendMessage(number, null, param1, null);
|
||||
}
|
||||
|
||||
public void SendMessage(int number, string param1, string param2)
|
||||
{
|
||||
SendMessage(number, null, param1, param2);
|
||||
}
|
||||
|
||||
public void SendMessage(int number, ChatUser initiator)
|
||||
{
|
||||
SendMessage(number, initiator, null, null);
|
||||
}
|
||||
|
||||
public void SendMessage(int number, ChatUser initiator, string param1)
|
||||
{
|
||||
SendMessage(number, initiator, param1, null);
|
||||
}
|
||||
|
||||
public void SendMessage(int number, ChatUser initiator, string param1, string param2)
|
||||
public void SendMessage(int number, ChatUser initiator, string param1 = null, string param2 = null)
|
||||
{
|
||||
for (int i = 0; i < m_Users.Count; ++i)
|
||||
{
|
||||
|
|
@ -395,32 +344,12 @@ namespace Server.Engines.Chat
|
|||
}
|
||||
}
|
||||
|
||||
public void SendCommand(ChatCommand command)
|
||||
{
|
||||
SendCommand(command, null, null, null);
|
||||
}
|
||||
|
||||
public void SendCommand(ChatCommand command, string param1)
|
||||
{
|
||||
SendCommand(command, null, param1, null);
|
||||
}
|
||||
|
||||
public void SendCommand(ChatCommand command, string param1, string param2)
|
||||
public void SendCommand(ChatCommand command, string param1 = null, string param2 = null)
|
||||
{
|
||||
SendCommand(command, null, param1, param2);
|
||||
}
|
||||
|
||||
public void SendCommand(ChatCommand command, ChatUser initiator)
|
||||
{
|
||||
SendCommand(command, initiator, null, null);
|
||||
}
|
||||
|
||||
public void SendCommand(ChatCommand command, ChatUser initiator, string param1)
|
||||
{
|
||||
SendCommand(command, initiator, param1, null);
|
||||
}
|
||||
|
||||
public void SendCommand(ChatCommand command, ChatUser initiator, string param1, string param2)
|
||||
public void SendCommand(ChatCommand command, ChatUser initiator, string param1 = null, string param2 = null)
|
||||
{
|
||||
for (int i = 0; i < m_Users.Count; ++i)
|
||||
{
|
||||
|
|
@ -457,12 +386,7 @@ namespace Server.Engines.Chat
|
|||
}
|
||||
}
|
||||
|
||||
public static Channel AddChannel(string name)
|
||||
{
|
||||
return AddChannel(name, null);
|
||||
}
|
||||
|
||||
public static Channel AddChannel(string name, string password)
|
||||
public static Channel AddChannel(string name, string password = null)
|
||||
{
|
||||
Channel channel = FindChannelByName(name);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,17 +16,7 @@ namespace Server.Engines.Chat
|
|||
PacketHandlers.Register(0xB3, 0, true, ChatAction);
|
||||
}
|
||||
|
||||
public static void SendCommandTo(Mobile to, ChatCommand type)
|
||||
{
|
||||
SendCommandTo(to, type, null, null);
|
||||
}
|
||||
|
||||
public static void SendCommandTo(Mobile to, ChatCommand type, string param1)
|
||||
{
|
||||
SendCommandTo(to, type, param1, null);
|
||||
}
|
||||
|
||||
public static void SendCommandTo(Mobile to, ChatCommand type, string param1, string param2)
|
||||
public static void SendCommandTo(Mobile to, ChatCommand type, string param1 = null, string param2 = null)
|
||||
{
|
||||
to?.Send(new ChatMessagePacket(null, (int)type + 20, param1, param2));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ namespace Server.Engines.Chat
|
|||
|
||||
password = password?.Trim();
|
||||
|
||||
if (password != null && password.Length == 0)
|
||||
if (password?.Length == 0)
|
||||
password = null;
|
||||
|
||||
Channel joined = Channel.FindChannelByName(name);
|
||||
|
|
@ -217,7 +217,7 @@ namespace Server.Engines.Chat
|
|||
|
||||
password = password?.Trim();
|
||||
|
||||
if (password != null && password.Length == 0)
|
||||
if (password?.Length == 0)
|
||||
password = null;
|
||||
|
||||
Channel.AddChannel(name, password).AddUser(from, password);
|
||||
|
|
|
|||
|
|
@ -49,17 +49,12 @@ namespace Server.Engines.Chat
|
|||
|
||||
public bool IgnorePrivateMessage{ get; set; }
|
||||
|
||||
public bool IsModerator => CurrentChannel != null && CurrentChannel.IsModerator(this);
|
||||
public bool IsModerator => CurrentChannel?.IsModerator(this) == true;
|
||||
|
||||
public char GetColorCharacter()
|
||||
{
|
||||
if (CurrentChannel != null && CurrentChannel.IsModerator(this))
|
||||
return ModeratorColorCharacter;
|
||||
|
||||
if (CurrentChannel != null && CurrentChannel.IsVoiced(this))
|
||||
return VoicedColorCharacter;
|
||||
|
||||
return NormalColorCharacter;
|
||||
return IsModerator ? ModeratorColorCharacter :
|
||||
CurrentChannel?.IsVoiced(this) == true ? VoicedColorCharacter : NormalColorCharacter;
|
||||
}
|
||||
|
||||
public bool CheckOnline()
|
||||
|
|
@ -71,17 +66,7 @@ namespace Server.Engines.Chat
|
|||
return false;
|
||||
}
|
||||
|
||||
public void SendMessage(int number)
|
||||
{
|
||||
SendMessage(number, null, null);
|
||||
}
|
||||
|
||||
public void SendMessage(int number, string param1)
|
||||
{
|
||||
SendMessage(number, param1, null);
|
||||
}
|
||||
|
||||
public void SendMessage(int number, string param1, string param2)
|
||||
public void SendMessage(int number, string param1 = null, string param2 = null)
|
||||
{
|
||||
if (Mobile.NetState != null)
|
||||
Mobile.Send(new ChatMessagePacket(Mobile, number, param1, param2));
|
||||
|
|
@ -135,28 +120,28 @@ namespace Server.Engines.Chat
|
|||
{
|
||||
ChatUser user = GetChatUser(from);
|
||||
|
||||
if (user == null)
|
||||
if (user != null)
|
||||
return user;
|
||||
|
||||
user = new ChatUser(from);
|
||||
|
||||
m_Users.Add(user);
|
||||
m_Table[from] = user;
|
||||
|
||||
Channel.SendChannelsTo(user);
|
||||
|
||||
List<Channel> list = Channel.Channels;
|
||||
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
user = new ChatUser(from);
|
||||
Channel c = list[i];
|
||||
|
||||
m_Users.Add(user);
|
||||
m_Table[from] = user;
|
||||
|
||||
Channel.SendChannelsTo(user);
|
||||
|
||||
List<Channel> list = Channel.Channels;
|
||||
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
Channel c = list[i];
|
||||
|
||||
if (c.AddUser(user))
|
||||
break;
|
||||
}
|
||||
|
||||
//ChatSystem.SendCommandTo( user.m_Mobile, ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );
|
||||
if (c.AddUser(user))
|
||||
break;
|
||||
}
|
||||
|
||||
//ChatSystem.SendCommandTo( user.m_Mobile, ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
|
|
@ -205,32 +190,12 @@ namespace Server.Engines.Chat
|
|||
return null;
|
||||
}
|
||||
|
||||
public static void GlobalSendCommand(ChatCommand command)
|
||||
{
|
||||
GlobalSendCommand(command, null, null, null);
|
||||
}
|
||||
|
||||
public static void GlobalSendCommand(ChatCommand command, string param1)
|
||||
{
|
||||
GlobalSendCommand(command, null, param1, null);
|
||||
}
|
||||
|
||||
public static void GlobalSendCommand(ChatCommand command, string param1, string param2)
|
||||
public static void GlobalSendCommand(ChatCommand command, string param1, string param2 = null)
|
||||
{
|
||||
GlobalSendCommand(command, null, param1, param2);
|
||||
}
|
||||
|
||||
public static void GlobalSendCommand(ChatCommand command, ChatUser initiator)
|
||||
{
|
||||
GlobalSendCommand(command, initiator, null, null);
|
||||
}
|
||||
|
||||
public static void GlobalSendCommand(ChatCommand command, ChatUser initiator, string param1)
|
||||
{
|
||||
GlobalSendCommand(command, initiator, param1, null);
|
||||
}
|
||||
|
||||
public static void GlobalSendCommand(ChatCommand command, ChatUser initiator, string param1, string param2)
|
||||
public static void GlobalSendCommand(ChatCommand command, ChatUser initiator = null, string param1 = null, string param2 = null)
|
||||
{
|
||||
for (int i = 0; i < m_Users.Count; ++i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,11 +44,11 @@ namespace Server.Engines.ConPVP
|
|||
AddImage(215, -43, 0xEE40);
|
||||
//AddImage( 330, 141, 0x8BA );
|
||||
|
||||
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32), false, false);
|
||||
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32), false, false);
|
||||
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32), false, false);
|
||||
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32), false, false);
|
||||
AddHtml(22, 22, 294, 20, Color(Center("Duel Challenge"), LabelColor32), false, false);
|
||||
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
|
||||
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
|
||||
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
|
||||
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
|
||||
AddHtml(22, 22, 294, 20, Color(Center("Duel Challenge"), LabelColor32));
|
||||
|
||||
string fmt;
|
||||
|
||||
|
|
@ -57,37 +57,37 @@ namespace Server.Engines.ConPVP
|
|||
else
|
||||
fmt = "You have been challenged to a duel from {0}. Do you accept?";
|
||||
|
||||
AddHtml(22 - 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32), false, false);
|
||||
AddHtml(22 + 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32), false, false);
|
||||
AddHtml(22, 50 - 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32), false, false);
|
||||
AddHtml(22, 50 + 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32), false, false);
|
||||
AddHtml(22, 50, 294, 40, Color(string.Format(fmt, challenger.Name), 0xB0C868), false, false);
|
||||
AddHtml(22 - 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
|
||||
AddHtml(22 + 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
|
||||
AddHtml(22, 50 - 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
|
||||
AddHtml(22, 50 + 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
|
||||
AddHtml(22, 50, 294, 40, Color(string.Format(fmt, challenger.Name), 0xB0C868));
|
||||
|
||||
AddImageTiled(32, 88, 264, 1, 9107);
|
||||
AddImageTiled(42, 90, 264, 1, 9157);
|
||||
|
||||
AddRadio(24, 100, 9727, 9730, true, 1);
|
||||
AddHtml(60 - 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32), false, false);
|
||||
AddHtml(60 + 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32), false, false);
|
||||
AddHtml(60, 105 - 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32), false, false);
|
||||
AddHtml(60, 105 + 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32), false, false);
|
||||
AddHtml(60, 105, 250, 20, Color("Yes, I will fight this duel.", LabelColor32), false, false);
|
||||
AddHtml(60 - 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
|
||||
AddHtml(60 + 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
|
||||
AddHtml(60, 105 - 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
|
||||
AddHtml(60, 105 + 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
|
||||
AddHtml(60, 105, 250, 20, Color("Yes, I will fight this duel.", LabelColor32));
|
||||
|
||||
AddRadio(24, 135, 9727, 9730, false, 2);
|
||||
AddHtml(60 - 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32), false, false);
|
||||
AddHtml(60 + 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32), false, false);
|
||||
AddHtml(60, 140 - 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32), false, false);
|
||||
AddHtml(60, 140 + 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32), false, false);
|
||||
AddHtml(60, 140, 250, 20, Color("No, I do not wish to fight.", LabelColor32), false, false);
|
||||
AddHtml(60 - 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
|
||||
AddHtml(60 + 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
|
||||
AddHtml(60, 140 - 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
|
||||
AddHtml(60, 140 + 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
|
||||
AddHtml(60, 140, 250, 20, Color("No, I do not wish to fight.", LabelColor32));
|
||||
|
||||
AddRadio(24, 170, 9727, 9730, false, 3);
|
||||
AddHtml(60 - 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32), false, false);
|
||||
AddHtml(60 + 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32), false, false);
|
||||
AddHtml(60, 175 - 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32), false, false);
|
||||
AddHtml(60, 175 + 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32), false, false);
|
||||
AddHtml(60, 175, 250, 20, Color("No, knave. Do not ask again.", LabelColor32), false, false);
|
||||
AddHtml(60 - 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
|
||||
AddHtml(60 + 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
|
||||
AddHtml(60, 175 - 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
|
||||
AddHtml(60, 175 + 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
|
||||
AddHtml(60, 175, 250, 20, Color("No, knave. Do not ask again.", LabelColor32));
|
||||
|
||||
AddButton(314, 173, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(314, 173, 247, 248, 1);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(15.0), AutoReject);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,13 +86,9 @@ namespace Server.Engines.ConPVP
|
|||
[PropertyObject]
|
||||
public class ArenaStartPoints
|
||||
{
|
||||
public ArenaStartPoints() : this(new Point3D[8])
|
||||
public ArenaStartPoints(Point3D[] points = null)
|
||||
{
|
||||
}
|
||||
|
||||
public ArenaStartPoints(Point3D[] points)
|
||||
{
|
||||
Points = points;
|
||||
Points = points ?? new Point3D[8];
|
||||
}
|
||||
|
||||
public ArenaStartPoints(GenericReader reader)
|
||||
|
|
@ -407,7 +403,8 @@ namespace Server.Engines.ConPVP
|
|||
set
|
||||
{
|
||||
m_GateOut = value;
|
||||
if (Teleporter != null) Teleporter.Location = m_GateOut;
|
||||
if (Teleporter != null)
|
||||
Teleporter.Location = m_GateOut;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -664,7 +661,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
ArenaController controller = allControllers[i];
|
||||
|
||||
if (controller != null && !controller.Deleted && controller.Arena != null && controller.IsPrivate &&
|
||||
if (controller?.Deleted == false && controller.Arena != null && controller.IsPrivate &&
|
||||
controller.Map == first.Map && first.InRange(controller, 24))
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt(controller);
|
||||
|
|
|
|||
|
|
@ -48,11 +48,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private bool m_Yielding;
|
||||
|
||||
public DuelContext(Mobile initiator, RulesetLayout layout) : this(initiator, layout, true)
|
||||
{
|
||||
}
|
||||
|
||||
public DuelContext(Mobile initiator, RulesetLayout layout, bool addNew)
|
||||
public DuelContext(Mobile initiator, RulesetLayout layout, bool addNew = true)
|
||||
{
|
||||
Initiator = initiator;
|
||||
Participants = new List<Participant>();
|
||||
|
|
@ -123,13 +119,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public static bool AllowSpecialMove(Mobile from, string name, SpecialMove move)
|
||||
{
|
||||
if (!(from is PlayerMobile pm))
|
||||
return true;
|
||||
|
||||
DuelContext dc = pm.DuelContext;
|
||||
|
||||
// No DuelContext, or InstaAllowSpecialMove
|
||||
return dc?.InstAllowSpecialMove(from, name, move) != false;
|
||||
return (from as PlayerMobile)?.DuelContext?.InstAllowSpecialMove(from, name, move) != false;
|
||||
}
|
||||
|
||||
public bool InstAllowSpecialMove(Mobile from, string name, SpecialMove move)
|
||||
|
|
@ -139,7 +130,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer pl = Find(from);
|
||||
|
||||
if (pl == null || pl.Eliminated)
|
||||
if (pl?.Eliminated != false)
|
||||
return true;
|
||||
|
||||
if (CantDoAnything(from))
|
||||
|
|
@ -165,9 +156,7 @@ namespace Server.Engines.ConPVP
|
|||
if (!StartedBeginCountdown)
|
||||
return true;
|
||||
|
||||
DuelPlayer pl = Find(from);
|
||||
|
||||
if (pl?.Eliminated != false)
|
||||
if (Find(from)?.Eliminated != false)
|
||||
return true;
|
||||
|
||||
if (CantDoAnything(from))
|
||||
|
|
@ -256,7 +245,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer pl = Find(from);
|
||||
|
||||
if (pl == null || pl.Eliminated)
|
||||
if (pl?.Eliminated != false)
|
||||
return true;
|
||||
|
||||
if (item is Dagger || CheckItemEquip(from, item))
|
||||
|
|
@ -350,7 +339,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer pl = Find(from);
|
||||
|
||||
if (pl == null || pl.Eliminated)
|
||||
if (pl?.Eliminated != false)
|
||||
return true;
|
||||
|
||||
if (CantDoAnything(from))
|
||||
|
|
@ -373,7 +362,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer pl = Find(from);
|
||||
|
||||
if (pl == null || pl.Eliminated)
|
||||
if (pl?.Eliminated != false)
|
||||
return true;
|
||||
|
||||
if (!(item is BaseRefreshPotion))
|
||||
|
|
@ -507,7 +496,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer pl = Find(mob);
|
||||
|
||||
if (pl == null || pl.Eliminated)
|
||||
if (pl?.Eliminated != false)
|
||||
return;
|
||||
|
||||
if (mob.Map == Map.Internal)
|
||||
|
|
@ -533,30 +522,27 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer pl = Find(mob);
|
||||
|
||||
if (pl != null && !pl.Eliminated)
|
||||
if (pl?.Eliminated == true || m_EventGame != null && !m_EventGame.OnDeath(mob, corpse))
|
||||
return;
|
||||
|
||||
pl.Eliminated = true;
|
||||
|
||||
if (mob.Poison != null)
|
||||
mob.Poison = null;
|
||||
|
||||
Requip(mob, corpse);
|
||||
DelayBounce(TimeSpan.FromSeconds(4.0), mob, corpse);
|
||||
|
||||
Participant winner = CheckCompletion();
|
||||
|
||||
if (winner != null)
|
||||
{
|
||||
if (m_EventGame != null && !m_EventGame.OnDeath(mob, corpse))
|
||||
return;
|
||||
|
||||
pl.Eliminated = true;
|
||||
|
||||
if (mob.Poison != null)
|
||||
mob.Poison = null;
|
||||
|
||||
Requip(mob, corpse);
|
||||
DelayBounce(TimeSpan.FromSeconds(4.0), mob, corpse);
|
||||
|
||||
Participant winner = CheckCompletion();
|
||||
|
||||
if (winner != null)
|
||||
{
|
||||
Finish(winner);
|
||||
}
|
||||
else if (!m_Yielding)
|
||||
{
|
||||
mob.LocalOverheadMessage(MessageType.Regular, 0x22, false, "You have been defeated.");
|
||||
mob.NonlocalOverheadMessage(MessageType.Regular, 0x22, false, $"{mob.Name} has been defeated.");
|
||||
}
|
||||
Finish(winner);
|
||||
}
|
||||
else if (!m_Yielding)
|
||||
{
|
||||
mob.LocalOverheadMessage(MessageType.Regular, 0x22, false, "You have been defeated.");
|
||||
mob.NonlocalOverheadMessage(MessageType.Regular, 0x22, false, $"{mob.Name} has been defeated.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -564,7 +550,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)Participants[i];
|
||||
Participant p = Participants[i];
|
||||
|
||||
if (p.HasOpenSlot)
|
||||
return false;
|
||||
|
|
@ -609,7 +595,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
Mobile killer = from.FindMostRecentDamager(false);
|
||||
|
||||
if (killer != null && killer.Player)
|
||||
if (killer?.Player == true)
|
||||
killer.AddToBackpack(new Head(m_Tournament == null ? HeadType.Duel : HeadType.Tournament, from.Name));
|
||||
}
|
||||
|
||||
|
|
@ -671,7 +657,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
DuelPlayer pl = winner.Players[i];
|
||||
|
||||
if (pl != null && !pl.Eliminated)
|
||||
if (pl?.Eliminated == false)
|
||||
DelayBounce(TimeSpan.FromSeconds(8.0), pl.Mobile, null);
|
||||
}
|
||||
|
||||
|
|
@ -688,7 +674,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant loser = (Participant)Participants[i];
|
||||
Participant loser = Participants[i];
|
||||
|
||||
if (loser != winner)
|
||||
{
|
||||
|
|
@ -714,8 +700,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (IsOneVsOne)
|
||||
{
|
||||
DuelPlayer dp1 = ((Participant)Participants[0]).Players[0];
|
||||
DuelPlayer dp2 = ((Participant)Participants[1]).Players[0];
|
||||
DuelPlayer dp1 = Participants[0].Players[0];
|
||||
DuelPlayer dp2 = Participants[1].Players[0];
|
||||
|
||||
if (dp1 != null && dp2 != null)
|
||||
{
|
||||
|
|
@ -797,7 +783,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)Participants[i];
|
||||
Participant p = Participants[i];
|
||||
|
||||
for (int j = 0; j < p.Players.Length; ++j)
|
||||
{
|
||||
|
|
@ -828,7 +814,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant oldPart = (Participant)Participants[i];
|
||||
Participant oldPart = Participants[i];
|
||||
Participant newPart = new Participant(dc, oldPart.Players.Length);
|
||||
|
||||
for (int j = 0; j < oldPart.Players.Length; ++j)
|
||||
|
|
@ -858,7 +844,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)Participants[i];
|
||||
Participant p = Participants[i];
|
||||
DuelPlayer pl = p.Find(mob);
|
||||
|
||||
if (pl != null)
|
||||
|
|
@ -873,7 +859,7 @@ namespace Server.Engines.ConPVP
|
|||
DuelPlayer pl1 = Find(m1);
|
||||
DuelPlayer pl2 = Find(m2);
|
||||
|
||||
return pl1 != null && pl2 != null && pl1.Participant == pl2.Participant;
|
||||
return pl1 != null && pl1.Participant == pl2?.Participant;
|
||||
}
|
||||
|
||||
public Participant CheckCompletion()
|
||||
|
|
@ -885,7 +871,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)Participants[i];
|
||||
Participant p = Participants[i];
|
||||
|
||||
if (p.Eliminated)
|
||||
{
|
||||
|
|
@ -900,10 +886,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
if (hasWinner)
|
||||
return winner ?? (Participant)Participants[0];
|
||||
|
||||
return null;
|
||||
return hasWinner ? winner ?? Participants[0] : null;
|
||||
}
|
||||
|
||||
public void StartCountdown(int count, CountdownCallback cb)
|
||||
|
|
@ -953,13 +936,13 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)Participants[i];
|
||||
Participant p = Participants[i];
|
||||
|
||||
for (int j = 0; j < p.Players.Length; ++j)
|
||||
{
|
||||
DuelPlayer pl = p.Players[j];
|
||||
|
||||
if (pl == null || pl.Eliminated)
|
||||
if (pl?.Eliminated != false)
|
||||
continue;
|
||||
|
||||
pl.Mobile.SendSound(0x1E1);
|
||||
|
|
@ -984,13 +967,13 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)Participants[i];
|
||||
Participant p = Participants[i];
|
||||
|
||||
for (int j = 0; j < p.Players.Length; ++j)
|
||||
{
|
||||
DuelPlayer pl = p.Players[j];
|
||||
|
||||
if (pl == null || pl.Eliminated)
|
||||
if (pl?.Eliminated != false)
|
||||
continue;
|
||||
|
||||
pl.Mobile.SendSound(0x1E1);
|
||||
|
|
@ -1065,7 +1048,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
DuelPlayer pl = p.Players[j];
|
||||
|
||||
if (pl != null && !pl.Eliminated)
|
||||
if (pl?.Eliminated == false)
|
||||
DelayBounce(TimeSpan.FromSeconds(8.0), pl.Mobile, null);
|
||||
}
|
||||
|
||||
|
|
@ -1527,7 +1510,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)Participants[i];
|
||||
Participant p = Participants[i];
|
||||
|
||||
for (int j = 0; j < p.Players.Length; ++j)
|
||||
{
|
||||
|
|
@ -1546,7 +1529,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)Participants[i];
|
||||
Participant p = Participants[i];
|
||||
|
||||
for (int j = 0; j < p.Players.Length; ++j)
|
||||
{
|
||||
|
|
@ -1851,9 +1834,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i)
|
||||
{
|
||||
defs.Or(((Ruleset)ruleset.Flavors[i]).Options);
|
||||
defs.Or(ruleset.Flavors[i].Options);
|
||||
|
||||
mob.SendMessage(" + {0}", ((Ruleset)ruleset.Flavors[i]).Title);
|
||||
mob.SendMessage(" + {0}", ruleset.Flavors[i].Title);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -2084,10 +2067,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
Arena arena = m_OverrideArena;
|
||||
|
||||
if (arena == null)
|
||||
arena = Arena.FindArena(players);
|
||||
Arena arena = m_OverrideArena ?? Arena.FindArena(players);
|
||||
|
||||
if (arena == null)
|
||||
{
|
||||
|
|
@ -2482,7 +2462,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
else
|
||||
{
|
||||
if (m_Teleporter != null && !m_Teleporter.Deleted)
|
||||
if (m_Teleporter?.Deleted == false)
|
||||
m_Teleporter.Register(m);
|
||||
|
||||
base.UseGate(m);
|
||||
|
|
|
|||
|
|
@ -15,12 +15,7 @@ namespace Server.Engines.ConPVP
|
|||
public class DuelTeleporterAddon : BaseAddon
|
||||
{
|
||||
[Constructible]
|
||||
public DuelTeleporterAddon() : this(DuelTeleporterType.Squares)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public DuelTeleporterAddon(DuelTeleporterType type)
|
||||
public DuelTeleporterAddon(DuelTeleporterType type = DuelTeleporterType.Squares)
|
||||
{
|
||||
int itemID = (int)type;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
|
|
@ -85,7 +85,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
Mobile mob = FindOwner(parent);
|
||||
|
||||
if (mob != null) mob.SolidHueOverride = 0x0499;
|
||||
if (mob != null)
|
||||
mob.SolidHueOverride = 0x0499;
|
||||
}
|
||||
|
||||
public override void OnRemoved(IEntity parent)
|
||||
|
|
@ -100,9 +101,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void DropTo(Mobile mob, Mobile killer)
|
||||
{
|
||||
if (mob != null && !mob.Deleted)
|
||||
if (mob?.Deleted == false)
|
||||
MoveToWorld(mob.Location, mob.Map);
|
||||
else if (killer != null && !killer.Deleted)
|
||||
else if (killer?.Deleted == false)
|
||||
MoveToWorld(killer.Location, killer.Map);
|
||||
else
|
||||
m_Game?.ReturnBomb();
|
||||
|
|
@ -110,14 +111,11 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
{
|
||||
if (m_Flying || !Visible || m_Game == null || m == null || !m.Alive)
|
||||
if (m_Flying || !Visible || m_Game == null || m?.Alive != true)
|
||||
return true;
|
||||
|
||||
BRTeamInfo useTeam = m_Game.GetTeamInfo(m);
|
||||
if (useTeam == null)
|
||||
return true;
|
||||
|
||||
return TakeBomb(m, useTeam, "picked up");
|
||||
return useTeam == null || TakeBomb(m, useTeam, "picked up");
|
||||
}
|
||||
|
||||
public override void OnLocationChange(Point3D oldLocation)
|
||||
|
|
@ -150,7 +148,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnDoubleClick(Mobile m)
|
||||
{
|
||||
if (m_Game == null || !Visible || m == null || !m.Alive)
|
||||
if (m_Game == null || !Visible || m?.Alive != true)
|
||||
return;
|
||||
|
||||
if (!m_Flying && IsChildOf(m.Backpack))
|
||||
|
|
@ -408,15 +406,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (landTile.ID == 0x244 && statics.Length == 0) // 0x244 = invalid land tile
|
||||
{
|
||||
bool empty = true;
|
||||
IPooledEnumerable<Item> eable = Map.GetItemsInRange(point, 0);
|
||||
|
||||
foreach (Item item in eable)
|
||||
if (item != this)
|
||||
{
|
||||
empty = false;
|
||||
break;
|
||||
}
|
||||
bool empty = eable.All(item => item == this);
|
||||
|
||||
eable.Free();
|
||||
|
||||
|
|
@ -747,9 +739,8 @@ namespace Server.Engines.ConPVP
|
|||
private void ResendBombTarget()
|
||||
{
|
||||
// Make sure they still have the bomb, then give them the target back
|
||||
if (m_Bomb != null && !m_Bomb.Deleted && m_Mob != null && !m_Mob.Deleted && m_Mob.Alive)
|
||||
if (m_Bomb.IsChildOf(m_Mob))
|
||||
m_Mob.Target = new BombTarget(m_Bomb, m_Mob);
|
||||
if (m_Bomb?.Deleted == false && m_Mob?.Deleted == false && m_Mob.Alive && m_Bomb.IsChildOf(m_Mob))
|
||||
m_Mob.Target = new BombTarget(m_Bomb, m_Mob);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -905,7 +896,7 @@ namespace Server.Engines.ConPVP
|
|||
if (!Visible)
|
||||
return true;
|
||||
|
||||
if (m == null || !m.Player || !m.Alive || m.Backpack == null || m_Team?.Game == null)
|
||||
if (m?.Player != true || !m.Alive || m.Backpack == null || m_Team?.Game == null)
|
||||
return true;
|
||||
|
||||
if (!base.OnMoveOver(m))
|
||||
|
|
@ -968,16 +959,11 @@ namespace Server.Engines.ConPVP
|
|||
private const int LabelColor32 = 0xFFFFFF;
|
||||
private const int BlackColor32 = 0x000000;
|
||||
|
||||
private BRGame m_Game;
|
||||
// private BRGame m_Game;
|
||||
|
||||
public BRBoardGump(Mobile mob, BRGame game)
|
||||
: this(mob, game, null)
|
||||
public BRBoardGump(Mobile mob, BRGame game, BRTeamInfo section = null) : base(60, 60)
|
||||
{
|
||||
}
|
||||
|
||||
public BRBoardGump(Mobile mob, BRGame game, BRTeamInfo section) : base(60, 60)
|
||||
{
|
||||
m_Game = game;
|
||||
// m_Game = game;
|
||||
|
||||
BRTeamInfo ourTeam = game.GetTeamInfo(mob);
|
||||
|
||||
|
|
@ -1099,7 +1085,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBorderedText(235 + 15, 105 + i * 75, 250, 20, pl.Player.Name, 0xFFC000, BlackColor32);
|
||||
}
|
||||
|
||||
AddButton(314, height - 42, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(314, height - 42, 247, 248, 1);
|
||||
}
|
||||
|
||||
public string Center(string text)
|
||||
|
|
@ -1124,9 +1110,9 @@ namespace Server.Engines.ConPVP
|
|||
private void AddColoredText(int x, int y, int width, int height, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, height, text, false, false);
|
||||
AddHtml(x, y, width, height, text);
|
||||
else
|
||||
AddHtml(x, y, width, height, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, height, Color(text, color));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1456,10 +1442,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override bool CantDoAnything(Mobile mob)
|
||||
{
|
||||
if (mob?.Backpack == null || GetTeamInfo(mob) == null)
|
||||
return false;
|
||||
|
||||
return mob.Backpack.FindItemByType<BRBomb>() != null;
|
||||
return mob.Backpack?.FindItemByType<BRBomb>() != null && GetTeamInfo(mob) != null;
|
||||
}
|
||||
|
||||
public void ReturnBomb()
|
||||
|
|
@ -1549,7 +1532,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
m_Context.RemoveAggressions(mob);
|
||||
|
||||
if (dp != null && !dp.Eliminated)
|
||||
if (dp?.Eliminated == false)
|
||||
mob.MoveToWorld(m_Context.Arena.GetBaseStartPoint(GetTeamID(mob)), Facet);
|
||||
else
|
||||
m_Context.SendOutside(mob);
|
||||
|
|
@ -1578,7 +1561,7 @@ namespace Server.Engines.ConPVP
|
|||
bomb.DropTo(mob, killer);
|
||||
});
|
||||
|
||||
if (killer != null && killer.Player)
|
||||
if (killer?.Player == true)
|
||||
{
|
||||
BRTeamInfo teamInfo = GetTeamInfo(killer);
|
||||
BRTeamInfo victInfo = GetTeamInfo(mob);
|
||||
|
|
@ -1647,33 +1630,36 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (tourney != null && tourney.TourneyType == TourneyType.FreeForAll)
|
||||
if (tourney != null)
|
||||
{
|
||||
sb.Append(m_Context.Participants.Count * tourney.PlayersPerParticipant);
|
||||
sb.Append("-man FFA");
|
||||
}
|
||||
else if (tourney != null && tourney.TourneyType == TourneyType.RandomTeam)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-team");
|
||||
}
|
||||
else if (tourney != null && tourney.TourneyType == TourneyType.RedVsBlue)
|
||||
{
|
||||
sb.Append("Red v Blue");
|
||||
}
|
||||
else if (tourney != null && tourney.TourneyType == TourneyType.Faction)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-team Faction");
|
||||
}
|
||||
else if (tourney != null)
|
||||
{
|
||||
for (int i = 0; i < tourney.ParticipantsPerMatch; ++i)
|
||||
if (tourney.TourneyType == TourneyType.FreeForAll)
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
sb.Append('v');
|
||||
sb.Append(m_Context.Participants.Count * tourney.PlayersPerParticipant);
|
||||
sb.Append("-man FFA");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.RandomTeam)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-team");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.RedVsBlue)
|
||||
{
|
||||
sb.Append("Red v Blue");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.Faction)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-team Faction");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < tourney.ParticipantsPerMatch; ++i)
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
sb.Append('v');
|
||||
|
||||
sb.Append(tourney.PlayersPerParticipant);
|
||||
sb.Append(tourney.PlayersPerParticipant);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBorderedText(235 + 15, 105 + i * 75, 250, 20, pl.Player.Name, 0xFFC000, BlackColor32);
|
||||
}
|
||||
|
||||
AddButton(314, height - 42, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(314, height - 42, 247, 248, 1);
|
||||
}
|
||||
|
||||
public string Center(string text)
|
||||
|
|
@ -203,9 +203,9 @@ namespace Server.Engines.ConPVP
|
|||
private void AddColoredText(int x, int y, int width, int height, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, height, text, false, false);
|
||||
AddHtml(x, y, width, height, text);
|
||||
else
|
||||
AddHtml(x, y, width, height, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, height, Color(text, color));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -904,7 +904,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
m_Context.RemoveAggressions(mob);
|
||||
|
||||
if (dp != null && !dp.Eliminated)
|
||||
if (dp?.Eliminated == false)
|
||||
mob.MoveToWorld(m_Context.Arena.GetBaseStartPoint(GetTeamID(mob)), Facet);
|
||||
else
|
||||
m_Context.SendOutside(mob);
|
||||
|
|
@ -933,7 +933,7 @@ namespace Server.Engines.ConPVP
|
|||
flag.DropTo(mob, killer);
|
||||
});
|
||||
|
||||
if (killer != null && killer.Player)
|
||||
if (killer?.Player == true)
|
||||
{
|
||||
CTFTeamInfo teamInfo = GetTeamInfo(killer);
|
||||
CTFTeamInfo victInfo = GetTeamInfo(mob);
|
||||
|
|
@ -1030,33 +1030,36 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (tourney != null && tourney.TourneyType == TourneyType.FreeForAll)
|
||||
if (tourney != null)
|
||||
{
|
||||
sb.Append(m_Context.Participants.Count * tourney.PlayersPerParticipant);
|
||||
sb.Append("-man FFA");
|
||||
}
|
||||
else if (tourney != null && tourney.TourneyType == TourneyType.RandomTeam)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-team");
|
||||
}
|
||||
else if (tourney != null && tourney.TourneyType == TourneyType.RedVsBlue)
|
||||
{
|
||||
sb.Append("Red v Blue");
|
||||
}
|
||||
else if (tourney != null && tourney.TourneyType == TourneyType.Faction)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-team Faction");
|
||||
}
|
||||
else if (tourney != null)
|
||||
{
|
||||
for (int i = 0; i < tourney.ParticipantsPerMatch; ++i)
|
||||
if (tourney.TourneyType == TourneyType.FreeForAll)
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
sb.Append('v');
|
||||
sb.Append(m_Context.Participants.Count * tourney.PlayersPerParticipant);
|
||||
sb.Append("-man FFA");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.RandomTeam)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-team");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.RedVsBlue)
|
||||
{
|
||||
sb.Append("Red v Blue");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.Faction)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-team Faction");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < tourney.ParticipantsPerMatch; ++i)
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
sb.Append('v');
|
||||
|
||||
sb.Append(tourney.PlayersPerParticipant);
|
||||
sb.Append(tourney.PlayersPerParticipant);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,17 +54,12 @@ namespace Server.Engines.ConPVP
|
|||
private const int LabelColor32 = 0xFFFFFF;
|
||||
private const int BlackColor32 = 0x000000;
|
||||
|
||||
private DDGame m_Game;
|
||||
// private DDGame m_Game;
|
||||
|
||||
public DDBoardGump(Mobile mob, DDGame game)
|
||||
: this(mob, game, null)
|
||||
{
|
||||
}
|
||||
|
||||
public DDBoardGump(Mobile mob, DDGame game, DDTeamInfo section)
|
||||
public DDBoardGump(Mobile mob, DDGame game, DDTeamInfo section = null)
|
||||
: base(60, 60)
|
||||
{
|
||||
m_Game = game;
|
||||
// m_Game = game;
|
||||
|
||||
DDTeamInfo ourTeam = game.GetTeamInfo(mob);
|
||||
|
||||
|
|
@ -179,7 +174,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBorderedText(235 + 15, 105 + i * 75, 250, 20, pl.Player.Name, 0xFFC000, BlackColor32);
|
||||
}
|
||||
|
||||
AddButton(314, height - 42, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(314, height - 42, 247, 248, 1);
|
||||
}
|
||||
|
||||
public string Center(string text)
|
||||
|
|
@ -204,9 +199,9 @@ namespace Server.Engines.ConPVP
|
|||
private void AddColoredText(int x, int y, int width, int height, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, height, text, false, false);
|
||||
AddHtml(x, y, width, height, text);
|
||||
else
|
||||
AddHtml(x, y, width, height, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, height, Color(text, color));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -553,7 +548,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
m_Context.RemoveAggressions(mob);
|
||||
|
||||
if (dp != null && !dp.Eliminated)
|
||||
if (dp?.Eliminated == false)
|
||||
mob.MoveToWorld(m_Context.Arena.GetBaseStartPoint(GetTeamID(mob)), Facet);
|
||||
else
|
||||
m_Context.SendOutside(mob);
|
||||
|
|
@ -568,7 +563,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Mobile killer = mob.FindMostRecentDamager(false);
|
||||
|
||||
if (killer != null && killer.Player)
|
||||
if (killer?.Player == true)
|
||||
{
|
||||
DDTeamInfo teamInfo = GetTeamInfo(killer);
|
||||
DDTeamInfo victInfo = GetTeamInfo(mob);
|
||||
|
|
@ -663,33 +658,36 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (tourney != null && tourney.TourneyType == TourneyType.FreeForAll)
|
||||
if (tourney != null)
|
||||
{
|
||||
sb.Append(m_Context.Participants.Count * tourney.PlayersPerParticipant);
|
||||
sb.Append("-man FFA");
|
||||
}
|
||||
else if (tourney != null && tourney.TourneyType == TourneyType.RandomTeam)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-team");
|
||||
}
|
||||
else if (tourney != null && tourney.TourneyType == TourneyType.RedVsBlue)
|
||||
{
|
||||
sb.Append("Red v Blue");
|
||||
}
|
||||
else if (tourney != null && tourney.TourneyType == TourneyType.Faction)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-team Faction");
|
||||
}
|
||||
else if (tourney != null)
|
||||
{
|
||||
for (int i = 0; i < tourney.ParticipantsPerMatch; ++i)
|
||||
if (tourney.TourneyType == TourneyType.FreeForAll)
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
sb.Append('v');
|
||||
sb.Append(m_Context.Participants.Count * tourney.PlayersPerParticipant);
|
||||
sb.Append("-man FFA");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.RandomTeam)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-team");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.RedVsBlue)
|
||||
{
|
||||
sb.Append("Red v Blue");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.Faction)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-team Faction");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < tourney.ParticipantsPerMatch; ++i)
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
sb.Append('v');
|
||||
|
||||
sb.Append(tourney.PlayersPerParticipant);
|
||||
sb.Append(tourney.PlayersPerParticipant);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -850,14 +848,12 @@ namespace Server.Engines.ConPVP
|
|||
if (point == null || from == null || team == null || !m_Capturable)
|
||||
return;
|
||||
|
||||
bool wasDom = Controller.PointA != null && Controller.PointB != null &&
|
||||
Controller.PointA.TeamOwner == Controller.PointB.TeamOwner && Controller.PointA.TeamOwner != null;
|
||||
bool wasDom = Controller.PointA?.TeamOwner == Controller.PointB?.TeamOwner && Controller.PointA?.TeamOwner != null;
|
||||
|
||||
point.TeamOwner = team;
|
||||
Alert("{0} has captured {1}!", team.Name, point.Name);
|
||||
|
||||
bool isDom = Controller.PointA != null && Controller.PointB != null &&
|
||||
Controller.PointA.TeamOwner == Controller.PointB.TeamOwner && Controller.PointA.TeamOwner != null;
|
||||
bool isDom = Controller.PointA?.TeamOwner == Controller.PointB?.TeamOwner && Controller.PointA?.TeamOwner != null;
|
||||
|
||||
if (wasDom && !isDom)
|
||||
{
|
||||
|
|
@ -879,12 +875,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private void CaptureTick()
|
||||
{
|
||||
DDTeamInfo team = null;
|
||||
|
||||
if (Controller.PointA?.TeamOwner != null)
|
||||
team = Controller.PointA.TeamOwner;
|
||||
else if (Controller.PointB?.TeamOwner != null)
|
||||
team = Controller.PointB.TeamOwner;
|
||||
DDTeamInfo team = Controller.PointA?.TeamOwner ?? Controller.PointB?.TeamOwner;
|
||||
|
||||
if (team == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Server.Gumps;
|
||||
|
|
@ -92,7 +91,7 @@ namespace Server.Engines.ConPVP
|
|||
return false;
|
||||
|
||||
// Mobile exists and is alive and is a player?
|
||||
if (m == null || m.Deleted || !m.Alive || !m.Player)
|
||||
if (m?.Deleted != false || !m.Alive || !m.Player)
|
||||
return false;
|
||||
|
||||
// Not current king (or they are the current king)
|
||||
|
|
@ -100,10 +99,7 @@ namespace Server.Engines.ConPVP
|
|||
return false;
|
||||
|
||||
// They are on a team
|
||||
if (m_Game.GetTeamInfo(m) == null)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return m_Game.GetTeamInfo(m) != null;
|
||||
}
|
||||
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
|
|
@ -147,12 +143,8 @@ namespace Server.Engines.ConPVP
|
|||
if (m_Game != null && CapturesSoFar > 0 && killer != null && king != null && kingTeam != null &&
|
||||
killerTeam != null)
|
||||
{
|
||||
string kingName = king.Name;
|
||||
if (kingName == null)
|
||||
kingName = "";
|
||||
string killerName = killer.Name;
|
||||
if (killerName == null)
|
||||
killerName = "";
|
||||
string kingName = king.Name ?? "";
|
||||
string killerName = killer.Name ?? "";
|
||||
|
||||
m_Game.Alert("{0} ({1}) was dethroned by {2} ({3})!", kingName, kingTeam.Name, killerName, killerTeam.Name);
|
||||
}
|
||||
|
|
@ -217,13 +209,13 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
KHPlayerInfo pi = null;
|
||||
|
||||
if (m_Hill == null || m_Hill.Deleted || m_Hill.Game == null)
|
||||
if (m_Hill?.Deleted != false || m_Hill.Game == null)
|
||||
{
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_Hill.King == null || m_Hill.King.Deleted || !m_Hill.King.Alive)
|
||||
if (m_Hill.King?.Deleted != false || !m_Hill.King.Alive)
|
||||
{
|
||||
m_Hill.DeKingify();
|
||||
Stop();
|
||||
|
|
@ -468,7 +460,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBorderedText(235 + 15, 105 + i * 75, 250, 20, leader, 0xFFC000, BlackColor32);
|
||||
}
|
||||
|
||||
AddButton(314, height - 42, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(314, height - 42, 247, 248, 1);
|
||||
}
|
||||
|
||||
public string Center(string text)
|
||||
|
|
@ -493,9 +485,9 @@ namespace Server.Engines.ConPVP
|
|||
private void AddColoredText(int x, int y, int width, int height, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, height, text, false, false);
|
||||
AddHtml(x, y, width, height, text);
|
||||
else
|
||||
AddHtml(x, y, width, height, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, height, Color(text, color));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -865,7 +857,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
if (mob != null && GetTeamInfo(mob) != null && Controller != null)
|
||||
for (int i = 0; i < Controller.Hills.Length; i++)
|
||||
if (Controller.Hills[i] != null && Controller.Hills[i].King == mob)
|
||||
if (Controller.Hills[i]?.King == mob)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -937,7 +929,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
m_Context.RemoveAggressions(mob);
|
||||
|
||||
if (dp != null && !dp.Eliminated)
|
||||
if (dp?.Eliminated == false)
|
||||
mob.MoveToWorld(m_Context.Arena.GetBaseStartPoint(GetTeamID(mob)), Facet);
|
||||
else
|
||||
m_Context.SendOutside(mob);
|
||||
|
|
@ -947,7 +939,7 @@ namespace Server.Engines.ConPVP
|
|||
DuelContext.CancelSpell(mob);
|
||||
mob.Frozen = false;
|
||||
|
||||
if (corpse != null && !corpse.Deleted)
|
||||
if (corpse?.Deleted == false)
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(30), corpse.Delete);
|
||||
}
|
||||
|
||||
|
|
@ -958,7 +950,7 @@ namespace Server.Engines.ConPVP
|
|||
KHTeamInfo victInfo = GetTeamInfo(mob);
|
||||
int bonus = 0;
|
||||
|
||||
if (killer != null && killer.Player)
|
||||
if (killer?.Player == true)
|
||||
teamInfo = GetTeamInfo(killer);
|
||||
|
||||
for (int i = 0; i < Controller.Hills.Length; i++)
|
||||
|
|
@ -1017,7 +1009,7 @@ namespace Server.Engines.ConPVP
|
|||
Controller.Hills[i].Game = this;
|
||||
|
||||
foreach (KHBoard board in Controller.Boards)
|
||||
if (board != null && !board.Deleted)
|
||||
if (board?.Deleted == false)
|
||||
board.m_Game = this;
|
||||
|
||||
m_FinishTimer = Timer.DelayCall(Controller.Duration, Finish_Callback);
|
||||
|
|
@ -1041,28 +1033,31 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (tourney != null && tourney.TourneyType == TourneyType.FreeForAll)
|
||||
if (tourney != null)
|
||||
{
|
||||
sb.Append(m_Context.Participants.Count * tourney.PlayersPerParticipant);
|
||||
sb.Append("-man FFA");
|
||||
}
|
||||
else if (tourney != null && tourney.TourneyType == TourneyType.RandomTeam)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-team");
|
||||
}
|
||||
else if (tourney != null && tourney.TourneyType == TourneyType.RedVsBlue)
|
||||
{
|
||||
sb.Append("Red v Blue");
|
||||
}
|
||||
else if (tourney != null)
|
||||
{
|
||||
for (int i = 0; i < tourney.ParticipantsPerMatch; ++i)
|
||||
if (tourney.TourneyType == TourneyType.FreeForAll)
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
sb.Append('v');
|
||||
sb.Append(m_Context.Participants.Count * tourney.PlayersPerParticipant);
|
||||
sb.Append("-man FFA");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.RandomTeam)
|
||||
{
|
||||
sb.Append(tourney.ParticipantsPerMatch);
|
||||
sb.Append("-team");
|
||||
}
|
||||
else if (tourney.TourneyType == TourneyType.RedVsBlue)
|
||||
{
|
||||
sb.Append("Red v Blue");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < tourney.ParticipantsPerMatch; ++i)
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
sb.Append('v');
|
||||
|
||||
sb.Append(tourney.PlayersPerParticipant);
|
||||
sb.Append(tourney.PlayersPerParticipant);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public DuelContext Context{ get; set; }
|
||||
|
||||
public bool InProgress => Context != null && Context.Registered;
|
||||
public bool InProgress => Context?.Registered == true;
|
||||
|
||||
public void Start(Arena arena, Tournament tourney)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace Server.Engines.ConPVP
|
|||
defs = new BitArray(basedef.Options);
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i)
|
||||
defs.Or(((Ruleset)ruleset.Flavors[i]).Options);
|
||||
defs.Or(ruleset.Flavors[i].Options);
|
||||
|
||||
height += ruleset.Flavors.Count * 18;
|
||||
}
|
||||
|
|
@ -194,7 +194,7 @@ namespace Server.Engines.ConPVP
|
|||
y += 20;
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i, y += 18)
|
||||
AddBorderedText(35, y, 190, 20, $" + {((Ruleset)ruleset.Flavors[i]).Title}", LabelColor32, BlackColor32);
|
||||
AddBorderedText(35, y, 190, 20, $" + {ruleset.Flavors[i].Title}", LabelColor32, BlackColor32);
|
||||
|
||||
y += 4;
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ namespace Server.Engines.ConPVP
|
|||
y += 35;
|
||||
|
||||
y -= 3;
|
||||
AddButton(314, y, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(314, y, 247, 248, 1);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(15.0), AutoReject);
|
||||
}
|
||||
|
|
@ -270,9 +270,9 @@ namespace Server.Engines.ConPVP
|
|||
private void AddColoredText(int x, int y, int width, int height, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, height, text, false, false);
|
||||
AddHtml(x, y, width, height, text);
|
||||
else
|
||||
AddHtml(x, y, width, height, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, height, Color(text, color));
|
||||
}
|
||||
|
||||
public void AutoReject()
|
||||
|
|
|
|||
|
|
@ -105,18 +105,13 @@ namespace Server.Engines.ConPVP
|
|||
AddColumnHeader(325, "Participants");
|
||||
AddColumnHeader(40, "Obs");
|
||||
|
||||
AddButton(499 + 40 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(499 + 40 - 12 - 63, height - 12 - 24, 241, 242, 2, GumpButtonType.Reply, 0);
|
||||
AddButton(499 + 40 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1);
|
||||
AddButton(499 + 40 - 12 - 63, height - 12 - 24, 241, 242, 2);
|
||||
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
Arena ar = list[i];
|
||||
|
||||
string name = ar.Name;
|
||||
|
||||
if (name == null)
|
||||
name = "(no name)";
|
||||
|
||||
int x = 12;
|
||||
int y = 32 + i * 31;
|
||||
|
||||
|
|
@ -125,7 +120,7 @@ namespace Server.Engines.ConPVP
|
|||
AddRadio(x + 3, y + 1, 9727, 9730, false, i);
|
||||
x += 35;
|
||||
|
||||
AddBorderedText(x + 5, y + 5, 115 - 5, name, color, 0);
|
||||
AddBorderedText(x + 5, y + 5, 115 - 5, ar.Name ?? "(no name)", color, 0);
|
||||
x += 115;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
@ -271,9 +266,9 @@ namespace Server.Engines.ConPVP
|
|||
private void AddColoredText(int x, int y, int width, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, 20, text, false, false);
|
||||
AddHtml(x, y, width, 20, text);
|
||||
else
|
||||
AddHtml(x, y, width, 20, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, 20, Color(text, color));
|
||||
}
|
||||
|
||||
private void AddColumnHeader(int width, string name)
|
||||
|
|
|
|||
|
|
@ -20,32 +20,32 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
AddImage(215, -43, 0xEE40);
|
||||
|
||||
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32), false, false);
|
||||
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32), false, false);
|
||||
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32), false, false);
|
||||
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32), false, false);
|
||||
AddHtml(22, 22, 294, 20, Color(Center("Duel Countdown"), LabelColor32), false, false);
|
||||
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
|
||||
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
|
||||
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
|
||||
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
|
||||
AddHtml(22, 22, 294, 20, Color(Center("Duel Countdown"), LabelColor32));
|
||||
|
||||
AddHtml(22 - 1, 50, 294, 80,
|
||||
Color(
|
||||
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
|
||||
BlackColor32), false, false);
|
||||
BlackColor32));
|
||||
AddHtml(22 + 1, 50, 294, 80,
|
||||
Color(
|
||||
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
|
||||
BlackColor32), false, false);
|
||||
BlackColor32));
|
||||
AddHtml(22, 50 - 1, 294, 80,
|
||||
Color(
|
||||
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
|
||||
BlackColor32), false, false);
|
||||
BlackColor32));
|
||||
AddHtml(22, 50 + 1, 294, 80,
|
||||
Color(
|
||||
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
|
||||
BlackColor32), false, false);
|
||||
BlackColor32));
|
||||
AddHtml(22, 50, 294, 80,
|
||||
Color(
|
||||
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
|
||||
0xFFCC66), false, false);
|
||||
0xFFCC66));
|
||||
|
||||
/*AddImageTiled( 32, 128, 264, 1, 9107 );
|
||||
AddImageTiled( 42, 130, 264, 1, 9157 );
|
||||
|
|
@ -56,7 +56,7 @@ namespace Server.Engines.ConPVP
|
|||
AddHtml( 60, 140+1, 250, 20, Color( String.Format( "Duel will begin in <BASEFONT COLOR=#{2:X6}>{0} <BASEFONT COLOR=#{2:X6}>second{1}.", count, count==1?"":"s", BlackColor32 ), BlackColor32 ), false, false );
|
||||
AddHtml( 60, 140, 250, 20, Color( String.Format( "Duel will begin in <BASEFONT COLOR=#FF6666>{0} <BASEFONT COLOR=#{2:X6}>second{1}.", count, count==1?"":"s", 0x66AACC ), 0x66AACC ), false, false );*/
|
||||
|
||||
AddButton(314 - 50, 157 - offset, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(314 - 50, 157 - offset, 247, 248, 1);
|
||||
}
|
||||
|
||||
public string Center(string text)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class ConfirmSignupGump : Gump
|
|||
defs = new BitArray(basedef.Options);
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i)
|
||||
defs.Or(((Ruleset)ruleset.Flavors[i]).Options);
|
||||
defs.Or(ruleset.Flavors[i].Options);
|
||||
|
||||
height += ruleset.Flavors.Count * 18;
|
||||
}
|
||||
|
|
@ -198,7 +198,7 @@ public class ConfirmSignupGump : Gump
|
|||
y += 20;
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i, y += 18)
|
||||
AddBorderedText(35, y, 190, 20, $" + {((Ruleset)ruleset.Flavors[i]).Title}", LabelColor32, BlackColor32);
|
||||
AddBorderedText(35, y, 190, 20, $" + {ruleset.Flavors[i].Title}", LabelColor32, BlackColor32);
|
||||
|
||||
y += 4;
|
||||
|
||||
|
|
@ -278,7 +278,7 @@ public class ConfirmSignupGump : Gump
|
|||
y += 35;
|
||||
|
||||
y -= 3;
|
||||
AddButton(314, y, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(314, y, 247, 248, 1);
|
||||
}
|
||||
|
||||
public string Center(string text)
|
||||
|
|
@ -303,15 +303,15 @@ public class ConfirmSignupGump : Gump
|
|||
private void AddColoredText(int x, int y, int width, int height, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, height, text, false, false);
|
||||
AddHtml(x, y, width, height, text);
|
||||
else
|
||||
AddHtml(x, y, width, height, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, height, Color(text, color));
|
||||
}
|
||||
|
||||
public void AddGoldenButton(int x, int y, int bid)
|
||||
{
|
||||
AddButton(x, y, 0xD2, 0xD2, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0xD2, 0xD2, bid);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, height, 9250);
|
||||
AddBackground(10, 10, 280, height - 20, 0xDAC);
|
||||
|
||||
AddHtml(35, 25, 230, 20, Center("Duel Setup"), false, false);
|
||||
AddHtml(35, 25, 230, 20, Center("Duel Setup"));
|
||||
|
||||
int x = 35;
|
||||
int y = 47;
|
||||
|
|
@ -38,12 +38,12 @@ namespace Server.Engines.ConPVP
|
|||
AddGoldenButtonLabeled(x, y, 3, "Add Participant");
|
||||
y += 30;
|
||||
|
||||
AddHtml(35, y, 230, 20, Center("Participants"), false, false);
|
||||
AddHtml(35, y, 230, 20, Center("Participants"));
|
||||
y += 22;
|
||||
|
||||
for (int i = 0; i < context.Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)context.Participants[i];
|
||||
Participant p = context.Participants[i];
|
||||
|
||||
AddGoldenButtonLabeled(x, y, 4 + i,
|
||||
string.Format(p.Count == 1 ? "Player {0}: {3}" : "Team {0}: {1}/{2}: {3}", 1 + i, p.FilledSlots, p.Count,
|
||||
|
|
@ -63,14 +63,14 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void AddGoldenButton(int x, int y, int bid)
|
||||
{
|
||||
AddButton(x, y, 0xD2, 0xD2, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0xD2, 0xD2, bid);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
|
||||
}
|
||||
|
||||
public void AddGoldenButtonLabeled(int x, int y, int bid, string text)
|
||||
{
|
||||
AddGoldenButton(x, y, bid);
|
||||
AddHtml(x + 25, y, 200, 20, text, false, false);
|
||||
AddHtml(x + 25, y, 200, 20, text);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -129,7 +129,7 @@ namespace Server.Engines.ConPVP
|
|||
index -= 4;
|
||||
|
||||
if (index >= 0 && index < Context.Participants.Count)
|
||||
From.SendGump(new ParticipantGump(From, Context, (Participant)Context.Participants[index]));
|
||||
From.SendGump(new ParticipantGump(From, Context, Context.Participants[index]));
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,18 +103,18 @@ namespace Server.Engines.ConPVP
|
|||
AddAlphaRegion(10, 10, 479, height - 20);
|
||||
|
||||
if (page > 0)
|
||||
AddButton(446, height - 12 - 2 - 16, 0x15E3, 0x15E7, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(446, height - 12 - 2 - 16, 0x15E3, 0x15E7, 1);
|
||||
else
|
||||
AddImage(446, height - 12 - 2 - 16, 0x2626);
|
||||
|
||||
if ((page + 1) * 15 < lc)
|
||||
AddButton(466, height - 12 - 2 - 16, 0x15E1, 0x15E5, 2, GumpButtonType.Reply, 0);
|
||||
AddButton(466, height - 12 - 2 - 16, 0x15E1, 0x15E5, 2);
|
||||
else
|
||||
AddImage(466, height - 12 - 2 - 16, 0x2622);
|
||||
|
||||
AddHtml(16, height - 12 - 2 - 18, 400, 20,
|
||||
Color(string.Format("Top {3} of {0:N0} duelists, page {1} of {2}", m_List.Count, page + 1, (lc + 14) / 15, lc),
|
||||
0xFFC000), false, false);
|
||||
0xFFC000));
|
||||
|
||||
AddColumnHeader(75, "Rank");
|
||||
AddColumnHeader(115, "Level");
|
||||
|
|
@ -231,9 +231,9 @@ namespace Server.Engines.ConPVP
|
|||
private void AddColoredText(int x, int y, int width, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, 20, text, false, false);
|
||||
AddHtml(x, y, width, 20, text);
|
||||
else
|
||||
AddHtml(x, y, width, 20, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, 20, Color(text, color));
|
||||
}
|
||||
|
||||
private void AddColumnHeader(int width, string name)
|
||||
|
|
|
|||
|
|
@ -29,16 +29,16 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, height, 9250);
|
||||
AddBackground(10, 10, 280, height - 20, 0xDAC);
|
||||
|
||||
AddButton(240, 25, 0xFB1, 0xFB3, 3, GumpButtonType.Reply, 0);
|
||||
AddButton(240, 25, 0xFB1, 0xFB3, 3);
|
||||
|
||||
//AddButton( 223, 54, 0x265A, 0x265A, 4, GumpButtonType.Reply, 0 );
|
||||
//AddButton( 223, 54, 0x265A, 0x265A, 4, );
|
||||
|
||||
AddHtml(35, 25, 230, 20, Center("Participant Setup"), false, false);
|
||||
AddHtml(35, 25, 230, 20, Center("Participant Setup"));
|
||||
|
||||
int x = 35;
|
||||
int y = 47;
|
||||
|
||||
AddHtml(x, y, 200, 20, $"Team Size: {p.Players.Length}", false, false);
|
||||
AddHtml(x, y, 200, 20, $"Team Size: {p.Players.Length}");
|
||||
y += 22;
|
||||
|
||||
AddGoldenButtonLabeled(x + 20, y, 1, "Increase");
|
||||
|
|
@ -46,7 +46,7 @@ namespace Server.Engines.ConPVP
|
|||
AddGoldenButtonLabeled(x + 20, y, 2, "Decrease");
|
||||
y += 30;
|
||||
|
||||
AddHtml(35, y, 230, 20, Center("Players"), false, false);
|
||||
AddHtml(35, y, 230, 20, Center("Players"));
|
||||
y += 22;
|
||||
|
||||
for (int i = 0; i < p.Players.Length; ++i)
|
||||
|
|
@ -71,14 +71,14 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void AddGoldenButton(int x, int y, int bid)
|
||||
{
|
||||
AddButton(x, y, 0xD2, 0xD2, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0xD2, 0xD2, bid);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
|
||||
}
|
||||
|
||||
public void AddGoldenButtonLabeled(int x, int y, int bid, string text)
|
||||
{
|
||||
AddGoldenButton(x, y, bid);
|
||||
AddHtml(x + 25, y, 200, 20, text, false, false);
|
||||
AddHtml(x + 25, y, 200, 20, text);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 260, height, 9250);
|
||||
AddBackground(10, 10, 240, height - 20, 0xDAC);
|
||||
|
||||
AddHtml(35, 25, 190, 20, Center("Rules"), false, false);
|
||||
AddHtml(35, 25, 190, 20, Center("Rules"));
|
||||
|
||||
int y = 25 + 20;
|
||||
|
||||
|
|
@ -34,37 +34,37 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Ruleset cur = m_Defaults[i];
|
||||
|
||||
AddHtml(35 + 14, y, 176, 20, cur.Title, false, false);
|
||||
AddHtml(35 + 14, y, 176, 20, cur.Title);
|
||||
|
||||
if (ruleset.Base == cur && !ruleset.Changed)
|
||||
AddImage(35, y + 4, 0x939);
|
||||
else if (ruleset.Base == cur)
|
||||
AddButton(35, y + 4, 0x93A, 0x939, 2 + i, GumpButtonType.Reply, 0);
|
||||
AddButton(35, y + 4, 0x93A, 0x939, 2 + i);
|
||||
else
|
||||
AddButton(35, y + 4, 0x938, 0x939, 2 + i, GumpButtonType.Reply, 0);
|
||||
AddButton(35, y + 4, 0x938, 0x939, 2 + i);
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
||||
AddHtml(35 + 14, y, 176, 20, "Custom", false, false);
|
||||
AddButton(35, y + 4, ruleset.Changed ? 0x939 : 0x938, 0x939, 1, GumpButtonType.Reply, 0);
|
||||
AddHtml(35 + 14, y, 176, 20, "Custom");
|
||||
AddButton(35, y + 4, ruleset.Changed ? 0x939 : 0x938, 0x939, 1);
|
||||
|
||||
y += 22;
|
||||
y += 6;
|
||||
|
||||
AddHtml(35, y, 190, 20, Center("Flavors"), false, false);
|
||||
AddHtml(35, y, 190, 20, Center("Flavors"));
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < m_Flavors.Length; ++i)
|
||||
{
|
||||
Ruleset cur = m_Flavors[i];
|
||||
|
||||
AddHtml(35 + 14, y, 176, 20, cur.Title, false, false);
|
||||
AddHtml(35 + 14, y, 176, 20, cur.Title);
|
||||
|
||||
if (ruleset.Flavors.Contains(cur))
|
||||
AddButton(35, y + 4, 0x939, 0x938, 2 + m_Defaults.Length + i, GumpButtonType.Reply, 0);
|
||||
AddButton(35, y + 4, 0x939, 0x938, 2 + m_Defaults.Length + i);
|
||||
else
|
||||
AddButton(35, y + 4, 0x938, 0x939, 2 + m_Defaults.Length + i, GumpButtonType.Reply, 0);
|
||||
AddButton(35, y + 4, 0x938, 0x939, 2 + m_Defaults.Length + i);
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (m_Context != null && !m_Context.Registered)
|
||||
if (m_Context?.Registered == false)
|
||||
return;
|
||||
|
||||
switch (info.ButtonID)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < parts.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)parts[i];
|
||||
Participant p = parts[i];
|
||||
|
||||
height += 4;
|
||||
|
||||
|
|
@ -44,19 +44,19 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (count == -1)
|
||||
{
|
||||
AddHtml(35, 25, 190, 20, Center("Ready"), false, false);
|
||||
AddHtml(35, 25, 190, 20, Center("Ready"));
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtml(35, 25, 190, 20, Center("Starting"), false, false);
|
||||
AddHtml(35, 25, 190, 20, "<DIV ALIGN=RIGHT>" + count, false, false);
|
||||
AddHtml(35, 25, 190, 20, Center("Starting"));
|
||||
AddHtml(35, 25, 190, 20, "<DIV ALIGN=RIGHT>" + count);
|
||||
}
|
||||
|
||||
int y = 25 + 20;
|
||||
|
||||
for (int i = 0; i < parts.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)parts[i];
|
||||
Participant p = parts[i];
|
||||
|
||||
y += 4;
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (p.Players.Length > 1)
|
||||
{
|
||||
AddHtml(35 + 14, y, 176, 20, $"Participant #{i + 1}", false, false);
|
||||
AddHtml(35 + 14, y, 176, 20, $"Participant #{i + 1}");
|
||||
y += 22;
|
||||
offset = 10;
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
DuelPlayer pl = p.Players[j];
|
||||
|
||||
if (pl != null && pl.Ready)
|
||||
if (pl?.Ready == true)
|
||||
{
|
||||
AddImage(35 + offset, y + 4, 0x939);
|
||||
}
|
||||
|
|
@ -87,7 +87,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
string name = pl == null ? "(Empty)" : pl.Mobile.Name;
|
||||
|
||||
AddHtml(35 + offset + 14, y, 166, 20, name, false, false);
|
||||
AddHtml(35 + offset + 14, y, 166, 20, name);
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 210, height, 9250);
|
||||
AddBackground(10, 10, 190, height - 20, 0xDAC);
|
||||
|
||||
AddHtml(35, 25, 140, 20, Center("Rematch?"), false, false);
|
||||
AddHtml(35, 25, 140, 20, Center("Rematch?"));
|
||||
|
||||
AddButton(35, 55, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(115, 55, 242, 241, 2, GumpButtonType.Reply, 0);
|
||||
AddButton(35, 55, 247, 248, 1);
|
||||
AddButton(115, 55, 242, 241, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -58,7 +58,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 260, height, 9250);
|
||||
AddBackground(10, 10, 240, height - 20, 0xDAC);
|
||||
|
||||
AddHtml(35, 25, 190, 20, Center("Participants"), false, false);
|
||||
AddHtml(35, 25, 190, 20, Center("Participants"));
|
||||
|
||||
int y = 20 + 25;
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (p.Players.Length > 1)
|
||||
{
|
||||
AddHtml(35, y, 176, 20, $"Team #{i + 1}", false, false);
|
||||
AddHtml(35, y, 176, 20, $"Team #{i + 1}");
|
||||
y += 22;
|
||||
offset = 10;
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
string name = pl == null ? "(Empty)" : pl.Mobile.Name;
|
||||
|
||||
AddHtml(35 + offset, y, 166, 20, name, false, false);
|
||||
AddHtml(35 + offset, y, 166, 20, name);
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
|
@ -91,12 +91,12 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
y += 8;
|
||||
|
||||
AddHtml(35, y, 176, 20, "Continue?", false, false);
|
||||
AddHtml(35, y, 176, 20, "Continue?");
|
||||
|
||||
y -= 2;
|
||||
|
||||
AddButton(102, y, 247, 248, 0, GumpButtonType.Page, 2);
|
||||
AddButton(169, y, 242, 241, 2, GumpButtonType.Reply, 0);
|
||||
AddButton(169, y, 242, 241, 2);
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ namespace Server.Engines.ConPVP
|
|||
defs = new BitArray(basedef.Options);
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i)
|
||||
defs.Or(((Ruleset)ruleset.Flavors[i]).Options);
|
||||
defs.Or(ruleset.Flavors[i].Options);
|
||||
|
||||
height += ruleset.Flavors.Count * 18;
|
||||
}
|
||||
|
|
@ -140,20 +140,20 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 260, height, 9250);
|
||||
AddBackground(10, 10, 240, height - 20, 0xDAC);
|
||||
|
||||
AddHtml(35, 25, 190, 20, Center("Rules"), false, false);
|
||||
AddHtml(35, 25, 190, 20, Center("Rules"));
|
||||
|
||||
AddHtml(35, 50, 190, 20, $"Set: {basedef.Title}", false, false);
|
||||
AddHtml(35, 50, 190, 20, $"Set: {basedef.Title}");
|
||||
|
||||
y = 70;
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i, y += 18)
|
||||
AddHtml(35, y, 190, 20, $" + {((Ruleset)ruleset.Flavors[i]).Title}", false, false);
|
||||
AddHtml(35, y, 190, 20, $" + {ruleset.Flavors[i].Title}");
|
||||
|
||||
y += 4;
|
||||
|
||||
if (changes > 0)
|
||||
{
|
||||
AddHtml(35, y, 190, 20, "Modifications:", false, false);
|
||||
AddHtml(35, y, 190, 20, "Modifications:");
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < opts.Length; ++i)
|
||||
|
|
@ -164,7 +164,7 @@ namespace Server.Engines.ConPVP
|
|||
if (name != null) // sanity
|
||||
{
|
||||
AddImage(35, y, opts[i] ? 0xD3 : 0xD2);
|
||||
AddHtml(60, y, 165, 22, name, false, false);
|
||||
AddHtml(60, y, 165, 22, name);
|
||||
}
|
||||
|
||||
y += 22;
|
||||
|
|
@ -172,18 +172,18 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
else
|
||||
{
|
||||
AddHtml(35, y, 190, 20, "Modifications: None", false, false);
|
||||
AddHtml(35, y, 190, 20, "Modifications: None");
|
||||
y += 20;
|
||||
}
|
||||
|
||||
y += 8;
|
||||
|
||||
AddHtml(35, y, 176, 20, "Continue?", false, false);
|
||||
AddHtml(35, y, 176, 20, "Continue?");
|
||||
|
||||
y -= 2;
|
||||
|
||||
AddButton(102, y, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(169, y, 242, 241, 3, GumpButtonType.Reply, 0);
|
||||
AddButton(102, y, 247, 248, 1);
|
||||
AddButton(169, y, 242, 241, 3);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
@ -196,8 +196,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void AddGoldenButton(int x, int y, int bid)
|
||||
{
|
||||
AddButton(x, y, 0xD2, 0xD2, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0xD2, 0xD2, bid);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 260, height, 9250);
|
||||
AddBackground(10, 10, 240, height - 20, 0xDAC);
|
||||
|
||||
AddHtml(35, 25, 190, 20, Center(page.Title), false, false);
|
||||
AddHtml(35, 25, 190, 20, Center(page.Title));
|
||||
|
||||
int x = 35;
|
||||
int y = 47;
|
||||
|
|
@ -53,7 +53,7 @@ namespace Server.Engines.ConPVP
|
|||
for (int i = 0; i < page.Children.Length; ++i)
|
||||
{
|
||||
AddGoldenButton(x, y, 1 + i);
|
||||
AddHtml(x + 25, y, 250, 22, page.Children[i].Title, false, false);
|
||||
AddHtml(x + 25, y, 250, 22, page.Children[i].Title);
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ namespace Server.Engines.ConPVP
|
|||
else
|
||||
AddCheck(x, y, 0xD2, 0xD3, enabled, i);
|
||||
|
||||
AddHtml(x + 25, y, 250, 22, page.Options[i], false, false);
|
||||
AddHtml(x + 25, y, 250, 22, page.Options[i]);
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
|
@ -80,13 +80,13 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void AddGoldenButton(int x, int y, int bid)
|
||||
{
|
||||
AddButton(x, y, 0xD2, 0xD2, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0xD2, 0xD2, bid);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (m_DuelContext != null && !m_DuelContext.Registered)
|
||||
if (m_DuelContext?.Registered == false)
|
||||
return;
|
||||
|
||||
if (!m_ReadOnly)
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
sb.Append(" Tournament Bracket");
|
||||
|
||||
AddHtml(25, 35, 250, 20, Center(sb.ToString()), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center(sb.ToString()));
|
||||
|
||||
AddRightArrow(25, 53, ToButtonID(0, 4), "Rules");
|
||||
AddRightArrow(25, 71, ToButtonID(0, 1), "Participants");
|
||||
|
|
@ -117,7 +117,7 @@ namespace Server.Engines.ConPVP
|
|||
text = "The tournament will begin shortly.";
|
||||
}
|
||||
|
||||
AddHtml(25, 92, 250, 40, text, false, false);
|
||||
AddHtml(25, 92, 250, 40, text);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -138,7 +138,7 @@ namespace Server.Engines.ConPVP
|
|||
defs = new BitArray(basedef.Options);
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i)
|
||||
defs.Or(((Ruleset)ruleset.Flavors[i]).Options);
|
||||
defs.Or(ruleset.Flavors[i].Options);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -158,7 +158,7 @@ namespace Server.Engines.ConPVP
|
|||
60 + 18 + 20 + 20 + 20 + 8 + 20 + ruleset.Flavors.Count * 18 + 4 + 20 + changes * 22 + 6, 9380);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 0));
|
||||
AddHtml(25, 35, 250, 20, Center("Rules"), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center("Rules"));
|
||||
|
||||
int y = 53;
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ namespace Server.Engines.ConPVP
|
|||
break;
|
||||
}
|
||||
|
||||
AddHtml(35, y, 190, 20, $"Grouping: {groupText}", false, false);
|
||||
AddHtml(35, y, 190, 20, $"Grouping: {groupText}");
|
||||
y += 20;
|
||||
|
||||
string tieText = null;
|
||||
|
|
@ -201,7 +201,7 @@ namespace Server.Engines.ConPVP
|
|||
break;
|
||||
}
|
||||
|
||||
AddHtml(35, y, 190, 20, $"Tiebreaker: {tieText}", false, false);
|
||||
AddHtml(35, y, 190, 20, $"Tiebreaker: {tieText}");
|
||||
y += 20;
|
||||
|
||||
string sdText = "Off";
|
||||
|
|
@ -216,22 +216,22 @@ namespace Server.Engines.ConPVP
|
|||
sdText = $"{sdText} (all rounds)";
|
||||
}
|
||||
|
||||
AddHtml(35, y, 240, 20, $"Sudden Death: {sdText}", false, false);
|
||||
AddHtml(35, y, 240, 20, $"Sudden Death: {sdText}");
|
||||
y += 20;
|
||||
|
||||
y += 8;
|
||||
|
||||
AddHtml(35, y, 190, 20, $"Ruleset: {basedef.Title}", false, false);
|
||||
AddHtml(35, y, 190, 20, $"Ruleset: {basedef.Title}");
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i, y += 18)
|
||||
AddHtml(35, y, 190, 20, $" + {((Ruleset)ruleset.Flavors[i]).Title}", false, false);
|
||||
AddHtml(35, y, 190, 20, $" + {ruleset.Flavors[i].Title}");
|
||||
|
||||
y += 4;
|
||||
|
||||
if (changes > 0)
|
||||
{
|
||||
AddHtml(35, y, 190, 20, "Modifications:", false, false);
|
||||
AddHtml(35, y, 190, 20, "Modifications:");
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < opts.Length; ++i)
|
||||
|
|
@ -242,7 +242,7 @@ namespace Server.Engines.ConPVP
|
|||
if (name != null) // sanity
|
||||
{
|
||||
AddImage(35, y, opts[i] ? 0xD3 : 0xD2);
|
||||
AddHtml(60, y, 165, 22, name, false, false);
|
||||
AddHtml(60, y, 165, 22, name);
|
||||
}
|
||||
|
||||
y += 22;
|
||||
|
|
@ -250,7 +250,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
else
|
||||
{
|
||||
AddHtml(35, y, 190, 20, "Modifications: None", false, false);
|
||||
AddHtml(35, y, 190, 20, "Modifications: None");
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -265,8 +265,7 @@ namespace Server.Engines.ConPVP
|
|||
: new List<TourneyParticipant>(tourney.Participants);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 0));
|
||||
AddHtml(25, 35, 250, 20, Center($"{pList.Count} Participant{(pList.Count == 1 ? "" : "s")}"), false,
|
||||
false);
|
||||
AddHtml(25, 35, 250, 20, Center($"{pList.Count} Participant{(pList.Count == 1 ? "" : "s")}"));
|
||||
|
||||
StartPage(out int index, out int count, out int y, 12);
|
||||
|
||||
|
|
@ -293,11 +292,11 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, 60 + 18 + 20 + part.Players.Count * 18 + 20 + 20 + 160, 9380);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 1));
|
||||
AddHtml(25, 35, 250, 20, Center("Participants"), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center("Participants"));
|
||||
|
||||
int y = 53;
|
||||
|
||||
AddHtml(25, y, 200, 20, part.Players.Count == 1 ? "Players" : "Team", false, false);
|
||||
AddHtml(25, y, 200, 20, part.Players.Count == 1 ? "Players" : "Team");
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < part.Players.Count; ++i)
|
||||
|
|
@ -314,10 +313,10 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
AddHtml(25, y, 200, 20,
|
||||
$"Free Advances: {(part.FreeAdvances == 0 ? "None" : part.FreeAdvances.ToString())}", false, false);
|
||||
$"Free Advances: {(part.FreeAdvances == 0 ? "None" : part.FreeAdvances.ToString())}");
|
||||
y += 20;
|
||||
|
||||
AddHtml(25, y, 200, 20, "Log:", false, false);
|
||||
AddHtml(25, y, 200, 20, "Log:");
|
||||
y += 20;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
@ -343,7 +342,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, 300, 9380);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 3));
|
||||
AddHtml(25, 35, 250, 20, Center("Participants"), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center("Participants"));
|
||||
|
||||
if (!(obj is Mobile mob))
|
||||
break;
|
||||
|
|
@ -351,16 +350,13 @@ namespace Server.Engines.ConPVP
|
|||
Ladder ladder = Ladder.Instance;
|
||||
LadderEntry entry = ladder?.Find(mob);
|
||||
|
||||
AddHtml(25, 53, 250, 20, $"Name: {mob.Name}", false, false);
|
||||
AddHtml(25, 53, 250, 20, $"Name: {mob.Name}");
|
||||
AddHtml(25, 73, 250, 20,
|
||||
$"Guild: {(mob.Guild == null ? "None" : mob.Guild.Name + " [" + mob.Guild.Abbreviation + "]")}",
|
||||
false, false);
|
||||
AddHtml(25, 93, 250, 20, $"Rank: {(entry == null ? "N/A" : LadderGump.Rank(entry.Index + 1))}", false,
|
||||
false);
|
||||
AddHtml(25, 113, 250, 20, $"Level: {(entry == null ? 0 : Ladder.GetLevel(entry.Experience))}", false,
|
||||
false);
|
||||
AddHtml(25, 133, 250, 20, $"Wins: {entry?.Wins ?? 0:N0}", false, false);
|
||||
AddHtml(25, 153, 250, 20, $"Losses: {entry?.Losses ?? 0:N0}", false, false);
|
||||
$"Guild: {(mob.Guild == null ? "None" : mob.Guild.Name + " [" + mob.Guild.Abbreviation + "]")}");
|
||||
AddHtml(25, 93, 250, 20, $"Rank: {(entry == null ? "N/A" : LadderGump.Rank(entry.Index + 1))}");
|
||||
AddHtml(25, 113, 250, 20, $"Level: {(entry == null ? 0 : Ladder.GetLevel(entry.Experience))}");
|
||||
AddHtml(25, 133, 250, 20, $"Wins: {entry?.Wins ?? 0:N0}");
|
||||
AddHtml(25, 153, 250, 20, $"Losses: {entry?.Losses ?? 0:N0}");
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -370,7 +366,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, 300, 9380);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 0));
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"));
|
||||
|
||||
// List<PyramidLevel> levelsList = m_List != null
|
||||
// ? Utility.CastListCovariant<object, PyramidLevel>(m_List)
|
||||
|
|
@ -389,7 +385,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, 300, 9380);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 2));
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"));
|
||||
|
||||
if (!(m_Object is PyramidLevel level))
|
||||
break;
|
||||
|
|
@ -401,7 +397,7 @@ namespace Server.Engines.ConPVP
|
|||
AddRightArrow(25, 53, ToButtonID(5, 0),
|
||||
$"Free Advance: {(level.FreeAdvance == null ? "None" : level.FreeAdvance.NameList)}");
|
||||
|
||||
AddHtml(25, 73, 200, 20, $"{matchesList.Count} Match{(matchesList.Count == 1 ? "" : "es")}", false, false);
|
||||
AddHtml(25, 73, 200, 20, $"{matchesList.Count} Match{(matchesList.Count == 1 ? "" : "es")}");
|
||||
|
||||
StartPage(out int index, out int count, out int y, 10);
|
||||
|
||||
|
|
@ -529,14 +525,12 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, 60 + 18 + 20 + 20 + 20 + ct * 18 + 6, 9380);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 5));
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"));
|
||||
|
||||
AddHtml(25, 53, 250, 20, $"Winner: {(match.Winner == null ? "N/A" : match.Winner.NameList)}", false,
|
||||
false);
|
||||
AddHtml(25, 53, 250, 20, $"Winner: {(match.Winner == null ? "N/A" : match.Winner.NameList)}");
|
||||
AddHtml(25, 73, 250, 20,
|
||||
$"State: {(match.InProgress ? "In progress" : match.Context != null ? "Complete" : "Waiting")}",
|
||||
false, false);
|
||||
AddHtml(25, 93, 250, 20, "Participants:", false, false);
|
||||
$"State: {(match.InProgress ? "In progress" : match.Context != null ? "Complete" : "Waiting")}");
|
||||
AddHtml(25, 93, 250, 20, "Participants:");
|
||||
|
||||
if (m_Tournament.TourneyType == TourneyType.Standard)
|
||||
for (int i = 0; i < match.Participants.Count; ++i)
|
||||
|
|
@ -613,7 +607,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
else if (m_Tournament.TourneyType == TourneyType.FreeForAll)
|
||||
AddHtml(25, 113, 250, 20, "Free For All", false, false);
|
||||
AddHtml(25, 113, 250, 20, "Free For All");
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -642,17 +636,17 @@ namespace Server.Engines.ConPVP
|
|||
private void AddColoredText(int x, int y, int width, int height, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, height, text, false, false);
|
||||
AddHtml(x, y, width, height, text);
|
||||
else
|
||||
AddHtml(x, y, width, height, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, height, Color(text, color));
|
||||
}
|
||||
|
||||
public void AddRightArrow(int x, int y, int bid, string text)
|
||||
{
|
||||
AddButton(x, y, 0x15E1, 0x15E5, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0x15E1, 0x15E5, bid);
|
||||
|
||||
if (text != null)
|
||||
AddHtml(x + 20, y - 1, 230, 20, text, false, false);
|
||||
AddHtml(x + 20, y - 1, 230, 20, text);
|
||||
}
|
||||
|
||||
public void AddRightArrow(int x, int y, int bid)
|
||||
|
|
@ -662,10 +656,10 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void AddLeftArrow(int x, int y, int bid, string text)
|
||||
{
|
||||
AddButton(x, y, 0x15E3, 0x15E7, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0x15E3, 0x15E7, bid);
|
||||
|
||||
if (text != null)
|
||||
AddHtml(x + 20, y - 1, 230, 20, text, false, false);
|
||||
AddHtml(x + 20, y - 1, 230, 20, text);
|
||||
}
|
||||
|
||||
public void AddLeftArrow(int x, int y, int bid)
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace Server.Engines.ConPVP
|
|||
get
|
||||
{
|
||||
for (int i = 0; i < Players.Length; ++i)
|
||||
if (Players[i] != null && !Players[i].Eliminated)
|
||||
if (Players[i]?.Eliminated == false)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
@ -96,7 +96,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
for (int i = 0; i < Players.Length; ++i)
|
||||
if (Players[i] != null && Players[i].Mobile == mob)
|
||||
if (Players[i]?.Mobile == mob)
|
||||
return Players[i];
|
||||
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -198,8 +198,8 @@ namespace Server.Engines.ConPVP
|
|||
AddColumnHeader(35, null);
|
||||
AddColumnHeader(115, "Arena");
|
||||
|
||||
AddButton(499 + 40 - 365 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(499 + 40 - 365 - 12 - 63, height - 12 - 24, 241, 242, 2, GumpButtonType.Reply, 0);
|
||||
AddButton(499 + 40 - 365 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1);
|
||||
AddButton(499 + 40 - 365 - 12 - 63, height - 12 - 24, 241, 242, 2);
|
||||
|
||||
for (int i = 0; i < arenas.Count; ++i)
|
||||
{
|
||||
|
|
@ -258,9 +258,9 @@ namespace Server.Engines.ConPVP
|
|||
private void AddColoredText(int x, int y, int width, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, 20, text, false, false);
|
||||
AddHtml(x, y, width, 20, text);
|
||||
else
|
||||
AddHtml(x, y, width, 20, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, 20, Color(text, color));
|
||||
}
|
||||
|
||||
private void AddColumnHeader(int width, string name)
|
||||
|
|
|
|||
|
|
@ -21,10 +21,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override bool AllowHousing(Mobile from, Point3D p)
|
||||
{
|
||||
if (from.AccessLevel < AccessLevel.GameMaster)
|
||||
return false;
|
||||
|
||||
return base.AllowHousing(from, p);
|
||||
return from.AccessLevel >= AccessLevel.GameMaster && base.AllowHousing(from, p);
|
||||
}
|
||||
|
||||
public override bool OnMoveInto(Mobile m, Direction d, Point3D newLocation, Point3D oldLocation)
|
||||
|
|
@ -35,12 +32,11 @@ namespace Server.Engines.ConPVP
|
|||
return false;
|
||||
}
|
||||
|
||||
PlayerMobile pm = m as PlayerMobile;
|
||||
PlayerMobile pm = m as PlayerMobile ??
|
||||
(m is BaseCreature bc && bc.Summoned ?
|
||||
bc.SummonMaster as PlayerMobile : null);
|
||||
|
||||
if (pm == null && m is BaseCreature bc && bc.Summoned)
|
||||
pm = bc.SummonMaster as PlayerMobile;
|
||||
|
||||
if (pm?.DuelContext != null && pm.DuelContext.StartedBeginCountdown)
|
||||
if (pm?.DuelContext?.StartedBeginCountdown == true)
|
||||
return true;
|
||||
|
||||
if (DuelContext.CheckCombat(m))
|
||||
|
|
|
|||
|
|
@ -370,9 +370,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < part.Context.Participants.Count; ++i)
|
||||
{
|
||||
Participant check = part.Context.Participants[i];
|
||||
|
||||
if (check != null && !check.Eliminated)
|
||||
if (part.Context.Participants[i]?.Eliminated == false)
|
||||
++rem;
|
||||
}
|
||||
|
||||
|
|
@ -559,7 +557,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Mobile mob = players[i];
|
||||
|
||||
if (mob == null || mob.Deleted)
|
||||
if (mob?.Deleted != false)
|
||||
continue;
|
||||
|
||||
Item item = new Trophy(title, rank);
|
||||
|
|
@ -762,7 +760,7 @@ namespace Server.Engines.ConPVP
|
|||
if (!match.InProgress)
|
||||
for (int j = 0; j < Arenas.Count; ++j)
|
||||
{
|
||||
Arena arena = (Arena)Arenas[j];
|
||||
Arena arena = Arenas[j];
|
||||
|
||||
if (!arena.IsOccupied)
|
||||
{
|
||||
|
|
@ -895,7 +893,7 @@ namespace Server.Engines.ConPVP
|
|||
public void Alert(params string[] alerts)
|
||||
{
|
||||
for (int i = 0; i < Arenas.Count; ++i)
|
||||
Alert((Arena)Arenas[i], alerts);
|
||||
Alert(Arenas[i], alerts);
|
||||
}
|
||||
|
||||
public void Alert(Arena arena, params string[] alerts)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
TournamentController controller = m_Instances[i];
|
||||
|
||||
if (controller != null && !controller.Deleted && controller.Tournament != null &&
|
||||
if (controller?.Deleted == false && controller.Tournament != null &&
|
||||
controller.Tournament.Stage != TournamentStage.Inactive)
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,8 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Faction fac = Faction.Find(mob);
|
||||
|
||||
if (fac != null) index = fac.Definition.Sort;
|
||||
if (fac != null)
|
||||
index = fac.Definition.Sort;
|
||||
}
|
||||
else if (partsPerMatch == 2)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,16 +17,7 @@ namespace Server.Engines.Craft
|
|||
private CraftPage m_Page;
|
||||
private BaseTool m_Tool;
|
||||
|
||||
/*public CraftGump( Mobile from, CraftSystem craftSystem, BaseTool tool ): this( from, craftSystem, -1, -1, tool, null )
|
||||
{
|
||||
}*/
|
||||
|
||||
public CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice) : this(from, craftSystem, tool,
|
||||
notice, CraftPage.None)
|
||||
{
|
||||
}
|
||||
|
||||
private CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, CraftPage page) : base(40, 40)
|
||||
public CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, CraftPage page = CraftPage.None) : base(40, 40)
|
||||
{
|
||||
m_From = from;
|
||||
m_CraftSystem = craftSystem;
|
||||
|
|
@ -50,57 +41,56 @@ namespace Server.Engines.Craft
|
|||
AddAlphaRegion(10, 10, 510, 417);
|
||||
|
||||
if (craftSystem.GumpTitleNumber > 0)
|
||||
AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor);
|
||||
else
|
||||
AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString, false, false);
|
||||
AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString);
|
||||
|
||||
AddHtmlLocalized(10, 37, 200, 22, 1044010, LabelColor, false, false); // <CENTER>CATEGORIES</CENTER>
|
||||
AddHtmlLocalized(215, 37, 305, 22, 1044011, LabelColor, false, false); // <CENTER>SELECTIONS</CENTER>
|
||||
AddHtmlLocalized(10, 302, 150, 25, 1044012, LabelColor, false, false); // <CENTER>NOTICES</CENTER>
|
||||
AddHtmlLocalized(10, 37, 200, 22, 1044010, LabelColor); // <CENTER>CATEGORIES</CENTER>
|
||||
AddHtmlLocalized(215, 37, 305, 22, 1044011, LabelColor); // <CENTER>SELECTIONS</CENTER>
|
||||
AddHtmlLocalized(10, 302, 150, 25, 1044012, LabelColor); // <CENTER>NOTICES</CENTER>
|
||||
|
||||
AddButton(15, 402, 4017, 4019, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 405, 150, 18, 1011441, LabelColor, false, false); // EXIT
|
||||
AddButton(15, 402, 4017, 4019, 0);
|
||||
AddHtmlLocalized(50, 405, 150, 18, 1011441, LabelColor); // EXIT
|
||||
|
||||
AddButton(270, 402, 4005, 4007, GetButtonID(6, 2), GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(305, 405, 150, 18, 1044013, LabelColor, false, false); // MAKE LAST
|
||||
AddButton(270, 402, 4005, 4007, GetButtonID(6, 2));
|
||||
AddHtmlLocalized(305, 405, 150, 18, 1044013, LabelColor); // MAKE LAST
|
||||
|
||||
// Mark option
|
||||
if (craftSystem.MarkOption)
|
||||
{
|
||||
AddButton(270, 362, 4005, 4007, GetButtonID(6, 6), GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(305, 365, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor,
|
||||
false, false); // MARK ITEM
|
||||
AddButton(270, 362, 4005, 4007, GetButtonID(6, 6));
|
||||
AddHtmlLocalized(305, 365, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor); // MARK ITEM
|
||||
}
|
||||
// ****************************************
|
||||
|
||||
// Resmelt option
|
||||
if (craftSystem.Resmelt)
|
||||
{
|
||||
AddButton(15, 342, 4005, 4007, GetButtonID(6, 1), GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 345, 150, 18, 1044259, LabelColor, false, false); // SMELT ITEM
|
||||
AddButton(15, 342, 4005, 4007, GetButtonID(6, 1));
|
||||
AddHtmlLocalized(50, 345, 150, 18, 1044259, LabelColor); // SMELT ITEM
|
||||
}
|
||||
// ****************************************
|
||||
|
||||
// Repair option
|
||||
if (craftSystem.Repair)
|
||||
{
|
||||
AddButton(270, 342, 4005, 4007, GetButtonID(6, 5), GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(305, 345, 150, 18, 1044260, LabelColor, false, false); // REPAIR ITEM
|
||||
AddButton(270, 342, 4005, 4007, GetButtonID(6, 5));
|
||||
AddHtmlLocalized(305, 345, 150, 18, 1044260, LabelColor); // REPAIR ITEM
|
||||
}
|
||||
// ****************************************
|
||||
|
||||
// Enhance option
|
||||
if (craftSystem.CanEnhance)
|
||||
{
|
||||
AddButton(270, 382, 4005, 4007, GetButtonID(6, 8), GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(305, 385, 150, 18, 1061001, LabelColor, false, false); // ENHANCE ITEM
|
||||
AddButton(270, 382, 4005, 4007, GetButtonID(6, 8));
|
||||
AddHtmlLocalized(305, 385, 150, 18, 1061001, LabelColor); // ENHANCE ITEM
|
||||
}
|
||||
// ****************************************
|
||||
|
||||
if (notice is int noticeInt && noticeInt > 0)
|
||||
AddHtmlLocalized(170, 295, 350, 40, noticeInt, LabelColor, false, false);
|
||||
AddHtmlLocalized(170, 295, 350, 40, noticeInt, LabelColor);
|
||||
else if (notice is string)
|
||||
AddHtml(170, 295, 350, 40, $"<BASEFONT COLOR=#{FontColor:X6}>{notice}</BASEFONT>", false, false);
|
||||
AddHtml(170, 295, 350, 40, $"<BASEFONT COLOR=#{FontColor:X6}>{notice}</BASEFONT>");
|
||||
|
||||
// If the system has more than one resource
|
||||
if (craftSystem.CraftSubRes.Init)
|
||||
|
|
@ -131,10 +121,10 @@ namespace Server.Engines.Craft
|
|||
resourceCount += items[i].Amount;
|
||||
}
|
||||
|
||||
AddButton(15, 362, 4005, 4007, GetButtonID(6, 0), GumpButtonType.Reply, 0);
|
||||
AddButton(15, 362, 4005, 4007, GetButtonID(6, 0));
|
||||
|
||||
if (nameNumber > 0)
|
||||
AddHtmlLocalized(50, 365, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false);
|
||||
AddHtmlLocalized(50, 365, 250, 18, nameNumber, resourceCount.ToString(), LabelColor);
|
||||
else
|
||||
AddLabel(50, 362, LabelHue, $"{nameString} ({resourceCount} Available)");
|
||||
}
|
||||
|
|
@ -169,10 +159,10 @@ namespace Server.Engines.Craft
|
|||
resourceCount += items[i].Amount;
|
||||
}
|
||||
|
||||
AddButton(15, 382, 4005, 4007, GetButtonID(6, 7), GumpButtonType.Reply, 0);
|
||||
AddButton(15, 382, 4005, 4007, GetButtonID(6, 7));
|
||||
|
||||
if (nameNumber > 0)
|
||||
AddHtmlLocalized(50, 385, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false);
|
||||
AddHtmlLocalized(50, 385, 250, 18, nameNumber, resourceCount.ToString(), LabelColor);
|
||||
else
|
||||
AddLabel(50, 385, LabelHue, $"{nameString} ({resourceCount} Available)");
|
||||
}
|
||||
|
|
@ -184,7 +174,7 @@ namespace Server.Engines.Craft
|
|||
CreateResList(false, from);
|
||||
else if (page == CraftPage.PickResource2)
|
||||
CreateResList(true, from);
|
||||
else if (context != null && context.LastGroupIndex > -1)
|
||||
else if (context?.LastGroupIndex > -1)
|
||||
CreateItemList(context.LastGroupIndex);
|
||||
}
|
||||
|
||||
|
|
@ -210,9 +200,9 @@ namespace Server.Engines.Craft
|
|||
|
||||
CraftContext context = m_CraftSystem.GetContext(m_From);
|
||||
|
||||
AddButton(220, 260, 4005, 4007, GetButtonID(6, 4), GumpButtonType.Reply, 0);
|
||||
AddButton(220, 260, 4005, 4007, GetButtonID(6, 4));
|
||||
AddHtmlLocalized(255, 263, 200, 18, context == null || !context.DoNotColor ? 1061591 : 1061590,
|
||||
LabelColor, false, false);
|
||||
LabelColor);
|
||||
}
|
||||
|
||||
int resourceCount = 0;
|
||||
|
|
@ -225,11 +215,11 @@ namespace Server.Engines.Craft
|
|||
resourceCount += items[j].Amount;
|
||||
}
|
||||
|
||||
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(5, i), GumpButtonType.Reply, 0);
|
||||
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(5, i));
|
||||
|
||||
if (subResource.NameNumber > 0)
|
||||
AddHtmlLocalized(255, 63 + index * 20, 250, 18, subResource.NameNumber, resourceCount.ToString(),
|
||||
LabelColor, false, false);
|
||||
LabelColor);
|
||||
else
|
||||
AddLabel(255, 60 + index * 20, LabelHue, $"{subResource.NameString} ({resourceCount})");
|
||||
}
|
||||
|
|
@ -256,7 +246,7 @@ namespace Server.Engines.Craft
|
|||
if (i > 0)
|
||||
{
|
||||
AddButton(370, 260, 4005, 4007, 0, GumpButtonType.Page, i / 10 + 1);
|
||||
AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor, false, false); // NEXT PAGE
|
||||
AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor); // NEXT PAGE
|
||||
}
|
||||
|
||||
AddPage(i / 10 + 1);
|
||||
|
|
@ -264,21 +254,21 @@ namespace Server.Engines.Craft
|
|||
if (i > 0)
|
||||
{
|
||||
AddButton(220, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10);
|
||||
AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor, false, false); // PREV PAGE
|
||||
AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor); // PREV PAGE
|
||||
}
|
||||
}
|
||||
|
||||
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(3, i), GumpButtonType.Reply, 0);
|
||||
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(3, i));
|
||||
|
||||
if (craftItem.NameNumber > 0)
|
||||
AddHtmlLocalized(255, 63 + index * 20, 220, 18, craftItem.NameNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(255, 63 + index * 20, 220, 18, craftItem.NameNumber, LabelColor);
|
||||
else
|
||||
AddLabel(255, 60 + index * 20, LabelHue, craftItem.NameString);
|
||||
|
||||
AddButton(480, 60 + index * 20, 4011, 4012, GetButtonID(4, i), GumpButtonType.Reply, 0);
|
||||
AddButton(480, 60 + index * 20, 4011, 4012, GetButtonID(4, i));
|
||||
}
|
||||
else
|
||||
AddHtmlLocalized(230, 62, 200, 22, 1044165, LabelColor, false, false); // You haven't made anything yet.
|
||||
AddHtmlLocalized(230, 62, 200, 22, 1044165, LabelColor); // You haven't made anything yet.
|
||||
}
|
||||
|
||||
public void CreateItemList(int selectedGroup)
|
||||
|
|
@ -304,7 +294,7 @@ namespace Server.Engines.Craft
|
|||
if (i > 0)
|
||||
{
|
||||
AddButton(370, 260, 4005, 4007, 0, GumpButtonType.Page, i / 10 + 1);
|
||||
AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor, false, false); // NEXT PAGE
|
||||
AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor); // NEXT PAGE
|
||||
}
|
||||
|
||||
AddPage(i / 10 + 1);
|
||||
|
|
@ -312,18 +302,18 @@ namespace Server.Engines.Craft
|
|||
if (i > 0)
|
||||
{
|
||||
AddButton(220, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10);
|
||||
AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor, false, false); // PREV PAGE
|
||||
AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor); // PREV PAGE
|
||||
}
|
||||
}
|
||||
|
||||
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(1, i), GumpButtonType.Reply, 0);
|
||||
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(1, i));
|
||||
|
||||
if (craftItem.NameNumber > 0)
|
||||
AddHtmlLocalized(255, 63 + index * 20, 220, 18, craftItem.NameNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(255, 63 + index * 20, 220, 18, craftItem.NameNumber, LabelColor);
|
||||
else
|
||||
AddLabel(255, 60 + index * 20, LabelHue, craftItem.NameString);
|
||||
|
||||
AddButton(480, 60 + index * 20, 4011, 4012, GetButtonID(2, i), GumpButtonType.Reply, 0);
|
||||
AddButton(480, 60 + index * 20, 4011, 4012, GetButtonID(2, i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -331,17 +321,17 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
CraftGroupCol craftGroupCol = m_CraftSystem.CraftGroups;
|
||||
|
||||
AddButton(15, 60, 4005, 4007, GetButtonID(6, 3), GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 63, 150, 18, 1044014, LabelColor, false, false); // LAST TEN
|
||||
AddButton(15, 60, 4005, 4007, GetButtonID(6, 3));
|
||||
AddHtmlLocalized(50, 63, 150, 18, 1044014, LabelColor); // LAST TEN
|
||||
|
||||
for (int i = 0; i < craftGroupCol.Count; i++)
|
||||
{
|
||||
CraftGroup craftGroup = craftGroupCol.GetAt(i);
|
||||
|
||||
AddButton(15, 80 + i * 20, 4005, 4007, GetButtonID(0, i), GumpButtonType.Reply, 0);
|
||||
AddButton(15, 80 + i * 20, 4005, 4007, GetButtonID(0, i));
|
||||
|
||||
if (craftGroup.NameNumber > 0)
|
||||
AddHtmlLocalized(50, 83 + i * 20, 150, 18, craftGroup.NameNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(50, 83 + i * 20, 150, 18, craftGroup.NameNumber, LabelColor);
|
||||
else
|
||||
AddLabel(50, 80 + i * 20, LabelHue, craftGroup.NameString);
|
||||
}
|
||||
|
|
@ -608,7 +598,7 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
}
|
||||
|
||||
private enum CraftPage
|
||||
public enum CraftPage
|
||||
{
|
||||
None,
|
||||
PickResource,
|
||||
|
|
|
|||
|
|
@ -53,41 +53,40 @@ namespace Server.Engines.Craft
|
|||
AddImageTiled(10, 387, 510, 22, 2624);
|
||||
AddAlphaRegion(10, 10, 510, 399);
|
||||
|
||||
AddHtmlLocalized(170, 40, 150, 20, 1044053, LabelColor, false, false); // ITEM
|
||||
AddHtmlLocalized(10, 192, 150, 22, 1044054, LabelColor, false, false); // <CENTER>SKILLS</CENTER>
|
||||
AddHtmlLocalized(10, 277, 150, 22, 1044055, LabelColor, false, false); // <CENTER>MATERIALS</CENTER>
|
||||
AddHtmlLocalized(10, 362, 150, 22, 1044056, LabelColor, false, false); // <CENTER>OTHER</CENTER>
|
||||
AddHtmlLocalized(170, 40, 150, 20, 1044053, LabelColor); // ITEM
|
||||
AddHtmlLocalized(10, 192, 150, 22, 1044054, LabelColor); // <CENTER>SKILLS</CENTER>
|
||||
AddHtmlLocalized(10, 277, 150, 22, 1044055, LabelColor); // <CENTER>MATERIALS</CENTER>
|
||||
AddHtmlLocalized(10, 362, 150, 22, 1044056, LabelColor); // <CENTER>OTHER</CENTER>
|
||||
|
||||
if (craftSystem.GumpTitleNumber > 0)
|
||||
AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor);
|
||||
else
|
||||
AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString, false, false);
|
||||
AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString);
|
||||
|
||||
AddButton(15, 387, 4014, 4016, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 390, 150, 18, 1044150, LabelColor, false, false); // BACK
|
||||
AddButton(15, 387, 4014, 4016, 0);
|
||||
AddHtmlLocalized(50, 390, 150, 18, 1044150, LabelColor); // BACK
|
||||
|
||||
bool needsRecipe = craftItem.Recipe != null && from is PlayerMobile mobile &&
|
||||
!mobile.HasRecipe(craftItem.Recipe);
|
||||
|
||||
if (needsRecipe)
|
||||
{
|
||||
AddButton(270, 387, 4005, 4007, 0, GumpButtonType.Page, 0);
|
||||
AddHtmlLocalized(305, 390, 150, 18, 1044151, GreyLabelColor, false, false); // MAKE NOW
|
||||
AddButton(270, 387, 4005, 4007, 0, GumpButtonType.Page);
|
||||
AddHtmlLocalized(305, 390, 150, 18, 1044151, GreyLabelColor); // MAKE NOW
|
||||
}
|
||||
else
|
||||
{
|
||||
AddButton(270, 387, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(305, 390, 150, 18, 1044151, LabelColor, false, false); // MAKE NOW
|
||||
AddButton(270, 387, 4005, 4007, 1);
|
||||
AddHtmlLocalized(305, 390, 150, 18, 1044151, LabelColor); // MAKE NOW
|
||||
}
|
||||
|
||||
if (craftItem.NameNumber > 0)
|
||||
AddHtmlLocalized(330, 40, 180, 18, craftItem.NameNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(330, 40, 180, 18, craftItem.NameNumber, LabelColor);
|
||||
else
|
||||
AddLabel(330, 40, LabelHue, craftItem.NameString);
|
||||
|
||||
if (craftItem.UseAllRes)
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1048176, LabelColor, false,
|
||||
false); // Makes as many as possible at once
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1048176, LabelColor); // Makes as many as possible at once
|
||||
|
||||
DrawItem();
|
||||
DrawSkill();
|
||||
|
|
@ -100,15 +99,14 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (craftItem.RequiredExpansion != Expansion.None)
|
||||
{
|
||||
bool supportsEx = from.NetState != null && from.NetState.SupportsExpansion(craftItem.RequiredExpansion);
|
||||
bool supportsEx = from.NetState?.SupportsExpansion(craftItem.RequiredExpansion) == true;
|
||||
TextDefinition.AddHtmlText(this, 170, 302 + m_OtherCount++ * 20, 310, 18,
|
||||
RequiredExpansionMessage(craftItem.RequiredExpansion), false, false,
|
||||
supportsEx ? LabelColor : RedLabelColor, supportsEx ? LabelHue : RedLabelHue);
|
||||
}
|
||||
|
||||
if (needsRecipe)
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1073620, RedLabelColor, false,
|
||||
false); // You have not learned this recipe.
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1073620, RedLabelColor); // You have not learned this recipe.
|
||||
}
|
||||
|
||||
private TextDefinition RequiredExpansionMessage(Expansion expansion)
|
||||
|
|
@ -132,8 +130,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (m_CraftItem.IsMarkable(type))
|
||||
{
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1044059, LabelColor, false,
|
||||
false); // This item may hold its maker's mark
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1044059, LabelColor); // This item may hold its maker's mark
|
||||
m_ShowExceptionalChance = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -148,8 +145,7 @@ namespace Server.Engines.Craft
|
|||
if (minSkill < 0)
|
||||
minSkill = 0;
|
||||
|
||||
AddHtmlLocalized(170, 132 + i * 20, 200, 18, AosSkillBonuses.GetLabel(skill.SkillToMake), LabelColor, false,
|
||||
false);
|
||||
AddHtmlLocalized(170, 132 + i * 20, 200, 18, AosSkillBonuses.GetLabel(skill.SkillToMake), LabelColor);
|
||||
AddLabel(430, 132 + i * 20, LabelHue, $"{minSkill:F1}");
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +167,7 @@ namespace Server.Engines.Craft
|
|||
else if (chance > 1.0)
|
||||
chance = 1.0;
|
||||
|
||||
AddHtmlLocalized(170, 80, 250, 18, 1044057, LabelColor, false, false); // Success Chance:
|
||||
AddHtmlLocalized(170, 80, 250, 18, 1044057, LabelColor); // Success Chance:
|
||||
AddLabel(430, 80, LabelHue, $"{chance * 100:F1}%");
|
||||
|
||||
if (m_ShowExceptionalChance)
|
||||
|
|
@ -181,7 +177,7 @@ namespace Server.Engines.Craft
|
|||
else if (excepChance > 1.0)
|
||||
excepChance = 1.0;
|
||||
|
||||
AddHtmlLocalized(170, 100, 250, 18, 1044058, 32767, false, false); // Exceptional Chance:
|
||||
AddHtmlLocalized(170, 100, 250, 18, 1044058, 32767); // Exceptional Chance:
|
||||
AddLabel(430, 100, LabelHue, $"{excepChance * 100:F1}%");
|
||||
}
|
||||
}
|
||||
|
|
@ -232,13 +228,12 @@ namespace Server.Engines.Craft
|
|||
if (!retainedColor && m_CraftItem.RetainsColorFrom(m_CraftSystem, type))
|
||||
{
|
||||
retainedColor = true;
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1044152, LabelColor, false,
|
||||
false); // * The item retains the color of this material
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1044152, LabelColor); // * The item retains the color of this material
|
||||
AddLabel(500, 219 + i * 20, LabelHue, "*");
|
||||
}
|
||||
|
||||
if (nameNumber > 0)
|
||||
AddHtmlLocalized(170, 219 + i * 20, 310, 18, nameNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(170, 219 + i * 20, 310, 18, nameNumber, LabelColor);
|
||||
else
|
||||
AddLabel(170, 219 + i * 20, LabelHue, nameString);
|
||||
|
||||
|
|
@ -247,13 +242,12 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (m_CraftItem.NameNumber == 1041267) // runebook
|
||||
{
|
||||
AddHtmlLocalized(170, 219 + m_CraftItem.Resources.Count * 20, 310, 18, 1044447, LabelColor, false, false);
|
||||
AddHtmlLocalized(170, 219 + m_CraftItem.Resources.Count * 20, 310, 18, 1044447, LabelColor);
|
||||
AddLabel(430, 219 + m_CraftItem.Resources.Count * 20, LabelHue, "1");
|
||||
}
|
||||
|
||||
if (cropScroll)
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 360, 18, 1044379, LabelColor, false,
|
||||
false); // Inscribing scrolls also requires a blank scroll and mana.
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 360, 18, 1044379, LabelColor); // Inscribing scrolls also requires a blank scroll and mana.
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Commands;
|
||||
using Server.Factions;
|
||||
using Server.Items;
|
||||
|
|
@ -273,16 +274,12 @@ namespace Server.Engines.Craft
|
|||
return false;
|
||||
|
||||
IPooledEnumerable<Item> eable = map.GetItemsInRange(from.Location, 2);
|
||||
|
||||
foreach (Item item in eable)
|
||||
if (item.Z + 16 > from.Z && from.Z + 16 > item.Z && Find(item.ItemID, itemIDs))
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool found = eable.Any(item => item.Z + 16 > item.Z && item.Z + 16 > item.Z && Find(item.ItemID, itemIDs));
|
||||
eable.Free();
|
||||
|
||||
if (found)
|
||||
return true;
|
||||
|
||||
for (int x = -2; x <= 2; ++x)
|
||||
for (int y = -2; y <= 2; ++y)
|
||||
{
|
||||
|
|
@ -758,7 +755,7 @@ namespace Server.Engines.Craft
|
|||
if (from.BeginAction<CraftSystem>())
|
||||
{
|
||||
if (RequiredExpansion == Expansion.None ||
|
||||
from.NetState != null && from.NetState.SupportsExpansion(RequiredExpansion))
|
||||
from.NetState?.SupportsExpansion(RequiredExpansion) == true)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = GetSuccessChance(from, typeRes, craftSystem, false, ref allRequiredSkills);
|
||||
|
|
@ -860,7 +857,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (badCraft > 0)
|
||||
{
|
||||
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
|
||||
else
|
||||
from.SendLocalizedMessage(badCraft);
|
||||
|
|
@ -876,7 +873,7 @@ namespace Server.Engines.Craft
|
|||
ref checkMessage)
|
||||
&& ConsumeAttributes(from, ref checkMessage, false)))
|
||||
{
|
||||
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
|
||||
else if (checkMessage is int messageInt && messageInt > 0)
|
||||
from.SendLocalizedMessage(messageInt);
|
||||
|
|
@ -905,7 +902,7 @@ namespace Server.Engines.Craft
|
|||
if (!(ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message)
|
||||
&& ConsumeAttributes(from, ref message, true)))
|
||||
{
|
||||
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, craftSystem, tool, message));
|
||||
else if (message is int messageIn && messageIn > 0)
|
||||
from.SendLocalizedMessage(messageIn);
|
||||
|
|
@ -992,7 +989,7 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
Town town = Town.FromRegion(from.Region);
|
||||
|
||||
if (town != null && town.Owner == faction)
|
||||
if (town?.Owner == faction)
|
||||
{
|
||||
Container pack = from.Backpack;
|
||||
|
||||
|
|
@ -1013,14 +1010,14 @@ namespace Server.Engines.Craft
|
|||
if (queryFactionImbue)
|
||||
from.SendGump(new FactionImbueGump(quality, item, from, craftSystem, tool, num, availableSilver, faction,
|
||||
def));
|
||||
else if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
else if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, craftSystem, tool, num));
|
||||
else if (num > 0)
|
||||
from.SendLocalizedMessage(num);
|
||||
}
|
||||
else if (!allRequiredSkills)
|
||||
{
|
||||
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, craftSystem, tool, 1044153));
|
||||
else
|
||||
from.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item.
|
||||
|
|
@ -1036,7 +1033,7 @@ namespace Server.Engines.Craft
|
|||
// Not enough resource to craft it
|
||||
if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, true))
|
||||
{
|
||||
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, craftSystem, tool, message));
|
||||
else if (message is int messageInt && messageInt > 0)
|
||||
from.SendLocalizedMessage(messageInt);
|
||||
|
|
@ -1104,7 +1101,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (badCraft > 0)
|
||||
{
|
||||
if (m_Tool != null && !m_Tool.Deleted && m_Tool.UsesRemaining > 0)
|
||||
if (m_Tool?.Deleted == false && m_Tool.UsesRemaining > 0)
|
||||
m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, badCraft));
|
||||
else
|
||||
m_From.SendLocalizedMessage(badCraft);
|
||||
|
|
|
|||
|
|
@ -4,14 +4,11 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
public class CraftRes
|
||||
{
|
||||
public CraftRes(Type type, int amount)
|
||||
public CraftRes(Type type, TextDefinition name, int amount, TextDefinition message = null)
|
||||
{
|
||||
ItemType = type;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
public CraftRes(Type type, TextDefinition name, int amount, TextDefinition message) : this(type, amount)
|
||||
{
|
||||
NameNumber = name;
|
||||
MessageNumber = message;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,13 +31,13 @@ namespace Server.Engines.Craft
|
|||
AddBackground(0, 0, 220, 170, 5054);
|
||||
AddBackground(10, 10, 200, 150, 3000);
|
||||
|
||||
AddHtmlLocalized(20, 20, 180, 80, 1018317, false, false); // Do you wish to place your maker's mark on this item?
|
||||
AddHtmlLocalized(20, 20, 180, 80, 1018317); // Do you wish to place your maker's mark on this item?
|
||||
|
||||
AddHtmlLocalized(55, 100, 140, 25, 1011011, false, false); // CONTINUE
|
||||
AddButton(20, 100, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 100, 140, 25, 1011011); // CONTINUE
|
||||
AddButton(20, 100, 4005, 4007, 1);
|
||||
|
||||
AddHtmlLocalized(55, 125, 140, 25, 1011012, false, false); // CANCEL
|
||||
AddButton(20, 125, 4005, 4007, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 125, 140, 25, 1011012); // CANCEL
|
||||
AddButton(20, 125, 4005, 4007, 0);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
|
|||
|
|
@ -34,16 +34,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public int ID{ get; }
|
||||
|
||||
public TextDefinition TextDefinition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_TD == null)
|
||||
m_TD = new TextDefinition(CraftItem.NameNumber, CraftItem.NameString);
|
||||
|
||||
return m_TD;
|
||||
}
|
||||
}
|
||||
public TextDefinition TextDefinition => m_TD ?? (m_TD = new TextDefinition(CraftItem.NameNumber, CraftItem.NameString));
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
return SmeltResult.Invalid;
|
||||
|
|
|
|||
|
|
@ -17,16 +17,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044001;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefAlchemy();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefAlchemy());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
|
|
@ -35,8 +26,9 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
||||
|
|
|
|||
|
|
@ -30,16 +30,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044002;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefBlacksmithy();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefBlacksmithy());
|
||||
|
||||
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
|
||||
|
||||
|
|
@ -111,7 +102,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckTool(tool, from))
|
||||
return 1048146; // If you have a tool equipped, you must use that tool.
|
||||
|
|
|
|||
|
|
@ -15,16 +15,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044006;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefBowFletching();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefBowFletching());
|
||||
|
||||
public override CraftECA ECA => CraftECA.FiftyPercentChanceMinusTenPercent;
|
||||
|
||||
|
|
@ -35,7 +26,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
|
|||
|
|
@ -15,16 +15,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044004;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefCarpentry();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefCarpentry());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
|
|
@ -33,7 +24,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
|
|||
|
|
@ -15,16 +15,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044008;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefCartography();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefCartography());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
|
|
@ -33,7 +24,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
|
|||
|
|
@ -15,16 +15,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044003;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefCooking();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefCooking());
|
||||
|
||||
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
|
||||
|
||||
|
|
@ -35,7 +26,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
|
|||
|
|
@ -16,28 +16,16 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044622;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefGlassblowing();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefGlassblowing());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
if (item.ItemType == typeof(HollowPrism))
|
||||
return 0.5; // 50%
|
||||
|
||||
return 0.0; // 0%
|
||||
return item.ItemType == typeof(HollowPrism) ? 0.5 : 0.0;
|
||||
}
|
||||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckTool(tool, from))
|
||||
return 1048146; // If you have a tool equipped, you must use that tool.
|
||||
|
|
@ -48,10 +36,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
DefBlacksmithy.CheckAnvilAndForge(from, 2, out _, out bool forge);
|
||||
|
||||
if (forge)
|
||||
return 0;
|
||||
|
||||
return 1044628; // You must be near a forge to blow glass.
|
||||
return forge ? 0 : 1044628; // You must be near a forge to blow glass.
|
||||
}
|
||||
|
||||
public override void PlayCraftEffect(Mobile from)
|
||||
|
|
|
|||
|
|
@ -36,16 +36,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044009;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefInscription();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefInscription());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
|
|
@ -54,7 +45,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type typeItem)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
@ -65,9 +56,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (o is SpellScroll scroll)
|
||||
{
|
||||
Spellbook book = Spellbook.Find(from, scroll.SpellID);
|
||||
|
||||
bool hasSpell = book != null && book.HasSpell(scroll.SpellID);
|
||||
bool hasSpell = Spellbook.Find(from, scroll.SpellID)?.HasSpell(scroll.SpellID) == true;
|
||||
|
||||
scroll.Delete();
|
||||
|
||||
|
|
@ -121,7 +110,6 @@ namespace Server.Engines.Craft
|
|||
switch (m_Circle)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
minSkill = -25.0;
|
||||
maxSkill = 25.0;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -16,16 +16,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044500;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefMasonry();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefMasonry());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
|
|
@ -39,7 +30,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckTool(tool, from))
|
||||
return 1048146; // If you have a tool equipped, you must use that tool.
|
||||
|
|
|
|||
|
|
@ -23,16 +23,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044005;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefTailoring();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefTailoring());
|
||||
|
||||
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
|
||||
|
||||
|
|
@ -43,7 +34,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
|
|||
|
|
@ -31,16 +31,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044007;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefTinkering();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefTinkering());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
|
|
@ -52,7 +43,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
@ -507,7 +498,7 @@ namespace Server.Engines.Craft
|
|||
Mobile from = m_TrapCraft.From;
|
||||
BaseTool tool = m_TrapCraft.Tool;
|
||||
|
||||
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, m_TrapCraft.CraftSystem, tool, message));
|
||||
else if (message > 0)
|
||||
from.SendLocalizedMessage(message);
|
||||
|
|
|
|||
|
|
@ -27,12 +27,7 @@ namespace Server.Engines.Doom
|
|||
private Timer m_Timer;
|
||||
|
||||
[Constructible]
|
||||
public GauntletSpawner() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public GauntletSpawner(string typeName) : base(0x36FE)
|
||||
public GauntletSpawner(string typeName = null) : base(0x36FE)
|
||||
{
|
||||
Visible = false;
|
||||
Movable = false;
|
||||
|
|
@ -334,7 +329,7 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
State = GauntletSpawnerState.InSequence;
|
||||
|
||||
if (Sequence != null && !Sequence.Deleted)
|
||||
if (Sequence?.Deleted == false)
|
||||
Sequence.RecurseReset();
|
||||
}
|
||||
}
|
||||
|
|
@ -353,7 +348,7 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
State = GauntletSpawnerState.Completed;
|
||||
|
||||
if (Sequence != null && !Sequence.Deleted)
|
||||
if (Sequence?.Deleted == false)
|
||||
{
|
||||
if (Sequence.State == GauntletSpawnerState.Completed)
|
||||
RecurseReset();
|
||||
|
|
@ -428,7 +423,7 @@ namespace Server.Engines.Doom
|
|||
public static void CreateTeleporter(int xFrom, int yFrom, int xTo, int yTo)
|
||||
{
|
||||
Static telePad = new Static(0x1822);
|
||||
Teleporter teleItem = new Teleporter(new Point3D(xTo, yTo, -1), Map.Malas, false);
|
||||
Teleporter teleItem = new Teleporter(new Point3D(xTo, yTo, -1), Map.Malas);
|
||||
|
||||
telePad.Hue = 0x482;
|
||||
telePad.MoveToWorld(new Point3D(xFrom, yFrom, -1), Map.Malas);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Commands;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
|
@ -181,12 +182,11 @@ namespace Server.Engines.Doom
|
|||
[Description("Generates lamp room and lever puzzle in doom.")]
|
||||
public static void GenLampPuzzle_OnCommand(CommandEventArgs e)
|
||||
{
|
||||
foreach (Item item in Map.Malas.GetItemsInRange(lp_Center, 0))
|
||||
if (item is LeverPuzzleController)
|
||||
{
|
||||
e.Mobile.SendMessage("Lamp room puzzle already exists: please delete the existing controller first ...");
|
||||
return;
|
||||
}
|
||||
if (Map.Malas.GetItemsInRange(lp_Center, 0).OfType<LeverPuzzleController>().Any())
|
||||
{
|
||||
e.Mobile.SendMessage("Lamp room puzzle already exists: please delete the existing controller first ...");
|
||||
return;
|
||||
}
|
||||
|
||||
e.Mobile.SendMessage("Generating Lamp Room puzzle...");
|
||||
new LeverPuzzleController().MoveToWorld(lp_Center, Map.Malas);
|
||||
|
|
@ -199,10 +199,11 @@ namespace Server.Engines.Doom
|
|||
|
||||
public static Item AddLeverPuzzlePart(int[] Loc, Item newitem)
|
||||
{
|
||||
if (newitem == null || newitem.Deleted)
|
||||
if (newitem?.Deleted != false)
|
||||
installed = false;
|
||||
else
|
||||
newitem.MoveToWorld(new Point3D(Loc[0], Loc[1], Loc[2]), Map.Malas);
|
||||
|
||||
return newitem;
|
||||
}
|
||||
|
||||
|
|
@ -220,16 +221,17 @@ namespace Server.Engines.Doom
|
|||
|
||||
m_LampRoom?.Unregister();
|
||||
if (m_Tiles != null)
|
||||
foreach (Region region in m_Tiles)
|
||||
foreach (LeverPuzzleRegion region in m_Tiles)
|
||||
region.Unregister();
|
||||
if (m_Box != null && !m_Box.Deleted) m_Box.Delete();
|
||||
if (m_Box?.Deleted == false)
|
||||
m_Box.Delete();
|
||||
}
|
||||
|
||||
public static void NukeItemList(List<Item> list)
|
||||
{
|
||||
if (list != null && list.Count != 0)
|
||||
if (list?.Count > 0)
|
||||
foreach (Item item in list)
|
||||
if (item != null && !item.Deleted)
|
||||
if (item?.Deleted == false)
|
||||
item.Delete();
|
||||
}
|
||||
|
||||
|
|
@ -244,31 +246,29 @@ namespace Server.Engines.Doom
|
|||
public virtual LeverPuzzleStatue GetStatue(int index)
|
||||
{
|
||||
LeverPuzzleStatue statue = (LeverPuzzleStatue)m_Statues[index];
|
||||
|
||||
if (statue != null && !statue.Deleted) return statue;
|
||||
return null;
|
||||
return statue?.Deleted == false ? statue : null;
|
||||
}
|
||||
|
||||
public virtual LeverPuzzleLever GetLever(int index)
|
||||
{
|
||||
LeverPuzzleLever lever = (LeverPuzzleLever)m_Levers[index];
|
||||
|
||||
if (lever != null && !lever.Deleted) return lever;
|
||||
return null;
|
||||
return lever?.Deleted == false ? lever : null;
|
||||
}
|
||||
|
||||
public virtual void PuzzleStatus(int message, string fstring)
|
||||
public virtual void PuzzleStatus(int message, string fstring = null)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Item s;
|
||||
if ((s = GetStatue(i)) != null) s.PublicOverheadMessage(MessageType.Regular, 0x3B2, message, fstring);
|
||||
if ((s = GetStatue(i)) != null)
|
||||
s.PublicOverheadMessage(MessageType.Regular, 0x3B2, message, fstring);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ResetPuzzle()
|
||||
{
|
||||
PuzzleStatus(1062053, null);
|
||||
PuzzleStatus(1062053);
|
||||
ResetLevers();
|
||||
}
|
||||
|
||||
|
|
@ -289,8 +289,8 @@ namespace Server.Engines.Doom
|
|||
|
||||
public virtual void KillTimers()
|
||||
{
|
||||
if (l_Timer != null && l_Timer.Running) l_Timer.Stop();
|
||||
if (m_Timer != null && m_Timer.Running) m_Timer.Stop();
|
||||
if (l_Timer?.Running == true) l_Timer.Stop();
|
||||
if (m_Timer?.Running == true) m_Timer.Stop();
|
||||
}
|
||||
|
||||
public virtual void RemoveSuccessful()
|
||||
|
|
@ -300,8 +300,7 @@ namespace Server.Engines.Doom
|
|||
|
||||
public virtual void LeverPulled(ushort code)
|
||||
{
|
||||
int Correct = 0;
|
||||
Mobile m_Player;
|
||||
int correct = 0;
|
||||
|
||||
KillTimers();
|
||||
|
||||
|
|
@ -315,20 +314,21 @@ namespace Server.Engines.Doom
|
|||
|
||||
if (!CircleComplete)
|
||||
{
|
||||
PuzzleStatus(1050004, null); // The circle is the key...
|
||||
PuzzleStatus(1050004); // The circle is the key...
|
||||
}
|
||||
else
|
||||
{
|
||||
Mobile player;
|
||||
if (TheirKey == MyKey)
|
||||
{
|
||||
GenKey();
|
||||
if ((Successful = m_Player = GetOccupant(0)) != null)
|
||||
if ((Successful = player = GetOccupant(0)) != null)
|
||||
{
|
||||
SendLocationEffect(lp_Center, 0x1153, 0, 60, 1);
|
||||
PlaySounds(lp_Center, cs1);
|
||||
|
||||
Effects.SendBoltEffect(m_Player, true);
|
||||
m_Player.MoveToWorld(lr_Enter, Map.Malas);
|
||||
Effects.SendBoltEffect(player, true);
|
||||
player.MoveToWorld(lr_Enter, Map.Malas);
|
||||
|
||||
m_Timer = new LampRoomTimer(this);
|
||||
m_Timer.Start();
|
||||
|
|
@ -339,16 +339,13 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
for (int i = 0; i < 16; i++) /* Count matching SET bits, ie correct codes */
|
||||
if (((MyKey >> i) & 1) == 1 && ((TheirKey >> i) & 1) == 1)
|
||||
Correct++;
|
||||
correct++;
|
||||
|
||||
PuzzleStatus(Statue_Msg[Correct], Correct > 0 ? Correct.ToString() : null);
|
||||
PuzzleStatus(Statue_Msg[correct], correct > 0 ? correct.ToString() : null);
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
if ((m_Player = GetOccupant(i)) != null)
|
||||
{
|
||||
Timer smash = new RockTimer(m_Player, this);
|
||||
smash.Start();
|
||||
}
|
||||
if ((player = GetOccupant(i)) != null)
|
||||
new RockTimer(player, this).Start();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -357,33 +354,25 @@ namespace Server.Engines.Doom
|
|||
|
||||
public virtual void GenKey() /* Shuffle & build key */
|
||||
{
|
||||
ushort tmp;
|
||||
int n, i;
|
||||
ushort[] CA = { 1, 2, 4, 8 };
|
||||
for (i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
n = (n = Utility.Random(0, 3)) == i ? n & ~i : n; /* if (i==n) { return pointless; } */
|
||||
tmp = CA[i];
|
||||
int n = (n = Utility.Random(0, 3)) == i ? n & ~i : n;
|
||||
ushort tmp = CA[i];
|
||||
CA[i] = CA[n];
|
||||
CA[n] = tmp;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; MyKey = (ushort)(CA[i++] | (MyKey <<= 4)))
|
||||
for (int i = 0; i < 4; MyKey = (ushort)(CA[i++] | (MyKey <<= 4)))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsValidDamagable(Mobile m)
|
||||
{
|
||||
if (m != null && !m.Deleted)
|
||||
{
|
||||
if (m.Player && m.Alive)
|
||||
return true;
|
||||
|
||||
return m is BaseCreature bc && (bc.Controlled || bc.Summoned) && !bc.IsDeadBondedPet;
|
||||
}
|
||||
|
||||
return false;
|
||||
return m?.Deleted == false &&
|
||||
(m.Player && m.Alive ||
|
||||
m is BaseCreature bc && (bc.Controlled || bc.Summoned) && !bc.IsDeadBondedPet);
|
||||
}
|
||||
|
||||
public static void MoveMobileOut(Mobile m)
|
||||
|
|
@ -391,7 +380,7 @@ namespace Server.Engines.Doom
|
|||
if (m != null)
|
||||
{
|
||||
if (m is PlayerMobile && !m.Alive)
|
||||
if (m.Corpse != null && !m.Corpse.Deleted)
|
||||
if (m.Corpse?.Deleted == false)
|
||||
m.Corpse.MoveToWorld(lr_Exit, Map.Malas);
|
||||
BaseCreature.TeleportPets(m, lr_Exit, Map.Malas);
|
||||
m.Location = lr_Exit;
|
||||
|
|
@ -401,7 +390,7 @@ namespace Server.Engines.Doom
|
|||
|
||||
public static bool AniSafe(Mobile m)
|
||||
{
|
||||
return m != null && !TransformationSpellHelper.UnderTransformation(m) && m.BodyMod == 0 && m.Alive;
|
||||
return m?.BodyMod == 0 && m.Alive && !TransformationSpellHelper.UnderTransformation(m);
|
||||
}
|
||||
|
||||
public static IEntity ZAdjustedIEFromMobile(Mobile m, int ZDelta)
|
||||
|
|
@ -411,7 +400,7 @@ namespace Server.Engines.Doom
|
|||
|
||||
public static void DoDamage(Mobile m, int min, int max, bool poison)
|
||||
{
|
||||
if (m != null && !m.Deleted && m.Alive)
|
||||
if (m?.Deleted == false && m.Alive)
|
||||
{
|
||||
int damage = Utility.Random(min, max);
|
||||
AOS.Damage(m, damage, poison ? 0 : 100, 0, 0, poison ? 100 : 0, 0);
|
||||
|
|
@ -559,8 +548,8 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
IEntity m_IEntity = new Entity(Serial.Zero, RandomPointIn(m_Player.Location, 10), m_Player.Map);
|
||||
|
||||
List<Mobile> mobiles = new List<Mobile>();
|
||||
foreach (Mobile m in m_IEntity.Map.GetMobilesInRange(m_IEntity.Location, 2)) mobiles.Add(m);
|
||||
List<Mobile> mobiles = m_IEntity.Map.GetMobilesInRange(m_IEntity.Location, 2).ToList();
|
||||
|
||||
for (int k = 0; k < mobiles.Count; k++)
|
||||
if (IsValidDamagable(mobiles[k]) && mobiles[k] != m_Player)
|
||||
{
|
||||
|
|
@ -615,7 +604,7 @@ namespace Server.Engines.Doom
|
|||
if (ticks >= 71 || m_Controller.m_LampRoom.GetPlayerCount() == 0)
|
||||
{
|
||||
foreach (Mobile mobile in mobiles)
|
||||
if (mobile != null && !mobile.Deleted && !mobile.IsDeadBondedPet)
|
||||
if (mobile?.Deleted == false && !mobile.IsDeadBondedPet)
|
||||
mobile.Kill();
|
||||
m_Controller.Enabled = true;
|
||||
Stop();
|
||||
|
|
@ -637,7 +626,8 @@ namespace Server.Engines.Doom
|
|||
DoDamage(mobile, 15, 20, true);
|
||||
}
|
||||
|
||||
if (Utility.Random((int)(level & ~0xfffffffc), 3) == 3) mobile.ApplyPoison(mobile, PA2[level]);
|
||||
if (Utility.Random((int)(level & ~0xfffffffc), 3) == 3)
|
||||
mobile.ApplyPoison(mobile, PA2[level]);
|
||||
if (ticks % 12 == 0 && level > 0 && mobile.Player)
|
||||
mobile.SendLocalizedMessage(PA[level][0], null, PA[level][1]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
m_Wanderer = new WandererOfTheVoid();
|
||||
m_Wanderer.MoveToWorld(LeverPuzzleController.lr_Enter, Map.Malas);
|
||||
m_Wanderer.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1060002, ""); // I am the guardian of...
|
||||
m_Wanderer.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1060002); // I am the guardian of...
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(5.0), CallBackMessage);
|
||||
}
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@ namespace Server.Engines.Doom
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if (m_Controller != null && !m_Controller.Deleted)
|
||||
if (m_Controller?.Deleted == false)
|
||||
m_Controller.Delete();
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ namespace Server.Engines.Doom
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if (m_Controller != null && !m_Controller.Deleted)
|
||||
if (m_Controller?.Deleted == false)
|
||||
m_Controller.Delete();
|
||||
}
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ namespace Server.Engines.Doom
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if (m_Controller != null && !m_Controller.Deleted)
|
||||
if (m_Controller?.Deleted == false)
|
||||
m_Controller.Delete();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
public class LampRoomRegion : BaseRegion
|
||||
{
|
||||
private LeverPuzzleController Controller;
|
||||
private LeverPuzzleController m_Controller;
|
||||
|
||||
public LampRoomRegion(LeverPuzzleController controller)
|
||||
: base(null, Map.Malas, Find(LeverPuzzleController.lr_Enter, Map.Malas), LeverPuzzleController.lr_Rect)
|
||||
{
|
||||
Controller = controller;
|
||||
m_Controller = controller;
|
||||
Register();
|
||||
}
|
||||
|
||||
|
|
@ -38,13 +38,13 @@ namespace Server.Engines.Doom
|
|||
if (m.AccessLevel > AccessLevel.Player)
|
||||
return;
|
||||
|
||||
if (Controller.Successful != null)
|
||||
if (m_Controller.Successful != null)
|
||||
{
|
||||
if (m is PlayerMobile)
|
||||
{
|
||||
if (m == Controller.Successful) return;
|
||||
if (m == m_Controller.Successful) return;
|
||||
}
|
||||
else if (m is BaseCreature bc && (bc.Controlled && bc.ControlMaster == Controller.Successful ||
|
||||
else if (m is BaseCreature bc && (bc.Controlled && bc.ControlMaster == m_Controller.Successful ||
|
||||
bc.Summoned))
|
||||
{
|
||||
return;
|
||||
|
|
@ -57,49 +57,36 @@ namespace Server.Engines.Doom
|
|||
|
||||
public override void OnExit(Mobile m)
|
||||
{
|
||||
if (m != null && m == Controller.Successful)
|
||||
Controller.RemoveSuccessful();
|
||||
if (m != null && m == m_Controller.Successful)
|
||||
m_Controller.RemoveSuccessful();
|
||||
}
|
||||
|
||||
public override void OnDeath(Mobile m)
|
||||
{
|
||||
if (m != null && !m.Deleted && !(m is WandererOfTheVoid))
|
||||
{
|
||||
Timer kick = new LeverPuzzleController.LampRoomKickTimer(m);
|
||||
kick.Start();
|
||||
}
|
||||
if (m?.Deleted != false || m is WandererOfTheVoid)
|
||||
return;
|
||||
Timer kick = new LeverPuzzleController.LampRoomKickTimer(m);
|
||||
kick.Start();
|
||||
}
|
||||
|
||||
public override bool OnSkillUse(Mobile m, int Skill) /* just in case */
|
||||
{
|
||||
if (Controller.Successful == null || m.AccessLevel == AccessLevel.Player && m != Controller.Successful)
|
||||
return false;
|
||||
return true;
|
||||
return m_Controller.Successful != null && (m.AccessLevel != AccessLevel.Player || m == m_Controller.Successful);
|
||||
}
|
||||
}
|
||||
|
||||
public class LeverPuzzleRegion : BaseRegion
|
||||
{
|
||||
private LeverPuzzleController Controller;
|
||||
public Mobile m_Occupant;
|
||||
|
||||
public LeverPuzzleRegion(LeverPuzzleController controller, int[] loc)
|
||||
: base(null, Map.Malas, Find(LeverPuzzleController.lr_Enter, Map.Malas), new Rectangle2D(loc[0], loc[1], 1, 1))
|
||||
{
|
||||
Controller = controller;
|
||||
Register();
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Occupant
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Occupant != null && m_Occupant.Alive)
|
||||
return m_Occupant;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public Mobile Occupant => m_Occupant?.Alive == true ? m_Occupant : null;
|
||||
|
||||
public override void OnEnter(Mobile m)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Server.Ethics.Evil;
|
||||
using Server.Ethics.Hero;
|
||||
using Server.Items;
|
||||
|
|
@ -126,16 +127,7 @@ namespace Server.Ethics
|
|||
if (!Insensitive.Equals(ethic.Definition.JoinPhrase.String, e.Speech))
|
||||
continue;
|
||||
|
||||
bool isNearAnkh = false;
|
||||
|
||||
foreach (Item item in e.Mobile.GetItemsInRange(2))
|
||||
if (item is AnkhNorth || item is AnkhWest)
|
||||
{
|
||||
isNearAnkh = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isNearAnkh)
|
||||
if (!e.Mobile.GetItemsInRange(2).Any(item => item is AnkhNorth || item is AnkhWest))
|
||||
continue;
|
||||
|
||||
pl = new Player(ethic, e.Mobile);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace Server.Ethics
|
|||
{
|
||||
Movable = false;
|
||||
|
||||
if (Instance == null || Instance.Deleted)
|
||||
if (Instance?.Deleted != false)
|
||||
Instance = this;
|
||||
else
|
||||
base.Delete();
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ namespace Server.Ethics
|
|||
|
||||
Player pl = pm.EthicPlayer;
|
||||
|
||||
if (pl != null && !pl.Ethic.IsEligible(pl.Mobile))
|
||||
if (pl?.Ethic.IsEligible(pl.Mobile) == false)
|
||||
pm.EthicPlayer = pl = null;
|
||||
|
||||
return pl;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Server.Ethics.Evil
|
|||
|
||||
public override void BeginInvoke(Player from)
|
||||
{
|
||||
if (from.Familiar != null && from.Familiar.Deleted)
|
||||
if (from.Familiar?.Deleted == true)
|
||||
from.Familiar = null;
|
||||
|
||||
if (from.Familiar != null)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Server.Ethics.Evil
|
|||
|
||||
public override void BeginInvoke(Player from)
|
||||
{
|
||||
if (from.Steed != null && from.Steed.Deleted)
|
||||
if (from.Steed?.Deleted == true)
|
||||
from.Steed = null;
|
||||
|
||||
if (from.Steed != null)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Server.Ethics.Hero
|
|||
|
||||
public override void BeginInvoke(Player from)
|
||||
{
|
||||
if (from.Steed != null && from.Steed.Deleted)
|
||||
if (from.Steed?.Deleted == true)
|
||||
from.Steed = null;
|
||||
|
||||
if (from.Steed != null)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Server.Ethics.Hero
|
|||
|
||||
public override void BeginInvoke(Player from)
|
||||
{
|
||||
if (from.Familiar != null && from.Familiar.Deleted)
|
||||
if (from.Familiar?.Deleted == true)
|
||||
from.Familiar = null;
|
||||
|
||||
if (from.Familiar != null)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Accounting;
|
||||
using Server.Commands;
|
||||
using Server.Commands.Generic;
|
||||
|
|
@ -239,36 +240,18 @@ namespace Server.Factions
|
|||
return false;
|
||||
|
||||
IPooledEnumerable<IEntity> eable = mob.Map.GetObjectsInRange(mob.Location, range, items, mobs);
|
||||
|
||||
foreach (IEntity obj in eable)
|
||||
if (type.IsInstanceOfType(obj))
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isInstance = eable.Any(type.IsInstanceOfType);
|
||||
eable.Free();
|
||||
return false;
|
||||
|
||||
return isInstance;
|
||||
}
|
||||
|
||||
public static bool IsNearType(Mobile mob, Type[] types, int range)
|
||||
{
|
||||
IPooledEnumerable<IEntity> eable = mob.GetObjectsInRange(range);
|
||||
|
||||
foreach (IEntity obj in eable)
|
||||
{
|
||||
Type objType = obj.GetType();
|
||||
|
||||
for (int i = 0; i < types.Length; i++)
|
||||
if (types[i].IsAssignableFrom(objType))
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool found = eable.Any(obj => types.Any(t => t.IsInstanceOfType(obj)));
|
||||
eable.Free();
|
||||
return false;
|
||||
return found;
|
||||
}
|
||||
|
||||
public void RemovePlayerState(PlayerState pl)
|
||||
|
|
@ -475,7 +458,7 @@ namespace Server.Factions
|
|||
pm.SendLocalizedMessage(
|
||||
1042161); // You cannot join a faction because your guild is an Order or Chaos type.
|
||||
}
|
||||
else if (!Guild.NewGuildSystem && guild.Enemies != null && guild.Enemies.Count > 0
|
||||
else if (!Guild.NewGuildSystem && guild.Enemies?.Count > 0
|
||||
) //CAN join w/wars in new system
|
||||
{
|
||||
pm.SendLocalizedMessage(1005056); // You cannot join a faction with active Wars
|
||||
|
|
@ -1016,7 +999,7 @@ namespace Server.Factions
|
|||
Player killerEPL = Player.Find(killer);
|
||||
Player victimEPL = Player.Find(victim);
|
||||
|
||||
if (killerEPL != null && victimEPL != null && victimEPL.Power > 0 && victimState.CanGiveSilverTo(killer))
|
||||
if (killerEPL != null && victimEPL?.Power > 0 && victimState.CanGiveSilverTo(killer))
|
||||
{
|
||||
int powerTransfer = Math.Max(1, victimEPL.Power / 5);
|
||||
|
||||
|
|
@ -1078,7 +1061,7 @@ namespace Server.Factions
|
|||
Player killerEPL = Player.Find(killer);
|
||||
Player victimEPL = Player.Find(victim);
|
||||
|
||||
if (killerEPL != null && victimEPL != null && victimEPL.Power > 0)
|
||||
if (killerEPL != null && victimEPL?.Power > 0)
|
||||
{
|
||||
int powerTransfer = Math.Max(1, victimEPL.Power / 5);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace Server.Factions
|
|||
{
|
||||
get
|
||||
{
|
||||
if (Item == null || Item.Deleted)
|
||||
if (Item?.Deleted != false)
|
||||
return true;
|
||||
|
||||
return Expiration != DateTime.MinValue && DateTime.UtcNow >= Expiration;
|
||||
|
|
@ -77,7 +77,7 @@ namespace Server.Factions
|
|||
if (Item is IFactionItem item)
|
||||
item.FactionItemState = null;
|
||||
|
||||
if (Faction != null && Faction.State.FactionItems.Contains(this))
|
||||
if (Faction?.State.FactionItems.Contains(this) == true)
|
||||
Faction.State.FactionItems.Remove(this);
|
||||
}
|
||||
|
||||
|
|
@ -93,13 +93,7 @@ namespace Server.Factions
|
|||
{
|
||||
PlayerState pl = PlayerState.Find(mob);
|
||||
|
||||
if (pl == null)
|
||||
return 0;
|
||||
|
||||
if (pl.Faction.IsCommander(mob))
|
||||
return 9;
|
||||
|
||||
return pl.Rank.MaxWearables;
|
||||
return pl == null ? 0 : pl.Faction.IsCommander(mob) ? 9 : pl.Rank.MaxWearables;
|
||||
}
|
||||
|
||||
public static FactionItem Find(Item item)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace Server.Factions
|
|||
{
|
||||
Movable = false;
|
||||
|
||||
if (Instance == null || Instance.Deleted)
|
||||
if (Instance?.Deleted == true)
|
||||
Instance = this;
|
||||
else
|
||||
base.Delete();
|
||||
|
|
|
|||
|
|
@ -386,18 +386,14 @@ namespace Server.Factions
|
|||
|
||||
public bool IsSheriff(Mobile mob)
|
||||
{
|
||||
if (mob == null || mob.Deleted)
|
||||
return false;
|
||||
|
||||
return mob.AccessLevel >= AccessLevel.GameMaster || mob == Sheriff;
|
||||
return mob?.Deleted == false &&
|
||||
(mob.AccessLevel >= AccessLevel.GameMaster || mob == Sheriff);
|
||||
}
|
||||
|
||||
public bool IsFinance(Mobile mob)
|
||||
{
|
||||
if (mob == null || mob.Deleted)
|
||||
return false;
|
||||
|
||||
return mob.AccessLevel >= AccessLevel.GameMaster || mob == Finance;
|
||||
return mob?.Deleted == false &&
|
||||
(mob.AccessLevel >= AccessLevel.GameMaster || mob == Finance);
|
||||
}
|
||||
|
||||
public void Capture(Faction f)
|
||||
|
|
|
|||
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