Beispiel #1
0
        public static void MarkHighValueUnwalkedTiles(TibiaMapFile map)
        {
            int StartX = 0;
            int StartY = 0;

            int EndX = 256;
            int EndY = 256;

            int StartOffsetX = -TibiaCastRecordingParser.MapParser.POSITION_VIEWPORT_OFFSET_X;
            int StartOffsetY = -TibiaCastRecordingParser.MapParser.POSITION_VIEWPORT_OFFSET_Y;
            int EndOffsetX   = TibiaCastRecordingParser.MapParser.POSITION_VIEWPORT_OFFSET_X;
            int EndOffsetY   = TibiaCastRecordingParser.MapParser.POSITION_VIEWPORT_OFFSET_Y;
            int StartOffsetZ;
            int EndOffsetZ;

            long posOffset;
            long targetPosOffset;
            int  value;

            bool mapChanged = false;

            StartOffsetZ = (map.BaseZ <= 7 ? 0 : Math.Max(0, map.BaseZ - 2));
            EndOffsetZ   = (map.BaseZ <= 7 ? 7 : Math.Min(15, map.BaseZ + 2));

            StartOffsetZ = (map.BaseZ <= 7 ? (-map.BaseZ) : -2);
            EndOffsetZ   = (map.BaseZ <= 7 ? (7 - map.BaseZ) : Math.Min(15 - map.BaseZ, 2));

            for (int x = StartX; x < EndX; x++)
            {
                for (int y = StartY; y < EndY; y++)
                {
                    posOffset = GetPositionOffset((map.BaseX << 8) + x, (map.BaseY << 8) + y, map.BaseZ);

                    if (TileWalkableStates.Contains(posOffset) && (!TileWalkedStates.Contains(posOffset)))
                    {
                        value = 0;
                        DebugDump.Append("Position: ");
                        DebugDump.Append(((map.BaseX << 8) + x).ToString());
                        DebugDump.Append(", ");
                        DebugDump.Append(((map.BaseY << 8) + y).ToString());
                        DebugDump.Append(", ");
                        DebugDump.Append(map.BaseZ.ToString());
                        DebugDump.Append(Environment.NewLine);

                        //33418, 32038, 7 :
                        //  33410, 32032, 0
                        //  33426, 32044, 0
                        DebugDump.Append(" Min: ");
                        DebugDump.Append((((map.BaseX << 8) + x) + (StartOffsetZ) + StartOffsetX).ToString());
                        DebugDump.Append(", ");
                        DebugDump.Append((((map.BaseY << 8) + y) + (StartOffsetZ) + StartOffsetY).ToString());
                        DebugDump.Append(", ");
                        DebugDump.Append((((map.BaseZ << 0) + 0) + StartOffsetZ).ToString());
                        DebugDump.Append(Environment.NewLine);

                        DebugDump.Append(" Max: ");
                        DebugDump.Append((((map.BaseX << 8) + x) + (EndOffsetZ) + EndOffsetX).ToString());
                        DebugDump.Append(", ");
                        DebugDump.Append((((map.BaseY << 8) + y) + (EndOffsetZ) + EndOffsetY).ToString());
                        DebugDump.Append(", ");
                        DebugDump.Append((((map.BaseZ << 0) + 0) + (EndOffsetZ)).ToString());
                        DebugDump.Append(Environment.NewLine);

                        for (int offX = StartOffsetX; offX <= EndOffsetX; offX++)
                        {
                            for (int offY = StartOffsetY; offY <= EndOffsetY; offY++)
                            {
                                for (int offZ = StartOffsetZ; offZ <= EndOffsetZ; offZ++)
                                {
                                    // TODO TEST
                                    targetPosOffset = GetPositionOffset(
                                        ((map.BaseX << 8) + x) + (offZ) + offX,
                                        ((map.BaseY << 8) + y) + (offZ) + offY,
                                        ((map.BaseZ << 0) + 0) + (offZ)
                                        );

                                    if (!TileExploredStates.Contains(targetPosOffset))
                                    {
                                        if (IsReachable(((map.BaseX << 8) + x) + (offZ) + offX, ((map.BaseY << 8) + y) + (offZ) + offY, ((map.BaseZ << 0) + 0) + (offZ)))
                                        {
                                            DebugDump.Append("  Can reveal: ");
                                            DebugDump.Append((((map.BaseX << 8) + x) + (offZ) + offX).ToString());
                                            DebugDump.Append(", ");
                                            DebugDump.Append((((map.BaseY << 8) + y) + (offZ) + offY).ToString());
                                            DebugDump.Append(", ");
                                            DebugDump.Append((((map.BaseZ << 0) + 0) + (offZ)).ToString());
                                            DebugDump.Append(Environment.NewLine);

                                            value++;
                                        }
                                    }
                                }
                            }
                        }

                        TileWalkValue[posOffset] = value;
                        if (value > BASELINE_ADD_MARK)
                        {
                            map.AddMapMarker(x, y, 14, "Value: " + value.ToString());
                            mapChanged = true;
                        }
                    }
                }
            }

            if (mapChanged || true)
            {
                map.Save(@"C:\Users\Reece\Recordings\MarkedMaps");
                LogDump();
            }
        }