vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --[[ LS Chat 1.2
2 author : Aaike Van Roekeghem - a.k.a [LoSt]Madness
3  
4 Enables you to remove the buttons next to the chatframes.
5 The buttons are still clickable eventhough they are invisible , the "Goto Bottom" button will still flash if you are not at the bottom as well.
6 The mod also allows you to scroll in the chatframes with the mousewheel and timestamps chat messages as they come in (with or without seconds).
7  
8 anything this addon does can be enabled/disabled in its options window. open it up with the
9 slashcommand : /lschat
10  
11 changes in 1.2 :
12 - added support for MyAddons
13 - changed toc file for wow version 1600
14 - empty chat messages will not be displayed with timestamps
15  
16 changes in 1.1 :
17 - There is now an option to disable the chat buttons completely
18  
19 ]]--
20  
21 --Default Configuration
22 LSChatConfig = {};
23 LSChatConfig.HideButtons = false;
24 LSChatConfig.DisableButtons = false;
25 LSChatConfig.HideEmote = false;
26 LSChatConfig.StampEnabled = false;
27 LSChatConfig.StampSeconds = false;
28 LSChatConfig.StampStyle = false;
29  
30 LSChat = {
31  
32 --local vars
33 chatbuttons = {"DownButton",
34 "UpButton",
35 "BottomButton"
36 };
37  
38 chatFrames = 7;
39  
40 --Public Functions
41 ToggleButtons = function()
42 if(LSChatConfig.HideButtons) then
43 LSChat.Show();
44 else
45 LSChat.Hide();
46 end
47 end;
48  
49 ToggleEnabled = function()
50 if(LSChatConfig.DisableButtons) then
51 LSChat.Enable();
52 else
53 LSChat.Disable();
54 end
55 end;
56  
57 ToggleEmote = function()
58 if(ChatFrameMenuButton:IsVisible()) then
59 ChatFrameMenuButton:Hide()
60 LSChatConfig.HideEmote = true;
61 else
62 ChatFrameMenuButton:Show()
63 LSChatConfig.HideEmote = false;
64 end
65 end;
66  
67 ToggleMousewheel = function()
68 if(LSChatConfig.Mousewheel) then
69 LSChatConfig.Mousewheel = false;
70 else
71 LSChatConfig.Mousewheel = true
72 end
73 end;
74  
75  
76 ToggleStamp = function()
77 if(LSChatConfig.StampEnabled)then
78 LSChatConfig.StampEnabled = false;
79 else
80 LSChatConfig.StampEnabled = true;
81 end
82 end;
83  
84 ToggleStampSeconds = function()
85 if(LSChatConfig.StampSeconds)then
86 LSChatConfig.StampSeconds = false;
87 else
88 LSChatConfig.StampSeconds = true;
89 end
90 end;
91  
92 ToggleStampStyle = function()
93 if(LSChatConfig.StampStyle)then
94 LSChatConfig.StampStyle = false;
95 else
96 LSChatConfig.StampStyle = true;
97 end
98 end;
99  
100  
101 --Private Functions
102 OnLoad = function()
103  
104  
105 -- Hook ChatFrame_OnEvent so we can hook AddMessage
106 Original_ChatFrame_OnEvent = ChatFrame_OnEvent;
107 ChatFrame_OnEvent = LSChat.OnEvent;
108  
109 SlashCmdList["LOST_CHAT"] = LSChat_ToggleOptions;
110 SLASH_LOST_CHAT1 = "/lschat";
111  
112  
113 end;
114  
115 OnEvent = function(event)
116  
117 if (event == "VARIABLES_LOADED") then
118  
119 if (myAddOnsFrame) then
120 myAddOnsList.LS_Chat = {
121 name = "LS_Chat",
122 description = "Removes chat buttons, enables mousewheel scrolling and more",
123 version = "1.2", category = MYADDONS_CATEGORY_CHAT,
124 frame = "LSChat_Options",
125 optionsframe = "LSChat_Options"
126 };
127 end
128  
129 if(LSChatConfig.HideButtons) then
130 LSChat.Hide();
131 else
132 LSChat.Show();
133 end
134  
135 if(LSChatConfig.HideEmote) then
136 ChatFrameMenuButton:Hide()
137 else
138 ChatFrameMenuButton:Show()
139 end
140  
141  
142 end
143  
144 Original_ChatFrame_OnEvent(event); --call the real ChatFrame_OnEvent function
145 --if we haven't already done so, hook the AddMessage function
146 if(not this.Original_AddMessage) then
147 this.Original_AddMessage = this.AddMessage;
148 this.AddMessage = LSChat.AddMessage;
149 end
150  
151 end;
152  
153 Disable = function()
154 for i=1, LSChat.chatFrames, 1 do
155 for button in LSChat.chatbuttons do
156 b = getglobal("ChatFrame".. i .. LSChat.chatbuttons[button]);
157 b:EnableMouse(0)
158 end
159 end
160 LSChatConfig.DisableButtons = true;
161 end;
162  
163 Enable = function()
164 for i=1, LSChat.chatFrames, 1 do
165 for button in LSChat.chatbuttons do
166 b = getglobal("ChatFrame".. i .. LSChat.chatbuttons[button]);
167 b:EnableMouse(1)
168 end
169 end
170 LSChatConfig.DisableButtons = false;
171 end;
172  
173  
174  
175 Hide = function()
176 for i=1, LSChat.chatFrames, 1 do
177 for button in LSChat.chatbuttons do
178 b = getglobal("ChatFrame".. i .. LSChat.chatbuttons[button]);
179 b:DisableDrawLayer();
180 end
181 end
182 LSChatConfig.HideButtons = true;
183 end;
184  
185 Show = function()
186 for i=1, LSChat.chatFrames, 1 do
187 for button in LSChat.chatbuttons do
188 b = getglobal("ChatFrame".. i .. LSChat.chatbuttons[button]);
189 b:EnableDrawLayer();
190 end
191 end
192 LSChatConfig.HideButtons = false;
193 end;
194  
195 AddMessage = function(this, msg, r, g, b, id)
196  
197 if(LSChatConfig.StampEnabled) then
198 local hour=string.sub(date(), 10, 11)
199  
200 local minute=string.sub(date(), 13, 14)
201  
202 local second =string.sub(date(), 16, 17)
203 local AMPM
204 local newmsg
205  
206 if LSChatConfig.StampStyle==false then
207  
208 if tonumber(hour) >12 then
209 hour=hour-12
210 AMPM="pm"
211 else
212 hour=string.sub(date(), 11, 11)
213 if tonumber(hour)=="0" then
214 hour=12
215 end
216 AMPM="am"
217 end
218  
219 end
220  
221 if msg == nil then
222 msg="The value was nil"
223 end
224 newmsg = "["..hour..":"..minute
225  
226 if(LSChatConfig.StampSeconds) then
227 newmsg = newmsg .. ":"..second
228 end
229  
230 newmsg = newmsg .. "]".." "..msg
231  
232 if newmsg == "" then
233 this:Original_AddMessage(msg, r, g, b, id); --call the real AddMessage function
234 else
235 this:Original_AddMessage(newmsg, r, g, b, id); --call the real AddMessage function
236 end
237  
238 else
239 this:Original_AddMessage(msg, r, g, b, id); --call the real AddMessage function
240 end
241  
242 end;
243  
244 }
245