Initial push
This commit is contained in:
17
src/aliases/bashmatic/BM_Addtarget.lua
Normal file
17
src/aliases/bashmatic/BM_Addtarget.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
if not bashmatic.configs.death.event then
|
||||
cecho("<firebrick>BASHMATIC: You must configure the death trigger first. Please see bm help for more info.")
|
||||
else
|
||||
if bashmatic.configs.enemies.detection == "inline" then
|
||||
-- using trigger detection
|
||||
local area = nil
|
||||
if bashmatic.configs.areas.detection == "mapper" then area = GetRoomAreaName(GetRoomArea(GetPlayerRoom())) end
|
||||
if bashmatic.configs.areas.detection == "gmcp" and bashmatic.configs.areas.data ~= nil then area = bashmatic.configs.areas.data end
|
||||
inlineAddTarget(matches[2], area)
|
||||
elseif bashmatic.configs.enemies.detection == "gmcp" then
|
||||
-- using gmcp detection
|
||||
cecho("<firebrick>BASHMATIC: GMCP not implemented yet.")
|
||||
else
|
||||
-- well this is broken
|
||||
cecho("<firebrick>BASHMATIC: Invalid enemy detection method.<reset>")
|
||||
end
|
||||
end
|
||||
10
src/aliases/bashmatic/BM_Clear.lua
Normal file
10
src/aliases/bashmatic/BM_Clear.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
if table.size(bashmatic.hunting.events) > 0 then
|
||||
for _, tid in ipairs(bashmatic.hunting.events) do
|
||||
killTrigger(tid)
|
||||
end
|
||||
end
|
||||
toggleBashing(false)
|
||||
bmDisable()
|
||||
bashmatic.hunting.events = {}
|
||||
bashmatic.hunting.targets = {}
|
||||
cecho("<firebrick>BASHMATIC: Cleared target list.<reset>")
|
||||
24
src/aliases/bashmatic/BM_Config.lua
Normal file
24
src/aliases/bashmatic/BM_Config.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
cecho("<MediumPurple>Bashmatic - Let's Bash Some Mobs!")
|
||||
cecho("<Slategrey>---------------------------------")
|
||||
cecho("<DarkSlateBlue>See bm help for information on configuration.")
|
||||
cecho("<DarkSlateBlue>")
|
||||
cecho("<MediumPurple>\nBattle Commands:")
|
||||
cecho("<DarkSlateBlue>-- Start : " .. bashmatic.commands.start or "None")
|
||||
cecho("<DarkSlateBlue>-- Before: " .. bashmatic.commands.before or "None")
|
||||
cecho("<DarkSlateBlue>-- During: " .. bashmatic.commands.during or "None" .. "(Every " .. bashmatic.commands.duringTime .. "s)")
|
||||
cecho("<DarkSlateBlue>-- After : " .. bashmatic.commands.after or "None")
|
||||
cecho("<MediumPurple>\n\nDeath Trigger:")
|
||||
cecho("<DarkSlateBlue>-- Phrase : " .. bashmatic.death.phrase or "None")
|
||||
cecho("<DarkSlateBlue>-- Activated?: " .. bashmatic.death.event or "No")
|
||||
cecho("<MediumPurple>\n\nDetection:")
|
||||
cecho("<DarkSlateBlue>-- Detecting enemies using " .. bashmatic.configs.enemies.detection)
|
||||
if bashmatic.configs.areas.detection == nil then
|
||||
cecho("<DarkSlateBlue>-- Not currently grouping enemies by areas.")
|
||||
else
|
||||
cecho("<DarkSlateBlue>-- Currently grouping enemies by areas using " .. bashmatic.configs.areas.detection)
|
||||
end
|
||||
if bashmatic.configs.enemies.detection == "gmcp" or bashmatic.configs.areas.detection == "gmcp" then
|
||||
cecho("<MediumPurple>\n\nGMCP Detection Settings:")
|
||||
if bashmatic.configs.enemies.detection == "gmcp" then cecho("<DarkSlateBlue>-- Enemy data located at " .. bashmatic.configs.enemies.location) end
|
||||
if bashmatic.configs.areas.detection == "gmcp" then cecho("<DarkSlateBlue>-- Area data located at " .. bashmatic.configs.areas.location) end
|
||||
end
|
||||
25
src/aliases/bashmatic/BM_Configset.lua
Normal file
25
src/aliases/bashmatic/BM_Configset.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
local which = matches[2]:lower()
|
||||
|
||||
if which == "phrase" then
|
||||
-- death phrase
|
||||
elseif which == "start" then
|
||||
-- starting battle command
|
||||
elseif which == "before" then
|
||||
-- before battle command
|
||||
elseif which == "during" then
|
||||
-- during battle command
|
||||
elseif which == "duringTime" then
|
||||
-- during battle command time frame
|
||||
elseif which == "after" then
|
||||
-- after battle command
|
||||
elseif which == "enemy" then
|
||||
-- enemy detection method
|
||||
elseif which == "egmcp" then
|
||||
-- enemy gmcp path
|
||||
elseif which == "area" then
|
||||
-- area detection method
|
||||
elseif which == "agmcp" then
|
||||
-- area gmcp path
|
||||
else
|
||||
cecho("<firebrick>BASHMATIC: Unrecognized option " .. matches[2] .. ". See bm help for a list of options.")
|
||||
end
|
||||
38
src/aliases/bashmatic/BM_Help.lua
Normal file
38
src/aliases/bashmatic/BM_Help.lua
Normal file
@@ -0,0 +1,38 @@
|
||||
cecho([[<SteelBlue>
|
||||
Bashmatic Help File
|
||||
Let's Bash some Mobs!
|
||||
|
||||
Basic Setup
|
||||
-----------
|
||||
Bare Minimum, you need to setup a death trigger, a starting battle command, and at least one target. Set up the death trigger by doing bm config phrase=your game's death phrase. Then setup a starting command with bm config start=kill. Then go find a target and bm add target. Then type bm and you're all set to auto bash them. Altogether again then that was.
|
||||
|
||||
1) bm config phrase=death phrase
|
||||
2) bm config start=kill command
|
||||
3) bm add target
|
||||
4) bm - this will toggle the system on
|
||||
|
||||
All config options
|
||||
------------------
|
||||
Toggle all of these using bm config option=value
|
||||
|
||||
bm config phrase - sets the phrase that should trigger resolution for the death of our target.
|
||||
bm config start - sets the command used to start combat. The target name is added here.
|
||||
bm config before - commands to execute before we start combat.
|
||||
bm config during - commands to execute during combat.
|
||||
bm config duringTime - time delay between during command execution. Default 2 seconds. Wants a number.
|
||||
bm config after - commands to execute after the death trigger fires.
|
||||
bm config enemy - Set to one of inline or gmcp to determine how we grab enemy data.
|
||||
bm config egmcp - if using gmcp to grab enemy data, use this to set the gmcp path for enemy data.
|
||||
bm config area - if wanting to group by areas, set this to mapper or gmcp to set how we get area information.
|
||||
bm config agmcp - if using gmcp for areas, use this to set the gmcp path for area data.
|
||||
|
||||
Aliases Available
|
||||
-----------------
|
||||
bm add <target> - add a new target to the hunt list
|
||||
bmc - show the current configuration
|
||||
bm config option=value - change the configuration
|
||||
bmt - List all current targets
|
||||
bm - toggle the bashing system on and off
|
||||
bm clear - clear all targets
|
||||
bm help - this screen
|
||||
<reset>]])
|
||||
0
src/aliases/bashmatic/BM_Listtargets.lua
Normal file
0
src/aliases/bashmatic/BM_Listtargets.lua
Normal file
1
src/aliases/bashmatic/BM_Toggle.lua
Normal file
1
src/aliases/bashmatic/BM_Toggle.lua
Normal file
@@ -0,0 +1 @@
|
||||
bashmatic.configs.enabled = not bashmatic.configs.enabled
|
||||
51
src/aliases/bashmatic/aliases.json
Normal file
51
src/aliases/bashmatic/aliases.json
Normal file
@@ -0,0 +1,51 @@
|
||||
[
|
||||
{
|
||||
"isActive": "yes",
|
||||
"isFolder": "no",
|
||||
"name": "BM Addtarget",
|
||||
"regex": "^bm add (.*)$",
|
||||
"script": ""
|
||||
},
|
||||
{
|
||||
"isActive": "yes",
|
||||
"isFolder": "no",
|
||||
"name": "BM Config",
|
||||
"regex": "^bmc$",
|
||||
"script": ""
|
||||
},
|
||||
{
|
||||
"isActive": "yes",
|
||||
"isFolder": "no",
|
||||
"name": "BM Configset",
|
||||
"regex": "^bm config (.*)=(.*)$",
|
||||
"script": ""
|
||||
},
|
||||
{
|
||||
"isActive": "yes",
|
||||
"isFolder": "no",
|
||||
"name": "BM Listtargets",
|
||||
"regex": "^bmt$",
|
||||
"script": ""
|
||||
},
|
||||
{
|
||||
"isActive": "yes",
|
||||
"isFolder": "no",
|
||||
"name": "BM Toggle",
|
||||
"regex": "^bm$",
|
||||
"script": ""
|
||||
},
|
||||
{
|
||||
"isActive": "yes",
|
||||
"isFolder": "no",
|
||||
"name": "BM Clear",
|
||||
"regex": "^bm clear$",
|
||||
"script": ""
|
||||
},
|
||||
{
|
||||
"isActive": "yes",
|
||||
"isFolder": "no",
|
||||
"name": "BM Help",
|
||||
"regex": "^bm help$",
|
||||
"script": ""
|
||||
}
|
||||
]
|
||||
207
src/scripts/bashmatic/bashmatic_init.lua
Normal file
207
src/scripts/bashmatic/bashmatic_init.lua
Normal file
@@ -0,0 +1,207 @@
|
||||
bashmatic = bashmatic or nil
|
||||
|
||||
function handleInstall(_, name)
|
||||
if name:lower() == "bashmatic" then
|
||||
if bashmatic == nil then
|
||||
-- it's empty
|
||||
bashmatic = {}
|
||||
bashmatic.commands = {
|
||||
"start" = nil,
|
||||
"before" = nil,
|
||||
"during" = nil,
|
||||
"duringTime" = 2,
|
||||
"after" = nil
|
||||
}
|
||||
bashmatic.death = {
|
||||
"phrase" = nil,
|
||||
"event" = nil
|
||||
}
|
||||
bashmatic.configs = {
|
||||
"enemies" = {
|
||||
"detection" = "inline",
|
||||
"location" = nil,
|
||||
"data" = nil
|
||||
},
|
||||
"areas" = {
|
||||
"detection" = nil,
|
||||
"location" = nil,
|
||||
"data" = nil
|
||||
}
|
||||
}
|
||||
bashmatic.enabled = false
|
||||
bashmatic.bashing = false
|
||||
bashmatic.hunting = {
|
||||
"targets" = {},
|
||||
"events" = {}
|
||||
}
|
||||
else
|
||||
-- it's not empty, verify install
|
||||
local corruptions = 0
|
||||
if not table.contains(bashmatic, "commands") then
|
||||
bashmatic.commands = {
|
||||
"start" = nil,
|
||||
"before" = nil,
|
||||
"during" = nil,
|
||||
"duringTime" = 2,
|
||||
"after" = nil
|
||||
}
|
||||
cecho("<firebrick>BASHMATIC: Potentially corrupt install. Tried to repair bashing commands.<reset>")
|
||||
corruptions += 1
|
||||
end
|
||||
|
||||
if not table.contains(bashmatic, "death") then
|
||||
bashmatic.death = {
|
||||
"phrase" = nil,
|
||||
"event" = nil
|
||||
}
|
||||
cecho("<firebrick>BASHMATIC: Potentially corrupt install. Tried to repair death trigger.<reset>")
|
||||
corruptions += 1
|
||||
end
|
||||
|
||||
if not table.contains(bashmatic, "configs") then
|
||||
bashmatic.configs = {
|
||||
"enemies"{
|
||||
"detection" = "inline",
|
||||
"location" = nil,
|
||||
"data" = nil
|
||||
},
|
||||
"areas" = {
|
||||
"detection" = nil,
|
||||
"location" = nil,
|
||||
"data" = nil
|
||||
}
|
||||
}
|
||||
cecho("<firebrick>BASHMATIC: Potentially corrupt install. Tried to repair configuration.<reset>")
|
||||
corruptions += 1
|
||||
end
|
||||
|
||||
if not table.contains(bashmatic, "enabled") then
|
||||
bashmatic.enabled = false
|
||||
cecho("<firebrick>BASHMATIC: Potentially corrupt install. Tried to repair status settings.<reset>")
|
||||
corruptions += 1
|
||||
end
|
||||
|
||||
if not table.contains(bashmatic, "bashing") then
|
||||
bashmatic.bashing = false
|
||||
cecho("<firebrick>BASHMATIC: Potentially corrupt install. Tried to repair status settings.<reset>")
|
||||
corruptions += 1
|
||||
end
|
||||
|
||||
if not table.contains(bashmatic, "hunting") then
|
||||
bashmatic.hunting = {
|
||||
"targets" = {},
|
||||
"events" = {}
|
||||
}
|
||||
cecho("<firebrick>BASHMATIC: Potentially corrupt install. Tried to repair target listings.<reset>")
|
||||
corruptions += 1
|
||||
end
|
||||
|
||||
if corruptions >= 2 then
|
||||
cecho("<firebrick>BASHMATIC: Multiple corruptions fixed. You should probably uninstall and reinstall Bashmatic.<reset>")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
registerAnonymousEventHandler("sysInstallPackage", handleInstall)
|
||||
|
||||
function handleShutdown()
|
||||
|
||||
if bashmatic.configs.death.event ~= nil then killTrigger(bashmatic.configs.death.event) end
|
||||
bashmatic.configs.death.event = nil
|
||||
|
||||
table.save(getMudletHomeDir() .. "/bashmatic.lua", bashmatic)
|
||||
|
||||
end
|
||||
registerAnonymousEventHandler("sysExitEvent", handleShutdown)
|
||||
|
||||
function handleLoadEvent()
|
||||
|
||||
if io.exists(getMudletHomeDir() .. "/bashmatic.lua") then
|
||||
table.load(getMudletHomeDir() .. "/bashmatic.lua", bashmatic)
|
||||
end
|
||||
|
||||
if bashmatic.configs.death.phrase ~= nil then
|
||||
bashmatic.configs.death.event = tempTrigger(bashmatic.configs.death.phrase,handleMobDeath)
|
||||
end
|
||||
|
||||
cecho("<DarkSlateBlue>BASHMATIC: Loaded settings. Let's bash some mobs.")
|
||||
|
||||
end
|
||||
registerAnonymousEventHandler("sysLoadEvent", handleLoadEvent)
|
||||
|
||||
function bmDisable()
|
||||
bashmatic.enabled = false
|
||||
end
|
||||
|
||||
function toggleBashing(status)
|
||||
bashmatic.bashing = status
|
||||
end
|
||||
|
||||
function handleMobDeath()
|
||||
if bashmatic.configs.commands.after then
|
||||
send(bashmatic.configs.commands.after)
|
||||
end
|
||||
toggleBashing(false)
|
||||
if bashmatic.configs.enabled then
|
||||
send("look")
|
||||
end
|
||||
end
|
||||
|
||||
function handleDuringTick()
|
||||
send(bashmatic.configs.commands.during)
|
||||
if bashmatic.configs.bashing then tempTimer(bashmatic.configs.commands.duringTime,handleDuringTick) end
|
||||
end
|
||||
|
||||
-- Functions for handling inline matching
|
||||
|
||||
function handleBashingMatches(match)
|
||||
if not bashmatic.configs.enabled then
|
||||
-- bashing is disabled, so clear the triggers
|
||||
for _, tid in ipairs(bashmatic.hunting.events) do
|
||||
killTrigger(tid)
|
||||
end
|
||||
bashmatic.hunting.events = {}
|
||||
else
|
||||
if bashmatic.configs.bashing then
|
||||
-- we're currently bashing something, so reup the trigger and wait
|
||||
bmCreateTrigger(match)
|
||||
else
|
||||
if bashmatic.configs.commands.before then send(bashmatic.configs.commands.before) end
|
||||
send(bashmatic.configs.commands.start .. match)
|
||||
if bashmatic.configs.commands.during then tempTimer(bashmatic.configs.commands.duringTime,handleDuringTick) end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function bmCreateTrigger(keyword)
|
||||
table.insert(bashmatic.hunting.events, tempTrigger(keyword, handleBashingMatches(keyword), 1))
|
||||
end
|
||||
|
||||
-- Functions for handling GMCP matching
|
||||
|
||||
-- Functions for handling adding targets
|
||||
|
||||
function inlineAddTarget(target, area)
|
||||
if area == nil then
|
||||
cecho("<DarkSlateBlue>BASHMATIC: Added " .. matches[2] .. " to hunting targets.<reset>")
|
||||
if not table.contains(bashmatic.hunting.targets, matches[2]) then
|
||||
table.insert(bashmatic.hunting.targets, matches[2])
|
||||
end
|
||||
end
|
||||
|
||||
if area ~= nil then
|
||||
cecho("<DarkSlateBlue>BASHMATIC: Added " .. matches[2] .. " to hunting targets in " .. area .. ".<reset>")
|
||||
if table.contains(bashmatic.hunting.targets, area) then
|
||||
table.insert(bashmatic.hunting.targets.area, matches[2])
|
||||
else
|
||||
bashmatic.hunting.targets.area = {}
|
||||
table.insert(bashmatic.hunting.targets.area, matches[2])
|
||||
end
|
||||
end
|
||||
|
||||
if not bashmatic.configs.bashing then
|
||||
if bashmatic.configs.enabled then
|
||||
bmCreateTrigger(matches[2])
|
||||
end
|
||||
end
|
||||
end
|
||||
8
src/scripts/bashmatic/scripts.json
Normal file
8
src/scripts/bashmatic/scripts.json
Normal file
@@ -0,0 +1,8 @@
|
||||
[
|
||||
{
|
||||
"isActive": "yes",
|
||||
"isFolder": "no",
|
||||
"name": "bashmatic init",
|
||||
"script": ""
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user