Compare commits

..

15 Commits

Author SHA1 Message Date
e60721c110 VirtualShips (#1)
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/manual/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline failed
Reviewed-on: #1
Merge and Squash
2024-03-30 10:12:15 -05:00
2119809d2a Fine tuning
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-03-30 04:23:50 -04:00
89f65e6025 Setup Woodpecker CI
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Still just Woodpecker
2024-03-30 04:13:12 -04:00
Matthew Wagner
47bc988b39 Merge pull request #14 from LotJ/nield/galmap-final-fix
Add special starsystems query for mapper
2024-01-20 21:57:41 -10:00
Ian Alden
85e00ea775 Update readme 2024-01-21 00:17:27 -07:00
Ian Alden
1dcf4f0de9 Add special starsystems query for mapper 2024-01-21 00:13:23 -07:00
Matthew Wagner
e779f9940a Merge pull request #13 from LotJ/nield/osay-fix
Fix osay in chat window
2024-01-20 17:11:05 -10:00
Ian Alden
8ee32a20b3 Fix osay in chat window 2024-01-20 19:40:16 -07:00
Matthew Wagner
0d1e5f7695 Merge pull request #12 from LotJ/nield/galaxy-map-fix-2
Fix galaxy map for imms
2024-01-20 11:23:25 -10:00
Ian Alden
56aa040c9b Fix galaxy map for imms 2024-01-20 14:11:55 -07:00
Jonathan Gottfried
2f540f9127 Merge pull request #10 from LotJ/nield/fix-galmap
Fix trigger for galaxy map
2024-01-20 12:49:20 -05:00
Ian Alden
2a53d2fbe1 One more fix 2024-01-20 10:42:08 -07:00
Jonathan Gottfried
e092dbf204 Merge pull request #9 from LotJ/nield/fix-galmap
Nield/fix galmap
2024-01-20 12:34:29 -05:00
Ian Alden
5847f557ad Fix terminating chars 2024-01-20 10:27:36 -07:00
Ian Alden
2b3850ef98 Fix the galaxy map regex 2024-01-20 10:20:31 -07:00
7 changed files with 137 additions and 9 deletions

42
.woodpecker.yaml Normal file
View File

@@ -0,0 +1,42 @@
steps:
- name: build-release
image: alpine
when:
- event: tag
commands:
- apk add openjdk21
- apk add wget
- apk add tar
- wget https://github.com/demonnic/muddler/releases/download/0.13/muddle-shadow-0.13.tar
- tar -xvf muddle-shadow-0.13.tar
- mv muddle-shadow-0.13/lib/muddle-0.13-all.jar muddle.jar
- java -jar muddle.jar
- name: deploy-build
image: alpine
when:
- event: tag
environment:
GITEATKN:
from_secret: GITEA_TOKEN
GOTOKEN:
from_secret: GOTIFY_TOKEN
depends_on: build-release
commands:
- apk add tea
- apk add wget
- tea login add --name=temp --url=https://git.vertinext.com/ --token=$GITEATKN
- tea releases create --asset "build/lotj-ui.mpackage" --asset "build/lotj-ui.xml" --tag ${CI_COMMIT_TAG} --title "Latest Compiled Release" --note "Use .mpackage for Mudlet and .xml for Mushclient"
- wget "https://gotify.vertinext.com/message?token=$GOTOKEN" --post-data "title=${CI} - ${CI_REPO_NAME}&message=New release ${CI_COMMIT_TAG} built and deployed.&priority=0" -O /dev/null
- name: notify-on-branch-push
image: alpine
when:
- event: [push, pull_request, tag, release]
- status: [success, failure]
environment:
GOTOKEN:
from_secret: GOTIFY_TOKEN
commands:
- apk add wget
- wget "https://gotify.vertinext.com/message?token=$GOTOKEN" --post-data "title=${CI} - ${CI_REPO_NAME}&message=New ${CI_PIPELINE_EVENT} to ${CI_REPO_NAME}/${CI_COMMIT_BRANCH}.&priority=0" -O /dev/null

View File

@@ -55,7 +55,7 @@ After creating a Mudlet profile to connect to LOTJ, do the following to add the
## Contributing ## Contributing
The source for this package is structured to use [muddler](https://github.com/demonnic/muddler) to package it into a Mudlet package. The source for this package is structured to use [muddler](https://github.com/demonnic/muddler) to package it into a Mudlet package. Using version 0.1 is necessary at this time due to some errant behavior by later Muddler versions.
You can, of course, just modify the triggers/aliases/scripts directly within Mudlet if you want to test local changes, but they'll be overwritten if you want to update to future versions of this package. You can, of course, just modify the triggers/aliases/scripts directly within Mudlet if you want to test local changes, but they'll be overwritten if you want to update to future versions of this package.
@@ -64,7 +64,7 @@ To change the source for this package, modify the JSON files and associated Lua
If you have Docker set up, it can be easiest to run a command like this to regenerate the package, from the root of the repository: If you have Docker set up, it can be easiest to run a command like this to regenerate the package, from the root of the repository:
``` ```
docker run --rm -it -u $(id -u):$(id -g) -v $PWD:/$PWD -w /$PWD demonnic/muddler docker run --rm -it -u $(id -u):$(id -g) -v $PWD:/$PWD -w /$PWD demonnic/muddler:0.1
``` ```
If that's a pain, just make a pull request and someone else can generate the package with your changes to make sure they work. If that's a pain, just make a pull request and someone else can generate the package with your changes to make sure they work.

2
mfile
View File

@@ -1,4 +1,4 @@
{ {
"package": "lotj-ui", "package": "lotj-ui",
"version": "v2.3.1" "version": "v2.3.3"
} }

View File

@@ -1,5 +1,5 @@
lotj.galaxyMap.resetData() lotj.galaxyMap.resetData()
enableTrigger("galaxy-map-refresh") enableTrigger("galaxy-map-refresh")
send("starsystems", false) send("starsystems map", false)
send("planets", false) send("planets", false)

View File

@@ -227,6 +227,7 @@ function lotj.mapper.startMapping(areaName)
end end
lotj.mapper.mappingArea = areaName lotj.mapper.mappingArea = areaName
lotj.mapper.lastMoveDirs = {}
lotj.mapper.processCurrentRoom() lotj.mapper.processCurrentRoom()
end end
@@ -344,8 +345,11 @@ function lotj.mapper.setup()
loadMap(getMudletHomeDir().."/@PKGNAME@/starter-map.dat") loadMap(getMudletHomeDir().."/@PKGNAME@/starter-map.dat")
end end
lotj.mapper.loadShipData()
lotj.setup.registerEventHandler("sysDataSendRequest", lotj.mapper.handleSentCommand) lotj.setup.registerEventHandler("sysDataSendRequest", lotj.mapper.handleSentCommand)
lotj.setup.registerEventHandler("gmcp.Room.Info", lotj.mapper.onEnterRoom) lotj.setup.registerEventHandler("gmcp.Room.Info", lotj.mapper.onEnterRoom)
lotj.setup.registerEventHandler("sysExitEvent", lotj.mapper.saveShipData)
end end
function lotj.mapper.teardown() function lotj.mapper.teardown()
@@ -353,11 +357,28 @@ function lotj.mapper.teardown()
geyserMapper:hide() geyserMapper:hide()
end end
function lotj.mapper.loadShipData()
local location = getMudletHomeDir() .. "/lotjmapper_ship.lua"
lotj.mapper.shipLastRoom = lotj.mapper.shipLastRoom or {}
if io.exists(location) then table.load(location, lotj.mapper.shipLastRoom) end
end
function lotj.mapper.saveShipData()
if lotj.mapper.shipLastRoom then
local location = getMudletHomeDir() .. "/lotjmapper_ship.lua"
table.save(location, lotj.mapper.shipLastRoom)
end
end
-- Track the most recent movement command so we know which direction we moved when automapping -- Track the most recent movement command so we know which direction we moved when automapping
function lotj.mapper.handleSentCommand(event, cmd) function lotj.mapper.handleSentCommand(event, cmd)
-- If we're not mapping, don't bother -- If we're not mapping, store the last direction only for ships
if lotj.mapper.mappingArea == nil then if lotj.mapper.mappingArea == nil then
if not gmcp.Room.Info.planet then
-- only store movement if we're actually on a ship
lotj.mapper.shipMovement = lotj.mapper.shipMovement or {}
table.insert(lotj.mapper.shipMovement, dirObj(trim(cmd)))
end
return return
end end
@@ -380,6 +401,32 @@ function lotj.mapper.popMoveDir()
return result return result
end end
-- Function used to handle virtual ship maps. This will process the room
-- as a ship and attempt to position a player on an existing map of the same ship.
function lotj.mapper.processCurrentRoomAsShip(roomData, movement)
local roomVnum = table.keys(roomData)[1]
local matchesMany = #table.keys(roomData)
if matchesMany == 1 then
-- Only one room matched.
lotj.mapper.shipLastRoom = {actual = gmcp.Room.Info.vnum, virtual = roomVnum}
centerview(roomVnum)
elseif matchesMany > 1 then
-- Multiple matches
if lotj.mapper.shipLastRoom ~= nil and lotj.mapper.shipLastRoom.actual == gmcp.Room.Info.vnum then
-- This is likely a reboot. The last room and the current room match.
centerview(lotj.mapper.shipLastRoom.virtual)
elseif lotj.mapper.shipLastRoom ~= nil and movement then
-- position based on movement
local nextRoom = getRoomExits(lotj.mapper.shipLastRoom.virtual)
if table.contains(nextRoom, movement.long) then
lotj.mapper.shipLastRoom = {acutal = gmcp.Room.Info.vnum, virtual = nextRoom[movement.long]}
centerview(lotj.mapper.shipLastRoom.virtual)
end
end
end
end
-- Function used to handle a room that we've moved into. This will use the data on -- Function used to handle a room that we've moved into. This will use the data on
-- lotj.mapper.current, compared with lotj.mapper.last, to potentially create a new room and -- lotj.mapper.current, compared with lotj.mapper.last, to potentially create a new room and
@@ -388,6 +435,25 @@ function lotj.mapper.processCurrentRoom()
local vnum = lotj.mapper.current.vnum local vnum = lotj.mapper.current.vnum
local moveDir = lotj.mapper.popMoveDir() local moveDir = lotj.mapper.popMoveDir()
local room = lotj.mapper.getRoomByVnum(vnum) local room = lotj.mapper.getRoomByVnum(vnum)
local searchData = searchRoom(gmcp.Room.Info.name, false, true)
-- Only virtualize ships when we aren't actively mapping
if not gmcp.Room.Info.planet and lotj.mapper.mappingArea == nil then
if room == nil then
-- Don't virtualize if it's actually mapped
if not table.is_empty(searchData) then
if lotj.mapper.shipMovement then
lotj.mapper.processCurrentRoomAsShip(searchData, table.remove(lotj.mapper.shipMovement,1))
else
lotj.mapper.processCurrentRoomAsShip(searchData, nil)
end
return
end
end
else
-- if we're not virtualizing, make sure this is empty
lotj.mapper.shipMovement = {}
end
if lotj.mapper.mappingArea == nil and room == nil then if lotj.mapper.mappingArea == nil and room == nil then
lotj.mapper.logDebug("Room not found, but mapper not running.") lotj.mapper.logDebug("Room not found, but mapper not running.")
@@ -399,6 +465,26 @@ function lotj.mapper.processCurrentRoom()
lastRoom = lotj.mapper.getRoomByVnum(lotj.mapper.last.vnum) lastRoom = lotj.mapper.getRoomByVnum(lotj.mapper.last.vnum)
end end
-- Try to account for moving between visible and non-visible rooms
if moveDir ~= nil then
if not table.contains(gmcp.Room.Info.exits, revDirObj(moveDir.long).long) then
-- There was no return exit in this room matching the movement
if not table.is_empty(lotj.mapper.lastMoveDirs) then
-- There are additional movements in the table so test those
while not table.is_empty(lotj.mapper.lastMoveDirs) do
local tempDir = lotj.mapper.popMoveDir()
if table.contains(gmcp.Room.Info.exits, revDirObj(tempDir.long).long) then
-- This seems to be a match so use this one and empty out the last room as it is incorrect
moveDir = tempDir
lotj.mapper.last = nil
lastRoom = nil
end
end
end
end
end
-- Create the room if we don't have it yet -- Create the room if we don't have it yet
if room == nil then if room == nil then
lotj.mapper.log("Added new room: <yellow>"..lotj.mapper.current.name.."<reset>") lotj.mapper.log("Added new room: <yellow>"..lotj.mapper.current.name.."<reset>")

View File

@@ -19,11 +19,11 @@
"type": "regex" "type": "regex"
}, },
{ {
"pattern": "^\\(OOC\\) You say '.*'$", "pattern": "^\\(OSAY\\) You say '.*'$",
"type": "regex" "type": "regex"
}, },
{ {
"pattern": "^\\(OOC\\) .* says '.*'$", "pattern": "^\\(OSAY\\) .* says '.*'$",
"type": "regex" "type": "regex"
}, },
{ {

View File

@@ -172,7 +172,7 @@
"fireLength": 1, "fireLength": 1,
"patterns": [ "patterns": [
{ {
"pattern": "Listing publicly known starsystems:", "pattern": "Listing known starsystems:",
"type": "substring" "type": "substring"
} }
], ],
@@ -181,7 +181,7 @@
"name": "system-line", "name": "system-line",
"patterns": [ "patterns": [
{ {
"pattern": "^(.*) \\( ([0-9-]+), ([0-9-]+) \\)$", "pattern": "^(.*)\\s+\\(\\s*([0-9-]+), ([0-9-]+)\\s*\\)$",
"type": "regex" "type": "regex"
} }
] ]