Exemplo n.º 1
0
        public void ScanAndExportToMain(SceneMetricsScanSettings settings)
        {
            this.Reset();
            int num1 = 0;
            int num2 = 0;

            if (settings.ScanOreFinderData)
            {
                this._oreFinderTileLocations.Clear();
            }
            if (settings.BiomeScanCenterPositionInWorld.HasValue)
            {
                Point tileCoordinates = settings.BiomeScanCenterPositionInWorld.Value.ToTileCoordinates();
                Microsoft.Xna.Framework.Rectangle tileRectangle = new Microsoft.Xna.Framework.Rectangle(tileCoordinates.X - Main.buffScanAreaWidth / 2, tileCoordinates.Y - Main.buffScanAreaHeight / 2, Main.buffScanAreaWidth, Main.buffScanAreaHeight);
                tileRectangle = WorldUtils.ClampToWorld(this._world, tileRectangle);
                for (int left = tileRectangle.Left; left < tileRectangle.Right; ++left)
                {
                    for (int top = tileRectangle.Top; top < tileRectangle.Bottom; ++top)
                    {
                        if (tileRectangle.Contains(left, top))
                        {
                            Tile tile = this._world.Tiles[left, top];
                            if (tile != null && tile.active())
                            {
                                tileRectangle.Contains(left, top);
                                if (!TileID.Sets.isDesertBiomeSand[(int)tile.type] || !WorldGen.oceanDepths(left, top))
                                {
                                    ++this._tileCounts[(int)tile.type];
                                }
                                if (tile.type == (ushort)215 && tile.frameY < (short)36)
                                {
                                    this.HasCampfire = true;
                                }
                                if (tile.type == (ushort)49 && tile.frameX < (short)18)
                                {
                                    ++num1;
                                }
                                if (tile.type == (ushort)372 && tile.frameX < (short)18)
                                {
                                    ++num2;
                                }
                                if (tile.type == (ushort)405 && tile.frameX < (short)54)
                                {
                                    this.HasCampfire = true;
                                }
                                if (tile.type == (ushort)506 && tile.frameX < (short)72)
                                {
                                    this.HasCatBast = true;
                                }
                                if (tile.type == (ushort)42 && tile.frameY >= (short)324 && tile.frameY <= (short)358)
                                {
                                    this.HasHeartLantern = true;
                                }
                                if (tile.type == (ushort)42 && tile.frameY >= (short)252 && tile.frameY <= (short)286)
                                {
                                    this.HasStarInBottle = true;
                                }
                                if (tile.type == (ushort)91 && (tile.frameX >= (short)396 || tile.frameY >= (short)54))
                                {
                                    int banner = (int)tile.frameX / 18 - 21;
                                    for (int frameY = (int)tile.frameY; frameY >= 54; frameY -= 54)
                                    {
                                        banner = banner + 90 + 21;
                                    }
                                    int index = Item.BannerToItem(banner);
                                    if (ItemID.Sets.BannerStrength[index].Enabled)
                                    {
                                        this.NPCBannerBuff[banner] = true;
                                        this.hasBanner             = true;
                                    }
                                }
                                if (settings.ScanOreFinderData && Main.tileOreFinderPriority[(int)tile.type] != (short)0)
                                {
                                    this._oreFinderTileLocations.Add(new Point(left, top));
                                }
                            }
                        }
                    }
                }
            }
            if (settings.VisualScanArea.HasValue)
            {
                Microsoft.Xna.Framework.Rectangle world = WorldUtils.ClampToWorld(this._world, settings.VisualScanArea.Value);
                for (int left = world.Left; left < world.Right; ++left)
                {
                    for (int top = world.Top; top < world.Bottom; ++top)
                    {
                        Tile tile = this._world.Tiles[left, top];
                        if (tile != null && tile.active())
                        {
                            if (tile.type == (ushort)104)
                            {
                                this.HasClock = true;
                            }
                            switch (tile.type)
                            {
                            case 139:
                                if (tile.frameX >= (short)36)
                                {
                                    this.ActiveMusicBox = (int)tile.frameY / 36;
                                    continue;
                                }
                                continue;

                            case 207:
                                if (tile.frameY >= (short)72)
                                {
                                    switch ((int)tile.frameX / 36)
                                    {
                                    case 0:
                                        this.ActiveFountainColor = 0;
                                        continue;

                                    case 1:
                                        this.ActiveFountainColor = 12;
                                        continue;

                                    case 2:
                                        this.ActiveFountainColor = 3;
                                        continue;

                                    case 3:
                                        this.ActiveFountainColor = 5;
                                        continue;

                                    case 4:
                                        this.ActiveFountainColor = 2;
                                        continue;

                                    case 5:
                                        this.ActiveFountainColor = 10;
                                        continue;

                                    case 6:
                                        this.ActiveFountainColor = 4;
                                        continue;

                                    case 7:
                                        this.ActiveFountainColor = 9;
                                        continue;

                                    case 8:
                                        this.ActiveFountainColor = 8;
                                        continue;

                                    case 9:
                                        this.ActiveFountainColor = 6;
                                        continue;

                                    default:
                                        this.ActiveFountainColor = -1;
                                        continue;
                                    }
                                }
                                else
                                {
                                    continue;
                                }

                            case 410:
                                if (tile.frameY >= (short)56)
                                {
                                    this.ActiveMonolithType = (int)tile.frameX / 36;
                                    continue;
                                }
                                continue;

                            case 480:
                                if (tile.frameY >= (short)54)
                                {
                                    this.BloodMoonMonolith = true;
                                    continue;
                                }
                                continue;

                            case 509:
                                if (tile.frameY >= (short)56)
                                {
                                    this.ActiveMonolithType = 4;
                                    continue;
                                }
                                continue;

                            default:
                                continue;
                            }
                        }
                    }
                }
            }
            this.WaterCandleCount = num1;
            this.PeaceCandleCount = num2;
            this.ExportTileCountsToMain();
            if (!settings.ScanOreFinderData)
            {
                return;
            }
            this.UpdateOreFinderData();
        }
        public void ScanAndExportToMain(SceneMetricsScanSettings settings)
        {
            Reset();
            int num  = 0;
            int num2 = 0;

            if (settings.ScanOreFinderData)
            {
                _oreFinderTileLocations.Clear();
            }
            if (settings.BiomeScanCenterPositionInWorld.HasValue)
            {
                Point     point     = settings.BiomeScanCenterPositionInWorld.Value.ToTileCoordinates();
                Rectangle rectangle = WorldUtils.ClampToWorld(tileRectangle: new Rectangle(point.X - Main.buffScanAreaWidth / 2, point.Y - Main.buffScanAreaHeight / 2, Main.buffScanAreaWidth, Main.buffScanAreaHeight), world: _world);
                for (int i = rectangle.Left; i < rectangle.Right; i++)
                {
                    for (int j = rectangle.Top; j < rectangle.Bottom; j++)
                    {
                        if (!rectangle.Contains(i, j))
                        {
                            continue;
                        }
                        Tile tile = _world.Tiles[i, j];
                        if (tile == null || !tile.active())
                        {
                            continue;
                        }
                        rectangle.Contains(i, j);
                        if (!TileID.Sets.isDesertBiomeSand[tile.type] || !WorldGen.oceanDepths(i, j))
                        {
                            _tileCounts[tile.type]++;
                        }
                        if (tile.type == 215 && tile.frameY < 36)
                        {
                            HasCampfire = true;
                        }
                        if (tile.type == 49 && tile.frameX < 18)
                        {
                            num++;
                        }
                        if (tile.type == 372 && tile.frameX < 18)
                        {
                            num2++;
                        }
                        if (tile.type == 405 && tile.frameX < 54)
                        {
                            HasCampfire = true;
                        }
                        if (tile.type == 506 && tile.frameX < 72)
                        {
                            HasCatBast = true;
                        }
                        if (tile.type == 42 && tile.frameY >= 324 && tile.frameY <= 358)
                        {
                            HasHeartLantern = true;
                        }
                        if (tile.type == 42 && tile.frameY >= 252 && tile.frameY <= 286)
                        {
                            HasStarInBottle = true;
                        }
                        if (tile.type == 91 && (tile.frameX >= 396 || tile.frameY >= 54))
                        {
                            int num3 = tile.frameX / 18 - 21;
                            for (int num4 = tile.frameY; num4 >= 54; num4 -= 54)
                            {
                                num3 += 90;
                                num3 += 21;
                            }
                            int num5 = Item.BannerToItem(num3);
                            if (ItemID.Sets.BannerStrength[num5].Enabled)
                            {
                                NPCBannerBuff[num3] = true;
                                hasBanner           = true;
                            }
                        }
                        if (settings.ScanOreFinderData && Main.tileOreFinderPriority[tile.type] != 0)
                        {
                            _oreFinderTileLocations.Add(new Point(i, j));
                        }
                    }
                }
            }
            if (settings.VisualScanArea.HasValue)
            {
                Rectangle rectangle2 = WorldUtils.ClampToWorld(_world, settings.VisualScanArea.Value);
                for (int k = rectangle2.Left; k < rectangle2.Right; k++)
                {
                    for (int l = rectangle2.Top; l < rectangle2.Bottom; l++)
                    {
                        Tile tile2 = _world.Tiles[k, l];
                        if (tile2 == null || !tile2.active())
                        {
                            continue;
                        }
                        if (tile2.type == 104)
                        {
                            HasClock = true;
                        }
                        switch (tile2.type)
                        {
                        case 139:
                            if (tile2.frameX >= 36)
                            {
                                ActiveMusicBox = tile2.frameY / 36;
                            }
                            break;

                        case 207:
                            if (tile2.frameY >= 72)
                            {
                                switch (tile2.frameX / 36)
                                {
                                case 0:
                                    ActiveFountainColor = 0;
                                    break;

                                case 1:
                                    ActiveFountainColor = 12;
                                    break;

                                case 2:
                                    ActiveFountainColor = 3;
                                    break;

                                case 3:
                                    ActiveFountainColor = 5;
                                    break;

                                case 4:
                                    ActiveFountainColor = 2;
                                    break;

                                case 5:
                                    ActiveFountainColor = 10;
                                    break;

                                case 6:
                                    ActiveFountainColor = 4;
                                    break;

                                case 7:
                                    ActiveFountainColor = 9;
                                    break;

                                case 8:
                                    ActiveFountainColor = 8;
                                    break;

                                case 9:
                                    ActiveFountainColor = 6;
                                    break;

                                default:
                                    ActiveFountainColor = -1;
                                    break;
                                }
                            }
                            break;

                        case 410:
                            if (tile2.frameY >= 56)
                            {
                                int num7 = (ActiveMonolithType = tile2.frameX / 36);
                            }
                            break;

                        case 509:
                            if (tile2.frameY >= 56)
                            {
                                ActiveMonolithType = 4;
                            }
                            break;

                        case 480:
                            if (tile2.frameY >= 54)
                            {
                                BloodMoonMonolith = true;
                            }
                            break;
                        }
                    }
                }
            }
            WaterCandleCount = num;
            PeaceCandleCount = num2;
            ExportTileCountsToMain();
            if (settings.ScanOreFinderData)
            {
                UpdateOreFinderData();
            }
        }