Make OnClick handler easier to read

This commit is contained in:
tekkub ʕ ´ᴥ` ʔ 2016-09-10 03:36:41 -06:00
parent 2eee3f45e9
commit 847478800f
1 changed files with 12 additions and 5 deletions

View File

@ -8,16 +8,23 @@ local ICONSIZE = 17
local function OnClick(self, button)
if IsAltKeyDown() and not self.AltCurrency:IsShown() then
local id = self:GetID()
local hasaltcurrency = (GetMerchantItemCostInfo(id) > 0)
if IsAltKeyDown() and not hasaltcurrency then
self:BuyItem(true)
elseif IsModifiedClick() then
HandleModifiedItemClick(GetMerchantItemLink(self:GetID()))
elseif self.AltCurrency:IsShown() then
local id = self:GetID()
HandleModifiedItemClick(GetMerchantItemLink(id))
elseif hasaltcurrency then
local link = GetMerchantItemLink(id)
self.link, self.texture = GetMerchantItemLink(id), self.icon:GetTexture()
MerchantFrame_ConfirmExtendedItemCost(self)
else self:BuyItem() end
else
self:BuyItem()
end
end