public static FillableContentType Lookup(FillableContent content) { if (content == null) { return(FillableContentType.None); } return((FillableContentType)Array.IndexOf(m_ContentTypes, content)); }
public static FillableContent Acquire(Point3D loc, Map map) { if (map == null || map == Map.Internal) { return(null); } if (m_AcquireTable == null) { m_AcquireTable = new Dictionary <Type, FillableContent>(); for (int i = 0; i < m_ContentTypes.Length; ++i) { FillableContent fill = m_ContentTypes[i]; for (int j = 0; j < fill.Vendors.Length; ++j) { m_AcquireTable[fill.Vendors[j]] = fill; } } } Mobile nearest = null; FillableContent content = null; foreach (Mobile mob in map.GetMobilesInRange(loc, 20)) { if (nearest != null && mob.GetDistanceToSqrt(loc) > nearest.GetDistanceToSqrt(loc) && !(nearest is Cobbler && mob is Provisioner)) { continue; } if (m_AcquireTable.TryGetValue(mob.GetType(), out FillableContent check)) { nearest = mob; content = check; } } return(content); }