Skip to content

Commit a637f23

Browse files
committed
First full code commit.
1 parent 9ca8b90 commit a637f23

File tree

134 files changed

+6966
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+6966
-0
lines changed

mfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"package": "GoMud-Mapper",
3+
"title": "GoMud Mapper",
4+
"description": "Custom GMCP mapper for GoMud, based on the IRE GMCP mapper script.",
5+
"version": "1.0.0",
6+
"author": "Morquin - forked from the IRE Mudlet Mapper",
7+
"icon": "gomud-mapper.png",
8+
"dependencies": "",
9+
"outputFile": true
10+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
local tmp = getRoomUserData(1, "gotoMapping")
2+
local maptable = {}
3+
4+
if tmp ~= "" then
5+
maptable = yajl.to_value(tmp)
6+
end
7+
8+
local location, markname
9+
if not matches[3] then
10+
markname = matches[2]
11+
location = mmp.currentroom
12+
elseif tonumber(matches[2]) then
13+
location = matches[2]; markname = matches[3]
14+
else
15+
location = matches[3]; markname = matches[2]
16+
end
17+
18+
-- can't allow mark name to ne a number - yajl then generates a giant table of null's
19+
if tonumber(markname) then
20+
mmp.echo("The mark name can't be a number.") return
21+
end
22+
23+
maptable[markname] = location
24+
local tmp2 = yajl.to_string(maptable)
25+
26+
if not mmp.roomexists(1) then
27+
addRoom(1)
28+
end
29+
30+
setRoomUserData(1, "gotoMapping", tmp2)
31+
mmp.echo(string.format("Room mark for '%s' set to room %s.", markname, location))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mmp.roomLabel(matches[2])
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mmp.echoAreaList()
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
enableTrigger("Parse wholist")
2+
send("who b")
3+
tempTimer(10, [[disableTrigger'Parse wholist']])
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
local tmp= getRoomUserData(1, "gotoMapping")
2+
if tmp~="" then
3+
local maptable = yajl.to_value(tmp) or {}
4+
local sortedkeys = {}
5+
for k in pairs(maptable) do sortedkeys[#sortedkeys+1] = k end
6+
table.sort(sortedkeys)
7+
8+
mmp.echo("Known marks in this map:")
9+
if next(maptable) then
10+
for i = 1, #sortedkeys do echo(string.format(" %-21s %s\n", tostring(sortedkeys[i]), tostring(maptable[sortedkeys[i]]))) end
11+
else
12+
echo(" (none)\n")
13+
end
14+
else
15+
mmp.echo("No marks are recorded in this map.")
16+
end
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
if not matches[2] and not matches[3] then
2+
mmp.echo("Where do you want to showpath to?")
3+
elseif matches[2] and not matches[3] then
4+
mmp.echoPath(mmp.currentroom, matches[2])
5+
else
6+
mmp.echoPath(matches[2], matches[3])
7+
end
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
local where = matches[2]:lower()
2+
local gallop
3+
if command:ends("gallop") then
4+
gallop = "gallop"
5+
where = where:sub(1, -8)
6+
elseif command:ends("sprint") then
7+
gallop = "sprint"
8+
where = where:sub(1, -8)
9+
elseif command:ends("dash") then
10+
gallop = "dash"
11+
where = where:sub(1, -6)
12+
elseif command:ends("runaway") then
13+
gallop = "runaway"
14+
where = where:sub(1, -9)
15+
elseif command:ends("glide") then
16+
gallop = "glide"
17+
where = where:sub(1, -7)
18+
end
19+
if mmp.debug then
20+
mmp.gotoPerf = mmp.gotoPerf or createStopWatch()
21+
startStopWatch(mmp.gotoPerf)
22+
end
23+
-- goto room ID
24+
if tonumber(where) then
25+
mmp.gotoRoom(where, gallop)
26+
else
27+
-- goto area or feature
28+
local split = where:split(" ")
29+
if split[1] == "feature" then
30+
table.remove(split, 1)
31+
mmp.gotoFeature(table.concat(split, " "), gallop)
32+
else
33+
if tonumber(split[#split]) then
34+
mmp.gotoArea(where:sub(1, -#(split[#split]) - 2), tonumber(split[#split]), gallop)
35+
else
36+
mmp.gotoArea(where, nil, gallop)
37+
end
38+
end
39+
end
40+
if mmp.debug then
41+
mmp.echo("goto alias took " .. stopStopWatch(mmp.gotoPerf) .. "s to run.")
42+
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mmp.listMapFeatures()
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
local function s(loc)
2+
if string.ends(loc, ".json") and not loadJsonMap then
3+
mmp.echo("Your Mudlet can't load maps in JSON, please upgrade first.")
4+
return
5+
end
6+
7+
local allok = true
8+
if string.ends(loc, ".json") then
9+
allok = loadJsonMap(loc)
10+
else
11+
allok = loadMap(loc)
12+
end
13+
14+
if not allok then
15+
mmp.echo("Couldn't load the map :(")
16+
else
17+
mmp.lockWormholes();
18+
mmp.lockSewers();
19+
mmp.lockPebble();
20+
if mmp.settings.waterwalk then
21+
mmp.enableWaterWalk()
22+
else
23+
mmp.disableWaterWalk()
24+
end
25+
if loc ~= "" then
26+
mmp.echo("Map loaded.")
27+
else
28+
mmp.echo("Loaded the default map.")
29+
end
30+
raiseEvent("mmapper updated map")
31+
end
32+
end
33+
34+
if matches[2] and matches[2] == "custom" then
35+
s(invokeFileDialog(true, "Please select the map file and click Open to load it"))
36+
elseif matches[2] then
37+
s(getMudletHomeDir() .. "/map/" .. matches[2])
38+
else
39+
s("")
40+
end

0 commit comments

Comments
 (0)