recent chat: colorize chat correctly & more!
This commit is contained in:
+28
-14
@@ -3859,7 +3859,6 @@
|
|||||||
for i = 1, 50 do
|
for i = 1, 50 do
|
||||||
if _G["ChatFrame" .. i] and _G["ChatFrame" .. i]:GetMaxLines() ~= 4096 then
|
if _G["ChatFrame" .. i] and _G["ChatFrame" .. i]:GetMaxLines() ~= 4096 then
|
||||||
_G["ChatFrame" .. i]:SetMaxLines(4096);
|
_G["ChatFrame" .. i]:SetMaxLines(4096);
|
||||||
_G["ChatFrame" .. i]:SetMaxLines(4096);
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Process temporary chat frames
|
-- Process temporary chat frames
|
||||||
@@ -4405,7 +4404,7 @@
|
|||||||
LeaPlusDB["ChatHistory" .. i] = {}
|
LeaPlusDB["ChatHistory" .. i] = {}
|
||||||
local chtfrm = _G["ChatFrame" .. i]
|
local chtfrm = _G["ChatFrame" .. i]
|
||||||
local NumMsg = chtfrm:GetNumMessages()
|
local NumMsg = chtfrm:GetNumMessages()
|
||||||
local MaxMsg = chtfrm:GetMaxLines()
|
local MaxMsg = 499
|
||||||
local StartMsg = 1
|
local StartMsg = 1
|
||||||
if NumMsg > MaxMsg then
|
if NumMsg > MaxMsg then
|
||||||
StartMsg = NumMsg - MaxMsg + 1
|
StartMsg = NumMsg - MaxMsg + 1
|
||||||
@@ -13230,7 +13229,6 @@
|
|||||||
-- Recent chat window
|
-- Recent chat window
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
-- Recent chat window
|
|
||||||
if LeaPlusLC["RecentChatWindow"] == "On" and not LeaLockList["RecentChatWindow"] then
|
if LeaPlusLC["RecentChatWindow"] == "On" and not LeaLockList["RecentChatWindow"] then
|
||||||
|
|
||||||
-- only initialize once
|
-- only initialize once
|
||||||
@@ -13368,31 +13366,49 @@
|
|||||||
----------------------------------------
|
----------------------------------------
|
||||||
-- 4) Populate on Ctrl+Click tabs --
|
-- 4) Populate on Ctrl+Click tabs --
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
local function ShowChatbox(chtfrm)
|
|
||||||
|
-- Map message-IDs back to ChatType strings
|
||||||
|
local chatTypeIndexToName = {}
|
||||||
|
for chatType in pairs(ChatTypeInfo) do
|
||||||
|
chatTypeIndexToName[ GetChatTypeIndex(chatType) ] = chatType
|
||||||
|
end
|
||||||
|
|
||||||
|
local function ShowChatbox(chatFrame)
|
||||||
edit:ClearFocus()
|
edit:ClearFocus()
|
||||||
edit:SetText("")
|
edit:SetText("")
|
||||||
|
|
||||||
local num = chtfrm:GetNumMessages()
|
local num = chatFrame:GetNumMessages()
|
||||||
if num == 0 then return end
|
if num == 0 then return end
|
||||||
|
|
||||||
local maxHist = chtfrm:GetMaxLines() or 4096
|
-- choose your start… (e.g. oldest N lines)
|
||||||
local start = (num > maxHist) and (num - maxHist + 1) or 1
|
local start = 1
|
||||||
local count = 0
|
|
||||||
|
|
||||||
|
local count = 0
|
||||||
for i = start, num do
|
for i = start, num do
|
||||||
local msg = select(1, chtfrm:GetMessageInfo(i))
|
local msg, _, lineID = chatFrame:GetMessageInfo(i)
|
||||||
if msg then
|
if msg then
|
||||||
-- strip textures/atlases as before
|
-- 1) strip icon/atlas tags however you like
|
||||||
msg = gsub(msg, "|T.-|t", "")
|
msg = gsub(msg, "|T.-|t", "")
|
||||||
msg = gsub(msg, "|A.-|a", "")
|
msg = gsub(msg, "|A.-|a", "")
|
||||||
edit:Insert(msg .. "\n")
|
|
||||||
|
-- 2) pick up the right color
|
||||||
|
local info = ChatTypeInfo[ chatTypeIndexToName[lineID] ]
|
||||||
|
local r,g,b = info and info.r, info.g, info.b or 1,1,1
|
||||||
|
|
||||||
|
-- 3) wrap in hex
|
||||||
|
local hex = format("|cff%02x%02x%02x", r*255, g*255, b*255)
|
||||||
|
msg = hex .. msg .. "|r"
|
||||||
|
|
||||||
|
-- 4) insert into copy window
|
||||||
|
edit:Insert(msg)
|
||||||
|
edit:Insert("\n")
|
||||||
count = count + 1
|
count = count + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
title.count:SetText("Messages: "..count)
|
title.count:SetText("Messages: "..count)
|
||||||
ResizeEdit(count)
|
ResizeEdit(count)
|
||||||
scroll:SetVerticalScroll(0)
|
scroll:SetVerticalScroll(scroll:GetVerticalScrollRange())
|
||||||
frame:Show()
|
frame:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -13422,8 +13438,6 @@
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
-- Show cooldowns
|
-- Show cooldowns
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user