Merges bug fixes and cleanup with master (#17)
This commit is contained in:
parent
39dfe86e10
commit
55136d8842
33 changed files with 157 additions and 234 deletions
|
|
@ -219,29 +219,29 @@ namespace Server.Commands
|
|||
|
||||
if (entry != null)
|
||||
{
|
||||
if (@from.AccessLevel >= entry.AccessLevel)
|
||||
if (from.AccessLevel >= entry.AccessLevel)
|
||||
{
|
||||
if (entry.Handler != null)
|
||||
{
|
||||
CommandEventArgs e = new CommandEventArgs(@from, command, argString, args);
|
||||
CommandEventArgs e = new CommandEventArgs(from, command, argString, args);
|
||||
entry.Handler(e);
|
||||
EventSink.InvokeCommand(e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (@from.AccessLevel <= BadCommandIgnoreLevel)
|
||||
if (from.AccessLevel <= BadCommandIgnoreLevel)
|
||||
return false;
|
||||
|
||||
@from.SendMessage("You do not have access to that command.");
|
||||
from.SendMessage("You do not have access to that command.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (@from.AccessLevel <= BadCommandIgnoreLevel)
|
||||
if (from.AccessLevel <= BadCommandIgnoreLevel)
|
||||
return false;
|
||||
|
||||
@from.SendMessage("That is not a valid command.");
|
||||
from.SendMessage("That is not a valid command.");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace Server
|
|||
void OnConnectionChanged();
|
||||
bool OnCasterMoving(Direction d);
|
||||
bool OnCasterEquipping(Item item);
|
||||
bool OnCasterUsingObject(object o);
|
||||
bool OnCasterUsingObject(IEntity entity);
|
||||
bool OnCastInTown(Region r);
|
||||
}
|
||||
|
||||
|
|
@ -111,4 +111,4 @@ namespace Server
|
|||
void OnBeforeSpawn(Point3D location, Map map);
|
||||
void OnAfterSpawn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1134,10 +1134,8 @@ namespace Server
|
|||
{
|
||||
IEntity p = m_Parent;
|
||||
|
||||
while (p is Item)
|
||||
while (p is Item item)
|
||||
{
|
||||
Item item = (Item)p;
|
||||
|
||||
if (item.m_Parent == null) break;
|
||||
|
||||
p = item.m_Parent;
|
||||
|
|
@ -3349,13 +3347,11 @@ namespace Server
|
|||
{
|
||||
IEntity p = m_Parent;
|
||||
|
||||
while (p is Item)
|
||||
while (p is Item item)
|
||||
{
|
||||
if (p is T)
|
||||
if (item is T)
|
||||
return true;
|
||||
|
||||
Item item = (Item)p;
|
||||
|
||||
if (item.m_Parent == null) break;
|
||||
|
||||
p = item.m_Parent;
|
||||
|
|
@ -3685,15 +3681,13 @@ namespace Server
|
|||
target.Map == null)
|
||||
return false;
|
||||
|
||||
object root = target.RootParent;
|
||||
|
||||
if (from.AccessLevel < AccessLevel.GameMaster && !from.InRange(target.GetWorldLocation(), 2))
|
||||
return false;
|
||||
if (!from.CanSee(target) || !from.InLOS(target))
|
||||
return false;
|
||||
if (!target.IsAccessibleTo(from))
|
||||
return false;
|
||||
if (root is Mobile mobile && !mobile.CheckNonlocalDrop(from, this, target))
|
||||
if (target.RootParent is Mobile mobile && !mobile.CheckNonlocalDrop(from, this, target))
|
||||
return false;
|
||||
if (!from.OnDroppedItemToItem(this, target, p))
|
||||
return false;
|
||||
|
|
@ -4024,12 +4018,12 @@ namespace Server
|
|||
{
|
||||
object p = this;
|
||||
|
||||
while (p is Item)
|
||||
while (p is Item item)
|
||||
{
|
||||
if (p is SecureTradeContainer container)
|
||||
if (item is SecureTradeContainer container)
|
||||
return container;
|
||||
|
||||
p = ((Item)p).m_Parent;
|
||||
p = item.m_Parent;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -4125,10 +4119,8 @@ namespace Server
|
|||
if (p == o)
|
||||
return true;
|
||||
|
||||
while (p is Item)
|
||||
while (p is Item item)
|
||||
{
|
||||
Item item = (Item)p;
|
||||
|
||||
if (item.m_Parent == null)
|
||||
break;
|
||||
|
||||
|
|
@ -4214,22 +4206,22 @@ namespace Server
|
|||
|
||||
NetState ns = from.NetState;
|
||||
|
||||
if (ns != null)
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
if (Name == null)
|
||||
{
|
||||
if (Name == null)
|
||||
{
|
||||
if (m_Amount <= 1)
|
||||
ns.Send(new MessageLocalized(Serial, m_ItemID, MessageType.Label, 0x3B2, 3, LabelNumber, "", ""));
|
||||
else
|
||||
ns.Send(new MessageLocalizedAffix(Serial, m_ItemID, MessageType.Label, 0x3B2, 3, LabelNumber, "",
|
||||
AffixType.Append,
|
||||
$" : {m_Amount}", ""));
|
||||
}
|
||||
if (m_Amount <= 1)
|
||||
ns.Send(new MessageLocalized(Serial, m_ItemID, MessageType.Label, 0x3B2, 3, LabelNumber, "", ""));
|
||||
else
|
||||
{
|
||||
ns.Send(new UnicodeMessage(Serial, m_ItemID, MessageType.Label, 0x3B2, 3, "ENU", "",
|
||||
Name + (m_Amount > 1 ? " : " + m_Amount : "")));
|
||||
}
|
||||
ns.Send(new MessageLocalizedAffix(Serial, m_ItemID, MessageType.Label, 0x3B2, 3, LabelNumber, "",
|
||||
AffixType.Append,
|
||||
$" : {m_Amount}", ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
ns.Send(new UnicodeMessage(Serial, m_ItemID, MessageType.Label, 0x3B2, 3, "ENU", "",
|
||||
Name + (m_Amount > 1 ? " : " + m_Amount : "")));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4296,11 +4288,6 @@ namespace Server
|
|||
Delete();
|
||||
}
|
||||
|
||||
public virtual bool CheckBlessed(object obj)
|
||||
{
|
||||
return CheckBlessed(obj as Mobile);
|
||||
}
|
||||
|
||||
public virtual bool CheckBlessed(Mobile m)
|
||||
{
|
||||
if (m_LootType == LootType.Blessed || Mobile.InsuranceEnabled && Insured)
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
object parent = Parent;
|
||||
IEntity parent = Parent;
|
||||
|
||||
while (parent != null)
|
||||
{
|
||||
|
|
@ -627,15 +627,9 @@ namespace Server.Items
|
|||
|
||||
public virtual bool CheckContentDisplay(Mobile from)
|
||||
{
|
||||
if (DisplaysContent)
|
||||
{
|
||||
object root = RootParent;
|
||||
|
||||
if (root == null || root is Item || root == from || from.AccessLevel > AccessLevel.Player)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return DisplaysContent && RootParent == null ||
|
||||
RootParent is Item || RootParent == from ||
|
||||
from.AccessLevel > AccessLevel.Player;
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
|
|
|
|||
|
|
@ -4667,7 +4667,7 @@ namespace Server
|
|||
if (m_Spell != null && !m_Spell.OnCasterUsingObject(item))
|
||||
return;
|
||||
|
||||
object root = item.RootParent;
|
||||
IEntity root = item.RootParent;
|
||||
bool okay = false;
|
||||
|
||||
if (!Utility.InUpdateRange(this, item.GetWorldLocation()))
|
||||
|
|
@ -4789,7 +4789,7 @@ namespace Server
|
|||
}
|
||||
else
|
||||
{
|
||||
object root = item.RootParent;
|
||||
IEntity root = item.RootParent;
|
||||
|
||||
if (root is Mobile mobile && !mobile.CheckNonlocalLift(from, item))
|
||||
{
|
||||
|
|
@ -4964,7 +4964,7 @@ namespace Server
|
|||
if (DragEffects && !item.Deleted)
|
||||
{
|
||||
Map map = m_Map;
|
||||
object root = item.RootParent;
|
||||
IEntity root = item.RootParent;
|
||||
|
||||
if (map != null && (root == null || root is Item))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -51,12 +51,11 @@ namespace Server
|
|||
{
|
||||
public unsafe void Read(IntPtr ptr, void* buffer, int length)
|
||||
{
|
||||
//UnsafeNativeMethods._lread( ptr, buffer, length );
|
||||
uint lpNumberOfBytesRead = 0;
|
||||
UnsafeNativeMethods.ReadFile(ptr, buffer, (uint)length, ref lpNumberOfBytesRead, null);
|
||||
}
|
||||
|
||||
internal class UnsafeNativeMethods
|
||||
internal static class UnsafeNativeMethods
|
||||
{
|
||||
/*[DllImport("kernel32")]
|
||||
internal unsafe static extern int _lread(IntPtr hFile, void* lpBuffer, int wBytes);*/
|
||||
|
|
@ -74,10 +73,10 @@ namespace Server
|
|||
UnsafeNativeMethods.read(ptr, buffer, length);
|
||||
}
|
||||
|
||||
internal class UnsafeNativeMethods
|
||||
internal static class UnsafeNativeMethods
|
||||
{
|
||||
[DllImport("libc")]
|
||||
internal static extern unsafe int read(IntPtr ptr, void* buffer, int length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,10 +48,11 @@ namespace Server
|
|||
{
|
||||
FileOptions options = FileOptions.SequentialScan;
|
||||
|
||||
if (Concurrency > 0) options |= FileOptions.Asynchronous;
|
||||
if (Concurrency > 0)
|
||||
options |= FileOptions.Asynchronous;
|
||||
|
||||
#if MONO
|
||||
return new FileStream( path, mode, access, share, bufferSize, options );
|
||||
return new FileStream( path, mode, access, share, BufferSize, options );
|
||||
#else
|
||||
if (Unbuffered)
|
||||
options |= NoBuffering;
|
||||
|
|
@ -109,4 +110,4 @@ namespace Server
|
|||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,10 +79,8 @@ namespace Server
|
|||
)
|
||||
);
|
||||
|
||||
#if !MONO
|
||||
PerformanceCounterCategory.Create(PerformanceCategoryName, PerformanceCategoryDesc,
|
||||
PerformanceCounterCategoryType.SingleInstance, counters);
|
||||
#endif
|
||||
}
|
||||
|
||||
numberOfWorldSaves = new PerformanceCounter(PerformanceCategoryName, "Save - Count", false);
|
||||
|
|
@ -137,4 +135,4 @@ namespace Server
|
|||
writtenBytesPerSecond.IncrementBy(numberOfBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,10 +80,6 @@ namespace Server
|
|||
AppendCompilerOption(ref sb, "/d:NEWTIMERS");
|
||||
#endif
|
||||
|
||||
#if NEWPARENT
|
||||
AppendCompilerOption(ref sb, "/d:NEWPARENT");
|
||||
#endif
|
||||
|
||||
return sb?.ToString();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -165,9 +165,7 @@ namespace Server.Targeting
|
|||
return;
|
||||
}
|
||||
|
||||
object root = item.RootParent;
|
||||
|
||||
if (!AllowNonlocal && root is Mobile && root != from && from.AccessLevel == AccessLevel.Player)
|
||||
if (!AllowNonlocal && item.RootParent is Mobile && item.RootParent != from && from.AccessLevel == AccessLevel.Player)
|
||||
{
|
||||
OnNonlocalTarget(from, item);
|
||||
OnTargetFinish(from);
|
||||
|
|
@ -290,4 +288,4 @@ namespace Server.Targeting
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -388,11 +388,7 @@ namespace Server
|
|||
|
||||
fixed (StaticTile* pTiles = staTiles)
|
||||
{
|
||||
#if !MONO
|
||||
NativeReader.Read(DataStream.SafeFileHandle.DangerousGetHandle(), pTiles, length);
|
||||
#else
|
||||
NativeReader.Read( m_Statics.Handle, pTiles, length );
|
||||
#endif
|
||||
if (m_Lists == null)
|
||||
{
|
||||
m_Lists = new TileList[8][];
|
||||
|
|
@ -463,11 +459,7 @@ namespace Server
|
|||
|
||||
fixed (LandTile* pTiles = tiles)
|
||||
{
|
||||
#if !MONO
|
||||
NativeReader.Read(MapStream.SafeFileHandle.DangerousGetHandle(), pTiles, 192);
|
||||
#else
|
||||
NativeReader.Read( m_Map.Handle, pTiles, 192 );
|
||||
#endif
|
||||
}
|
||||
|
||||
return tiles;
|
||||
|
|
@ -718,9 +710,9 @@ namespace Server
|
|||
|
||||
if (y == null)
|
||||
return -1;
|
||||
|
||||
|
||||
return x.m_Offset.CompareTo(y.m_Offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,11 +95,7 @@ namespace Server
|
|||
|
||||
fixed (LandTile* pTiles = tiles)
|
||||
{
|
||||
#if !MONO
|
||||
NativeReader.Read(fsData.SafeFileHandle.DangerousGetHandle(), pTiles, 192);
|
||||
#else
|
||||
NativeReader.Read( fsData.Handle, pTiles, 192 );
|
||||
#endif
|
||||
}
|
||||
|
||||
matrix.SetLandBlock(x, y, tiles);
|
||||
|
|
@ -163,11 +159,7 @@ namespace Server
|
|||
|
||||
fixed (StaticTile* pTiles = staTiles)
|
||||
{
|
||||
#if !MONO
|
||||
NativeReader.Read(fsData.SafeFileHandle.DangerousGetHandle(), pTiles, length);
|
||||
#else
|
||||
NativeReader.Read( fsData.Handle, pTiles, length );
|
||||
#endif
|
||||
StaticTile* pCur = pTiles, pEnd = pTiles + tileCount;
|
||||
|
||||
while (pCur < pEnd)
|
||||
|
|
@ -199,4 +191,4 @@ namespace Server
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue