Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gmcpAff = gmcpAff or {}
- local showAffMsg = true -- change to false if you don't want to see updates
- local tblIgnore = {
- -- for afflictions we don't care about
- "blindness",
- "deafness",
- "insomnia",
- }
- gmcpAffParse = function()
- gmcpAff = {}
- for k, v in pairs(gmcp.Char.Afflictions.List) do
- table.insert(gmcpAff,#gmcpAff+1,v["name"])
- end
- gmcpAffShow()
- updateAffBox()
- end
- gmcpAffAdd = function()
- local aff = gmcp.Char.Afflictions.Add.name
- if not table.contains(gmcpAff,aff) then
- table.insert(gmcpAff,#gmcpAff+1,aff)
- end
- if showAffMsg == true and not table.contains(tblIgnore, aff) then affEcho("Added "..aff) end
- updateAffBox()
- end
- gmcpAffDel = function()
- local x = -1
- local aff = gmcp.Char.Afflictions.Remove[1]
- if table.contains(gmcpAff,aff) then
- for k, v in pairs(gmcpAff) do
- if aff == v then x = k end
- end
- end
- if x > -1 then table.remove(gmcpAff,x) end
- if showAffMsg == true and not table.contains(tblIgnore, aff) then affEcho("Cured "..aff) end
- updateAffBox()
- end
- gmcpAffShow = function()
- if #gmcpAff > 0 then
- cecho("<tomato>"..table.concat(gmcpAff,"<DarkSlateGrey>|<tomato>").."\n")
- end
- end
- affEcho = function(line)
- cecho("<SaddleBrown>[<pink>aff<SaddleBrown>]<white> "..line.."<reset>\n")
- end
- function updateAffBox()
- --assumes your destination window is called AffBox
- clearUserWindow("AffBox")
- AffBox:cecho("<tomato> -- Afflictions --\n")
- AffBox:cecho("<white>"..table.concat(gmcpAff,"\n").."\n")
- end
- registerAnonymousEventHandler("gmcp.Char.Afflictions.Add","gmcpAffAdd")
- registerAnonymousEventHandler("gmcp.Char.Afflictions.Remove","gmcpAffDel")
- registerAnonymousEventHandler("gmcp.Char.Afflictions.List","gmcpAffParse")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement