Fixes dictionary uses (#7)
This commit is contained in:
parent
d4a52344f2
commit
916d404c51
161 changed files with 1211 additions and 1722 deletions
|
|
@ -342,9 +342,9 @@ namespace Server.Items
|
|||
if (!m.Player || m.AccessLevel > AccessLevel.Player) //Staff and creatures not subject to instancing.
|
||||
return true;
|
||||
|
||||
if (m_InstancedItems != null)
|
||||
if (m_InstancedItems.TryGetValue(child, out InstancedItemInfo info) && (InstancedCorpse || info.Perpetual))
|
||||
return info.IsOwner(m); //IsOwner checks Party stuff.
|
||||
if (m_InstancedItems != null && m_InstancedItems.TryGetValue(child, out InstancedItemInfo info)
|
||||
&& (InstancedCorpse || info.Perpetual))
|
||||
return info.IsOwner(m); //IsOwner checks Party stuff.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -495,7 +495,7 @@ namespace Server.Items
|
|||
c = new Corpse(owner, hair, facialhair, equipItems);
|
||||
|
||||
owner.Corpse = c;
|
||||
|
||||
|
||||
for (int i = 0; i < initialContent.Count; ++i)
|
||||
{
|
||||
Item item = initialContent[i];
|
||||
|
|
@ -830,7 +830,7 @@ namespace Server.Items
|
|||
if (!Looters.Contains(from))
|
||||
Looters.Add(from);
|
||||
|
||||
if (m_InstancedItems != null && m_InstancedItems.ContainsKey(item))
|
||||
if (m_InstancedItems?.ContainsKey(item) == true)
|
||||
m_InstancedItems.Remove(item);
|
||||
}
|
||||
|
||||
|
|
@ -847,7 +847,7 @@ namespace Server.Items
|
|||
if (!Looters.Contains(from))
|
||||
Looters.Add(from);
|
||||
|
||||
if (m_InstancedItems != null && m_InstancedItems.ContainsKey(item))
|
||||
if (m_InstancedItems?.ContainsKey(item) == true)
|
||||
m_InstancedItems.Remove(item);
|
||||
}
|
||||
|
||||
|
|
@ -891,12 +891,7 @@ namespace Server.Items
|
|||
if (!IsCriminalAction(from))
|
||||
return true;
|
||||
|
||||
Map map = Map;
|
||||
|
||||
if (map == null || (map.Rules & MapRules.HarmfulRestrictions) != 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return Map != null && (Map.Rules & MapRules.HarmfulRestrictions) == 0;
|
||||
}
|
||||
|
||||
public bool CheckLoot(Mobile from, Item item)
|
||||
|
|
@ -1194,4 +1189,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace Server.Items
|
|||
{
|
||||
private static readonly TimeSpan m_UseTimeout = TimeSpan.FromMinutes(2.0);
|
||||
|
||||
private Dictionary<Mobile, DamageTimer> m_DamageTable = new Dictionary<Mobile, DamageTimer>();
|
||||
private HashSet<Mobile> m_DamageTable = new HashSet<Mobile>();
|
||||
private DateTime m_LastUse;
|
||||
|
||||
private int m_SideLength;
|
||||
|
|
@ -217,12 +217,12 @@ namespace Server.Items
|
|||
if (!to.Alive)
|
||||
return;
|
||||
|
||||
if (m_DamageTable[to] == null)
|
||||
if (!m_DamageTable.Contains(to))
|
||||
{
|
||||
to.Frozen = true;
|
||||
|
||||
DamageTimer timer = new DamageTimer(this, to);
|
||||
m_DamageTable[to] = timer;
|
||||
m_DamageTable.Add(to);
|
||||
|
||||
timer.Start();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -690,7 +690,7 @@ namespace Server.Items
|
|||
m.SendLocalizedMessage(ProgressNumber);
|
||||
|
||||
if (ShowTimeRemaining)
|
||||
m.SendMessage("Time remaining: {0}", FormatTime(m_Table[m].Timer.Next - DateTime.UtcNow));
|
||||
m.SendMessage("Time remaining: {0}", FormatTime(info.Timer.Next - DateTime.UtcNow));
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(5), EndLock, m);
|
||||
}
|
||||
|
|
@ -764,19 +764,12 @@ namespace Server.Items
|
|||
private Dictionary<Mobile, Timer> m_Teleporting;
|
||||
|
||||
[Constructible]
|
||||
public TimeoutTeleporter()
|
||||
: this(new Point3D(0, 0, 0), null, false)
|
||||
public TimeoutTeleporter() : this(new Point3D(0, 0, 0))
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public TimeoutTeleporter(Point3D pointDest, Map mapDest)
|
||||
: this(pointDest, mapDest, false)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public TimeoutTeleporter(Point3D pointDest, Map mapDest, bool creatures)
|
||||
public TimeoutTeleporter(Point3D pointDest, Map mapDest = null, bool creatures = false)
|
||||
: base(pointDest, mapDest, creatures)
|
||||
{
|
||||
m_Teleporting = new Dictionary<Mobile, Timer>();
|
||||
|
|
@ -1195,4 +1188,4 @@ namespace Server.Items
|
|||
DeadOnly = 0x100
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue