示例#1
0
        /// <summary>
        /// Gets the areas for a certain spot
        /// </summary>
        /// <param name="zone"></param>
        /// <param name="p"></param>
        /// <param name="checkZ"></param>
        /// <returns></returns>
        public override IList GetAreasOfZone(Zone zone, int x, int y, int z)
        {
            Zone  checkZone = zone;
            IList areas     = new ArrayList();

            if (checkZone == null)
            {
                return(areas);
            }

            // Players will always request the skinned zone so map it to the actual instance zone
            if (m_zoneSkinMap.ContainsKey(zone.ID))
            {
                checkZone = m_zoneSkinMap[zone.ID];
            }

            int zoneIndex = Zones.IndexOf(checkZone);

            if (zoneIndex >= 0)
            {
                lock (m_lockAreas)
                {
                    try
                    {
                        for (int i = 0; i < m_ZoneAreasCount[zoneIndex]; i++)
                        {
                            IArea area = (IArea)Areas[m_ZoneAreas[zoneIndex][i]];
                            if (area.IsContaining(x, y, z))
                            {
                                areas.Add(area);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        log.Error("GetArea exception.Area count " + m_ZoneAreasCount[zoneIndex], e);
                    }
                }
            }

            return(areas);
        }
        /// <summary>
        /// Gets the areas for a certain spot
        /// </summary>
        /// <param name="zone"></param>
        /// <param name="p"></param>
        /// <param name="checkZ"></param>
        /// <returns></returns>
        public override IList <IArea> GetAreasOfZone(Zone zone, IPoint3D p, bool checkZ)
        {
            Zone checkZone = zone;
            var  areas     = new List <IArea>();

            if (checkZone == null)
            {
                return(areas);
            }

            // Players will always request the skinned zone so map it to the actual instance zone
            if (m_zoneSkinMap.ContainsKey(zone.ID))
            {
                checkZone = m_zoneSkinMap[zone.ID];
            }

            int zoneIndex = Zones.IndexOf(checkZone);

            if (zoneIndex >= 0)
            {
                lock (m_lockAreas)
                {
                    try
                    {
                        for (int i = 0; i < m_ZoneAreasCount[zoneIndex]; i++)
                        {
                            IArea area = (IArea)Areas[m_ZoneAreas[zoneIndex][i]];
                            if (area.IsContaining(p, checkZ))
                            {
                                areas.Add(area);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        log.Error("GetAreaOfZone: Caught exception for Zone " + zone.Description + ", Area count " + m_ZoneAreasCount[zoneIndex] + ".", e);
                    }
                }
            }

            return(areas);
        }