示例#1
0
        private bool ValidateLocation(Point3D p, Map map)
        {
            if (!TreasureMap.ValidateLocation(p.X, p.Y, map))
            {
                return(false);
            }

            for (int x = p.X - 1; x <= p.X + 1; x++)
            {
                for (int y = p.Y - 1; y <= p.Y + 1; y++)
                {
                    if (TreasureMap.ValidateLocation(x, y, map))
                    {
                        int z = map.GetAverageZ(x, y);
                        IPooledEnumerable eable = map.GetItemsInRange(new Point3D(x, y, z), 0);
                        foreach (Item item in eable)
                        {
                            ItemData id = TileData.ItemTable[item.ItemID & TileData.MaxItemValue];

                            if (item.Z + id.CalcHeight >= z)
                            {
                                eable.Free();
                                return(false);
                            }
                        }
                        eable.Free();

                        return(true);
                    }
                }
            }

            return(false);
        }