📄 auctionframepost.lua
字号:
else MoneyFrame_Update(frame.depositMoneyFrame:GetName(), 0); frame.depositMoneyFrame:Hide(); frame.depositErrorLabel:Show(); end else MoneyFrame_Update(frame.depositMoneyFrame:GetName(), 0); frame.depositMoneyFrame:Hide(); frame.depositErrorLabel:Hide(); end endend--------------------------------------------------------------------------------- Gets the item ID.-------------------------------------------------------------------------------function AuctionFramePost_GetItemID(frame) return frame.itemID;end--------------------------------------------------------------------------------- Gets the item name.-------------------------------------------------------------------------------function AuctionFramePost_GetItemName(frame) return frame.itemName;end--------------------------------------------------------------------------------- Sets the price model note (i.e. "Undercutting 5%")-------------------------------------------------------------------------------function AuctionFramePost_SetNoteText(frame, text) local cHex, cRed, cGreen, cBlue = Auctioneer.Util.GetWarnColor(text); getglobal(frame:GetName().."PriceModelNoteText"):SetText(text); getglobal(frame:GetName().."PriceModelNoteText"):SetTextColor(cRed, cGreen, cBlue);end--------------------------------------------------------------------------------- Gets whether or not to save the current price information as the fixed-- price.-------------------------------------------------------------------------------function AuctionFramePost_GetSavePrice(frame) local checkbox = getglobal(frame:GetName().."SavePriceCheckBox"); return (checkbox and checkbox:IsVisible() and checkbox:GetChecked());end--------------------------------------------------------------------------------- Gets the starting price.-------------------------------------------------------------------------------function AuctionFramePost_GetStartPrice(frame) return MoneyInputFrame_GetCopper(getglobal(frame:GetName().."StartPrice"));end--------------------------------------------------------------------------------- Sets the starting price.-------------------------------------------------------------------------------function AuctionFramePost_SetStartPrice(frame, price) frame.ignoreStartPriceChange = true; MoneyInputFrame_SetCopper(getglobal(frame:GetName().."StartPrice"), price); frame:ValidateAuction();end--------------------------------------------------------------------------------- Gets the buyout price.-------------------------------------------------------------------------------function AuctionFramePost_GetBuyoutPrice(frame) return MoneyInputFrame_GetCopper(getglobal(frame:GetName().."BuyoutPrice"));end--------------------------------------------------------------------------------- Sets the buyout price.-------------------------------------------------------------------------------function AuctionFramePost_SetBuyoutPrice(frame, price) frame.ignoreBuyoutPriceChange = true; MoneyInputFrame_SetCopper(getglobal(frame:GetName().."BuyoutPrice"), price); frame:ValidateAuction();end--------------------------------------------------------------------------------- Gets the stack size.-------------------------------------------------------------------------------function AuctionFramePost_GetStackSize(frame) return getglobal(frame:GetName().."StackSize"):GetNumber();end--------------------------------------------------------------------------------- Sets the stack size.-------------------------------------------------------------------------------function AuctionFramePost_SetStackSize(frame, size) -- Update the stack size. getglobal(frame:GetName().."StackSize"):SetNumber(size); -- Update the deposit cost. frame:UpdateDeposit(); frame:UpdatePriceModels(); frame:ValidateAuction();end--------------------------------------------------------------------------------- Gets the stack count.-------------------------------------------------------------------------------function AuctionFramePost_GetStackCount(frame) return getglobal(frame:GetName().."StackCount"):GetNumber();end--------------------------------------------------------------------------------- Sets the stack count.-------------------------------------------------------------------------------function AuctionFramePost_SetStackCount(frame, count) -- Update the stack count. getglobal(frame:GetName().."StackCount"):SetNumber(count); -- Update the deposit cost. frame:UpdateDeposit(); frame:ValidateAuction();end--------------------------------------------------------------------------------- Gets the duration.-------------------------------------------------------------------------------function AuctionFramePost_GetDuration(frame) if (getglobal(frame:GetName().."ShortAuctionRadio"):GetChecked()) then return 120; elseif(getglobal(frame:GetName().."MediumAuctionRadio"):GetChecked()) then return 480; else return 1440; endend--------------------------------------------------------------------------------- Sets the duration.-------------------------------------------------------------------------------function AuctionFramePost_SetDuration(frame, duration) local shortRadio = getglobal(frame:GetName().."ShortAuctionRadio"); local mediumRadio = getglobal(frame:GetName().."MediumAuctionRadio"); local longRadio = getglobal(frame:GetName().."LongAuctionRadio"); -- Figure out radio to set as checked. if (duration == 120) then shortRadio:SetChecked(1); mediumRadio:SetChecked(nil); longRadio:SetChecked(nil); elseif (duration == 480) then shortRadio:SetChecked(nil); mediumRadio:SetChecked(1); longRadio:SetChecked(nil); else shortRadio:SetChecked(nil); mediumRadio:SetChecked(nil); longRadio:SetChecked(1); end -- Update the deposit cost. frame:UpdateDeposit(); frame:ValidateAuction();end--------------------------------------------------------------------------------- Gets the deposit amount required to post.-------------------------------------------------------------------------------function AuctionFramePost_GetDeposit(frame) return getglobal(frame:GetName().."DepositMoneyFrame").staticMoney;end--------------------------------------------------------------------------------- Sets the item to display in the create auction frame.-------------------------------------------------------------------------------function AuctionFramePost_SetAuctionItem(frame, bag, item, count) -- Prevent validation while updating. frame.updating = true; -- Update the controls with the item. local button = getglobal(frame:GetName().."AuctionItem"); if (bag and item) then -- Get the item's information. local itemLink = GetContainerItemLink(bag, item); local itemID, randomProp, enchant, uniqueId, name = EnhTooltip.BreakLink(itemLink); local itemTexture, itemCount = GetContainerItemInfo(bag, item); if (count == nil) then count = itemCount; end -- Save the item's information. frame.itemName = name; frame.itemID = itemID; -- Show the item getglobal(button:GetName().."Name"):SetText(name); getglobal(button:GetName().."Name"):Show(); getglobal(button:GetName().."IconTexture"):SetTexture(itemTexture); getglobal(button:GetName().."IconTexture"):Show(); -- Set the defaults. local duration = Auctioneer.Command.GetFilterVal('auction-duration') if duration == 1 then -- 2h frame:SetDuration(120) elseif duration == 2 then -- 8h frame:SetDuration(480) elseif duration == 3 then -- 24h frame:SetDuration(1440) else -- last frame:SetDuration(Auctioneer.Command.GetFilterVal('last-auction-duration')) end frame:SetStackSize(count); frame:SetStackCount(1); -- Clear the current pricing model so that the default one gets selected. local dropdown = getglobal(frame:GetName().."PriceModelDropDown"); AuctionFramePost_PriceModelDropDownItem_SetSelectedID(dropdown, nil); -- Update the Transactions tab if BeanCounter is loaded. if (AuctionFrameTransactions) then AuctionFrameTransactions:SearchTransactions(name, true, nil); end else -- Clear the item's information. frame.itemName = nil; frame.itemID = nil; -- Hide the item getglobal(button:GetName().."Name"):Hide(); getglobal(button:GetName().."IconTexture"):Hide(); -- Clear the defaults. frame:SetStackSize(1); frame:SetStackCount(1); end -- Update the deposit cost and validate the auction. frame.updating = false; frame:UpdateDeposit(); frame:UpdatePriceModels(); frame:UpdateAuctionList(); frame:ValidateAuction();end--------------------------------------------------------------------------------- Validates the current auction.-------------------------------------------------------------------------------function AuctionFramePost_ValidateAuction(frame) -- Only validate if its not turned off. if (not frame.updating) then -- Check that we have an item. local valid = false; if (frame.itemID) then valid = (frame.itemID ~= nil); end -- Check that there is a starting price. local startPrice = frame:GetStartPrice(); local startErrorText = getglobal(frame:GetName().."StartPriceInvalidText"); if (startPrice == 0) then valid = false; startErrorText:Show(); else startErrorText:Hide(); end -- Check that the starting price is less than or equal to the buyout. local buyoutPrice = frame:GetBuyoutPrice(); local buyoutErrorText = getglobal(frame:GetName().."BuyoutPriceInvalidText"); if (buyoutPrice > 0 and buyoutPrice < startPrice) then valid = false; buyoutErrorText:Show(); else buyoutErrorText:Hide(); end -- Check that the item stacks to the amount specified and that the player -- has enough of the item. local stackSize = frame:GetStackSize(); local stackCount = frame:GetStackCount(); local quantityErrorText = getglobal(frame:GetName().."QuantityInvalidText"); if (frame.itemID and frame.itemName) then local quantity = AucPostManager.GetItemQuantity(frame.itemID); local maxStackSize = AuctionFramePost_GetMaxStackSize(frame.itemID); if (stackSize == 0) then valid = false; quantityErrorText:SetText(_AUCT('UiStackTooSmallError')); quantityErrorText:SetTextColor(RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b); quantityErrorText:Show(); elseif (stackSize > 1 and (maxStackSize == nil or stackSize > maxStackSize)) then valid = false; quantityErrorText:SetText(_AUCT('UiStackTooBigError')); quantityErrorText:SetTextColor(RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b); quantityErrorText:Show(); elseif (quantity < (stackSize * stackCount)) then valid = false; quantityErrorText:SetText(_AUCT('UiNotEnoughError'));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -