disenchanting interface

-added a disenchanting interface
-it is opened by right clicking the enchanting button
This commit is contained in:
Anch
2023-10-30 03:00:38 +13:00
parent 5499501fd8
commit b3c527e464
5 changed files with 334 additions and 16 deletions
@@ -1,6 +1,6 @@
--[[
Name: Dewdrop-2.0
Revision: $Rev: 326 $
Revision: $Rev: 327 $
Author(s): ckknight (ckknight@gmail.com)
Website: http://ckknight.wowinterface.com/
Documentation: http://wiki.wowace.com/index.php/Dewdrop-2.0
@@ -11,7 +11,7 @@ License: LGPL v2.1
]]
local MAJOR_VERSION = "Dewdrop-2.0"
local MINOR_VERSION = tonumber(strmatch("$Revision: 326 $", "%d+")) + 90000
local MINOR_VERSION = tonumber(strmatch("$Revision: 327 $", "%d+")) + 90000
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
@@ -232,6 +232,7 @@ eventFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
function createSecureFrame()
if secureFrame or InCombatLockdown() then return end
secureFrame = CreateFrame("Button", nil, nil, "SecureActionButtonTemplate")
secureFrame:RegisterForClicks("AnyDown")
secureFrame:Hide()
secureFrame:SetScript("OnLeave",
@@ -243,10 +244,10 @@ secureFrame:SetScript("OnLeave",
)
secureFrame:HookScript("OnClick",
function(this)
function(this , buttonClick)
local realthis = this
this = this.owner
this:GetScript("OnClick")(this)
this:GetScript("OnClick")(this, buttonClick)
end
)
@@ -601,6 +602,7 @@ local function AcquireButton(self, level)
button = CreateFrame("Button", "Dewdrop20Button" .. numButtons, nil)
button:SetFrameStrata("FULLSCREEN_DIALOG")
button:SetHeight(16)
button:RegisterForClicks("AnyDown")
local highlight = button:CreateTexture(nil, "BACKGROUND")
highlight:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight")
button.highlight = highlight
@@ -677,7 +679,7 @@ local function AcquireButton(self, level)
GameTooltip:Hide()
end)
local first = true
button:SetScript("OnClick", function(this)
button:SetScript("OnClick", function(this, buttonClick)
if not this.disabled then
if this.hasColorSwatch then
local func = button.colorFunc
@@ -730,7 +732,39 @@ local function AcquireButton(self, level)
end
self:Close(1)
ShowUIPanel(ColorPickerFrame)
elseif this.func then
elseif this.funcRight and buttonClick == "RightButton" then
local level = this.level
if type(this.funcRight) == "string" then
if type(this.argRight1[this.funcRight]) ~= "function" then
self:error("Cannot call method %q", this.funcRight)
end
this.argRight1[this.funcRight](this.argRight1, getArgs(this, 'arg', 2))
else
this.funcRight(getArgs(this, 'arg', 1))
end
if this.closeWhenClicked then
self:Close()
elseif level:IsShown() then
for i = 1, level.num do
Refresh(self, levels[i])
end
local value = levels[level.num].value
for i = level.num-1, 1, -1 do
local level = levels[i]
local good = false
for _,button in ipairs(level.buttons) do
if button.value == value then
good = true
break
end
end
if not good then
Dewdrop:Close(i+1)
end
value = levels[i].value
end
end
elseif this.func and buttonClick == "LeftButton" then
local level = this.level
if type(this.func) == "string" then
if type(this.arg1[this.func]) ~= "function" then
@@ -762,9 +796,9 @@ local function AcquireButton(self, level)
value = levels[i].value
end
end
elseif this.closeWhenClicked then
self:Close()
end
elseif this.closeWhenClicked then
self:Close()
end
end
end)
local text = button:CreateFontString(nil, "ARTWORK")
@@ -772,12 +806,12 @@ local function AcquireButton(self, level)
text:SetFontObject(GameFontHighlightSmall)
button.text:SetFont(STANDARD_TEXT_FONT, UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT)
button:SetScript("OnMouseDown", function(this)
if not this.disabled and (this.func or this.colorFunc or this.closeWhenClicked) then
if not this.disabled and (this.func or this.funcRight or this.colorFunc or this.closeWhenClicked) then
text:SetPoint("LEFT", button, "LEFT", this.notCheckable and 1 or 25, -1)
end
end)
button:SetScript("OnMouseUp", function(this)
if not this.disabled and (this.func or this.colorFunc or this.closeWhenClicked) then
if not this.disabled and (this.func or this.funcRight or this.colorFunc or this.closeWhenClicked) then
text:SetPoint("LEFT", button, "LEFT", this.notCheckable and 0 or 24, 0)
end
end)
@@ -3166,6 +3200,7 @@ function Dewdrop:AddLine(...)
end
if not button.disabled then
button.func = info.func
button.funcRight = info.funcRight
button.secure = info.secure
end
button.hasColorSwatch = info.hasColorSwatch
@@ -3178,6 +3213,7 @@ function Dewdrop:AddLine(...)
button.colorSwatch.texture:SetVertexColor(button.r, button.g, button.b)
button.checked = false
button.func = nil
button.funcRight = nil
button.colorFunc = info.colorFunc
local i = 1
while true do