Merges crash bugs into master (#12)

This commit is contained in:
Kamron Batman 2019-03-03 14:28:24 -08:00 committed by GitHub
parent 916d404c51
commit 39dfe86e10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 33 additions and 85 deletions

View file

@ -572,12 +572,14 @@ namespace Server.Gumps
if (baseType == typeofObject || baseType?.GetProperty(prop.Name, prop.PropertyType) == null)
break;
type = baseType;
}
if (type != null && !groups.ContainsKey(type))
groups[type] = new List<PropertyInfo>{ prop };
else
groups[type].Add(prop);
}
}
}
@ -657,13 +659,13 @@ namespace Server.Gumps
return 0;
if (x == null)
return -1;
return y == null ? 1 : x.Name.CompareTo(x.Name);
}
}
private class GroupComparer : IComparer<KeyValuePair<Type, List<PropertyInfo>>>
{
{
private Type m_Start;
public GroupComparer(Type start)
@ -689,4 +691,4 @@ namespace Server.Gumps
}
}
}
}
}

View file

@ -1104,6 +1104,7 @@ namespace Server.Items
public static void CheckHeaveTimer(Mobile from)
{
Timer t;
if (from.BAC > 0 && from.Map != Map.Internal && !from.Deleted)
{
if (m_Table.ContainsKey(from))
@ -1112,12 +1113,12 @@ namespace Server.Items
if (from.BAC > 60)
from.BAC = 60;
Timer t = new HeaveTimer(from);
t = new HeaveTimer(from);
t.Start();
m_Table[from] = t;
}
else if (m_Table.TryGetValue(from, out Timer t))
else if (m_Table.TryGetValue(from, out t))
{
t.Stop();
m_Table.Remove(from);

View file

@ -281,62 +281,22 @@ namespace Server
private static bool IsArmor(int itemID)
{
if (itemID >= 0x13BB && itemID <= 0x13E2)
return true;
if (itemID >= 0x13E5 && itemID <= 0x13F2)
return true;
if (itemID >= 0x1408 && itemID <= 0x141A)
return true;
if (itemID >= 0x144E && itemID <= 0x1457)
return true;
return false;
return itemID >= 0x13BB && itemID <= 0x13E2 || itemID >= 0x13E5 && itemID <= 0x13F2 ||
itemID >= 0x1408 && itemID <= 0x141A || itemID >= 0x144E && itemID <= 0x1457;
}
private static bool IsMetalWeapon(int itemID)
{
if (itemID >= 0xF43 && itemID <= 0xF4E)
return true;
if (itemID >= 0xF51 && itemID <= 0xF52)
return true;
if (itemID >= 0xF5C && itemID <= 0xF63)
return true;
if (itemID >= 0x13AF && itemID <= 0x13B0)
return true;
if (itemID >= 0x13B5 && itemID <= 0x13BA)
return true;
if (itemID >= 0x13FA && itemID <= 0x13FB)
return true;
if (itemID >= 0x13FE && itemID <= 0x1407)
return true;
if (itemID >= 0x1438 && itemID <= 0x1443)
return true;
return false;
return itemID >= 0xF43 && itemID <= 0xF4E || itemID >= 0xF51 && itemID <= 0xF52 ||
itemID >= 0xF5C && itemID <= 0xF63 || itemID >= 0x13AF && itemID <= 0x13B0 ||
itemID >= 0x13B5 && itemID <= 0x13BA || itemID >= 0x13FA && itemID <= 0x13FB ||
itemID >= 0x13FE && itemID <= 0x1407 || itemID >= 0x1438 && itemID <= 0x1443;
}
private static bool IsArcheryWeapon(int itemID)
{
if (itemID >= 0xF4F && itemID <= 0xF50)
return true;
if (itemID >= 0x13B1 && itemID <= 0x13B2)
return true;
if (itemID >= 0x13FC && itemID <= 0x13FD)
return true;
return false;
return itemID >= 0xF4F && itemID <= 0xF50 || itemID >= 0x13B1 && itemID <= 0x13B2 ||
itemID >= 0x13FC && itemID <= 0x13FD;
}
private static ShopFlags ProcessDisplayedItem(int itemID)
@ -481,9 +441,9 @@ namespace Server
floor.Add(p);
for (int xo = -1; xo <= 1; ++xo)
for (int yo = -1; yo <= 1; ++yo)
if ((xo != 0 || yo != 0) && IsFloor(map, x + xo, y + yo, false))
RecurseFindFloor(map, x + xo, y + yo, floor);
for (int yo = -1; yo <= 1; ++yo)
if ((xo != 0 || yo != 0) && IsFloor(map, x + xo, y + yo, false))
RecurseFindFloor(map, x + xo, y + yo, floor);
}
[Flags]

View file

@ -4728,16 +4728,12 @@ namespace Server.Mobiles
public virtual bool HasRecipe(Recipe r)
{
if (r == null)
return false;
return HasRecipe(r.ID);
return r != null && HasRecipe(r.ID);
}
public virtual bool HasRecipe(int recipeID)
{
m_AcquiredRecipes?.TryGetValue(recipeID, out bool value);
return value;
return m_AcquiredRecipes.TryGetValue(recipeID, out bool value) && value;
}
public virtual void AcquireRecipe(Recipe r)

View file

@ -91,7 +91,7 @@ namespace Server.Regions
if (bc?.NoHouseRestrictions == true)
{
}
else if (bc.IsHouseSummonable == true &&
else if (bc?.IsHouseSummonable == true &&
!(BaseCreature.Summoning || House.IsInside(oldLocation, 16)))
{
}

View file

@ -1789,18 +1789,7 @@ namespace Server
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
public Map LogoutMap{ get; set; }
public Region Region
{
get
{
if (m_Region == null)
if (Map == null)
return Map.Internal.DefaultRegion;
else
return Map.DefaultRegion;
return m_Region;
}
}
public Region Region => m_Region ?? (Map == null ? Map.Internal.DefaultRegion : Map.DefaultRegion);
public Packet RemovePacket
{

View file

@ -416,7 +416,7 @@ namespace Server
return false;
}
// TODO: Memoize this
public T GetRegion<T>() where T : Region
{
@ -468,7 +468,7 @@ namespace Server
return null;
}
public bool IsPartOf<T>() where T : Region
{
return GetRegion<T>() != null;
@ -840,7 +840,7 @@ namespace Server
Console.WriteLine("Could not find root element 'ServerRegions' in Regions.xml");
return;
}
foreach (XmlElement facet in root.SelectNodes("Facet"))
{
Map map = null;
@ -1172,4 +1172,4 @@ namespace Server
return true;
}
}
}
}

View file

@ -7,7 +7,7 @@
<!-- Automatically check for missing packages during build in Visual Studio -->
<add key="automatic" value="True" />
</packageRestore>
</configuration>
<packages>
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.1" targetFramework="net47" />
</packages>
<packages>
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.1" targetFramework="net47" />
</packages>
</configuration>