Add files via upload

master
aardlyworthit 5 years ago committed by GitHub
parent 4f56bda49f
commit a0c5cbc306
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -73,6 +73,46 @@
>
</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"
@ -119,7 +159,7 @@
regexp="y"
sequence="110"
omit_from_output="y"
group="practice111111111111111111111111111"
group="practice"
>
</trigger>
<trigger
@ -175,6 +215,30 @@
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 -->
@ -183,6 +247,8 @@
<script>
<![CDATA[
require "gmcphelper"
require "serialize"
require "tprint"
local char = {}
local spells = {} -- spell, mana, pct, num
@ -193,16 +259,29 @@ local pracs_cost = 0
local pracs_spent = 0
local spells_prac = 0
local spells_left = 0
function note(msg)
ColourNote("darkcyan", "", ">> ", "silver", "", msg)
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
@ -215,14 +294,16 @@ function start(name, line, args)
return
end
note("Checking automatic skills and spellup spells...")
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}")
@ -264,7 +345,7 @@ function practice_spells()
end
function start_practice_all()
note("Practicing automatic skills and spellup spells...")
note("Practicing automatic, desired, and additional skills/spells...")
EnableTrigger("next_blank_line", true)
pracs_cost = 0
pracs_spent = 0
@ -283,9 +364,9 @@ function end_practice_all()
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.")
note("Need "..pracs_cost.." practices for "..spells_left.." skills/spells.", "orangered")
end
note("Done practicing automatic skills and spellup spells.")
note("Done practicing automatic, desired, and additional skills/spells.")
-- report practices needed, if necessary
-- otherwise report practices spent on total spells
-- tl = gettriggerlist()
@ -303,6 +384,7 @@ end
function disable_practice_triggers()
EnableTriggerGroup("practice", false)
EnableTrigger("next_blank_line", true)
practice_spells()
end
@ -310,19 +392,70 @@ 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")
note("Found "..sk.." automatic skills and "..sp.." spellup spells less than "..limit.."% practiced.")
if (sp + sk) > 0 then
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
@ -352,6 +485,26 @@ 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)
@ -371,15 +524,52 @@ function OnPluginBroadcast (msg, id, name, text)
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("silver", "", "\nThis plugin will practice the following types of skills/spells:")
ColourNote("white", "", " spellup")
ColourNote("white", "", " resist")
ColourNote("white", "", " healing")
ColourNote("white", "", " curative")
ColourNote("white", "", " passive")
ColourNote("white", "", " movement")
ColourNote("silver", "", "The command to practice all is ", "white", "", "prs", "silver", "", ".\n")
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)

Loading…
Cancel
Save