if ( IsModifiedClick() ) then
MerchantItemButton_OnModifiedClick(self, button);
else
MerchantItemButton_OnClick(self, button);
end
MerchantItemButton_OnLoad(self);
MerchantItemButton_OnClick(self, "LeftButton");
MerchantItemButton_OnEnter(self, motion);
GameTooltip:Hide();
ResetCursor();
MerchantFrame.itemHover = nil;
if ( self.hasStackSplit == 1 ) then
StackSplitFrame:Hide();
end
SmallMoneyFrame_OnLoad(self);
MoneyFrame_SetType(self, "STATIC");
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
local repairAllCost, canRepair = GetRepairAllCost();
if ( canRepair and (repairAllCost > 0) ) then
GameTooltip:SetText(REPAIR_ALL_ITEMS);
SetTooltipMoney(GameTooltip, repairAllCost);
end
GameTooltip:Show();
RepairAllItems();
PlaySound("ITEM_REPAIR");
GameTooltip:Hide();
local _, canRepair = GetRepairAllCost();
if ( not canRepair ) then
SetDesaturation(MerchantRepairAllIcon, 1);
SetDesaturation(MerchantGuildBankRepairButtonIcon, 1);
MerchantGuildBankRepairButton:Disable();
self:Disable();
else
SetDesaturation(MerchantRepairAllIcon, nil);
SetDesaturation(MerchantGuildBankRepairButtonIcon, nil);
self:Enable();
MerchantGuildBankRepairButton:Enable();
end
self:RegisterEvent("UPDATE_INVENTORY_DURABILITY");
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(REPAIR_AN_ITEM);
if ( InRepairMode() ) then
MerchantFrame:UnregisterEvent("PLAYER_MONEY");
HideRepairCursor();
else
MerchantFrame:RegisterEvent("PLAYER_MONEY");
ShowRepairCursor();
end
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
local repairAllCost, canRepair = GetRepairAllCost();
if ( canRepair and (repairAllCost > 0) ) then
GameTooltip:SetText(REPAIR_ALL_ITEMS);
SetTooltipMoney(GameTooltip, repairAllCost);
local amount = GetGuildBankWithdrawMoney();
local guildBankMoney = GetGuildBankMoney();
if ( amount == -1 ) then
-- Guild leader shows full guild bank amount
amount = guildBankMoney;
else
amount = min(amount, guildBankMoney);
end
GameTooltip:AddLine(GUILDBANK_REPAIR, nil, nil, nil, 1);
SetTooltipMoney(GameTooltip, amount, "GUILD_REPAIR");
GameTooltip:Show();
end
--FIXME!!! Need actual amount of guild money left to withdraw
if(CanGuildBankRepair()) then
RepairAllItems(1);
PlaySound("ITEM_REPAIR");
end
GameTooltip:Hide();
local _, canRepair = GetRepairAllCost();
if ( not canRepair ) then
SetDesaturation(MerchantRepairAllIcon, 1);
SetDesaturation(MerchantGuildBankRepairButtonIcon, 1);
MerchantGuildBankRepairButton:Disable();
MerchantRepairAllButton:Disable();
else
SetDesaturation(MerchantRepairAllIcon, nil);
SetDesaturation(MerchantGuildBankRepairButtonIcon, nil);
self:Enable();
MerchantRepairAllButton:Enable();
end
self:RegisterEvent("UPDATE_INVENTORY_DURABILITY");
if ( event == "MERCHANT_UPDATE" ) then
if ( GameTooltip:IsOwned(self) ) then
GameTooltip:SetBuybackItem(GetNumBuybackItems());
GameTooltip:Show();
end
end
BuybackItem(GetNumBuybackItems());
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetBuybackItem(GetNumBuybackItems());
ShowMerchantSellCursor(self:GetID());
SmallMoneyFrame_OnLoad(self);
MoneyFrame_SetType(self, "STATIC");
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText("", 1.0,1.0,1.0 );
PanelTemplates_SetTab(MerchantFrame, self:GetID());
MerchantFrame_Update();
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText("", 1.0,1.0,1.0 );
PanelTemplates_SetTab(MerchantFrame, self:GetID());
MerchantFrame_Update();
if ( MerchantFrame.itemHover ) then
if ( IsModifiedClick("DRESSUP") ) then
ShowInspectCursor();
else
ShowMerchantSellCursor(MerchantFrame.itemHover);
end
end
if ( MerchantRepairItemButton:IsShown() ) then
if ( InRepairMode() ) then
MerchantRepairItemButton:LockHighlight();
else
MerchantRepairItemButton:UnlockHighlight();
end
end
if ( MerchantFrame.refundItem ) then
if ( ContainerFrame_GetExtendedPriceString(MerchantFrame.refundItem, MerchantFrame.refundItemEquipped)) then
-- a confirmation dialog has been shown
return;
end
end
PickupMerchantItem(0);
MerchantItemButton_OnClick(self, "LeftButton");