-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathchat.lua
78 lines (61 loc) · 2.08 KB
/
chat.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
--[[ This was once a really old version of idChat :D ]]
local blacklist = {
[ChatFrame2] = true,
[ChatFrame4] = true,
}
-- 1: index, 2: channelname, 3: twatt
-- Examples are based on this: [1. Channel] Otravi: Hi
--local str = "[%2$.3s] %s" -- gives: [Cha] Otravi: Hi
--local str = "[%d. %2$.3s] %s" -- gives: [1. Cha] Otravi: Hi
local str = "%d|h %3$s" -- gives: 1 Otravi: Hi
local channel = function(...)
return str:format(...)
end
local type = type
local math_floor = math.floor
local ts = "|cffffffff|HoChat|h%s|h|||r %s"
local origs = {}
local AddMessage = function(self, text, ...)
if(type(text) == "string") then
local _, size = self:GetFont()
size = math_floor(size + .5)
-- Simplify channel display.
text = text:gsub('|Hchannel:(%d+)|h%[?(.-)%]?|h.+(|Hplayer.+)', channel)
-- Make the in-line textures match the font-size.
text = text:gsub('(|T[^:]+:)(%d+:*%d*)', ('%%1%d:%1$d'):format(size))
-- Timestamp in the start.
text = ts:format(date"%H%M.%S", text)
end
return origs[self](self, text, ...)
end
for i=1, NUM_CHAT_WINDOWS do
local cf = _G["ChatFrame"..i]
cf:SetFading(false)
if(not blacklist[cf]) then
origs[cf] = cf.AddMessage
cf.AddMessage = AddMessage
end
local bFrame = _G['ChatFrame' .. i .. 'ButtonFrame']
bFrame.Show = bFrame.Hide
bFrame:Hide()
local eb = _G['ChatFrame' .. i .. 'EditBox']
eb:ClearAllPoints()
if(i ~= 2) then
eb:SetPoint("BOTTOMLEFT", cf, "TOPLEFT", -5, 20)
eb:SetPoint("BOTTOMRIGHT", cf, "TOPRIGHT", 5, 20)
else
eb:SetPoint("BOTTOMLEFT", cf, "TOPLEFT", -5, 45)
eb:SetPoint("BOTTOMRIGHT", cf, "TOPRIGHT", 5, 45)
end
eb:SetAltArrowKeyMode(false)
_G['ChatFrame' .. i .. 'EditBoxLeft']:Hide()
_G['ChatFrame' .. i .. 'EditBoxMid']:Hide()
_G['ChatFrame' .. i .. 'EditBoxRight']:Hide()
_G['ChatFrame' .. i .. 'EditBoxFocusLeft']:SetTexture(nil)
_G['ChatFrame' .. i .. 'EditBoxFocusMid']:SetTexture(nil)
_G['ChatFrame' .. i .. 'EditBoxFocusRight']:SetTexture(nil)
end
FriendsMicroButton.Show = FriendsMicroButton.Hide
FriendsMicroButton:Hide()
ChatFrameMenuButton.Show = ChatFrameMenuButton.Hide
ChatFrameMenuButton:Hide()