-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Juwe_ProfessionsCustomerOrders.lua
40 lines (31 loc) · 1.46 KB
/
Juwe_ProfessionsCustomerOrders.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
local _, Juwe = ...;
local Item = Item;
local PROFESSIONS_RECRAFT_ORDER_NAME_FMT = PROFESSIONS_RECRAFT_ORDER_NAME_FMT;
EventUtil.ContinueOnAddOnLoaded("Blizzard_ProfessionsCustomerOrders", function()
local Professions = Professions;
local wasFavoritesSearch = C_CraftingOrders.HasFavoriteCustomerOptions();
Juwe.CreateToggleButton(ProfessionsCustomerOrdersFrame, function()
ProfessionsCustomerOrdersFrame.BrowseOrders:StartSearch(wasFavoritesSearch);
end);
-- executes after ProfessionsCustomerTableCellItemNameMixin:Populate
local function populateHook(self, rowData, dataIndex)
local order = rowData.option;
Juwe.GetGemStats(Item:CreateFromItemID(order.itemID), function(item, stats)
local qualityColor = item:GetItemQualityColor().color;
local itemName = qualityColor:WrapTextInColorCode(stats);
if order.isRecraft then
itemName = PROFESSIONS_RECRAFT_ORDER_NAME_FMT:format(itemName);
end
if order.minQuality and order.minQuality > 1 then
itemName = itemName.." "..Professions.GetChatIconMarkupForQuality(order.minQuality, true);
end
self.Text:SetText(itemName);
end);
end
-- executes after ProfessionsCustomerOrdersBrowsePageMixin:StartSearch
local function startSearchHook(self, isFavoritesSearch)
wasFavoritesSearch = isFavoritesSearch;
end
hooksecurefunc(ProfessionsCustomerTableCellItemNameMixin, "Populate", populateHook);
hooksecurefunc(ProfessionsCustomerOrdersFrame.BrowseOrders, "StartSearch", startSearchHook);
end);