vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --------------------------------------------- |
2 | -- Hook functions to track picked up items -- |
||
3 | --------------------------------------------- |
||
4 | SAS_original_PickupAction = PickupAction; |
||
5 | function SAS_PickupAction(slot) |
||
6 | local PlrName = SASFrame.PlrName; |
||
7 | local itemInfo = SAS_GetMissingItemInfo( slot ); |
||
8 | if ( not SAS_SwappingSet ) then |
||
9 | SAS_SavedPickup = SAS_BuildActionInfo(SAS_GetActionInfo(slot)); |
||
10 | if ( SAS_SavedPickup ) then |
||
11 | SASDebug("Picked up action "..SAS_ParseActionInfo(SAS_SavedPickup, 1).." from slot "..slot ); |
||
12 | SAS_ReturnAction = slot; |
||
13 | SASFakeDrag_Drop(1); |
||
14 | end |
||
15 | end |
||
16 | if ( itemInfo and HasAction(slot) ) then |
||
17 | SASDebug( "Removing missing item from action "..slot..". Attempted to pick up." ); |
||
18 | SAS_Saved[PlrName]["MissingItems"][slot] = nil; |
||
19 | SAS_ForceUpdate( slot ); |
||
20 | end |
||
21 | SAS_original_PickupAction(slot); |
||
22 | end |
||
23 | PickupAction = SAS_PickupAction; |
||
24 | |||
25 | SAS_original_PlaceAction = PlaceAction; |
||
26 | function SAS_PlaceAction(slot) |
||
27 | if ( not SAS_SwappingSet ) then |
||
28 | SAS_ReturnAction = nil; |
||
29 | SASDebug("Place action "..slot); |
||
30 | SAS_SavedPickup = SAS_BuildActionInfo(SAS_GetActionInfo(slot)); |
||
31 | if ( SAS_SavedPickup ) then |
||
32 | SASDebug("Placed action "..SAS_ParseActionInfo(SAS_SavedPickup, 1).." from slot "..slot ); |
||
33 | SASFakeDrag_Drop(1); |
||
34 | end |
||
35 | end |
||
36 | SAS_original_PlaceAction(slot); |
||
37 | end |
||
38 | PlaceAction = SAS_PlaceAction; |
||
39 | |||
40 | SAS_original_UseAction = UseAction; |
||
41 | function SAS_UseAction(slot, check, onSelf) |
||
42 | if ( not SAS_SwappingSet ) then |
||
43 | SAS_ReturnAction = nil; |
||
44 | SAS_SavedPickup = SAS_BuildActionInfo(SAS_GetActionInfo(slot)); |
||
45 | if ( SAS_SavedPickup ) then |
||
46 | SASFakeDrag_Drop(1); |
||
47 | SASDebug("Use action "..SAS_ParseActionInfo(SAS_SavedPickup, 1).." from slot "..slot ); |
||
48 | end |
||
49 | end |
||
50 | SAS_original_UseAction(slot, check, onSelf); |
||
51 | end |
||
52 | UseAction = SAS_UseAction; |
||
53 | |||
54 | SAS_original_PickupContainerItem = PickupContainerItem; |
||
55 | function SAS_PickupContainerItem( bag, slot ) |
||
56 | if ( not SAS_SwappingSet ) then |
||
57 | SAS_ReturnAction = nil; |
||
58 | local itemLink = GetContainerItemLink( bag, slot ); |
||
59 | if ( itemLink ) then |
||
60 | local name = SAS_FindName(itemLink); |
||
61 | local link = SAS_FindLink(itemLink); |
||
62 | local texture = GetContainerItemInfo( bag, slot ); |
||
63 | SAS_SavedPickup = SAS_BuildActionInfo( name, texture, nil, link ); |
||
64 | SASFakeDrag_Drop(1); |
||
65 | SASDebug("Pick up container item "..name.." from "..bag..", "..slot ); |
||
66 | end |
||
67 | end |
||
68 | SAS_original_PickupContainerItem( bag, slot ); |
||
69 | end |
||
70 | PickupContainerItem = SAS_PickupContainerItem; |
||
71 | |||
72 | SAS_original_PickupInventoryItem = PickupInventoryItem; |
||
73 | function SAS_PickupInventoryItem(index) |
||
74 | if ( not SAS_SwappingSet ) then |
||
75 | SAS_ReturnAction = nil; |
||
76 | local itemLink = GetInventoryItemLink( "player", index ); |
||
77 | if ( itemLink ) then |
||
78 | local name = SAS_FindName(itemLink); |
||
79 | local link = SAS_FindLink(itemLink); |
||
80 | local texture = GetInventoryItemTexture( "player", index ); |
||
81 | SAS_SavedPickup = SAS_BuildActionInfo( name, texture, nil, link ); |
||
82 | SASFakeDrag_Drop(1); |
||
83 | SASDebug("Pick up inventory item "..name.." from "..index ); |
||
84 | end |
||
85 | end |
||
86 | SAS_original_PickupInventoryItem(index); |
||
87 | end |
||
88 | PickupInventoryItem = SAS_PickupInventoryItem; |
||
89 | |||
90 | SAS_original_PickupMacro = PickupMacro; |
||
91 | function SAS_PickupMacro(index) |
||
92 | if ( not SAS_SwappingSet ) then |
||
93 | SAS_ReturnAction = nil; |
||
94 | local name, texture = GetMacroInfo(index); |
||
95 | local macro = GetMacroIndexByName(name); |
||
96 | if ( name ) then |
||
97 | SAS_SavedPickup = SAS_BuildActionInfo( name, texture, nil, nil, macro ); |
||
98 | SASFakeDrag_Drop(1); |
||
99 | SASDebug("Pick up macro "..name.." from "..index ); |
||
100 | end |
||
101 | end |
||
102 | SAS_original_PickupMacro(index); |
||
103 | end |
||
104 | PickupMacro = SAS_PickupMacro; |
||
105 | |||
106 | SAS_original_PickupSpell = PickupSpell; |
||
107 | function SAS_PickupSpell(id, bookType) |
||
108 | if ( not SAS_SwappingSet ) then |
||
109 | SAS_ReturnAction = nil; |
||
110 | local name, rank = GetSpellName( id, bookType ); |
||
111 | local texture = GetSpellTexture( id, bookType ); |
||
112 | if ( name ) then |
||
113 | SAS_SavedPickup = SAS_BuildActionInfo( name, texture, rank ); |
||
114 | SASFakeDrag_Drop(1); |
||
115 | SASDebug("Pick up spell "..name.." from "..id); |
||
116 | local passive = IsSpellPassive( id, bookType ); |
||
117 | if ( passive ) then |
||
118 | SASDebug("Spell is passive? Why can we pick this up?"); |
||
119 | end |
||
120 | SAS_SavedPickup = SAS_BuildActionInfo( name, texture, rank, nil, nil, passive ); |
||
121 | end |
||
122 | end |
||
123 | SAS_original_PickupSpell(id, bookType); |
||
124 | end |
||
125 | PickupSpell = SAS_PickupSpell; |
||
126 | |||
127 | |||
128 | -------------------------------------------- |
||
129 | -- Hook functions to drop fake drag frame -- |
||
130 | -------------------------------------------- |
||
131 | |||
132 | SAS_original_WorldFrameOnMouseDown = WorldFrame:GetScript("OnMouseDown"); |
||
133 | WorldFrame:SetScript("OnMouseDown", function() |
||
134 | SASFakeDrag_Drop(1); |
||
135 | if ( SAS_original_WorldFrameOnMouseDown ) then |
||
136 | SAS_original_WorldFrameOnMouseDown(); |
||
137 | end |
||
138 | end); |
||
139 | |||
140 | ------------------------------------------- |
||
141 | -- Hook functions to show missing items -- |
||
142 | ------------------------------------------- |
||
143 | |||
144 | SAS_original_GetActionTexture = GetActionTexture; |
||
145 | function SAS_GetActionTexture( id ) |
||
146 | local PlrName = SASFrame.PlrName; |
||
147 | local texture = SAS_original_GetActionTexture( id ); |
||
148 | local itemInfo = SAS_GetMissingItemInfo( id ); |
||
149 | if ( itemInfo ) then |
||
150 | if ( texture ) then |
||
151 | SASDebug( "Removing missing item from action "..id..". Real action exists." ); |
||
152 | SAS_Saved[PlrName]["MissingItems"][id] = nil; |
||
153 | SAS_ForceUpdate( id ); |
||
154 | else |
||
155 | return SAS_FullPath(SAS_ParseActionInfo(itemInfo, 2)); |
||
156 | end |
||
157 | end |
||
158 | return texture; |
||
159 | end |
||
160 | GetActionTexture = SAS_GetActionTexture; |
||
161 | |||
162 | SAS_original_IsConsumableAction = IsConsumableAction; |
||
163 | function SAS_IsConsumableAction( id ) |
||
164 | if ( SAS_GetMissingItemInfo( id ) ) then |
||
165 | return 1; |
||
166 | end |
||
167 | return SAS_original_IsConsumableAction( id ); |
||
168 | end |
||
169 | IsConsumableAction = SAS_IsConsumableAction; |
||
170 | |||
171 | SAS_original_HasAction = HasAction; |
||
172 | function SAS_HasAction( id ) |
||
173 | if ( SAS_GetMissingItemInfo( id ) ) then |
||
174 | return 1; |
||
175 | end |
||
176 | return SAS_original_HasAction( id ); |
||
177 | end |
||
178 | HasAction = SAS_HasAction; |
||
179 | |||
180 | SAS_original_SetAction = GameTooltip.SetAction; |
||
181 | function SAS_SetAction( this, id ) |
||
182 | local PlrName = SASFrame.PlrName; |
||
183 | local itemInfo = SAS_GetMissingItemInfo( id ); |
||
184 | if ( itemInfo ) then |
||
185 | local name, link = SAS_ParseActionInfo( itemInfo, 1, 4); |
||
186 | if ( link and GetItemInfo("item:"..link) ) then |
||
187 | TooltipReturn = GameTooltip:SetHyperlink("item:"..link); |
||
188 | if ( not SAS_Saved[PlrName]["HideFakeItemTooltips"] ) then |
||
189 | SASTooltipAddLine( SAS_TEXT_TOOLTIP_GENERATEDACTION ); |
||
190 | if ( IsShiftKeyDown() or SAS_IsValidAction ) then |
||
191 | SASTooltipAddLine( SAS_TEXT_TOOLTIP_FAKEACTIONWARN ); |
||
192 | end |
||
193 | end |
||
194 | GameTooltip:Show(); |
||
195 | --return 1; |
||
196 | return; |
||
197 | else |
||
198 | TooltipReturn = GameTooltip:SetText( name, 1, 1, 1 ); |
||
199 | SASTooltipAddLine( SAS_TEXT_TOOLTIP_NOTVALID ); |
||
200 | if ( not SAS_Saved[PlrName]["HideFakeItemTooltips"] ) then |
||
201 | SASTooltipAddLine( SAS_TEXT_TOOLTIP_GENERATEDACTION ); |
||
202 | if ( IsShiftKeyDown() or SAS_IsValidAction ) then |
||
203 | SASTooltipAddLine( SAS_TEXT_TOOLTIP_FAKEACTIONWARN ); |
||
204 | end |
||
205 | end |
||
206 | GameTooltip:Show(); |
||
207 | --return 1; |
||
208 | return; |
||
209 | end |
||
210 | end |
||
211 | return SAS_original_SetAction( this, id ); |
||
212 | end |
||
213 | GameTooltip.SetAction = SAS_SetAction; |