Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gchat = {
- --This determines where things go, obviously. this is safely changeable.
- channelmap = {
- clt = "Clans",
- gnt = "Guild",
- gt = "Guild",
- gts = "Guild",
- cgt = "Org",
- ft = "Clans",
- ct = "Org",
- newbie = "Misc",
- market = "Misc",
- says = "Says",
- tell = "Tells",
- shout = "Says",
- oto = "Org",
- ot = "Org",
- oti = "Org"
- },
- --If true, won't move says from talkers not recognized by NDB into tabbed chat (only effects says, so it won't
- --hide things like calls for help.
- gagdenizen = true
- ,
- --Everything past here is no longer configs!! Don't change this stuff or you'll probably break things.
- crossChat = function(event,text)
- if demonnic.chat.config.timestamp then gchat.timestamp(demonnic.chat.config.Alltab) end
- demonnic.chat:decho(demonnic.chat.config.Alltab,text)
- end
- ,
- ansindb = function(text)
- local text = ansi2decho(text)
- color = string.match(text,"^<?r?>?<%d+,%d+,%d+:%d-,?%d-,?%d->")
- local background = color:match(":.->") or ":>"
- local highlighted = {}
- for _, name in pairs(ndb.findnames(text)or {}) do
- if not table.contains(lighted,name) then
- if ndb.getcolor(name)~="" then
- text = text:gsub(name,string.format("<r><%d,%d,%d",unpack(color_table[string.sub(ndb.getcolor(name),2,-2)]))..background..name..color)
- end
- table.insert(highlighted,name)
- end
- end
- return text
- end
- ,
- gmcpchat = function()
- if gchat.gagdenizen and not ndb.findname(gmcp.Comm.Channel.Text.talker) and gmcp.Comm.Channel.Text.channel == "says" then return end
- if gmcp.Comm.Channel.Text.channel:sub(1,4) =="tell" then gmcp.Comm.Channel.Text.channel = "tell" end
- local chat = gchat.channelmap[gmcp.Comm.Channel.Text.channel:gsub("[0-9]","")] or demonnic.chat.config.Alltab
- -- local temptext = gchat.stripAnsi(gmcp.Comm.Channel.Text.text).."\n"
- if demonnic.chat.config.timestamp then gchat.timestamp(chat) end
- demonnic.chat:decho(chat,gchat.ansindb(gmcp.Comm.Channel.Text.text).."\n")
- raiseGlobalEvent("crossChat",gchat.ansindb(gmcp.Comm.Channel.Text.text).."\n")
- end,
- opencomms = function()
- sendGMCP([[Core.Supports.Add ["Comm.Channel 1"] ]])
- end,
- timestamp = function(chat) --Bit of code pulled from YATCO itself for timestamping. Credits go to original author.
- local timestamp = getTime(true, demonnic.chat.config.timestamp)
- local tsfg = {}
- local tsbg = {}
- local colorLeader = ""
- if demonnic.chat.config.timestampCustomColor then
- if type(demonnic.chat.config.timestampFG) == "string" then
- tsfg = color_table[demonnic.chat.config.timestampFG]
- else
- tsfg = demonnic.chat.config.timestampFG
- end
- if type(demonnic.chat.config.timestampBG) == "string" then
- tsbg = color_table[demonnic.chat.config.timestampBG]
- else
- tsbg = demonnic.chat.config.timestampBG
- end
- colorLeader = string.format("<%s,%s,%s:%s,%s,%s>",tsfg[1],tsfg[2],tsfg[3],tsbg[1],tsbg[2],tsbg[3])
- local fullstamp = string.format("%s%s",colorLeader,timestamp)
- demonnic.chat.windows[chat]:decho(fullstamp)
- demonnic.chat.windows[chat]:echo(" ")
- if demonnic.chat.config.Alltab and chat~=demonnic.chat.config.Alltab then
- demonnic.chat.windows[demonnic.chat.config.Alltab]:decho(fullstamp)
- demonnic.chat.windows[demonnic.chat.config.Alltab]:echo(" ")
- end
- else
- demonnic.chat.windows[chat]:cecho(format..timestamp)
- demonnic.chat.windows[chat]:echo(" ")
- if demonnic.chat.config.Alltab then
- demonnic.chat.windows[demonnic.chat.config.Alltab]:cecho(format..timestamp)
- demonnic.chat.windows[demonnic.chat.config.Alltab]:echo(" ")
- end
- end
- end,
- }
- registerAnonymousEventHandler("gmcp.Comm.Channel.Text","gchat.gmcpchat")
- registerAnonymousEventHandler("gmcp.Char.Name","gchat.opencomms")
- registerAnonymousEventHandler("crossChat","gchat.crossChat")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement