Skip to content

Commit

Permalink
Merge pull request #11 from 11BelowStudio/develop
Browse files Browse the repository at this point in the history
Version 1.2.0!
  • Loading branch information
11BelowStudio authored Jun 17, 2024
2 parents 51c004e + f5e6f21 commit 3bebc94
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: 1arp/[email protected]
# see https://github.com/marketplace/actions/create-a-file
with:
path: 'src/resources'
path: './'
isAbsolutePath: false
file: 'version.txt'
content: ${{ env.mfile_version }}
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
- uses: ncipollo/release-action@v1
# see https://github.com/marketplace/actions/create-release
with:
artifacts: "build/MUDKIP_Mud2.mpackage,src/resources/version.txt"
artifacts: "build/MUDKIP_Mud2.mpackage,version.txt"
allowUpdates: true
bodyFile: "./README.md"
tag: ${{ env.mfile_version }}
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
# CHANGELOG

## 1.2.0

*17/6/2024*

* Rewrote the automatic update code a little bit.
* Using the `dword` alias will clear the known dreamword.
* Also added a `DWORD` alias for saying the dreamword IN CAPITALS (for personae who tend to say things in capitals)
* Added an alias to fix accidentally putting an 's' at the end of emote-y commands whilst in game (correcting `smiles` to `smile`, `waves` into `wave`, `laughs` into `laugh` etc).
* Renamed the package to `Multi User Dungeon Kool Informational Package for MUD2` (says `Package` instead of `Panels`)

## 1.1.2

*7/6/2024*

* Fixed automatic updates (forgot to delete the downloaded version check file :P)

## 1.1.1

*7/6/2024*

* Added automatic updates so you (hopefully) don't need to manually update MUDKIP any more :)

## 1.1.0
Expand Down
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# MUDKIP_Mud2

## Multi User Dungeon Kool Informational Panels (for playing MUD2 with Mudlet)
## Multi User Dungeon Kool Informational Package (for playing MUD2 with Mudlet)

