|
|
|
@ -36,7 +36,7 @@ end
|
|
|
|
|
function trim(s)
|
|
|
|
|
return (s:gsub("^%s*(.-)%s*$", "%1"))
|
|
|
|
|
end
|
|
|
|
|
function returnStringPosition( item, start, arg )
|
|
|
|
|
function returnStringPosition( item, start, arg ) -- Designed to save on some variable usage in commands
|
|
|
|
|
local position, _ = string.find(arg, item, start, true)
|
|
|
|
|
if position then
|
|
|
|
|
return position
|
|
|
|
@ -44,24 +44,9 @@ function returnStringPosition( item, start, arg )
|
|
|
|
|
return -1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--[[ Script Stuff ]]--
|
|
|
|
|
dtrack = { channel="echo" }
|
|
|
|
|
dtrack.regular = { start=false, prepend="[dTrack Swings]: " }
|
|
|
|
|
dtrack.hits = { start=false, prepend="[dTrack Hits]: " }
|
|
|
|
|
|
|
|
|
|
--[[ Tables that contain dtrack attacks/hits/etc ]]--
|
|
|
|
|
dtrack_ignore = {
|
|
|
|
|
"Rounds",
|
|
|
|
|
"Swings",
|
|
|
|
|
"Primary",
|
|
|
|
|
"Secondary",
|
|
|
|
|
"Hits",
|
|
|
|
|
"Misses",
|
|
|
|
|
"Damage",
|
|
|
|
|
"Specials",
|
|
|
|
|
"Specials Damage"
|
|
|
|
|
}
|
|
|
|
|
dtrack_track = {
|
|
|
|
|
["Swings Per Round"]="swings",
|
|
|
|
|
["Hit Percentage"]="hitpercent",
|
|
|
|
@ -83,15 +68,7 @@ dtrack_hits = {
|
|
|
|
|
["Lightspeed"]=false,
|
|
|
|
|
["Unarmed"]=false
|
|
|
|
|
}
|
|
|
|
|
--[[ dtrack swings ]]--
|
|
|
|
|
function isIgnored(argument)
|
|
|
|
|
for index, value in pairs(dtrack_ignore) do
|
|
|
|
|
if value == argument then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
--[[ dtrack swings logic ]]--
|
|
|
|
|
function isTrackedLine(argument)
|
|
|
|
|
return ((argument == "Tracked Spell") or (argument == "Tracked Skill"))
|
|
|
|
|
end
|
|
|
|
@ -103,9 +80,6 @@ function returnTracked(argument)
|
|
|
|
|
end
|
|
|
|
|
return -1
|
|
|
|
|
end
|
|
|
|
|
function returnSkill(argument)
|
|
|
|
|
return string.sub(argument, returnStringPosition("(", 1, argument)+1, returnStringPosition("):", 1, argument)-1)
|
|
|
|
|
end
|
|
|
|
|
function TRIGGER_process_dtrack_line(_, line, _, _)
|
|
|
|
|
local columnone = trim(string.sub(line, returnStringPosition(":", 1, line)-12, returnStringPosition(":", 1, line)-1))
|
|
|
|
|
local columntwo = trim(string.sub(line, returnStringPosition(":", 30, line)-20, returnStringPosition(":", 30, line)-1))
|
|
|
|
@ -118,23 +92,18 @@ function TRIGGER_process_dtrack_line(_, line, _, _)
|
|
|
|
|
EnableTriggerGroup("dtrack_swings", false)
|
|
|
|
|
reportSwings()
|
|
|
|
|
end
|
|
|
|
|
elseif (isTrackedLine(trim(string.sub(line,1,(1+12))))) then
|
|
|
|
|
dtrack.regular["sname"] = returnSkill(line)
|
|
|
|
|
elseif (isIgnored(columnone) and isIgnored(columntwo)) then
|
|
|
|
|
return -- Both columns are not being tracked, do nothing.
|
|
|
|
|
elseif (isTrackedLine(trim(string.sub(line,1,13)))) then
|
|
|
|
|
dtrack.regular["sname"] = trim(string.sub(line,returnStringPosition("(",1,line)+1,returnStringPosition("):",1,line)-1))
|
|
|
|
|
else
|
|
|
|
|
if (returnTracked(columnone) ~= -1) then
|
|
|
|
|
local value = tonumber(trim(string.sub(line, returnStringPosition("[", 1, line)+1, returnStringPosition("]", 1, line)-1)))
|
|
|
|
|
dtrack.regular[returnTracked(columnone)] = ("%0.2f"):format(value)
|
|
|
|
|
else
|
|
|
|
|
dtrack.regular[returnTracked(columnone)] = ("%0.2f"):format(tonumber(trim(string.sub(line, returnStringPosition("[", 1, line)+1, returnStringPosition("]", 1, line)-1))))
|
|
|
|
|
end
|
|
|
|
|
if (returnTracked(columntwo) ~= -1) then
|
|
|
|
|
local value = tonumber(trim(string.sub( line, returnStringPosition("[", 30, line)+1, returnStringPosition("]", 30, line)-1)))
|
|
|
|
|
dtrack.regular[returnTracked(columntwo)] = ("%0.2f"):format(value)
|
|
|
|
|
dtrack.regular[returnTracked(columntwo)] = ("%0.2f"):format(tonumber(trim(string.sub( line, returnStringPosition("[", 30, line)+1, returnStringPosition("]", 30, line)-1))))
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--[[ dtrack hits ]]--
|
|
|
|
|
--[[ dtrack hits logic ]]--
|
|
|
|
|
function isHitsAttack(argument)
|
|
|
|
|
local calculate=returnStringPosition(":",1,argument)-(returnStringPosition(":",1,argument)-1)
|
|
|
|
|
local command = trim(string.sub( argument, calculate, returnStringPosition(":",1,argument)-1))
|
|
|
|
@ -203,11 +172,17 @@ function reportHits()
|
|
|
|
|
end
|
|
|
|
|
--[[ ALIAS command ]]--
|
|
|
|
|
function ALIAS_report(name, line, args)
|
|
|
|
|
if not (args.channel or args.command) then
|
|
|
|
|
if not (args.command) then
|
|
|
|
|
cnote( "@CSyntax: @Gdreport @R<@wswings|hits@R> <@wchannel@R>@w" )
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
dtrack.channel = args.channel
|
|
|
|
|
if args.command:lower() == "help" then
|
|
|
|
|
DREPORT_Help()
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
if not (args.channel) then
|
|
|
|
|
dtrack.channel = "echo"
|
|
|
|
|
end
|
|
|
|
|
if args.command:lower() == "swings" then
|
|
|
|
|
EnableTriggerGroup("dtrack_swings", true)
|
|
|
|
|
SendNoEcho( "dtrack" )
|
|
|
|
@ -215,17 +190,26 @@ function ALIAS_report(name, line, args)
|
|
|
|
|
EnableTriggerGroup("dtrack_hits", true)
|
|
|
|
|
SendNoEcho( "dtrack hits" )
|
|
|
|
|
else
|
|
|
|
|
cnote( "@CSyntax: @Gdreport @R<@wswings|hits@R> <@wchannel@R>@w" )
|
|
|
|
|
return
|
|
|
|
|
DREPORT_Help()
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--[[ Help File ]]--
|
|
|
|
|
function DREPORT_Help()
|
|
|
|
|
cnote("@GdTrack Reports@w")
|
|
|
|
|
cnote("@WUsage:@w")
|
|
|
|
|
cnote("@G dreport help @w:@W This menu@w")
|
|
|
|
|
cnote("@G dreport swings <channel> @w:@W Reports the 'dtrack' main screen to a channel@w")
|
|
|
|
|
cnote("@G dreport hits <channel> @w:@W Reports teh 'dtrack hits' screen to a channel@w")
|
|
|
|
|
Note()
|
|
|
|
|
end
|
|
|
|
|
--[[ MUSH Specific functions for saving/loading Plugin information ]]--
|
|
|
|
|
-- Anytime a variable (designed to save over) is modified, call SaveState() function afterwards.
|
|
|
|
|
function OnPluginSaveState ()
|
|
|
|
|
end -- function OnPluginSaveState
|
|
|
|
|
function OnPluginInstall ()
|
|
|
|
|
cnote("@GdTrack Reports@w initialized. Check out 'dtrack help' for more information.@w")
|
|
|
|
|
end -- function OnPluginInstall
|
|
|
|
|
|
|
|
|
|
]]>
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|