diff --git a/mfile b/mfile index bdc7287..7ca2919 100644 --- a/mfile +++ b/mfile @@ -1,4 +1,4 @@ { "package": "lotj-ui", - "version": "v2.0-beta.1" + "version": "v2.0" } \ No newline at end of file diff --git a/src/resources/starter-map.dat b/src/resources/starter-map.dat new file mode 100644 index 0000000..6fd9ee9 Binary files /dev/null and b/src/resources/starter-map.dat differ diff --git a/src/scripts/mapper/mapper.lua b/src/scripts/mapper/mapper.lua index de180b3..aefc1dd 100644 --- a/src/scripts/mapper/mapper.lua +++ b/src/scripts/mapper/mapper.lua @@ -42,14 +42,46 @@ end -- Configuration of an amenity name to the environment code to use on rooms with it local amenityEnvCodes = { - bacta = 269, - bank = 267, - broadcast = 270, - hotel = 265, - library = 261, - locker = 263, - package = 262, - workshop = 266, + bacta = { + envCode = 269, + symbol = "B" + }, + bank = { + envCode = 267, + symbol = "B" + }, + broadcast = { + envCode = 270, + symbol = "B" + }, + hotel = { + envCode = 265, + symbol = "H" + }, + library = { + envCode = 261, + symbol = "L" + }, + locker = { + envCode = 263, + symbol = "L" + }, + package = { + envCode = 262, + symbol = "P" + }, + workshop = { + envCode = 266, + symbol = "W" + }, + ["turbolift landing"] = { + envCode = 259, + symbol = "L" + }, + ["turbolift"] = { + envCode = 263, + symbol = "T" + }, } local function trim(s) @@ -122,15 +154,13 @@ function lotj.mapper.printHelp() lotj.mapper.log("Mapper Command List") cecho([[ -map start +map start [] Begin mapping. Any new rooms you enter while mapping will be added to this area name, so you -should be sure to stop mapping before entering a ship or moving to a different zone. +should be sure to stop mapping before entering a ship or moving to a different planet. No area +name argument is required if you're on a planet, as we'll default to the planet name. Some tips to remember: - - Move slowly, and wait for the map to reflect your movements before going to the next room. - The MUD sends data about your current room after some delay, so moving too fast will make the - mapper skip rooms or draw exits which aren't there. - Use a light while mapping. Entering a dark room where you can't see will not update the map. - Use map shift to adjust room positioning, especially after going through turbolifts or voice-activated doors. It's faster to click-and-drag with the GUI to move large blocks of @@ -161,8 +191,12 @@ end function lotj.mapper.startMapping(areaName) areaName = trim(areaName) if #areaName == 0 then - lotj.mapper.log("Syntax: map start ") - return + if lotj.mapper.current and lotj.mapper.current.planet then + areaName = lotj.mapper.current.planet + else + lotj.mapper.log("Syntax: map start ") + return + end end if lotj.mapper.mappingArea ~= nil then @@ -272,13 +306,7 @@ function lotj.mapper.setup() end end if not hasAnyAreas then - lotj.mapper.mapperInstance:hide() - lotj.mapper.noAreasPrompt = Geyser.Label:new({ - x = 0, y = 0, - width = "100%", - height = "100%" - }, lotj.layout.upperRightTabData.contents["map"]) - lotj.mapper.noAreasPrompt:echo("No map data.

Use map help to get started.", nil, "c14") + loadMap(getMudletHomeDir().."/@PKGNAME@/starter-map.dat") end lotj.setup.registerEventHandler("sysDataSendRequest", lotj.mapper.handleSentCommand) @@ -419,41 +447,31 @@ function lotj.mapper.processCurrentRoom() end -function lotj.mapper.checkAmenityLine(roomName, amenityName, wasPending) +function lotj.mapper.checkAmenityLine(roomName, amenityName) if lotj.mapper.mappingArea == nil then return end - envCode = amenityEnvCodes[string.lower(amenityName)] - if envCode == nil then + amenityData = amenityEnvCodes[string.lower(amenityName)] + if amenityData == nil then return end + -- Sanity check that the current room matches the name we just saw local addAmenityRoom = nil if lotj.mapper.current.name == roomName then addAmenityRoom = lotj.mapper.current - elseif lotj.mapper.last.name == roomName then - addAmenityRoom = lotj.mapper.last + else + return end - -- If this wasn't stored for later use, we need a newline since this is being invoked on - -- seeing a room name and we don't want it mushed into that line. - if not wasPending then - echo("\n") - end + -- This is being invoked on seeing a room name and we don't want it mushed into that line. + echo("\n") - if addAmenityRoom == nil then - -- The room name we're triggering on might be the room we just entered but we haven't - -- received the GMCP event yet, so we'll store this for the next time we do. - lotj.mapper.pendingAmenity = { - roomName = roomName, - amenityName = amenityName, - } - else - lotj.mapper.log("Set amenity "..amenityName.." on room "..addAmenityRoom.name.."") - setRoomEnv(addAmenityRoom.vnum, envCode) - updateMap() - end + lotj.mapper.log("Set amenity "..amenityName.." on room "..addAmenityRoom.name.."") + setRoomEnv(addAmenityRoom.vnum, amenityData.envCode) + setRoomChar(addAmenityRoom.vnum, amenityData.symbol) + updateMap() end @@ -467,19 +485,26 @@ function lotj.mapper.onEnterRoom() vnum = gmcp.Room.Info.vnum, name = gmcp.Room.Info.name:gsub("&.", ""), exits = gmcp.Room.Info.exits or {}, + planet = gmcp.Room.Info.planet, } + + -- If the new room has has a planet different than the last one and we don't have + -- an area for that planet yet, give a prompt about how to start mapping it. + if lotj.mapper.current.planet then + if lotj.mapper.last and lotj.mapper.last.planet ~= lotj.mapper.current.planet then + if getAreaTable()[lotj.mapper.current.planet] == nil then + lotj.mapper.log("Welcome to "..lotj.mapper.current.planet..". ".. + "To begin mapping this area as you explore, type map start.") + echo("\n") + end + end + end lotj.mapper.processCurrentRoom() -- Since we've handled the move, we don't want the last move command to get -- used by anything else. lotj.mapper.lastMoveDir = nil - - local pendingAmenity = lotj.mapper.pendingAmenity - if pendingAmenity ~= nil then - lotj.mapper.checkAmenityLine(pendingAmenity.roomName, pendingAmenity.amenityName, true) - lotj.mapper.pendingAmenity = nil - end end @@ -518,6 +543,8 @@ function lotj.mapper.getRoomByCoords(areaName, x, y, z) end function doSpeedWalk() - echo("Path we need to take: " .. table.concat(speedWalkDir, ", ") .. "\n") - echo("A future version of the mapper script might actually execute these commands.\n") + lotj.mapper.log("Speedwalking using these directions: " .. table.concat(speedWalkDir, ", ") .. "\n") + for _, dir in ipairs(speedWalkDir) do + send(dir, false) + end end diff --git a/src/triggers/chat/triggers.json b/src/triggers/chat/triggers.json index c8a6281..787a63c 100644 --- a/src/triggers/chat/triggers.json +++ b/src/triggers/chat/triggers.json @@ -56,6 +56,10 @@ "pattern": "^\\( IMM \\| CHAT \\)\\[.*\\]: '.*'$", "type": "regex" }, + { + "pattern": "^\\( IMM \\| CHAT \\) You mortchat to .* '.*'$", + "type": "regex" + }, { "pattern": "^ImmNet\\[.*\\]: .*$", "type": "regex"