You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
582 lines
13 KiB
582 lines
13 KiB
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!DOCTYPE muclient>
|
|
<!-- Saved on Tuesday, May 29, 2018, 4:44 PM -->
|
|
<!-- MuClient version 5.06-pre -->
|
|
|
|
<!-- Plugin "Aard_Practice_Spellups" generated by Plugin Wizard -->
|
|
|
|
<muclient>
|
|
<plugin
|
|
name="Aard_Practice_Skills_Spellups"
|
|
author="Endymion"
|
|
id="b03f0bec97a2924e5b3b5f04"
|
|
language="Lua"
|
|
purpose="Practice automatic skills and spellup spells."
|
|
date_written="2018-05-29 16:43:56"
|
|
requires="4.30"
|
|
version="1.0"
|
|
>
|
|
|
|
</plugin>
|
|
|
|
|
|
<!-- Triggers -->
|
|
|
|
<triggers>
|
|
-- Spellup spells
|
|
<trigger
|
|
enabled="n"
|
|
name="start"
|
|
match="{practice_spellup_start}"
|
|
script="enable_triggers"
|
|
sequence="100"
|
|
omit_from_output="y"
|
|
group="spellups"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="n"
|
|
match="^(Level [\d\s]+:)?\s+(?<spell>\w+[\s\w]+\w)\s+(?<mana>\d+)\s+(?<pct>\d+)%\s+(?<num>\d+)$"
|
|
regexp="y"
|
|
script="spell_line"
|
|
sequence="100"
|
|
omit_from_output="y"
|
|
group="spellups"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="n"
|
|
match="^(Level [\d\s]+:)?\s+(?<skill>\w+[\s\w]+\w)\s+(?<pct>\d+)%$"
|
|
regexp="y"
|
|
script="skill_line"
|
|
sequence="100"
|
|
omit_from_output="y"
|
|
group="spellups"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="n"
|
|
match="^.*$"
|
|
regexp="y"
|
|
sequence="110"
|
|
omit_from_output="y"
|
|
group="spellups"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="n"
|
|
match="{practice_spellup_end}"
|
|
script="disable_triggers"
|
|
sequence="100"
|
|
omit_from_output="y"
|
|
group="spellups"
|
|
>
|
|
</trigger>
|
|
|
|
-- learned spells triggers
|
|
<trigger
|
|
enabled="n"
|
|
name="learned"
|
|
match="{learned_start}"
|
|
script="enable_learned_triggers"
|
|
omit_from_output="y"
|
|
sequence="100"
|
|
group="learned"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="n"
|
|
match="^(?<name>\w[\s\w]+\w+)\s+(?<num>\d+)\s+(?<pct>\d+)%\s+([^\s]+)?\s+\d+$"
|
|
regexp="y"
|
|
script="learned_line"
|
|
sequence="100"
|
|
omit_from_output="y"
|
|
group="learned"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="n"
|
|
match="{learned_end}"
|
|
script="disable_learned_triggers"
|
|
omit_from_output="y"
|
|
sequence="100"
|
|
group="learned"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="n"
|
|
match="^.*$"
|
|
regexp="y"
|
|
sequence="110"
|
|
omit_from_output="y"
|
|
group="learned"
|
|
>
|
|
</trigger>
|
|
|
|
-- spell practice triggers
|
|
<trigger
|
|
enabled="n"
|
|
name="practice"
|
|
match="{practice_start}"
|
|
script="enable_practice_triggers"
|
|
omit_from_output="y"
|
|
sequence="100"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="n"
|
|
match="^You spend (?<spent>\d+) practices? to increase (?<name>[\w\s]+) to (?<pct>\d+%)\.$"
|
|
regexp="y"
|
|
script="prac_ok"
|
|
sequence="100"
|
|
omit_from_output="y"
|
|
group="practice"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="n"
|
|
match="^It will cost you (?<cost>\d+) practices? to increase [\w\s]+ to \d+%\.$"
|
|
regexp="y"
|
|
script="prac_nok"
|
|
sequence="100"
|
|
omit_from_output="y"
|
|
group="practice"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="n"
|
|
match="^There is nobody here to help you practice\.$"
|
|
regexp="y"
|
|
script="cant_prac"
|
|
sequence="100"
|
|
omit_from_output="y"
|
|
group="practice"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="n"
|
|
match="^.*$"
|
|
regexp="y"
|
|
sequence="110"
|
|
omit_from_output="y"
|
|
group="practice"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="n"
|
|
match="{practice_end}"
|
|
script="disable_practice_triggers"
|
|
sequence="100"
|
|
omit_from_output="y"
|
|
group="practice"
|
|
>
|
|
</trigger>
|
|
|
|
-- all spells practice triggers
|
|
<trigger
|
|
enabled="n"
|
|
match="{start_practice_all}"
|
|
script="start_practice_all"
|
|
sequence="100"
|
|
omit_from_output="y"
|
|
group="practice_all"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="n"
|
|
match="{end_practice_all}"
|
|
script="end_practice_all"
|
|
sequence="100"
|
|
omit_from_output="y"
|
|
group="practice_all"
|
|
>
|
|
</trigger>
|
|
|
|
<trigger
|
|
enabled="n"
|
|
regexp="y"
|
|
match="^$"
|
|
sequence="100"
|
|
name="next_blank_line"
|
|
script="next_blank_line"
|
|
omit_from_output="y"
|
|
>
|
|
</trigger>
|
|
</triggers>
|
|
|
|
<!-- Aliases -->
|
|
|
|
<aliases>
|
|
<alias
|
|
match="^prs( (?<limit>\d+))?$"
|
|
enabled="y"
|
|
regexp="y"
|
|
script="start"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
<alias
|
|
match="^prs add (?<num>\d+)$"
|
|
enabled="y"
|
|
regexp="y"
|
|
script="add"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
<alias
|
|
match="^prs add$"
|
|
enabled="y"
|
|
regexp="y"
|
|
script="list_additional"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
<alias
|
|
match="^prs help$"
|
|
enabled="y"
|
|
regexp="y"
|
|
script="help"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
</aliases>
|
|
|
|
<!-- Script -->
|
|
|
|
|
|
<script>
|
|
<![CDATA[
|
|
require "gmcphelper"
|
|
require "serialize"
|
|
require "tprint"
|
|
|
|
local char = {}
|
|
local spells = {} -- spell, mana, pct, num
|
|
local retry = ""
|
|
local limit = 85
|
|
local cant = false
|
|
local pracs_cost = 0
|
|
local pracs_spent = 0
|
|
local spells_prac = 0
|
|
local spells_left = 0
|
|
|
|
local additional = nil
|
|
local pvar = GetVariable("additional") or ""
|
|
if additional ~= "" then
|
|
additional = loadstring("return "..pvar)()
|
|
end
|
|
|
|
function note(msg, color)
|
|
if not color then
|
|
color = "white"
|
|
end
|
|
ColourNote("darkcyan", "", ">> ", color, "", msg)
|
|
end
|
|
|
|
function start(name, line, args)
|
|
limit = 85
|
|
spells = {}
|
|
if args.limit ~= "" then
|
|
note("Practice limit argument was submitted.")
|
|
limit = tonumber(args.limit)
|
|
if limit > 95 then
|
|
limit = 95
|
|
end
|
|
note("Practice limit temporarily set to "..limit.."%.")
|
|
end
|
|
if not char.status or not char.status.state then
|
|
retry = line
|
|
Send_GMCP_Packet("request char")
|
|
return
|
|
end
|
|
if char.status.state ~= "3" then
|
|
note("Cannot practice skills/spells unless you are standing.")
|
|
return
|
|
end
|
|
|
|
note("Checking automatic, desired, and additional skills/spells...")
|
|
EnableTrigger("start", true)
|
|
|
|
SendNoEcho("echo {practice_spellup_start}")
|
|
SendNoEcho("spells spellup")
|
|
SendNoEcho("skills spellup")
|
|
SendNoEcho("spells resist")
|
|
SendNoEcho("spells healing")
|
|
SendNoEcho("spells curative")
|
|
SendNoEcho("skills curative")
|
|
SendNoEcho("skills passive")
|
|
SendNoEcho("skills movement")
|
|
SendNoEcho("echo {practice_spellup_end}")
|
|
end
|
|
|
|
function in_spells(sp)
|
|
for i, spell in ipairs(spells) do
|
|
if spell.name == sp then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function spell_line(name, line, args)
|
|
if not in_spells(args.spell) then
|
|
table.insert(spells, {type = "spell", name = args.spell, mana = args.mana, pct = args.pct, num = args.num})
|
|
end
|
|
end
|
|
|
|
function skill_line(name, line, args)
|
|
if not in_spells(args.spell) then
|
|
table.insert(spells, {type = "skill", name = args.skill, pct = args.pct})
|
|
end
|
|
end
|
|
|
|
function practice_spells()
|
|
for i, sp in ipairs(spells) do
|
|
if tonumber(sp.pct) < limit then
|
|
EnableTrigger("practice", true)
|
|
SendNoEcho("echo {practice_start}")
|
|
SendNoEcho("practice "..sp.name.." full")
|
|
SendNoEcho("echo {practice_end}")
|
|
table.remove(spells, i)
|
|
return
|
|
end
|
|
end
|
|
SendNoEcho("echo {end_practice_all}")
|
|
end
|
|
|
|
function start_practice_all()
|
|
note("Practicing automatic, desired, and additional skills/spells...")
|
|
EnableTrigger("next_blank_line", true)
|
|
pracs_cost = 0
|
|
pracs_spent = 0
|
|
spells_prac = 0
|
|
spells_left = 0
|
|
pracs_left = 0
|
|
cant = false
|
|
end
|
|
|
|
function end_practice_all()
|
|
EnableTrigger("practice", false)
|
|
EnableTriggerGroup("practice_all", false)
|
|
if cant then
|
|
note("You cannot practice here!")
|
|
return
|
|
end
|
|
note("Spent "..pracs_spent.." practices on "..spells_prac.." skills/spells.")
|
|
if spells_left > 0 then
|
|
note("Need "..pracs_cost.." practices for "..spells_left.." skills/spells.", "orangered")
|
|
end
|
|
note("Done practicing automatic, desired, and additional skills/spells.")
|
|
-- report practices needed, if necessary
|
|
-- otherwise report practices spent on total spells
|
|
-- tl = gettriggerlist()
|
|
-- if tl then
|
|
-- for k, v in ipairs(tl) do
|
|
-- note(v.." "..gettriggeroption(v, "enabled"))
|
|
-- end -- for
|
|
-- end -- if we have any triggers
|
|
end
|
|
|
|
function enable_practice_triggers()
|
|
EnableTriggerGroup("practice", true)
|
|
end
|
|
|
|
function disable_practice_triggers()
|
|
EnableTriggerGroup("practice", false)
|
|
EnableTrigger("next_blank_line", true)
|
|
|
|
practice_spells()
|
|
end
|
|
|
|
function enable_triggers()
|
|
EnableTriggerGroup("spellups", true)
|
|
end
|
|
|
|
function has_additional()
|
|
if not additional then
|
|
return false
|
|
end
|
|
for _, _ in pairs(additional) do
|
|
return true
|
|
end
|
|
return false
|
|
end
|
|
|
|
function disable_triggers()
|
|
EnableTriggerGroup("spellups", false)
|
|
EnableTrigger("next_blank_line", true)
|
|
if has_additional() then
|
|
check_additional()
|
|
else
|
|
report()
|
|
end
|
|
end
|
|
|
|
function report()
|
|
local sp = prac_count("spell")
|
|
local sk = prac_count("skill")
|
|
local ad = prac_count("additional")
|
|
note("Found "..sk.." automatic, "..sp.." desired, and "..ad.." additional skills/spells less than "..limit.."% practiced.")
|
|
if (sp + sk + ad) > 0 then
|
|
EnableTriggerGroup("practice_all", true)
|
|
SendNoEcho("echo {start_practice_all}")
|
|
practice_spells()
|
|
end
|
|
end
|
|
|
|
function check_additional()
|
|
EnableTrigger("learned", true)
|
|
SendNoEcho("echo {learned_start}")
|
|
SendNoEcho("learned")
|
|
SendNoEcho("echo {learned_end}")
|
|
end
|
|
|
|
function enable_learned_triggers()
|
|
EnableTriggerGroup("learned", true)
|
|
end
|
|
|
|
function learned_line(name, line, args, styles)
|
|
if additional[args.name] or additional[args.num] then
|
|
if additional[args.num] then -- convert to spell name
|
|
additional[args.name] = args.num
|
|
additional[args.num] = nil
|
|
SaveState()
|
|
end
|
|
if styles[1].textcolour == 16711680 and tonumber(args.pct) < limit then
|
|
note("Additional spell "..args.name.." ["..args.num.."] is ignored, but will be practiced.")
|
|
end
|
|
if not in_spells(args.name) then
|
|
table.insert(spells, {type = "additional", name = args.name, pct = args.pct})
|
|
end
|
|
end
|
|
end
|
|
|
|
function disable_learned_triggers()
|
|
EnableTriggerGroup("learned", false)
|
|
report()
|
|
end
|
|
|
|
function prac_count(t)
|
|
local x = 0
|
|
for i, sp in ipairs(spells) do
|
|
if tonumber(sp.pct) < limit and sp.type == t then
|
|
x = x + 1
|
|
end
|
|
end
|
|
return x
|
|
end
|
|
|
|
function prac_ok(name, line, args)
|
|
pracs_spent = pracs_spent + args.spent
|
|
spells_prac = spells_prac + 1
|
|
note("'"..string_capitalize(args.name).."' practiced to "..args.pct..".")
|
|
end
|
|
|
|
function prac_nok(name, line, args)
|
|
pracs_cost = pracs_cost + args.cost
|
|
spells_left = spells_left + 1
|
|
end
|
|
|
|
function cant_prac()
|
|
cant = true
|
|
end
|
|
|
|
function next_blank_line()
|
|
EnableTrigger("next_blank_line", false)
|
|
end
|
|
|
|
function add(name, line, args)
|
|
if not additional then
|
|
additional = {}
|
|
end
|
|
for sp, num in pairs(additional) do
|
|
if num == args.num then
|
|
additional[sp] = nil
|
|
note(sp.." has been removed from additional spells.")
|
|
return
|
|
elseif sp == args.num then
|
|
additional[args.num] = nil
|
|
note(args.num.." has been removed from additional spells.")
|
|
return
|
|
end
|
|
end
|
|
additional[args.num] = 1
|
|
note(args.num.." has been added to additional spells.")
|
|
SaveState()
|
|
end
|
|
|
|
function string_capitalize(str)
|
|
if #str < 2 then
|
|
return string.upper(str)
|
|
end
|
|
return (string.upper(string.sub(str, 1, 1))..string.sub(str, 2))
|
|
end
|
|
|
|
function OnPluginBroadcast (msg, id, name, text)
|
|
if id == "3e7dedbe37e44942dd46d264" then
|
|
if text == "char.status" then
|
|
char = gmcp("char")
|
|
if retry ~= "" then
|
|
Execute(retry)
|
|
retry = ""
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function OnPluginSaveState()
|
|
SetVariable("additional", serialize.save_simple(additional))
|
|
end
|
|
|
|
function by_name(a, b)
|
|
return a.name < b.name
|
|
end
|
|
|
|
function list_additional()
|
|
local sorted = {}
|
|
for sp, num in pairs(additional) do
|
|
table.insert(sorted, {name = sp, num = num})
|
|
end
|
|
table.sort(sorted, by_name)
|
|
Note()
|
|
if not has_additional() then
|
|
note("You don't have any additional spells saved.")
|
|
return
|
|
end
|
|
note("You have the following additional spells added:")
|
|
for i, sp in ipairs(sorted) do
|
|
if tonumber(sp.name) then -- spell number just added
|
|
note("Unknown name ["..sp.num.."] (will show name after you prs)")
|
|
else
|
|
note(sp.name.." ["..sp.num.."]")
|
|
end
|
|
end
|
|
Note()
|
|
Note()
|
|
end
|
|
|
|
function help()
|
|
ColourNote("white", "", "\nThis plugin will practice the following:")
|
|
ColourNote("white", "", " skills/spells spellup")
|
|
ColourNote("white", "", " spells resist")
|
|
ColourNote("white", "", " spells healing")
|
|
ColourNote("white", "", " skills/spells curative")
|
|
ColourNote("white", "", " skills passive")
|
|
ColourNote("white", "", " skills movement")
|
|
ColourNote("white", "", " additional skills/spells (your custom list)")
|
|
ColourNote("white", "", "The command to practice all is ", "orangered", "", "prs", "white", "", ".")
|
|
ColourNote("white", "", "The command to toggle additional spells is ", "orangered", "", "prs add <#>", "white", "", ".")
|
|
ColourNote("orangered", "", " ** ", "white", "", "Additional #'s will be converted to name after you run prs.")
|
|
ColourNote("white", "", "The command to list additional spells is ", "orangered", "", "prs add", "white", "", ".")
|
|
ColourNote("white", "", "The command to this help file is ", "orangered", "", "prs help", "white", "", ".")
|
|
Note()
|
|
end
|
|
|
|
DoAfterSpecial(.2, "help()", 12)
|
|
|
|
]]>
|
|
</script>
|
|
|
|
|
|
</muclient>
|