Advertisement
Guest User

gmcp.Char.Defences Tracker

a guest
Apr 10th, 2015
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. --Event handlers:
  2. --gmcp.Char.Defences.List
  3. --gmcp.Char.Defences.Add
  4. --gmcp.Char.Defences.Remove
  5.  
  6. Track = Track or {}
  7. Track.defences = Track.defences or {}
  8. Track.defences.list = Track.defences.list or {}
  9.  
  10. Track.defences.hide = {
  11.  
  12. }
  13.  
  14. Track.defences.show = function(win)
  15.     if win then
  16.         win = win.name
  17.         clearWindow(win)
  18.     else
  19.         win = "main"
  20.     end
  21.  
  22.     for x,_ in pairs(Track.defences.list) do
  23.         cecho(win, x .. "\n")
  24.     end
  25. end
  26.  
  27. function defences(event, arg)
  28.     if event == "gmcp.Char.Defences.List" then
  29.         Track.defences.list = {}
  30.         for _,x in ipairs(gmcp.Char.Defences.List) do
  31.             Track.defences.list[x.name] = x.desc
  32.         end
  33.     end
  34.  
  35.     if event == "gmcp.Char.Defences.Add" then
  36.         Track.defences.list[gmcp.Char.Defences.Add.name] = gmcp.Char.Defences.Add.desc
  37.         cecho("--<green>[DEFENCE][+]" .. gmcp.Char.Defences.Add.name:title())
  38.     end
  39.  
  40.     if event == "gmcp.Char.Defences.Remove" then
  41.         for _,x in ipairs(gmcp.Char.Defences.Remove) do
  42.             cecho("--<red>[DEFENCE][-]" .. x:title())
  43.             Track.defences.list[x] = nil
  44.         end
  45.     end
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement