From dea974ac39186aa0807d262cc5bf5ff48341e809 Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Fri, 2 Oct 2015 08:50:23 +0200 Subject: [PATCH] some controlflow utils --- buy.lua | 67 +++++++++++++++++++++++++-------------- buy.xml | 90 ++++++++++++++++++++++++++++++++++++++++++++--------- control.lua | 61 ++++++++++++++++++++++++++++++++++++ control.xml | 0 4 files changed, 179 insertions(+), 39 deletions(-) create mode 100644 control.lua create mode 100644 control.xml diff --git a/buy.lua b/buy.lua index 5c7eae7..37710f3 100644 --- a/buy.lua +++ b/buy.lua @@ -1,6 +1,6 @@ Aux.buy = {} -local record_auction, set_message, report, tooltip_match +local record_auction, set_message, report, tooltip_match, show_buyout_dialog, show_bid_dialog local entries local selectedEntries = {} local search_query @@ -123,6 +123,43 @@ function set_message(msg) end ----------------------------------------- +function show_buyout_dialog(hyperlink, stack_size, buyout_price) + AuxBuyBuyoutDialogBuyButton:Disable() + AuxBuyBuyoutDialogHTML:SetFontObject('h1', GameFontWhite) + AuxBuyBuyoutDialogHTML:SetScript('OnHyperlinkClick', function() SetItemRef(arg1) end) + AuxBuyBuyoutDialogHTML:SetText(string.format( + [[ + + +

%s x %i

+ + + ]], + hyperlink, + stack_size + )) + --MoneyFrame_Update('AuxBuyBuyoutDialogBuyoutPrice', Aux_Round(buyout_price)) + AuxBuyBuyoutDialog:Show() +end + +function show_bid_dialog(hyperlink, stack_size, bid) + AuxBuyBidDialogBidButton:Disable() + AuxBuyBidDialogHTML:SetFontObject('h1', GameFontWhite) + AuxBuyBidDialogHTML:SetScript('OnHyperlinkClick', function() SetItemRef(arg1) end) + AuxBuyBidDialogHTML:SetText(string.format( + [[ + + +

%s x %i

+ + + ]], + hyperlink, + stack_size + )) + AuxBuyBidDialog:Show() + MoneyInputFrame_SetCopper(AuxBuyBidDialogBid, 5) +end function AuxBuyEntry_OnClick() local express_mode = IsControlKeyDown() @@ -133,29 +170,11 @@ function AuxBuyEntry_OnClick() local entry = entries[entry_index] if not express_mode then - AuxBuyBuyoutDialogBuyButton:Disable() - AuxBuyBuyoutDialogHTML:SetText(string.format( - [[ - - -

%s

-
-

- Stack Size: %i -

- Buyout Price: %s -

- Unit Price: %s -

- - - ]], - entry.name, - entry.stack_size, - Aux.util.format_money(entry.buyout_price), - Aux.util.format_money(entry.item_price) - )) - AuxBuyBuyoutDialog:Show() + if arg1 == "LeftButton" then + show_buyout_dialog(entry.hyperlink, entry.stack_size, entry.buyout_price) + elseif arg1 == "RightButton" then + show_bid_dialog(entry.hyperlink, entry.stack_size, entry.buyout_price) + end end PlaySound("igMainMenuOptionCheckBoxOn") diff --git a/buy.xml b/buy.xml index 5c57199..577fca5 100644 --- a/buy.xml +++ b/buy.xml @@ -12,6 +12,11 @@ + + + + + + + + this:RegisterForDrag("LeftButton") + this:StartMoving() + this:StopMovingOrSizing() + + + + + + + + + + + + + + + + + + + @@ -427,11 +491,7 @@ - - - - - +