vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | Minimalist = AceAddon:new({ |
2 | name = "Minimalist", |
||
3 | version = "2.9.0", |
||
4 | description = "Useful Tweaks and Automations for a Good Gameplay Experience", |
||
5 | author = "Grennon of Argent Dawn", |
||
6 | email = "jeramy.smith@gmail.com", |
||
7 | releaseDate = "07/18/06", |
||
8 | aceCompatible = "103", |
||
9 | category = "interface", |
||
10 | db = AceDatabase:new("MinimalistDB"), |
||
11 | defaults = Minimalist_Defaults, |
||
12 | }) |
||
13 | |||
14 | function Minimalist:Initialize() |
||
15 | self.GetOpt = function(var) return self.db:get(self.profilePath,var) end |
||
16 | self.SetOpt = function(var,val) self.db:set(self.profilePath,var,val) end |
||
17 | end |
||
18 | |||
19 | function Minimalist:Enable() |
||
20 | SlashCmdList["MINIMALIST"] = MinCmdHandler |
||
21 | SLASH_MINIMALIST1 = "/minimalist" |
||
22 | SLASH_MINIMALIST2 = "/min" |
||
23 | local checkbox, func |
||
24 | for _, checkbox in Minimalist_CheckButtons do |
||
25 | if (self.GetOpt(checkbox.var)) then |
||
26 | func = checkbox.func |
||
27 | func(true) |
||
28 | end |
||
29 | end |
||
30 | for i=1, 4 do |
||
31 | local sf = getglobal("MinimalistSubFrame"..i) |
||
32 | sf:SetBackdropBorderColor(0.4, 0.4, 0.4) |
||
33 | sf:SetBackdropColor(0.15, 0.15, 0.15) |
||
34 | getglobal("MinimalistSubFrame"..i.."Title"):SetText(getglobal("MinimalistFrameTab"..i):GetText()) |
||
35 | end |
||
36 | end |
||
37 | |||
38 | function MinCmdHandler() |
||
39 | Minimalist:Show() |
||
40 | end |
||
41 | |||
42 | function Minimalist:Show() |
||
43 | if (MinimalistFrame:IsVisible()) then return end |
||
44 | local key, value, button, string, checked |
||
45 | for key, value in Minimalist_CheckButtons do |
||
46 | button = getglobal("MinimalistFrame_CheckButton"..value.index) |
||
47 | string = getglobal("MinimalistFrame_CheckButton"..value.index.."Text") |
||
48 | checked = nil |
||
49 | button.disabled = nil |
||
50 | if (value.var) then |
||
51 | if (self.GetOpt(value.var)) then |
||
52 | checked = 1 |
||
53 | else |
||
54 | checked = 0 |
||
55 | end |
||
56 | else |
||
57 | checked = 0 |
||
58 | end |
||
59 | OptionsFrame_EnableCheckBox(button) |
||
60 | button:SetChecked(checked) |
||
61 | string:SetText(key) |
||
62 | button.tooltipText = value.tooltipText |
||
63 | end |
||
64 | MinimalistFrame:Show() |
||
65 | self:TabHandler("MinimalistFrameTab1") |
||
66 | end |
||
67 | |||
68 | function Minimalist:CheckButton_OnClick() |
||
69 | local key, value, button |
||
70 | for key, value in Minimalist_CheckButtons do |
||
71 | if (this:GetName() == "MinimalistFrame_CheckButton"..value.index) then |
||
72 | button = getglobal("MinimalistFrame_CheckButton"..value.index) |
||
73 | if (button:GetChecked()) then |
||
74 | self.SetOpt(value.var, TRUE) |
||
75 | if (value.func) then |
||
76 | local func = value.func |
||
77 | func(true) |
||
78 | end |
||
79 | else |
||
80 | self.SetOpt(value.var, FALSE) |
||
81 | if (value.func) then |
||
82 | local func = value.func |
||
83 | func(false) |
||
84 | end |
||
85 | end |
||
86 | end |
||
87 | end |
||
88 | end |
||
89 | |||
90 | function Minimalist:CheckButton_OnEnter() |
||
91 | if (this.tooltipText ) then |
||
92 | GameTooltip:SetOwner(this, "ANCHOR_LEFT") |
||
93 | GameTooltip:SetText(this.tooltipText, nil, nil, nil, nil, 1) |
||
94 | end |
||
95 | end |
||
96 | |||
97 | -- the following function is for ace hooking nils |
||
98 | function Minimalist:DummyFunc() |
||
99 | end |
||
100 | |||
101 | function Minimalist:TabHandler(tab) |
||
102 | for i=1, 4 do |
||
103 | if (tab == "MinimalistFrameTab"..i) then getglobal("MinimalistSubFrame"..i):Show() |
||
104 | else getglobal("MinimalistSubFrame"..i):Hide() end |
||
105 | end |
||
106 | end |
||
107 | |||
108 | -- merchant handlers |
||
109 | function Minimalist:MHOn() |
||
110 | if (not Minimalist_Merchant_Show) then |
||
111 | self:RegisterEvent("MERCHANT_SHOW", "MinMerchantHandler") |
||
112 | Minimalist_Merchant_Show = true |
||
113 | end |
||
114 | end |
||
115 | |||
116 | function Minimalist:MHOff() |
||
117 | if (self.GetOpt("AUTOSELL") or self.GetOpt("AUTOREPAIR") or not Minimalist_Merchant_Show) then return end |
||
118 | self:UnregisterEvent("MERCHANT_SHOW") |
||
119 | Minimalist_Merchant_Show = false |
||
120 | end |
||
121 | |||
122 | function Minimalist:MinMerchantHandler() |
||
123 | if (self.GetOpt("AUTOSELL")) then self:MinSellJunk() end |
||
124 | if (CanMerchantRepair() and self.GetOpt("AUTOREPAIR")) then self:RepairHandler() end |
||
125 | end |
||
126 | |||
127 | -- gossip handlers |
||
128 | function Minimalist:GHOn() |
||
129 | if (not Minimalist_Gossip_Show) then |
||
130 | self:RegisterEvent("GOSSIP_SHOW", "MinGossipHandler") |
||
131 | Minimalist_Gossip_Show = true |
||
132 | end |
||
133 | end |
||
134 | |||
135 | function Minimalist:GHOff() |
||
136 | if (self.GetOpt("GOSSIPSKIP") or self.GetOpt("QUESTLEVEL") or not Minimalist_Gossip_Show) then return end |
||
137 | self:UnregisterEvent("GOSSIP_SHOW") |
||
138 | Minimalist_Gossip_Show = false |
||
139 | end |
||
140 | |||
141 | function Minimalist:MinGossipHandler() |
||
142 | if (self.GetOpt("QUESTLEVEL")) then self:GossipQuestLevelShow() end |
||
143 | if (self.GetOpt("GOSSIPSKIP")) then self:SkipGossip() end |
||
144 | end |
||
145 | |||
146 | function Minimalist:SkipGossip() |
||
147 | local bwl = "The orb's markings match the brand on your hand." |
||
148 | local mc = "You see large cavernous tunnels" |
||
149 | local t = GetGossipText() |
||
150 | if (t == bwl or (strsub(t,1,31) == mc)) then |
||
151 | SelectGossipOption(1) |
||
152 | return |
||
153 | end |
||
154 | local list = {GetGossipOptions()} |
||
155 | for i = 2,getn(list),2 do |
||
156 | if(list[i]=="taxi" or list[i]=="battlemaster" or list[i]=="banker") then SelectGossipOption(i/2) return end |
||
157 | end |
||
158 | end |
||
159 | |||
160 | -- smart taxi functions |
||
161 | function Minimalist:SmartTaxiOn() |
||
162 | self:RegisterEvent("TAXIMAP_OPENED", "MinDisMount") |
||
163 | end |
||
164 | |||
165 | function Minimalist:SmartTaxiOff() |
||
166 | self:UnregisterEvent("TAXIMAP_OPENED") |
||
167 | end |
||
168 | |||
169 | function Minimalist:MinDisMount() |
||
170 | for i=0,15 do |
||
171 | if GetPlayerBuffTexture(i) then |
||
172 | if string.find(GetPlayerBuffTexture(i),"Mount") then CancelPlayerBuff(i) end |
||
173 | end |
||
174 | end |
||
175 | end |
||
176 | |||
177 | -- hide/unhide default UI toolbar gryphons |
||
178 | function Minimalist:GryphOn() |
||
179 | MainMenuBarLeftEndCap:Hide() |
||
180 | MainMenuBarRightEndCap:Hide() |
||
181 | end |
||
182 | |||
183 | function Minimalist:GryphOff() |
||
184 | MainMenuBarLeftEndCap:Show() |
||
185 | MainMenuBarRightEndCap:Show() |
||
186 | end |
||
187 | |||
188 | -- functions to display quest level |
||
189 | function Minimalist:MinQLOn() |
||
190 | self:Hook("GetQuestLogTitle", "MinGetQuestLogTitle") |
||
191 | self:RegisterEvent("QUEST_GREETING", "MinCheckQuestDetail") |
||
192 | self:GHOn() |
||
193 | end |
||
194 | |||
195 | function Minimalist:MinQLOff() |
||
196 | self:Unhook("GetQuestLogTitle") |
||
197 | self:UnregisterEvent("QUEST_GREETING") |
||
198 | self:GHOff() |
||
199 | end |
||
200 | |||
201 | -- the following MinGetQuestLogTitle is based on the method ct_questlevels uses |
||
202 | function Minimalist:MinGetQuestLogTitle(questIndex) |
||
203 | local questLogTitleText, level, questTag, isHeader, isCollapsed, isComplete = self:CallHook("GetQuestLogTitle", questIndex) |
||
204 | if ( not isHeader and level ) then |
||
205 | if ( questLogTitleText ) then |
||
206 | questLogTitleText = "[" .. level .. "] " .. questLogTitleText |
||
207 | end |
||
208 | end |
||
209 | return questLogTitleText, level, questTag, isHeader, isCollapsed, isComplete |
||
210 | end |
||
211 | |||
212 | -- display quest level in a gossip window, inspired by AutoSelect |
||
213 | function Minimalist:GossipQuestLevelShow() |
||
214 | local buttonindex = 1 |
||
215 | local list, button |
||
216 | if (GetGossipAvailableQuests()) then |
||
217 | list,button = {GetGossipAvailableQuests()} |
||
218 | for i = 2,getn(list),2 do |
||
219 | button = getglobal("GossipTitleButton"..(buttonindex)) |
||
220 | button:SetText(format('[%d] %s',list[i],list[i-1])) |
||
221 | buttonindex = buttonindex + 1 |
||
222 | end |
||
223 | buttonindex = buttonindex + 1 |
||
224 | end |
||
225 | if (GetGossipActiveQuests()) then |
||
226 | list,button = {GetGossipActiveQuests()} |
||
227 | for i = 2,getn(list),2 do |
||
228 | button = getglobal("GossipTitleButton"..(buttonindex)) |
||
229 | button:SetText(format('[%d] %s',list[i],list[i-1])) |
||
230 | buttonindex = buttonindex + 1 |
||
231 | end |
||
232 | end |
||
233 | end |
||
234 | |||
235 | -- display quest level in a quest detail window, based on AutoSelect |
||
236 | function Minimalist:MinCheckQuestDetail() |
||
237 | local nact,navl = GetNumActiveQuests(), GetNumAvailableQuests() |
||
238 | local title,level,button |
||
239 | local o,GetTitle,GetLevel = 0,GetActiveTitle,GetActiveLevel |
||
240 | for i = 1,nact+navl do |
||
241 | if(i==nact+1) then |
||
242 | o,GetTitle,GetLevel = nact,GetAvailableTitle,GetAvailableLevel |
||
243 | end |
||
244 | title,level = GetTitle(i-o), GetLevel(i-o) |
||
245 | button = getglobal("QuestTitleButton"..i) |
||
246 | button:SetText(format('[%d] %s',level,title)) |
||
247 | end |
||
248 | end |
||
249 | |||
250 | |||
251 | -- honor progress bar override this is my own and not based on the other mods out there |
||
252 | function Minimalist:MinHonorFrame_Update(updateAll) |
||
253 | self:CallHook("HonorFrame_Update", updateALL) |
||
254 | local RankProgress = GetPVPRankProgress()*100 |
||
255 | local RankProgress = string.format("%.2f", RankProgress) |
||
256 | local RankProgress = " - "..RankProgress.."%" |
||
257 | local oldranktext = HonorFrameCurrentPVPRank:GetText() |
||
258 | HonorFrameCurrentPVPRank:SetText("("..oldranktext.." "..RankProgress..")") |
||
259 | HonorFrameCurrentPVPTitle:SetPoint("TOP", "HonorFrame", "TOP", - HonorFrameCurrentPVPRank:GetWidth()/2, -83) |
||
260 | end |
||
261 | |||
262 | -- autorepair functions based on KC_AutoRepair by Kaelten |
||
263 | function Minimalist:setAmountString(amt) |
||
264 | local str = "" |
||
265 | local sep = " " |
||
266 | local copper = mod(floor(amt + .5), 100) |
||
267 | local silver = mod(floor(amt/100), 100) |
||
268 | local gold = mod(floor(amt/(100*100)), 100) |
||
269 | if ( gold > 0 ) then str = gold .. " Gold" end |
||
270 | if ( silver > 0 ) then |
||
271 | if ( str ~= "" ) then str = str .. sep end |
||
272 | str = str .. silver .. " Silver" |
||
273 | end |
||
274 | if ( copper > 0 ) then |
||
275 | if ( str ~= "" ) then str = str .. sep end |
||
276 | str = str .. copper .. " Copper" |
||
277 | end |
||
278 | return str |
||
279 | end |
||
280 | |||
281 | function Minimalist:RepairHandler() |
||
282 | local STATUS_COLOR = "|c00FFFF66" |
||
283 | local equipcost = GetRepairAllCost() |
||
284 | local funds = GetMoney() |
||
285 | if (funds < equipcost) then Minimalist_ChatFrame:AddMessage(STATUS_COLOR.."Insufficient Funds to Repair") end |
||
286 | if (funds > equipcost and equipcost > 0) then |
||
287 | Minimalist_ChatFrame:AddMessage(STATUS_COLOR.."Total Repair Costs: "..self:setAmountString(equipcost)) |
||
288 | if (equipcost > 0) then RepairAllItems() end |
||
289 | end |
||
290 | end |
||
291 | |||
292 | -- autosell grey junk, adapted from AutoProfit |
||
293 | function Minimalist:MinSellJunk() |
||
294 | local bag, slot |
||
295 | for bag = 0, 4 do |
||
296 | if GetContainerNumSlots(bag) > 0 then |
||
297 | for slot = 0, GetContainerNumSlots(bag) do |
||
298 | local _, _, _, quality = GetContainerItemInfo(bag, slot) |
||
299 | if (quality == 0 or quality == -1) then |
||
300 | if (self:ProcessLink(GetContainerItemLink(bag, slot))) then |
||
301 | PickupContainerItem(bag, slot) |
||
302 | MerchantItemButton_OnClick("LeftButton") |
||
303 | end |
||
304 | end |
||
305 | end |
||
306 | end |
||
307 | end |
||
308 | end |
||
309 | |||
310 | function Minimalist:ProcessLink(link) |
||
311 | local color |
||
312 | local name |
||
313 | for color, _, name in string.gfind(link, "|c(%x+)|Hitem:(%d+:%d+:%d+:%d+)|h%[(.-)%]|h|r") do |
||
314 | if (color == "ff9d9d9d") then |
||
315 | for i=1,table.getn(Minimalist_AutoSell_Blacklist) do |
||
316 | if (name == Minimalist_AutoSell_Blacklist[i]) then return false end |
||
317 | end |
||
318 | return true |
||
319 | end |
||
320 | return false |
||
321 | end |
||
322 | end |
||
323 | |||
324 | -- Improved Repututation Handlers and Functions |
||
325 | function Minimalist:MinRepOn() |
||
326 | -- the next three lines display the faction text/numbers on the Rep Bar (1.10 replacement for the xpbar) |
||
327 | self:RepBarSet() |
||
328 | self:RegisterEvent("PLAYER_ENTERING_WORLD", "RepBarSet") |
||
329 | self:RegisterEvent("UPDATE_FACTION", "RepChat_Update") |
||
330 | for i=1, 15 do |
||
331 | self:HookScript(getglobal("ReputationBar"..i), "OnEnter", "DummyFunc") |
||
332 | self:HookScript(getglobal("ReputationBar"..i), "OnLeave", "DummyFunc") |
||
333 | end |
||
334 | self:Hook("ReputationFrame_Update", "RepFrame_Update") |
||
335 | end |
||
336 | |||
337 | function Minimalist:MinRepOff() |
||
338 | ReputationWatchBar.cvarLocked = nil |
||
339 | ReputationWatchBar.textLocked = nil |
||
340 | ReputationWatchStatusBarText:Hide() |
||
341 | self:UnregisterEvent("UPDATE_FACTION") |
||
342 | for i=1, 15 do |
||
343 | self:UnhookScript(getglobal("ReputationBar"..i), "OnEnter") |
||
344 | self:UnhookScript(getglobal("ReputationBar"..i), "OnLeave") |
||
345 | end |
||
346 | self:Unhook("ReputationFrame_Update") |
||
347 | self:UnregisterEvent("PLAYER_ENTERING_WORLD") |
||
348 | ReputationFrame_Update() |
||
349 | end |
||
350 | |||
351 | function Minimalist:RepBarSet() |
||
352 | ReputationWatchBar.cvarLocked = 1 |
||
353 | ReputationWatchBar.textLocked = 1 |
||
354 | ReputationWatchStatusBarText:Show() |
||
355 | end |
||
356 | |||
357 | --based on Reputation Mod, displays the raw honor numbers on the reputation frame |
||
358 | function Minimalist:RepFrame_Update() |
||
359 | self:CallHook("ReputationFrame_Update") |
||
360 | local numFactions = GetNumFactions() |
||
361 | local factionOffset = FauxScrollFrame_GetOffset(ReputationListScrollFrame) |
||
362 | local factionIndex, factionStanding, standingID, barValue, isHeader |
||
363 | for i=1, NUM_FACTIONS_DISPLAYED, 1 do |
||
364 | factionIndex = factionOffset + i |
||
365 | if ( factionIndex <= numFactions ) then |
||
366 | _, _, standingID, barMin, barMax, barValue, _, _, isHeader = GetFactionInfo(factionIndex) |
||
367 | if ( not isHeader ) then |
||
368 | factionStanding = getglobal("FACTION_STANDING_LABEL"..standingID) |
||
369 | getglobal("ReputationBar"..i.."FactionStanding"):SetText( factionStanding.." - "..barValue-barMin.."/"..barMax-barMin) |
||
370 | end |
||
371 | end |
||
372 | end |
||
373 | end |
||
374 | |||
375 | -- based on Rep Mod, displays faction until next standing in the combat or main chat window |
||
376 | local MinReps = { } |
||
377 | function Minimalist:RepChat_Update() |
||
378 | self:RepBarSet() |
||
379 | local RepRemains |
||
380 | for factionIndex=1, GetNumFactions(), 1 do |
||
381 | local name, _, standingID, barMin, barMax, barValue, _, _, isHeader, _ = GetFactionInfo(factionIndex) |
||
382 | if ( not isHeader ) then |
||
383 | if (MinReps[name]) then |
||
384 | local difference = barValue - MinReps[name].Value |
||
385 | if (difference > 0 and standingID ~= 8) then |
||
386 | RepRemains = barMax-barValue |
||
387 | Minimalist_ChatFrame:AddMessage(format("%d faction needed until %s with %s.",RepRemains,getglobal("FACTION_STANDING_LABEL"..standingID+1),name), 1.0, 1.0, 0.0) |
||
388 | elseif (difference < 0 and standingID ~= 1) then |
||
389 | difference=abs(difference) |
||
390 | RepRemains = barValue-barMin |
||
391 | Minimalist_ChatFrame:AddMessage(format("%d faction left until %s with %s.",RepRemains,getglobal("FACTION_STANDING_LABEL"..standingID-1),name), 1.0, 1.0, 0.0) |
||
392 | end |
||
393 | MinReps[name].Value = barValue |
||
394 | else |
||
395 | MinReps[name] = { } |
||
396 | MinReps[name].Value = barValue |
||
397 | end |
||
398 | end |
||
399 | end |
||
400 | end |
||
401 | |||
402 | --autorez function based on work from AutoRez mod, pretty simple, huh? |
||
403 | function Minimalist:MinAutoRez() |
||
404 | if (arg1 == "Chained Spirit") then return end |
||
405 | if (GetCorpseRecoveryDelay() ~= 0) then return end |
||
406 | HideUIPanel(StaticPopup1) |
||
407 | AcceptResurrect() |
||
408 | end |
||
409 | |||
410 | -- ignore duel function |
||
411 | function Minimalist:MinAutoDuel() |
||
412 | HideUIPanel(StaticPopup1) |
||
413 | CancelDuel() |
||
414 | end |
||
415 | |||
416 | --minimap functions based on idminimap |
||
417 | function Minimalist:MapLocOn() |
||
418 | MinMapFrame:Show() |
||
419 | MinMapFrame:SetScript("OnUpdate", MinMapLoc) |
||
420 | self:RegisterEvent("ZONE_CHANGED_NEW_AREA", "Fix_Zone") |
||
421 | end |
||
422 | |||
423 | function Minimalist:Fix_Zone() |
||
424 | local x, y = GetPlayerMapPosition("player") |
||
425 | if x == 0 and y == 0 then |
||
426 | SetMapToCurrentZone() |
||
427 | end |
||
428 | end |
||
429 | |||
430 | function Minimalist:MapLocOff() |
||
431 | MinMapLocText:SetText('') |
||
432 | MinMapFrame:SetScript("OnUpdate", nil) |
||
433 | self:UnregisterEvent(" ZONE_CHANGED_NEW_AREA") |
||
434 | if (not self.GetOpt("MAPSCROLL")) then MinMapFrame:Hide() end |
||
435 | end |
||
436 | |||
437 | function MinMapLoc() |
||
438 | local x, y = GetPlayerMapPosition("player") |
||
439 | if x == 0 and y == 0 then |
||
440 | MinMapLocText:SetText('') |
||
441 | else |
||
442 | MinMapLocText:SetText(string.format('%s,%s', floor(x*100), floor(y*100))) |
||
443 | end |
||
444 | end |
||
445 | |||
446 | function Minimalist:MapScrollOn() |
||
447 | MinMapFrame:Show() |
||
448 | MinMapFrame:SetScript("OnMouseWheel", MinMapZoom) |
||
449 | MinMapFrame:EnableMouseWheel(1) |
||
450 | end |
||
451 | |||
452 | function Minimalist:MapScrollOff() |
||
453 | MinMapFrame:SetScript("OnMouseWheel", nil) |
||
454 | MinMapFrame:EnableMouseWheel(FALSE) |
||
455 | if (not self.GetOpt("MAPLOC")) then MinMapFrame:Hide() end |
||
456 | end |
||
457 | |||
458 | function MinMapZoom() |
||
459 | if arg1 < 0 then |
||
460 | if Minimap:GetZoom() ~= 0 then Minimap:SetZoom(Minimap:GetZoom() - 1) end |
||
461 | else |
||
462 | if Minimap:GetZoom() ~= 5 then Minimap:SetZoom(Minimap:GetZoom() + 1) end |
||
463 | end |
||
464 | end |
||
465 | |||
466 | function Minimalist:MinMapHide() |
||
467 | MinimapZoomIn:Hide() |
||
468 | MinimapZoomOut:Hide() |
||
469 | GameTimeFrame:Hide() |
||
470 | MinimapToggleButton:Hide() |
||
471 | MinimapZoneTextButton:Hide() |
||
472 | MinimapBorderTop:Hide() |
||
473 | end |
||
474 | |||
475 | function Minimalist:MinMapShow() |
||
476 | MinimapZoomIn:Show() |
||
477 | MinimapZoomOut:Show() |
||
478 | GameTimeFrame:Show() |
||
479 | MinimapToggleButton:Show() |
||
480 | MinimapZoneTextButton:Show() |
||
481 | MinimapBorderTop:Show() |
||
482 | end |
||
483 | |||
484 | -- chat mods based on Industrial's idChat and Random's ChatScroll |
||
485 | function Minimalist:ChatScrollOn() |
||
486 | for i = 1, 7 do |
||
487 | local cf = getglobal('ChatFrame'..i) |
||
488 | self:HookScript(cf, 'OnMouseWheel', 'ChatScroll') |
||
489 | cf:EnableMouseWheel(1) |
||
490 | end |
||
491 | end |
||
492 | |||
493 | function Minimalist:ChatScrollOff() |
||
494 | for i = 1, 7 do |
||
495 | local cf = getglobal('ChatFrame'..i) |
||
496 | self:UnhookScript(cf, 'OnMouseWheel') |
||
497 | cf:EnableMouseWheel(FALSE) |
||
498 | end |
||
499 | end |
||
500 | |||
501 | function Minimalist:ChatScroll() |
||
502 | self:CallScript(this, 'OnMouseWheel') |
||
503 | if arg1 > 0 then |
||
504 | if IsShiftKeyDown() then this:ScrollToTop() else this:ScrollUp() end |
||
505 | elseif arg1 < 0 then |
||
506 | if IsShiftKeyDown() then this:ScrollToBottom() else this:ScrollDown() end |
||
507 | end |
||
508 | end |
||
509 | |||
510 | function Minimalist:ChatButtonsOn() |
||
511 | if (ChatFrameMenuButton:IsVisible()) then return end |
||
512 | local cf |
||
513 | ChatFrameMenuButton:Show() |
||
514 | for i = 1, 7 do |
||
515 | cf=getglobal('ChatFrame'..i..'UpButton') |
||
516 | self:UnhookScript(cf, 'OnShow') |
||
517 | cf:Show() |
||
518 | cf=getglobal('ChatFrame'..i..'DownButton') |
||
519 | self:UnhookScript(cf, 'OnShow') |
||
520 | cf:Show() |
||
521 | cf=getglobal('ChatFrame'..i..'BottomButton') |
||
522 | self:UnhookScript(cf, 'OnShow') |
||
523 | cf:Show() |
||
524 | end |
||
525 | end |
||
526 | |||
527 | function Minimalist:ChatButtonsOff() |
||
528 | if (not ChatFrameMenuButton:IsVisible()) then return end |
||
529 | local cf |
||
530 | ChatFrameMenuButton:Hide() |
||
531 | for i = 1, 7 do |
||
532 | cf=getglobal('ChatFrame'..i..'UpButton') |
||
533 | cf:Hide() |
||
534 | self:HookScript(cf, 'OnShow', function() this:Hide() end) |
||
535 | cf=getglobal('ChatFrame'..i..'DownButton') |
||
536 | cf:Hide() |
||
537 | self:HookScript(cf, 'OnShow', function() this:Hide() end) |
||
538 | cf=getglobal('ChatFrame'..i..'BottomButton') |
||
539 | cf:Hide() |
||
540 | self:HookScript(cf, 'OnShow', function() this:Hide() end) |
||
541 | end |
||
542 | end |
||
543 | |||
544 | function Minimalist:ChatMoveEditBox() |
||
545 | local eb = VisorEditBox or ChatFrameEditBox |
||
546 | eb:ClearAllPoints() |
||
547 | eb:SetPoint('BOTTOMLEFT', 'ChatFrame1', 'TOPLEFT', -5, 0) |
||
548 | eb:SetPoint('BOTTOMRIGHT', 'ChatFrame1', 'TOPRIGHT', 5, 0) |
||
549 | end |
||
550 | |||
551 | function Minimalist:ChatRestoreEditBox() |
||
552 | local eb = VisorEditBox or ChatFrameEditBox |
||
553 | eb:ClearAllPoints() |
||
554 | eb:SetPoint('TOPLEFT', 'ChatFrame1', 'BOTTOMLEFT', -5, 0) |
||
555 | eb:SetPoint('TOPRIGHT', 'ChatFrame1', 'BOTTOMRIGHT', 5, 0) |
||
556 | end |
||
557 | |||
558 | function Minimalist:ChatArrowsOn() |
||
559 | local eb = VisorEditBox or ChatFrameEditBox |
||
560 | eb:SetAltArrowKeyMode(false) |
||
561 | end |
||
562 | |||
563 | function Minimalist:ChatArrowsOff() |
||
564 | local eb = VisorEditBox or ChatFrameEditBox |
||
565 | eb:SetAltArrowKeyMode(enabled) |
||
566 | end |
||
567 | |||
568 | function Minimalist:ChatParseOn() |
||
569 | if Minimalist_Chat_Parse then return end |
||
570 | for i = 1, 7 do |
||
571 | local cf = getglobal("ChatFrame"..i) |
||
572 | self:Hook(cf, "AddMessage", function(cf, msg, r, g, b, id) |
||
573 | msg = msg or '' |
||
574 | r = r or '' |
||
575 | g = g or '' |
||
576 | b = b or '' |
||
577 | id = id or nil |
||
578 | if (self.GetOpt("CHATTIME")) then msg = date("%H:%M:%S").."| "..msg end |
||
579 | if (self.GetOpt("CHATCLEAN")) then |
||
580 | msg = string.gsub(msg, '%[Guild%]', '(G)') |
||
581 | msg = string.gsub(msg, '%[Party%]', '(P)') |
||
582 | msg = string.gsub(msg, '%[Raid%]', '(R)') |
||
583 | msg = string.gsub(msg, '%[Raid Leader%]', '(R)') |
||
584 | msg = string.gsub(msg, '%[Raid Warning%]', '(!)') |
||
585 | msg = string.gsub(msg, '%[Officer%]', '(O)') |
||
586 | msg = string.gsub(msg, '%[(%d)%..-%]', '(%1)') |
||
587 | end |
||
588 | self:CallHook(cf, "AddMessage", msg, r, g, b, id) |
||
589 | end) |
||
590 | end |
||
591 | Minimalist_Chat_Parse = true |
||
592 | end |
||
593 | |||
594 | function Minimalist:ChatParseOff() |
||
595 | if (self.GetOpt("CHATCLEAN") or self.GetOpt("CHATTIME") or not Minimalist_Chat_Parse) then return end |
||
596 | for i=1,7 do self:Unhook(getglobal('ChatFrame'..i), 'AddMessage') end |
||
597 | Minimalist_Chat_Parse = false |
||
598 | end |
||
599 | |||
600 | Minimalist:RegisterForLoad() |