vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | FILTERFIX_VERSION = "4216a"; |
2 | |||
3 | function FilterFix_OnLoad() |
||
4 | this:RegisterEvent("TRAINER_SHOW"); |
||
5 | this:RegisterEvent("VARIABLES_LOADED"); |
||
6 | |||
7 | SLASH_FILTERFIX1 = "/filterfix"; |
||
8 | SLASH_FILTERFIX2 = "/ff"; |
||
9 | SlashCmdList["FILTERFIX"] = function(msg) |
||
10 | FilterFix_OnSlashCommand(msg); |
||
11 | end |
||
12 | if ( DEFAULT_CHAT_FRAME ) then |
||
13 | DEFAULT_CHAT_FRAME:AddMessage("FilterFix "..FILTERFIX_VERSION.." Loaded! /filterfix or /ff for usage"); |
||
14 | end |
||
15 | end |
||
16 | |||
17 | function FilterFix_OnEvent(event) |
||
18 | |||
19 | if ( event == "VARIABLES_LOADED" ) then |
||
20 | if ( not FilterFixEnable ) then |
||
21 | FilterFixEnable = 1; |
||
22 | end |
||
23 | elseif ( event == "TRAINER_SHOW" and FilterFixEnable == 1 ) then |
||
24 | SetTrainerServiceTypeFilter("unavailable", 0); |
||
25 | elseif ( event == "TRAINER_SHOW" and FilterFixEnable == 0 ) then |
||
26 | SetTrainerServiceTypeFilter("unavailable", 1); |
||
27 | end |
||
28 | end |
||
29 | |||
30 | function FilterFix_OnSlashCommand(msg) |
||
31 | if ( msg == "" ) then |
||
32 | DEFAULT_CHAT_FRAME:AddMessage("Usage: /filterfix [option] or /ff [option]"); |
||
33 | DEFAULT_CHAT_FRAME:AddMessage("Options:\n toggle - toggles FilterFix on/off. Note: this state is used across all characters."); |
||
34 | DEFAULT_CHAT_FRAME:AddMessage(" state - tells FilterFix's current state."); |
||
35 | elseif ( string.find(msg, "toggle") ) then |
||
36 | if ( FilterFixEnable == 0 ) then |
||
37 | FilterFixEnable = 1; |
||
38 | DEFAULT_CHAT_FRAME:AddMessage("FilterFix has been enabled!"); |
||
39 | else |
||
40 | FilterFixEnable = 0; |
||
41 | DEFAULT_CHAT_FRAME:AddMessage("FilterFix has been disabled!"); |
||
42 | end |
||
43 | elseif ( string.find(msg, "state") ) then |
||
44 | if ( FilterFixEnable == 1) then |
||
45 | DEFAULT_CHAT_FRAME:AddMessage("FilterFix is currently enabled."); |
||
46 | else |
||
47 | DEFAULT_CHAT_FRAME:AddMessage("FilterFix if currently disabled."); |
||
48 | end |
||
49 | end |
||
50 | end |