**MUDKIP** is a plucky little [Mudlet](https://www.mudlet.org) plugin
**MUDKIP** is a plucky little [Mudlet](https://www.mudlet.org) package
I bodged together, which adds some Kool Informational Panels
that might be of use whilst one is playing *MUD2*.

Expand Down Expand Up @@ -53,13 +53,17 @@ whistles like speedwalking, fancy maps, re-fighting, etc.

### Aliases

* `dword`
* **automatic dreamword**
* If the dreamword is known, this will send a `say <dreamword>`
command to the game.
* **automatic dreamword** `dword`
* If the dreamword is known, this will send a `say <dreamword>` command to the game.
* If the dreamword is not known, MUDKIP will leave a message
telling you that it doesn't know what the dreamword is.
* `dwo` and `dwor` are also aliases for this.
* There's an uppercase variant which says the dreamword in uppercase instead.
* **fixing emotes**
* Tired of accidentally sending `laughs`,`smiles`,`waves` etc
and then having the MUD2 parser complain about it?
* *MUDKIP_Mud2* will correct them to `laugh`, `smile`, `wave` etc, allowing you to perform those actions in peace.
* Many other verbs along these lines have also been fixed.

### API

Expand All @@ -84,12 +88,17 @@ if you wish to contribute to the development of *MUDKIP*.

## CHANGELOG

* **1.1.2** (7/6/2024)
* Added automatic updates so you (hopefully) don't need to manually update MUDKIP any more :)
* **1.2.0** (`17/6/2024)
* Rewrote the automatic update code a little bit.
* Using the `dword` alias will clear the known dreamword.
* Also added a `DWORD` alias for saying the dreamword IN CAPITALS (for personae who tend to say things in capitals)
* Added an alias to fix accidentally putting an 's' at the end of emote-y commands whilst in game (correcting `smiles` to `smile`, `waves` into `wave`, `laughs` into `laugh` etc).
* Slight rebrand for the package (P stands for 'Package' instead of 'Panels' now)


See [CHANGELOG.md](https://github.com/11BelowStudio/MUDKIP_Mud2/CHANGELOG.md) for the full changelog.
See [CHANGELOG.md](https://github.com/11BelowStudio/MUDKIP_Mud2/blob/main/CHANGELOG.md) for the full changelog.

## TODO

* see what people want I guess
* get the auto-update to check the tag on the latest release on git or something like that instead of the release version.txt(?)

Binary file modified docs/readme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions mfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"package": "MUDKIP_Mud2",
"version": "1.1.2",
"version": "1.2.0",
"author": "11BelowStudio",
"title": "Multi User Dungeon Kool Informational Panels (for playing MUD2 with Mudlet)",
"title": "Multi User Dungeon Kool Informational Package (for playing MUD2 with Mudlet)",
"outputFile": true,
"icon": "mudkip.png"
}
4 changes: 2 additions & 2 deletions release.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"package": "MUDKIP_Mud2",
"version": "1.1.2",
"version": "1.2.0",
"author": "11BelowStudio",
"title": "Multi User Dungeon Kool Informational Panels (for playing MUD2 with Mudlet)",
"title": "Multi User Dungeon Kool Informational Package (for playing MUD2 with Mudlet)",
"outputFile": true,
"icon": "mudkip.png"
}
12 changes: 11 additions & 1 deletion src/aliases/MUDKIP_Mud2/aliases.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@
},
{
"name": "say_dreamword",
"regex": "^dwo(rd?)?",
"regex": "^d[Ww][Oo]([Rr][Dd]?)?$",
"isActive": "true"
},
{
"name": "say_dreamword_uppercase",
"regex": "^D[Ww][Oo]([Rr][Dd]?)?$",
"isActive": "true"
},
{
"name":"emotes_with_s",
"isActive":"true",
"regex":"(?i)^(?<emote>bay|bark|blink|cackle|cheer|chuckle|drool|duck|flip|frown|gasp|giggle|glare|grin|groan|growl|gurgle|howl|laugh|leer|nod|point|ponder|pounce|pucker|purr|quack|roar|scream|shake|shiver|shout|shrug|sing|smile|smirk|spin|stammer|think|twiddle|wait|(re)?wave|whisper|wink|woof|yodel|yawn)s$"
}
]
8 changes: 8 additions & 0 deletions src/aliases/MUDKIP_Mud2/emotes_with_s.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- this alias is used to send emotes like 'laugh' when you accidentally send 'laughs' instead
if MUDKIP_Mud2:isInGame() then
--send(matches.emote) -- matches.namedGroup doesn't work for aliases for some reason.
send(matches[2]) -- this does seem to work. weird.
else
-- sends command as-is if you're not in-game
send(command)
end
1 change: 1 addition & 0 deletions src/aliases/MUDKIP_Mud2/say_dreamword.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ if MUDKIP_Mud2:isInGame() then
local dword = MUDKIP_Mud2:getDreamword()
if dword ~= "" then
send('say ' .. dword)
MUDKIP_Mud2:clearDreamword()
else
MUDKIP_Mud2:mcecho("Cannot say an unknown dreamword!","warn")
end
Expand Down
9 changes: 9 additions & 0 deletions src/aliases/MUDKIP_Mud2/say_dreamword_uppercase.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if MUDKIP_Mud2:isInGame() then
local dword = MUDKIP_Mud2:getDreamword()
if dword ~= "" then
send('say ' .. string.upper(dword))
MUDKIP_Mud2:clearDreamword()
else
MUDKIP_Mud2:mcecho("Cannot say an unknown dreamword!","warn")
end
end
113 changes: 81 additions & 32 deletions src/scripts/MUDKIP_Mud2/updates.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--[[
THE AUTO-UPDATER FOR MUDKIP_Mud2
heavily ripped off from https://forums.mudlet.org/viewtopic.php?f=6&t=4400&p=20635&hilit=update#p20635
heavily ripped off from https://forums.mudlet.org/viewtopic.php?p=20504
(DSL PNP 4.0 Main Script, Zachary Hiland, 2/09/2014)
Shoutouts to demonnic for providing the lua code to actually get the package installed and such
Expand All @@ -17,14 +17,13 @@ local defaults = {
version_check_download = "version.txt",
version_url = "",
file_path = "",
version_check_save = "dl_version.txt",
versions_file_name = "version.txt",
version_check_save = "dl_version.txt"--,
--versions_file_name = "version.txt",
}
defaults.package_url = defaults.download_path .. defaults.package_name .. ".mpackage"
defaults.version_url = defaults.download_path .. defaults.version_check_download
defaults.file_path = getMudletHomeDir() .. "/".. defaults.package_name .. "/"


defaults.temp_file_path = getMudletHomeDir() .. "/" .. defaults.package_name .. "_temp" .. "/"

local download_queue = download_queue or {}
local downloading = false
Expand All @@ -34,7 +33,12 @@ local scripts_list = {}
local init_list = {}
local event_list = {}

--[[
Attempts to open a file to read/write/append/modify.
If file could be read, returns table of file {name:str,mode:str,type:"fileIO_file",contents:{str}} and a nil
If it couldn't be read, returns a nil and a string with info about the error.
]]
local function fileOpen(filename,mode)
local errors
mode = mode or "read"
Expand Down Expand Up @@ -123,18 +127,58 @@ local function update_the_package()
end)
end

local function load_package_xml()
local function load_package_xml(path)


if path ~= defaults.temp_file_path .. defaults.package_name.. ".xml" then
if MUDKIP_Mud2 then
MUDKIP_Mud2:mcecho("Given unexpected .xml file (".. path .."), aborting! (please install the update manually.)", "error")
else
cecho("\n<b><ansiLightRed>ERROR</b><reset> - Given unexpected .xml file (".. path .."), aborting! (please install the update manually.)\n")
return
end
end


-- uninstall old package
uninstallPackage(defaults.package_name)

-- wipe old package variables etc from memory
_G.MUDKIP_Mud2 = nil

-- install new package
installPackage(defaults.download_path .. defaults.package_name .. ".xml")
tempTimer(1, function()
installPackage(path)
os.remove(path)
lfs.rmdir(defaults.temp_file_path)
end)
end

local function load_package_mpackage()
local function load_package_mpackage(path)

if path ~= defaults.temp_file_path .. defaults.package_name.. ".mpackage" then
if MUDKIP_Mud2 then
MUDKIP_Mud2:mcecho("Given unexpected .mpackage file (".. path .."), aborting! (please install the update manually.)", "error")
else
cecho("\n<b><ansiLightRed>ERROR</b><reset> - Given unexpected .mpackage file (".. path .."), aborting! (please install the update manually.)\n")
return
end
end

-- uninstall old package
uninstallPackage(defaults.package_name)

-- wipe old package variables etc from memory
_G.MUDKIP_Mud2 = nil

-- install new package
installPackage(defaults.download_path .. defaults.package_name .. ".mpackage")
tempTimer(1, function()
installPackage(path)
--installPackage(defaults.temp_file_path .. defaults.package_name .. ".mpackage")
os.remove(path)
lfs.rmdir(defaults.temp_file_path)
end)
--installPackage(defaults.download_path .. defaults.package_name .. ".mpackage")
end


Expand All @@ -144,7 +188,7 @@ local function start_download()
-- get info from queue
local info = download_queue[1]
if MUDKIP_Mud2 then
MUDKIP_Mud2:mcecho("Downloading remote version file " .. info[2] .. " to " .. info[1], "info")
MUDKIP_Mud2:mcecho("Downloading remote file " .. info[2] .. " to " .. info[1], "info")
else
cecho("\n<b><ansiLightYellow>INFO</b><reset> - Downloading remote version file " .. info[2] .. " to " .. info[1] .. "\n")
end
Expand Down Expand Up @@ -204,33 +248,35 @@ end

local function get_version_check()
-- create MUDKIP_Mud2 folder in Mudlet home directory if necessary
lfs.mkdir(getMudletHomeDir() .. "/" .. defaults.package_name)
lfs.mkdir(defaults.file_path)
-- download current version info
queue_download(defaults.file_path .. defaults.version_check_save, defaults.download_path .. defaults.version_check_download)
end

local function check_versions()
local version_path = defaults.file_path .. defaults.versions_file_name



--local version_path = defaults.file_path .. defaults.versions_file_name
local dl_path = defaults.file_path .. defaults.version_check_save
local dl_version, curr_version
local dl_file, version_file
local dl_file, dl_errors--, version_file


-- read in check file
dl_file = fileOpen(dl_path,"read")
if io.exists(version_path) then
-- read in version file
version_file = fileOpen(version_path,"read")
else
-- create new version file
local temp_v_file = fileOpen(version_path, "write")
temp_v_file.contents = {getPackageInfo(defaults.package_name,"version")}
fileClose(temp_v_file)
dl_file, dl_errors = fileOpen(dl_path,"read")

version_file = fileOpen(version_path,"read")
if dl_file == nil then
-- if something's gone AWOL and we couldn't read the file
if MUDKIP_Mud2 then
MUDKIP_Mud2:mcecho("Could not read remote version info file, aborting auto-update routine. (".. dl_errors ..")", "error")
else
cecho("\n<b><ansiLightRed>ERROR</b><reset> - Could not read remote version info file, aborting auto-update routine. (".. dl_errors ..")\n")
return
end
end

curr_version = version_file.contents[1]
curr_version = getPackageInfo(defaults.package_name,"version") --version_file.contents[1]
dl_version = dl_file.contents[1]

if MUDKIP_Mud2 then
Expand All @@ -240,7 +286,7 @@ local function check_versions()
end

-- close the files (we don't need them any more)
fileClose(version_file)
--fileClose(version_file)
fileClose(dl_file)

os.remove(dl_path)
Expand All @@ -251,7 +297,8 @@ local function check_versions()
else
cecho("\n<b><ansiLightYellow>INFO</b><reset> - Attempting to update MUDKIP to v" .. dl_version .."\n")
end
update_the_package()
M2Updates:update_package()
--update_the_package()
else
if MUDKIP_Mud2 then
MUDKIP_Mud2:mcecho("MUDKIP_Mud2 is up-to-date, have a nice day :)", "info")
Expand All @@ -260,6 +307,8 @@ local function check_versions()
end
end



end

local function finish_download(path)
Expand All @@ -273,9 +322,9 @@ local function finish_download(path)
if string.find(path,defaults.version_check_save) then
check_versions()
elseif string.find(path,".mpackage") then
--load_package_mpackage()
load_package_mpackage(path)
elseif string.find(path,".xml") then
--load_package_xml()
load_package_xml(path)
end
end

Expand All @@ -286,17 +335,17 @@ local function fail_download(...)
if MUDKIP_Mud2 then
MUDKIP_Mud2:mcecho("failed downloading " .. arg[2] .. arg[1], "error")
else
cecho("\n<b><ansiBrightRed>ERROR</b><reset> - failed downloading " .. arg[2] .. arg[1].. "\n")
cecho("\n<b><ansiLightRed>ERROR</b><reset> - failed downloading " .. arg[2] .. arg[1].. "\n")
end

--table.insert(unavailable, arg[1])
end

function M2Updates:update_package()
-- create MUDKIP_Mud2 folder in Mudlet home directory if necessary
--lfs.mkdir(getMudletHomeDir() .. "/MUDKIP_Mud2")
-- create MUDKIP_Mud2_temp folder in Mudlet home directory if necessary
lfs.mkdir(defaults.temp_file_path)
-- download newest package
--queue_download(defaults.file_path .. defaults.package_name .. ".xml", defaults.download_path .. defaults.package_name .. ".xml")
queue_download(defaults.temp_file_path .. defaults.package_name .. ".mpackage", defaults.download_path .. defaults.package_name .. ".mpackage")
end

function M2Updates:update_scripts()
Expand Down

0 comments on commit 3bebc94

Please sign in to comment.