vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | -- Purge entrys not seen since X weeks |
2 | SCCN_PURGEWEEKS = 4; |
||
3 | |||
4 | ------------------------------------------------- |
||
5 | -- DEFAULT VARIABLES |
||
6 | ------------------------------------------------- |
||
7 | |||
8 | if( not SCCN_storage ) then SCCN_storage = { Skyhawk = { c=7, t=123} }; end; |
||
9 | if( not SCCN_mousescroll ) then SCCN_mousescroll = 1; end; |
||
10 | if( not SCCN_hidechanname ) then SCCN_hidechanname = 0; end; |
||
11 | if( not SCCN_shortchanname ) then SCCN_shortchanname = 0; end; |
||
12 | if( not SCCN_colornicks ) then SCCN_colornicks = 1; end; |
||
13 | if( not SCCN_topeditbox ) then SCCN_topeditbox = 0; end; |
||
14 | if( not SCCN_timestamp ) then SCCN_timestamp = 1; end; |
||
15 | if( not SCCN_colormap ) then SCCN_colormap = 1; end; |
||
16 | if( not SCCN_hyperlinker ) then SCCN_hyperlinker = 1; end; |
||
17 | if( not SCCN_selfhighlight ) then SCCN_selfhighlight = 1; end; |
||
18 | if( not SCCN_clickinvite ) then SCCN_clickinvite = 1; end; |
||
19 | if( not SCCN_editboxkeys ) then SCCN_editboxkeys = 1; end; |
||
20 | if( not SCCN_chatstring ) then SCCN_chatstring = 1; end; |
||
21 | if( not SCCN_selfhighlightmsg ) then SCCN_selfhighlightmsg = 1; end; |
||
22 | if( not SCCN_ts_format ) then SCCN_ts_format = "#33CCFF[$h:$m]"; end; |
||
23 | if( not SCCN_HideChatButtons ) then SCCN_HideChatButtons = 0; end; |
||
24 | if( not SCCN_Highlight_Text ) then SCCN_Highlight_Text = {}; end; |
||
25 | if( not SCCN_Highlight ) then SCCN_Highlight = 0; end; |
||
26 | if( not SCCN_AutoBGMap ) then SCCN_AutoBGMap = 1; end; |
||
27 | if( not SCCN_AutoGossipSkip ) then SCCN_AutoGossipSkip = 0; end; |
||
28 | if( not SCCN_AutoDismount ) then SCCN_AutoDismount = 0; end; |
||
29 | if( not SCCN_Chan_Replace ) then SCCN_Chan_Replace = {}; end; |
||
30 | if( not SCCN_Chan_ReplaceWith ) then SCCN_Chan_ReplaceWith = {}; end; |
||
31 | |||
32 | -- welcome dialog |
||
33 | if( not SCCN_WELCOMESHOWED ) then SCCN_WELCOMESHOWED = 0; end; |
||
34 | |||
35 | -- |
||
36 | |||
37 | |||
38 | local ChatFrame_OnEvent_Org; |
||
39 | local ORG_AddMessage = nil; |
||
40 | SCCN_EntrysConverted = 0; |
||
41 | SCCN_INVITEFOUND = nil; |
||
42 | |||
43 | -- because RAID_CLASS_COLORS is not working always as intended (dont figured out why exactly) I using this. |
||
44 | local SCCN_RAID_COLORS = { |
||
45 | HUNTER = "|cffaad372", |
||
46 | WARLOCK = "|cff9382C9", |
||
47 | PRIEST = "|cffffffff", |
||
48 | PALADIN = "|cfff48cba", |
||
49 | MAGE = "|cff68ccef", |
||
50 | ROGUE = "|cfffff468", |
||
51 | DRUID = "|cffff7c0a", |
||
52 | SHAMAN = "|cfff48cba", |
||
53 | WARRIOR = "|cffc69b6d", |
||
54 | DEFAULT = "|cffa0a0a0"}; |
||
55 | -- Some Colors |
||
56 | local COLOR = { |
||
57 | RED = "|cffff0000", |
||
58 | GREEN = "|cff10ff10", |
||
59 | BLUE = "|cff0000ff", |
||
60 | MAGENTA = "|cffff00ff", |
||
61 | YELLOW = "|cffffff00", |
||
62 | ORANGE = "|cffff9c00", |
||
63 | CYAN = "|cff00ffff", |
||
64 | WHITE = "|cffffffff", |
||
65 | SILVER = "|ca0a0a0a0" |
||
66 | } |
||
67 | ------------------------------------------------- |
||
68 | -- DEFAULT FUNCTIONS |
||
69 | ------------------------------------------------- |
||
70 | function solColorChatNicks_OnLoad() |
||
71 | this:RegisterEvent("VARIABLES_LOADED"); |
||
72 | this:RegisterEvent("PLAYER_LEAVING_WORLD"); |
||
73 | this:RegisterEvent("FRIENDLIST_UPDATE"); |
||
74 | this:RegisterEvent("RAID_ROSTER_UPDATE"); |
||
75 | this:RegisterEvent("GUILD_ROSTER_UPDATE"); |
||
76 | this:RegisterEvent("PARTY_MEMBERS_CHANGED"); |
||
77 | this:RegisterEvent("UPDATE_WORLD_STATES"); |
||
78 | this:RegisterEvent("ZONE_CHANGED_NEW_AREA"); |
||
79 | this:RegisterEvent("GOSSIP_SHOW"); |
||
80 | |||
81 | -- Setting Slash commands |
||
82 | SlashCmdList["SCCN"] = solColorChatNicks_SlashCommand; |
||
83 | SLASH_SCCN1 = "/sccn"; |
||
84 | SlashCmdList["TT"] = SCCN_CMD_TT; |
||
85 | SLASH_TT1 = "/wt"; |
||
86 | end |
||
87 | |||
88 | function solColorChatNicks_OnEvent(event) |
||
89 | if strsub(event, 1, 16) == "VARIABLES_LOADED" then |
||
90 | -- confab compatibility |
||
91 | if ( CONFAB_VERSION ) then |
||
92 | SCCN_write(SCCN_CONFAB); |
||
93 | SCCN_topeditbox = 9; |
||
94 | else |
||
95 | -- top editbox |
||
96 | SCCN_EditBox(SCCN_topeditbox); |
||
97 | end |
||
98 | -- chat hooks |
||
99 | if ChatFrame_OnEvent_Org == nil then |
||
100 | ChatFrame_OnEvent_Org = ChatFrame_OnEvent; |
||
101 | ChatFrame_OnEvent = solColorChatNicks_ChatFrame_OnEvent; |
||
102 | end |
||
103 | if( SCCN_hyperlinker == 1 ) then |
||
104 | -- catches URL's |
||
105 | SCCN_Org_SetItemRef = SetItemRef; |
||
106 | SetItemRef = SCCN_SetItemRef; |
||
107 | end |
||
108 | if( CHRONOS_REV ~= nil ) then |
||
109 | Chronos.schedule(3,SCCN_write,"sOLARiZ Color Chat Nicks. v"..SCCN_VER.." loaded!"); |
||
110 | -- doing auto purge event 30 sec delayed |
||
111 | Chronos.schedule(5,solColorChatNicks_PurgeDB); |
||
112 | -- map pins |
||
113 | Chronos.schedule(15,SCCN_RefreshIcons); |
||
114 | -- URL ADD |
||
115 | Chronos.schedule(10,SCCN_write,"Check out www.solariz.de/sccn for updates."); |
||
116 | else |
||
117 | -- no chronos, direct purge |
||
118 | SCCN_write("sol's Color Chat Nicks. v"..SCCN_VER.." loaded!"); |
||
119 | -- doing auto purge event |
||
120 | solColorChatNicks_PurgeDB(); |
||
121 | -- map pins |
||
122 | SCCN_RefreshIcons(); |
||
123 | end |
||
124 | -- refill |
||
125 | if IsInGuild() then GuildRoster(); end |
||
126 | if GetNumFriends() > 0 then ShowFriends(); end |
||
127 | -- store original chat Editbox history buffer size |
||
128 | SCCN_EditBoxKeysToggle(SCCN_editboxkeys); |
||
129 | -- replacing chat some customized strings |
||
130 | SCCN_CustomizeChatString(SCCN_chatstring); |
||
131 | -- config dialog fillin |
||
132 | SCCN_Config_OnLoad(); |
||
133 | -- Welcome Screen Fill in |
||
134 | if( SCCN_WELCOMESHOWED ~= SCCN_VER ) then |
||
135 | SCCN_WELCOMESCREEN:Show(); |
||
136 | end |
||
137 | |||
138 | |||
139 | elseif strsub(event, 1, 17) == "FRIENDLIST_UPDATE" then |
||
140 | solColorChatNicks_InsertFriends(); |
||
141 | elseif strsub(event, 1, 19) == "GUILD_ROSTER_UPDATE" then |
||
142 | solColorChatNicks_InsertGuildMembers(); |
||
143 | elseif strsub(event, 1, 18) == "RAID_ROSTER_UPDATE" then |
||
144 | solColorChatNicks_InsertRaidMembers(); |
||
145 | SCCN_RefreshIcons(); |
||
146 | elseif strsub(event, 1, 21) == "PARTY_MEMBERS_CHANGED" then |
||
147 | solColorChatNicks_InsertPartyMembers(); |
||
148 | SCCN_RefreshIcons(); |
||
149 | elseif strsub(event, 1, 19) == "UPDATE_WORLD_STATES" then |
||
150 | SCCN_RefreshIcons(); |
||
151 | elseif strsub(event, 1, 21) == "ZONE_CHANGED_NEW_AREA" then |
||
152 | SCCN_BG_AutoMap(); |
||
153 | elseif event == "PLAYER_LEAVING_WORLD" then |
||
154 | this:RegisterEvent("PLAYER_ENTERING_WORLD"); |
||
155 | -- Unregistering Events |
||
156 | this:UnregisterEvent("FRIENDLIST_UPDATE"); |
||
157 | this:UnregisterEvent("RAID_ROSTER_UPDATE"); |
||
158 | this:UnregisterEvent("GUILD_ROSTER_UPDATE"); |
||
159 | this:UnregisterEvent("PARTY_MEMBERS_CHANGED"); |
||
160 | this:UnregisterEvent("UPDATE_WORLD_STATES"); |
||
161 | this:UnregisterEvent("ZONE_CHANGED_NEW_AREA"); |
||
162 | this:UnregisterEvent("GOSSIP_SHOW"); |
||
163 | elseif event == "PLAYER_ENTERING_WORLD" then |
||
164 | -- re Register Events |
||
165 | this:RegisterEvent("FRIENDLIST_UPDATE"); |
||
166 | this:RegisterEvent("RAID_ROSTER_UPDATE"); |
||
167 | this:RegisterEvent("GUILD_ROSTER_UPDATE"); |
||
168 | this:RegisterEvent("PARTY_MEMBERS_CHANGED"); |
||
169 | this:RegisterEvent("UPDATE_WORLD_STATES"); |
||
170 | this:RegisterEvent("ZONE_CHANGED_NEW_AREA"); |
||
171 | this:RegisterEvent("GOSSIP_SHOW"); |
||
172 | elseif ( event == "GOSSIP_SHOW" and not IsControlKeyDown() ) then |
||
173 | SCCN_OnGOSSIP(); |
||
174 | end |
||
175 | end |
||
176 | |||
177 | |||
178 | function solColorChatNicks_PurgeDB() |
||
179 | SCCN_purged = 0; |
||
180 | SCCN_keept = 0; |
||
181 | SCCN_EntrysConverted = 0; |
||
182 | SCCN_OldStorage = SCCN_storage; |
||
183 | SCCN_storage = nil; |
||
184 | SCCN_storage = {}; |
||
185 | table.foreach(SCCN_OldStorage, solColorChatNicks_PurgeEntry); |
||
186 | if( SCCN_EntrysConverted > 0 ) then |
||
187 | SCCN_write("Purged: "..SCCN_purged..", Keept: "..SCCN_keept.." Converted to "..SCCN_VER.." :"..SCCN_EntrysConverted); |
||
188 | SCCN_EntrysConverted = nil; |
||
189 | else |
||
190 | SCCN_write("Purged: "..SCCN_purged..", Keept: "..SCCN_keept); |
||
191 | end |
||
192 | SCCN_write("Memory currently used by SolsColorChatNicks Addon storage: "..ceil( (SCCN_keept*60) / 1024).." Kb"); |
||
193 | getglobal("SCCNConfigForm".."stat1".."Label"):SetText(COLOR["SILVER"].."SCCN Knows currently "..SCCN_keept.." Chars, this are ca. "..ceil( (SCCN_keept*60) / 1024).." Kb"); |
||
194 | SCCN_OldStorage = nil; |
||
195 | SCCN_purged = nil; |
||
196 | SCCN_keept = nil; |
||
197 | end |
||
198 | |||
199 | function solColorChatNicks_PurgeEntry(k,v) |
||
200 | if( (SCCN_OldStorage[k]["t"] + (3600*24*7*SCCN_PURGEWEEKS) ) < time() ) then |
||
201 | SCCN_purged = SCCN_purged + 1; |
||
202 | else |
||
203 | SCCN_storage[k] = { t=SCCN_OldStorage[k]["t"], c=SCCN_OldStorage[k]["c"] } |
||
204 | SCCN_keept = SCCN_keept + 1; |
||
205 | end |
||
206 | -- Convert check for old version storage pre v.0.2 |
||
207 | if( SCCN_storage[k] ~= nil ) then -- 0.5 formal 126 line error workaround |
||
208 | if( SCCN_storage[k]["c"] ~= nil ) then |
||
209 | if( SCCN_storage[k]["c"] ~= 0 and SCCN_storage[k]["c"] ~= 1 and SCCN_storage[k]["c"] ~= 2 and SCCN_storage[k]["c"] ~= 3 and SCCN_storage[k]["c"] ~= 4 and SCCN_storage[k]["c"] ~= 5 and SCCN_storage[k]["c"] ~= 6 and SCCN_storage[k]["c"] ~= 7 and SCCN_storage[k]["c"] ~= 8 and SCCN_storage[k]["c"] ~= 9 ) then |
||
210 | SCCN_storage[k]["c"] = solColorChatNicks_ClassToNum(SCCN_storage[k]["c"]); |
||
211 | SCCN_EntrysConverted = SCCN_EntrysConverted+1; |
||
212 | end |
||
213 | end |
||
214 | end |
||
215 | end |
||
216 | |||
217 | function SCCN_write(msg) |
||
218 | if( msg ~= nil ) then |
||
219 | DEFAULT_CHAT_FRAME:AddMessage("|cffaad372".."Sol".."|cfffff468".."CCN".."|cffffffff: "..msg); |
||
220 | end |
||
221 | end |
||
222 | |||
223 | ------------------------------------------------- |
||
224 | -- CHAT FRAME MANIPULATION FUNCTIONS |
||
225 | ------------------------------------------------- |
||
226 | function solColorChatNicks_ChatFrame_OnEvent(event) |
||
227 | if( not this.ORG_AddMessage ) then |
||
228 | this.ORG_AddMessage = this.AddMessage |
||
229 | this.AddMessage = S_AddMessage |
||
230 | end; |
||
231 | if( SCCN_colornicks == 1) then |
||
232 | this.solColorChatNicks_Name = arg2; |
||
233 | end |
||
234 | -- Strip channel name |
||
235 | if arg9 and event ~= "CHAT_MSG_CHANNEL_NOTICE" then |
||
236 | local _, _, strippedChannelName = string.find(arg9, "(.-)%s.*"); |
||
237 | this.solColorChatNicks_Channelname = strippedChannelName; |
||
238 | end |
||
239 | -- Call original handler |
||
240 | ChatFrame_OnEvent_Org(event); |
||
241 | end |
||
242 | |||
243 | function S_AddMessage(this,text,r,g,b,id) |
||
244 | if SCCN_hidechanname == 1 and this.solColorChatNicks_Channelname then |
||
245 | -- Remove channel name |
||
246 | text = string.gsub(text, ".%s" .. this.solColorChatNicks_Channelname, "", 1); |
||
247 | this.solColorChatNicks_Channelname = nil; |
||
248 | end |
||
249 | if ( (SCCN_hidechanname == 1) and text ~= nil ) then |
||
250 | -- remove Guild, Party, Raid from chat channel name |
||
251 | for i=1, table.getn(SCCN_STRIPCHAN) do |
||
252 | text = string.gsub(text, "(%[)(%d?)(.?%s?"..SCCN_STRIPCHAN[i].."%s?)(%])(%s?)", SCCN_STRIPCHANNAMEFUNC,1); |
||
253 | end |
||
254 | elseif ( SCCN_shortchanname == 1 ) then |
||
255 | -- Short Channel Names |
||
256 | local temp = nil; |
||
257 | if text ~= nil then |
||
258 | for i = 1, 9 do |
||
259 | if SCCN_Chan_Replace[i] ~= nil and SCCN_Chan_ReplaceWith[i] ~= nil then |
||
260 | temp = string.gsub(text, SCCN_Chan_Replace[i].."]%s", SCCN_Chan_ReplaceWith[i].."]", 1) |
||
261 | if temp ~= text then |
||
262 | text = temp; |
||
263 | temp = nil; |
||
264 | break; |
||
265 | end |
||
266 | end |
||
267 | end |
||
268 | end |
||
269 | end |
||
270 | |||
271 | -- color self in text |
||
272 | if( SCCN_selfhighlight == 1 and text ~= nil ) then |
||
273 | if( arg8 ~= 3 and arg8 ~= 4 ) then |
||
274 | if( arg2 ~= nil and arg2 ~= UnitName("player") and UnitName("player") ~= nil and string.len(text) >= string.len(UnitName("player")) ) then |
||
275 | if(string.find(text, UnitName("player")) or string.find(text, string.lower(UnitName("player")))) then |
||
276 | -- NO CTRA and NO DMSYNC |
||
277 | if(not string.find(text, "<CTRaid>") and not string.find(text, "SYNCE_") and not string.find(text, "SYNC_") ) then |
||
278 | text = string.gsub(text, "([^:^%[]"..UnitName("player")..")" , " "..COLOR["YELLOW"]..">"..COLOR["RED"]..UnitName("player")..COLOR["YELLOW"].."<|r"); |
||
279 | text = string.gsub(text, "([^:^%[]"..string.lower(UnitName("player"))..")" , " "..COLOR["YELLOW"]..">"..COLOR["RED"]..UnitName("player")..COLOR["YELLOW"].."<|r"); |
||
280 | -- On Screen Msg |
||
281 | if( SCCN_selfhighlightmsg == 1 ) then |
||
282 | UIErrorsFrame:AddMessage(text, 1, 1, 1, 1.0, UIERRORS_HOLD_TIME); |
||
283 | PlaySound("FriendJoinGame"); |
||
284 | end |
||
285 | end |
||
286 | end |
||
287 | end |
||
288 | end |
||
289 | end |
||
290 | -- Custom Highlight /SCCN highlight |
||
291 | SCCN_Custom_Highlighted = false; |
||
292 | |||
293 | if SCCN_Custom_Highlighted == false then text = SCCN_CustomHighlightProcessor(text,SCCN_Highlight_Text[1]); end; |
||
294 | if SCCN_Custom_Highlighted == false then text = SCCN_CustomHighlightProcessor(text,SCCN_Highlight_Text[2]); end; |
||
295 | if SCCN_Custom_Highlighted == false then text = SCCN_CustomHighlightProcessor(text,SCCN_Highlight_Text[3]); end; |
||
296 | |||
297 | -- color nick's |
||
298 | if this.solColorChatNicks_Name and string.len(this.solColorChatNicks_Name) > 2 and text ~= nil and arg2 ~= nil then |
||
299 | text = string.gsub(text, "(.-)"..this.solColorChatNicks_Name .. "([%]%s].*)", "%1"..solColorChatNicks_GetColorFor(this.solColorChatNicks_Name)..this.solColorChatNicks_Name.."|r%2", 1); |
||
300 | end |
||
301 | this.solColorChatNicks_Name = nil; |
||
302 | -- Timestamp |
||
303 | if( SCCN_timestamp == 1 and text ~= nil ) then |
||
304 | local hour = tonumber(string.sub(date(), 10, 11)); |
||
305 | local minute= tonumber(string.sub(date(), 13, 14)); |
||
306 | local second= tonumber(string.sub(date(), 16, 17)); |
||
307 | local periode = ""; |
||
308 | local hour12 = ""; |
||
309 | if hour > 0 and hour < 12 then |
||
310 | periode = "am"; |
||
311 | hour12 = hour; |
||
312 | else |
||
313 | periode = "pm"; |
||
314 | hour12 = hour-12; |
||
315 | end |
||
316 | -- 2 digit |
||
317 | if( string.len(tostring(hour)) < 2) then hour = "0"..tostring(hour); end |
||
318 | if( string.len(tostring(hour12)) < 2) then hour12 = "0"..tostring(hour12); end |
||
319 | if( string.len(tostring(minute)) < 2) then minute = "0"..tostring(minute); end |
||
320 | if( string.len(tostring(second)) < 2) then second = "0"..tostring(second); end |
||
321 | -- setting timestamp |
||
322 | local TimeStamp = SCCN_ts_format; |
||
323 | TimeStamp = string.gsub(TimeStamp, "$h", hour); |
||
324 | TimeStamp = string.gsub(TimeStamp, "$m", minute); |
||
325 | TimeStamp = string.gsub(TimeStamp, "$s", second); |
||
326 | TimeStamp = string.gsub(TimeStamp, "$p", periode); |
||
327 | TimeStamp = string.gsub(TimeStamp, "$t", hour12); |
||
328 | TimeStamp = string.gsub(TimeStamp, "#", "|cff"); |
||
329 | text = TimeStamp.."|r "..text; |
||
330 | end |
||
331 | -- URL detection |
||
332 | if( SCCN_hyperlinker == 1 and text ~= nil ) then |
||
333 | SCCN_URLFOUND = nil; |
||
334 | -- numeric IP's 123.123.123.123:12345 |
||
335 | if SCCN_URLFOUND == nil then text = string.gsub(text, "(%s?)(%d%d?%d?%.%d%d?%d?%.%d%d?%d?%.%d%d?%d?:%d%d?%d?%d?%d?)(%s?)", SCCN_GetURL); end; |
||
336 | -- TeamSpeak like IP's sub.domain.org:12345 or domain.de:123 |
||
337 | if SCCN_URLFOUND == nil then text = string.gsub(text, "(%s?)([%w_-]+%.?[%w_-]+%.[%w_-]+:%d%d%d?%d?%d?)(%s?)", SCCN_GetURL); end; |
||
338 | -- complete http urls |
||
339 | if SCCN_URLFOUND == nil then text = string.gsub(text, "(%s?)(%a+://[%w_/%.%?%%=~&-]+)(%s?)", SCCN_GetURL); end; |
||
340 | -- www.URL.de |
||
341 | if SCCN_URLFOUND == nil then text = string.gsub(text, "(%s?)(www%.[%w_/%.%?%%=~&-]+)(%s?)", SCCN_GetURL); end; |
||
342 | -- test@test.de |
||
343 | if SCCN_URLFOUND == nil then text = string.gsub(text, "(%s?)([_%w-%.~-]+@[_%w-]+%.[_%w-%.]+)(%s?)", SCCN_GetURL); end; |
||
344 | end |
||
345 | -- clickinvite |
||
346 | if( SCCN_clickinvite == 1 and text ~= nil and arg2 ~= nil ) then |
||
347 | SCCN_INVITEFOUND = nil; |
||
348 | if SCCN_INVITEFOUND == nil then text = string.gsub(text, "(%s?[^%a])(invite)[^%a](%s?)", SCCN_ClickInvite,1); end |
||
349 | if SCCN_INVITEFOUND == nil then text = string.gsub(text, "(%s)(invite)[^%a](%s?)", SCCN_ClickInvite,1); end |
||
350 | if SCCN_INVITEFOUND == nil then text = string.gsub(text, "(%s?[^%a])(inv)[^%a](%s?)", SCCN_ClickInvite,1); end |
||
351 | if SCCN_INVITEFOUND == nil then text = string.gsub(text, "(%s)(inv)[^%a](%s?)", SCCN_ClickInvite,1); end |
||
352 | if SCCN_INVITEFOUND == nil and SCCN_CUSTOM_INV ~= nil then |
||
353 | -- custom invite word in localization |
||
354 | for i=1, table.getn(SCCN_CUSTOM_INV) do |
||
355 | if SCCN_INVITEFOUND == nil then text = string.gsub(text, "(%s?[^%a])("..SCCN_CUSTOM_INV[i]..")(%a?)", SCCN_ClickInvite,1); end |
||
356 | if SCCN_INVITEFOUND == nil then text = string.gsub(text, "(%s)("..SCCN_CUSTOM_INV[i]..")(%s?)", SCCN_ClickInvite,1); end |
||
357 | end |
||
358 | end |
||
359 | if SCCN_INVITEFOUND == nil then text = string.gsub(text, "(%s?[^%a])(invite)(%a?)", SCCN_ClickInvite,1); end |
||
360 | if SCCN_INVITEFOUND == nil then text = string.gsub(text, "(%s?[^%a])(inv)(%a?)", SCCN_ClickInvite,1); end |
||
361 | end |
||
362 | -- output |
||
363 | if (this.ORG_AddMessage ~= nil) then |
||
364 | this:ORG_AddMessage(text,r,g,b,id); |
||
365 | end |
||
366 | end |
||
367 | |||
368 | function SCCN_CustomHighlightProcessor(text,SCCN_Custom_Highlight_Word) |
||
369 | if ( SCCN_Highlight == 1 and SCCN_Custom_Highlight_Word and string.len(text) >= string.len(SCCN_Custom_Highlight_Word) and string.len(SCCN_Custom_Highlight_Word) > 2 ) then |
||
370 | if( string.find(text,string.lower(SCCN_Custom_Highlight_Word)) or string.find(text,SCCN_Custom_Highlight_Word) ) then |
||
371 | -- NO CTRA and NO DMSYNC |
||
372 | if(not string.find(text, "<CTRaid>") and not string.find(text, "SYNCE_") and not string.find(text, "SYNC_") ) then |
||
373 | if( text ~= string.gsub(text, "([^:^%[]"..SCCN_Custom_Highlight_Word..")" , "")) then |
||
374 | text = string.gsub(text, "([^:^%[]"..SCCN_Custom_Highlight_Word..")" , " "..COLOR["YELLOW"]..">"..COLOR["RED"]..SCCN_Custom_Highlight_Word..COLOR["YELLOW"].."<|r"); |
||
375 | else |
||
376 | text = string.gsub(text, "([^:^%[]"..string.lower(SCCN_Custom_Highlight_Word)..")" , " "..COLOR["YELLOW"]..">"..COLOR["RED"]..string.lower(SCCN_Custom_Highlight_Word)..COLOR["YELLOW"].."<|r"); |
||
377 | end |
||
378 | -- On Screen Msg |
||
379 | UIErrorsFrame:AddMessage(text, 1, 1, 1, 1.0, UIERRORS_HOLD_TIME); |
||
380 | PlaySound("FriendJoinGame"); |
||
381 | -- set already highlighted = True |
||
382 | SCCN_Custom_Highlighted = true; |
||
383 | end |
||
384 | end |
||
385 | end |
||
386 | return text; |
||
387 | end |
||
388 | |||
389 | function SCCN_OnMouseWheel(chatframe, value) |
||
390 | if( SCCN_mousescroll == 1 ) then |
||
391 | if IsShiftKeyDown() then |
||
392 | -- shift key pressed (Fast scroll) |
||
393 | if ( value > 0 ) then |
||
394 | for i = 1,5 do chatframe:ScrollUp(); end; |
||
395 | elseif ( value < 0 ) then |
||
396 | for i = 1,5 do chatframe:ScrollDown(); end; |
||
397 | end |
||
398 | elseif IsControlKeyDown() then |
||
399 | -- to top / to bottom |
||
400 | if ( value > 0 ) then |
||
401 | chatframe:ScrollToTop(); |
||
402 | elseif ( value < 0 ) then |
||
403 | chatframe:ScrollToBottom(); |
||
404 | end |
||
405 | else |
||
406 | -- Normal Scroll without shift key |
||
407 | if ( value > 0 ) then |
||
408 | chatframe:ScrollUp(); |
||
409 | elseif ( value < 0 ) then |
||
410 | chatframe:ScrollDown(); |
||
411 | end |
||
412 | end |
||
413 | end |
||
414 | end |
||
415 | |||
416 | function SCCN_EditBox(where) |
||
417 | if(where == 1) then |
||
418 | -- top |
||
419 | ChatFrameEditBox:ClearAllPoints(); |
||
420 | ChatFrameEditBox:SetPoint("BOTTOMLEFT", "ChatFrame1", "TOPLEFT", 0, 2); |
||
421 | ChatFrameEditBox:SetPoint("BOTTOMRIGHT", "ChatFrame1", "TOPRIGHT", 0, 2); |
||
422 | elseif(where == 0) then |
||
423 | -- bottom |
||
424 | -- ChatFrameEditBox:ClearAllPoints(); |
||
425 | ChatFrameEditBox:SetPoint("BOTTOMLEFT", "ChatFrame1", "BOTTOMLEFT", 0, -28); |
||
426 | ChatFrameEditBox:SetPoint("BOTTOMRIGHT", "ChatFrame1", "BOTTOMRIGHT", 0, -28); |
||
427 | end |
||
428 | end |
||
429 | |||
430 | function SCCN_CustomizeChatString(status) |
||
431 | if OLD_CHAT_WHISPER_GET == nil then OLD_CHAT_WHISPER_GET = CHAT_WHISPER_GET; end |
||
432 | if OLD_CHAT_WHISPER_INFORM_GET == nil then OLD_CHAT_WHISPER_INFORM_GET = CHAT_WHISPER_INFORM_GET; end; |
||
433 | if( status == 1 ) then |
||
434 | CHAT_WHISPER_GET = SCCN_CUSTOM_CHT_FROM.." "; |
||
435 | CHAT_WHISPER_INFORM_GET = SCCN_CUSTOM_CHT_TO.." "; |
||
436 | else |
||
437 | -- restore original |
||
438 | CHAT_WHISPER_GET = OLD_CHAT_WHISPER_GET; |
||
439 | CHAT_WHISPER_INFORM_GET = OLD_CHAT_WHISPER_INFORM_GET; |
||
440 | end |
||
441 | end |
||
442 | |||
443 | function SCCN_EditBoxKeysToggle(status) |
||
444 | if SCCN_OrgHistoryLines == nil then SCCN_OrgHistoryLines = ChatFrameEditBox:GetHistoryLines(); end |
||
445 | if( status == 1 ) then |
||
446 | ChatFrameEditBox:SetHistoryLines(250); |
||
447 | ChatFrameEditBox:SetAltArrowKeyMode(false); |
||
448 | else |
||
449 | -- restore original |
||
450 | ChatFrameEditBox:SetHistoryLines(16); |
||
451 | ChatFrameEditBox:SetHistoryLines(SCCN_OrgHistoryLines); |
||
452 | ChatFrameEditBox:SetAltArrowKeyMode(true); |
||
453 | end |
||
454 | end |
||
455 | |||
456 | function SCCN_STRIPCHANNAMEFUNC(a,b,c,d,e) |
||
457 | -- a = (%[) |
||
458 | -- b = (%d?) |
||
459 | -- c = (.?%s?"..SCCN_STRIPCHAN[i].."%]%s?) |
||
460 | -- d = (%]) |
||
461 | -- e = (%s?) |
||
462 | if(SCCN_hidechanname == 1) then |
||
463 | if(c ~= nil and string.find(c,"%.") ) then |
||
464 | return a..b..d..e; |
||
465 | else |
||
466 | return; |
||
467 | end |
||
468 | end |
||
469 | --getglobal("SCCNConfigForm".."ver1".."Label"):SetText(COLOR["RED"].."A["..COLOR["WHITE"]..a..COLOR["RED"].."] B["..COLOR["WHITE"]..b..COLOR["RED"].."] C["..COLOR["WHITE"]..c..COLOR["RED"].."] D["..COLOR["WHITE"]..d..COLOR["RED"].."]"); |
||
470 | end |
||
471 | |||
472 | function SCCN_ChatFrame_OnUpdate() |
||
473 | local BottomButton = getglobal(this:GetParent():GetName().."BottomButton"); |
||
474 | local DownButton = getglobal(this:GetParent():GetName().."DownButton"); |
||
475 | local UpButton = getglobal(this:GetParent():GetName().."UpButton"); |
||
476 | if( SCCN_HideChatButtons == 1 ) then |
||
477 | if BottomButton:IsVisible() then BottomButton:Hide(); end |
||
478 | if DownButton:IsVisible() then DownButton:Hide(); end |
||
479 | if UpButton:IsVisible() then UpButton:Hide(); end |
||
480 | if ChatFrameMenuButton:IsVisible() then ChatFrameMenuButton:Hide(); end |
||
481 | else |
||
482 | if not BottomButton:IsVisible() then BottomButton:Show(); end |
||
483 | if not DownButton:IsVisible() then DownButton:Show(); end |
||
484 | if not UpButton:IsVisible() then UpButton:Show(); end |
||
485 | if not ChatFrameMenuButton:IsVisible() then ChatFrameMenuButton:Show(); end |
||
486 | end |
||
487 | |||
488 | end |
||
489 | |||
490 | function SCCN_KeyBinding_ChatFrameEditBox(kommando) |
||
491 | if (not ChatFrameEditBox:IsVisible()) then |
||
492 | ChatFrame_OpenChat(kommando); |
||
493 | else |
||
494 | ChatFrameEditBox:SetText(kommando); |
||
495 | end; |
||
496 | ChatFrameEditBox:Show(); |
||
497 | ChatEdit_ParseText(ChatFrame1.editBox,0); |
||
498 | end |
||
499 | |||
500 | ------------------------------------------------- |
||
501 | -- MOD INTERFACE FOR 3rd PARTY MODS |
||
502 | ------------------------------------------------- |
||
503 | function SCCN_ForgottenChatNickName(Name) |
||
504 | local FCcolor = solColorChatNicks_GetColorFor(Name); |
||
505 | if( FCcolor ~= nil ) then |
||
506 | return solColorChatNicks_GetColorFor(Name)..Name.."|r"; |
||
507 | else |
||
508 | return Name; |
||
509 | end |
||
510 | end |
||
511 | |||
512 | ------------------------------------------------- |
||
513 | -- INFORMATION GATHERING FUNCTIONS |
||
514 | ------------------------------------------------- |
||
515 | -- Color management |
||
516 | function solColorChatNicks_GetColorFor(name) |
||
517 | -- Default color |
||
518 | color = ""; |
||
519 | -- Check if unit name exists in storage |
||
520 | if( SCCN_storage[name] ~= nil ) then |
||
521 | color = solColorChatNicks_GetClassColor(SCCN_storage[name]["c"]); |
||
522 | elseif( name == UnitName("player") ) then |
||
523 | -- You are the person. That's easy |
||
524 | local _, class = UnitClass("player"); |
||
525 | local class = solColorChatNicks_ClassToNum(class); |
||
526 | color = solColorChatNicks_GetClassColor(class); |
||
527 | SCCN_storage[name] = { c = class, t=time() }; |
||
528 | end |
||
529 | |||
530 | return color; |
||
531 | end |
||
532 | |||
533 | function solColorChatNicks_InsertFriends() |
||
534 | -- add current online friends |
||
535 | for i = 1, GetNumFriends() do |
||
536 | local name, _, class, _ = GetFriendInfo(i); |
||
537 | local class = solColorChatNicks_ClassToNum(class); |
||
538 | if( class ~= nil and name ~= nil ) then |
||
539 | SCCN_storage[name] = { c = class, t=time() }; |
||
540 | end |
||
541 | end |
||
542 | end |
||
543 | |||
544 | function solColorChatNicks_InsertGuildMembers() |
||
545 | -- add current online guild members |
||
546 | for i = 1, GetNumGuildMembers() do |
||
547 | local name,_,_,_,class = GetGuildRosterInfo(i); |
||
548 | local class = solColorChatNicks_ClassToNum(class); |
||
549 | if( class ~= nil and name ~= nil ) then |
||
550 | SCCN_storage[name] = { c = class, t=time() }; |
||
551 | end |
||
552 | end |
||
553 | end |
||
554 | |||
555 | function solColorChatNicks_InsertRaidMembers() |
||
556 | for i = 1, GetNumRaidMembers() do |
||
557 | local name, _, _, _, _, class = GetRaidRosterInfo(i); |
||
558 | local class = solColorChatNicks_ClassToNum(class); |
||
559 | if( class ~= nil and name ~= nil ) then |
||
560 | SCCN_storage[name] = { c = class, t=time() }; |
||
561 | end |
||
562 | end |
||
563 | end |
||
564 | |||
565 | function solColorChatNicks_InsertPartyMembers() |
||
566 | for i = 1, GetNumPartyMembers() do |
||
567 | local unit = "party" .. i; |
||
568 | local _, class = UnitClass(unit); |
||
569 | local name = UnitName(unit); |
||
570 | local class = solColorChatNicks_ClassToNum(class); |
||
571 | if( class ~= nil and name ~= nil ) then |
||
572 | SCCN_storage[name] = { c = class, t=time() }; |
||
573 | end |
||
574 | end |
||
575 | end |
||
576 | |||
577 | ------------------------------------------------- |
||
578 | -- CONVERTER / GET FROM ARRAY FUNCTIONS |
||
579 | ------------------------------------------------- |
||
580 | function solColorChatNicks_ClassToNum(class) |
||
581 | if(class == "WARLOCK" or class == SCCN_LOCAL_CLASS["WARLOCK"]) then |
||
582 | return 1; |
||
583 | elseif(class == "HUNTER" or class == SCCN_LOCAL_CLASS["HUNTER"]) then |
||
584 | return 2; |
||
585 | elseif(class == "PRIEST" or class == SCCN_LOCAL_CLASS["PRIEST"]) then |
||
586 | return 3; |
||
587 | elseif(class == "PALADIN" or class == SCCN_LOCAL_CLASS["PALADIN"]) then |
||
588 | return 4; |
||
589 | elseif(class == "MAGE" or class == SCCN_LOCAL_CLASS["MAGE"]) then |
||
590 | return 5; |
||
591 | elseif(class == "ROGUE" or class == SCCN_LOCAL_CLASS["ROGUE"]) then |
||
592 | return 6; |
||
593 | elseif(class == "DRUID" or class == SCCN_LOCAL_CLASS["DRUID"]) then |
||
594 | return 7; |
||
595 | elseif(class == "SHAMAN" or class == SCCN_LOCAL_CLASS["SHAMAN"]) then |
||
596 | return 8; |
||
597 | elseif(class == "WARRIOR" or class == SCCN_LOCAL_CLASS["WARRIOR"]) then |
||
598 | return 9; |
||
599 | end |
||
600 | return 0; |
||
601 | end |
||
602 | |||
603 | function solColorChatNicks_ClassNumToRGB(classnum) |
||
604 | if(classnum == 1) then return {r=100,g=0,b=112} |
||
605 | elseif(classnum == 2) then return {r=81,g=140,b=11} |
||
606 | elseif(classnum == 3) then return {r=1,g=1,b=1} |
||
607 | elseif(classnum == 4) then return {r=255,g=0,b=255} |
||
608 | elseif(classnum == 5) then return {r=0,g=180,b=240} |
||
609 | elseif(classnum == 6) then return {r=220,g=200,b=0} |
||
610 | elseif(classnum == 7) then return {r=240,g=136,b=0} |
||
611 | elseif(classnum == 8) then return {r=255,g=0,b=255} |
||
612 | elseif(classnum == 9) then return {r=147,g=112,b=67} |
||
613 | else return {r=0,g=0,b=0}; end |
||
614 | end |
||
615 | |||
616 | function solColorChatNicks_GetClassColor(class) |
||
617 | if(class == 1) then return SCCN_RAID_COLORS["WARLOCK"]; |
||
618 | elseif(class == 2) then return SCCN_RAID_COLORS["HUNTER"]; |
||
619 | elseif(class == 3) then return SCCN_RAID_COLORS["PRIEST"]; |
||
620 | elseif(class == 4) then return SCCN_RAID_COLORS["PALADIN"]; |
||
621 | elseif(class == 5) then return SCCN_RAID_COLORS["MAGE"]; |
||
622 | elseif(class == 6) then return SCCN_RAID_COLORS["ROGUE"]; |
||
623 | elseif(class == 7) then return SCCN_RAID_COLORS["DRUID"]; |
||
624 | elseif(class == 8) then return SCCN_RAID_COLORS["SHAMAN"]; |
||
625 | elseif(class == 9) then return SCCN_RAID_COLORS["WARRIOR"]; |
||
626 | end |
||
627 | return SCCN_RAID_COLORS["DEFAULT"]; |
||
628 | end |
||
629 | |||
630 | ------------------------------------------------- |
||
631 | -- Map Stuff |
||
632 | ------------------------------------------------- |
||
633 | function SCCN_RefreshIcons() |
||
634 | if( UnitInRaid("player") and SCCN_colormap == 1 and GetNumRaidMembers() > 0 ) then |
||
635 | local classcolor = {} |
||
636 | local icon = "Interface\\AddOns\\solColorChatNicks\\gfx\\Icon"; |
||
637 | local icon2 = icon.."2"; |
||
638 | for i=1, MAX_RAID_MEMBERS do |
||
639 | -- Full WorldMap colored Icons |
||
640 | local raidMemberFrame = getglobal("WorldMapRaid"..i); |
||
641 | if ( UnitInRaid(raidMemberFrame.unit) ) then |
||
642 | for x=1, GetNumRaidMembers() do |
||
643 | local name, _, _, _, _, class = GetRaidRosterInfo(x); |
||
644 | if ( name == UnitName(raidMemberFrame.unit) ) then |
||
645 | getglobal(raidMemberFrame:GetName().."Icon"):SetTexture(icon2); |
||
646 | local iconColor = RAID_CLASS_COLORS[class]; |
||
647 | getglobal(raidMemberFrame:GetName().."Icon"):SetVertexColor(iconColor.r, iconColor.g, iconColor.b); |
||
648 | break; |
||
649 | end |
||
650 | end |
||
651 | else |
||
652 | getglobal(raidMemberFrame:GetName().."Icon"):SetTexture(icon); |
||
653 | getglobal(raidMemberFrame:GetName().."Icon"):SetVertexColor(0.6, 0.6, 0.6); |
||
654 | end |
||
655 | -- BattleField Minimap colored icons |
||
656 | if ( IsAddOnLoaded("Blizzard_BattlefieldMinimap") ) then |
||
657 | local BFMMFrame = getglobal("BattlefieldMinimapRaid"..i); |
||
658 | if ( UnitInRaid(BFMMFrame.unit) ) then |
||
659 | for x=1, GetNumRaidMembers() do |
||
660 | local name, _, _, _, _, class = GetRaidRosterInfo(x); |
||
661 | if ( name == UnitName(BFMMFrame.unit) ) then |
||
662 | local iconColor = RAID_CLASS_COLORS[class]; |
||
663 | getglobal(BFMMFrame:GetName().."Icon"):SetTexture(icon2); |
||
664 | getglobal(BFMMFrame:GetName().."Icon"):SetVertexColor(iconColor.r, iconColor.g, iconColor.b); |
||
665 | break; |
||
666 | end |
||
667 | end |
||
668 | else |
||
669 | getglobal(BFMMFrame:GetName().."Icon"):SetTexture(icon); |
||
670 | getglobal(BFMMFrame:GetName().."Icon"):SetVertexColor(0.6, 0.6, 0.6); |
||
671 | end |
||
672 | end |
||
673 | end |
||
674 | end |
||
675 | end |
||
676 | |||
677 | function SCCN_BG_AutoMap(event) |
||
678 | if( SCCN_AutoBGMap == 1 ) then |
||
679 | local zone_text = GetZoneText() |
||
680 | if (zone_text == SCCN_LOCAL_ZONE["alterac"] or zone_text == SCCN_LOCAL_ZONE["warsong"] or zone_text == SCCN_LOCAL_ZONE["arathi"]) then |
||
681 | SCCN_write("Zone change into '"..zone_text.."' detected. AutoToggle BGMiniMap..."); |
||
682 | ToggleBattlefieldMinimap(); |
||
683 | end |
||
684 | end |
||
685 | end |
||
686 | |||
687 | |||
688 | -------------------------------------------------- |
||
689 | -- Hyperlink and make clickable in chat Stuff |
||
690 | -------------------------------------------------- |
||
691 | function SCCN_HyperlinkWindow(url) |
||
692 | if( url ~= nil ) then |
||
693 | getglobal( "solHyperlinkerEditBox" ):SetText( url ); |
||
694 | -- solHyperlinkerForm:Hide(); |
||
695 | solHyperlinkerForm:Show(); |
||
696 | end |
||
697 | end |
||
698 | |||
699 | function SCCN_GetURL(before, URL, after) |
||
700 | SCCN_URLFOUND = 1; |
||
701 | return before.."|cff".."9999EE".. "|Href:" .. URL .. "|h[".. URL .."]|h|r" .. after; |
||
702 | end |
||
703 | |||
704 | function SCCN_SetItemRef(link, text, button) |
||
705 | if (string.sub(link, 1 , 3) == "ref") then |
||
706 | SCCN_HyperlinkWindow(string.sub(link,5)); |
||
707 | return; |
||
708 | elseif (string.sub(link, 1 , 3) == "inv") then |
||
709 | InviteByName(string.sub(link,5)); |
||
710 | else |
||
711 | SCCN_Org_SetItemRef(link, text, button); |
||
712 | end |
||
713 | end |
||
714 | |||
715 | function SCCN_ChanRewrite(before, msg, after) |
||
716 | -- maybe doing something special herein later |
||
717 | -- my Idea is to switch from highlighting to hiding or shortening |
||
718 | |||
719 | -- after = string.gsub(after , "]", ""); |
||
720 | return before..after; |
||
721 | end |
||
722 | |||
723 | function SCCN_ClickInvite(before, msg, after) |
||
724 | if( string.len(after) > 0 and string.sub(after,1,1) ~= " " ) then |
||
725 | return before..msg..after; |
||
726 | end |
||
727 | SCCN_INVITEFOUND = true; |
||
728 | return before.."|Hinv:" .. arg2 .. "|h["..msg.."]|h"..after; |
||
729 | end |
||
730 | |||
731 | -------------------------------------------------- |
||
732 | -- Slash Command handlers |
||
733 | -------------------------------------------------- |
||
734 | function SCCN_CMD_TT(msg) |
||
735 | if( UnitName("target") == nil ) then |
||
736 | SCCN_write("No Target for /tt"); |
||
737 | return false; |
||
738 | end |
||
739 | if( msg ~= nil and string.len(msg) > 1 ) then |
||
740 | -- send a whisper to your target |
||
741 | SendChatMessage(msg, "WHISPER", this.language, UnitName("target")); |
||
742 | else |
||
743 | SCCN_write("Use: /tt This is a example!"); |
||
744 | end |
||
745 | end |
||
746 | |||
747 | function solColorChatNicks_SlashCommand(cmd) |
||
748 | -- This function handle the Help and general Option calls |
||
749 | local cmd = string.lower(cmd); |
||
750 | if ( cmd == "hidechanname") then |
||
751 | if SCCN_hidechanname == 0 then |
||
752 | SCCN_hidechanname = 1; |
||
753 | SCCN_write(SCCN_CMDSTATUS[1].."|cff00ff00".." ON"); |
||
754 | else |
||
755 | SCCN_hidechanname = 0; |
||
756 | SCCN_write(SCCN_CMDSTATUS[1].."|cffff0000".." OFF"); |
||
757 | end; |
||
758 | elseif( cmd == "colornicks") then |
||
759 | if SCCN_colornicks == 0 then |
||
760 | SCCN_colornicks = 1; |
||
761 | SCCN_write(SCCN_CMDSTATUS[2].."|cff00ff00".." ON"); |
||
762 | else |
||
763 | SCCN_colornicks = 0; |
||
764 | SCCN_write(SCCN_CMDSTATUS[2].."|cffff0000".." OFF"); |
||
765 | end; |
||
766 | elseif( cmd == "mousescroll") then |
||
767 | if SCCN_mousescroll == 0 then |
||
768 | SCCN_mousescroll = 1; |
||
769 | SCCN_write(SCCN_CMDSTATUS[3].."|cff00ff00".." ON"); |
||
770 | else |
||
771 | SCCN_mousescroll = 0; |
||
772 | SCCN_write(SCCN_CMDSTATUS[3].."|cffff0000".." OFF"); |
||
773 | end; |
||
774 | elseif( cmd == "topeditbox") then |
||
775 | if( CONFAB_VERSION ) then SCCN_write(SCCN_CONFAB); return false; end; |
||
776 | if( SCCN_topeditbox == 1 ) then |
||
777 | SCCN_topeditbox = 0; |
||
778 | SCCN_EditBox(0); |
||
779 | SCCN_write(SCCN_CMDSTATUS[4].."|cffff0000".." OFF"); |
||
780 | else |
||
781 | SCCN_topeditbox = 1; |
||
782 | SCCN_EditBox(1); |
||
783 | SCCN_write(SCCN_CMDSTATUS[4].."|cff00ff00".." ON"); |
||
784 | end |
||
785 | elseif( cmd == "colormap") then |
||
786 | if( SCCN_colormap == 1 ) then |
||
787 | SCCN_colormap = 0; |
||
788 | SCCN_write(SCCN_CMDSTATUS[6].."|cffff0000".." OFF"); |
||
789 | else |
||
790 | SCCN_colormap = 1; |
||
791 | SCCN_write(SCCN_CMDSTATUS[6].."|cff00ff00".." ON"); |
||
792 | SCCN_RefreshIcons(); |
||
793 | end |
||
794 | elseif( strsub(cmd, 1, 9) == "timestamp") then |
||
795 | if(string.len(cmd) > 9) then |
||
796 | -- more then just the toggleswitch |
||
797 | local more = strsub(cmd, 11); |
||
798 | if more then |
||
799 | if(more == "?" or more == "help") then |
||
800 | SCCN_write(SCCN_TS_HELP); |
||
801 | else |
||
802 | SCCN_ts_format = more; |
||
803 | SCCN_write("Timestamp format changed to: "..SCCN_ts_format); |
||
804 | end |
||
805 | else |
||
806 | SCCN_write(SCCN_TS_HELP); |
||
807 | end |
||
808 | else |
||
809 | if SCCN_timestamp == 0 then |
||
810 | SCCN_timestamp = 1; |
||
811 | SCCN_write(SCCN_CMDSTATUS[5].."|cff00ff00".." ON"); |
||
812 | else |
||
813 | SCCN_timestamp = 0; |
||
814 | SCCN_write(SCCN_CMDSTATUS[5].."|cffff0000".." OFF"); |
||
815 | end; |
||
816 | end |
||
817 | elseif( cmd == "selfhighlight") then |
||
818 | if SCCN_selfhighlight == 0 then |
||
819 | SCCN_selfhighlight = 1; |
||
820 | SCCN_write(SCCN_CMDSTATUS[8].."|cff00ff00".." ON"); |
||
821 | else |
||
822 | SCCN_selfhighlight = 0; |
||
823 | SCCN_write(SCCN_CMDSTATUS[8].."|cffff0000".." OFF"); |
||
824 | end; |
||
825 | elseif( cmd == "clickinvite") then |
||
826 | if SCCN_clickinvite == 0 then |
||
827 | SCCN_clickinvite = 1; |
||
828 | SCCN_write(SCCN_CMDSTATUS[9].."|cff00ff00".." ON"); |
||
829 | else |
||
830 | SCCN_clickinvite = 0; |
||
831 | SCCN_write(SCCN_CMDSTATUS[9].."|cffff0000".." OFF"); |
||
832 | end; |
||
833 | elseif( cmd == "editboxkeys") then |
||
834 | if SCCN_editboxkeys == 0 then |
||
835 | SCCN_EditBoxKeysToggle(1); |
||
836 | SCCN_editboxkeys = 1; |
||
837 | SCCN_write(SCCN_CMDSTATUS[10].."|cff00ff00".." ON"); |
||
838 | else |
||
839 | SCCN_EditBoxKeysToggle(0); |
||
840 | SCCN_editboxkeys = 0; |
||
841 | SCCN_write(SCCN_CMDSTATUS[10].."|cffff0000".." OFF"); |
||
842 | end; |
||
843 | elseif( cmd == "selfhighlightmsg") then |
||
844 | if SCCN_selfhighlightmsg == 0 then |
||
845 | SCCN_selfhighlightmsg = 1; |
||
846 | SCCN_write(SCCN_CMDSTATUS[12].."|cff00ff00".." ON"); |
||
847 | else |
||
848 | SCCN_selfhighlightmsg = 0; |
||
849 | SCCN_write(SCCN_CMDSTATUS[12].."|cffff0000".." OFF"); |
||
850 | end; |
||
851 | elseif( cmd == "chatstring") then |
||
852 | if SCCN_chatstring == 0 then |
||
853 | SCCN_chatstring = 1; |
||
854 | SCCN_write(SCCN_CMDSTATUS[11].."|cff00ff00".." ON"); |
||
855 | SCCN_CustomizeChatString(1); |
||
856 | else |
||
857 | SCCN_chatstring = 0; |
||
858 | SCCN_write(SCCN_CMDSTATUS[11].."|cffff0000".." OFF"); |
||
859 | SCCN_CustomizeChatString(0); |
||
860 | end; |
||
861 | elseif( cmd == "hyperlink") then |
||
862 | if SCCN_hyperlinker == 0 then |
||
863 | SCCN_hyperlinker = 1; |
||
864 | SCCN_write(SCCN_CMDSTATUS[7].."|cff00ff00".." ON"); |
||
865 | SCCN_Org_SetItemRef = SetItemRef; |
||
866 | SetItemRef = SCCN_SetItemRef; |
||
867 | else |
||
868 | SCCN_hyperlinker = 0; |
||
869 | SCCN_write(SCCN_CMDSTATUS[7].."|cffff0000".." OFF"); |
||
870 | if( SCCN_Org_SetItemRef ) then |
||
871 | SetItemRef = SCCN_Org_SetItemRef; |
||
872 | end |
||
873 | end; |
||
874 | elseif( cmd == "purge" ) then |
||
875 | solColorChatNicks_PurgeDB(); |
||
876 | elseif( cmd == "hidechatbuttons" ) then |
||
877 | if(SCCN_HideChatButtons == 1) then |
||
878 | SCCN_HideChatButtons = 0; |
||
879 | SCCN_write(SCCN_CMDSTATUS[13].."|cffff0000".." OFF"); |
||
880 | else |
||
881 | SCCN_HideChatButtons = 1; |
||
882 | SCCN_write(SCCN_CMDSTATUS[13].."|cff00ff00".." ON"); |
||
883 | end |
||
884 | elseif( cmd == "killdb" ) then |
||
885 | SCCN_write("Whiped complete Database."); |
||
886 | SCCN_storage = {}; |
||
887 | SCCN_OldStorage = {}; |
||
888 | solColorChatNicks_PurgeDB(); |
||
889 | elseif( cmd == "highlight" ) then |
||
890 | if(SCCN_Highlight == 1) then |
||
891 | SCCN_Highlight = 0; |
||
892 | SCCN_write(SCCN_CMDSTATUS[15].."|cffff0000".." OFF"); |
||
893 | else |
||
894 | SCCN_Highlight = 1; |
||
895 | SCCN_write(SCCN_CMDSTATUS[15].."|cff00ff00".." ON"); |
||
896 | end |
||
897 | elseif( cmd == "autobgmap" ) then |
||
898 | if(SCCN_AutoBGMap == 1) then |
||
899 | SCCN_AutoBGMap = 0; |
||
900 | SCCN_write(SCCN_CMDSTATUS[14].."|cffff0000".." OFF"); |
||
901 | else |
||
902 | SCCN_AutoBGMap = 1; |
||
903 | SCCN_write(SCCN_CMDSTATUS[14].."|cff00ff00".." ON"); |
||
904 | end |
||
905 | elseif( cmd == "autogossipskip" ) then |
||
906 | if(SCCN_AutoGossipSkip == 1) then |
||
907 | SCCN_AutoGossipSkip = 0; |
||
908 | SCCN_write(SCCN_CMDSTATUS[17].."|cffff0000".." OFF"); |
||
909 | else |
||
910 | SCCN_AutoGossipSkip = 1; |
||
911 | SCCN_write(SCCN_CMDSTATUS[17].."|cff00ff00".." ON"); |
||
912 | end |
||
913 | elseif( cmd == "autodismount" ) then |
||
914 | if(SCCN_AutoDismount == 1) then |
||
915 | SCCN_AutoDismount = 0; |
||
916 | SCCN_write(SCCN_CMDSTATUS[18].."|cffff0000".." OFF"); |
||
917 | else |
||
918 | SCCN_AutoDismount = 1; |
||
919 | SCCN_write(SCCN_CMDSTATUS[18].."|cff00ff00".." ON"); |
||
920 | end |
||
921 | elseif( cmd == "shortchanname" ) then |
||
922 | if(SCCN_shortchanname == 1) then |
||
923 | SCCN_shortchanname = 0; |
||
924 | SCCN_write(SCCN_CMDSTATUS[16].."|cffff0000".." OFF"); |
||
925 | else |
||
926 | SCCN_shortchanname = 1; |
||
927 | SCCN_write(SCCN_CMDSTATUS[16].."|cff00ff00".." ON"); |
||
928 | end |
||
929 | elseif( cmd == "about" ) then |
||
930 | SCCN_WELCOMESCREEN:Show(); |
||
931 | elseif( cmd == "status" ) then |
||
932 | SCCN_write("|cff006CFF ---[sOLARiZ Color Chat Nick's Status]---"); |
||
933 | if( SCCN_colornicks == 1) then SCCN_write(SCCN_CMDSTATUS[2].."|cff00ff00".." ON"); |
||
934 | else SCCN_write(SCCN_CMDSTATUS[2].."|cffff0000".." OFF"); end; |
||
935 | if( SCCN_hidechanname == 1) then SCCN_write(SCCN_CMDSTATUS[1].."|cff00ff00".." ON"); |
||
936 | else SCCN_write(SCCN_CMDSTATUS[1].."|cffff0000".." OFF"); end; |
||
937 | if( SCCN_mousescroll == 1) then SCCN_write(SCCN_CMDSTATUS[3].."|cff00ff00".." ON"); |
||
938 | else SCCN_write(SCCN_CMDSTATUS[3].."|cffff0000".." OFF"); end; |
||
939 | if( SCCN_topeditbox == 1) then SCCN_write(SCCN_CMDSTATUS[4].."|cff00ff00".." ON"); |
||
940 | else SCCN_write(SCCN_CMDSTATUS[4].."|cffff0000".." OFF"); end; |
||
941 | if( SCCN_timestamp == 1) then SCCN_write(SCCN_CMDSTATUS[5].."|cff00ff00".." ON"); |
||
942 | else SCCN_write(SCCN_CMDSTATUS[5].."|cffff0000".." OFF"); end; |
||
943 | if( SCCN_colormap == 1) then SCCN_write(SCCN_CMDSTATUS[6].."|cff00ff00".." ON"); |
||
944 | else SCCN_write(SCCN_CMDSTATUS[6].."|cffff0000".." OFF"); end; |
||
945 | if( SCCN_hyperlinker == 1) then SCCN_write(SCCN_CMDSTATUS[7].."|cff00ff00".." ON"); |
||
946 | else SCCN_write(SCCN_CMDSTATUS[7].."|cffff0000".." OFF"); end; |
||
947 | if( SCCN_selfhighlight == 1) then SCCN_write(SCCN_CMDSTATUS[8].."|cff00ff00".." ON"); |
||
948 | else SCCN_write(SCCN_CMDSTATUS[8].."|cffff0000".." OFF"); end; |
||
949 | if( SCCN_clickinvite == 1) then SCCN_write(SCCN_CMDSTATUS[9].."|cff00ff00".." ON"); |
||
950 | else SCCN_write(SCCN_CMDSTATUS[9].."|cffff0000".." OFF"); end; |
||
951 | if( SCCN_editboxkeys == 1) then SCCN_write(SCCN_CMDSTATUS[10].."|cff00ff00".." ON"); |
||
952 | else SCCN_write(SCCN_CMDSTATUS[10].."|cffff0000".." OFF"); end; |
||
953 | if( SCCN_chatstring == 1) then SCCN_write(SCCN_CMDSTATUS[11].."|cff00ff00".." ON"); |
||
954 | else SCCN_write(SCCN_CMDSTATUS[11].."|cffff0000".." OFF"); end; |
||
955 | if( SCCN_selfhighlightmsg == 1) then SCCN_write(SCCN_CMDSTATUS[12].."|cff00ff00".." ON"); |
||
956 | else SCCN_write(SCCN_CMDSTATUS[12].."|cffff0000".." OFF"); end; |
||
957 | if( SCCN_HideChatButtons == 1) then SCCN_write(SCCN_CMDSTATUS[13].."|cff00ff00".." ON"); |
||
958 | else SCCN_write(SCCN_CMDSTATUS[13].."|cffff0000".." OFF"); end; |
||
959 | if( SCCN_AutoBGMap == 1) then SCCN_write(SCCN_CMDSTATUS[14].."|cff00ff00".." ON"); |
||
960 | else SCCN_write(SCCN_CMDSTATUS[14].."|cffff0000".." OFF"); end; |
||
961 | if( SCCN_shortchanname == 1) then SCCN_write(SCCN_CMDSTATUS[16].."|cff00ff00".." ON"); |
||
962 | else SCCN_write(SCCN_CMDSTATUS[16].."|cffff0000".." OFF"); end; |
||
963 | if( SCCN_AutoGossipSkip == 1) then SCCN_write(SCCN_CMDSTATUS[17].."|cff00ff00".." ON"); |
||
964 | else SCCN_write(SCCN_CMDSTATUS[17].."|cffff0000".." OFF"); end; |
||
965 | if( SCCN_AutoDismount == 1) then SCCN_write(SCCN_CMDSTATUS[18].."|cff00ff00".." ON"); |
||
966 | else SCCN_write(SCCN_CMDSTATUS[18].."|cffff0000".." OFF"); end; |
||
967 | else |
||
968 | SCCNConfigForm:Show(); |
||
969 | SCCN_write(SCCN_HELP[1]); |
||
970 | SCCN_write(SCCN_HELP[4]); |
||
971 | SCCN_write(SCCN_HELP[5]); |
||
972 | SCCN_write(SCCN_HELP[8]); |
||
973 | SCCN_write(SCCN_HELP[14]); |
||
974 | SCCN_write(SCCN_HELP[99]); |
||
975 | end |
||
976 | end |
||
977 | |||
978 | ----------------------------------------------- |
||
979 | -- SCCN Config GUI Stuff |
||
980 | ----------------------------------------------- |
||
981 | function SCCN_Config_OnLoad() |
||
982 | -- Setzen der UI Eigenschaften |
||
983 | -- * Version |
||
984 | getglobal("SCCNConfigForm".."ver1".."Label"):SetText(COLOR["SILVER"].."ver."..SCCN_VER); |
||
985 | -- * Help Einträge |
||
986 | getglobal("SCCNShortchanForm".."HLP1".."Label"):SetText(SCCN_HELP[2]); |
||
987 | getglobal("SCCNShortchanForm".."HLP2".."Label"):SetText(SCCN_HELP[19]); |
||
988 | getglobal("SCCNConfigForm".."HLP2".."Label"):SetText(SCCN_HELP[3]); |
||
989 | getglobal("SCCNConfigForm".."HLP3".."Label"):SetText(SCCN_HELP[6]); |
||
990 | getglobal("SCCNConfigForm".."HLP4".."Label"):SetText(SCCN_HELP[7]); |
||
991 | getglobal("SCCNConfigForm".."HLP5".."Label"):SetText(SCCN_HELP[9]); |
||
992 | getglobal("SCCNConfigForm".."HLP6".."Label"):SetText(SCCN_HELP[10]); |
||
993 | |||
994 | getglobal("SCCNConfigForm".."HLP8".."Label"):SetText(SCCN_HELP[12]); |
||
995 | getglobal("SCCNConfigForm".."HLP9".."Label"):SetText(SCCN_HELP[13]); |
||
996 | --getglobal("SCCNConfigForm".."HLP10".."Label"):SetText(SCCN_HELP[15]); |
||
997 | getglobal("SCCNConfigForm".."HLP11".."Label"):SetText(SCCN_HELP[16]); |
||
998 | getglobal("SCCNConfigForm".."HLP12".."Label"):SetText(SCCN_HELP[20]); |
||
999 | getglobal("SCCNConfigForm".."HLP13".."Label"):SetText(SCCN_HELP[21]); |
||
1000 | |||
1001 | getglobal("SCCN_Highlight_Form".."HLP0".."Label"):SetText(SCCN_HELP[17]); |
||
1002 | getglobal("SCCN_Highlight_Form".."HLP1".."Label"):SetText(SCCN_HELP[11]); |
||
1003 | getglobal("SCCN_Highlight_Form".."HLP2".."Label"):SetText(SCCN_HELP[15]); |
||
1004 | |||
1005 | |||
1006 | -- * Button Config auslesen und setzen |
||
1007 | SCCN_Config_SetButtonState(SCCN_hidechanname,1); |
||
1008 | SCCN_Config_SetButtonState(SCCN_shortchanname,7); |
||
1009 | SCCN_Config_SetButtonState(SCCN_colornicks,2); |
||
1010 | SCCN_Config_SetButtonState(SCCN_mousescroll,3); |
||
1011 | SCCN_Config_SetButtonState(SCCN_topeditbox,4); |
||
1012 | SCCN_Config_SetButtonState(SCCN_colormap,5); |
||
1013 | SCCN_Config_SetButtonState(SCCN_hyperlinker,6); |
||
1014 | --SCCN_Config_SetButtonState(SCCN_selfhighlight,7); |
||
1015 | SCCN_Config_SetButtonState(SCCN_clickinvite,8); |
||
1016 | SCCN_Config_SetButtonState(SCCN_editboxkeys,9); |
||
1017 | SCCN_Config_SetButtonState(SCCN_HideChatButtons,11); |
||
1018 | SCCN_Config_SetButtonState(SCCN_AutoGossipSkip,12); |
||
1019 | SCCN_Config_SetButtonState(SCCN_AutoDismount,13); |
||
1020 | |||
1021 | SCCN_Config_SetButtonState(SCCN_Highlight,100); |
||
1022 | SCCN_Config_SetButtonState(SCCN_selfhighlight,101); |
||
1023 | SCCN_Config_SetButtonState(SCCN_selfhighlightmsg,102); |
||
1024 | |||
1025 | end |
||
1026 | |||
1027 | function SCCN_Config_SetButtonState(val,buttonnr) |
||
1028 | if(val == 0 or val == false or val == nil) then |
||
1029 | getglobal( "SCCN_CONF_CHK"..buttonnr ):SetChecked(0); |
||
1030 | else |
||
1031 | getglobal( "SCCN_CONF_CHK"..buttonnr ):SetChecked(1); |
||
1032 | end |
||
1033 | end |
||
1034 | |||
1035 | -------------------------------------------------------- |
||
1036 | -- Misc functions |
||
1037 | -------------------------------------------------------- |
||
1038 | |||
1039 | function SCCN_OnGOSSIP() |
||
1040 | if SCCN_AutoGossipSkip == 1 then |
||
1041 | local GossipOptions = {}; |
||
1042 | local append = "."; |
||
1043 | --SelectGossipOption(1); |
||
1044 | _,GossipOptions[1],_,GossipOptions[2],_,GossipOptions[3],_,GossipOptions[4],_,GossipOptions[5]= GetGossipOptions() |
||
1045 | for i=1, getn(GossipOptions) do |
||
1046 | if (GossipOptions[i] == "taxi") then SCCN_Dismount(); append=", Dismounting." end; |
||
1047 | if (GossipOptions[i] == "battlemaster" or GossipOptions[i] == "taxi" or GossipOptions[i] == "banker" or GossipOptions[i] == "trainer") then |
||
1048 | --SCCN_write("Skip Gossip: '"..GossipOptions[i].."' detected, Autoselecting Option "..i..append); |
||
1049 | SelectGossipOption(i); |
||
1050 | end |
||
1051 | end |
||
1052 | end |
||
1053 | end |
||
1054 | |||
1055 | function SCCN_Dismount() |
||
1056 | if SCCN_AutoDismount == 1 then |
||
1057 | for i=0,15 do |
||
1058 | local buffIndex, untilCancelled = GetPlayerBuff(i, "HELPFUL"); |
||
1059 | if GetPlayerBuffTexture(buffIndex) then |
||
1060 | if string.find(GetPlayerBuffTexture(buffIndex),"Mount") then |
||
1061 | CancelPlayerBuff(buffIndex); |
||
1062 | end |
||
1063 | end |
||
1064 | end |
||
1065 | end |
||
1066 | end |