mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 03:54:54 +02:00
New lightweight minimap format, finish #15
This commit is contained in:
@@ -6,7 +6,7 @@ navigating = false
|
||||
minimapWidget = nil
|
||||
minimapButton = nil
|
||||
minimapWindow = nil
|
||||
|
||||
otmm = false
|
||||
flagsPanel = nil
|
||||
flagWindow = nil
|
||||
nextFlagId = 0
|
||||
@@ -49,6 +49,7 @@ function init()
|
||||
reset()
|
||||
minimapWindow:setup()
|
||||
loadMapFlags()
|
||||
useOTMM()
|
||||
|
||||
if g_game.isOnline() then
|
||||
addEvent(function() updateMapFlags() end)
|
||||
@@ -263,17 +264,32 @@ end
|
||||
|
||||
function loadMap()
|
||||
local protocolVersion = g_game.getProtocolVersion()
|
||||
local minimapFile = '/minimap_' .. protocolVersion .. '.otcm'
|
||||
if g_resources.fileExists(minimapFile) then
|
||||
g_map.clean()
|
||||
g_map.loadOtcm(minimapFile)
|
||||
g_map.clean()
|
||||
g_minimap.clean()
|
||||
|
||||
if otmm then
|
||||
local minimapFile = '/minimap.otmm'
|
||||
if g_resources.fileExists(minimapFile) then
|
||||
g_minimap.loadOtmm(minimapFile)
|
||||
end
|
||||
else
|
||||
local minimapFile = '/minimap_' .. protocolVersion .. '.otcm'
|
||||
if g_resources.fileExists(minimapFile) then
|
||||
g_map.loadOtcm(minimapFile)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function saveMap()
|
||||
local protocolVersion = g_game.getProtocolVersion()
|
||||
local minimapFile = '/minimap_' .. protocolVersion .. '.otcm'
|
||||
g_map.saveOtcm(minimapFile)
|
||||
|
||||
if otmm then
|
||||
local minimapFile = '/minimap.otmm'
|
||||
g_minimap.saveOtmm(minimapFile)
|
||||
else
|
||||
local minimapFile = '/minimap_' .. protocolVersion .. '.otcm'
|
||||
g_map.saveOtcm(minimapFile)
|
||||
end
|
||||
end
|
||||
|
||||
function toggle()
|
||||
@@ -286,6 +302,10 @@ function toggle()
|
||||
end
|
||||
end
|
||||
|
||||
function useOTMM()
|
||||
otmm = true
|
||||
end
|
||||
|
||||
function isClickInRange(position, fromPosition, toPosition)
|
||||
return (position.x >= fromPosition.x and position.y >= fromPosition.y and position.x <= toPosition.x and position.y <= toPosition.y)
|
||||
end
|
||||
|
Reference in New Issue
Block a user