rename withing files

This commit is contained in:
Manuel Simon Hirsig
2015-09-10 19:09:05 +02:00
parent 51d12a5c4b
commit 72d723742e
12 changed files with 446 additions and 446 deletions
+129 -129
View File
@@ -1,9 +1,9 @@
auctionatorEntries = {} -- persisted
auxEntries = {} -- persisted
-----------------------------------------
local bestPriceOurStackSize
local selectedAuctionatorEntry
local selectedAuxEntry
local currentAuctionItemName = nil
local currentAuctionItemTexture = nil
@@ -18,18 +18,18 @@ local processScanResults, undercut, ItemType2AuctionClass, SubType2AuctionSubcla
-----------------------------------------
function Auctionator_Sell_OnEvent()
function Aux_Sell_OnEvent()
if event == "AUCTION_OWNED_LIST_UPDATE" then
Auctionator_OnAuctionOwnedUpdate()
Aux_OnAuctionOwnedUpdate()
end
end
-----------------------------------------
function Auctionator_AuctionFrameAuctions_Update()
Auctionator.orig.AuctionFrameAuctions_Update()
if PanelTemplates_GetSelectedTab(AuctionFrame) == Auctionator.tabs.sell.index and AuctionFrame:IsShown() then
Auctionator_HideElems(Auctionator.tabs.sell.hiddenElements)
function Aux_AuctionFrameAuctions_Update()
Aux.orig.AuctionFrameAuctions_Update()
if PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.sell.index and AuctionFrame:IsShown() then
Aux_HideElems(Aux.tabs.sell.hiddenElements)
end
end
@@ -38,114 +38,114 @@ end
-- that we can note the auction values
-----------------------------------------
function Auctionator_AuctionsCreateAuctionButton_OnClick()
if PanelTemplates_GetSelectedTab(AuctionFrame) == Auctionator.tabs.sell.index and AuctionFrame:IsShown() then
function Aux_AuctionsCreateAuctionButton_OnClick()
if PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.sell.index and AuctionFrame:IsShown() then
lastBuyoutPrice = MoneyInputFrame_GetCopper(BuyoutPrice)
lastItemPosted = currentAuctionItemName
end
Auctionator.orig.AuctionsCreateAuctionButton_OnClick()
Aux.orig.AuctionsCreateAuctionButton_OnClick()
end
-----------------------------------------
function Auctionator_OnAuctionOwnedUpdate()
function Aux_OnAuctionOwnedUpdate()
if lastItemPosted then
Auctionator_Recommend_Text:SetText("Auction Created for "..lastItemPosted)
Aux_Recommend_Text:SetText("Auction Created for "..lastItemPosted)
MoneyFrame_Update("Auctionator_RecommendPerStack_Price", lastBuyoutPrice)
MoneyFrame_Update("Aux_RecommendPerStack_Price", lastBuyoutPrice)
Auctionator_RecommendPerStack_Price:Show()
Auctionator_RecommendPerItem_Price:Hide()
Auctionator_RecommendPerItem_Text:Hide()
Auctionator_Recommend_Basis_Text:Hide()
Aux_RecommendPerStack_Price:Show()
Aux_RecommendPerItem_Price:Hide()
Aux_RecommendPerItem_Text:Hide()
Aux_Recommend_Basis_Text:Hide()
end
end
-----------------------------------------
function Auctionator_AuctionSellItemButton_OnEvent()
Auctionator.orig.AuctionSellItemButton_OnEvent()
Auctionator_OnNewAuctionUpdate()
function Aux_AuctionSellItemButton_OnEvent()
Aux.orig.AuctionSellItemButton_OnEvent()
Aux_OnNewAuctionUpdate()
end
-----------------------------------------
function Auctionator_SetupHookFunctions()
function Aux_SetupHookFunctions()
Auctionator.orig.BrowseButton_OnClick = BrowseButton_OnClick
BrowseButton_OnClick = Auctionator_BrowseButton_OnClick
Aux.orig.BrowseButton_OnClick = BrowseButton_OnClick
BrowseButton_OnClick = Aux_BrowseButton_OnClick
BrowseButton1:RegisterForClicks("LeftButtonUp", "RightButtonDown")
BrowseButton1:SetScript("OnMouseDown", Auctionator_BrowseButton_OnMouseDown)
BrowseButton1:SetScript("OnMouseDown", Aux_BrowseButton_OnMouseDown)
BrowseButton2:RegisterForClicks("LeftButtonUp", "RightButtonDown")
BrowseButton2:SetScript("OnMouseDown", Auctionator_BrowseButton_OnMouseDown)
BrowseButton2:SetScript("OnMouseDown", Aux_BrowseButton_OnMouseDown)
BrowseButton3:RegisterForClicks("LeftButtonUp", "RightButtonDown")
BrowseButton3:SetScript("OnMouseDown", Auctionator_BrowseButton_OnMouseDown)
BrowseButton3:SetScript("OnMouseDown", Aux_BrowseButton_OnMouseDown)
BrowseButton4:RegisterForClicks("LeftButtonUp", "RightButtonDown")
BrowseButton4:SetScript("OnMouseDown", Auctionator_BrowseButton_OnMouseDown)
BrowseButton4:SetScript("OnMouseDown", Aux_BrowseButton_OnMouseDown)
BrowseButton5:RegisterForClicks("LeftButtonUp", "RightButtonDown")
BrowseButton5:SetScript("OnMouseDown", Auctionator_BrowseButton_OnMouseDown)
BrowseButton5:SetScript("OnMouseDown", Aux_BrowseButton_OnMouseDown)
BrowseButton6:RegisterForClicks("LeftButtonUp", "RightButtonDown")
BrowseButton6:SetScript("OnMouseDown", Auctionator_BrowseButton_OnMouseDown)
BrowseButton6:SetScript("OnMouseDown", Aux_BrowseButton_OnMouseDown)
BrowseButton7:RegisterForClicks("LeftButtonUp", "RightButtonDown")
BrowseButton7:SetScript("OnMouseDown", Auctionator_BrowseButton_OnMouseDown)
BrowseButton7:SetScript("OnMouseDown", Aux_BrowseButton_OnMouseDown)
BrowseButton8:RegisterForClicks("LeftButtonUp", "RightButtonDown")
BrowseButton8:SetScript("OnMouseDown", Auctionator_BrowseButton_OnMouseDown)
BrowseButton8:SetScript("OnMouseDown", Aux_BrowseButton_OnMouseDown)
Auctionator.orig.AuctionSellItemButton_OnEvent = AuctionSellItemButton_OnEvent
AuctionSellItemButton_OnEvent = Auctionator_AuctionSellItemButton_OnEvent
Aux.orig.AuctionSellItemButton_OnEvent = AuctionSellItemButton_OnEvent
AuctionSellItemButton_OnEvent = Aux_AuctionSellItemButton_OnEvent
Auctionator.orig.AuctionFrameTab_OnClick = AuctionFrameTab_OnClick
AuctionFrameTab_OnClick = Auctionator_AuctionFrameTab_OnClick
Aux.orig.AuctionFrameTab_OnClick = AuctionFrameTab_OnClick
AuctionFrameTab_OnClick = Aux_AuctionFrameTab_OnClick
Auctionator.orig.ContainerFrameItemButton_OnClick = ContainerFrameItemButton_OnClick
ContainerFrameItemButton_OnClick = Auctionator_ContainerFrameItemButton_OnClick
Aux.orig.ContainerFrameItemButton_OnClick = ContainerFrameItemButton_OnClick
ContainerFrameItemButton_OnClick = Aux_ContainerFrameItemButton_OnClick
Auctionator.orig.AuctionFrameAuctions_Update = AuctionFrameAuctions_Update
AuctionFrameAuctions_Update = Auctionator_AuctionFrameAuctions_Update
Aux.orig.AuctionFrameAuctions_Update = AuctionFrameAuctions_Update
AuctionFrameAuctions_Update = Aux_AuctionFrameAuctions_Update
Auctionator.orig.AuctionsCreateAuctionButton_OnClick = AuctionsCreateAuctionButton_OnClick
AuctionsCreateAuctionButton_OnClick = Auctionator_AuctionsCreateAuctionButton_OnClick
Aux.orig.AuctionsCreateAuctionButton_OnClick = AuctionsCreateAuctionButton_OnClick
AuctionsCreateAuctionButton_OnClick = Aux_AuctionsCreateAuctionButton_OnClick
end
-----------------------------------------
function Auctionator_SetMessage(msg)
Auctionator_HideElems(Auctionator.tabs.sell.shownElements)
AuctionatorMessage:SetText(msg)
AuctionatorMessage:Show()
AuctionatorBuyMessage:SetText(msg) -- TODO doesn't belong here
AuctionatorBuyMessage:Show()
function Aux_SetMessage(msg)
Aux_HideElems(Aux.tabs.sell.shownElements)
AuxMessage:SetText(msg)
AuxMessage:Show()
AuxBuyMessage:SetText(msg) -- TODO doesn't belong here
AuxBuyMessage:Show()
end
-----------------------------------------
function Auctionator_SelectAuctionatorEntry()
function Aux_SelectAuxEntry()
if not currentAuctionItemName or not auctionatorEntries[currentAuctionItemName] then
selectedAuctionatorEntry = nil
if not currentAuctionItemName or not auxEntries[currentAuctionItemName] then
selectedAuxEntry = nil
else
local bestPrice = {} -- a table with one entry per stacksize that is the cheapest auction for that particular stacksize
local absoluteBest -- the overall cheapest auction
----- find the best price per stacksize and overall -----
for _,auctionatorEntry in ipairs(auctionatorEntries[currentAuctionItemName]) do
if not bestPrice[auctionatorEntry.stackSize] or bestPrice[auctionatorEntry.stackSize].itemPrice >= auctionatorEntry.itemPrice then
bestPrice[auctionatorEntry.stackSize] = auctionatorEntry
for _,auxEntry in ipairs(auxEntries[currentAuctionItemName]) do
if not bestPrice[auxEntry.stackSize] or bestPrice[auxEntry.stackSize].itemPrice >= auxEntry.itemPrice then
bestPrice[auxEntry.stackSize] = auxEntry
end
if not absoluteBest or absoluteBest.itemPrice > auctionatorEntry.itemPrice then
absoluteBest = auctionatorEntry
if not absoluteBest or absoluteBest.itemPrice > auxEntry.itemPrice then
absoluteBest = auxEntry
end
end
selectedAuctionatorEntry = absoluteBest
selectedAuxEntry = absoluteBest
if bestPrice[currentAuctionItemStackSize] then
selectedAuctionatorEntry = bestPrice[currentAuctionItemStackSize]
selectedAuxEntry = bestPrice[currentAuctionItemStackSize]
bestPriceOurStackSize = bestPrice[currentAuctionItemStackSize]
end
end
@@ -153,128 +153,128 @@ end
-----------------------------------------
function Auctionator_UpdateRecommendation()
function Aux_UpdateRecommendation()
if not currentAuctionItemName then
AuctionatorSellRefreshButton:Disable()
Auctionator_SetMessage("Drag an item to the Auction Item area\n\nto see recommended pricing information")
AuxSellRefreshButton:Disable()
Aux_SetMessage("Drag an item to the Auction Item area\n\nto see recommended pricing information")
else
AuctionatorSellRefreshButton:Enable()
AuxSellRefreshButton:Enable()
if selectedAuctionatorEntry then
local newBuyoutPrice = selectedAuctionatorEntry.itemPrice * currentAuctionItemStackSize
if selectedAuxEntry then
local newBuyoutPrice = selectedAuxEntry.itemPrice * currentAuctionItemStackSize
if selectedAuctionatorEntry.numYours < selectedAuctionatorEntry.count then
if selectedAuxEntry.numYours < selectedAuxEntry.count then
newBuyoutPrice = undercut(newBuyoutPrice)
end
local newStartPrice = newBuyoutPrice * 0.95
AuctionatorMessage:Hide()
Auctionator_ShowElems(Auctionator.tabs.sell.shownElements)
AuxMessage:Hide()
Aux_ShowElems(Aux.tabs.sell.shownElements)
Auctionator_Recommend_Text:SetText("Recommended Buyout Price")
Auctionator_RecommendPerStack_Text:SetText("for your stack of "..currentAuctionItemStackSize)
Aux_Recommend_Text:SetText("Recommended Buyout Price")
Aux_RecommendPerStack_Text:SetText("for your stack of "..currentAuctionItemStackSize)
if currentAuctionItemTexture then
Auctionator_RecommendItem_Tex:SetNormalTexture(currentAuctionItemTexture)
Aux_RecommendItem_Tex:SetNormalTexture(currentAuctionItemTexture)
if currentAuctionItemStackSize > 1 then
Auctionator_RecommendItem_TexCount:SetText(currentAuctionItemStackSize)
Auctionator_RecommendItem_TexCount:Show()
Aux_RecommendItem_TexCount:SetText(currentAuctionItemStackSize)
Aux_RecommendItem_TexCount:Show()
else
Auctionator_RecommendItem_TexCount:Hide()
Aux_RecommendItem_TexCount:Hide()
end
else
Auctionator_RecommendItem_Tex:Hide()
Aux_RecommendItem_Tex:Hide()
end
MoneyFrame_Update("Auctionator_RecommendPerItem_Price", Auctionator_Round(newBuyoutPrice / currentAuctionItemStackSize))
MoneyFrame_Update("Auctionator_RecommendPerStack_Price", Auctionator_Round(newBuyoutPrice))
MoneyFrame_Update("Aux_RecommendPerItem_Price", Aux_Round(newBuyoutPrice / currentAuctionItemStackSize))
MoneyFrame_Update("Aux_RecommendPerStack_Price", Aux_Round(newBuyoutPrice))
MoneyInputFrame_SetCopper(BuyoutPrice, newBuyoutPrice)
MoneyInputFrame_SetCopper(StartPrice, newStartPrice)
if selectedAuctionatorEntry.stackSize == auctionatorEntries[currentAuctionItemName][1].stackSize and selectedAuctionatorEntry.buyoutPrice == auctionatorEntries[currentAuctionItemName][1].buyoutPrice then
Auctionator_Recommend_Basis_Text:SetText("(based on cheapest)")
elseif bestPriceOurStackSize and selectedAuctionatorEntry.stackSize == bestPriceOurStackSize.stackSize and selectedAuctionatorEntry.buyoutPrice == bestPriceOurStackSize.buyoutPrice then
Auctionator_Recommend_Basis_Text:SetText("(based on cheapest stack of the same size)")
if selectedAuxEntry.stackSize == auxEntries[currentAuctionItemName][1].stackSize and selectedAuxEntry.buyoutPrice == auxEntries[currentAuctionItemName][1].buyoutPrice then
Aux_Recommend_Basis_Text:SetText("(based on cheapest)")
elseif bestPriceOurStackSize and selectedAuxEntry.stackSize == bestPriceOurStackSize.stackSize and selectedAuxEntry.buyoutPrice == bestPriceOurStackSize.buyoutPrice then
Aux_Recommend_Basis_Text:SetText("(based on cheapest stack of the same size)")
else
Auctionator_Recommend_Basis_Text:SetText("(based on auction selected below)")
Aux_Recommend_Basis_Text:SetText("(based on auction selected below)")
end
elseif auctionatorEntries[currentAuctionItemName] then
Auctionator_SetMessage("No auctions were found for \n\n"..currentAuctionItemName)
elseif auxEntries[currentAuctionItemName] then
Aux_SetMessage("No auctions were found for \n\n"..currentAuctionItemName)
else
Auctionator_HideElems(Auctionator.tabs.sell.shownElements)
Aux_HideElems(Aux.tabs.sell.shownElements)
end
end
Auctionator_ScrollbarUpdate()
Aux_ScrollbarUpdate()
end
-----------------------------------------
function Auctionator_OnNewAuctionUpdate()
function Aux_OnNewAuctionUpdate()
if PanelTemplates_GetSelectedTab(AuctionFrame) ~= Auctionator.tabs.sell.index then
if PanelTemplates_GetSelectedTab(AuctionFrame) ~= Aux.tabs.sell.index then
return
end
if not Auctionator_Scan_IsIdle() then
Auctionator_Scan_Abort()
if not Aux_Scan_IsIdle() then
Aux_Scan_Abort()
end
currentAuctionItemName, currentAuctionItemTexture, currentAuctionItemStackSize = GetAuctionSellItemInfo()
if currentAuctionItemName and not auctionatorEntries[currentAuctionItemName] then
Auctionator_RefreshEntries()
if currentAuctionItemName and not auxEntries[currentAuctionItemName] then
Aux_RefreshEntries()
end
Auctionator_SelectAuctionatorEntry()
Auctionator_UpdateRecommendation()
Aux_SelectAuxEntry()
Aux_UpdateRecommendation()
end
-----------------------------------------
function Auctionator_RefreshEntries()
auctionatorEntries[currentAuctionItemName] = nil
selectedAuctionatorEntry = nil
function Aux_RefreshEntries()
auxEntries[currentAuctionItemName] = nil
selectedAuxEntry = nil
local sName, sLink, iRarity, iLevel, iMinLevel, sType, sSubType, iStackCount = GetItemInfo(currentAuctionItemName)
local currentAuctionClass = ItemType2AuctionClass(sType)
local currentAuctionSubclass = nil -- SubType2AuctionSubclass(currentAuctionClass, sSubType)
Auctionator_Scan_Start{
query = Auctionator_Scan_CreateQuery{
Aux_Scan_Start{
query = Aux_Scan_CreateQuery{
name = currentAuctionItemName,
classIndex = currentAuctionClass,
subclassIndex = currentAuctionSubclass
},
onComplete = function(data)
processScanResults(data, currentAuctionItemName)
Auctionator_SelectAuctionatorEntry()
Auctionator_UpdateRecommendation()
Aux_SelectAuxEntry()
Aux_UpdateRecommendation()
end
}
end
-----------------------------------------
function Auctionator_ScrollbarUpdate()
function Aux_ScrollbarUpdate()
local numrows
if not currentAuctionItemName or not auctionatorEntries[currentAuctionItemName] then
if not currentAuctionItemName or not auxEntries[currentAuctionItemName] then
numrows = 0
else
numrows = getn(auctionatorEntries[currentAuctionItemName])
numrows = getn(auxEntries[currentAuctionItemName])
end
FauxScrollFrame_Update(AuctionatorScrollFrame, numrows, 12, 16);
FauxScrollFrame_Update(AuxScrollFrame, numrows, 12, 16);
for line = 1,12 do
local dataOffset = line + FauxScrollFrame_GetOffset(AuctionatorScrollFrame)
local lineEntry = getglobal("AuctionatorSellEntry"..line)
local dataOffset = line + FauxScrollFrame_GetOffset(AuxScrollFrame)
local lineEntry = getglobal("AuxSellEntry"..line)
if numrows <= 12 then
lineEntry:SetWidth(603)
@@ -284,15 +284,15 @@ function Auctionator_ScrollbarUpdate()
lineEntry:SetID(dataOffset)
if currentAuctionItemName and dataOffset <= numrows and auctionatorEntries[currentAuctionItemName] then
if currentAuctionItemName and dataOffset <= numrows and auxEntries[currentAuctionItemName] then
local entry = auctionatorEntries[currentAuctionItemName][dataOffset]
local entry = auxEntries[currentAuctionItemName][dataOffset]
local lineEntry_avail = getglobal("AuctionatorSellEntry"..line.."_Availability")
local lineEntry_comm = getglobal("AuctionatorSellEntry"..line.."_Comment")
local lineEntry_stack = getglobal("AuctionatorSellEntry"..line.."_StackPrice")
local lineEntry_avail = getglobal("AuxSellEntry"..line.."_Availability")
local lineEntry_comm = getglobal("AuxSellEntry"..line.."_Comment")
local lineEntry_stack = getglobal("AuxSellEntry"..line.."_StackPrice")
if selectedAuctionatorEntry and entry.itemPrice == selectedAuctionatorEntry.itemPrice and entry.stackSize == selectedAuctionatorEntry.stackSize then
if selectedAuxEntry and entry.itemPrice == selectedAuxEntry.itemPrice and entry.stackSize == selectedAuxEntry.stackSize then
lineEntry:LockHighlight()
else
lineEntry:UnlockHighlight()
@@ -313,11 +313,11 @@ function Auctionator_ScrollbarUpdate()
lineEntry_comm:SetText("yours: "..entry.numYours)
end
local tx = string.format("%i %s of %i", entry.count, Auctionator_PluralizeIf("stack", entry.count), entry.stackSize)
local tx = string.format("%i %s of %i", entry.count, Aux_PluralizeIf("stack", entry.count), entry.stackSize)
lineEntry_avail:SetText(tx)
MoneyFrame_Update("AuctionatorSellEntry"..line.."_UnitPrice", Auctionator_Round(entry.buyoutPrice/entry.stackSize))
MoneyFrame_Update("AuctionatorSellEntry"..line.."_TotalPrice", Auctionator_Round(entry.buyoutPrice))
MoneyFrame_Update("AuxSellEntry"..line.."_UnitPrice", Aux_Round(entry.buyoutPrice/entry.stackSize))
MoneyFrame_Update("AuxSellEntry"..line.."_TotalPrice", Aux_Round(entry.buyoutPrice))
lineEntry:Show()
else
@@ -328,30 +328,30 @@ end
-----------------------------------------
function AuctionatorSellEntry_OnClick()
function AuxSellEntry_OnClick()
local entryIndex = this:GetID()
selectedAuctionatorEntry = auctionatorEntries[currentAuctionItemName][entryIndex]
selectedAuxEntry = auxEntries[currentAuctionItemName][entryIndex]
Auctionator_UpdateRecommendation()
Aux_UpdateRecommendation()
PlaySound("igMainMenuOptionCheckBoxOn")
end
-----------------------------------------
function AuctionatorSellRefreshButton_OnClick()
if not Auctionator_Scan_IsIdle() then
Auctionator_Scan_Abort()
function AuxSellRefreshButton_OnClick()
if not Aux_Scan_IsIdle() then
Aux_Scan_Abort()
end
Auctionator_RefreshEntries()
Auctionator_SelectAuctionatorEntry()
Auctionator_UpdateRecommendation()
Aux_RefreshEntries()
Aux_SelectAuxEntry()
Aux_UpdateRecommendation()
end
-----------------------------------------
function AuctionatorMoneyFrame_OnLoad()
function AuxMoneyFrame_OnLoad()
this.small = 1
SmallMoneyFrame_OnLoad()
MoneyFrame_SetType("AUCTION")
@@ -366,7 +366,7 @@ end
function processScanResults(rawData, auctionItemName)
auctionatorEntries[auctionItemName] = {}
auxEntries[auctionItemName] = {}
----- Condense the scan rawData into a table that has only a single entry per stacksize/price combo
@@ -394,11 +394,11 @@ function processScanResults(rawData, auctionItemName)
local n = 1
for _,condDatum in pairs(condData) do
auctionatorEntries[auctionItemName][n] = condDatum
auxEntries[auctionItemName][n] = condDatum
n = n + 1
end
table.sort(auctionatorEntries[auctionItemName], function(a,b) return a.itemPrice < b.itemPrice end)
table.sort(auxEntries[auctionItemName], function(a,b) return a.itemPrice < b.itemPrice end)
end
-----------------------------------------
@@ -421,7 +421,7 @@ function ItemType2AuctionClass(itemType)
end
end
else
Auctionator_Log("Can't GetAuctionItemClasses")
Aux_Log("Can't GetAuctionItemClasses")
end
end