asamy / forgottenmapeditor

Map editor written in lua for Open Tibia. Written with OtClient's framework.
Other
46 stars 20 forks source link

New Map/File Manager #62

Open mindrage opened 10 years ago

mindrage commented 10 years ago

Working on some File Manager stuff.

First thing is a FileDialog API. Basically a function that works like this:

FileDialog.show(title, filter, action)

it returns false if its busy, returns nil if nothing is selected. Action is a function(path) which is defined if a path is selected.

filedialog1

And a map manager for loading/saving files to make room for some extra features, like a minimap preview and recent maps. Thinking of removing the map description/positions into separate window or something. mapmanager

asamy commented 10 years ago

That looks awesome. If you need any help with core functionality, just let me know.

mindrage commented 10 years ago

Well, I did try alot of g_resources functions, but none of them seems to be able to give a list of directories and files so i had to do this iterator instead:

local function directory(path)
  local t = {}
  local i = 0;
  if g_app.getOs() == "linux" then
    for filename in io.popen('ls -a "'..directory..'"'):lines() do
      table.insert(t, filename)
    end
  elseif g_app.getOs() == "windows" then
    for filename in io.popen("dir " .. directory .. " /b /ad]]"):lines() do
      table.insert(t, filename)
    end
  end

  local n = #t
  return function()
      local list = t
      i = i + 1
      if i <= n then 
    return t[i]
      end
  end
end

But as it uses shell commands its really just very inaffective and simply wrong to use.., but i can access outside of the "listed" directories. Think you could help me solve this somehow?

asamy commented 10 years ago

Looks like we have no option but use boost filesystem and this is what im going to do, no worries. You shall have this done by today or tomorrow.

asamy commented 10 years ago

OtClient's commit https://github.com/edubart/otclient/commit/6745bff132544e4b66cf39da9ae1e8a3666d86bf implements this, read the commit message to learn how it works.

asamy commented 10 years ago

Please let me know about your recent activities on this, i really need this in very soon and if you need ANY help, do not hesitate to ask me. If you are unable to continue you can pass the code to someone or just post it here and we'll see if someone continues it, maybe i will.

mindrage commented 10 years ago

Oh sorry, Im still working on it. I'll try to finish it tomorrow. took a break due to christmas/exams.

asamy commented 10 years ago

Great to hear, thanks!

asamy commented 10 years ago

Any progress on this?

If you're having trouble using the new function, here's an explanation:

local files = g_resources.getDirectoryFiles("C:/what");
...
local map = g_map.openMap("what/map.otbm") -- or just pass the full path
mindrage commented 10 years ago

Oh well, I tried a bit, then got tired because i had to look up things into source all the time. But im setting up an Eclipse IDE with Lua Profiler, Autocomplete and debugger to ease development in both my server projects and perhaps otclient aswell. V http://eclipse.org/downloads/download.php?file=/koneki/products/stable/ldt/1.1/org.eclipse.koneki.ldt.product-win32.win32.x86_64.zip&mirror_id=514

the autocomplete part is easy, you just write a file with empty function headers with parameters.

Also trying to integrate an XML template for TFS 1.0

OTUI might be a bit harder to implement, but i assume it can be coded with a Java Plugin. But ill do that later.

I wont be able to finish this in a while, But you can have the modules sofar, Aint that much to be honest other than OTUI and Startup/Shutdown scripts.

http://speedy.sh/PXyBv/mapeditor-modules.zip

I'll try to share the IDE later.

asamy commented 10 years ago

Okay, thanks. Will have this finished by the end of jan got no time now.