Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- byte[,,] TibiaMap;
- private void button8_Click(object sender, EventArgs e)
- {
- string Path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Tibia\\Automap\\";
- int StartX = 31744;
- int StartY = 30976;
- int MaxHeight = 2048;
- int MaxWidth = 2048;
- TibiaMap = new byte[16, 2048, 2048];
- DirectoryInfo di = new DirectoryInfo(Path);
- for (int z = 0; z < 16; z++)
- {
- FileInfo[] mapFiles = di.GetFiles("1??1??" +
- z.ToString("00") +
- ".map");
- foreach (FileInfo inf in mapFiles)
- {
- Location RealLocation = MapFileNameToLocation(inf.Name);
- int ArrayX = RealLocation.X - StartX;
- int ArrayY = RealLocation.Y - StartY;
- byte[] ColorArray = new byte[65536];
- FileStream fs = new FileStream(inf.FullName, FileMode.Open);
- BufferedStream bs = new BufferedStream(fs);
- bs.Read(ColorArray, 0, 65536);
- int index = 0;
- for (int x = 0; x < 256; x++)
- {
- for (int y = 0; y < 256; y++)
- {
- TibiaMap[z, x + ArrayX,y + ArrayY] = ColorArray[index];
- index += 1;
- }
- }
- fs.Close();
- }
- }
- }
- private Location MapFileNameToLocation(string fileName)
- {
- Location l = new Location(0, 0, 0);
- if (fileName.Length == 12 || fileName.Length == 8)
- {
- l.X = Int32.Parse(fileName.Substring(0, 3)) * 256;
- l.Y = Int32.Parse(fileName.Substring(3, 3)) * 256;
- l.Z = Int32.Parse(fileName.Substring(6, 2));
- }
- return l;
- }
- private void button9_Click(object sender, EventArgs e)
- {
- int StartX = 31744;
- int StartY = 30976;
- int arrayX = client.PlayerLocation.X - StartX;
- int arrayY = client.PlayerLocation.Y - StartY;
- MessageBox.Show(TibiaMap[client.PlayerLocation.Z, arrayX, arrayY].ToString());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement