vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | -- ----------------------------------------------------------------- |
2 | -- File: AllInOneBank_Config.lua |
||
3 | -- |
||
4 | -- Purpose: Functions for AIOB Config window and options. |
||
5 | -- |
||
6 | -- Author: Ramble |
||
7 | -- |
||
8 | -- Credits: |
||
9 | -- Starven, for MyInventory |
||
10 | -- Kaitlin, for BankItems |
||
11 | -- Sarf, for the original concept of AllInOneInventory |
||
12 | -- ----------------------------------------------------------------- |
||
13 | |||
14 | -- == Slash Handlers == |
||
15 | -- ChatCommandHandler: Slash commands are in here |
||
16 | function AIOB_ChatCommandHandler(msg) |
||
17 | |||
18 | if ( ( not msg ) or ( strlen(msg) <= 0 ) ) then |
||
19 | AIOB_Print(AIOB_CHAT_COMMAND_USAGE); |
||
20 | AIOBConfigFrame:Show(); |
||
21 | return; |
||
22 | end |
||
23 | |||
24 | local commandName, params = AIOB_Extract_NextParameter(msg); |
||
25 | |||
26 | if ( ( commandName ) and ( strlen(commandName) > 0 ) ) then |
||
27 | commandName = string.lower(commandName); |
||
28 | else |
||
29 | commandName = ""; |
||
30 | end |
||
31 | |||
32 | if ( (strfind(commandName, "show")) or (strfind(commandName, "toggle")) ) then |
||
33 | ToggleAIOBFrame(); |
||
34 | elseif ( (strfind(commandName, "freeze")) or (strfind(commandName, "unfreeze")) ) then |
||
35 | AIOB_Toggle_Option("Freeze"); |
||
36 | elseif ( (strfind(commandName, "replacebank")) or (strfind(commandName, "replace"))) then |
||
37 | AIOB_Toggle_Option("ReplaceBank"); |
||
38 | elseif strfind(commandName, "highlightbags") then |
||
39 | AIOB_Toggle_Option("HighlightBags"); |
||
40 | elseif strfind(commandName, "highlightitems") then |
||
41 | AIOB_Toggle_Option("HighlightItems"); |
||
42 | elseif strfind(commandName, "graphic") then |
||
43 | AIOB_Toggle_Option("Graphics"); |
||
44 | elseif strfind(commandName, "back") then |
||
45 | AIOB_Toggle_Option("Background"); |
||
46 | elseif strfind(commandName, "player") then |
||
47 | AIOB_Toggle_Option("ShowPlayers"); |
||
48 | elseif ( (strfind(commandName, "cols")) or (strfind(commandName, "column")) ) then |
||
49 | cols, params = AIOB_Extract_NextParameter(params); |
||
50 | cols = tonumber(cols); |
||
51 | AIOBFrame_SetColumns(cols); |
||
52 | elseif ( (strfind(commandName, "reset")) or (strfind(commandName, "init")) ) then |
||
53 | AIOBProfile[UnitName("player")] = nil; |
||
54 | AIOB_InitializeProfile(); |
||
55 | elseif (strfind(commandName, "config")) then |
||
56 | AIOBConfigFrame:Show(); |
||
57 | else |
||
58 | AIOB_Print(AIOB_CHAT_COMMAND_USAGE); |
||
59 | return; |
||
60 | end |
||
61 | end |
||
62 | -- Extract_NextParameter: Used for Slash command handler |
||
63 | function AIOB_Extract_NextParameter(msg) |
||
64 | local params = msg; |
||
65 | local command = params; |
||
66 | local index = strfind(command, " "); |
||
67 | if ( index ) then |
||
68 | command = strsub(command, 1, index-1); |
||
69 | params = strsub(params, index+1); |
||
70 | else |
||
71 | params = ""; |
||
72 | end |
||
73 | return command, params; |
||
74 | end |
||
75 | -- == End Slash Handlers == |
||
76 | |||
77 | |||
78 | --All Functions that deal directly with AIOBConfig Frame items should go here |
||
79 | function AIOBConfig_OnShow() |
||
80 | AIOBConfigReplaceCheck:SetChecked(AIOBReplaceBank); |
||
81 | AIOBConfigFreezeCheck:SetChecked(AIOBFreeze); |
||
82 | AIOBConfigColumns:SetText(AIOBColumns); |
||
83 | AIOBConfigHighlightItemsCheck:SetChecked(AIOBHighlightItems); |
||
84 | AIOBConfigHighlightBagsCheck:SetChecked(AIOBHighlightBags); |
||
85 | AIOBConfigHighlightItemsCheck:SetChecked(AIOBHighlightItems); |
||
86 | AIOBConfigGraphicsCheck:SetChecked(AIOBGraphics); |
||
87 | AIOBConfigBackgroundCheck:SetChecked(AIOBBackground); |
||
88 | end |
||
89 | function AIOBConfig_OnHide() |
||
90 | if AIOBConfigReplaceCheck:GetChecked() then |
||
91 | AIOB_Toggle_Option("ReplaceBank", 1,1); |
||
92 | else |
||
93 | AIOB_Toggle_Option("ReplaceBank", 0,1); |
||
94 | end |
||
95 | if AIOBConfigFreezeCheck:GetChecked() then |
||
96 | AIOB_Toggle_Option("Freeze", 1,1); |
||
97 | else |
||
98 | AIOB_Toggle_Option("Freeze", 0,1); |
||
99 | end |
||
100 | local cols = tonumber(AIOBConfigColumns:GetText()); |
||
101 | if cols and cols > 5 and cols < 19 then |
||
102 | AIOBFrame_SetColumns(cols); |
||
103 | end |
||
104 | if AIOBConfigHighlightItemsCheck:GetChecked() then |
||
105 | AIOB_Toggle_Option("HighlightItems",1,1); |
||
106 | else |
||
107 | AIOB_Toggle_Option("HighlightItems",0,1); |
||
108 | end |
||
109 | if AIOBConfigHighlightBagsCheck:GetChecked() then |
||
110 | AIOB_Toggle_Option("HighlightBags",1,1); |
||
111 | else |
||
112 | AIOB_Toggle_Option("HighlightBags",0,1); |
||
113 | end |
||
114 | if AIOBConfigGraphicsCheck:GetChecked() then |
||
115 | AIOB_Toggle_Option("Graphics",1,1); |
||
116 | else |
||
117 | AIOB_Toggle_Option("Graphics",0,1); |
||
118 | end |
||
119 | if AIOBConfigBackgroundCheck:GetChecked() then |
||
120 | AIOB_Toggle_Option("Background",1,1); |
||
121 | else |
||
122 | AIOB_Toggle_Option("Background",0,1); |
||
123 | end |
||
124 | end |
||
125 | |||
126 | |||
127 | -- END AIOBConfig Frame stuff |
||
128 | |||
129 |