vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | function GB_Hook_Functions() |
2 | -- HOOK FUNCTIONS FOR PICKING UP STUFF |
||
3 | GB_Old_SpellButton_OnClick = SpellButton_OnClick; |
||
4 | SpellButton_OnClick = GB_SpellButton_OnClick; |
||
5 | GB_Old_ContainerFrameItemButton_OnClick = ContainerFrameItemButton_OnClick; |
||
6 | ContainerFrameItemButton_OnClick = GB_ContainerFrame_OnClick; |
||
7 | GB_Old_PaperDollItemSlotButton_OnClick = PaperDollItemSlotButton_OnClick; |
||
8 | PaperDollItemSlotButton_OnClick = GB_PaperDollItemSlotButton_OnClick; |
||
9 | GB_Old_PickupMacro = PickupMacro; |
||
10 | PickupMacro = GB_PickupMacro; |
||
11 | |||
12 | -- FOR COSMOS COMPATIBILITY (uuuugh :P) |
||
13 | GB_Old_TotemStomper_WatchSpellbook = TotemStomper_WatchSpellbook; |
||
14 | TotemStomper_WatchSpellbook = GB_TotemStomper_WatchSpellbook; |
||
15 | |||
16 | -- MYINVENTORY COMPATIBILITY |
||
17 | GB_Old_MyInventoryFrameItemButton_OnClick = MyInventoryFrameItemButton_OnClick; |
||
18 | MyInventoryFrameItemButton_OnClick = GB_MyInventoryFrameItemButton_OnClick; |
||
19 | |||
20 | -- ALL IN ONE INVENTORY COMPATIBILITY |
||
21 | GB_Old_AllInOneInventoryFrameItemButton_OnClick = AllInOneInventoryFrameItemButton_OnClick; |
||
22 | AllInOneInventoryFrameItemButton_OnClick = GB_AllInOneInventoryFrameItemButton_OnClick; |
||
23 | |||
24 | -- TO UPDATE MACROS WHEN YOU ADD NEW ONES |
||
25 | GB_Old_MacroFrame_Update = MacroFrame_Update; |
||
26 | MacroFrame_Update = GB_MacroFrame_Update; |
||
27 | |||
28 | -- Click-casting for the default raid frames |
||
29 | -- GB_Old_RaidPulloutButton_OnClick = RaidPulloutButton_OnClick; |
||
30 | -- RaidPulloutButton_OnClick = GB_RaidPulloutButton_OnClick; |
||
31 | |||
32 | -- Click-casting and mouseovers for CTRA frames |
||
33 | GB_Old_CT_RA_MemberFrame_OnClick = CT_RA_MemberFrame_OnClick; |
||
34 | CT_RA_MemberFrame_OnClick = GB_CT_RA_MemberFrame_OnClick; |
||
35 | GB_Old_CT_RA_MemberFrame_OnEnter = CT_RA_MemberFrame_OnEnter; |
||
36 | CT_RA_MemberFrame_OnEnter = GB_CT_RA_MemberFrame_OnEnter; |
||
37 | GB_Old_CT_RA_MemberFrame_OnLeave = CT_RA_MemberFrame_OnLeave; |
||
38 | CT_RA_MemberFrame_OnLeave = GB_CT_RA_MemberFrame_OnLeave; |
||
39 | |||
40 | -- Support for Perl's Raid Frames, probably doesn't work, Perl's not built for click-casting |
||
41 | GB_Old_Perl_Raid_MouseUp = Perl_Raid_MouseUp; |
||
42 | GB_Perl_Raid_MouseUp = Perl_Raid_MouseUp; |
||
43 | |||
44 | -- Support for beyondRaid frames |
||
45 | GB_Old_beyondRaidUnitOnClick = beyondRaidUnitOnClick; |
||
46 | beyondRaidUnitOnClick = GB_beyondRaidUnitOnClick; |
||
47 | |||
48 | -- Support for Mars Raid |
||
49 | GB_Old_MarsRaidFrame_OnClick = MarsRaidFrame_OnClick; |
||
50 | MarsRaidFrame_OnClick = GB_MarsRaidFrame_OnClick; |
||
51 | GB_Old_MarsRaidFrame_OnEnter = MarsRaidFrame_OnEnter; |
||
52 | MarsRaidFrame_OnEnter = GB_MarsRaidFrame_OnEnter; |
||
53 | GB_Old_MarsRaidFrame_OnLeave = MarsRaidFrame_OnLeave; |
||
54 | MarsRaidFrame_OnLeave = GB_MarsRaidFrame_OnLeave; |
||
55 | |||
56 | -- Support for Discord Unit Frames 2.0 |
||
57 | if (DUF_TargetOfTargetFrame) then |
||
58 | GB_Old_DUF_Element_OnClick = DUF_Element_OnClick; |
||
59 | DUF_Element_OnClick = GB_DUF_Element_OnClick; |
||
60 | GB_Old_DUF_UnitFrame_OnClick = DUF_UnitFrame_OnClick; |
||
61 | DUF_UnitFrame_OnClick = GB_DUF_UnitFrame_OnClick; |
||
62 | GB_Old_DUF_Element_OnEnter = DUF_Element_OnEnter; |
||
63 | DUF_Element_OnEnter = GB_DUF_Element_OnEnter; |
||
64 | GB_Old_DUF_UnitFrame_OnEnter = DUF_UnitFrame_OnEnter; |
||
65 | DUF_UnitFrame_OnEnter = GB_DUF_UnitFrame_OnEnter; |
||
66 | GB_Old_DUF_Element_OnLeave = DUF_Element_OnLeave; |
||
67 | DUF_Element_OnLeave = GB_DUF_Element_OnLeave; |
||
68 | GB_Old_DUF_UnitFrame_OnLeave = DUF_UnitFrame_OnLeave; |
||
69 | DUF_UnitFrame_OnLeave = GB_DUF_UnitFrame_OnLeave; |
||
70 | end |
||
71 | |||
72 | -- Gotta get set the bars when the default raid frames load |
||
73 | GB_Old_RaidFrame_LoadUI = RaidFrame_LoadUI; |
||
74 | RaidFrame_LoadUI = GB_RaidFrame_LoadUI; |
||
75 | end |
||
76 | |||
77 | function GB_RaidFrame_LoadUI() |
||
78 | GB_Old_RaidFrame_LoadUI(); |
||
79 | GB_Set_Appearance("raid"); |
||
80 | end |
||
81 | |||
82 | function GB_MacroFrame_Update() |
||
83 | GB_Old_MacroFrame_Update(); |
||
84 | GB_Update_Macros(); |
||
85 | end |
||
86 | |||
87 | function GB_Clear_MouseAction() |
||
88 | GB_MOUSE_ACTION = {nil}; |
||
89 | end |
||
90 | |||
91 | function GB_Set_MouseAction(id, id2, idtype, options) |
||
92 | GB_Clear_MouseAction(); |
||
93 | GB_MOUSE_ACTION.id = id; |
||
94 | GB_MOUSE_ACTION.id2 = id2; |
||
95 | GB_MOUSE_ACTION.idtype = idtype; |
||
96 | GB_MOUSE_ACTION.options = {}; |
||
97 | if (options) then |
||
98 | GB_Copy_Table(options, GB_MOUSE_ACTION.options); |
||
99 | else |
||
100 | local table = GB_Get_DefaultButtonSettings(); |
||
101 | GB_Copy_Table(table, GB_MOUSE_ACTION.options); |
||
102 | end |
||
103 | end |
||
104 | |||
105 | function GB_AllInOneInventoryFrameItemButton_OnClick(button, ignoreShift) |
||
106 | local bag, slot = AllInOneInventory_GetIdAsBagSlot(this:GetID()); |
||
107 | if ( button == "LeftButton" ) then |
||
108 | if ( not IsShiftKeyDown() ) then |
||
109 | local itemname = GB_Get_ItemName(bag, slot); |
||
110 | local _, _, locked = GetContainerItemInfo(bag, slot); |
||
111 | if (itemname and (not locked)) then |
||
112 | GB_Set_MouseAction(itemname, "", "item"); |
||
113 | GB_Old_AllInOneInventoryFrameItemButton_OnClick(button, ignoreShift); |
||
114 | else |
||
115 | GB_Old_AllInOneInventoryFrameItemButton_OnClick(button, ignoreShift); |
||
116 | GB_Clear_MouseAction(); |
||
117 | end |
||
118 | else |
||
119 | GB_Old_AllInOneInventoryFrameItemButton_OnClick(button, ignoreShift); |
||
120 | end |
||
121 | else |
||
122 | GB_Old_AllInOneInventoryFrameItemButton_OnClick(button, ignoreShift); |
||
123 | end |
||
124 | end |
||
125 | |||
126 | function GB_ContainerFrame_OnClick(button, ignoreShift) |
||
127 | if ( button == "LeftButton" ) then |
||
128 | if ( not IsShiftKeyDown() ) then |
||
129 | local bag = this:GetParent():GetID(); |
||
130 | local slot = this:GetID(); |
||
131 | local itemname = GB_Get_ItemName(bag, slot); |
||
132 | local _, _, locked = GetContainerItemInfo(bag, slot); |
||
133 | if (itemname) then |
||
134 | GB_Set_MouseAction(itemname, "", "item"); |
||
135 | GB_Old_ContainerFrameItemButton_OnClick(button, ignoreShift); |
||
136 | else |
||
137 | GB_Old_ContainerFrameItemButton_OnClick(button, ignoreShift); |
||
138 | GB_Clear_MouseAction(); |
||
139 | end |
||
140 | else |
||
141 | GB_Old_ContainerFrameItemButton_OnClick(button, ignoreShift); |
||
142 | end |
||
143 | else |
||
144 | GB_Old_ContainerFrameItemButton_OnClick(button, ignoreShift); |
||
145 | end |
||
146 | end |
||
147 | |||
148 | function GB_MyInventoryFrameItemButton_OnClick(button, ignoreShift) |
||
149 | local bag, slot = this.bagIndex, this.itemIndex; |
||
150 | if ( button == "LeftButton" ) then |
||
151 | if ( not IsShiftKeyDown() ) then |
||
152 | local itemname = GB_Get_ItemName(bag, slot); |
||
153 | local _, _, locked = GetContainerItemInfo(bag, slot); |
||
154 | if (itemname and (not locked)) then |
||
155 | GB_Set_MouseAction(itemname, "", "item"); |
||
156 | GB_Old_MyInventoryFrameItemButton_OnClick(button, ignoreShift); |
||
157 | else |
||
158 | GB_Old_MyInventoryFrameItemButton_OnClick(button, ignoreShift); |
||
159 | GB_Clear_MouseAction(); |
||
160 | end |
||
161 | else |
||
162 | GB_Old_MyInventoryFrameItemButton_OnClick(button, ignoreShift); |
||
163 | end |
||
164 | else |
||
165 | GB_Old_MyInventoryFrameItemButton_OnClick(button, ignoreShift); |
||
166 | end |
||
167 | end |
||
168 | |||
169 | function GB_PaperDollItemSlotButton_OnClick(button, ignoreShift) |
||
170 | GB_Old_PaperDollItemSlotButton_OnClick(button, ignoreShift); |
||
171 | if ( button == "LeftButton" ) then |
||
172 | if ( not IsShiftKeyDown() ) then |
||
173 | if ( GetInventoryItemTexture("player", this:GetID()) ) then |
||
174 | local itemname = GB_Get_ItemName(this:GetID()); |
||
175 | GB_Set_MouseAction(itemname, "", "inv"); |
||
176 | end |
||
177 | end |
||
178 | end |
||
179 | end |
||
180 | |||
181 | function GB_PickupMacro(arg) |
||
182 | GB_Old_PickupMacro(arg); |
||
183 | local macroname, texture = GetMacroInfo(arg); |
||
184 | GB_Set_MouseAction(macroname, "", "macro"); |
||
185 | end |
||
186 | |||
187 | function GB_SpellButton_OnClick(drag) |
||
188 | GB_Old_SpellButton_OnClick(drag); |
||
189 | if (drag) then |
||
190 | local spellName, spellRank = GetSpellName(SpellBook_GetSpellID(this:GetID()), BOOKTYPE_SPELL); |
||
191 | GB_Set_MouseAction(spellName, spellRank, "spell"); |
||
192 | end |
||
193 | end |
||
194 | |||
195 | function GB_TotemStomper_WatchSpellbook(drag) |
||
196 | GB_Old_TotemStomper_WatchSpellbook(drag); |
||
197 | if (drag) then |
||
198 | local spellName, spellRank = GetSpellName(SpellBook_GetSpellID(this:GetID()), BOOKTYPE_SPELL); |
||
199 | GB_Set_MouseAction(spellName, spellRank, "spell"); |
||
200 | end |
||
201 | end |