Update EnemyPercentReporter.xml

Updated commands, added a simple help on plugin install
main
Mark 3 years ago
parent b881317be2
commit c201c18678

@ -20,7 +20,17 @@
</triggers> </triggers>
<aliases> <aliases>
<alias <alias
match="mprep" script="announceMobPercent" match="eprep" script="announceMobPercent"
keep_evaluating="y"
enabled="y"
regexp="n"
send_to="12"
sequence="100"
ignore_case = "y"
>
</alias>
<alias
match="eptoggle" script="toggleMobPercent"
keep_evaluating="y" keep_evaluating="y"
enabled="y" enabled="y"
regexp="n" regexp="n"
@ -44,7 +54,7 @@ plugin_ids = {
} }
--[[Global Plugin Variables]]-- --[[Global Plugin Variables]]--
plugin_state = { plugin_state = {
ENABLED = false, ENABLED = true,
DEBUG = false, DEBUG = false,
channels = { "gtell" } channels = { "gtell" }
} }
@ -56,6 +66,9 @@ plugin_configs = {
function isEnabled() function isEnabled()
return plugin_state.ENABLED return plugin_state.ENABLED
end end
function toggleEnabled()
plugin_state.ENABLED = not plugin_state.ENABLED
end
function isDebug() function isDebug()
return plugin_state.DEBUG return plugin_state.DEBUG
end end
@ -145,7 +158,10 @@ function processMobPercentRequest(arg)
end end
end end
function announceMobPercent() function announceMobPercent()
if isFighting() then if not isEnabled() then
cnote(("%s @wis @Rdisabled@w. Please use the '@Yeptoggle@w' command to enable before attempting to announce the enemy percentage."):format(getPrepend()))
end
if isFighting() and isEnabled() then
local mpmsg = "" local mpmsg = ""
local percent = getEnemyPercent() local percent = getEnemyPercent()
if percent > 40 then if percent > 40 then
@ -158,7 +174,10 @@ function announceMobPercent()
Send(("%s %s @D[@WRoom %d@D]@w %s is at @R%s%%@w"):format(getChannel(), getPrepend(), getRoomID(), getEnemyName(), mpmsg)) Send(("%s %s @D[@WRoom %d@D]@w %s is at @R%s%%@w"):format(getChannel(), getPrepend(), getRoomID(), getEnemyName(), mpmsg))
end end
end end
function toggleMobPercent()
toggleEnabled()
cnote(("%s @Wis now %s@w"):format(getPrepend(), isEnabled() and "@Genabled@w" or "@Rdisabled@w"))
end
--[[ Mushclient Plugin Functions ]]-- --[[ Mushclient Plugin Functions ]]--
--[[ --[[
-- OnPluginLineReceived(s) is not in use for this plugin, commented out for now.... -- OnPluginLineReceived(s) is not in use for this plugin, commented out for now....
@ -168,13 +187,19 @@ end
function OnPluginBroadcast(msg, id, name, text) function OnPluginBroadcast(msg, id, name, text)
if isGMCP(id) and isGMCPCommChannel(text) then if isGMCP(id) and isGMCPCommChannel(text) then
local comm_chan = gmcp('comm.channel.chan') local comm_chan = gmcp('comm.channel.chan')
if isValidChannel(comm_chan) then if isValidChannel(comm_chan) and isEnabled() then
local chan_msg = strip_colours(gmcp('comm.channel.msg')) local chan_msg = strip_colours(gmcp('comm.channel.msg'))
processMobPercentRequest(chan_msg) processMobPercentRequest(chan_msg)
end end
end end
end end
function OnPluginEnable() function OnPluginEnable()
cnote(("@GEnemyPercentReporter Plugin"))
cnote(("@W----------------------------------------"))
cnote(("@RCommands:@w"))
cnote(("@W eprep@w -- Manual report"))
cnote(("@W eptoggle@w -- toggles script on/off"))
Note()
end end
function OnPluginInstall() function OnPluginInstall()
OnPluginEnable() OnPluginEnable()

Loading…
Cancel
Save