Skip to content

Commit

Permalink
(autocommit) Updated IRE mapping script to latest upstream (Mudlet#4988)
Browse files Browse the repository at this point in the history
Co-authored-by: mudlet-machine-account <mudlet-machine-account@users.noreply.github.com>
  • Loading branch information
1 parent 32e30d9 commit 9fd144c
Showing 1 changed file with 71 additions and 45 deletions.
116 changes: 71 additions & 45 deletions src/mudlet-mapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4915,53 +4915,91 @@ end</script>
</Alias>
<Alias isActive="yes" isFolder="no">
<name>Save a map</name>
<script>local function s(loc)
if not saveMap(loc) then
mmp.echo("Couldn't save the map :(")
else
if loc ~= "" then mmp.echo("Map saved.") else mmp.echo("Saved the default map.") end
end
<script>local function s(location, format)
local savednormal, savedjson = "not saved", "not saved"
if format == "json" then
savedjson = saveJsonMap(location)
elseif format == "all" then
savednormal = saveMap(location)
savedjson = saveJsonMap(location)
elseif format == nil or format == "" then
savednormal = saveMap(location)
end

if savednormal == nil then
mmp.echo("Couldn't save the map :(")
elseif savednormal == true then
mmp.echo(location ~= "" and "Map saved." or "Saved the default map.")
end
if savedjson == nil then
mmp.echo("Couldn't save the JSON map :(")
elseif savedjson == true then
mmp.echo(location ~= "" and "Map saved in JSON." or "Saved the default map in JSON.")
end
end

if not saveMap then
mmp.echo("Your Mudlet can't save maps. Please upgrade it!")
if matches[2] and (matches[2] == "json" or matches[2] == "all") and not saveJsonMap then
mmp.echo("Your Mudlet can't save maps in JSON, please upgrade first.")
return
end
if matches[3] and matches[3] == "custom" then
s(
invokeFileDialog(false, "Please select the folder to save the map in and hit Open") ..
"/Mudlet map from " ..
os.date("%A %d, %b '%y") ..
".dat",
matches[2]
)
elseif matches[3] then
s(getMudletHomeDir() .. "/map/" .. matches[3], matches[2])
else
if matches[2] and matches[2] == "custom" then
s(invokeFileDialog(false, "Please select the folder to save the map in and hit Open").."/Mudlet map from "..os.date("%A %d, %b '%y")..".dat")
elseif matches[2] then
s(getMudletHomeDir().."/map/"..matches[2])
else
s("")
end
s("", matches[2])
end</script>
<command></command>
<packageName></packageName>
<regex>^map save(?: (.+))?$</regex>
<regex>^map save(?: (json|all))?(?: (.+))?$</regex>
</Alias>
<Alias isActive="yes" isFolder="no">
<name>Load a map</name>
<script>local function s(loc)
if not loadMap(loc) then
mmp.echo("Couldn't load the map :(")
if string.ends(loc, ".json") and not loadJsonMap then
mmp.echo("Your Mudlet can't load maps in JSON, please upgrade first.")
return
end

local allok = true
if string.ends(loc, ".json") then
allok = loadJsonMap(loc)
else
allok = loadMap(loc)
end

if not allok then
mmp.echo("Couldn't load the map :(")
else
mmp.lockWormholes();
mmp.lockSewers();
mmp.lockPebble();
if mmp.settings.waterwalk then
mmp.enableWaterWalk()
else
mmp.lockWormholes(); mmp.lockSewers(); mmp.lockPebble();
if mmp.settings.waterwalk then mmp.enableWaterWalk() else mmp.disableWaterWalk() end

if loc ~= "" then mmp.echo("Map loaded.") else mmp.echo("Loaded the default map.") end
raiseEvent("mmapper updated map")
mmp.disableWaterWalk()
end
if loc ~= "" then
mmp.echo("Map loaded.")
else
mmp.echo("Loaded the default map.")
end
raiseEvent("mmapper updated map")
end
end

if not loadMap then
mmp.echo("Your Mudlet can't load maps. Please upgrade it!")
if matches[2] and matches[2] == "custom" then
s(invokeFileDialog(true, "Please select the map file and click Open to load it"))
elseif matches[2] then
s(getMudletHomeDir() .. "/map/" .. matches[2])
else
if matches[2] and matches[2] == "custom" then
s(invokeFileDialog(true, "Please select the map file and click Open to load it"))
elseif matches[2] then
s(getMudletHomeDir().."/map/"..matches[2])
else
s("")
end
s("")
end</script>
<command></command>
<packageName></packageName>
Expand Down Expand Up @@ -5104,18 +5142,6 @@ end</script>
<packageName></packageName>
<regex>^(small|big|biggest)map(?: (\d+))?$</regex>
</Alias>
<Alias isActive="yes" isFolder="no">
<name>^make maps$</name>
<script>local c = 0
for _, id in pairs(getAreaTable()) do
tempTimer(c*.5, [[exportAreaImage(]]..id..[[)]])
c = c + 1
end
mmp.echo("Done!")</script>
<command></command>
<packageName></packageName>
<regex>^make maps$</regex>
</Alias>
<Alias isActive="yes" isFolder="no">
<name>Set debug mode</name>
<script>if matches[2] == "on" then
Expand Down Expand Up @@ -5446,7 +5472,7 @@ mmp.lagtable = {
time = 10
}
}
local newversion = "21.2.1"
local newversion = "21.3.1"
if mmp.version and mmp.version ~= newversion then
if not mmp.game then
mmp.echo(
Expand Down

0 comments on commit 9fd144c

Please sign in to comment.