vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | function SuperMacroFrame_InsertText(text) |
2 | if ( SM_VARS.tabShown=="regular" ) then |
||
3 | SuperMacroFrameText:Insert(text); |
||
4 | elseif ( SM_VARS.tabShown=="super") then |
||
5 | SuperMacroFrameSuperText:Insert(text); |
||
6 | end |
||
7 | end |
||
8 | |||
9 | function SuperMacroFrame_InsertItemText(link) |
||
10 | if ( not link ) then return end; |
||
11 | if ( IsAltKeyDown() ) then |
||
12 | SuperMacroFrame_InsertText(link); |
||
13 | return 1; |
||
14 | end |
||
15 | if ( IsShiftKeyDown() ) then |
||
16 | local item=ItemLinkToName(link); |
||
17 | if ( IsControlKeyDown() ) then |
||
18 | SuperMacroFrame_InsertText('"'..item..'"'); |
||
19 | else |
||
20 | SuperMacroFrame_InsertText(item); |
||
21 | end |
||
22 | return 1; |
||
23 | end |
||
24 | end |
||
25 | |||
26 | -- Alt = [link] |
||
27 | -- Shift = item name |
||
28 | -- Ctrl-shift ="item name" |
||
29 | |||
30 | local oldContainerFrameItemButton_OnClick = ContainerFrameItemButton_OnClick; |
||
31 | function ContainerFrameItemButton_OnClick(button, ignoreShift) |
||
32 | if ( button=="LeftButton" and not ignoreShift and SuperMacroFrame:IsVisible() ) then |
||
33 | local link = GetContainerItemLink(this:GetParent():GetID(), this:GetID()); |
||
34 | if ( not SuperMacroFrame_InsertItemText(link) ) then |
||
35 | |||
36 | oldContainerFrameItemButton_OnClick(button, ignoreShift); |
||
37 | end |
||
38 | return; |
||
39 | end |
||
40 | oldContainerFrameItemButton_OnClick(button, ignoreShift); |
||
41 | end |
||
42 | |||
43 | local oldPaperDollItemSlotButton_OnClick = PaperDollItemSlotButton_OnClick; |
||
44 | function PaperDollItemSlotButton_OnClick(button, ignoreShift) |
||
45 | if ( button=="LeftButton" and not ignoreShift and SuperMacroFrame:IsVisible() ) then |
||
46 | local link = GetInventoryItemLink("player", this:GetID()); |
||
47 | if ( not SuperMacroFrame_InsertItemText(link) ) then |
||
48 | |||
49 | oldPaperDollItemSlotButton_OnClick(button, ignoreShift); |
||
50 | end |
||
51 | return; |
||
52 | end |
||
53 | oldPaperDollItemSlotButton_OnClick(button, ignoreShift); |
||
54 | end |
||
55 | |||
56 | local oldBagSlotButton_OnClick = BagSlotButton_OnClick; |
||
57 | function BagSlotButton_OnClick() |
||
58 | if ( arg1=="LeftButton" and SuperMacroFrame:IsVisible() ) then |
||
59 | this:SetChecked(not this:GetChecked()); |
||
60 | local link = GetInventoryItemLink("player", this:GetID()); |
||
61 | if ( not SuperMacroFrame_InsertItemText(link) ) then |
||
62 | oldBagSlotButton_OnClick(); |
||
63 | end |
||
64 | return; |
||
65 | end |
||
66 | oldBagSlotButton_OnClick(); |
||
67 | end |
||
68 | |||
69 | local oldBagSlotButton_OnShiftClick = BagSlotButton_OnShiftClick; |
||
70 | function BagSlotButton_OnShiftClick() |
||
71 | if ( SuperMacroFrame:IsVisible() ) then |
||
72 | this:SetChecked(not this:GetChecked()); |
||
73 | local link = GetInventoryItemLink("player", this:GetID()); |
||
74 | if ( not SuperMacroFrame_InsertItemText(link) ) then |
||
75 | oldBagSlotButton_OnShiftClick(); |
||
76 | end |
||
77 | return; |
||
78 | end |
||
79 | oldBagSlotButton_OnShiftClick(); |
||
80 | end |
||
81 | |||
82 | --Trade skill and craft frames |
||
83 | -- Alt = [link] |
||
84 | -- Ctrl-Alt = all reagent links |
||
85 | -- Shift = item name |
||
86 | -- Ctrl-shift ="item name" |
||
87 | |||
88 | function SM_TradeSkillSkillButton_OnClick(button) |
||
89 | old_SM_TradeSkillSkillButton_OnClick(button); |
||
90 | local index = TradeSkillFrame.selectedSkill; |
||
91 | local link = GetTradeSkillItemLink(index); |
||
92 | if ( link ) then |
||
93 | if ( SuperMacroFrame:IsVisible() and IsAltKeyDown() ) then |
||
94 | if ( IsControlKeyDown() ) then |
||
95 | for i=1, GetTradeSkillNumReagents(index) do |
||
96 | local link = GetTradeSkillReagentItemLink(index, i); |
||
97 | local reagentName, reagentTexture, reagentCount = GetTradeSkillReagentInfo( index, i); |
||
98 | SuperMacroFrame_InsertText(" "..reagentCount.."x"..link); |
||
99 | end |
||
100 | else |
||
101 | SuperMacroFrame_InsertText(link); |
||
102 | end |
||
103 | return; |
||
104 | end |
||
105 | if ( SuperMacroFrame:IsVisible() and IsShiftKeyDown() ) then |
||
106 | SuperMacroFrame_InsertItemText(link); |
||
107 | end |
||
108 | if ( ChatFrameEditBox:IsVisible() and IsShiftKeyDown() ) then |
||
109 | if ( IsControlKeyDown() ) then |
||
110 | for i=1, GetTradeSkillNumReagents(index) do |
||
111 | local link = GetTradeSkillReagentItemLink(index, i); |
||
112 | local reagentName, reagentTexture, reagentCount = GetTradeSkillReagentInfo( index, i); |
||
113 | ChatFrameEditBox:Insert(" "..reagentCount.."x"..link); |
||
114 | end |
||
115 | else |
||
116 | ChatFrameEditBox:Insert(link); |
||
117 | end |
||
118 | return; |
||
119 | end |
||
120 | end |
||
121 | end |
||
122 | |||
123 | function SM_CraftButton_OnClick(button) |
||
124 | old_SM_CraftButton_OnClick(button); |
||
125 | local index = GetCraftSelectionIndex(); |
||
126 | local link = GetCraftItemLink(index); |
||
127 | --[[ |
||
128 | if ( not link ) then |
||
129 | link = GetCraftInfo(index); |
||
130 | end |
||
131 | --]] |
||
132 | if ( link ) then |
||
133 | if ( SuperMacroFrame:IsVisible() and IsAltKeyDown() ) then |
||
134 | if ( IsControlKeyDown() ) then |
||
135 | for i=1, GetCraftNumReagents(index) do |
||
136 | local link = GetCraftReagentItemLink(index, i); |
||
137 | local reagentName, reagentTexture, reagentCount = GetCraftReagentInfo( index, i); |
||
138 | SuperMacroFrame_InsertText(" "..reagentCount.."x"..link); |
||
139 | end |
||
140 | else |
||
141 | SuperMacroFrame_InsertText(link); |
||
142 | end |
||
143 | return; |
||
144 | end |
||
145 | if ( SuperMacroFrame:IsVisible() and IsShiftKeyDown() ) then |
||
146 | SuperMacroFrame_InsertItemText(link); |
||
147 | end |
||
148 | if ( ChatFrameEditBox:IsVisible() and IsShiftKeyDown() ) then |
||
149 | if ( IsControlKeyDown() ) then |
||
150 | for i=1, GetCraftNumReagents(index) do |
||
151 | local link = GetCraftReagentItemLink(index, i); |
||
152 | local reagentName, reagentTexture, reagentCount = GetCraftReagentInfo( index, i); |
||
153 | ChatFrameEditBox:Insert(" "..reagentCount.."x"..link); |
||
154 | end |
||
155 | else |
||
156 | ChatFrameEditBox:Insert(link); |
||
157 | end |
||
158 | return; |
||
159 | end |
||
160 | end |
||
161 | end |
||
162 | |||
163 | function SM_TradeSkillItem_OnClick() |
||
164 | local old_SM_TradeSkillReagent_OnClick = TradeSkillReagent1:GetScript("OnClick"); |
||
165 | for i=1, 8 do |
||
166 | local item = getglobal("TradeSkillReagent"..i); |
||
167 | item:SetScript("OnClick", function() |
||
168 | if ( SuperMacroFrame:IsVisible()) then |
||
169 | local link = GetTradeSkillReagentItemLink( TradeSkillFrame.selectedSkill, this:GetID()); |
||
170 | if ( link ) then |
||
171 | SuperMacroFrame_InsertItemText(link); |
||
172 | return; |
||
173 | end |
||
174 | end |
||
175 | if ( old_SM_TradeSkillReagent_OnClick ) then |
||
176 | old_SM_TradeSkillReagent_OnClick(); |
||
177 | end |
||
178 | end); |
||
179 | end |
||
180 | local old_SM_TradeSkillSkillIcon_OnClick = TradeSkillSkillIcon:GetScript("OnClick"); |
||
181 | TradeSkillSkillIcon:SetScript("OnClick", function() |
||
182 | local index = TradeSkillFrame.selectedSkill; |
||
183 | local link = GetTradeSkillItemLink(index); |
||
184 | if ( link ) then |
||
185 | if ( SuperMacroFrame:IsVisible() and IsAltKeyDown() ) then |
||
186 | if ( IsControlKeyDown() ) then |
||
187 | for i=1, GetTradeSkillNumReagents(index) do |
||
188 | local link = GetTradeSkillReagentItemLink(index, i); |
||
189 | local reagentName, reagentTexture, reagentCount = GetTradeSkillReagentInfo( index, i); |
||
190 | SuperMacroFrame_InsertText(" "..reagentCount.."x"..link); |
||
191 | end |
||
192 | else |
||
193 | SuperMacroFrame_InsertText(link); |
||
194 | end |
||
195 | return; |
||
196 | end |
||
197 | local inserted; |
||
198 | if ( SuperMacroFrame:IsVisible() and IsShiftKeyDown() ) then |
||
199 | inserted=SuperMacroFrame_InsertItemText(link); |
||
200 | end |
||
201 | if ( ChatFrameEditBox:IsVisible() and IsShiftKeyDown() ) then |
||
202 | if ( IsControlKeyDown() ) then |
||
203 | for i=1, GetTradeSkillNumReagents(index) do |
||
204 | local link = GetTradeSkillReagentItemLink(index, i); |
||
205 | local reagentName, reagentTexture, reagentCount = GetTradeSkillReagentInfo( index, i); |
||
206 | ChatFrameEditBox:Insert(" "..reagentCount.."x"..link); |
||
207 | end |
||
208 | else |
||
209 | ChatFrameEditBox:Insert(link); |
||
210 | end |
||
211 | return; |
||
212 | end |
||
213 | if ( inserted ) then return end; |
||
214 | end |
||
215 | if ( old_SM_TradeSkillSkillIcon_OnClick )then |
||
216 | old_SM_TradeSkillSkillIcon_OnClick(); |
||
217 | end |
||
218 | end); |
||
219 | end |
||
220 | |||
221 | function SM_CraftItem_OnClick() |
||
222 | local old_SM_CraftReagent_OnClick = CraftReagent1:GetScript("OnClick"); |
||
223 | for i=1, 8 do |
||
224 | local item = getglobal("CraftReagent"..i); |
||
225 | item:SetScript("OnClick", function() |
||
226 | if ( SuperMacroFrame:IsVisible() ) then |
||
227 | local link = GetCraftReagentItemLink(GetCraftSelectionIndex(), this:GetID()); |
||
228 | if ( link ) then |
||
229 | SuperMacroFrame_InsertItemText(link); |
||
230 | return; |
||
231 | end |
||
232 | end |
||
233 | if ( old_SM_CraftReagent_OnClick ) then |
||
234 | old_SM_CraftReagent_OnClick(); |
||
235 | end |
||
236 | end); |
||
237 | end |
||
238 | local old_SM_CraftIcon_OnClick = CraftIcon:GetScript("OnClick"); |
||
239 | CraftIcon:SetScript("OnClick", function() |
||
240 | local index = GetCraftSelectionIndex(); |
||
241 | local link = GetCraftItemLink(index); |
||
242 | --[[ |
||
243 | if ( not link ) then |
||
244 | link = GetCraftInfo(index); |
||
245 | end |
||
246 | --]] |
||
247 | if ( link ) then |
||
248 | if ( SuperMacroFrame:IsVisible() and IsAltKeyDown() ) then |
||
249 | if ( IsControlKeyDown() ) then |
||
250 | for i=1, GetCraftNumReagents(index) do |
||
251 | local link = GetCraftReagentItemLink(index, i); |
||
252 | local reagentName, reagentTexture, reagentCount = GetCraftReagentInfo( index, i); |
||
253 | SuperMacroFrame_InsertText(" "..reagentCount.."x"..link); |
||
254 | end |
||
255 | else |
||
256 | SuperMacroFrame_InsertText(link); |
||
257 | end |
||
258 | return; |
||
259 | end |
||
260 | local inserted; |
||
261 | if ( SuperMacroFrame:IsVisible() and IsShiftKeyDown() ) then |
||
262 | inserted=SuperMacroFrame_InsertItemText(link); |
||
263 | end |
||
264 | if ( ChatFrameEditBox:IsVisible() and IsShiftKeyDown() ) then |
||
265 | if ( IsControlKeyDown() ) then |
||
266 | for i=1, GetCraftNumReagents(index) do |
||
267 | local link = GetCraftReagentItemLink(index, i); |
||
268 | local reagentName, reagentTexture, reagentCount = GetCraftReagentInfo( index, i); |
||
269 | ChatFrameEditBox:Insert(" "..reagentCount.."x"..link); |
||
270 | end |
||
271 | else |
||
272 | ChatFrameEditBox:Insert(link); |
||
273 | end |
||
274 | return; |
||
275 | end |
||
276 | if ( inserted ) then return end; |
||
277 | end |
||
278 | if ( old_SM_CraftIcon_OnClick ) then |
||
279 | old_SM_CraftIcon_OnClick(); |
||
280 | end |
||
281 | end); |
||
282 | end |
||
283 | |||
284 | local oldSpellButton_OnClick = SpellButton_OnClick; |
||
285 | function SpellButton_OnClick(drag) |
||
286 | local id = SpellBook_GetSpellID(this:GetID()); |
||
287 | if ( id > MAX_SPELLS ) then |
||
288 | return; |
||
289 | end |
||
290 | if ( IsShiftKeyDown() and SuperMacroFrame:IsVisible() ) then |
||
291 | local spellName, subSpellName = GetSpellName(id, SpellBookFrame.bookType); |
||
292 | if ( spellName and not IsSpellPassive(id, SpellBookFrame.bookType) ) then |
||
293 | if ( subSpellName and (strlen(subSpellName) > 0) ) then |
||
294 | spellName=spellName.."("..subSpellName..")"; |
||
295 | end |
||
296 | if ( IsControlKeyDown() ) then |
||
297 | SuperMacroFrame_InsertText('"'..spellName..'"'); |
||
298 | elseif ( IsAltKeyDown() ) then |
||
299 | SuperMacroFrame_InsertText(spellName); |
||
300 | else |
||
301 | SuperMacroFrame_InsertText("\n"..TEXT(SLASH_CAST1).." "..spellName); |
||
302 | end |
||
303 | end |
||
304 | this:SetChecked(not this:GetChecked()); |
||
305 | return; |
||
306 | end |
||
307 | oldSpellButton_OnClick(drag); |
||
308 | end |