vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | Auctioneer Addon for World of Warcraft(tm). |
||
3 | Version: 3.9.0.1000 (Kangaroo) |
||
4 | Revision: $Id: AuctioneerUI.lua 735 2006-03-03 04:04:26Z vindicator $ |
||
5 | |||
6 | Auctioneer UI manager |
||
7 | |||
8 | License: |
||
9 | This program is free software; you can redistribute it and/or |
||
10 | modify it under the terms of the GNU General Public License |
||
11 | as published by the Free Software Foundation; either version 2 |
||
12 | of the License, or (at your option) any later version. |
||
13 | |||
14 | This program is distributed in the hope that it will be useful, |
||
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
17 | GNU General Public License for more details. |
||
18 | |||
19 | You should have received a copy of the GNU General Public License |
||
20 | along with this program(see GPL.txt); if not, write to the Free Software |
||
21 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||
22 | ]] |
||
23 | |||
24 | ------------------------------------------------------------------------------- |
||
25 | -- Data members |
||
26 | ------------------------------------------------------------------------------- |
||
27 | CursorItem = nil; |
||
28 | |||
29 | MoneyTypeInfo["AUCTIONEER"] = { |
||
30 | UpdateFunc = function() |
||
31 | return this.staticMoney; |
||
32 | end, |
||
33 | |||
34 | collapse = 1, |
||
35 | fixedWidth = 1, |
||
36 | showSmallerCoins = 1 |
||
37 | }; |
||
38 | |||
39 | ------------------------------------------------------------------------------- |
||
40 | ------------------------------------------------------------------------------- |
||
41 | function AuctioneerUI_OnLoad() |
||
42 | Stubby.RegisterFunctionHook("PickupContainerItem", 200, AuctioneerUI_PickupContainerItemHook) |
||
43 | end |
||
44 | |||
45 | ------------------------------------------------------------------------------- |
||
46 | -- Called after Blizzard's AuctionFrameTab_OnClick() method. |
||
47 | ------------------------------------------------------------------------------- |
||
48 | function AuctioneerUI_AuctionFrameTab_OnClickHook(_, _, index) |
||
49 | if (not index) then |
||
50 | index = this:GetID(); |
||
51 | end |
||
52 | |||
53 | -- Hide the Auctioneer tabs |
||
54 | AuctionFrameSearch:Hide(); |
||
55 | AuctionFramePost:Hide(); |
||
56 | |||
57 | -- Show an Auctioneer tab if its the one clicked |
||
58 | local tab = getglobal("AuctionFrameTab"..index); |
||
59 | if (tab) then |
||
60 | if (tab:GetName() == "AuctionFrameTabSearch") then |
||
61 | AuctionFrameTopLeft:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Browse-TopLeft"); |
||
62 | AuctionFrameTop:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Browse-Top"); |
||
63 | AuctionFrameTopRight:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Browse-TopRight"); |
||
64 | AuctionFrameBotLeft:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Browse-BotLeft"); |
||
65 | AuctionFrameBot:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Browse-Bot"); |
||
66 | AuctionFrameBotRight:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Browse-BotRight"); |
||
67 | AuctionFrameSearch:Show(); |
||
68 | elseif (tab:GetName() == "AuctionFrameTabPost") then |
||
69 | AuctionFrameTopLeft:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Browse-TopLeft"); |
||
70 | AuctionFrameTop:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Browse-Top"); |
||
71 | AuctionFrameTopRight:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Browse-TopRight"); |
||
72 | AuctionFrameBotLeft:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Browse-BotLeft"); |
||
73 | AuctionFrameBot:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Browse-Bot"); |
||
74 | AuctionFrameBotRight:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Browse-BotRight"); |
||
75 | AuctionFramePost:Show(); |
||
76 | end |
||
77 | end |
||
78 | end |
||
79 | |||
80 | ------------------------------------------------------------------------------- |
||
81 | -- Called after Blizzard's PickupContainerItem() method in order to capture |
||
82 | -- which item is on the cursor. |
||
83 | ------------------------------------------------------------------------------- |
||
84 | function AuctioneerUI_PickupContainerItemHook(_, _, bag, slot) |
||
85 | if (CursorHasItem()) then |
||
86 | CursorItem = { bag = bag, slot = slot }; |
||
87 | --EnhTooltip.DebugPrint("Picked up item "..CursorItem.bag..", "..CursorItem.slot); |
||
88 | else |
||
89 | CursorItem = nil; |
||
90 | --EnhTooltip.DebugPrint("Dropped item "..bag..", "..slot); |
||
91 | end |
||
92 | AuctioneerUI_GetCursorContainerItem(); |
||
93 | end |
||
94 | |||
95 | ------------------------------------------------------------------------------- |
||
96 | -- Gets the bag and slot number of the item on the cursor. |
||
97 | ------------------------------------------------------------------------------- |
||
98 | function AuctioneerUI_GetCursorContainerItem() |
||
99 | if (CursorHasItem() and CursorItem) then |
||
100 | return CursorItem; |
||
101 | end |
||
102 | return nil; |
||
103 | end |
||
104 | |||
105 | ------------------------------------------------------------------------------- |
||
106 | -- Wrapper for UIDropDownMenu_SetSeletedID() that sets 'this' before calling |
||
107 | -- UIDropDownMenu_SetSelectedID(). |
||
108 | ------------------------------------------------------------------------------- |
||
109 | function AuctioneerDropDownMenu_SetSelectedID(dropdown, index) |
||
110 | local oldThis = this; |
||
111 | this = dropdown; |
||
112 | local newThis = this; |
||
113 | UIDropDownMenu_SetSelectedID(dropdown, index); |
||
114 | -- Double check that the value of 'this' didn't change... this can screw us |
||
115 | -- up and prevent the reason for this method! |
||
116 | if (newThis ~= this) then |
||
117 | EnhTooltip.DebugPrint("WARNING: The value of this changed during AuctioneerDropDownMenu_SetSelectedID()"); |
||
118 | end |
||
119 | this = oldThis; |
||
120 | end |
||
121 | |||
122 | ------------------------------------------------------------------------------- |
||
123 | -- Wrapper for UIDropDownMenu_Initialize() that sets 'this' before calling |
||
124 | -- UIDropDownMenu_Initialize(). |
||
125 | ------------------------------------------------------------------------------- |
||
126 | function AuctioneerDropDownMenu_Initialize(dropdown, func) |
||
127 | -- Hide all the buttons to prevent any calls to Hide() inside |
||
128 | -- UIDropDownMenu_Initialize() which will screw up the value of this. |
||
129 | local button, dropDownList; |
||
130 | for i = 1, UIDROPDOWNMENU_MAXLEVELS, 1 do |
||
131 | dropDownList = getglobal("DropDownList"..i); |
||
132 | if ( i >= UIDROPDOWNMENU_MENU_LEVEL or frame:GetName() ~= UIDROPDOWNMENU_OPEN_MENU ) then |
||
133 | dropDownList.numButtons = 0; |
||
134 | dropDownList.maxWidth = 0; |
||
135 | for j=1, UIDROPDOWNMENU_MAXBUTTONS, 1 do |
||
136 | button = getglobal("DropDownList"..i.."Button"..j); |
||
137 | button:Hide(); |
||
138 | end |
||
139 | end |
||
140 | end |
||
141 | |||
142 | -- Call the UIDropDownMenu_Initialize() after swapping in a value for 'this'. |
||
143 | local oldThis = this; |
||
144 | this = getglobal(dropdown:GetName().."Button"); |
||
145 | local newThis = this; |
||
146 | UIDropDownMenu_Initialize(dropdown, func); |
||
147 | -- Double check that the value of 'this' didn't change... this can screw us |
||
148 | -- up and prevent the reason for this method! |
||
149 | if (newThis ~= this) then |
||
150 | EnhTooltip.DebugPrint("WARNING: The value of this changed during UIDropDownMenu_Initialize()"); |
||
151 | end |
||
152 | this = oldThis; |
||
153 | end |