added global quest alert

pull/1/head
mtrp12 3 years ago committed by GitHub
parent dd0be21d08
commit 422c8375f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -22,8 +22,22 @@
</alias> </alias>
</aliases> </aliases>
<!-- Script --> <!-- Triggers -->
<triggers>
<trigger
name="gqAlert"
enabled="y"
keep_evaluating="y"
group="Notifier"
match="^Global Quest\: Global quest \# (.*?) has been declared for levels ([0-9]*?) to ([0-9]*?)\.$"
regexp="y"
script="sendAlert"
sequence="100" >
</trigger>
</triggers>
<!-- Script -->
<script> <script>
<![CDATA[ <![CDATA[
@ -77,9 +91,32 @@ function pageRequest(req, protocol)
end end
end end
function getGQAlertMessage(wildcards)
-- get gq information
local gqid = wildcards[1]
local lower = tonumber(wildcards[2])
local upper = tonumber(wildcards[3])
-- get character information
local ret, datastring = CallPlugin("3e7dedbe37e44942dd46d264", "gmcpdata_as_string", "char.status")
pcall(loadstring("status_table = "..datastring))
local char_level = tonumber(status_table["level"])
-- verification and message creation
if char_level >= lower and char_level <= upper then
return "GQ ALERT#" .. gqid
end
end
function sendAlert(name, line, wildcards) function sendAlert(name, line, wildcards)
local wc = wildcards[1] or "" if name == "gqAlert" then
if name ~= "TestAlert" then msg = getGQAlertMessage(wildcards)
if msg == nil then
return
end
msg = string.format(alertFormat, url.escape(msg))
elseif name ~= "TestAlert" then
local wc = wildcards[1] or ""
for _,v in ipairs(triggerLines) do for _,v in ipairs(triggerLines) do
if name == v.name then if name == v.name then
msg = string.format(alertFormat, url.escape(v.message .. wc)) msg = string.format(alertFormat, url.escape(v.message .. wc))

Loading…
Cancel
Save