Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Slain Tracking version 2.0
- SLAIN - Display what you've bagged so far!
- SLAIN [DENIZENS/PLAYERS] - Specify which list of kills to see.
- SLAIN SEARCH [TERM] - Search your kills for specific things.
- SLAIN ADD [DENIZENS/PLAYERS] [#] [THING] - Add kills to the denizen or player lists.
- SLAIN REMOVE [DENIZENS/PLAYERS/BY] [#] [THING] - Remove the specified number and type of kills from the lists.
- SLAIN RESET - Reset your kill counters
- SLAIN RESET [DENIZENS/PLAYERS] - Speicify which list of kills to reset.
- SLAIN HELP - View the help for this script.
- Note - search, add, and remove are case sensitive.
- --]]
- --------
- --SLAIN
- --------
- slain = {
- things = {
- denizens = {},
- players = {},
- by = {},
- },
- add = function (name, type, num)
- slain.things[type][name] = (slain.things[type][name] or 0) + (num or 1)
- if num then
- cecho("\n<red>[<white>SLAIN<red>]<white> Added " .. num .. " " .. name .. " to the " .. type .. " kill list.")
- end -- if
- slain.save()
- end, -- func
- find = function (string)
- slain.search = string
- slain.display ()
- end, -- fun
- remove = function (item, num, group)
- if slain.things[group][item] then
- slain.things[group][item] = slain.things[group][item] - num or nil
- cecho("\n<red>[<white>SLAIN<red>]<white> Removed " .. num .. " \"" .. item .. "\" from the slain tracker.")
- if slain.things[group][item] == 0 then
- slain.things[group][item] = nil
- end -- if
- slain.save()
- else
- if group == "by" then
- cecho("\n<red>[<white>SLAIN<red>]<white> You have not been slain by anything of that name.")
- else
- cecho("\n<red>[<white>SLAIN<red>]<white> You have not slain anything by that name.")
- end -- if
- end -- if
- end, -- func
- reset = function (group)
- if not group then
- slain.things.denizens = {}
- slain.things.players = {}
- slain.things.by = {}
- cecho("\n<red>[<white>SLAIN<red>]<white> Reset all slain counters.")
- else
- slain.things[group] = {}
- cecho("\n<red>[<white>SLAIN<red>]<white> Reset " .. group .. " counter.")
- end -- if
- slain.save()
- end, -- func
- display = function (group)
- local ntotal
- if group then
- group = string.lower (group)
- end -- if
- cecho("\n<green>You have slain:")
- if slain.search then
- cecho("<white> " .. slain.search)
- end -- if
- for k, v in pairs (slain.things) do
- ntotal = 0
- if group == k or not group then
- cecho("<red>\n " .. string.title(k))
- for k,v in pairs (slain.things[k]) do
- if not slain.search or string.find(tostring(k),slain.search,1,true) then
- ntotal = ntotal + v
- end -- if
- end -- for
- cecho("<red>:<white> " .. ntotal .. "\n")
- slain.displaygroup (k)
- end -- if
- end -- for
- slain.search = nil
- end, -- func
- displaygroup = function (group)
- if next (slain.things[group]) == nil and slain.search == nil then
- cecho("<white> None!")
- else
- local last = {}
- for k, v in pairs (slain.things[group]) do
- if not slain.search or string.find(tostring(k),slain.search,1,true) then
- if string.len (k) > 31 or string.len (k) + string.len (tostring(v)) > 37 then
- cecho(" <blue>[<white>" .. string.format ("%6s", v))
- cecho("<blue>]<white> " .. k .. "\n")
- elseif last[1] then
- cecho(" <blue>[<white>" .. string.format ("%6s", last[2]))
- cecho("<blue>]<white> " .. string.format ("%-31s", last[1]))
- cecho(" <blue>[<white>" .. string.format ("%6s", v))
- cecho("<blue>]<white> " .. k .. "\n")
- last = {}
- else
- last = {k, v}
- end -- if
- end -- if
- end -- for
- if last[1] then
- cecho(" <blue>[<white>" .. string.format ("%6s", last[2]))
- cecho("<blue>]<white> " .. last[1] .. "\n")
- end -- if
- end -- if
- end, -- func
- help = function ()
- cecho("\n<red>[<white>SLAIN TRACKER<red>]")
- cecho("\n<white>-------------")
- cecho("\n<white>SLAIN - Display what you've bagged so far!")
- cecho("\n<white>SLAIN [DENIZENS/PLAYERS/BY] - Specify which list of kills to see.")
- cecho("\n<white>SLAIN SEARCH [TERM] - Search your kills for specific things.")
- cecho("\n<white>SLAIN ADD [DENIZENS/PLAYERS/BY] [#] [THING] - Add kills to the denizen or player lists.")
- cecho("\n<white>SLAIN REMOVE [DENIZENS/PLAYERS/BY] [#] [THING] - Remove the specified number and type of kills from the lists.")
- cecho("\n<white>SLAIN RESET - Reset your kill counters.")
- cecho("\n<white>SLAIN RESET [DENIZENS/PLAYERS/BY] - Speicify which list of kills to reset.")
- cecho("\n<white>SLAIN HELP - View the help for this script.")
- cecho("\n<white>Note - Search, add, and remove are case sensitive.")
- end, -- func
- save = function ()
- if string.char(getMudletHomeDir():byte()) == "/"
- then _sep = "/"
- else _sep = "\\"
- end -- if
- local slain_things = getMudletHomeDir() .. _sep .. "slain_things.lua"
- table.save(slain_things, slain.things)
- end, -- func
- load = function ()
- if string.char(getMudletHomeDir():byte()) == "/"
- then _sep = "/"
- else _sep = "\\"
- end -- if
- local slain_things = getMudletHomeDir() .. _sep .. "slain_things.lua"
- if (io.exists(slain_things)) then
- table.load(slain_things, slain.things)
- end -- if
- end, -- func
- }
- slain.load()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement