vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | WIM_ButtonsHooked = false; |
2 | WIM_TradeSkillIsHooked = false; |
||
3 | WIM_CraftSkillIsHooked = false; |
||
4 | |||
5 | function WIM_HookTradeSkill() |
||
6 | if(WIM_TradeSkillIsHooked == true and WIM_CraftSkillIsHooked == true) then |
||
7 | return; |
||
8 | end |
||
9 | |||
10 | if(WIM_TradeSkillIsHooked == false and TradeSkillFrame ~= nil) then |
||
11 | WIM_TradeSkillSkillIcon_OnClick_orig = TradeSkillSkillIcon:GetScript("OnClick"); |
||
12 | TradeSkillSkillIcon:SetScript("OnClick", function() WIM_TradeSkillSkillIcon_OnClick_orig(); WIM_TradeSkillSkillIcon_OnClick(); end); |
||
13 | |||
14 | for i=1, 8 do |
||
15 | WIM_TradeSkillReagent_OnClick_orig = getglobal("TradeSkillReagent"..i):GetScript("OnClick"); |
||
16 | getglobal("TradeSkillReagent"..i):SetScript("OnClick", function() WIM_TradeSkillReagent_OnClick_orig(); WIM_TradeSkillReagent_OnClick(); end); |
||
17 | end |
||
18 | WIM_TradeSkillIsHooked = true; |
||
19 | end |
||
20 | |||
21 | if(WIM_CraftSkillIsHooked == false and CraftFrame ~= nil) then |
||
22 | WIM_CraftIcon_OnClick_orig = CraftIcon:GetScript("OnClick"); |
||
23 | CraftIcon:SetScript("OnClick", function() WIM_CraftIcon_OnClick_orig(); WIM_CraftIcon_OnClick(); end); |
||
24 | |||
25 | for i=1, 8 do |
||
26 | WIM_CraftReagent_OnClick_orig = getglobal("CraftReagent"..i):GetScript("OnClick"); |
||
27 | getglobal("CraftReagent"..i):SetScript("OnClick", function() WIM_CraftReagent_OnClick_orig(); WIM_CraftReagent_OnClick(); end); |
||
28 | end |
||
29 | |||
30 | WIM_CraftSkillIsHooked = true; |
||
31 | end |
||
32 | end |
||
33 | |||
34 | function WIM_CraftIcon_OnClick(arg1) |
||
35 | if ( IsShiftKeyDown() ) then |
||
36 | if ( WIM_EditBoxInFocus ) then |
||
37 | WIM_EditBoxInFocus:Insert(GetCraftItemLink(GetCraftSelectionIndex())); |
||
38 | end |
||
39 | end |
||
40 | end |
||
41 | |||
42 | function WIM_CraftReagent_OnClick(arg1) |
||
43 | if ( IsShiftKeyDown() ) then |
||
44 | if ( WIM_EditBoxInFocus ) then |
||
45 | WIM_EditBoxInFocus:Insert(GetCraftReagentItemLink(GetCraftSelectionIndex(), this:GetID())); |
||
46 | end |
||
47 | end |
||
48 | end |
||
49 | |||
50 | |||
51 | function WIM_TradeSkillSkillIcon_OnClick(agr1) |
||
52 | if ( IsShiftKeyDown() ) then |
||
53 | if ( WIM_EditBoxInFocus ) then |
||
54 | WIM_EditBoxInFocus:Insert(GetTradeSkillItemLink(TradeSkillFrame.selectedSkill)); |
||
55 | end |
||
56 | end |
||
57 | end |
||
58 | |||
59 | function WIM_TradeSkillReagent_OnClick(arg1) |
||
60 | if ( IsShiftKeyDown() ) then |
||
61 | if ( WIM_EditBoxInFocus ) then |
||
62 | WIM_EditBoxInFocus:Insert(GetTradeSkillReagentItemLink(TradeSkillFrame.selectedSkill, this:GetID())); |
||
63 | end |
||
64 | end |
||
65 | end |
||
66 | |||
67 | |||
68 | function WIM_PaperDollItemSlotButton_OnClick(arg1) |
||
69 | if(arg1 == "LeftButton" and IsShiftKeyDown()) then |
||
70 | if(WIM_EditBoxInFocus) then |
||
71 | WIM_EditBoxInFocus:Insert(GetInventoryItemLink("player", this:GetID())); |
||
72 | end |
||
73 | end |
||
74 | WIM_PaperDollItemSlotButton_OnClick_orig(arg1); |
||
75 | end |
||
76 | |||
77 | function WIM_FriendsFrame_OnEvent() |
||
78 | if(event == "WHO_LIST_UPDATE") then |
||
79 | local numWhos, totalCount = GetNumWhoResults(); |
||
80 | if(numWhos > 0) then |
||
81 | local name, guild, level, race, class, zone = GetWhoInfo(1); |
||
82 | if(WIM_Windows[name] and name ~= "" and name ~= nil) then |
||
83 | if(WIM_Windows[name].waiting_who) then |
||
84 | WIM_Windows[name].waiting_who = false; |
||
85 | WIM_Windows[name].class = class; |
||
86 | WIM_Windows[name].level = level; |
||
87 | WIM_Windows[name].race = race; |
||
88 | WIM_Windows[name].guild = guild; |
||
89 | WIM_SetWhoInfo(name); |
||
90 | SetWhoToUI(0); |
||
91 | return; |
||
92 | end |
||
93 | end |
||
94 | end |
||
95 | end |
||
96 | WIM_FriendsFrame_OnEvent_orig(event); |
||
97 | end |
||
98 | |||
99 | |||
100 | function WIM_SetItemRef (link, text, button) |
||
101 | if (WIM_isLinkURL(link)) then |
||
102 | WIM_DisplayURL(link); |
||
103 | return; |
||
104 | end |
||
105 | if (strsub(link, 1, 6) ~= "player") and ( IsShiftKeyDown() ) and ( not ChatFrameEditBox:IsVisible() ) then |
||
106 | local itemName = gsub(text, ".*%[(.*)%].*", "%1"); |
||
107 | if(WIM_EditBoxInFocus) then |
||
108 | WIM_EditBoxInFocus:Insert(text); |
||
109 | end |
||
110 | end |
||
111 | end |
||
112 | |||
113 | function WIM_ItemButton_OnClick(button, ignoreModifiers) |
||
114 | if ( button == "LeftButton" ) and (not ignoreModifiers) and ( IsShiftKeyDown() ) and ( not ChatFrameEditBox:IsVisible() ) and (GameTooltipTextLeft1:GetText()) then |
||
115 | if(WIM_EditBoxInFocus) then |
||
116 | WIM_EditBoxInFocus:Insert(GetContainerItemLink(this:GetParent():GetID(), this:GetID())); |
||
117 | end |
||
118 | end |
||
119 | end |
||
120 | |||
121 | function WIM_SetUpHooks() |
||
122 | if(WIM_ButtonsHooked) then |
||
123 | return; |
||
124 | end |
||
125 | |||
126 | --Hook FriendsFrame_OnEvent |
||
127 | WIM_FriendsFrame_OnEvent_orig = FriendsFrame_OnEvent; |
||
128 | FriendsFrame_OnEvent = WIM_FriendsFrame_OnEvent; |
||
129 | |||
130 | --Hook ChatFrame_OnEvent |
||
131 | WIM_ChatFrame_OnEvent_orig = ChatFrame_OnEvent; |
||
132 | ChatFrame_OnEvent = function(event) if(WIM_ChatFrameSupressor_OnEvent(event)) then WIM_ChatFrame_OnEvent_orig(event); end; end; |
||
133 | |||
134 | --Hook SetItemRef |
||
135 | WIM_SetItemRef_orig = SetItemRef; |
||
136 | SetItemRef = function(link, text, button) if(not WIM_isLinkURL(link)) then WIM_SetItemRef_orig(link, text, button); end; WIM_SetItemRef(link, text, button); end; |
||
137 | |||
138 | --Hook Paper Doll Button |
||
139 | WIM_PaperDollItemSlotButton_OnClick_orig = PaperDollItemSlotButton_OnClick; |
||
140 | PaperDollItemSlotButton_OnClick = WIM_PaperDollItemSlotButton_OnClick; |
||
141 | |||
142 | --Hook ContainerFrameItemButton_OnClick |
||
143 | WIM_ContainerFrameItemButton_OnClick_orig = ContainerFrameItemButton_OnClick; |
||
144 | ContainerFrameItemButton_OnClick = function(button, ignoreModifiers) WIM_ContainerFrameItemButton_OnClick_orig(button, ignoreModifiers); WIM_ItemButton_OnClick(button, ignoreModifiers); end; |
||
145 | |||
146 | if (AllInOneInventoryFrameItemButton_OnClick) then |
||
147 | --Hook ContainerFrameItemButton_OnClick |
||
148 | WIM_AllInOneInventoryFrameItemButton_OnClick_orig = AllInOneInventoryFrameItemButton_OnClick; |
||
149 | AllInOneInventoryFrameItemButton_OnClick = function(button, ignoreModifiers) WIM_AllInOneInventoryFrameItemButton_OnClick_orig(button, ignoreModifiers); WIM_ItemButton_OnClick(button, ignoreModifiers); end; |
||
150 | end |
||
151 | |||
152 | if (EngInventory_ItemButton_OnClick) then |
||
153 | --Hook ContainerFrameItemButton_OnClick |
||
154 | WIM_EngInventory_ItemButton_OnClick_orig = EngInventory_ItemButton_OnClick; |
||
155 | EngInventory_ItemButton_OnClick = function(button, ignoreModifiers) WIM_EngInventory_ItemButton_OnClick_orig(button, ignoreModifiers); WIM_ItemButton_OnClick(button, ignoreModifiers); end; |
||
156 | end |
||
157 | |||
158 | if (BrowseButton) then |
||
159 | --Hook BrowseButtons |
||
160 | for i=1, 8 do |
||
161 | local frame = getglobal("BrowseButton"..i.."Item"); |
||
162 | local oldFunc = frame:GetScript("OnClick"); |
||
163 | frame:SetScript("OnClick", function() oldFunc(); WIM_ItemButton_OnClick(arg1); end); |
||
164 | end |
||
165 | end |
||
166 | WIM_ButtonsHooked = true; |
||
167 | end |