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.
1176 lines
37 KiB
1176 lines
37 KiB
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!DOCTYPE muclient>
|
|
<!-- Saved on Sunday, November 15, 2015, 4:49 PM -->
|
|
<!-- MuClient version 4.96 -->
|
|
|
|
<!-- Plugin "AardPupTimer" generated by Plugin Wizard -->
|
|
|
|
<muclient>
|
|
<plugin
|
|
name="KTracker"
|
|
author="KoopaTroopa"
|
|
id="0b88f1c931f76eb186a3baaf"
|
|
language="Lua"
|
|
purpose="Track Statistics with regards to leveling, questing, and pupping."
|
|
date_written="2017-03-21 16:48:31"
|
|
requires="4.30"
|
|
version="1.30"
|
|
save_state="y"
|
|
>
|
|
<description trim="y">
|
|
<![CDATA[
|
|
|
|
This plugin will show you your pup times. It will also
|
|
show reports of total pups, avg time/pup, slowest pup,
|
|
fastest pup, and interval averages. The slowest pup for
|
|
each day is not used in averages, due to it likely being
|
|
an extended period of time since the last pup.
|
|
|
|
Command Purpose
|
|
------------------------------------------------------------------------------
|
|
kt color <@x> Set kt message color.
|
|
- standard mud colorcodes
|
|
|
|
kt numcolor <@x> Set numbers color.
|
|
- standard mud colorcodes
|
|
|
|
kt accentcolor <@x> Set brackets color.
|
|
- standard mud colorcodes
|
|
|
|
kt comm Toggles commlog kt output.
|
|
|
|
kt chan <chan> Sets the output channel for each pup.
|
|
- No argument disables channel output.
|
|
|
|
kt window Toggles window kt output.
|
|
|
|
kt avg <#> Total for rolling average kt time.
|
|
|
|
kt avg 0 Turns off display of average kt time.
|
|
|
|
kt display Toggle kt display between new and old style.
|
|
|
|
kt help Shows this message.
|
|
|
|
kt days Shows the current number of
|
|
days to keep daily pups.
|
|
|
|
kt days <#> Set the number of days to keep
|
|
daily kt totals. Default 180.
|
|
|
|
kt rep[ort] <#> Show kt report for # of days.
|
|
|
|
kt crep[ort] <chan> Show kt report for 1 of days and send to Channel.
|
|
|
|
grep[ort] <chan> Show today's gold report. Channel optional.
|
|
|
|
igrep[ort] <chan> Show gold report since last clear. Channel optional.
|
|
|
|
igrep[ort] clear Clear out the interval gold report data.
|
|
|
|
kt info
|
|
|
|
------------------------------------------------------------------------------
|
|
|
|
]]>
|
|
</description>
|
|
|
|
</plugin>
|
|
|
|
|
|
<!-- Get our standard constants -->
|
|
|
|
<include name="constants.lua"/>
|
|
|
|
<!-- Aliases -->
|
|
|
|
<aliases>
|
|
<alias
|
|
script="set_color"
|
|
match="^kt color (\@)([a-zA-Z0-9]+)$"
|
|
enabled="y"
|
|
regexp="y"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
<alias
|
|
script="set_numcolor"
|
|
match="^kt numcolor (\@)([a-zA-Z])$"
|
|
enabled="y"
|
|
regexp="y"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
<alias
|
|
script="set_accentcolor"
|
|
match="^kt accentcolor (\@)([a-zA-Z])$"
|
|
enabled="y"
|
|
regexp="y"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
<alias
|
|
script="toggle_comm"
|
|
match="^kt comm$"
|
|
enabled="y"
|
|
regexp="y"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
<alias
|
|
script="pup_chan"
|
|
match="^kt chan ?(?<chan>[\w ]+)?$"
|
|
enabled="y"
|
|
regexp="y"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
<alias
|
|
script="toggle_output"
|
|
match="^kt window$"
|
|
enabled="y"
|
|
regexp="y"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
<alias
|
|
script="set_pup_days"
|
|
match="^kt days ?(\d+)?$"
|
|
enabled="y"
|
|
regexp="y"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
<alias
|
|
script="pup_report"
|
|
match="^kt repo?r?t? (\d+)$"
|
|
enabled="y"
|
|
regexp="y"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
<alias
|
|
script="pup_reportc"
|
|
match="^kt crepo?r?t? ?(?<chan>[\w ]+)?$"
|
|
enabled="y"
|
|
regexp="y"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
|
|
<alias
|
|
script="set_avg"
|
|
match="^kt avg (\d+)$"
|
|
enabled="y"
|
|
regexp="y"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
<alias
|
|
script="set_display"
|
|
match="^kt display$"
|
|
enabled="y"
|
|
regexp="y"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
<alias
|
|
script="gold_report"
|
|
match="^grepo?r?t? ?(?<chan>[\w ]+)?$"
|
|
enabled="y"
|
|
regexp="y"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
<alias
|
|
script="igold_report"
|
|
match="^igrepo?r?t? ?(?<chan>[\w ]+)?$"
|
|
enabled="y"
|
|
regexp="y"
|
|
sequence="100"
|
|
>
|
|
</alias>
|
|
<alias
|
|
script="igrep_reset"
|
|
match="^igrepo?r?t? (clear|reset)$"
|
|
enabled="y"
|
|
regexp="y"
|
|
sequence="99"
|
|
>
|
|
</alias>
|
|
<alias
|
|
script="test_output"
|
|
match="^kt test$"
|
|
enabled="y"
|
|
regexp="y"
|
|
sequence="99"
|
|
>
|
|
</alias>
|
|
<alias
|
|
script="pup_info"
|
|
match="^kt info$"
|
|
enabled="y"
|
|
regexp="y"
|
|
sequence="99"
|
|
>
|
|
</alias>
|
|
</aliases>
|
|
|
|
<!-- Plugin help -->
|
|
|
|
<aliases>
|
|
<alias
|
|
script="OnHelp"
|
|
match="^kt help$"
|
|
enabled="y"
|
|
regexp="y"
|
|
>
|
|
</alias>
|
|
</aliases>
|
|
|
|
<!-- Triggers -->
|
|
|
|
<triggers>
|
|
<trigger
|
|
enabled="n"
|
|
match="^Congratulations, hero\. You have increased your powers!$|^You gain a powerup\.$"
|
|
omit_from_output="n"
|
|
regexp="y"
|
|
script="power_up"
|
|
sequence="100"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="y"
|
|
match="^You raise a level! You are now level (?<level>[\d,]+)\.$"
|
|
omit_from_output="n"
|
|
regexp="y"
|
|
script="level_up"
|
|
sequence="100"
|
|
>
|
|
</trigger>
|
|
|
|
<trigger
|
|
name="kill"
|
|
enabled="y"
|
|
regexp="y"
|
|
match="^You get (?<gold>[\d,]+) gold coins? from .+\.$"
|
|
sequence="100"
|
|
script="record_gold"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="y"
|
|
regexp="y"
|
|
match="^(You receive ([(]halved[)] )?([0-9]+)[+]?([0-9]+)?[+]?([0-9]+)? experience points?[.]|That was a pointless no experience kill!|Duel - Winners Room)"
|
|
sequence="100"
|
|
script="killed_mob"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
name="item"
|
|
enabled="y"
|
|
regexp="y"
|
|
match="^You get (?<item>.+) from the .+ corpse .+\.$"
|
|
sequence="100"
|
|
script="got_item"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="y"
|
|
regexp="y"
|
|
match="^(?<item>.+) (?<crumble>crumbles) into (?<gold>[\d,]+) gold pieces\.$"
|
|
sequence="100"
|
|
script="record_gold"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="y"
|
|
regexp="y"
|
|
match="^You share (?<neg_gold>[\d,]+) gold coins (.+) Your share is (?<gold>[\d,]+) gold\.$"
|
|
script="record_gold"
|
|
sequence="100"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
name="kill1"
|
|
enabled="y"
|
|
regexp="y"
|
|
match="^[\w]+ shares ([\d,]+) gold coins with .+ Your share is (?<gold>[\d,]+) gold\.$"
|
|
script="record_gold"
|
|
sequence="100"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="y"
|
|
regexp="y"
|
|
match="^\[1\] Your decapitation does .+ things to .+! \[\d+\]$"
|
|
script="record_vorpal"
|
|
sequence="100"
|
|
>
|
|
</trigger>
|
|
<trigger
|
|
enabled="y"
|
|
regexp="y"
|
|
match="^Your death blow CLEAVES .+ in two!$"
|
|
script="record_deathblow"
|
|
sequence="100"
|
|
>
|
|
</trigger>
|
|
<!--
|
|
<trigger
|
|
enabled="y"
|
|
group="prtrack_quest"
|
|
match="You are on a quest to slay *!"
|
|
send_to="12"
|
|
sequence="102"
|
|
script="broadcast_qinfo"
|
|
>
|
|
</trigger>
|
|
-->
|
|
</triggers>
|
|
--
|
|
|
|
<script>
|
|
<![CDATA[
|
|
require "serialize"
|
|
require "tprint"
|
|
require "commas"
|
|
|
|
local avg = GetVariable("avg") or 20
|
|
local pupcomm = GetVariable("pupcomm") or "false"
|
|
local pupoutput = GetVariable("pupoutput") or "false"
|
|
local pupcolor = GetVariable("pupcolor") or "@W"
|
|
local numcolor = GetVariable("numcolor") or "@w"
|
|
local accentcolor = GetVariable("accentcolor") or "@b"
|
|
local pup_days_max = tonumber(GetVariable("pup_days_max")) or 180
|
|
local level_days_max = tonumber(GetVariable("level_days_max")) or 180
|
|
local pup_days = {}
|
|
local level_days = {}
|
|
local lastpup = GetVariable("lastpup") or ""
|
|
local gold = GetVariable("gold") or 0
|
|
local igrep = {}
|
|
local gotitems = {}
|
|
local last100 = {}
|
|
local display = "0"
|
|
local pchann = GetVariable("pchann") or "gt"
|
|
local pupchan = GetVariable("pupchan") or "true"
|
|
local lastlevel = GetVariable("lastlevel") or 0
|
|
local totalxplevel = 0
|
|
local avgxpmin = 0
|
|
local puptrains = 0
|
|
local ttrains = 0
|
|
local trains = 0
|
|
local daygold = 0
|
|
quest_stuff = {}
|
|
timer = {}
|
|
doublstartpups = 0
|
|
doubleendpups = 0
|
|
doublepups = 0
|
|
doublestartlevels = 0
|
|
doubleendlevels = 0
|
|
doublestartmobs = 0
|
|
doubleendmobs = 0
|
|
doublemobs = 0
|
|
doublerunning = 0
|
|
|
|
|
|
|
|
local pvar = GetVariable("igrep") or ""
|
|
if pvar ~= "" then
|
|
igrep = loadstring("return "..pvar)()
|
|
|
|
end
|
|
|
|
local pvar = GetVariable("pup_days") or ""
|
|
if pvar ~= "" then
|
|
pup_days = loadstring("return "..pvar)()
|
|
end
|
|
|
|
local pvar = GetVariable("last100") or ""
|
|
if pvar ~= "" then
|
|
last100 = loadstring("return "..pvar)()
|
|
end
|
|
|
|
local pvar = GetVariable("igrep") or ""
|
|
if pvar ~= "" then
|
|
igrep = loadstring("return "..pvar)()
|
|
|
|
end
|
|
|
|
local lvar = GetVariable("level_days") or ""
|
|
if pvar ~= "" then
|
|
level_days = loadstring("return "..pvar)()
|
|
end
|
|
|
|
local pvar = GetVariable("last100") or ""
|
|
if pvar ~= "" then
|
|
last100 = loadstring("return "..pvar)()
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function igold_report(name, line, args)
|
|
if not igrep.crumbles then
|
|
igrep.crumbles = 0
|
|
igrep.crumblegold = 0
|
|
end
|
|
if igrep.gold and igrep.gold > 0 then
|
|
local chan = args.chan
|
|
if string.sub(chan, 1, 4) == "tell" then
|
|
SendNoEcho(chan.." "..accentcolor.."["..pupcolor.."pup/gold"..accentcolor.."] "..pupcolor..">> "..accentcolor.."["..pupcolor..total_time(os.time() - igrep.start, false)..accentcolor.."] ["..pupcolor.."Pups "..numcolor..commas(igrep.pups)..accentcolor.."] ["..pupcolor.."Mobs "..pupcolor..""..commas(igrep.mobs)..accentcolor.."] ["..pupcolor.."Avg gold/pup "..numcolor..commas(math.floor(igrep.gold / igrep.pups))..accentcolor.."] ["..pupcolor.."Gold "..numcolor..commas(igrep.gold)..accentcolor.."] ["..pupcolor.."Avg gold/mob "..numcolor..commas(math.floor((igrep.gold - igrep.crumblegold) / igrep.mobs))..accentcolor.."] ["..pupcolor.."Max gold/mob "..numcolor..commas(igrep.maxgold)..accentcolor.."] ["..pupcolor.."Crumbles "..pupcolor..""..commas(igrep.crumbles).."@x249/"..numcolor..commas(igrep.crumblegold)..""..accentcolor.."]")
|
|
elseif chan ~= "" then
|
|
SendNoEcho(chan.." "..accentcolor.."["..pupcolor.."pup/gold"..accentcolor.."] >> ["..numcolor..total_time(os.time() - igrep.start, false)..accentcolor.."] ["..pupcolor.."Pups "..numcolor..commas(igrep.pups)..accentcolor.."] ["..pupcolor.."Mobs "..numcolor..commas(igrep.mobs)..accentcolor.."] ["..pupcolor.."Gold "..numcolor..commas(igrep.gold)..accentcolor.."] ["..pupcolor.."Avg gold/pup "..numcolor..commas(math.floor(igrep.gold / igrep.pups))..accentcolor.."] ["..pupcolor.."Avg gold/mob "..numcolor..commas(math.floor((igrep.gold - igrep.crumblegold) / igrep.mobs))..accentcolor.."] ["..pupcolor.."Max gold/mob "..numcolor..commas(igrep.maxgold)..accentcolor.."] ["..pupcolor.."Crumbles "..numcolor..commas(igrep.crumbles).."/"..commas(igrep.crumblegold)..""..accentcolor.."]")
|
|
else
|
|
SendNoEcho(pchann.." "..accentcolor.."["..pupcolor.."pup/gold"..accentcolor.."] >> ["..numcolor..total_time(os.time() - igrep.start, false)..accentcolor.."] ["..pupcolor.."Pups "..numcolor..commas(igrep.pups)..accentcolor.."] ["..pupcolor.."Mobs "..numcolor..commas(igrep.mobs)..accentcolor.."] ["..pupcolor.."Gold "..numcolor..commas(igrep.gold)..accentcolor.."] ["..pupcolor.."Avg gold/pup "..numcolor..commas(math.floor(igrep.gold / igrep.pups))..accentcolor.."] ["..pupcolor.."Avg gold/mob "..numcolor..commas(math.floor((igrep.gold - igrep.crumblegold) / igrep.mobs))..accentcolor.."] ["..pupcolor.."Max gold/mob "..numcolor..commas(igrep.maxgold)..accentcolor.."] ["..pupcolor.."Crumbles "..numcolor..commas(igrep.crumbles).."/"..commas(igrep.crumblegold)..""..accentcolor.."]")
|
|
end
|
|
else
|
|
ColourNote("white", "", " Sorry but no interval gold to report!")
|
|
end
|
|
end
|
|
|
|
function igrep_report(name, line, args)
|
|
igold_report("", "", {chan = ""})
|
|
end
|
|
|
|
function igrep_reset()
|
|
igrep_report()
|
|
igrep = {start = os.time(), mobs = 0, levels = 0, pups = 0, gold = 0, maxgold = 0, crumbles = 0, crumblegold = 0}
|
|
ColourNote("white", "", " Cleared out gold report interval data.")
|
|
SaveState()
|
|
end
|
|
|
|
-- fix pre-gold pups
|
|
for i, pup in ipairs(pup_days) do
|
|
if pup.max_gold == nil then
|
|
pup.max_gold = 0
|
|
end
|
|
if pup.gold == nil then
|
|
pup.gold = 0
|
|
end
|
|
end
|
|
|
|
function set_pup_days(name, line, args)
|
|
if args[1] == "" then
|
|
ColourNote("yellow", "", "\n Pup days limit is set to: ", "cyan", "", pup_days_max)
|
|
return
|
|
end
|
|
pup_days_max = tonumber(args[1])
|
|
ColourNote("yellow", "", "\n Pup days limit is now set to: ", "cyan", "", pup_days_max)
|
|
SaveState()
|
|
end
|
|
|
|
function pup_report(name, line, args)
|
|
local days = tonumber(args[1])
|
|
local total = 0
|
|
local totalgold = 0
|
|
local maxgold = 0
|
|
local fast = 60 * 60 * 24 * pup_days_max
|
|
local slow = 0
|
|
local slow_secs = 0
|
|
local secs = 0
|
|
if tonumber(#pup_days) > 0 then
|
|
if days <= #pup_days then
|
|
local suff = ""
|
|
if days > 1 then
|
|
suff = "s"
|
|
end
|
|
ColourNote("teal", "", "\n PUP report for ", "silver", "", days, "teal", "", " day"..suff..": \n")
|
|
--Note(#pup_days)
|
|
for i = #pup_days - days + 1, #pup_days do
|
|
total = total + pup_days[i]["total"]
|
|
totalgold = totalgold + pup_days[i]["gold"]
|
|
secs = secs + pup_days[i]["seconds"]
|
|
slow_secs = slow_secs + pup_days[i]["slowest"]
|
|
if pup_days[i]["fastest"] or 0 < fast then
|
|
fast = pup_days[i]["fastest"]
|
|
end
|
|
if pup_days[i]["slowest"] or 0 > slow then
|
|
slow = pup_days[i]["slowest"]
|
|
end
|
|
if pup_days[i]["max_gold"] or 0 > maxgold then
|
|
maxgold = pup_days[i]["max_gold"]
|
|
end
|
|
ColourNote("teal", "", " [", "silver", "", pup_days[i]["day"], "teal", "", "]", "teal", "", " Pups ", "silver", "", pup_days[i]["total"], "teal", "", " Gold ", "silver", "", commas(pup_days[i]["gold"] or 0 ), "teal", "", " Kills ", "silver", "", commas(pup_days[i]["kills"] or 0), "teal", "", " Deathblows ", "silver", "", commas(pup_days[i]["deathblow"] or 0), "teal", "", " Vorpals ", "silver", "", commas(pup_days[i]["vorpal"] or 0))
|
|
ColourTell("teal", "", " Avg pup ", "silver", "", string.format("%.1f", (pup_days[i]["seconds"] - pup_days[i]["slowest"])/(pup_days[i]["total"] - 1)).. " sec", "teal", "", " Fastest pup ", "silver", "", pup_days[i]["fastest"] or 0 .. " sec")
|
|
ColourNote("teal", "", " Avg gold/pup ", "silver", "", commas(math.floor(pup_days[i]["gold"] / pup_days[i]["total"])), "teal", "", " Max gold/pup ", "silver", "", commas(pup_days[i]["max_gold"] or 0 ).."\n")
|
|
end
|
|
ColourNote("teal", "", " Total pups ", "silver", "", total, "teal", "", " Avg pups/day ", "silver", "", string.format("%.1f", total/days), "teal", "", " Avg pup ", "silver", "", string.format("%.1f", (secs - slow_secs)/(total - days)).." sec", "teal", "", " Fastest pup ", "silver", "", fast.." sec")
|
|
ColourNote("teal", "", " Total gold ", "silver", "", commas(totalgold), "teal", "", " Avg gold/day ", "silver", "", commas(math.floor(totalgold/days)), "teal", "", " Avg gold/pup ", "silver", "", commas(math.floor(totalgold/total)).."\n")
|
|
else
|
|
ColourNote("teal", "", " Report requested "..days.." days, but only "..#pup_days.." days worth of pups have been saved.")
|
|
end
|
|
else
|
|
Note(" No pup data!")
|
|
end
|
|
end
|
|
|
|
function pup_reportc(name, line, args)
|
|
local chan = args.chan
|
|
local days = 1
|
|
local total = 0
|
|
local totalgold = 0
|
|
local maxgold = 0
|
|
local fast = 60 * 60 * 24 * pup_days_max
|
|
local slow = 0
|
|
local slow_secs = 0
|
|
local secs = 0
|
|
if tonumber(#pup_days) > 0 then
|
|
if days <= #pup_days then
|
|
local suff = ""
|
|
if days > 1 then
|
|
suff = "s"
|
|
end
|
|
|
|
for i = #pup_days - days + 1, #pup_days do
|
|
total = total + pup_days[i]["total"]
|
|
totalgold = totalgold + pup_days[i]["gold"]
|
|
secs = secs + pup_days[i]["seconds"]
|
|
slow_secs = slow_secs + pup_days[i]["slowest"]
|
|
if pup_days[i]["fastest"] or 0 < fast then
|
|
fast = pup_days[i]["fastest"]
|
|
end
|
|
if pup_days[i]["slowest"] or 0 > slow then
|
|
slow = pup_days[i]["slowest"]
|
|
end
|
|
if pup_days[i]["max_gold"] or 0 > maxgold then
|
|
maxgold = pup_days[i]["max_gold"]
|
|
end
|
|
SendNoEcho(chan.." "..accentcolor.."["..pupcolor.."Pups "..numcolor..pup_days[i]["total"]..accentcolor.."] ["..pupcolor.."Gold "..numcolor..commas(pup_days[i]["gold"])..accentcolor.."] ["..pupcolor.."Kills "..numcolor..commas(pup_days[i]["kills"] or 0).. accentcolor.."] ["..pupcolor.."Deathblows "..numcolor..commas(pup_days[i]["deathblow"] or 0)..accentcolor.."] ["..pupcolor.."Vorpals "..numcolor..commas(pup_days[i]["vorpal"] or 0).. accentcolor.."] ["..pupcolor.."Avg Pup "..numcolor..string.format("%.1f", (pup_days[i]["seconds"] - pup_days[i]["slowest"])/(pup_days[i]["total"] - 1))..pupcolor.. " sec".. accentcolor.."] ["..pupcolor.."Fastest Pup " ..numcolor..(pup_days[i]["fastest"] or 0).." sec "..accentcolor.."] ["..pupcolor.."Avg Gold/Pup "..numcolor..commas(math.floor(pup_days[i]["gold"] / pup_days[i]["total"])).. accentcolor.."] ["..pupcolor.."Max Gold/Pup "..numcolor..commas(pup_days[i]["max_gold"] or 0 ).. ""..accentcolor.."]")
|
|
|
|
end
|
|
|
|
else
|
|
ColourNote("teal", "", " No Data available for the last day.")
|
|
end
|
|
else
|
|
Note(" No pup data!")
|
|
end
|
|
end
|
|
|
|
function gold_report(name, line, args)
|
|
local chan = args.chan
|
|
local total = 0
|
|
local totalgold = 0
|
|
local maxgold = 0
|
|
if #pup_days > 0 then
|
|
i = #pup_days
|
|
total = total + pup_days[i]["total"]
|
|
totalgold = totalgold + pup_days[i]["gold"]
|
|
if tonumber(pup_days[i]["max_gold"]) > tonumber(maxgold) then
|
|
maxgold = pup_days[i]["max_gold"]
|
|
end
|
|
if string.sub(chan, 1, 4) == "tell" then
|
|
SendNoEcho(chan.." "..accentcolor.."["..pupcolor.."pup gold"..accentcolor.."]"..pupcolor" >> "..accentcolor.."["..numcolor..pup_days[i]["day"]..accentcolor.."] ["..pupcolor.."Pups "..numcolor..pup_days[i]["total"]..accentcolor.."] ["..pupcolor.."Gold "..numcolor..commas(pup_days[i]["gold"])..accentcolor.."] ["..pupcolor.."Avg gold/pup "..numcolor..commas(math.floor(pup_days[i]["gold"] / pup_days[i]["total"]))..accentcolor.."] ["..pupcolor.."Max gold/pup "..numcolor..commas(pup_days[i]["max_gold"])..""..accentcolor.."]")
|
|
elseif chan ~= "" then
|
|
SendNoEcho(chan.." :reports "..accentcolor.."["..pupcolor.."pup gold"..accentcolor.."] "..pupcolor..">> "..accentcolor.."["..numcolor..pup_days[i]["day"]..accentcolor.."] ["..pupcolor.."Pups "..pupcolor..""..pup_days[i]["total"]..accentcolor.."] ["..pupcolor.."Gold "..numcolor..commas(pup_days[i]["gold"])..accentcolor.."] ["..pupcolor.."Avg gold/pup "..numcolor..commas(math.floor(pup_days[i]["gold"] / pup_days[i]["total"]))..accentcolor.."] ["..pupcolor.."Max gold/pup "..numcolor..commas(pup_days[i]["max_gold"])..""..accentcolor.."]")
|
|
else
|
|
SendNoEcho(pchann.." reports "..accentcolor.."["..pupcolor.."pup gold"..accentcolor.."] "..pupcolor..">> "..accentcolor.."["..numcolor..pup_days[i]["day"]..accentcolor.."] ["..pupcolor.."Pups "..pupcolor..""..pup_days[i]["total"]..accentcolor.."] ["..pupcolor.."Gold "..numcolor..commas(pup_days[i]["gold"])..accentcolor.."] ["..pupcolor.."Avg gold/pup "..numcolor..commas(math.floor(pup_days[i]["gold"] / pup_days[i]["total"]))..accentcolor.."] ["..pupcolor.."Max gold/pup "..numcolor..commas(pup_days[i]["max_gold"])..""..accentcolor.."]")
|
|
end
|
|
else
|
|
Note(" No pup data!")
|
|
end
|
|
end
|
|
|
|
function toggle_comm(name, line, args)
|
|
local status
|
|
if pupcomm == "true" then
|
|
pupcomm = "false"
|
|
status = "OFF"
|
|
else
|
|
pupcomm = "true"
|
|
status = "ON"
|
|
end
|
|
ColourNote("orange", "", "\n KT comm log is now "..status..".")
|
|
SaveState()
|
|
end
|
|
|
|
function toggle_output(name, line, args)
|
|
local status
|
|
if pupoutput == "true" then
|
|
pupoutput = "false"
|
|
status = "OFF"
|
|
else
|
|
pupoutput = "true"
|
|
status = "ON"
|
|
end
|
|
ColourNote("orange", "", "\n KT window output is now "..status..".")
|
|
SaveState()
|
|
end
|
|
|
|
function set_display()
|
|
display = math.abs(display - 1)
|
|
if display == 0 then
|
|
ColourNote("orange", "", "\n Set KT display to new style.")
|
|
else
|
|
ColourNote("orange", "", "\n Set KT display to old style.")
|
|
end
|
|
SaveState()
|
|
end
|
|
|
|
function set_avg(name, line, args)
|
|
avg = args[1]
|
|
if tonumber(avg) > 100 then
|
|
ColourNote("orange", "", "\n Max pup average is 100!")
|
|
avg = 100
|
|
end
|
|
if avg == "0" then
|
|
ColourNote("orange", "", "\n Pup average is disabled.")
|
|
else
|
|
ColourNote("orange", "", "\n Set pup avg to: "..avg)
|
|
end
|
|
SaveState()
|
|
end
|
|
|
|
function set_color(name, line, args)
|
|
pupcolor = args[1]..args[2]
|
|
ColourNote("orange", "", "\n Set KT color to: "..pupcolor)
|
|
SaveState()
|
|
end
|
|
function pup_chan(name, line, args)
|
|
if args[1] == "" then
|
|
pupchan = "false"
|
|
ColourNote("orange", "", "\n KT Report Channel Disabled.")
|
|
|
|
else
|
|
|
|
pchann = args[1]
|
|
pupchan = "true"
|
|
ColourNote("orange", "", "\n KT report channel set to: "..pchann)
|
|
end
|
|
end
|
|
function set_numcolor(name, line, args)
|
|
numcolor = args[1]..args[2]
|
|
ColourNote("orange", "", "\n Set KT number color to: "..numcolor)
|
|
SaveState()
|
|
end
|
|
function set_accentcolor(name, line, args)
|
|
accentcolor = args[1]..args[2]
|
|
ColourNote("orange", "", "\n Set accent number color to: "..accentcolor)
|
|
SaveState()
|
|
end
|
|
|
|
function limit_pup_days()
|
|
local new_pup_days = {}
|
|
for i, p in ipairs(pup_days) do
|
|
if i > 1 then
|
|
table.insert(new_pup_days, p)
|
|
end
|
|
end
|
|
pup_days = new_pup_days
|
|
SaveState()
|
|
end
|
|
|
|
function limit_level_days()
|
|
local new_level_days = {}
|
|
for i, p in ipairs(level_days) do
|
|
if i > 1 then
|
|
table.insert(new_level_days, p)
|
|
end
|
|
end
|
|
level_days = new_level_days
|
|
SaveState()
|
|
end
|
|
|
|
|
|
function killed_mob()
|
|
gotitems = {}
|
|
end
|
|
|
|
function got_item(name, line, args)
|
|
gotitems[args.item] = 1
|
|
end
|
|
|
|
function record_gold(name, line, args)
|
|
local neggold = args.neg_gold
|
|
if neggold ~= nil then
|
|
neggold = string.gsub(args.neg_gold, ",", "")
|
|
neggold = tonumber(neggold)
|
|
gold = gold - neggold
|
|
igrep.gold = igrep.gold - neggold
|
|
end
|
|
local mgold = string.gsub(args.gold, ",", "")
|
|
mgold = tonumber(mgold)
|
|
--Note("Neg: "..tostring(neggold).." - Got: "..mgold)
|
|
gold = gold + mgold
|
|
igrep.gold = igrep.gold + mgold
|
|
if string.find(name, "kill") == 1 then
|
|
igrep.mobs = igrep.mobs + 1
|
|
record_kill()
|
|
end
|
|
if args.crumble then
|
|
if gotitems[args.item] == 1 then
|
|
igrep.crumbles = igrep.crumbles + 1
|
|
igrep.crumblegold = igrep.crumblegold + mgold
|
|
return
|
|
end
|
|
end
|
|
if mgold > tonumber(igrep.maxgold) then
|
|
igrep.maxgold = mgold
|
|
end
|
|
end
|
|
|
|
function record_kill() --line503
|
|
local day = os.date("%m").."-"..os.date("%d").."-"..os.date("%Y")
|
|
local found = false
|
|
for i, d in ipairs(pup_days) do
|
|
if d["day"] == day then
|
|
found = true
|
|
if not pup_days[i]["kills"] then
|
|
pup_days[i]["kills"] = 1
|
|
else
|
|
pup_days[i]["kills"] = pup_days[i]["kills"] + 1
|
|
end
|
|
break
|
|
end
|
|
end
|
|
if not found then
|
|
table.insert(pup_days, {["day"] = day, ["kills"] = 1, ["deathblow"] = 0, ["total"] = 0, ["total"] = 0, ["seconds"] = 0, ["fastest"] = 1000000, ["slowest"] = 0, ["gold"] = 0, ["max_gold"] = 0, ["trains"] = 0})
|
|
if #pup_days > pup_days_max then
|
|
limit_pup_days()
|
|
end
|
|
end
|
|
for i, d in ipairs(level_days) do
|
|
if d["day"] == day then
|
|
found = true
|
|
if not level_days[i]["kills"] then
|
|
level_days[i]["kills"] = 1
|
|
else
|
|
level_days[i]["kills"] = level_days[i]["kills"] + 1
|
|
end
|
|
break
|
|
end
|
|
end
|
|
if not found then
|
|
table.insert(level_days, {["day"] = day, ["kills"] = 1, ["deathblow"] = 0, ["total"] = 0, ["total"] = 0, ["seconds"] = 0, ["fastest"] = 1000000, ["slowest"] = 0, ["gold"] = 0, ["max_gold"] = 0})
|
|
if #level_days > level_days_max then --problem with this line - index d with a number
|
|
limit_level_days()
|
|
end
|
|
end
|
|
end
|
|
|
|
function record_deathblow(name, line, args)
|
|
local day = os.date("%m").."-"..os.date("%d").."-"..os.date("%Y")
|
|
local found = false
|
|
for i, d in ipairs(pup_days) do
|
|
if d["day"] == day then
|
|
found = true
|
|
if not pup_days[i]["deathblow"] then
|
|
pup_days[i]["deathblow"] = 1
|
|
else
|
|
pup_days[i]["deathblow"] = pup_days[i]["deathblow"] + 1
|
|
end
|
|
break
|
|
end
|
|
end
|
|
if not found then
|
|
table.insert(pup_days, {["day"] = day, ["kills"] = 0, ["deathblow"] = 1, ["total"] = 0, ["seconds"] = 0, ["fastest"] = 1000000, ["slowest"] = 0, ["gold"] = 0, ["max_gold"] = 0, ["trains"] = 0})
|
|
if #pup_days > pup_days_max then
|
|
limit_pup_days()
|
|
end
|
|
end
|
|
end
|
|
|
|
function record_vorpal(name, line, args)
|
|
local day = os.date("%m").."-"..os.date("%d").."-"..os.date("%Y")
|
|
local found = false
|
|
for i, d in ipairs(pup_days) do
|
|
if d["day"] == day then
|
|
found = true
|
|
if not pup_days[i]["vorpal"] then
|
|
pup_days[i]["vorpal"] = 1
|
|
else
|
|
pup_days[i]["vorpal"] = pup_days[i]["vorpal"] + 1
|
|
end
|
|
break
|
|
end
|
|
end
|
|
if not found then
|
|
table.insert(pup_days, {["day"] = day, ["kills"] = 0, ["deathblow"] = 0, ["vorpal"] = 1, ["total"] = 0, ["seconds"] = 0, ["fastest"] = 1000000, ["slowest"] = 0, ["gold"] = 0, ["max_gold"] = 0, ["trains"] = 0})
|
|
if #pup_days > pup_days_max then
|
|
limit_pup_days()
|
|
end
|
|
end
|
|
end
|
|
function level_up(name, line, args)
|
|
|
|
if lastlevel == "" then
|
|
lastlevel = os.time() - 60
|
|
Note("This is your first recorded level.")
|
|
end
|
|
|
|
local now = os.time()
|
|
local total_seconds = now - lastlevel
|
|
if #last100 == 100 then
|
|
table.remove(last100, 1)
|
|
end
|
|
table.insert(last100, total_seconds)
|
|
lastlevel = now
|
|
igrep.levels = igrep.levels + 1
|
|
avgxpmin = round((totalxplevel /total_seconds) * 60)
|
|
local total
|
|
local day = os.date("%m").."-"..os.date("%d").."-"..os.date("%Y")
|
|
local found = false
|
|
for i, d in ipairs(level_days) do
|
|
if d["day"] == day then
|
|
found = true
|
|
level_days[i]["total"] = d["total"] + 1
|
|
level_days[i]["seconds"] = level_days[i]["seconds"] + total_seconds
|
|
if tonumber(level_days[i]["fastest"]) > tonumber(total_seconds) then
|
|
level_days[i]["fastest"] = total_seconds
|
|
end
|
|
|
|
if tonumber(level_days[i]["slowest"]) < tonumber(total_seconds) then
|
|
level_days[i]["slowest"] = total_seconds
|
|
end
|
|
level_days[i]["gold"] = level_days[i]["gold"] + gold
|
|
if tonumber(level_days[i]["max_gold"]) < tonumber(gold) then
|
|
level_days[i]["max_gold"] = gold
|
|
end
|
|
total = level_days[i]["total"]
|
|
break
|
|
end
|
|
end
|
|
if not found then
|
|
total = 1
|
|
table.insert(level_days, {["day"] = day, ["total"] = 1, ["seconds"] = total_seconds, ["fastest"] = total_seconds, ["slowest"] = total_seconds, ["gold"] = gold, ["max_gold"] = gold})
|
|
if #level_days > level_days_max then
|
|
limit_level_days()
|
|
end
|
|
end
|
|
gold = 0
|
|
local msg
|
|
if tonumber(display) == 0 then
|
|
msg = pupcolor.."Level! "..accentcolor.."["..numcolor..total_time(total_seconds, true)..accentcolor.."] ["..numcolor..total..pupcolor.." today"..accentcolor.."]"..average_time(avg).." "..accentcolor.."("..numcolor..avgxpmin..pupcolor.." xp/min"..accentcolor..")$C"
|
|
else
|
|
msg = pupcolor.."Last Level: "..numcolor..total_time(total_seconds, true)..""..pupcolor.." | "..pupcolor.."Levels Today: "..numcolor..total..""..pupcolor..""
|
|
end
|
|
|
|
if pupcomm == "true" then
|
|
CallPlugin("b555825a4a5700c35fa80780", "storeFromOutside", string.format(msg))
|
|
end
|
|
if pupoutput == "true" then
|
|
SendNoEcho("echo "..msg)
|
|
end
|
|
if pupchan == "true" then
|
|
SendNoEcho(pchann.." "..msg)
|
|
end
|
|
totalxplevel = 0
|
|
SaveState()
|
|
end
|
|
|
|
function power_up(name, line, args)
|
|
if lastpup == "" then
|
|
lastpup = os.time() - 60
|
|
Note(" This is your first recorded pup.")
|
|
end
|
|
local now = os.time()
|
|
local total_seconds = now - lastpup
|
|
if #last100 == 100 then
|
|
table.remove(last100, 1)
|
|
end
|
|
table.insert(last100, total_seconds)
|
|
lastpup = now
|
|
igrep.pups = igrep.pups + 1
|
|
avgxpmin = round((totalxplevel /total_seconds) * 60)
|
|
local total
|
|
local day = os.date("%m").."-"..os.date("%d").."-"..os.date("%Y")
|
|
local found = false
|
|
|
|
|
|
for i, d in ipairs(pup_days) do
|
|
if d["day"] == day then
|
|
found = true
|
|
pup_days[i]["total"] = d["total"] + 1
|
|
pup_days[i]["trains"] = d["trains"] + tonumber(puptrains)
|
|
pup_days[i]["seconds"] = pup_days[i]["seconds"] + total_seconds
|
|
if tonumber(pup_days[i]["fastest"]) > tonumber(total_seconds) then
|
|
pup_days[i]["fastest"] = total_seconds
|
|
end
|
|
if tonumber(pup_days[i]["slowest"]) < tonumber(total_seconds) then
|
|
pup_days[i]["slowest"] = total_seconds
|
|
end
|
|
pup_days[i]["gold"] = pup_days[i]["gold"] + gold
|
|
if tonumber(pup_days[i]["max_gold"]) < tonumber(gold) then
|
|
pup_days[i]["max_gold"] = gold
|
|
end
|
|
daygold = pup_days[i]["gold"]
|
|
total = pup_days[i]["total"]
|
|
ttrains = pup_days[i]["trains"]
|
|
break
|
|
end
|
|
end
|
|
if not found then
|
|
total = 1
|
|
table.insert(pup_days, {["day"] = day, ["total"] = 1, ["seconds"] = total_seconds, ["fastest"] = total_seconds, ["slowest"] = total_seconds, ["gold"] = gold, ["max_gold"] = gold, ["trains"] = tonumber(puptrains)})
|
|
if #pup_days > pup_days_max then
|
|
limit_pup_days()
|
|
end
|
|
end
|
|
|
|
local msg
|
|
if tonumber(display) == 0 then
|
|
msg = pupcolor.."Powerup! "..accentcolor.."["..numcolor..total_time(total_seconds, true)..accentcolor.."] ["..numcolor..total..pupcolor.." today"..accentcolor.."]"..average_time(avg)..pupcolor.." "..accentcolor.."("..numcolor..avgxpmin..pupcolor.." xp/min"..accentcolor..") ["..pupcolor.."Trains "..numcolor..puptrains..pupcolor.." Today: "..numcolor..ttrains..accentcolor.."] ["..pupcolor.."Gold: "..numcolor..commas(gold)..pupcolor.." Today: "..numcolor..commas(daygold)..""..accentcolor.."]$C"
|
|
else
|
|
msg = pupcolor.."Last PUP: "..numcolor..total_time(total_seconds, true)..""..pupcolor.." | "..pupcolor.."PUPs Today: "..numcolor..total..""..pupcolor..""
|
|
end
|
|
|
|
if pupcomm == "true" then
|
|
CallPlugin("b555825a4a5700c35fa80780", "storeFromOutside", string.format(msg))
|
|
end
|
|
if pupoutput == "true" then
|
|
SendNoEcho("echo "..msg)
|
|
end
|
|
if pupchan == "true" then
|
|
SendNoEcho(pchann.." "..msg)
|
|
end
|
|
totalxplevel = 0
|
|
gold = 0
|
|
SaveState()
|
|
end
|
|
|
|
function test_output()
|
|
SendNoEcho(pchann.." "..pupcolor.."Quest: ("..numcolor..quest_stuff.mobname..pupcolor..") Area: ("..numcolor..quest_stuff.mobarea..pupcolor..") Room: ("..numcolor..quest_stuff.mobroom..pupcolor..")$C")
|
|
end
|
|
|
|
function pup_info()
|
|
Note("Pup Channel: "..pupchan.."\n Pup Channel: "..pchann.."\n Pup Color: "..pupcolor.."\n Pup NumColor: "..numcolor)
|
|
end
|
|
|
|
|
|
function OnPluginBroadcast (msg, id, name, text)
|
|
-- Kill capture
|
|
if id == "aaa61c4570508448e19c7c14" and msg == 1 then
|
|
local pvar = GetPluginVariable( "aaa61c4570508448e19c7c14", "kill_info")
|
|
|
|
-- get the mobs
|
|
loadstring( pvar )()
|
|
kill = kill_info
|
|
totalxplevel = totalxplevel + kill_info.totalxp
|
|
end
|
|
--Double Capture
|
|
if id == "aaafc15678afa22343c5a327" then
|
|
if msg == 1 then
|
|
--get the timer info
|
|
loadstring( text )()
|
|
-- do something with ttimer
|
|
if timer.secs == 0 and doublerunning == 1 then
|
|
|
|
doublerunning = 0
|
|
doubleendpups = igrep.pups
|
|
doubleendlevels = igrep.levels
|
|
doubleendmobs = igrep.mobs
|
|
|
|
doublepups = doubleendpups - doublestartpups
|
|
doublelevels = doubleendlevels - doublestartlevels
|
|
doublemobs = doubleendmobs - doublestartmobs
|
|
msg = pupcolor.."Double End - "
|
|
msg = msg..pupcolor.."Length: "..numcolor..doubletime
|
|
if doublepups > 0 then
|
|
msg = msg..pupcolor.." Pups: "..numcolor..doublepups
|
|
end
|
|
if doublelevels > 0 then
|
|
msg = msg..pupcolor.." Levels: "..numcolor..doublelevels
|
|
end
|
|
msg = msg..pupcolor.." Kills: "..numcolor..doublemobs..pupcolor
|
|
SendNoEcho(pchann.." "..msg)
|
|
elseif timer.secs > 0 and doublerunning ==0 then
|
|
doubletime = timer.text
|
|
doublerunning = 1
|
|
SendNoEcho(pchann.." "..pupcolor.."Double Start - "..numcolor..doubletime..pupcolor)
|
|
doublestartpups = igrep.pups
|
|
doublestartlevels = igrep.levels
|
|
doublestartmobs = igrep.mobs
|
|
end
|
|
end
|
|
end -- timer
|
|
|
|
|
|
--Quest Capture
|
|
if id == "aaa8a9eda20fa11787c6b438" and msg == 2 then
|
|
local pvar = GetPluginVariable( "aaa8a9eda20fa11787c6b438" , "quest_info")
|
|
--get the mob info
|
|
loadstring( pvar )()
|
|
quest_stuff = quest_info
|
|
SendNoEcho(pchann.." "..pupcolor.."Quest: "..accentcolor.."("..numcolor..quest_stuff.mobname..pupcolor..""..accentcolor..")"..pupcolor.." Area: "..accentcolor.."("..numcolor..quest_stuff.mobarea..pupcolor..""..accentcolor..")"..pupcolor.." Room: "..accentcolor.."("..numcolor..quest_stuff.mobroom..pupcolor..""..accentcolor..")$C")
|
|
end
|
|
if id == "aaa8a9eda20fa11787c6b438" and msg == 6 then
|
|
local pvar = GetPluginVariable( "aaa8a9eda20fa11787c6b438" , "quest_info")
|
|
--get the info
|
|
loadstring( pvar )()
|
|
quest_stuff = quest_info
|
|
tottime = quest_stuff.finishtime - quest_stuff.starttime
|
|
msg = pupcolor.."Quest: "..numcolor.."Complete! "..pupcolor.."QP:"..accentcolor.."(" --Line 774
|
|
msg = msg..numcolor..quest_stuff.qp..pupcolor
|
|
if tonumber(quest_stuff.tier) > 0 then
|
|
msg = msg.."+"..numcolor..quest_stuff.tier..pupcolor
|
|
end
|
|
if tonumber(quest_stuff.mccp) > 0 then
|
|
msg = msg.."+"..numcolor..quest_stuff.mccp..pupcolor
|
|
end
|
|
if tonumber(quest_stuff.lucky) > 0 then
|
|
msg = msg.."+"..numcolor..quest_stuff.lucky..pupcolor
|
|
end
|
|
if tonumber(quest_stuff.double) > 0 then
|
|
msg = msg.."+"..numcolor.."DOUBLE"..pupcolor
|
|
end
|
|
if tonumber(quest_stuff.daily) > 0 then
|
|
msg = msg.."+"..numcolor.."DAILY"..pupcolor
|
|
end
|
|
msg = msg.."="..numcolor..quest_stuff.totqp..pupcolor.."qp!"..accentcolor..") "
|
|
if tonumber(quest_stuff.tp) > 0 then
|
|
msg = msg..numcolor.."+"..quest_stuff.tp.."TP! "..pupcolor
|
|
end
|
|
if tonumber(quest_stuff.pracs) > 0 then
|
|
msg = msg..numcolor.."+"..quest_stuff.pracs.."pracs "..pupcolor
|
|
end
|
|
if tonumber(quest_stuff.trains) > 0 then
|
|
msg = msg..numcolor.."+"..quest_stuff.trains.."trains "..pupcolor
|
|
end
|
|
msg = msg..pupcolor.."Time: "..total_time(tottime).."$C"
|
|
SendNoEcho(pchann.." "..msg)
|
|
end
|
|
if id == "aaa8a9eda20fa11787c6b438" and msg == 8 then
|
|
local pvar = GetPluginVariable( "aaa8a9eda20fa11787c6b438" , "quest_info")
|
|
tottime = quest_stuff.finishtime - quest_stuff.starttime
|
|
SendNoEcho(pchann.." "..pupcolor.."Quest: "..numcolor.."Failed!$C")
|
|
end
|
|
if id == "aaa8a9eda20fa11787c6b438" and msg == 1 then
|
|
SendNoEcho(pchann..": can now "..numcolor.."QUEST!"..pupcolor.."$C")
|
|
end
|
|
--Level Capture
|
|
if id == "aaa0ab9ed92f8fc614664bd1" and msg == 1 then
|
|
local pvar = GetPluginVariable( "aaa0ab9ed92f8fc614664bd1", "levelinfo" )
|
|
-- get the info
|
|
loadstring( pvar )()
|
|
info = levelinfo
|
|
if levelinfo.type == "pup" then
|
|
|
|
puptrains = tonumber(levelinfo.trains) + tonumber(levelinfo.bonustrains)
|
|
power_up()
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
function average_time(x)
|
|
if tonumber(avg) == 0 then
|
|
return ""
|
|
end
|
|
if tonumber(x) > #last100 then
|
|
x = #last100
|
|
end
|
|
local seconds = 0
|
|
for i = (#last100 - x + 1), #last100 do
|
|
seconds = seconds + last100[i]
|
|
end
|
|
seconds = math.floor(seconds/x)
|
|
return " "..accentcolor.."["..total_time(seconds, true).." avg"..accentcolor.."]"
|
|
end
|
|
|
|
function total_time(total_seconds, clr)
|
|
show_sec = "yes"
|
|
--Note("delta: "..delta)
|
|
local days, hours, minutes, seconds = 0, 0, 0, 0
|
|
local dsuff, hsuff, msuff, ssuff = "", "", "", ""
|
|
if total_seconds > 60 * 60 * 24 then -- day or more
|
|
days = math.floor(total_seconds / (60 * 60 * 24))
|
|
end
|
|
--Note("days "..days)
|
|
if total_seconds > 60 * 60 then -- hours
|
|
hours = math.floor((total_seconds - (60 * 60 * 24 * days)) / 60 / 60)
|
|
end
|
|
--Note("hours "..hours)
|
|
if total_seconds > 60 then -- minutes
|
|
minutes = math.floor((total_seconds - (60 * 60 * 24 * days) - (60 * 60 * hours)) / 60)
|
|
end
|
|
--Note("minutes "..minutes)
|
|
seconds = math.floor(total_seconds - (60 * 60 * 24 * days) - (60 * 60 * hours) - (60 * minutes))
|
|
if days ~= "1" then
|
|
dsuff = ""
|
|
end
|
|
if hours ~= 1 then
|
|
hsuff = ""
|
|
end
|
|
if minutes ~= 1 then
|
|
msuff = ""
|
|
end
|
|
if seconds ~= 1 then
|
|
ssuff = ""
|
|
end
|
|
--Note("seconds "..seconds)
|
|
local time_str = ""
|
|
local ncolor = ""
|
|
local pcolor = ""
|
|
ncolor = numcolor
|
|
pcolor = pupcolor
|
|
if days > 0 then
|
|
if show_sec == "yes" then
|
|
return ncolor..days..pcolor.."d"..dsuff..""..ncolor..hours..pcolor.."h"..hsuff..""..ncolor..minutes..pcolor.."m"..msuff..""..ncolor..seconds.."s".. ssuff
|
|
else
|
|
return ncolor..days.."d"..dsuff..""..ncolor..hours.."h"..hsuff..""..ncolor..minutes.."m"..msuff
|
|
end
|
|
elseif hours > 0 then
|
|
if show_sec == "yes" then
|
|
return ncolor..hours..pcolor.."h"..hsuff..""..ncolor..minutes..pcolor.."m"..msuff..""..ncolor..seconds..pcolor.."s"..ssuff
|
|
else
|
|
return ncolor..hours..pcolor.."h"..hsuff..""..ncolor..minutes..pcolor.."m"..msuff
|
|
end
|
|
elseif minutes > 0 then
|
|
if show_sec == "yes" then
|
|
return ncolor..minutes..pcolor.."m"..msuff..""..ncolor..seconds..pcolor.."s"..ssuff
|
|
else
|
|
return ncolor..minutes..pcolor.."m"..msuff
|
|
end
|
|
else
|
|
return ncolor..seconds..pcolor.."s"..ssuff
|
|
end
|
|
end
|
|
|
|
function OnPluginSaveState()
|
|
SetVariable("pup_days_max", pup_days_max)
|
|
SetVariable("level_days_max", level_days_max)
|
|
SetVariable("pupcomm", pupcomm)
|
|
SetVariable("pupoutput", pupoutput)
|
|
SetVariable("pupcolor", pupcolor)
|
|
SetVariable("numcolor", numcolor)
|
|
SetVariable("accentcolor", accentcolor)
|
|
SetVariable("lastpup", lastpup)
|
|
SetVariable("gold", gold)
|
|
SetVariable("avg", avg)
|
|
SetVariable("igrep", serialize.save_simple(igrep))
|
|
SetVariable("pup_days", serialize.save_simple(pup_days))
|
|
SetVariable("level_days", serialize.save_simple(level_days))
|
|
SetVariable("last100", serialize.save_simple(last100))
|
|
SetVariable("lastlevel", lastlevel)
|
|
SetVariable("pchann", pchann)
|
|
SetVariable("pupchan", pupchan)
|
|
end
|
|
|
|
function OnHelp ()
|
|
ColourNote("orange", "", world.GetPluginInfo(world.GetPluginID(), 3))
|
|
end
|
|
|
|
function OnPluginDisconnect()
|
|
SaveState()
|
|
end
|
|
|
|
function OnPluginInstall()
|
|
ColourNote("orange", "", "\n Pup report plugin installed.\n")
|
|
igrep_reset()
|
|
end
|
|
|
|
function broadcast_qinfo()
|
|
SendNoEcho(pchann.." "..pupcolor.."Quest: "..accentcolor.."("..numcolor..quest_stuff.mobname..pupcolor..""..accentcolor..") Area: "..accentcolor.."("..numcolor..quest_stuff.mobarea..pupcolor""..accentcolor..") Room: "..accentcolor.."("..numcolor..quest_stuff.mobroom..pupcolor""..accentcolor..")$C")
|
|
end
|
|
|
|
|
|
|
|
]]>
|
|
</script>
|
|
|
|
</muclient>
|