Guest User

automap = {} automap.path = "

a guest
May 15th, 2012
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. automap = {}
  2. automap.path = "C:\\Users\\" .. os.getenv("USERNAME") .. "\\AppData\\Roaming\\Tibia\\Automap"
  3. automap.parse = function(filename)
  4.     local positions = {}
  5.     local mapX,mapY,mapZ = tonumber(filename:sub(1, 4)), tonumber(filename:sub(4, 4)),tonumber(filename:sub(8, 3))
  6.     local file = io.open(automap.path .. "\\" .. filename, "rb")
  7.     local data = file:read(65536 * 2)
  8.     file:close()
  9.     local index = 1
  10.     for x = 0, 256 do
  11.         for y = 0, 256 do
  12.            table.insert(positions, {x=x+(mapX*256),y=y+(mapY*256),z=mapZ,color=string.char(data[index])})
  13.            index = index + 1
  14.         end
  15.     end
  16.     return positions
  17. end
  18.  
  19. automap.parse("00300606")
Advertisement
Add Comment
Please, Sign In to add comment