Update EnemyPercentReporter.xml

Updated for area checks and who can use the !percent command
main
Icecool 3 years ago
parent c201c18678
commit 3f5cfc760e

@ -60,7 +60,7 @@ plugin_state = {
}
plugin_configs = {
channel = "gt",
prepend = "@D[@x166Enemy HP%@D]:@w"
prepend = "@D[@x166HP%@D]:@w"
}
--[[ Plugin State Functions ]]--
function isEnabled()
@ -121,8 +121,11 @@ end
function getZone()
return checkGMCPValue("room.info.zone")
end
function isLeader()
return checkGMCPValue("group.leader") == checkGMCPValue("char.base.name")
function isLeader(name)
return string.lower(checkGMCPValue("group.leader")) == string.lower(name)
end
function isIcecool(name)
return string.lower(name) == "icecool"
end
function isFighting()
return checkGMCPValue("char.status.state") == "8"
@ -171,7 +174,15 @@ function announceMobPercent()
elseif percent <= 20 then
mpmsg = ("@R%s"):format(getEnemyPercent())
end
Send(("%s %s @D[@WRoom %d@D]@w %s is at @R%s%%@w"):format(getChannel(), getPrepend(), getRoomID(), getEnemyName(), mpmsg))
if string.lower(getZone()) == "transcend" then
if getEnemyName() == "Void Trooper" then
send(("%s %s [@WRoom %d] @R---> @W%s @R<---@w"):format(getChannel(), getPrepend(), getRoomID(), getEnemyName()))
elseif getEnemyName() == "Void Guardian" then
Send(("%s %s @D[@WRoom %d@D]@w %s is at @R%s%%@w"):format(getChannel(), getPrepend(), getRoomID(), getEnemyName(), mpmsg))
end
else
Send(("%s %s @D[@WRoom %d@D]@w %s is at @R%s%%@w"):format(getChannel(), getPrepend(), getRoomID(), getEnemyName(), mpmsg))
end
end
end
function toggleMobPercent()
@ -187,7 +198,8 @@ end
function OnPluginBroadcast(msg, id, name, text)
if isGMCP(id) and isGMCPCommChannel(text) then
local comm_chan = gmcp('comm.channel.chan')
if isValidChannel(comm_chan) and isEnabled() then
local comm_player = gmcp('comm.channel.player')
if isValidChannel(comm_chan) and isEnabled() and (isLeader(comm_player) or isIcecool(comm_player)) then
local chan_msg = strip_colours(gmcp('comm.channel.msg'))
processMobPercentRequest(chan_msg)
end

Loading…
Cancel
Save