Cleanup/Housekeeping (#242)
This commit is contained in:
parent
90ede0659f
commit
741e8d8300
228 changed files with 6292 additions and 2690 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: AssemblyHandler.cs *
|
||||
* *
|
||||
|
|
@ -33,7 +33,9 @@ namespace Server
|
|||
var assemblies = new Assembly[files.Length];
|
||||
|
||||
for (var i = 0; i < files.Length; i++)
|
||||
{
|
||||
assemblies[i] = AssemblyLoadContext.Default.LoadFromAssemblyPath(files[i]);
|
||||
}
|
||||
|
||||
Assemblies = assemblies;
|
||||
}
|
||||
|
|
@ -43,42 +45,61 @@ namespace Server
|
|||
var invoke = new List<MethodInfo>();
|
||||
|
||||
for (var a = 0; a < Assemblies.Length; ++a)
|
||||
{
|
||||
invoke.AddRange(
|
||||
Assemblies[a]
|
||||
.GetTypes()
|
||||
.Select(t => t.GetMethod(method, BindingFlags.Static | BindingFlags.Public))
|
||||
.Where(m => m != null)
|
||||
);
|
||||
}
|
||||
|
||||
invoke.Sort(new CallPriorityComparer());
|
||||
|
||||
for (var i = 0; i < invoke.Count; ++i)
|
||||
{
|
||||
invoke[i].Invoke(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
public static TypeCache GetTypeCache(Assembly asm)
|
||||
{
|
||||
if (asm == null)
|
||||
{
|
||||
return m_NullCache ??= new TypeCache(null);
|
||||
}
|
||||
|
||||
if (m_TypeCaches.TryGetValue(asm, out var c))
|
||||
{
|
||||
return c;
|
||||
}
|
||||
|
||||
return m_TypeCaches[asm] = new TypeCache(asm);
|
||||
}
|
||||
|
||||
public static Type FindFirstTypeForName(string name, bool ignoreCase = false, Func<Type, bool> predicate = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name)) return null;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var types = FindTypesByName(name, ignoreCase).ToList();
|
||||
if (types.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (predicate != null)
|
||||
{
|
||||
return types.FirstOrDefault(predicate);
|
||||
}
|
||||
|
||||
if (types.Count == 1)
|
||||
{
|
||||
return types[0];
|
||||
}
|
||||
|
||||
// Try to find the closest match if there is no predicate.
|
||||
// Check for exact match of the FullName or Name
|
||||
// Then check for case-insensitive match of FullName or Name
|
||||
|
|
@ -97,13 +118,19 @@ namespace Server
|
|||
var types = new List<Type>();
|
||||
|
||||
if (ignoreCase)
|
||||
{
|
||||
name = name.ToLower();
|
||||
}
|
||||
|
||||
for (var i = 0; i < Assemblies.Length; i++)
|
||||
{
|
||||
types.AddRange(GetTypeCache(Assemblies[i])[name]);
|
||||
}
|
||||
|
||||
if (types.Count == 0)
|
||||
{
|
||||
types.AddRange(GetTypeCache(Core.Assembly)[name]);
|
||||
}
|
||||
|
||||
return types;
|
||||
}
|
||||
|
|
@ -150,15 +177,19 @@ namespace Server
|
|||
addToRefs(i, current.FullName);
|
||||
addToRefs(i, current.FullName?.ToLower());
|
||||
if (current.GetCustomAttribute(aliasType, false) is TypeAliasAttribute alias)
|
||||
{
|
||||
for (var j = 0; j < alias.Aliases.Length; j++)
|
||||
{
|
||||
addToRefs(i, alias.Aliases[j]);
|
||||
addToRefs(i, alias.Aliases[j].ToLower());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var (key, value) in nameMap)
|
||||
{
|
||||
m_NameMap[key] = value.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Type> Types => m_Types;
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* Attributes.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
|
@ -57,22 +37,32 @@ namespace Server
|
|||
public int Compare(MethodInfo x, MethodInfo y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (x == null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (y == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
var xPriority = GetPriority(x);
|
||||
var yPriority = GetPriority(y);
|
||||
|
||||
if (xPriority > yPriority)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (xPriority < yPriority)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -82,10 +72,14 @@ namespace Server
|
|||
var objs = mi.GetCustomAttributes(typeof(CallPriorityAttribute), true);
|
||||
|
||||
if (objs.Length == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(objs[0] is CallPriorityAttribute attr))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return attr.Priority;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,9 @@ namespace System.Buffers
|
|||
{
|
||||
if (length < 0)
|
||||
// Cast-away readonly to initialize lazy field
|
||||
{
|
||||
Volatile.Write(ref Unsafe.AsRef(length), sequence.Length);
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
|
@ -109,9 +111,13 @@ namespace System.Buffers
|
|||
if (CurrentSpanIndex >= CurrentSpan.Length)
|
||||
{
|
||||
if (usingSequence)
|
||||
{
|
||||
GetNextSpan();
|
||||
}
|
||||
else
|
||||
{
|
||||
moreData = false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -120,7 +126,10 @@ namespace System.Buffers
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Rewind(long count)
|
||||
{
|
||||
if ((ulong)count > (ulong)Consumed) throw new ArgumentOutOfRangeException(nameof(count));
|
||||
if ((ulong)count > (ulong)Consumed)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(count));
|
||||
}
|
||||
|
||||
Consumed -= count;
|
||||
|
||||
|
|
@ -232,7 +241,10 @@ namespace System.Buffers
|
|||
|
||||
private void AdvanceToNextSpan(long count)
|
||||
{
|
||||
if (count < 0) throw new ArgumentOutOfRangeException(nameof(count));
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(count));
|
||||
}
|
||||
|
||||
Consumed += count;
|
||||
while (moreData)
|
||||
|
|
@ -253,7 +265,10 @@ namespace System.Buffers
|
|||
|
||||
GetNextSpan();
|
||||
|
||||
if (count == 0) break;
|
||||
if (count == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (count != 0)
|
||||
|
|
@ -286,7 +301,9 @@ namespace System.Buffers
|
|||
{
|
||||
// If we don't have enough to fill the requested buffer, return false
|
||||
if (Remaining < destination.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var firstSpan = UnreadSpan;
|
||||
firstSpan.CopyTo(destination);
|
||||
|
|
@ -294,14 +311,19 @@ namespace System.Buffers
|
|||
|
||||
var next = nextPosition;
|
||||
while (sequence.TryGet(ref next, out var nextSegment))
|
||||
{
|
||||
if (nextSegment.Length > 0)
|
||||
{
|
||||
var nextSpan = nextSegment.Span;
|
||||
var toCopy = Math.Min(nextSpan.Length, destination.Length - copied);
|
||||
nextSpan.Slice(0, toCopy).CopyTo(destination.Slice(copied));
|
||||
copied += toCopy;
|
||||
if (copied >= destination.Length) break;
|
||||
if (copied >= destination.Length)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,10 @@ namespace System.Buffers
|
|||
where T : unmanaged
|
||||
{
|
||||
var span = reader.UnreadSpan;
|
||||
if (span.Length < sizeof(T)) return TryReadMultisegment(ref reader, out value);
|
||||
if (span.Length < sizeof(T))
|
||||
{
|
||||
return TryReadMultisegment(ref reader, out value);
|
||||
}
|
||||
|
||||
value = Unsafe.ReadUnaligned<T>(ref MemoryMarshal.GetReference(span));
|
||||
reader.Advance(sizeof(T));
|
||||
|
|
|
|||
|
|
@ -110,7 +110,10 @@ namespace System.Buffers
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Ensure(int count = 1)
|
||||
{
|
||||
if (_span.Length < count) EnsureMore(count);
|
||||
if (_span.Length < count)
|
||||
{
|
||||
EnsureMore(count);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -120,7 +123,10 @@ namespace System.Buffers
|
|||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private void EnsureMore(int count = 0)
|
||||
{
|
||||
if (_buffered > 0) Commit();
|
||||
if (_buffered > 0)
|
||||
{
|
||||
Commit();
|
||||
}
|
||||
|
||||
_span = _output.GetSpan(count);
|
||||
}
|
||||
|
|
@ -133,7 +139,10 @@ namespace System.Buffers
|
|||
{
|
||||
while (source.Length > 0)
|
||||
{
|
||||
if (_span.Length == 0) EnsureMore();
|
||||
if (_span.Length == 0)
|
||||
{
|
||||
EnsureMore();
|
||||
}
|
||||
|
||||
var writable = Math.Min(source.Length, _span.Length);
|
||||
source.Slice(0, writable).CopyTo(_span);
|
||||
|
|
|
|||
|
|
@ -58,14 +58,20 @@ namespace System.Buffers
|
|||
|
||||
protected void Dispose(bool disposing)
|
||||
{
|
||||
if (_isDisposed) return;
|
||||
if (_isDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_isDisposed = true;
|
||||
|
||||
Array = null;
|
||||
NativePointer = IntPtr.Zero;
|
||||
|
||||
if (_gcHandle.IsAllocated) _gcHandle.Free();
|
||||
if (_gcHandle.IsAllocated)
|
||||
{
|
||||
_gcHandle.Free();
|
||||
}
|
||||
}
|
||||
|
||||
~MemoryPoolSlab()
|
||||
|
|
|
|||
|
|
@ -72,7 +72,10 @@ namespace System.Buffers
|
|||
|
||||
public override IMemoryOwner<byte> Rent(int size = AnySize)
|
||||
{
|
||||
if (size > _blockSize) MemoryPoolThrowHelper.ThrowArgumentOutOfRangeException_BufferRequestTooLarge(_blockSize);
|
||||
if (size > _blockSize)
|
||||
{
|
||||
MemoryPoolThrowHelper.ThrowArgumentOutOfRangeException_BufferRequestTooLarge(_blockSize);
|
||||
}
|
||||
|
||||
var block = Lease();
|
||||
return block;
|
||||
|
|
@ -85,7 +88,9 @@ namespace System.Buffers
|
|||
private MemoryPoolBlock Lease()
|
||||
{
|
||||
if (_isDisposed)
|
||||
{
|
||||
MemoryPoolThrowHelper.ThrowObjectDisposedException(MemoryPoolThrowHelper.ExceptionArgument.MemoryPool);
|
||||
}
|
||||
|
||||
if (_blocks.TryDequeue(out var block))
|
||||
{
|
||||
|
|
@ -127,7 +132,9 @@ namespace System.Buffers
|
|||
block = new MemoryPoolBlock(this, slab, offset, _blockSize);
|
||||
|
||||
if (i != blockCount - 1) // last block
|
||||
{
|
||||
Return(block);
|
||||
}
|
||||
|
||||
offset += _blockSize;
|
||||
}
|
||||
|
|
@ -148,9 +155,13 @@ namespace System.Buffers
|
|||
internal void Return(MemoryPoolBlock block)
|
||||
{
|
||||
if (!_isDisposed)
|
||||
{
|
||||
_blocks.Enqueue(block);
|
||||
}
|
||||
else
|
||||
{
|
||||
GC.SuppressFinalize(block);
|
||||
}
|
||||
}
|
||||
|
||||
// This method can ONLY be called from the finalizer of MemoryPoolBlock
|
||||
|
|
@ -162,25 +173,37 @@ namespace System.Buffers
|
|||
// Need to make a new object because this one is being finalized
|
||||
// Note, this must be called within the _disposeSync lock because the block
|
||||
// could be disposed at the same time as the finalizer.
|
||||
{
|
||||
Return(new MemoryPoolBlock(this, slab, offset, length));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (_isDisposed) return;
|
||||
if (_isDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lock (_disposeSync)
|
||||
{
|
||||
_isDisposed = true;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
while (_slabs.TryPop(out var slab))
|
||||
// dispose managed state (managed objects).
|
||||
{
|
||||
slab.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
// Discard blocks in pool
|
||||
while (_blocks.TryDequeue(out var block)) GC.SuppressFinalize(block);
|
||||
while (_blocks.TryDequeue(out var block))
|
||||
{
|
||||
GC.SuppressFinalize(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: CityInfo.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* ClientVersion.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
|
@ -58,7 +38,9 @@ namespace Server
|
|||
|
||||
var br3 = br2 + 1;
|
||||
while (br3 < fmt.Length && char.IsDigit(fmt, br3))
|
||||
{
|
||||
br3++;
|
||||
}
|
||||
|
||||
Major = Utility.ToInt32(fmt.Substring(0, br1));
|
||||
Minor = Utility.ToInt32(fmt.Substring(br1 + 1, br2 - br1 - 1));
|
||||
|
|
@ -69,7 +51,9 @@ namespace Server
|
|||
if (Major <= 5 && Minor <= 0 && Revision <= 6) // Anything before 5.0.7
|
||||
{
|
||||
if (!char.IsWhiteSpace(fmt, br3))
|
||||
{
|
||||
Patch = fmt[br3] - 'a' + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -78,12 +62,18 @@ namespace Server
|
|||
}
|
||||
|
||||
if (fmt.IndexOf("god") >= 0 || fmt.IndexOf("gq") >= 0)
|
||||
{
|
||||
Type = ClientType.God;
|
||||
}
|
||||
else if (fmt.IndexOf("third dawn") >= 0 || fmt.IndexOf("uo:td") >= 0 || fmt.IndexOf("uotd") >= 0 ||
|
||||
fmt.IndexOf("uo3d") >= 0 || fmt.IndexOf("uo:3d") >= 0)
|
||||
{
|
||||
Type = ClientType.UOTD;
|
||||
}
|
||||
else
|
||||
{
|
||||
Type = ClientType.Regular;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -110,24 +100,50 @@ namespace Server
|
|||
public int CompareTo(ClientVersion o)
|
||||
{
|
||||
if (o == null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Major > o.Major)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Major < o.Major)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (Minor > o.Minor)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Minor < o.Minor)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (Revision > o.Revision)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Revision < o.Revision)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (Patch > o.Patch)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Patch < o.Patch)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +187,9 @@ namespace Server
|
|||
if (Major <= 5 && Minor <= 0 && Revision <= 6) // Anything before 5.0.7
|
||||
{
|
||||
if (Patch > 0)
|
||||
{
|
||||
builder.Append((char)('a' + (Patch - 1)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -195,11 +213,19 @@ namespace Server
|
|||
public static int Compare(ClientVersion a, ClientVersion b)
|
||||
{
|
||||
if (IsNull(a) && IsNull(b))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (IsNull(a))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (IsNull(b))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return a.CompareTo(b);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: ArraySet.cs *
|
||||
* *
|
||||
|
|
@ -57,7 +57,10 @@ namespace Server.Collections
|
|||
{
|
||||
var indexOf = m_List.IndexOf(item);
|
||||
|
||||
if (indexOf >= 0) return indexOf;
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
return indexOf;
|
||||
}
|
||||
|
||||
m_List.Add(item);
|
||||
return m_List.Count - 1;
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* Commands.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Network;
|
||||
|
|
@ -49,7 +29,9 @@ namespace Server
|
|||
public string GetString(int index)
|
||||
{
|
||||
if (index < 0 || index >= Arguments.Length)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return Arguments[index];
|
||||
}
|
||||
|
|
@ -57,7 +39,9 @@ namespace Server
|
|||
public int GetInt32(int index)
|
||||
{
|
||||
if (index < 0 || index >= Arguments.Length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Utility.ToInt32(Arguments[index]);
|
||||
}
|
||||
|
|
@ -65,7 +49,9 @@ namespace Server
|
|||
public uint GetUInt32(int index)
|
||||
{
|
||||
if (index < 0 || index >= Arguments.Length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Utility.ToUInt32(Arguments[index]);
|
||||
}
|
||||
|
|
@ -73,7 +59,9 @@ namespace Server
|
|||
public bool GetBoolean(int index)
|
||||
{
|
||||
if (index < 0 || index >= Arguments.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Utility.ToBoolean(Arguments[index]);
|
||||
}
|
||||
|
|
@ -81,7 +69,9 @@ namespace Server
|
|||
public double GetDouble(int index)
|
||||
{
|
||||
if (index < 0 || index >= Arguments.Length)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return Utility.ToDouble(Arguments[index]);
|
||||
}
|
||||
|
|
@ -89,7 +79,9 @@ namespace Server
|
|||
public TimeSpan GetTimeSpan(int index)
|
||||
{
|
||||
if (index < 0 || index >= Arguments.Length)
|
||||
{
|
||||
return TimeSpan.Zero;
|
||||
}
|
||||
|
||||
return Utility.ToTimeSpan(Arguments[index]);
|
||||
}
|
||||
|
|
@ -145,10 +137,16 @@ namespace Server
|
|||
var end = start;
|
||||
|
||||
while (end < array.Length)
|
||||
{
|
||||
if (array[end] != '"' || array[end - 1] == '\\')
|
||||
{
|
||||
++end;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
list.Add(value.Substring(start, end - start));
|
||||
|
||||
|
|
@ -159,10 +157,16 @@ namespace Server
|
|||
var end = start;
|
||||
|
||||
while (end < array.Length)
|
||||
{
|
||||
if (array[end] != ' ')
|
||||
{
|
||||
++end;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
list.Add(value.Substring(start, end - start));
|
||||
|
||||
|
|
@ -185,10 +189,14 @@ namespace Server
|
|||
public static bool Handle(Mobile from, string text, MessageType type = MessageType.Regular)
|
||||
{
|
||||
if (!text.StartsWith(Prefix) && type != MessageType.Command)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type != MessageType.Command)
|
||||
{
|
||||
text = text.Substring(Prefix.Length);
|
||||
}
|
||||
|
||||
var indexOf = text.IndexOf(' ');
|
||||
|
||||
|
|
@ -226,7 +234,9 @@ namespace Server
|
|||
else
|
||||
{
|
||||
if (from.AccessLevel <= BadCommandIgnoreLevel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
from.SendMessage("You do not have access to that command.");
|
||||
}
|
||||
|
|
@ -234,7 +244,9 @@ namespace Server
|
|||
else
|
||||
{
|
||||
if (from.AccessLevel <= BadCommandIgnoreLevel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
from.SendMessage("That is not a valid command.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: ServerConfiguration.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* ContextMenu.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
|
@ -50,14 +30,20 @@ namespace Server.ContextMenus
|
|||
var list = new List<ContextMenuEntry>();
|
||||
|
||||
if (target is Mobile mobile)
|
||||
mobile.GetContextMenuEntries(from, list);
|
||||
{
|
||||
mobile.GetContextMenuEntries(@from, list);
|
||||
}
|
||||
else if (target is Item item)
|
||||
item.GetContextMenuEntries(from, list);
|
||||
{
|
||||
item.GetContextMenuEntries(@from, list);
|
||||
}
|
||||
|
||||
Entries = list.ToArray();
|
||||
|
||||
for (var i = 0; i < Entries.Length; ++i)
|
||||
{
|
||||
Entries[i].Owner = this;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* ContextMenuEntry.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.ContextMenus
|
||||
|
|
@ -44,9 +24,13 @@ namespace Server.ContextMenus
|
|||
public ContextMenuEntry(int number, int range = -1)
|
||||
{
|
||||
if (number <= 0x7FFF) // Legacy code support
|
||||
{
|
||||
Number = 3000000 + number;
|
||||
}
|
||||
else
|
||||
{
|
||||
Number = number;
|
||||
}
|
||||
|
||||
Range = range;
|
||||
Enabled = true;
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* OpenBackpackEntry.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
namespace Server.ContextMenus
|
||||
{
|
||||
public class OpenBackpackEntry : ContextMenuEntry
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* PaperdollEntry.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
namespace Server.ContextMenus
|
||||
{
|
||||
public class PaperdollEntry : ContextMenuEntry
|
||||
|
|
@ -29,7 +9,9 @@ namespace Server.ContextMenus
|
|||
public override void OnClick()
|
||||
{
|
||||
if (m_Mobile.CanPaperdollBeOpenedBy(Owner.From))
|
||||
{
|
||||
m_Mobile.DisplayPaperdollTo(Owner.From);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* PacketProfile.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
|
@ -61,7 +41,10 @@ namespace Server.Diagnostics
|
|||
|
||||
public virtual void Start()
|
||||
{
|
||||
if (_stopwatch.IsRunning) _stopwatch.Reset();
|
||||
if (_stopwatch.IsRunning)
|
||||
{
|
||||
_stopwatch.Reset();
|
||||
}
|
||||
|
||||
_stopwatch.Start();
|
||||
}
|
||||
|
|
@ -72,7 +55,10 @@ namespace Server.Diagnostics
|
|||
|
||||
TotalTime += elapsed;
|
||||
|
||||
if (elapsed > PeakTime) PeakTime = elapsed;
|
||||
if (elapsed > PeakTime)
|
||||
{
|
||||
PeakTime = elapsed;
|
||||
}
|
||||
|
||||
Count++;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* PacketProfile.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
|
@ -36,10 +16,14 @@ namespace Server.Diagnostics
|
|||
public static GumpProfile Acquire(Type type)
|
||||
{
|
||||
if (!Core.Profiling)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!_profiles.TryGetValue(type, out var prof))
|
||||
{
|
||||
_profiles.Add(type, prof = new GumpProfile(type));
|
||||
}
|
||||
|
||||
return prof;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* PacketProfile.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
|
@ -67,7 +47,9 @@ namespace Server.Diagnostics
|
|||
public static PacketSendProfile Acquire(Type type)
|
||||
{
|
||||
if (!_profiles.TryGetValue(type, out var prof))
|
||||
{
|
||||
_profiles.Add(type, prof = new PacketSendProfile(type));
|
||||
}
|
||||
|
||||
return prof;
|
||||
}
|
||||
|
|
@ -101,7 +83,9 @@ namespace Server.Diagnostics
|
|||
public static PacketReceiveProfile Acquire(int packetId)
|
||||
{
|
||||
if (!_profiles.TryGetValue(packetId, out var prof))
|
||||
{
|
||||
_profiles.Add(packetId, prof = new PacketReceiveProfile(packetId));
|
||||
}
|
||||
|
||||
return prof;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* PacketProfile.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
|
@ -37,10 +17,14 @@ namespace Server.Diagnostics
|
|||
public static TargetProfile Acquire(Type type)
|
||||
{
|
||||
if (!Core.Profiling)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!_profiles.TryGetValue(type, out var prof))
|
||||
{
|
||||
_profiles.Add(type, prof = new TargetProfile(type));
|
||||
}
|
||||
|
||||
return prof;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* PacketProfile.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
|
|
@ -43,10 +23,14 @@ namespace Server.Diagnostics
|
|||
public static TimerProfile Acquire(string name)
|
||||
{
|
||||
if (!Core.Profiling)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!_profiles.TryGetValue(name, out var prof))
|
||||
{
|
||||
_profiles.Add(name, prof = new TimerProfile(name));
|
||||
}
|
||||
|
||||
return prof;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* Effects.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
|
|
@ -51,7 +31,9 @@ namespace Server
|
|||
public static void PlaySound(IPoint3D p, Map map, int soundID)
|
||||
{
|
||||
if (soundID <= -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (map != null)
|
||||
{
|
||||
|
|
@ -89,7 +71,9 @@ namespace Server
|
|||
var map = e.Map;
|
||||
|
||||
if (map == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
e.ProcessDelta();
|
||||
|
||||
|
|
@ -98,6 +82,7 @@ namespace Server
|
|||
var eable = map.GetClientsInRange(e.Location);
|
||||
|
||||
foreach (var state in eable)
|
||||
{
|
||||
if (state.Mobile.CanSee(e))
|
||||
{
|
||||
if (SendParticlesTo(state))
|
||||
|
|
@ -118,6 +103,7 @@ namespace Server
|
|||
state.Send(playSound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Packet.Release(preEffect);
|
||||
Packet.Release(boltEffect);
|
||||
|
|
@ -220,7 +206,9 @@ namespace Server
|
|||
public static void SendTargetEffect(IEntity target, int itemID, int speed, int duration, int hue, int renderMode)
|
||||
{
|
||||
if (target is Mobile mobile)
|
||||
{
|
||||
mobile.ProcessDelta();
|
||||
}
|
||||
|
||||
SendPacket(target.Location, target.Map, new TargetEffect(target, itemID, speed, duration, hue, renderMode));
|
||||
}
|
||||
|
|
@ -247,7 +235,9 @@ namespace Server
|
|||
)
|
||||
{
|
||||
if (target is Mobile mobile)
|
||||
{
|
||||
mobile.ProcessDelta();
|
||||
}
|
||||
|
||||
var map = target.Map;
|
||||
|
||||
|
|
@ -302,10 +292,14 @@ namespace Server
|
|||
)
|
||||
{
|
||||
if (from is Mobile mobile)
|
||||
{
|
||||
mobile.ProcessDelta();
|
||||
}
|
||||
|
||||
if (to is Mobile mobile1)
|
||||
{
|
||||
mobile1.ProcessDelta();
|
||||
}
|
||||
|
||||
SendPacket(
|
||||
from.Location,
|
||||
|
|
@ -389,10 +383,14 @@ namespace Server
|
|||
)
|
||||
{
|
||||
if (from is Mobile fromMob)
|
||||
{
|
||||
fromMob.ProcessDelta();
|
||||
}
|
||||
|
||||
if (to is Mobile toMob)
|
||||
{
|
||||
toMob.ProcessDelta();
|
||||
}
|
||||
|
||||
var map = from.Map;
|
||||
|
||||
|
|
@ -461,7 +459,9 @@ namespace Server
|
|||
public static void SendPacket(Point3D origin, Map map, Packet p)
|
||||
{
|
||||
if (map == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var eable = map.GetClientsInRange(origin);
|
||||
|
||||
|
|
@ -481,7 +481,9 @@ namespace Server
|
|||
public static void SendPacket(IPoint3D origin, Map map, Packet p)
|
||||
{
|
||||
if (map == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var eable = map.GetClientsInRange(new Point3D(origin));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: AccountLoginEvent.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: AggressiveActionEvent.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: CharacterCreatedEvent.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: CreateGuildEvent.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: EventSink.cs *
|
||||
* *
|
||||
|
|
@ -137,7 +137,9 @@ namespace Server
|
|||
public static void InvokeEquipMacro(Mobile m, List<Serial> list)
|
||||
{
|
||||
if (list?.Count > 0)
|
||||
{
|
||||
EquipMacro?.Invoke(m, list);
|
||||
}
|
||||
}
|
||||
|
||||
public static event Action<Mobile, List<Layer>> UnequipMacro;
|
||||
|
|
@ -145,7 +147,9 @@ namespace Server
|
|||
public static void InvokeUnequipMacro(Mobile m, List<Layer> layers)
|
||||
{
|
||||
if (layers?.Count > 0)
|
||||
{
|
||||
UnequipMacro?.Invoke(m, layers);
|
||||
}
|
||||
}
|
||||
|
||||
public static event Action<Mobile, IEntity, int> TargetedSpell;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: FastwalkEvent.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: GameLoginEvent.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: MovementEvent.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: ServerCrashedEvent.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: ServerListEvent.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: SocketConnectionEvent.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: SpeechEvent.cs *
|
||||
* *
|
||||
|
|
@ -46,8 +46,12 @@ namespace Server
|
|||
public bool HasKeyword(int keyword)
|
||||
{
|
||||
for (var i = 0; i < Keywords.Length; ++i)
|
||||
{
|
||||
if (Keywords[i] == keyword)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* ExpansionInfo.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Server
|
||||
|
|
@ -317,7 +297,10 @@ namespace Server
|
|||
{
|
||||
var info = GetInfo(ex);
|
||||
|
||||
if (info != null) return info.SupportedFeatures;
|
||||
if (info != null)
|
||||
{
|
||||
return info.SupportedFeatures;
|
||||
}
|
||||
|
||||
return ex switch
|
||||
{
|
||||
|
|
@ -343,7 +326,10 @@ namespace Server
|
|||
{
|
||||
var v = ex;
|
||||
|
||||
if (v < 0 || v >= Table.Length) v = 0;
|
||||
if (v < 0 || v >= Table.Length)
|
||||
{
|
||||
v = 0;
|
||||
}
|
||||
|
||||
return Table[v];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: Point2D.cs *
|
||||
* *
|
||||
|
|
@ -104,14 +104,22 @@ namespace Server
|
|||
public int CompareTo(Point2D other)
|
||||
{
|
||||
var xComparison = m_X.CompareTo(other.m_X);
|
||||
if (xComparison != 0) return xComparison;
|
||||
if (xComparison != 0)
|
||||
{
|
||||
return xComparison;
|
||||
}
|
||||
|
||||
return m_Y.CompareTo(other.m_Y);
|
||||
}
|
||||
|
||||
public int CompareTo(IPoint2D other)
|
||||
{
|
||||
var xComparison = m_X.CompareTo(other.X);
|
||||
if (xComparison != 0) return xComparison;
|
||||
if (xComparison != 0)
|
||||
{
|
||||
return xComparison;
|
||||
}
|
||||
|
||||
return m_Y.CompareTo(other.Y);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: Point3D.cs *
|
||||
* *
|
||||
|
|
@ -128,18 +128,34 @@ namespace Server
|
|||
public int CompareTo(Point3D other)
|
||||
{
|
||||
var xComparison = m_X.CompareTo(other.m_X);
|
||||
if (xComparison != 0) return xComparison;
|
||||
if (xComparison != 0)
|
||||
{
|
||||
return xComparison;
|
||||
}
|
||||
|
||||
var yComparison = m_Y.CompareTo(other.m_Y);
|
||||
if (yComparison != 0) return yComparison;
|
||||
if (yComparison != 0)
|
||||
{
|
||||
return yComparison;
|
||||
}
|
||||
|
||||
return m_Z.CompareTo(other.m_Z);
|
||||
}
|
||||
|
||||
public int CompareTo(IPoint3D other)
|
||||
{
|
||||
var xComparison = m_X.CompareTo(other.X);
|
||||
if (xComparison != 0) return xComparison;
|
||||
if (xComparison != 0)
|
||||
{
|
||||
return xComparison;
|
||||
}
|
||||
|
||||
var yComparison = m_Y.CompareTo(other.Y);
|
||||
if (yComparison != 0) return yComparison;
|
||||
if (yComparison != 0)
|
||||
{
|
||||
return yComparison;
|
||||
}
|
||||
|
||||
return m_Z.CompareTo(other.Z);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* Point3DList.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Server
|
||||
|
|
@ -52,7 +32,9 @@ namespace Server
|
|||
m_List = new Point3D[old.Length * 2];
|
||||
|
||||
for (var i = 0; i < old.Length; ++i)
|
||||
{
|
||||
m_List[i] = old[i];
|
||||
}
|
||||
}
|
||||
|
||||
m_List[Count].m_X = x;
|
||||
|
|
@ -69,7 +51,9 @@ namespace Server
|
|||
m_List = new Point3D[old.Length * 2];
|
||||
|
||||
for (var i = 0; i < old.Length; ++i)
|
||||
{
|
||||
m_List[i] = old[i];
|
||||
}
|
||||
}
|
||||
|
||||
m_List[Count].m_X = p.m_X;
|
||||
|
|
@ -81,12 +65,16 @@ namespace Server
|
|||
public Point3D[] ToArray()
|
||||
{
|
||||
if (Count == 0)
|
||||
{
|
||||
return m_EmptyList;
|
||||
}
|
||||
|
||||
var list = new Point3D[Count];
|
||||
|
||||
for (var i = 0; i < Count; ++i)
|
||||
{
|
||||
list[i] = m_List[i];
|
||||
}
|
||||
|
||||
Count = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: Rectangle2D.cs *
|
||||
* *
|
||||
|
|
@ -111,16 +111,24 @@ namespace Server
|
|||
public void MakeHold(Rectangle2D r)
|
||||
{
|
||||
if (r.m_Start.m_X < m_Start.m_X)
|
||||
{
|
||||
m_Start.m_X = r.m_Start.m_X;
|
||||
}
|
||||
|
||||
if (r.m_Start.m_Y < m_Start.m_Y)
|
||||
{
|
||||
m_Start.m_Y = r.m_Start.m_Y;
|
||||
}
|
||||
|
||||
if (r.m_End.m_X > m_End.m_X)
|
||||
{
|
||||
m_End.m_X = r.m_End.m_X;
|
||||
}
|
||||
|
||||
if (r.m_End.m_Y > m_End.m_Y)
|
||||
{
|
||||
m_End.m_Y = r.m_End.m_Y;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Contains(Point3D p) =>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: Rectangle3D.cs *
|
||||
* *
|
||||
|
|
@ -81,22 +81,34 @@ namespace Server
|
|||
public void MakeHold(Rectangle3D r)
|
||||
{
|
||||
if (r.m_Start.m_X < m_Start.m_X)
|
||||
{
|
||||
m_Start.m_X = r.m_Start.m_X;
|
||||
}
|
||||
|
||||
if (r.m_Start.m_Y < m_Start.m_Y)
|
||||
{
|
||||
m_Start.m_Y = r.m_Start.m_Y;
|
||||
}
|
||||
|
||||
if (r.m_Start.m_Z < m_Start.m_Z)
|
||||
{
|
||||
m_Start.m_Z = r.m_Start.m_Z;
|
||||
}
|
||||
|
||||
if (r.m_End.m_X > m_End.m_X)
|
||||
{
|
||||
m_End.m_X = r.m_End.m_X;
|
||||
}
|
||||
|
||||
if (r.m_End.m_Y > m_End.m_Y)
|
||||
{
|
||||
m_End.m_Y = r.m_End.m_Y;
|
||||
}
|
||||
|
||||
if (r.m_End.m_Z < m_End.m_Z)
|
||||
{
|
||||
m_End.m_Z = r.m_End.m_Z;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Contains(Point3D p) =>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: WorldLocation.cs *
|
||||
* *
|
||||
|
|
@ -104,7 +104,11 @@ namespace Server
|
|||
public int CompareTo(WorldLocation other)
|
||||
{
|
||||
var locComparison = m_Loc.CompareTo(other.m_Loc);
|
||||
if (locComparison != 0) return locComparison;
|
||||
if (locComparison != 0)
|
||||
{
|
||||
return locComparison;
|
||||
}
|
||||
|
||||
return Comparer<Map>.Default.Compare(m_Map, other.m_Map);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* Guild.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
|
@ -39,7 +19,10 @@ namespace Server.Guilds
|
|||
Serial = id;
|
||||
List.Add(Serial, this);
|
||||
if (Serial + 1 > m_NextID)
|
||||
{
|
||||
m_NextID = Serial + 1;
|
||||
}
|
||||
|
||||
SaveBuffer = new BufferedFileWriter(true);
|
||||
}
|
||||
|
||||
|
|
@ -95,7 +78,9 @@ namespace Server.Guilds
|
|||
var name = g.Name.ToLower();
|
||||
|
||||
if (words.All(t => name.IndexOf(t) != -1))
|
||||
{
|
||||
results.Add(g);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* Gump.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
|
@ -232,15 +212,21 @@ namespace Server.Gumps
|
|||
public void Add(GumpEntry g)
|
||||
{
|
||||
if (g.Parent != this)
|
||||
{
|
||||
g.Parent = this;
|
||||
}
|
||||
else if (!Entries.Contains(g))
|
||||
{
|
||||
Entries.Add(g);
|
||||
}
|
||||
}
|
||||
|
||||
public void Remove(GumpEntry g)
|
||||
{
|
||||
if (g == null || !Entries.Contains(g))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Entries.Remove(g);
|
||||
g.Parent = null;
|
||||
|
|
@ -250,7 +236,10 @@ namespace Server.Gumps
|
|||
{
|
||||
var indexOf = Strings.IndexOf(value);
|
||||
|
||||
if (indexOf >= 0) return indexOf;
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
return indexOf;
|
||||
}
|
||||
|
||||
Strings.Add(value);
|
||||
return Strings.Count - 1;
|
||||
|
|
@ -269,21 +258,33 @@ namespace Server.Gumps
|
|||
IGumpWriter disp;
|
||||
|
||||
if (ns?.Unpack == true)
|
||||
{
|
||||
disp = new DisplayGumpPacked(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
disp = new DisplayGumpFast(this);
|
||||
}
|
||||
|
||||
if (!Draggable)
|
||||
{
|
||||
disp.AppendLayout(m_NoMove);
|
||||
}
|
||||
|
||||
if (!Closable)
|
||||
{
|
||||
disp.AppendLayout(m_NoClose);
|
||||
}
|
||||
|
||||
if (!Disposable)
|
||||
{
|
||||
disp.AppendLayout(m_NoDispose);
|
||||
}
|
||||
|
||||
if (!Resizable)
|
||||
{
|
||||
disp.AppendLayout(m_NoResize);
|
||||
}
|
||||
|
||||
var count = Entries.Count;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpAlphaRegion.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpBackground.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpButton.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpCheck.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: GumpECHandleInput.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpEntry.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpGroup.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpHtml.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpHtmlLocalized.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpImage.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpImageTileButton.cs
|
||||
* -------------------
|
||||
* begin : April 26, 2005
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -91,8 +71,11 @@ namespace Server.Gumps
|
|||
public override string Compile(NetState ns)
|
||||
{
|
||||
if (LocalizedTooltip > 0)
|
||||
{
|
||||
return
|
||||
$"{{ buttontileart {X} {Y} {NormalID} {PressedID} {(int)m_Type} {Param} {ButtonID} {ItemID} {Hue} {Width} {Height} }}{{ tooltip {LocalizedTooltip} }}";
|
||||
}
|
||||
|
||||
return
|
||||
$"{{ buttontileart {X} {Y} {NormalID} {PressedID} {(int)m_Type} {Param} {ButtonID} {ItemID} {Hue} {Width} {Height} }}";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpImageTiled.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpItem.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -54,7 +34,9 @@ namespace Server.Gumps
|
|||
disp.AppendLayout(ItemID);
|
||||
|
||||
if (Hue != 0)
|
||||
{
|
||||
disp.AppendLayout(Hue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpItemProperty.cs
|
||||
* -------------------
|
||||
* begin : May 26, 2013
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpLabel.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpLabelCropped.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: GumpMasterGump.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpPage.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpRadio.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: GumpSpriteImage.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpTextEntry.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* GumpTextEntryLimited.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: GumpTooltip.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* RelayInfo.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class TextRelay
|
||||
|
|
@ -51,8 +31,12 @@ namespace Server.Gumps
|
|||
public bool IsSwitched(int switchID)
|
||||
{
|
||||
for (var i = 0; i < Switches.Length; ++i)
|
||||
{
|
||||
if (Switches[i] == switchID)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -60,8 +44,12 @@ namespace Server.Gumps
|
|||
public TextRelay GetTextEntry(int entryID)
|
||||
{
|
||||
for (var i = 0; i < TextEntries.Length; ++i)
|
||||
{
|
||||
if (TextEntries[i].EntryID == entryID)
|
||||
{
|
||||
return TextEntries[i];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* HuePicker.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.HuePickers
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* IAccount.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Server.Accounting
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* IEntity.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Server
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* Insensitive.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* Interfaces.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Server
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* BaseMulti.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
|
|
@ -60,7 +40,10 @@ namespace Server.Items
|
|||
int id = mcl.List[0].ItemId;
|
||||
|
||||
if (id < 0x4000)
|
||||
{
|
||||
return 1020000 + id;
|
||||
}
|
||||
|
||||
return 1078872 + id;
|
||||
}
|
||||
|
||||
|
|
@ -129,8 +112,12 @@ namespace Server.Items
|
|||
var version = reader.ReadInt();
|
||||
|
||||
if (version == 0)
|
||||
{
|
||||
if (ItemID >= 0x4000)
|
||||
{
|
||||
ItemID -= 0x4000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* Container.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
|
@ -71,7 +51,9 @@ namespace Server.Items
|
|||
get
|
||||
{
|
||||
if (m_ContainerData == null)
|
||||
{
|
||||
UpdateContainerData();
|
||||
}
|
||||
|
||||
return m_ContainerData;
|
||||
}
|
||||
|
|
@ -89,7 +71,9 @@ namespace Server.Items
|
|||
base.ItemID = value;
|
||||
|
||||
if (ItemID != oldID)
|
||||
{
|
||||
UpdateContainerData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -123,7 +107,10 @@ namespace Server.Items
|
|||
{
|
||||
get
|
||||
{
|
||||
if (Parent is Container container && container.MaxWeight == 0) return 0;
|
||||
if (Parent is Container container && container.MaxWeight == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return DefaultMaxWeight;
|
||||
}
|
||||
|
|
@ -206,7 +193,9 @@ namespace Server.Items
|
|||
if (IsDecoContainer)
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
SendCantStoreMessage(m, item);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -217,7 +206,9 @@ namespace Server.Items
|
|||
TotalItems + plusItems + item.TotalItems + (item.IsVirtualItem ? 0 : 1) > maxItems)
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
SendFullItemsMessage(m, item);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -225,7 +216,9 @@ namespace Server.Items
|
|||
if (MaxWeight != 0 && TotalWeight + plusWeight + item.TotalWeight + item.PileWeight > MaxWeight)
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
SendFullWeightMessage(m, item);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -236,10 +229,14 @@ namespace Server.Items
|
|||
while (parent != null)
|
||||
{
|
||||
if (parent is Container container)
|
||||
{
|
||||
return container.CheckHold(m, item, message, checkItems, plusItems, plusWeight);
|
||||
}
|
||||
|
||||
if (!(parent is Item parentItem))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
parent = parentItem.Parent;
|
||||
}
|
||||
|
|
@ -265,7 +262,9 @@ namespace Server.Items
|
|||
public virtual bool OnDragDropInto(Mobile from, Item item, Point3D p)
|
||||
{
|
||||
if (!CheckHold(from, item, true, true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
item.Location = new Point3D(p.m_X, p.m_Y, 0);
|
||||
AddItem(item);
|
||||
|
|
@ -280,8 +279,12 @@ namespace Server.Items
|
|||
var t = item.GetType();
|
||||
|
||||
for (var i = 0; i < types.Length; ++i)
|
||||
{
|
||||
if (types[i].IsAssignableFrom(t))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -289,7 +292,9 @@ namespace Server.Items
|
|||
private static void SetSaveFlag(ref SaveFlag flags, SaveFlag toSet, bool setIf)
|
||||
{
|
||||
if (setIf)
|
||||
{
|
||||
flags |= toSet;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool GetSaveFlag(SaveFlag flags, SaveFlag toGet) => (flags & toGet) != 0;
|
||||
|
|
@ -310,13 +315,19 @@ namespace Server.Items
|
|||
writer.Write((byte)flags);
|
||||
|
||||
if (GetSaveFlag(flags, SaveFlag.MaxItems))
|
||||
{
|
||||
writer.WriteEncodedInt(m_MaxItems);
|
||||
}
|
||||
|
||||
if (GetSaveFlag(flags, SaveFlag.GumpID))
|
||||
{
|
||||
writer.WriteEncodedInt(m_GumpID);
|
||||
}
|
||||
|
||||
if (GetSaveFlag(flags, SaveFlag.DropSound))
|
||||
{
|
||||
writer.WriteEncodedInt(m_DropSound);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
|
|
@ -332,19 +343,31 @@ namespace Server.Items
|
|||
var flags = (SaveFlag)reader.ReadByte();
|
||||
|
||||
if (GetSaveFlag(flags, SaveFlag.MaxItems))
|
||||
{
|
||||
m_MaxItems = reader.ReadEncodedInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_MaxItems = -1;
|
||||
}
|
||||
|
||||
if (GetSaveFlag(flags, SaveFlag.GumpID))
|
||||
{
|
||||
m_GumpID = reader.ReadEncodedInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_GumpID = -1;
|
||||
}
|
||||
|
||||
if (GetSaveFlag(flags, SaveFlag.DropSound))
|
||||
{
|
||||
m_DropSound = reader.ReadEncodedInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_DropSound = -1;
|
||||
}
|
||||
|
||||
LiftOverride = GetSaveFlag(flags, SaveFlag.LiftOverride);
|
||||
|
||||
|
|
@ -358,19 +381,27 @@ namespace Server.Items
|
|||
case 0:
|
||||
{
|
||||
if (version < 1)
|
||||
{
|
||||
m_MaxItems = GlobalMaxItems;
|
||||
}
|
||||
|
||||
m_GumpID = reader.ReadInt();
|
||||
m_DropSound = reader.ReadInt();
|
||||
|
||||
if (m_GumpID == DefaultGumpID)
|
||||
{
|
||||
m_GumpID = -1;
|
||||
}
|
||||
|
||||
if (m_DropSound == DefaultDropSound)
|
||||
{
|
||||
m_DropSound = -1;
|
||||
}
|
||||
|
||||
if (m_MaxItems == DefaultMaxItems)
|
||||
{
|
||||
m_MaxItems = -1;
|
||||
}
|
||||
|
||||
// m_Bounds = new Rectangle2D( reader.ReadPoint2D(), reader.ReadPoint2D() );
|
||||
reader.ReadPoint2D();
|
||||
|
|
@ -397,6 +428,7 @@ namespace Server.Items
|
|||
public override void UpdateTotal(Item sender, TotalType type, int delta)
|
||||
{
|
||||
if (sender != this && delta != 0 && !sender.IsVirtualItem)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case TotalType.Gold:
|
||||
|
|
@ -413,6 +445,7 @@ namespace Server.Items
|
|||
InvalidateProperties();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
base.UpdateTotal(sender, type, delta);
|
||||
}
|
||||
|
|
@ -426,7 +459,9 @@ namespace Server.Items
|
|||
var items = m_Items;
|
||||
|
||||
if (items == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < items.Count; ++i)
|
||||
{
|
||||
|
|
@ -435,7 +470,9 @@ namespace Server.Items
|
|||
item.UpdateTotals();
|
||||
|
||||
if (item.IsVirtualItem)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
m_TotalGold += item.TotalGold;
|
||||
m_TotalItems += item.TotalItems + 1;
|
||||
|
|
@ -471,7 +508,9 @@ namespace Server.Items
|
|||
|
||||
if (!(item is Container) && CheckHold(from, dropped, false, false) &&
|
||||
item.StackWith(from, dropped, playSound))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (CheckHold(from, dropped, sendFullMessage, true))
|
||||
|
|
@ -525,10 +564,14 @@ namespace Server.Items
|
|||
if (dropItems.Count + stackItems.Count == droppedItems.Length) // All good
|
||||
{
|
||||
for (var i = 0; i < dropItems.Count; i++)
|
||||
{
|
||||
DropItem(dropItems[i]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < stackItems.Count; i++)
|
||||
stackItems[i].m_StackItem.StackWith(from, stackItems[i].m_DropItem, false);
|
||||
{
|
||||
stackItems[i].m_StackItem.StackWith(@from, stackItems[i].m_DropItem, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -542,11 +585,13 @@ namespace Server.Items
|
|||
var map = Map;
|
||||
|
||||
for (var i = Items.Count - 1; i >= 0; --i)
|
||||
{
|
||||
if (i < Items.Count)
|
||||
{
|
||||
Items[i].SetLastMoved();
|
||||
Items[i].MoveToWorld(loc, map);
|
||||
}
|
||||
}
|
||||
|
||||
Delete();
|
||||
}
|
||||
|
|
@ -554,7 +599,9 @@ namespace Server.Items
|
|||
public virtual void DropItem(Item dropped)
|
||||
{
|
||||
if (dropped == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AddItem(dropped);
|
||||
|
||||
|
|
@ -564,14 +611,22 @@ namespace Server.Items
|
|||
int x, y;
|
||||
|
||||
if (bounds.Width >= ourBounds.Width)
|
||||
{
|
||||
x = (ourBounds.Width - bounds.Width) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = Utility.Random(ourBounds.Width - bounds.Width);
|
||||
}
|
||||
|
||||
if (bounds.Height >= ourBounds.Height)
|
||||
{
|
||||
y = (ourBounds.Height - bounds.Height) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
y = Utility.Random(ourBounds.Height - bounds.Height);
|
||||
}
|
||||
|
||||
x += ourBounds.X;
|
||||
x -= bounds.X;
|
||||
|
|
@ -593,9 +648,13 @@ namespace Server.Items
|
|||
if (trade != null)
|
||||
{
|
||||
if (trade.From.Mobile == from)
|
||||
{
|
||||
DisplayTo(trade.To.Mobile);
|
||||
}
|
||||
else if (trade.To.Mobile == from)
|
||||
{
|
||||
DisplayTo(trade.From.Mobile);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -614,7 +673,10 @@ namespace Server.Items
|
|||
base.OnSingleClick(from);
|
||||
|
||||
if (CheckContentDisplay(from))
|
||||
LabelTo(from, "({0} item{2}, {1} stones)", TotalItems, TotalWeight, TotalItems != 1 ? "s" : string.Empty);
|
||||
{
|
||||
LabelTo(@from, "({0} item{2}, {1} stones)", TotalItems, TotalWeight, TotalItems != 1 ? "s" : string.Empty);
|
||||
}
|
||||
|
||||
// LabelTo( from, 1050044, String.Format( "{0}\t{1}", TotalItems.ToString(), TotalWeight.ToString() ) );
|
||||
}
|
||||
|
||||
|
|
@ -634,9 +696,13 @@ namespace Server.Items
|
|||
if (ns != null)
|
||||
{
|
||||
if (ns.HighSeas)
|
||||
{
|
||||
to.Send(new ContainerDisplayHS(Serial, GumpID));
|
||||
}
|
||||
else
|
||||
{
|
||||
to.Send(new ContainerDisplay(Serial, GumpID));
|
||||
}
|
||||
|
||||
SendContentTo(ns);
|
||||
|
||||
|
|
@ -645,7 +711,9 @@ namespace Server.Items
|
|||
var items = Items;
|
||||
|
||||
for (var i = 0; i < items.Count; ++i)
|
||||
{
|
||||
to.Send(items[i].OPLPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -653,7 +721,9 @@ namespace Server.Items
|
|||
public void ProcessOpeners(Mobile opener)
|
||||
{
|
||||
if (IsPublicContainer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var contains = false;
|
||||
|
||||
|
|
@ -675,7 +745,9 @@ namespace Server.Items
|
|||
var range = GetUpdateRange(mob);
|
||||
|
||||
if (mob.Map != map || !mob.InRange(worldLoc, range))
|
||||
{
|
||||
Openers.RemoveAt(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -695,12 +767,18 @@ namespace Server.Items
|
|||
public virtual void SendContentTo(NetState state)
|
||||
{
|
||||
if (state == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (state.ContainerGridLines)
|
||||
{
|
||||
state.Send(new ContainerContent6017(state.Mobile, this));
|
||||
}
|
||||
else
|
||||
{
|
||||
state.Send(new ContainerContent(state.Mobile, this));
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
|
|
@ -712,6 +790,7 @@ namespace Server.Items
|
|||
if (Core.ML)
|
||||
{
|
||||
if (ParentsContain<BankBox>()) // Root Parent is the Mobile. Parent could be another containter.
|
||||
{
|
||||
list.Add(
|
||||
1073841,
|
||||
"{0}\t{1}\t{2}",
|
||||
|
|
@ -719,7 +798,9 @@ namespace Server.Items
|
|||
MaxItems,
|
||||
TotalWeight
|
||||
); // Contents: ~1_COUNT~/~2_MAXCOUNT~ items, ~3_WEIGHT~ stones
|
||||
}
|
||||
else
|
||||
{
|
||||
list.Add(
|
||||
1072241,
|
||||
"{0}\t{1}\t{2}\t{3}",
|
||||
|
|
@ -728,6 +809,7 @@ namespace Server.Items
|
|||
TotalWeight,
|
||||
MaxWeight
|
||||
); // Contents: ~1_COUNT~/~2_MAXCOUNT~ items, ~3_WEIGHT~/~4_MAXWEIGHT~ stones
|
||||
}
|
||||
|
||||
// TODO: Where do the other clilocs come into play? 1073839 & 1073840?
|
||||
}
|
||||
|
|
@ -741,15 +823,21 @@ namespace Server.Items
|
|||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from.AccessLevel > AccessLevel.Player || from.InRange(GetWorldLocation(), 2))
|
||||
DisplayTo(from);
|
||||
{
|
||||
DisplayTo(@from);
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage(500446); // That is too far away.
|
||||
{
|
||||
@from.SendLocalizedMessage(500446); // That is too far away.
|
||||
}
|
||||
}
|
||||
|
||||
public bool ConsumeTotalGrouped(Type type, int amount, bool recurse, OnItemConsumed callback, CheckItemGroup grouper)
|
||||
{
|
||||
if (grouper == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(grouper));
|
||||
}
|
||||
|
||||
var typedItems = FindItemsByType(type, recurse);
|
||||
|
||||
|
|
@ -769,9 +857,13 @@ namespace Server.Items
|
|||
var v = grouper(a, b);
|
||||
|
||||
if (v == 0)
|
||||
group.Add(b);
|
||||
{
|
||||
@group.Add(b);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
++idx;
|
||||
}
|
||||
|
|
@ -789,16 +881,23 @@ namespace Server.Items
|
|||
items[i] = groups[i].ToArray();
|
||||
|
||||
for (var j = 0; j < items[i].Length; ++j)
|
||||
{
|
||||
totals[i] += items[i][j].Amount;
|
||||
}
|
||||
|
||||
if (totals[i] >= amount)
|
||||
{
|
||||
hasEnough = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasEnough)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var i = 0; i < items.Length; ++i)
|
||||
{
|
||||
if (totals[i] >= amount)
|
||||
{
|
||||
var need = amount;
|
||||
|
|
@ -827,6 +926,7 @@ namespace Server.Items
|
|||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -837,9 +937,14 @@ namespace Server.Items
|
|||
)
|
||||
{
|
||||
if (types.Length != amounts.Length)
|
||||
{
|
||||
throw new ArgumentException("length of types and amounts must match");
|
||||
}
|
||||
|
||||
if (grouper == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(grouper));
|
||||
}
|
||||
|
||||
var items = new Item[types.Length][][];
|
||||
var totals = new int[types.Length][];
|
||||
|
|
@ -864,9 +969,13 @@ namespace Server.Items
|
|||
var v = grouper(a, b);
|
||||
|
||||
if (v == 0)
|
||||
group.Add(b);
|
||||
{
|
||||
@group.Add(b);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
++idx;
|
||||
}
|
||||
|
|
@ -884,18 +993,26 @@ namespace Server.Items
|
|||
items[i][j] = groups[j].ToArray();
|
||||
|
||||
for (var k = 0; k < items[i][j].Length; ++k)
|
||||
{
|
||||
totals[i][j] += items[i][j][k].Amount;
|
||||
}
|
||||
|
||||
if (totals[i][j] >= amounts[i])
|
||||
{
|
||||
hasEnough = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasEnough)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < items.Length; ++i)
|
||||
{
|
||||
for (var j = 0; j < items[i].Length; ++j)
|
||||
{
|
||||
if (totals[i][j] >= amounts[i])
|
||||
{
|
||||
var need = amounts[i];
|
||||
|
|
@ -924,6 +1041,8 @@ namespace Server.Items
|
|||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -934,9 +1053,14 @@ namespace Server.Items
|
|||
)
|
||||
{
|
||||
if (types.Length != amounts.Length)
|
||||
{
|
||||
throw new ArgumentException("length of types and amounts must match");
|
||||
}
|
||||
|
||||
if (grouper == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(grouper));
|
||||
}
|
||||
|
||||
var items = new Item[types.Length][][];
|
||||
var totals = new int[types.Length][];
|
||||
|
|
@ -961,9 +1085,13 @@ namespace Server.Items
|
|||
var v = grouper(a, b);
|
||||
|
||||
if (v == 0)
|
||||
group.Add(b);
|
||||
{
|
||||
@group.Add(b);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
++idx;
|
||||
}
|
||||
|
|
@ -981,18 +1109,26 @@ namespace Server.Items
|
|||
items[i][j] = groups[j].ToArray();
|
||||
|
||||
for (var k = 0; k < items[i][j].Length; ++k)
|
||||
{
|
||||
totals[i][j] += items[i][j][k].Amount;
|
||||
}
|
||||
|
||||
if (totals[i][j] >= amounts[i])
|
||||
{
|
||||
hasEnough = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasEnough)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < items.Length; ++i)
|
||||
{
|
||||
for (var j = 0; j < items[i].Length; ++j)
|
||||
{
|
||||
if (totals[i][j] >= amounts[i])
|
||||
{
|
||||
var need = amounts[i];
|
||||
|
|
@ -1021,6 +1157,8 @@ namespace Server.Items
|
|||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -1028,7 +1166,9 @@ namespace Server.Items
|
|||
public int ConsumeTotal(Type[][] types, int[] amounts, bool recurse = true, OnItemConsumed callback = null)
|
||||
{
|
||||
if (types.Length != amounts.Length)
|
||||
{
|
||||
throw new ArgumentException("length of types and amounts must match");
|
||||
}
|
||||
|
||||
var items = new Item[types.Length][];
|
||||
var totals = new int[types.Length];
|
||||
|
|
@ -1038,10 +1178,14 @@ namespace Server.Items
|
|||
items[i] = FindItemsByType(types[i], recurse);
|
||||
|
||||
for (var j = 0; j < items[i].Length; ++j)
|
||||
{
|
||||
totals[i] += items[i][j].Amount;
|
||||
}
|
||||
|
||||
if (totals[i] < amounts[i])
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < types.Length; ++i)
|
||||
|
|
@ -1077,7 +1221,9 @@ namespace Server.Items
|
|||
public int ConsumeTotal(Type[] types, int[] amounts, bool recurse = true, OnItemConsumed callback = null)
|
||||
{
|
||||
if (types.Length != amounts.Length)
|
||||
{
|
||||
throw new ArgumentException("length of types and amounts must match");
|
||||
}
|
||||
|
||||
var items = new Item[types.Length][];
|
||||
var totals = new int[types.Length];
|
||||
|
|
@ -1087,10 +1233,14 @@ namespace Server.Items
|
|||
items[i] = FindItemsByType(types[i], recurse);
|
||||
|
||||
for (var j = 0; j < items[i].Length; ++j)
|
||||
{
|
||||
totals[i] += items[i][j].Amount;
|
||||
}
|
||||
|
||||
if (totals[i] < amounts[i])
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < types.Length; ++i)
|
||||
|
|
@ -1131,7 +1281,9 @@ namespace Server.Items
|
|||
var total = 0;
|
||||
|
||||
for (var i = 0; i < items.Length; ++i)
|
||||
{
|
||||
total += items[i].Amount;
|
||||
}
|
||||
|
||||
if (total >= amount)
|
||||
{
|
||||
|
|
@ -1175,7 +1327,9 @@ namespace Server.Items
|
|||
RecurseConsumeUpTo(this, type, amount, recurse, ref consumed, toDelete);
|
||||
|
||||
while (toDelete.Count > 0)
|
||||
{
|
||||
toDelete.Dequeue().Delete();
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
|
@ -1186,7 +1340,9 @@ namespace Server.Items
|
|||
)
|
||||
{
|
||||
if (current == null || current.Items.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var list = current.Items;
|
||||
|
||||
|
|
@ -1222,7 +1378,9 @@ namespace Server.Items
|
|||
public int GetBestGroupAmount(Type type, bool recurse, CheckItemGroup grouper)
|
||||
{
|
||||
if (grouper == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(grouper));
|
||||
}
|
||||
|
||||
var best = 0;
|
||||
|
||||
|
|
@ -1244,9 +1402,13 @@ namespace Server.Items
|
|||
var v = grouper(a, b);
|
||||
|
||||
if (v == 0)
|
||||
group.Add(b);
|
||||
{
|
||||
@group.Add(b);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
++idx;
|
||||
}
|
||||
|
|
@ -1261,10 +1423,14 @@ namespace Server.Items
|
|||
var total = 0;
|
||||
|
||||
for (var j = 0; j < items.Length; ++j)
|
||||
{
|
||||
total += items[j].Amount;
|
||||
}
|
||||
|
||||
if (total >= best)
|
||||
{
|
||||
best = total;
|
||||
}
|
||||
}
|
||||
|
||||
return best;
|
||||
|
|
@ -1273,7 +1439,9 @@ namespace Server.Items
|
|||
public int GetBestGroupAmount(Type[] types, bool recurse, CheckItemGroup grouper)
|
||||
{
|
||||
if (grouper == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(grouper));
|
||||
}
|
||||
|
||||
var best = 0;
|
||||
|
||||
|
|
@ -1295,9 +1463,13 @@ namespace Server.Items
|
|||
var v = grouper(a, b);
|
||||
|
||||
if (v == 0)
|
||||
group.Add(b);
|
||||
{
|
||||
@group.Add(b);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
++idx;
|
||||
}
|
||||
|
|
@ -1311,7 +1483,9 @@ namespace Server.Items
|
|||
var total = items.Sum(t => t.Amount);
|
||||
|
||||
if (total >= best)
|
||||
{
|
||||
best = total;
|
||||
}
|
||||
}
|
||||
|
||||
return best;
|
||||
|
|
@ -1320,7 +1494,9 @@ namespace Server.Items
|
|||
public int GetBestGroupAmount(Type[][] types, bool recurse, CheckItemGroup grouper)
|
||||
{
|
||||
if (grouper == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(grouper));
|
||||
}
|
||||
|
||||
var best = 0;
|
||||
|
||||
|
|
@ -1344,9 +1520,13 @@ namespace Server.Items
|
|||
var v = grouper(a, b);
|
||||
|
||||
if (v == 0)
|
||||
group.Add(b);
|
||||
{
|
||||
@group.Add(b);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
++idx;
|
||||
}
|
||||
|
|
@ -1360,10 +1540,14 @@ namespace Server.Items
|
|||
var total = 0;
|
||||
|
||||
for (var k = 0; k < items.Length; ++k)
|
||||
{
|
||||
total += items[k].Amount;
|
||||
}
|
||||
|
||||
if (total >= best)
|
||||
{
|
||||
best = total;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1377,7 +1561,9 @@ namespace Server.Items
|
|||
public Item[] FindItemsByType(Type type, bool recurse = true)
|
||||
{
|
||||
if (m_FindItemsList.Count > 0)
|
||||
{
|
||||
m_FindItemsList.Clear();
|
||||
}
|
||||
|
||||
RecurseFindItemsByType(this, type, recurse, m_FindItemsList);
|
||||
|
||||
|
|
@ -1387,7 +1573,9 @@ namespace Server.Items
|
|||
private static void RecurseFindItemsByType(Item current, Type type, bool recurse, List<Item> list)
|
||||
{
|
||||
if (current == null || current.Items.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var items = current.Items;
|
||||
|
||||
|
|
@ -1396,17 +1584,23 @@ namespace Server.Items
|
|||
var item = items[i];
|
||||
|
||||
if (type.IsInstanceOfType(item))
|
||||
{
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
if (recurse && item is Container)
|
||||
{
|
||||
RecurseFindItemsByType(item, type, true, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Item[] FindItemsByType(Type[] types, bool recurse = true)
|
||||
{
|
||||
if (m_FindItemsList.Count > 0)
|
||||
{
|
||||
m_FindItemsList.Clear();
|
||||
}
|
||||
|
||||
RecurseFindItemsByType(this, types, recurse, m_FindItemsList);
|
||||
|
||||
|
|
@ -1416,7 +1610,9 @@ namespace Server.Items
|
|||
private static void RecurseFindItemsByType(Item current, Type[] types, bool recurse, List<Item> list)
|
||||
{
|
||||
if (current == null || current.Items.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var items = current.Items;
|
||||
|
||||
|
|
@ -1425,10 +1621,14 @@ namespace Server.Items
|
|||
var item = items[i];
|
||||
|
||||
if (InTypeList(item, types))
|
||||
{
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
if (recurse && item is Container)
|
||||
{
|
||||
RecurseFindItemsByType(item, types, true, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1437,7 +1637,9 @@ namespace Server.Items
|
|||
private static Item RecurseFindItemByType(Item current, Type type, bool recurse)
|
||||
{
|
||||
if (current == null || current.Items.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var list = current.Items;
|
||||
|
||||
|
|
@ -1446,14 +1648,18 @@ namespace Server.Items
|
|||
var item = list[i];
|
||||
|
||||
if (type.IsInstanceOfType(item))
|
||||
{
|
||||
return item;
|
||||
}
|
||||
|
||||
if (recurse && item is Container)
|
||||
{
|
||||
var check = RecurseFindItemByType(item, type, true);
|
||||
|
||||
if (check != null)
|
||||
{
|
||||
return check;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1465,7 +1671,9 @@ namespace Server.Items
|
|||
private static Item RecurseFindItemByType(Item current, Type[] types, bool recurse)
|
||||
{
|
||||
if (current == null || current.Items.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var list = current.Items;
|
||||
|
||||
|
|
@ -1473,14 +1681,19 @@ namespace Server.Items
|
|||
{
|
||||
var item = list[i];
|
||||
|
||||
if (InTypeList(item, types)) return item;
|
||||
if (InTypeList(item, types))
|
||||
{
|
||||
return item;
|
||||
}
|
||||
|
||||
if (recurse && item is Container)
|
||||
{
|
||||
var check = RecurseFindItemByType(item, types, true);
|
||||
|
||||
if (check != null)
|
||||
{
|
||||
return check;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1517,10 +1730,16 @@ namespace Server.Items
|
|||
{
|
||||
var container = queue.Dequeue();
|
||||
foreach (var item in container.Items)
|
||||
{
|
||||
if (item is T typedItem && predicate?.Invoke(typedItem) != false)
|
||||
{
|
||||
items.Add(typedItem);
|
||||
}
|
||||
else if (recurse && item is Container itemContainer)
|
||||
{
|
||||
queue.Enqueue(itemContainer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
|
|
@ -1556,9 +1775,14 @@ namespace Server.Items
|
|||
foreach (var item in container.Items)
|
||||
{
|
||||
if (item is T typedItem && predicate?.Invoke(typedItem) != false)
|
||||
{
|
||||
return typedItem;
|
||||
}
|
||||
|
||||
if (recurse && item is Container itemContainer)
|
||||
{
|
||||
queue.Enqueue(itemContainer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1623,7 +1847,9 @@ namespace Server.Items
|
|||
line = line.Trim();
|
||||
|
||||
if (line.Length == 0 || line.StartsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -1635,7 +1861,9 @@ namespace Server.Items
|
|||
|
||||
var aRect = split[1].Split(' ');
|
||||
if (aRect.Length < 4)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var x = Utility.ToInt32(aRect[0]);
|
||||
var y = Utility.ToInt32(aRect[1]);
|
||||
|
|
@ -1659,9 +1887,13 @@ namespace Server.Items
|
|||
var id = Utility.ToInt32(aIDs[i]);
|
||||
|
||||
if (m_Table.ContainsKey(id))
|
||||
{
|
||||
Console.WriteLine(@"Warning: double ItemID entry in Data\containers.cfg");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Table[id] = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* Containers.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Accounting;
|
||||
using Server.Network;
|
||||
|
||||
|
|
@ -88,14 +68,18 @@ namespace Server.Items
|
|||
Opened = reader.ReadBool();
|
||||
|
||||
if (Owner == null)
|
||||
{
|
||||
Delete();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ItemID == 0xE41)
|
||||
{
|
||||
ItemID = 0xE7C;
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
|
@ -103,7 +87,9 @@ namespace Server.Items
|
|||
Opened = false;
|
||||
|
||||
if (SendDeleteOnClose)
|
||||
{
|
||||
Owner?.Send(RemovePacket);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
|
|
@ -129,7 +115,9 @@ namespace Server.Items
|
|||
public override int GetTotal(TotalType type)
|
||||
{
|
||||
if (AccountGold.Enabled && Owner?.Account != null && type == TotalType.Gold)
|
||||
{
|
||||
return Owner.Account.TotalGold;
|
||||
}
|
||||
|
||||
return base.GetTotal(type);
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* ItemBounds.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: Layer.cs *
|
||||
* *
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: LightType.cs *
|
||||
* *
|
||||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* SecureTradeContainer.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Accounting;
|
||||
using Server.Network;
|
||||
|
||||
|
|
@ -40,7 +20,10 @@ namespace Server.Items
|
|||
|
||||
public override bool CheckHold(Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight)
|
||||
{
|
||||
if (item == Trade.From.VirtualCheck || item == Trade.To.VirtualCheck) return true;
|
||||
if (item == Trade.From.VirtualCheck || item == Trade.To.VirtualCheck)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var to = Trade.From.Container != this ? Trade.From.Mobile : Trade.To.Mobile;
|
||||
|
||||
|
|
@ -59,37 +42,51 @@ namespace Server.Items
|
|||
public override void OnItemAdded(Item item)
|
||||
{
|
||||
if (!(item is VirtualCheck))
|
||||
{
|
||||
ClearChecks();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnItemRemoved(Item item)
|
||||
{
|
||||
if (!(item is VirtualCheck))
|
||||
{
|
||||
ClearChecks();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSubItemAdded(Item item)
|
||||
{
|
||||
if (!(item is VirtualCheck))
|
||||
{
|
||||
ClearChecks();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSubItemRemoved(Item item)
|
||||
{
|
||||
if (!(item is VirtualCheck))
|
||||
{
|
||||
ClearChecks();
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearChecks()
|
||||
{
|
||||
if (Trade == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Trade.From?.IsDisposed == false)
|
||||
{
|
||||
Trade.From.Accepted = false;
|
||||
}
|
||||
|
||||
if (Trade.To?.IsDisposed == false)
|
||||
{
|
||||
Trade.To.Accepted = false;
|
||||
}
|
||||
|
||||
Trade.Update();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: VirtualCheck.cs *
|
||||
* *
|
||||
|
|
@ -78,7 +78,10 @@ namespace Server.Items
|
|||
{
|
||||
var c = GetSecureTradeCont();
|
||||
|
||||
if (check == null || c == null) return base.IsAccessibleTo(check);
|
||||
if (check == null || c == null)
|
||||
{
|
||||
return base.IsAccessibleTo(check);
|
||||
}
|
||||
|
||||
return c.RootParent == check && IsChildOf(c);
|
||||
}
|
||||
|
|
@ -125,11 +128,19 @@ namespace Server.Items
|
|||
{
|
||||
var c = GetSecureTradeCont();
|
||||
|
||||
if (c?.Trade == null) return;
|
||||
if (c?.Trade == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (user == c.Trade.From.Mobile)
|
||||
{
|
||||
c.Trade.UpdateFromCurrency();
|
||||
else if (user == c.Trade.To.Mobile) c.Trade.UpdateToCurrency();
|
||||
}
|
||||
else if (user == c.Trade.To.Mobile)
|
||||
{
|
||||
c.Trade.UpdateToCurrency();
|
||||
}
|
||||
|
||||
c.ClearChecks();
|
||||
}
|
||||
|
|
@ -194,7 +205,9 @@ namespace Server.Items
|
|||
base.OnServerClose(owner);
|
||||
|
||||
if (Check?.Deleted == false)
|
||||
{
|
||||
Check.UpdateTrade(User);
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
|
@ -202,17 +215,25 @@ namespace Server.Items
|
|||
User.CloseGump<EditGump>();
|
||||
|
||||
if (Check?.Deleted == false)
|
||||
{
|
||||
Check.UpdateTrade(User);
|
||||
}
|
||||
else
|
||||
{
|
||||
Check = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Send()
|
||||
{
|
||||
if (Check?.Deleted == false)
|
||||
{
|
||||
User.SendGump(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void Refresh(bool recompile)
|
||||
|
|
@ -224,7 +245,9 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
if (recompile)
|
||||
{
|
||||
CompileLayout();
|
||||
}
|
||||
|
||||
Close();
|
||||
Send();
|
||||
|
|
@ -233,7 +256,9 @@ namespace Server.Items
|
|||
private void CompileLayout()
|
||||
{
|
||||
if (Check?.Deleted != false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Entries.ForEach(e => e.Parent = null);
|
||||
Entries.Clear();
|
||||
|
|
@ -353,7 +378,9 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
if (updated)
|
||||
{
|
||||
User.SendMessage("Your offer has been updated.");
|
||||
}
|
||||
|
||||
if (refresh && Check?.Deleted == false)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* VirtualHair.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: IPEndPointConverter.cs *
|
||||
* *
|
||||
|
|
@ -25,7 +25,9 @@ namespace Server.Json
|
|||
public override IPEndPoint Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
if (IPEndPoint.TryParse(reader.GetString(), out var ipep))
|
||||
{
|
||||
return ipep;
|
||||
}
|
||||
|
||||
throw new JsonException("IPEndPoint must be in the correct format");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: IPEndPointConverterFactory.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: MapConverter.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: MapConverterFactory.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: NullableStructSerializer.cs *
|
||||
* *
|
||||
|
|
@ -25,9 +25,13 @@ namespace System.Text.Json.Serialization
|
|||
public override void Write(Utf8JsonWriter writer, TStruct? value, JsonSerializerOptions options)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
writer.WriteNullValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
JsonSerializer.Serialize(writer, value.Value, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: NullableStructSerializerFactory.cs *
|
||||
* *
|
||||
|
|
@ -20,7 +20,9 @@ namespace System.Text.Json.Serialization
|
|||
public override bool CanConvert(Type typeToConvert)
|
||||
{
|
||||
if (!typeToConvert.IsGenericType || typeToConvert.GetGenericTypeDefinition() != typeof(Nullable<>))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var structType = typeToConvert.GenericTypeArguments[0];
|
||||
return !structType.IsPrimitive && structType.Namespace?.StartsWith(nameof(System)) != true && !structType.IsEnum;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: Point2DConverter.cs *
|
||||
* *
|
||||
|
|
@ -30,19 +30,25 @@ namespace Server.Json
|
|||
{
|
||||
reader.Read();
|
||||
if (reader.TokenType == JsonTokenType.EndArray)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (reader.TokenType == JsonTokenType.Number)
|
||||
{
|
||||
if (count < 2)
|
||||
{
|
||||
data[count] = reader.GetInt32();
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count > 2)
|
||||
{
|
||||
throw new JsonException("Point2D must be an array of x, y");
|
||||
}
|
||||
|
||||
return new Point2D(data[0], data[1]);
|
||||
}
|
||||
|
|
@ -55,10 +61,14 @@ namespace Server.Json
|
|||
{
|
||||
reader.Read();
|
||||
if (reader.TokenType == JsonTokenType.EndObject)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (reader.TokenType != JsonTokenType.PropertyName)
|
||||
{
|
||||
throw new JsonException("Invalid json structure for Point2D object");
|
||||
}
|
||||
|
||||
var key = reader.GetString();
|
||||
|
||||
|
|
@ -72,7 +82,9 @@ namespace Server.Json
|
|||
reader.Read();
|
||||
|
||||
if (reader.TokenType != JsonTokenType.Number)
|
||||
{
|
||||
throw new JsonException($"Value for {key} must be a number");
|
||||
}
|
||||
|
||||
data[i] = reader.GetInt32();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: Point2DConverterFactory.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: Point3DConverter.cs *
|
||||
* *
|
||||
|
|
@ -30,19 +30,25 @@ namespace Server.Json
|
|||
{
|
||||
reader.Read();
|
||||
if (reader.TokenType == JsonTokenType.EndArray)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (reader.TokenType == JsonTokenType.Number)
|
||||
{
|
||||
if (count < 3)
|
||||
{
|
||||
data[count] = reader.GetInt32();
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count > 3)
|
||||
{
|
||||
throw new JsonException("Point3D must be an array of x, y, z");
|
||||
}
|
||||
|
||||
return new Point3D(data[0], data[1], data[2]);
|
||||
}
|
||||
|
|
@ -55,10 +61,14 @@ namespace Server.Json
|
|||
{
|
||||
reader.Read();
|
||||
if (reader.TokenType == JsonTokenType.EndObject)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (reader.TokenType != JsonTokenType.PropertyName)
|
||||
{
|
||||
throw new JsonException("Invalid json structure for Point3D object");
|
||||
}
|
||||
|
||||
var key = reader.GetString();
|
||||
|
||||
|
|
@ -73,7 +83,9 @@ namespace Server.Json
|
|||
reader.Read();
|
||||
|
||||
if (reader.TokenType != JsonTokenType.Number)
|
||||
{
|
||||
throw new JsonException($"Value for {key} must be a number");
|
||||
}
|
||||
|
||||
data[i] = reader.GetInt32();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: Point3DConverterFactory.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: Rectangle3DConverter.cs *
|
||||
* *
|
||||
|
|
@ -30,19 +30,25 @@ namespace Server.Json
|
|||
{
|
||||
reader.Read();
|
||||
if (reader.TokenType == JsonTokenType.EndArray)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (reader.TokenType == JsonTokenType.Number)
|
||||
{
|
||||
if (count < 6)
|
||||
{
|
||||
data[count] = reader.GetInt32();
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count > 6)
|
||||
{
|
||||
throw new JsonException("Rectangle3D must be an array of x, y, z, h, w, d");
|
||||
}
|
||||
|
||||
return new Rectangle3D(data[0], data[1], data[2], data[3], data[4], data[5]);
|
||||
}
|
||||
|
|
@ -59,10 +65,14 @@ namespace Server.Json
|
|||
{
|
||||
reader.Read();
|
||||
if (reader.TokenType == JsonTokenType.EndObject)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (reader.TokenType != JsonTokenType.PropertyName)
|
||||
{
|
||||
throw new JsonException("Invalid json structure for Rectangle3D object");
|
||||
}
|
||||
|
||||
var key = reader.GetString();
|
||||
|
||||
|
|
@ -71,7 +81,9 @@ namespace Server.Json
|
|||
if (key == "start" || key == "end")
|
||||
{
|
||||
if (objType > -1 && objType != 2)
|
||||
{
|
||||
throw new JsonException("Rectangle3D must have a start/end, or x/y/z/w/h/d, but not both.");
|
||||
}
|
||||
|
||||
objType = 2;
|
||||
|
||||
|
|
@ -107,20 +119,31 @@ namespace Server.Json
|
|||
if (i < 10)
|
||||
{
|
||||
if (objType > -1 && objType != 0)
|
||||
{
|
||||
throw new JsonException("Rectangle3D must have a start/end, or x/y/z/w/h/d, but not both.");
|
||||
}
|
||||
|
||||
objType = 0;
|
||||
data[i] = reader.GetInt32();
|
||||
if (i == 2) hasZ = true;
|
||||
if (i == 2)
|
||||
{
|
||||
hasZ = true;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (objType > -1 && objType != 1)
|
||||
{
|
||||
throw new JsonException("Rectangle3D must have a start/end, or x/y/z/w/h/d, but not both.");
|
||||
}
|
||||
|
||||
objType = 1;
|
||||
data[i - 10] = reader.GetInt32();
|
||||
if (i == 12 || i == 15) hasZ = true;
|
||||
if (i == 12 || i == 15)
|
||||
{
|
||||
hasZ = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasZ)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: Rectangle3DConverterFactory.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: TimeSpanConverter.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: TimeSpanConverterFactory.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: TypeConverter.cs *
|
||||
* *
|
||||
|
|
@ -24,7 +24,9 @@ namespace Server.Json
|
|||
public override Type Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
if (reader.TokenType != JsonTokenType.String)
|
||||
{
|
||||
throw new JsonException("The JSON value could not be converted to System.Type");
|
||||
}
|
||||
|
||||
return AssemblyHandler.FindFirstTypeForName(reader.GetString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: TypeConverterFactory.cs *
|
||||
* *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: WorldLocationConverter.cs *
|
||||
* *
|
||||
|
|
@ -32,14 +32,20 @@ namespace Server.Json
|
|||
{
|
||||
reader.Read();
|
||||
if (reader.TokenType == JsonTokenType.EndArray)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (reader.TokenType == JsonTokenType.Number)
|
||||
{
|
||||
if (count < 3)
|
||||
{
|
||||
data[count] = reader.GetInt32();
|
||||
}
|
||||
else if (count == 3)
|
||||
{
|
||||
map = Map.Maps[reader.GetInt32()];
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
|
|
@ -52,7 +58,9 @@ namespace Server.Json
|
|||
}
|
||||
|
||||
if (!hasMap || count < 3 || count > 4)
|
||||
{
|
||||
throw new JsonException("WorldLocation must be an array of x, y, z, and map");
|
||||
}
|
||||
|
||||
return new WorldLocation(data[0], data[1], data[2], map);
|
||||
}
|
||||
|
|
@ -70,10 +78,14 @@ namespace Server.Json
|
|||
{
|
||||
reader.Read();
|
||||
if (reader.TokenType == JsonTokenType.EndObject)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (reader.TokenType != JsonTokenType.PropertyName)
|
||||
{
|
||||
throw new JsonException("Invalid Json structure for WorldLocation object");
|
||||
}
|
||||
|
||||
var key = reader.GetString();
|
||||
|
||||
|
|
@ -88,17 +100,23 @@ namespace Server.Json
|
|||
};
|
||||
|
||||
if (i == 5)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
reader.Read();
|
||||
|
||||
if (i < 3)
|
||||
{
|
||||
if (hasLoc)
|
||||
{
|
||||
throw new JsonException("WorldLocation must have loc or x, y, z, but not both");
|
||||
}
|
||||
|
||||
if (reader.TokenType != JsonTokenType.Number)
|
||||
{
|
||||
throw new JsonException($"Value for {key} must be a number");
|
||||
}
|
||||
|
||||
hasXYZ = true;
|
||||
data[i] = reader.GetInt32();
|
||||
|
|
@ -108,7 +126,9 @@ namespace Server.Json
|
|||
if (i == 3)
|
||||
{
|
||||
if (hasXYZ)
|
||||
{
|
||||
throw new JsonException("WorldLocation must have loc or x, y, z, but not both");
|
||||
}
|
||||
|
||||
hasLoc = true;
|
||||
var loc = new Point3DConverter().Read(ref reader, typeof(Point3D), options);
|
||||
|
|
@ -128,7 +148,9 @@ namespace Server.Json
|
|||
}
|
||||
|
||||
if (!hasMap || count < 2)
|
||||
{
|
||||
throw new JsonException("WorldLocation must have an x, y, z, and map properties");
|
||||
}
|
||||
|
||||
return new WorldLocation(data[0], data[1], data[2], map);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: WorldLocationConverterFactory.cs *
|
||||
* *
|
||||
|
|
|
|||
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