This commit is contained in:
Andrew6810
2023-03-30 12:32:45 -07:00
parent f3e579cb57
commit d6aaac97af
53 changed files with 2930 additions and 1307 deletions
+71 -46
View File
@@ -51,12 +51,22 @@ function private:CreateStartScanContent(parent)
frame:SetAllPoints(parent)
frame:Hide()
-- Don't create or handle the GetAll button if player has disabled GetAll.
-- NOTE: This GUI creation is only done once per game reload, so this choice
-- won't change until the user does a UI "/reload" or logs out of the game.
local includeGetAll = not TSM.db.profile.disableGetAll
local function UpdateGetAllButton()
if not frame.startGetAllButton then
return -- Do nothing if the GetAll feature is disabled.
end
if TSM.Scan.isScanning then
frame:Disable()
elseif not select(2, CanSendAuctionQuery()) then
-- Server says that GetAll isn't ready. Check our stored cooldown value.
local previous = TSM.db.profile.lastGetAll or time()
if previous > (time() - 15*60) then
if previous > (time() - 15*60) then -- 15 minute enforced cooldown between GetAll scans...
local diff = previous + 15*60 - time()
local diffMin = math.floor(diff/60)
local diffSec = diff - diffMin*60
@@ -67,33 +77,36 @@ function private:CreateStartScanContent(parent)
frame:Enable()
frame.startGetAllButton:Disable()
else
-- Server says that GetAll is ready.
frame:Enable()
frame.getAllStatusText:SetText("|cff009900"..L["Ready"])
frame.startGetAllButton:Enable()
end
end
frame:SetScript("OnShow", function(self)
if includeGetAll then
frame:SetScript("OnShow", function(self)
TSMAPI:CreateTimeDelay("auctionDBGetAllStatus", 0, UpdateGetAllButton, 0.2)
end)
frame:SetScript("OnHide", function(self)
frame:SetScript("OnHide", function(self)
TSMAPI:CancelFrame("auctionDBGetAllStatus")
end)
end
frame.Enable = function(self)
self.startGetAllButton:Enable()
if self.startGetAllButton then self.startGetAllButton:Enable() end
self.startFullScanButton:Enable()
self.startGroupScanButton:Enable()
end
frame.Disable = function(self)
self.startGetAllButton:Disable()
if self.startGetAllButton then self.startGetAllButton:Disable() end
self.startFullScanButton:Disable()
self.startGroupScanButton:Disable()
end
-- top row (auto updater)
-- Top row: Auto updater.
local text = TSMAPI.GUI:CreateLabel(frame)
text:SetFont(TSMAPI.Design:GetContentFont(), 24)
text:SetPoint("TOP", 0, -24)
@@ -107,69 +120,81 @@ function private:CreateStartScanContent(parent)
a1:SetDuration(.5)
ag:SetLooping("BOUNCE")
ag:Play()
local content = CreateFrame("Frame", nil, frame)
content:SetAllPoints(parent.content)
TSMAPI.Design:SetFrameBackdropColor(content)
-- group tree
-- Group tree.
local container = CreateFrame("Frame", nil, content)
container:SetPoint("TOPLEFT", 5, -35)
container:SetPoint("BOTTOMRIGHT", -205, 5)
TSMAPI.Design:SetFrameColor(container)
frame.groupTree = TSMAPI:CreateGroupTree(container, nil, "AuctionDB")
local bar = TSMAPI.GUI:CreateVerticalLine(content, 0)
bar:ClearAllPoints()
bar:SetPoint("TOPRIGHT", -200, -30)
bar:SetPoint("BOTTOMRIGHT", -200, 0)
local buttonFrame = CreateFrame("Frame", nil, content)
buttonFrame:SetPoint("TOPLEFT", content, "TOPRIGHT", -200, 0)
buttonFrame:SetPoint("BOTTOMRIGHT")
-- first row (getall scan)
-- Row: GetAll Scan.
-- NOTE: We hide this button if the player has disabled GetAll scans.
local yOffset = -50
if includeGetAll then
local btn = TSMAPI.GUI:CreateButton(buttonFrame, 18)
btn:SetPoint("TOPLEFT", 6, yOffset)
btn:SetPoint("TOPRIGHT", -6, yOffset)
btn:SetHeight(22)
btn:SetScript("OnClick", TSM.Scan.StartGetAllScan)
btn:SetText(L["Run GetAll Scan"])
btn.tooltip = L["A GetAll scan is the fastest in-game method for scanning every item on the auction house. However, there are many possible bugs on Blizzard's end with it including the chance for it to disconnect you from the game. Also, it has a 15 minute cooldown. You can disable the GetAll button via TSM's AuctionDB options if this feature doesn't work well on your server."]
frame.startGetAllButton = btn
local text = TSMAPI.GUI:CreateLabel(buttonFrame)
text:SetPoint("TOPLEFT", btn, "BOTTOMLEFT", 0, -3)
text:SetPoint("TOPRIGHT", btn, "BOTTOMRIGHT", 0, -3)
text:SetHeight(16)
text:SetJustifyH("CENTER")
text:SetJustifyV("CENTER")
frame.getAllStatusText = text
yOffset = yOffset - 50
TSMAPI.GUI:CreateHorizontalLine(buttonFrame, yOffset)
yOffset = yOffset - 20
end
-- Row: Full Scan.
local btn = TSMAPI.GUI:CreateButton(buttonFrame, 18)
btn:SetPoint("TOPLEFT", 6, -50)
btn:SetPoint("TOPRIGHT", -6, -50)
btn:SetHeight(22)
btn:SetScript("OnClick", TSM.Scan.StartGetAllScan)
btn:SetText(L["Run GetAll Scan"])
btn.tooltip = L["A GetAll scan is the fastest in-game method for scanning every item on the auction house. However, there are many possible bugs on Blizzard's end with it including the chance for it to disconnect you from the game. Also, it has a 15 minute cooldown."]
frame.startGetAllButton = btn
local text = TSMAPI.GUI:CreateLabel(buttonFrame)
text:SetPoint("TOPLEFT", btn, "BOTTOMLEFT", 0, -3)
text:SetPoint("TOPRIGHT", btn, "BOTTOMRIGHT", 0, -3)
text:SetHeight(16)
text:SetJustifyH("CENTER")
text:SetJustifyV("CENTER")
frame.getAllStatusText = text
TSMAPI.GUI:CreateHorizontalLine(buttonFrame, -110)
-- second row (full scan)
local btn = TSMAPI.GUI:CreateButton(buttonFrame, 18)
btn:SetPoint("TOPLEFT", 6, -150)
btn:SetPoint("TOPRIGHT", -6, -150)
btn:SetPoint("TOPLEFT", 6, yOffset)
btn:SetPoint("TOPRIGHT", -6, yOffset)
btn:SetHeight(22)
btn:SetScript("OnClick", TSM.Scan.StartFullScan)
btn:SetText(L["Run Full Scan"])
btn.tooltip = L["A full auction house scan will scan every item on the auction house but is far slower than a GetAll scan. Expect this scan to take several minutes or longer."]
frame.startFullScanButton = btn
TSMAPI.GUI:CreateHorizontalLine(buttonFrame, -200)
-- third row (group scan)
yOffset = yOffset - 40
TSMAPI.GUI:CreateHorizontalLine(buttonFrame, yOffset)
yOffset = yOffset - 20
-- Row: Group Scan.
local btn = TSMAPI.GUI:CreateButton(buttonFrame, 18)
btn:SetPoint("TOPLEFT", 6, -225)
btn:SetPoint("TOPRIGHT", -6, -225)
btn:SetPoint("TOPLEFT", 6, yOffset)
btn:SetPoint("TOPRIGHT", -6, yOffset)
btn:SetHeight(22)
btn:SetScript("OnClick", GUI.StartGroupScan)
btn:SetText(L["Scan Selected Groups"])
btn.tooltip = L["This will do a slow auction house scan of every item in the selected groups and update their AuctionDB prices. This may take several minutes."]
frame.startGroupScanButton = btn
return frame
end