Make OnClick handler easier to read
This commit is contained in:
parent
2eee3f45e9
commit
847478800f
|
@ -8,16 +8,23 @@ local ICONSIZE = 17
|
||||||
|
|
||||||
|
|
||||||
local function OnClick(self, button)
|
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)
|
self:BuyItem(true)
|
||||||
|
|
||||||
elseif IsModifiedClick() then
|
elseif IsModifiedClick() then
|
||||||
HandleModifiedItemClick(GetMerchantItemLink(self:GetID()))
|
HandleModifiedItemClick(GetMerchantItemLink(id))
|
||||||
elseif self.AltCurrency:IsShown() then
|
|
||||||
local id = self:GetID()
|
elseif hasaltcurrency then
|
||||||
local link = GetMerchantItemLink(id)
|
local link = GetMerchantItemLink(id)
|
||||||
self.link, self.texture = GetMerchantItemLink(id), self.icon:GetTexture()
|
self.link, self.texture = GetMerchantItemLink(id), self.icon:GetTexture()
|
||||||
MerchantFrame_ConfirmExtendedItemCost(self)
|
MerchantFrame_ConfirmExtendedItemCost(self)
|
||||||
else self:BuyItem() end
|
|
||||||
|
else
|
||||||
|
self:BuyItem()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue