Cleaned Up Unnecessary Items

Removed unnecessary tables/functions to reduce overall work of script.
master
icecool 6 years ago
parent a641ac9442
commit 56a4b29acf

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

Loading…
Cancel
Save