-
Notifications
You must be signed in to change notification settings - Fork 0
/
MerchantFrameHelper.lua
66 lines (54 loc) · 2.16 KB
/
MerchantFrameHelper.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
local RB = RetailBags
function RB:InitMerchantSell()
InitMerchant(GetMerchantItemLink, MERCHANT_ITEMS_PER_PAGE, MerchantFrame.page);
RB:InitMerchantBuyBackLast();
end
function RB:InitMerchantBuyBackList()
InitMerchant(GetBuybackItemLink, BUYBACK_ITEMS_PER_PAGE, 1);
end
function InitMerchant(func, count, pageIndex)
for slotId = 1, count do
InitMerchantSlot(func, count, pageIndex, slotId)
end
end
function InitMerchantSlot(func, count, pageIndex, slotId)
local frame = _G['MerchantItem' .. slotId .. 'ItemButton'];
if (not frame) then
return;
end
if (RB.DB.profile.displayItemQualityBorders) then
local index = ((pageIndex - 1) * count) + slotId;
local merchantItemLink = func(index);
if (merchantItemLink) then
local itemName, _, quality, itemLevel, _, _, _, stack, slot, _, sellPrice, classId, subClassId, bindType, expacID, setID, isCraftingReagent =
GetItemInfo(merchantItemLink);
if quality then
local color = ITEM_QUALITY_COLORS[quality];
_G["MerchantItem" .. slotId].Name:SetTextColor(color.r, color.g, color.b);
CreateBorder(frame, quality, classId, true);
return;
end
end
end
if (frame.RetailBagsBorder) then
frame.RetailBagsBorder:Hide();
end
end
function RB:InitMerchantBuyBackLast()
if (RB.DB.profile.displayItemQualityBorders) then
local link = GetBuybackItemLink(GetNumBuybackItems());
if (link) then
local itemName, _, quality, itemLevel, _, _, _, stack, slot, _, sellPrice, classId, subClassId, bindType, expacID, setID, isCraftingReagent =
GetItemInfo(link);
if quality then
CreateBorder(MerchantBuyBackItemItemButton, quality, classId, true);
local color = ITEM_QUALITY_COLORS[quality];
MerchantBuyBackItem.Name:SetTextColor(color.r, color.g, color.b);
return;
end
end
end
if (MerchantBuyBackItemItemButton.RetailBagsBorder) then
MerchantBuyBackItemItemButton.RetailBagsBorder:Hide();
end
end