vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | GuildAdsShiftClick = { |
2 | |||
3 | metaInformations = { |
||
4 | name = "GuildAdsShiftClick", |
||
5 | guildadsCompatible = 100, |
||
6 | }; |
||
7 | |||
8 | -- hook |
||
9 | callHook = {}; |
||
10 | hookName = {}; |
||
11 | |||
12 | hook = function(id, hook, new) |
||
13 | if getglobal(hook) then |
||
14 | GuildAdsShiftClick.hookName[id] = hook; |
||
15 | GuildAdsShiftClick.callHook[id] = getglobal(hook); |
||
16 | setglobal(hook, new); |
||
17 | end |
||
18 | end; |
||
19 | |||
20 | unhook = function(id) |
||
21 | if id and GuildAdsShiftClick.hookName[id] then |
||
22 | setglobal(GuildAdsShiftClick.hookName[id], GuildAdsShiftClick.callHook[id]); |
||
23 | GuildAdsShiftClick.hookName[id] = nil; |
||
24 | GuildAdsShiftClick.callHook[id] = nil; |
||
25 | end |
||
26 | end; |
||
27 | |||
28 | -- onInit |
||
29 | onInit = function() |
||
30 | -- Patch in inventory OnClick |
||
31 | GuildAdsShiftClick.hook("inventory", "ContainerFrameItemButton_OnClick", GuildAdsShiftClick.inventoryOnClick); |
||
32 | |||
33 | -- Patch in chat link |
||
34 | GuildAdsShiftClick.hook("chatFrameHyperlink", "ChatFrame_OnHyperlinkShow", GuildAdsShiftClick.chatFrameOnHyperlinkShow); |
||
35 | |||
36 | -- Patch in bank OnClick |
||
37 | GuildAdsShiftClick.hook("bank", "BankFrameItemButtonGeneric_OnClick", GuildAdsShiftClick.bankOnClick); |
||
38 | |||
39 | -- Patch in paperdoll |
||
40 | GuildAdsShiftClick.hook("paperdoll", "PaperDollItemSlotButton_OnClick", GuildAdsShiftClick.paperdollOnClick) |
||
41 | |||
42 | -- Patch in merchant OnClick |
||
43 | GuildAdsShiftClick.hook("merchant", "MerchantItemButton_OnClick", GuildAdsShiftClick.merchantOnClick); |
||
44 | |||
45 | -- Patch in quest item OnClick |
||
46 | -- GuildAdsShiftClick.hook("questProgress", "QuestItem_OnClick", GuildAdsShiftClick.quest.progressOnClick); |
||
47 | -- GuildAdsShiftClick.hook("questReward", "QuestRewardItem_OnClick", GuildAdsShiftClick.quest.rewardOnClick); |
||
48 | |||
49 | -- Patch in inspect : on parse of the LUA file |
||
50 | |||
51 | -- Patch in auction house : on parse of the LUA file |
||
52 | |||
53 | -- Patch in trade skill : on parse of the LUA file |
||
54 | |||
55 | -- Patch in craft : on parse of the LUA file |
||
56 | |||
57 | -- Patch in AllInOneInventory item OnClick |
||
58 | GuildAdsShiftClick.hook("allInOneInventory", "AllInOneInventoryFrameItemButton_OnClick", GuildAdsShiftClick.allInOneInventoryOnClick) |
||
59 | |||
60 | -- Patch in MyInventory item OnlLick |
||
61 | GuildAdsShiftClick.hook("myInventory", "MyInventoryFrameItemButton_OnClick", GuildAdsShiftClick.myInventoryOnClick); |
||
62 | |||
63 | -- Patch in EngInventory |
||
64 | GuildAdsShiftClick.hook("engInventory", "EngInventory_ItemButton_OnClick", GuildAdsShiftClick.engInventoryOnClick); |
||
65 | |||
66 | -- Patch in MyBank |
||
67 | GuildAdsShiftClick.hook("myBank", "MyBankFrameItemButton_OnClick", GuildAdsShiftClick.myBankOnClick); |
||
68 | |||
69 | -- Patch in BankItems OnClick |
||
70 | GuildAdsShiftClick.hook("bankItemsItem", "BankItems_Button_OnClick", GuildAdsShiftClick.bankItems.itemOnClick); |
||
71 | GuildAdsShiftClick.hook("bankItemsBag", "BankItems_BagItem_OnClick", GuildAdsShiftClick.bankItems.bagOnClick); |
||
72 | |||
73 | -- Patch in BankStatement |
||
74 | GuildAdsShiftClick.hook("bankStatementItem", "BankStatementItemButton_OnClick", GuildAdsShiftClick.bankStatement.itemOnClick); |
||
75 | GuildAdsShiftClick.hook("bankStatementBag", "BankStatementContainerFrameItemButton_OnClick", GuildAdsShiftClick.bankStatement.bagOnClick); |
||
76 | |||
77 | -- Patch in ItemsMatrix item OnClick |
||
78 | GuildAdsShiftClick.hook("itemMatrix", "ItemsMatrixItemButton_OnClick", GuildAdsShiftClick.itemMatrixOnClick); |
||
79 | |||
80 | -- Patch in LootLink item OnClick |
||
81 | GuildAdsShiftClick.hook("lootLink", "LootLinkItemButton_OnClick", GuildAdsShiftClick.lootLink.onClick); |
||
82 | end; |
||
83 | |||
84 | -- hook this click ? |
||
85 | hookTest = function(button) |
||
86 | return GuildAdsFrame:IsVisible() and IsShiftKeyDown() and not IsControlKeyDown() and not IsAltKeyDown(); |
||
87 | end; |
||
88 | |||
89 | -- set current item in GuildAds window |
||
90 | setItem = function(button, link, texture, itemCount, text) |
||
91 | if(link) then |
||
92 | GuildAds_MyAdsEdit(nil); |
||
93 | GuildAds_setEditItem(text, link, texture, itemCount); |
||
94 | else |
||
95 | GuildAdsShiftClick.debug("Clicked on empty"); |
||
96 | end |
||
97 | end; |
||
98 | |||
99 | -- Inventory |
||
100 | inventoryOnClick = function(button, ignoreShift) |
||
101 | if(not ignoreShift and GuildAdsShiftClick.hookTest(button)) then |
||
102 | local texture, itemCount = GetContainerItemInfo(this:GetParent():GetID(), this:GetID()); |
||
103 | local link = GetContainerItemLink(this:GetParent():GetID(), this:GetID()); |
||
104 | GuildAdsShiftClick.setItem(button, link, texture, itemCount); |
||
105 | else |
||
106 | GuildAdsShiftClick.callHook.inventory(button, ignoreShift); |
||
107 | end |
||
108 | end; |
||
109 | |||
110 | -- Link into chatframe |
||
111 | chatFrameOnHyperlinkShow = function(link, text, button) |
||
112 | if (GuildAdsShiftClick.hookTest(button)) then |
||
113 | if string.sub(link, 1, 5) == "item:" then |
||
114 | local info = GAS_GetItemInfo(link); |
||
115 | GuildAdsShiftClick.setItem(button, text, info.texture, 1); |
||
116 | else |
||
117 | GuildAdsShiftClick.callHook.chatFrameHyperlink(link, text, button); |
||
118 | end |
||
119 | else |
||
120 | GuildAdsShiftClick.callHook.chatFrameHyperlink(link, text, button); |
||
121 | end |
||
122 | end; |
||
123 | |||
124 | -- Bank |
||
125 | bankOnClick = function(button) |
||
126 | if(GuildAdsShiftClick.hookTest(button)) then |
||
127 | local texture, itemCount = GetContainerItemInfo(BANK_CONTAINER, this:GetID()); |
||
128 | local link = GetContainerItemLink(BANK_CONTAINER, this:GetID()); |
||
129 | GuildAdsShiftClick.setItem(button, link, texture, itemCount); |
||
130 | else |
||
131 | GuildAdsShiftClick.callHook.bank(button); |
||
132 | end |
||
133 | end; |
||
134 | |||
135 | -- Paperdoll |
||
136 | paperdollOnClick = function(button, ignoreModifiers) |
||
137 | if (GuildAdsShiftClick.hookTest(button) and not ignoreModifiers) then |
||
138 | local texture = GetInventoryItemTexture("player", this:GetID()); |
||
139 | local count; |
||
140 | if texture then |
||
141 | count = GetInventoryItemCount("player", this:GetID()); |
||
142 | end |
||
143 | local link = GetInventoryItemLink("player", this:GetID()); |
||
144 | GuildAdsShiftClick.setItem(button, link, texture, count); |
||
145 | else |
||
146 | GuildAdsShiftClick.callHook.paperdoll(button, ignoreModifiers); |
||
147 | end |
||
148 | end; |
||
149 | |||
150 | -- Merchant |
||
151 | merchantOnClick = function(button, ignoreModifiers) |
||
152 | if button=="LeftButton" and not ignoreModifiers and GuildAdsShiftClick.hookTest(button) then |
||
153 | local name, texture, price, quantity, numAvailable, isUsable = GetMerchantItemInfo(this:GetID()); |
||
154 | local link = GetMerchantItemLink(this:GetID()); |
||
155 | if (quantity == 1) then |
||
156 | quantity = nil; |
||
157 | end |
||
158 | GuildAdsShiftClick.setItem(button, link, texture, quantity); |
||
159 | else |
||
160 | GuildAdsShiftClick.callHook.merchant(button, ignoreModifiers); |
||
161 | end |
||
162 | end; |
||
163 | |||
164 | -- Quest |
||
165 | quest = { |
||
166 | |||
167 | itemOnClick = function(hookToCall, button, ignoreModifiers) |
||
168 | if GuildAdsShiftClick.hookTest(button) and this.rewardType ~= "spell" then |
||
169 | local name, texture, numItems, quality, isUsable = GetQuestItemInfo(this.type, this:GetID()); |
||
170 | local link = GetQuestItemLink(this.type, this:GetID()); |
||
171 | GuildAdsShiftClick.setItem(button, link, texture, nil); |
||
172 | else |
||
173 | hookToCall(button, ignoreModifiers); |
||
174 | end |
||
175 | end; |
||
176 | |||
177 | progressOnClick = function(button, ignoreModifiers) |
||
178 | GuildAdsShiftClick.quest.itemOnClick(GuildAdsShiftClick.callHook.questProgress); |
||
179 | end; |
||
180 | |||
181 | rewardOnClick = function(button, ignoreModifiers) |
||
182 | GuildAdsShiftClick.quest.itemOnClick(GuildAdsShiftClick.callHook.questReward); |
||
183 | end; |
||
184 | |||
185 | }; |
||
186 | |||
187 | -- Inspect |
||
188 | inspect = { |
||
189 | |||
190 | notHook = true; |
||
191 | |||
192 | loadUI = function() |
||
193 | GuildAdsShiftClick.callHook.inspectLoadUI(); |
||
194 | |||
195 | if GuildAdsShiftClick.inspect.notHook then |
||
196 | GuildAdsShiftClick.inspect.notHook = nil; |
||
197 | GuildAdsShiftClick.hook("inspect", "InspectPaperDollItemSlotButton_OnClick", GuildAdsShiftClick.inspect.onClick); |
||
198 | end |
||
199 | end; |
||
200 | |||
201 | onClick = function(button) |
||
202 | if GuildAdsShiftClick.hookTest(button) then |
||
203 | local link = GetInventoryItemLink(InspectFrame.unit, this:GetID()); |
||
204 | local texture = GetInventoryItemTexture(InspectFrame.unit, this:GetID()); |
||
205 | local count; |
||
206 | if ( textureName ) then |
||
207 | count = GetInventoryItemCount(unit, button:GetID()); |
||
208 | end |
||
209 | GuildAdsShiftClick.setItem(button, link, texture, count); |
||
210 | else |
||
211 | GuildAdsShiftClick.callHook.inspect(button); |
||
212 | end |
||
213 | end; |
||
214 | |||
215 | }; |
||
216 | |||
217 | -- Auction House |
||
218 | auctionHouse = { |
||
219 | |||
220 | notHook = true; |
||
221 | |||
222 | loadUI = function() |
||
223 | GuildAdsShiftClick.callHook.auctionHouseLoadUI(); |
||
224 | |||
225 | if GuildAdsShiftClick.auctionHouse.notHook then |
||
226 | GuildAdsShiftClick.auctionHouse.notHook = nil; |
||
227 | |||
228 | -- Patch in auction OnClick |
||
229 | GuildAdsShiftClick.callHook.auctionHouseItemOnClick = BrowseButton1Item:GetScript("OnClick"); |
||
230 | GuildAdsShiftClick.callHook.auctionHouseLineOnClick = BrowseButton1:GetScript("OnClick"); |
||
231 | for i=1,9 do |
||
232 | local button = getglobal("BrowseButton"..i.."Item"); |
||
233 | if button then |
||
234 | button:SetScript("OnClick", GuildAdsShiftClick.auctionHouse.itemOnClick); |
||
235 | end; |
||
236 | button = getglobal("BrowseButton"..i); |
||
237 | if button then |
||
238 | button:SetScript("OnClick", GuildAdsShiftClick.auctionHouse.lineOnClick); |
||
239 | end; |
||
240 | end |
||
241 | |||
242 | end |
||
243 | end; |
||
244 | |||
245 | itemOnClick = function(button) |
||
246 | if(GuildAdsShiftClick.hookTest(button)) then |
||
247 | local index = this:GetParent():GetID()+FauxScrollFrame_GetOffset(BrowseScrollFrame); |
||
248 | local name, texture, itemCount = GetAuctionItemInfo("list", index); |
||
249 | local link = GetAuctionItemLink("list", index); |
||
250 | GuildAdsShiftClick.setItem(button, link, texture, itemCount); |
||
251 | else |
||
252 | GuildAdsShiftClick.callHook.auctionHouseItemOnClick(button); |
||
253 | end |
||
254 | end; |
||
255 | |||
256 | lineOnClick = function(button) |
||
257 | if(GuildAdsShiftClick.hookTest(button)) then |
||
258 | local index = this:GetID()+FauxScrollFrame_GetOffset(BrowseScrollFrame); |
||
259 | local name, texture, itemCount = GetAuctionItemInfo("list", index); |
||
260 | local link = GetAuctionItemLink("list", index); |
||
261 | GuildAdsShiftClick.setItem(button, link, texture, itemCount); |
||
262 | else |
||
263 | GuildAdsShiftClick.callHook.auctionHouseLineOnClick(button); |
||
264 | end |
||
265 | end; |
||
266 | |||
267 | }; |
||
268 | |||
269 | -- Tradeskill |
||
270 | tradeSkill = { |
||
271 | |||
272 | notHook = true; |
||
273 | |||
274 | loadUI = function() |
||
275 | GuildAdsShiftClick.callHook.tradeSkillLoadUI(); |
||
276 | |||
277 | if GuildAdsShiftClick.tradeSkill.notHook then |
||
278 | GuildAdsShiftClick.tradeSkill.notHook = nil; |
||
279 | |||
280 | -- TradeSkillSkillIcon |
||
281 | GuildAdsShiftClick.callHook.tradeSkillSkillOnClick = TradeSkillSkillIcon:GetScript("OnClick"); |
||
282 | TradeSkillSkillIcon:SetScript("OnClick", GuildAdsShiftClick.tradeSkill.SkillOnClick); |
||
283 | |||
284 | -- TradeSkillReagent1 .. TradeSkillReagent8 |
||
285 | GuildAdsShiftClick.callHook.tradeSkillReagentOnClick = TradeSkillReagent1:GetScript("OnClick"); |
||
286 | for i=1,TRADE_SKILLS_DISPLAYED do |
||
287 | local button = getglobal("TradeSkillReagent"..i); |
||
288 | if button then |
||
289 | button:SetScript("OnClick", GuildAdsShiftClick.tradeSkill.ReagentOnClick); |
||
290 | end; |
||
291 | end |
||
292 | |||
293 | end |
||
294 | end; |
||
295 | |||
296 | SkillOnClick = function(button) |
||
297 | if(GuildAdsShiftClick.hookTest(button)) then |
||
298 | local id = TradeSkillFrame.selectedSkill; |
||
299 | local link = GetTradeSkillItemLink(id); |
||
300 | local texture = GetTradeSkillIcon(id); |
||
301 | local minMade, maxMade = GetTradeSkillNumMade(id); |
||
302 | GuildAdsShiftClick.setItem(button, link, texture, minMade); |
||
303 | else |
||
304 | GuildAdsShiftClick.callHook.tradeSkillSkillOnClick(button); |
||
305 | end; |
||
306 | end; |
||
307 | |||
308 | ReagentOnClick = function(button) |
||
309 | if(GuildAdsShiftClick.hookTest(button)) then |
||
310 | local reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(TradeSkillFrame.selectedSkill, this:GetID()); |
||
311 | local link = GetTradeSkillReagentItemLink(TradeSkillFrame.selectedSkill, this:GetID()); |
||
312 | GuildAdsShiftClick.setItem(button, link, reagentTexture, reagentCount); |
||
313 | else |
||
314 | GuildAdsShiftClick.callHook.tradeSkillReagentOnClick(button); |
||
315 | end; |
||
316 | end; |
||
317 | |||
318 | }; |
||
319 | |||
320 | -- Craft |
||
321 | craft = { |
||
322 | |||
323 | notHook = true; |
||
324 | |||
325 | loadUI = function() |
||
326 | |||
327 | -- call old function |
||
328 | GuildAdsShiftClick.callHook.craftLoadUI(); |
||
329 | |||
330 | if GuildAdsShiftClick.craft.notHook then |
||
331 | GuildAdsShiftClick.craft.notHook = nil; |
||
332 | |||
333 | -- CraftIcon |
||
334 | GuildAdsShiftClick.callHook.craftIconOnClick = CraftIcon:GetScript("OnClick"); |
||
335 | CraftIcon:SetScript("OnClick", GuildAdsShiftClick.craft.iconOnClick); |
||
336 | |||
337 | -- CraftReagent1 .. CraftReagent8 |
||
338 | GuildAdsShiftClick.callHook.reagentIconOnClick = CraftReagent1:GetScript("OnClick"); |
||
339 | for i=1,CRAFTS_DISPLAYED do |
||
340 | local button = getglobal("CraftReagent"..i); |
||
341 | if button then |
||
342 | button:SetScript("OnClick", GuildAdsShiftClick.craft.reagentOnClick); |
||
343 | end; |
||
344 | end |
||
345 | end |
||
346 | end; |
||
347 | |||
348 | iconOnClick = function(button) |
||
349 | if GuildAdsShiftClick.hookTest(button) then |
||
350 | local id = GetCraftSelectionIndex(); |
||
351 | local craftName, craftSubSpellName, craftType, numAvailable, isExpanded = GetCraftInfo(id); |
||
352 | local texture = GetCraftIcon(id); |
||
353 | local craftDesc = GetCraftDescription(id); |
||
354 | GuildAdsShiftClick.setItem(button, GAS_PackLink("ffffffff", nil, craftName), texture, nil, craftDesc); |
||
355 | else |
||
356 | GuildAdsShiftClick.callHook.craftIconOnClick(button); |
||
357 | end |
||
358 | end; |
||
359 | |||
360 | reagentOnClick = function(button) |
||
361 | if GuildAdsShiftClick.hookTest(button) then |
||
362 | local id = GetCraftSelectionIndex(); |
||
363 | local link = GetCraftReagentItemLink(id, this:GetID()); |
||
364 | local reagentName, reagentTexture, reagentCount, playerReagentCount = GetCraftReagentInfo(id, this:GetID()); |
||
365 | GuildAdsShiftClick.setItem(button, link, reagentTexture, reagentCount); |
||
366 | else |
||
367 | GuildAdsShiftClick.callHook.reagentIconOnClick(button); |
||
368 | end |
||
369 | end; |
||
370 | |||
371 | }; |
||
372 | |||
373 | -- AllInOneInventory |
||
374 | allInOneInventoryOnClick = function(button, ignoreShift) |
||
375 | if(not ignoreShift and GuildAdsShiftClick.hookTest(button)) then |
||
376 | local bag, slot = AllInOneInventory_GetIdAsBagSlot(this:GetID()); |
||
377 | local texture, itemCount = GetContainerItemInfo(bag, slot); |
||
378 | local link = GetContainerItemLink(bag,slot); |
||
379 | GuildAdsShiftClick.setItem(button, link, texture, itemCount); |
||
380 | else |
||
381 | GuildAdsShiftClick.callHook.allInOneInventory(button, ignoreShift); |
||
382 | end |
||
383 | end; |
||
384 | |||
385 | -- MyInventory |
||
386 | myInventoryOnClick = function(button, ignoreShift) |
||
387 | if(not ignoreShift and GuildAdsShiftClick.hookTest(button)) then |
||
388 | local texture, itemCount = GetContainerItemInfo(this.bagIndex, this.itemIndex); |
||
389 | local link = GetContainerItemLink(this.bagIndex, this.itemIndex); |
||
390 | GuildAdsShiftClick.setItem(button, link, texture, itemCount); |
||
391 | else |
||
392 | GuildAdsShiftClick.callHook.myInventory(button, ignoreShift); |
||
393 | end |
||
394 | end; |
||
395 | |||
396 | -- EngInventory |
||
397 | engInventoryOnClick = function(arg1) |
||
398 | if GuildAdsShiftClick.hookTest(arg1) then |
||
399 | if (EngInventory_buttons[this:GetName()] ~= nil) then |
||
400 | bar = EngInventory_buttons[this:GetName()]["bar"]; |
||
401 | position = EngInventory_buttons[this:GetName()]["position"]; |
||
402 | |||
403 | bag = EngInventory_bar_positions[bar][position]["bagnum"]; |
||
404 | slot = EngInventory_bar_positions[bar][position]["slotnum"]; |
||
405 | |||
406 | local texture, itemCount = GetContainerItemInfo(bag, slot); |
||
407 | local link = GetContainerItemLink(bag,slot); |
||
408 | GuildAdsShiftClick.setItem(button, link, texture, itemCount); |
||
409 | end |
||
410 | else |
||
411 | GuildAdsShiftClick.callHook.engInventory(arg1); |
||
412 | end |
||
413 | end; |
||
414 | |||
415 | -- MyBank |
||
416 | myBankOnClick = function(button, ignoreShift) |
||
417 | if(GuildAdsShiftClick.hookTest(button)) then |
||
418 | local myLink; |
||
419 | local item = MyBank_GetBag(this.bagIndex)[this.itemIndex]; |
||
420 | if ItemsMatrix_GetLink then |
||
421 | myLink = ItemsMatrix_GetLink(item["name"]); |
||
422 | elseif LootLink_GetLink then |
||
423 | myLink = LootLink_GetLink(item["name"]); |
||
424 | else |
||
425 | myLink = MyBank_GetLink(item); |
||
426 | end |
||
427 | local icon, count = GetContainerItemInfo(this.bagIndex, this.itemIndex); |
||
428 | GuildAdsShiftClick.setItem(button, myLink, icon, count); |
||
429 | else |
||
430 | GuildAdsShiftClick.callHook.myBank(button, ignoreShift); |
||
431 | end |
||
432 | end; |
||
433 | |||
434 | -- BankItems |
||
435 | bankItems = { |
||
436 | |||
437 | itemOnClick = function(button) |
||
438 | if(GuildAdsShiftClick.hookTest(button)) then |
||
439 | local playerName = UIDropDownMenu_GetSelectedValue(BankItems_UserDropdown) |
||
440 | local item = BankItems_Save[playerName][this:GetID()]; |
||
441 | if (item) then |
||
442 | GuildAdsShiftClick.setItem(button, item.link, item.icon, item.count); |
||
443 | end |
||
444 | else |
||
445 | GuildAdsShiftClick.callHook.bankItemsItem(button); |
||
446 | end |
||
447 | end; |
||
448 | |||
449 | bagOnClick = function(button) |
||
450 | if(GuildAdsShiftClick.hookTest(button)) then |
||
451 | local playerName = UIDropDownMenu_GetSelectedValue(BankItems_UserDropdown) |
||
452 | local bag = BankItems_Save[playerName]["Bag"..this:GetParent():GetID()]; |
||
453 | local itemID = bag.size - ( this:GetID() - 1 ); |
||
454 | local item = bag[itemID]; |
||
455 | if (item) then |
||
456 | GuildAdsShiftClick.setItem(button, item.link, item.icon, item.count); |
||
457 | end |
||
458 | else |
||
459 | GuildAdsShiftClick.callHook.bankItemsBag(button); |
||
460 | end |
||
461 | end; |
||
462 | |||
463 | }; |
||
464 | |||
465 | -- BankStatement |
||
466 | bankStatement = { |
||
467 | |||
468 | getItemInfo = function(container, itemNum) |
||
469 | local item; |
||
470 | local player = BankStatementGetBSIIndex(); |
||
471 | if (BankStatementItems and BankStatementItems[player]) then |
||
472 | if (itemNum == "bag") then |
||
473 | item = BankStatementItems[player][container]; |
||
474 | else |
||
475 | if (BankStatementItems[player][container]) then |
||
476 | item = BankStatementItems[player][container][itemNum]; |
||
477 | end |
||
478 | end |
||
479 | end |
||
480 | return item.link, item.icon, item.quantity; |
||
481 | end; |
||
482 | |||
483 | itemOnClick = function(button) |
||
484 | if(GuildAdsShiftClick.hookTest(button)) then |
||
485 | local link, icon, count = GuildAds_BS_GetItemInfo("bank", this:GetID()); |
||
486 | GuildAdsShiftClick.setItem(button, link, icon, count); |
||
487 | else |
||
488 | GuildAdsShiftClick.callHook.bankStatementItem(button); |
||
489 | end |
||
490 | end; |
||
491 | |||
492 | bagOnClick = function(button) |
||
493 | if(GuildAdsShiftClick.hookTest(button)) then |
||
494 | local link, icon, count = GuildAds_BS_GetItemInfo("bag"..this:GetParent():GetID(), this:GetID()); |
||
495 | GuildAdsShiftClick.setItem(button, link, icon, count); |
||
496 | else |
||
497 | GuildAdsShiftClick.callHook.bankStatementBag(button); |
||
498 | end |
||
499 | end; |
||
500 | |||
501 | }; |
||
502 | |||
503 | -- ItemMatrix |
||
504 | itemMatrixOnClick = function(button) |
||
505 | if GuildAdsShiftClick.hookTest(button) then |
||
506 | --only input if link is linkable |
||
507 | if(IM_GetData(this:GetText(), "item")) then |
||
508 | local nameGIF, linkGIF, qualityGIF, minLevelGIF, classGIF, subclassGIF, maxStackGIF = GetItemInfo(IM_GetData(this:GetText(), "item")); |
||
509 | if(linkGIF and qualityGIF and nameGIF) then |
||
510 | if(qualityGIF == 5) then --legendary |
||
511 | useColor = "ffff8000"; |
||
512 | elseif(qualityGIF == 4) then --epic |
||
513 | useColor = "ffa335ee"; |
||
514 | elseif(qualityGIF == 3) then --rare |
||
515 | useColor = "ff0070dd"; |
||
516 | elseif(qualityGIF == 2) then --uncommon |
||
517 | useColor = "ff1eff00"; |
||
518 | elseif(qualityGIF == 1) then--white |
||
519 | useColor = "ffffffff"; |
||
520 | elseif(qualityGIF == 0) then--poor |
||
521 | useColor = "ff9d9d9d"; |
||
522 | elseif(qualityGIF == -1) then--poor |
||
523 | useColor = "ff9d9d9d"; |
||
524 | else |
||
525 | useColor = "ff57BDFB"; |
||
526 | end |
||
527 | |||
528 | --now insert it |
||
529 | if(useColor) then |
||
530 | GuildAdsShiftClick.setItem(button, "|c"..useColor.."|H"..linkGIF.."|h["..nameGIF.."]|h|r", nil, nil); |
||
531 | end |
||
532 | end |
||
533 | end |
||
534 | else |
||
535 | GuildAdsShiftClick.callHook.itemMatrix(button); |
||
536 | end |
||
537 | end; |
||
538 | |||
539 | |||
540 | -- LootLink |
||
541 | lootLink = { |
||
542 | |||
543 | -- Handle Lootlink OnClick events |
||
544 | checkItemServer = function(item) |
||
545 | -- If we haven't converted and this item predates multiple server support, count it as valid |
||
546 | if (not item._) |
||
547 | and ((not LootLinkState or not LootLinkState.DataVersion) or (LootLinkState.DataVersion < 110) ) then |
||
548 | return 1; |
||
549 | end |
||
550 | |||
551 | -- normal case (LootLink_CheckItemServerRaw function) |
||
552 | if item.s then |
||
553 | local index = LootLinkState.ServerNamesToIndices[GetRealmName()]; |
||
554 | for server in string.gfind(item.s, "(%d+)") do |
||
555 | if tonumber(server) == index then |
||
556 | return 1; |
||
557 | end |
||
558 | end |
||
559 | end |
||
560 | |||
561 | if( not item.s ) then |
||
562 | return nil; |
||
563 | end |
||
564 | |||
565 | return nil; |
||
566 | end; |
||
567 | |||
568 | getLink = function(name) |
||
569 | local itemLink = ItemLinks[name]; |
||
570 | if( itemLink and itemLink.c and itemLink.i and GuildAdsShiftClick.lootLink.checkItemServer(itemLink) ) then |
||
571 | -- Remove instance-specific data that we captured from the link we return |
||
572 | local item = string.gsub(itemLink.i, "(%d+):(%d+):(%d+):(%d+)", "%1:0:%3:%4"); |
||
573 | return "|c"..itemLink.c.."|Hitem:"..item.."|h["..name.."]|h|r"; |
||
574 | end |
||
575 | return nil; |
||
576 | end; |
||
577 | |||
578 | onClick = function(button) |
||
579 | if(GuildAdsShiftClick.hookTest(button)) then |
||
580 | local link = GuildAdsShiftClick.lootLink.getLink(this:GetText()); |
||
581 | GuildAdsShiftClick.setItem(button, link, nil, nil); |
||
582 | else |
||
583 | GuildAdsShiftClick.callHook.lootLink(button); |
||
584 | end |
||
585 | end; |
||
586 | |||
587 | }; |
||
588 | |||
589 | }; |
||
590 | |||
591 | GuildAdsPlugin.UIregister(GuildAdsShiftClick); |
||
592 | GuildAdsShiftClick.hook("inspectLoadUI", "InspectFrame_LoadUI", GuildAdsShiftClick.inspect.loadUI); |
||
593 | GuildAdsShiftClick.hook("auctionHouseLoadUI", "AuctionFrame_LoadUI", GuildAdsShiftClick.auctionHouse.loadUI); |
||
594 | GuildAdsShiftClick.hook("tradeSkillLoadUI", "TradeSkillFrame_LoadUI", GuildAdsShiftClick.tradeSkill.loadUI); |
||
595 | GuildAdsShiftClick.hook("craftLoadUI", "CraftFrame_LoadUI", GuildAdsShiftClick.craft.loadUI); |