Esempio n. 1
0
 public static Objects.Location getFileCoordinates(string fileName)
 {
     if (fileExists(fileName))
     {
         Objects.Location pos        = new Objects.Location();
         string[]         PathSplit  = fileName.Split('\\');
         string           fName      = PathSplit[PathSplit.Length - 1];
         char[]           NameInChar = fName.ToCharArray();
         StringBuilder    sb         = new StringBuilder();
         sb.Append(NameInChar[0]);
         sb.Append(NameInChar[1]);
         sb.Append(NameInChar[2]);
         pos.x = Convert.ToInt32(sb.ToString()) * 256;
         sb.Clear();
         sb.Append(NameInChar[3]);
         sb.Append(NameInChar[4]);
         sb.Append(NameInChar[5]);
         pos.y = Convert.ToInt32(sb.ToString()) * 256; // LOL SPOTY!
         sb.Clear();
         sb.Append(NameInChar[6]);
         sb.Append(NameInChar[7]);
         pos.z = Convert.ToInt32(sb.ToString()); // LOL SPOTZ!
         sb.Clear();
         return(pos);
     }
     else
     {
         return(new Objects.Location());
     }
 }
Esempio n. 2
0
        public static Bitmap getMapSpeedFileAroundMe(Objects.Location location)
        {
            fillColourList();
            // Format is up, upri, ri, rido, do, dole, le, leup, self
            StringBuilder[] sb = new StringBuilder[9];
            sb = getFileAroundMeNames(location);
            Bitmap[]  bmpList = new Bitmap[9];
            Bitmap    bmp     = new Bitmap(256 * 3, 256 * 3, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            Rectangle rect    = new Rectangle();

            rect.Height = 256;
            rect.Width  = 256;
            rect.X      = 0;
            rect.Y      = 0;
            Objects.Colour color = new Objects.Colour();
            color = colourlist[0];
            Graphics.FromImage(bmp).FillRectangle(new SolidBrush(Color.FromArgb(color.r, color.g, color.b)), rect);
            for (int i = 0; i < 9; i++)
            {
                string mapFileName = sb[i].ToString();
                bmpList[i] = getMapSpeedFile(mapFileName);
            }

            using (Graphics g = Graphics.FromImage(bmp))
            {
                g.DrawImage(bmpList[0], 0, 0, 256, 256);     // TL
                g.DrawImage(bmpList[1], 256, 0, 256, 256);   // TM
                g.DrawImage(bmpList[2], 512, 0, 256, 256);   // TR
                g.DrawImage(bmpList[3], 0, 256, 256, 256);   // ML
                g.DrawImage(bmpList[4], 256, 256, 256, 256); // MM
                g.DrawImage(bmpList[5], 512, 256, 256, 256); // MR
                g.DrawImage(bmpList[6], 0, 512, 256, 256);   // BL
                g.DrawImage(bmpList[7], 256, 512, 256, 256); // BM
                g.DrawImage(bmpList[8], 512, 512, 256, 256); // BR
            }
            for (int i = 0; i < 9; i++)
            {
                string fileToSave = "C:\\Users\\Owner\\Documents\\MapFiles\\MapFile" + Convert.ToString(i) + ".bmp";
                //bmpList[i].Save(fileToSave);
            }

            return(bmp);
        }
Esempio n. 3
0
 public static Objects.MiniMapTile[] getMapTiles(string fileName)
 {
     if (fileExists(fileName))
     {
         Objects.Location pos          = getFileCoordinates(fileName);
         byte[]           fileContents = ReadFile(Environment.ExpandEnvironmentVariables(fileName));
         int index = 0;
         Objects.MiniMapTile[] Tiles = new Objects.MiniMapTile[65536];
         for (int x = 0; x < 256; x++)
         {
             for (int y = 0; y < 256; y++)
             {
                 Tiles[index].color    = fileContents[index];
                 Tiles[index].speed    = fileContents[index + 65536];
                 Tiles[index].x        = pos.x + x;
                 Tiles[index].y        = pos.y + y;
                 Tiles[index].z        = pos.z;
                 Tiles[index].walkable = false;
                 if (fileContents[index + 65536] != 255)
                 {
                     Tiles[index].walkable = true;
                 }
                 Tiles[index].fishable = false;
                 if (fileContents[index] == 40)
                 {
                     Tiles[index].fishable = true;
                 }
                 index++;
             }
         }
         return(Tiles);
     }
     else
     {
         return(new Objects.MiniMapTile[0]);
     }
 }
Esempio n. 4
0
 private void readLargeMapFile(object sender, RoutedEventArgs e)
 {            
     Objects.Location loc = new Objects.Location();
     loc.x = Read.X();
     loc.y = Read.Y();
     loc.z = Read.Z();
     LargeImage1.Source = loadBitmap(MapReading.getMapFileAroundMe(loc));
     LargeImage2.Source = loadBitmap(MapReading.getMapSpeedFileAroundMe(loc));
     MapReading.getMapSpeedFileAroundMe(loc).Save("SpeedFile.bmp");
     MapReading.getMapFileAroundMe(loc).Save("ColourFile.bmp");
 }
Esempio n. 5
0
 public static Objects.Location getFileCoordinates(string fileName)
 {
     if (fileExists(fileName))
     {
         Objects.Location pos = new Objects.Location();
         string[] PathSplit = fileName.Split('\\');
         string fName = PathSplit[PathSplit.Length - 1];
         char[] NameInChar = fName.ToCharArray();
         StringBuilder sb = new StringBuilder();
         sb.Append(NameInChar[0]);
         sb.Append(NameInChar[1]);
         sb.Append(NameInChar[2]);
         pos.x = Convert.ToInt32(sb.ToString()) * 256;
         sb.Clear();
         sb.Append(NameInChar[3]);
         sb.Append(NameInChar[4]);
         sb.Append(NameInChar[5]);
         pos.y = Convert.ToInt32(sb.ToString()) * 256; // LOL SPOTY!
         sb.Clear();
         sb.Append(NameInChar[6]);
         sb.Append(NameInChar[7]);
         pos.z = Convert.ToInt32(sb.ToString()); // LOL SPOTZ!
         sb.Clear();
         return pos;
     }
     else
     {
         return new Objects.Location();
     }
 }
Esempio n. 6
0
        public static StringBuilder[] getFileAroundMeNames(Objects.Location location)
        {
            // Format will be up, upri, ri, rido, do, dole, le, leup, self
            StringBuilder[] sbuild = new StringBuilder[9];
            StringBuilder   sb     = new StringBuilder();

            sb.Append("%APPDATA%\\Tibia\\Automap\\");

            for (int i = 0; i < 9; i++)
            {
                sbuild[i] = new StringBuilder();
            }

            // TL
            sb.Append(Convert.ToString(location.x / 256 - 1)); sb.Append(Convert.ToString(location.y / 256 - 1)); // Set x + Y
            if (location.z < 10)
            {
                sb.Append("0");
            }
            sb.Append(Convert.ToString(location.z));  // Set Z
            sb.Append(".map"); sbuild[0].Append(sb.ToString());
            sb.Clear();                               // add extension, assign to array, clear
            sb.Append("%APPDATA%\\Tibia\\Automap\\"); // Refresh sb for next string

            // TM
            sb.Append(Convert.ToString(location.x / 256)); sb.Append(Convert.ToString(location.y / 256 - 1)); // Set x + Y
            if (location.z < 10)
            {
                sb.Append("0");
            }
            sb.Append(Convert.ToString(location.z));  // Set Z
            sb.Append(".map"); sbuild[1].Append(sb.ToString());
            sb.Clear();                               // add extension, assign to array, clear
            sb.Append("%APPDATA%\\Tibia\\Automap\\"); // Refresh sb for next string

            //TR
            sb.Append(Convert.ToString(location.x / 256 + 1)); sb.Append(Convert.ToString(location.y / 256 - 1)); // Set x + Y
            if (location.z < 10)
            {
                sb.Append("0");
            }
            sb.Append(Convert.ToString(location.z));  // Set Z
            sb.Append(".map"); sbuild[2].Append(sb.ToString());
            sb.Clear();                               // add extension, assign to array, clear
            sb.Append("%APPDATA%\\Tibia\\Automap\\"); // Refresh sb for next string

            // ML
            sb.Append(Convert.ToString(location.x / 256 - 1)); sb.Append(Convert.ToString(location.y / 256)); // Set x + Y
            if (location.z < 10)
            {
                sb.Append("0");
            }
            sb.Append(Convert.ToString(location.z));  // Set Z
            sb.Append(".map"); sbuild[3].Append(sb.ToString());
            sb.Clear();                               // add extension, assign to array, clear
            sb.Append("%APPDATA%\\Tibia\\Automap\\"); // Refresh sb for next string

            // MM
            sb.Append(Convert.ToString(location.x / 256)); sb.Append(Convert.ToString(location.y / 256)); // Set x + Y
            if (location.z < 10)
            {
                sb.Append("0");
            }
            sb.Append(Convert.ToString(location.z));  // Set Z
            sb.Append(".map"); sbuild[4].Append(sb.ToString());
            sb.Clear();                               // add extension, assign to array, clear
            sb.Append("%APPDATA%\\Tibia\\Automap\\"); // Refresh sb for next string

            // MR
            sb.Append(Convert.ToString(location.x / 256 + 1)); sb.Append(Convert.ToString(location.y / 256)); // Set x + Y
            if (location.z < 10)
            {
                sb.Append("0");
            }
            sb.Append(Convert.ToString(location.z));  // Set Z
            sb.Append(".map"); sbuild[5].Append(sb.ToString());
            sb.Clear();                               // add extension, assign to array, clear
            sb.Append("%APPDATA%\\Tibia\\Automap\\"); // Refresh sb for next string

            // BL
            sb.Append(Convert.ToString(location.x / 256 - 1)); sb.Append(Convert.ToString(location.y / 256 + 1)); // Set x + Y
            if (location.z < 10)
            {
                sb.Append("0");
            }
            sb.Append(Convert.ToString(location.z));  // Set Z
            sb.Append(".map"); sbuild[6].Append(sb.ToString());
            sb.Clear();                               // add extension, assign to array, clear
            sb.Append("%APPDATA%\\Tibia\\Automap\\"); // Refresh sb for next string

            // BM
            sb.Append(Convert.ToString(location.x / 256)); sb.Append(Convert.ToString(location.y / 256 + 1)); // Set x + Y
            if (location.z < 10)
            {
                sb.Append("0");
            }
            sb.Append(Convert.ToString(location.z));  // Set Z
            sb.Append(".map"); sbuild[7].Append(sb.ToString());
            sb.Clear();                               // add extension, assign to array, clear
            sb.Append("%APPDATA%\\Tibia\\Automap\\"); // Refresh sb for next string

            // BR
            sb.Append(Convert.ToString(location.x / 256 + 1)); sb.Append(Convert.ToString(location.y / 256 + 1)); // Set x + Y
            if (location.z < 10)
            {
                sb.Append("0");
            }
            sb.Append(Convert.ToString(location.z)); // Set Z
            sb.Append(".map"); sbuild[8].Append(sb.ToString());
            sb.Clear();                              // add extension, assign to array, clear


            return(sbuild);
        }