This commit is contained in:
Crum
2018-11-21 02:57:10 -06:00
parent e60d190f6a
commit 8a909794ce
3 changed files with 56 additions and 139 deletions
-59
View File
@@ -413,61 +413,6 @@ function B:ResetSlotAlphaForBags(f)
end end
end end
local function buttonOnClick(button, ignoreModifiers)
if not button then button = arg1 end
--KeyRing special case code
if this:GetParent():GetID() == KEYRING_CONTAINER then
KeyRingItemButton_OnClick(button, ignoreModifiers)
return
end
if button == "LeftButton" then
if IsControlKeyDown() and not ignoreModifiers then
DressUpItemLink(GetContainerItemLink(this:GetParent():GetID(), this:GetID()))
elseif IsShiftKeyDown() and not ignoreModifiers then
if ChatFrameEditBox:IsShown() then
ChatFrameEditBox:Insert(GetContainerItemLink(this:GetParent():GetID(), this:GetID()))
else
local texture, itemCount, locked = GetContainerItemInfo(this:GetParent():GetID(), this:GetID())
if not locked then
this.SplitStack = function(button, split)
SplitContainerItem(button:GetParent():GetID(), button:GetID(), split)
end
OpenStackSplitFrame(this.count, this, "BOTTOMRIGHT", "TOPRIGHT")
end
end
else
PickupContainerItem(this:GetParent():GetID(), this:GetID())
StackSplitFrame:Hide()
end
else
if IsControlKeyDown() and not ignoreModifiers then
return
elseif IsShiftKeyDown() and MerchantFrame:IsShown() and not ignoreModifiers then
this.SplitStack = function(button, split)
SplitContainerItem(button:GetParent():GetID(), button:GetID(), split)
MerchantItemButton_OnClick("LeftButton")
end
OpenStackSplitFrame(this.count, this, "BOTTOMRIGHT", "TOPRIGHT")
elseif MerchantFrame:IsShown() and MerchantFrame.selectedTab == 2 then
-- Don't sell the item if the buyback tab is selected
return
else
UseContainerItem(this:GetParent():GetID(), this:GetID())
StackSplitFrame:Hide()
end
end
end
local function buttonOnDragStart()
buttonOnClick("LeftButton", 1)
end
local function buttonOnReceiveDrag()
buttonOnClick("LeftButton", 1)
end
function B:Layout(isBank) function B:Layout(isBank)
if E.private.bags.enable ~= true then return end if E.private.bags.enable ~= true then return end
local f = self:GetContainerFrame(isBank) local f = self:GetContainerFrame(isBank)
@@ -585,10 +530,6 @@ function B:Layout(isBank)
f.Bags[bagID][slotID]:SetNormalTexture("") f.Bags[bagID][slotID]:SetNormalTexture("")
f.Bags[bagID][slotID]:SetCheckedTexture("") f.Bags[bagID][slotID]:SetCheckedTexture("")
f.Bags[bagID][slotID]:SetScript("OnClick", buttonOnClick)
f.Bags[bagID][slotID]:SetScript("OnDragStart", buttonOnDragStart)
f.Bags[bagID][slotID]:SetScript("OnReceiveDrag", buttonOnReceiveDrag)
f.Bags[bagID][slotID].Count = _G[f.Bags[bagID][slotID]:GetName().."Count"] f.Bags[bagID][slotID].Count = _G[f.Bags[bagID][slotID]:GetName().."Count"]
f.Bags[bagID][slotID].Count:ClearAllPoints() f.Bags[bagID][slotID].Count:ClearAllPoints()
E:Point(f.Bags[bagID][slotID].Count, "BOTTOMRIGHT", 0, 2) E:Point(f.Bags[bagID][slotID].Count, "BOTTOMRIGHT", 0, 2)
@@ -38,104 +38,92 @@ Support functions
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
if not AceGUIEditBoxInsertLink then if not AceGUIEditBoxInsertLink then
-- upgradeable hook -- upgradeable hook
local orig_BankFrameItemButtonGeneric_OnClick = BankFrameItemButtonGeneric_OnClick hooksecurefunc("BankFrameItemButtonGeneric_OnClick", function(button)
function BankFrameItemButtonGeneric_OnClick(button)
if button == "LeftButton" and IsShiftKeyDown() and not this.isBag then if button == "LeftButton" and IsShiftKeyDown() and not this.isBag then
return _G.AceGUIEditBoxInsertLink(GetContainerItemLink(BANK_CONTAINER, this:GetID())) return _G.AceGUIEditBoxInsertLink(GetContainerItemLink(BANK_CONTAINER, this:GetID()))
end end
end end)
local orig_ContainerFrameItemButton_OnClick = ContainerFrameItemButton_OnClick hooksecurefunc("ContainerFrameItemButton_OnClick", function(button, ignoreModifiers)
function ContainerFrameItemButton_OnClick(button, ignoreModifiers)
if button == "LeftButton" and IsShiftKeyDown() and not ignoreModifiers then if button == "LeftButton" and IsShiftKeyDown() and not ignoreModifiers then
return _G.AceGUIEditBoxInsertLink(GetContainerItemLink(this:GetParent():GetID(), this:GetID())) return _G.AceGUIEditBoxInsertLink(GetContainerItemLink(this:GetParent():GetID(), this:GetID()))
end end
end end)
local orig_KeyRingItemButton_OnClick = KeyRingItemButton_OnClick hooksecurefunc("KeyRingItemButton_OnClick", function(button)
function KeyRingItemButton_OnClick(button)
if button == "LeftButton" and IsShiftKeyDown() and not this.isBag then if button == "LeftButton" and IsShiftKeyDown() and not this.isBag then
return _G.AceGUIEditBoxInsertLink(GetContainerItemLink(KEYRING_CONTAINER, this:GetID())) return _G.AceGUIEditBoxInsertLink(GetContainerItemLink(KEYRING_CONTAINER, this:GetID()))
end end
end end)
local orig_LootFrameItem_OnClick = LootFrameItem_OnClick hooksecurefunc("LootFrameItem_OnClick", function(button)
function LootFrameItem_OnClick(button)
if button == "LeftButton" and IsShiftKeyDown() then if button == "LeftButton" and IsShiftKeyDown() then
return _G.AceGUIEditBoxInsertLink(GetLootSlotLink(this.slot)) return _G.AceGUIEditBoxInsertLink(GetLootSlotLink(this.slot))
end end
end end)
local orig_SetItemRef = SetItemRef hooksecurefunc("SetItemRef", function(link, text, button)
function SetItemRef(link, text, button)
if IsShiftKeyDown() then if IsShiftKeyDown() then
if sub(link, 1, 6) == "player" then if strsub(link,1,6) == "player" then
local name = sub(link, 8) local name = strsub(link,8)
if name and name ~= "" then if name and (strlen(name) > 0) then
return _G.AceGUIEditBoxInsertLink(name) return _G.AceGUIEditBoxInsertLink(name)
end end
else else
return _G.AceGUIEditBoxInsertLink(text) return _G.AceGUIEditBoxInsertLink(text)
end end
end end
end end)
local orig_MerchantItemButton_OnClick = MerchantItemButton_OnClick hooksecurefunc("MerchantItemButton_OnClick", function(button, ignoreModifiers)
function MerchantItemButton_OnClick(button, ignoreModifiers)
if MerchantFrame.selectedTab == 1 and button == "LeftButton" and IsShiftKeyDown() and not ignoreModifiers then if MerchantFrame.selectedTab == 1 and button == "LeftButton" and IsShiftKeyDown() and not ignoreModifiers then
return _G.AceGUIEditBoxInsertLink(GetMerchantItemLink(this:GetID())) return _G.AceGUIEditBoxInsertLink(GetMerchantItemLink(this:GetID()))
end end
end end)
local orig_PaperDollItemSlotButton_OnClick = PaperDollItemSlotButton_OnClick hooksecurefunc("PaperDollItemSlotButton_OnClick", function(button, ignoreModifiers)
function PaperDollItemSlotButton_OnClick(button, ignoreModifiers)
if button == "LeftButton" and IsShiftKeyDown() and not ignoreModifiers then if button == "LeftButton" and IsShiftKeyDown() and not ignoreModifiers then
return _G.AceGUIEditBoxInsertLink(GetInventoryItemLink("player", this:GetID())) return _G.AceGUIEditBoxInsertLink(GetInventoryItemLink("player", this:GetID()))
end end
end end)
local orig_QuestItem_OnClick = QuestItem_OnClick hooksecurefunc("QuestItem_OnClick", function()
function QuestItem_OnClick()
if IsShiftKeyDown() and this.rewardType ~= "spell" then if IsShiftKeyDown() and this.rewardType ~= "spell" then
return _G.AceGUIEditBoxInsertLink(GetQuestItemLink(this.type, this:GetID())) return _G.AceGUIEditBoxInsertLink(GetQuestItemLink(this.type, this:GetID()))
end end
end end)
local orig_QuestRewardItem_OnClick = QuestRewardItem_OnClick hooksecurefunc("QuestRewardItem_OnClick", function()
function QuestRewardItem_OnClick()
if IsShiftKeyDown() and this.rewardType ~= "spell" then if IsShiftKeyDown() and this.rewardType ~= "spell" then
return _G.AceGUIEditBoxInsertLink(GetQuestItemLink(this.type, this:GetID())) return _G.AceGUIEditBoxInsertLink(GetQuestItemLink(this.type, this:GetID()))
end end
end end)
local orig_QuestLogTitleButton_OnClick = QuestLogTitleButton_OnClick hooksecurefunc("QuestLogTitleButton_OnClick", function(button)
function QuestLogTitleButton_OnClick(button)
if IsShiftKeyDown() and (not this.isHeader) then if IsShiftKeyDown() and (not this.isHeader) then
return _G.AceGUIEditBoxInsertLink(gsub(this:GetText(), " *(.*)", "%1")) return _G.AceGUIEditBoxInsertLink(gsub(this:GetText(), " *(.*)", "%1"))
end end
end end)
local orig_QuestLogRewardItem_OnClick = QuestLogRewardItem_OnClick hooksecurefunc("QuestLogRewardItem_OnClick", function()
function QuestLogRewardItem_OnClick()
if IsShiftKeyDown() and this.rewardType ~= "spell" then if IsShiftKeyDown() and this.rewardType ~= "spell" then
return _G.AceGUIEditBoxInsertLink(GetQuestLogItemLink(this.type, this:GetID())) return _G.AceGUIEditBoxInsertLink(GetQuestLogItemLink(this.type, this:GetID()))
end end
end end)
local orig_SpellButton_OnClick = SpellButton_OnClick hooksecurefunc("SpellButton_OnClick", function(drag)
function SpellButton_OnClick(drag)
local id = SpellBook_GetSpellID(this:GetID()) local id = SpellBook_GetSpellID(this:GetID())
if id <= MAX_SPELLS and (not drag) and IsShiftKeyDown() then if id <= MAX_SPELLS and (not drag) and IsShiftKeyDown() then
local spellName, subSpellName = GetSpellName(id, SpellBookFrame.bookType) local spellName, subSpellName = GetSpellName(id, SpellBookFrame.bookType)
if spellName and not IsSpellPassive(id, SpellBookFrame.bookType) then if spellName and not IsSpellPassive(id, SpellBookFrame.bookType) then
if subSpellName and subSpellName ~= "" then if subSpellName and (strlen(subSpellName) > 0) then
_G.AceGUIEditBoxInsertLink(spellName.."("..subSpellName..")") _G.AceGUIEditBoxInsertLink(spellName.."("..subSpellName..")")
else else
_G.AceGUIEditBoxInsertLink(spellName) _G.AceGUIEditBoxInsertLink(spellName)
end end
end end
end end
end end)
end end
function _G.AceGUIEditBoxInsertLink(text) function _G.AceGUIEditBoxInsertLink(text)
@@ -35,104 +35,92 @@ Support functions
if not AceGUIMultiLineEditBoxInsertLink then if not AceGUIMultiLineEditBoxInsertLink then
-- upgradeable hook -- upgradeable hook
local orig_BankFrameItemButtonGeneric_OnClick = BankFrameItemButtonGeneric_OnClick hooksecurefunc("BankFrameItemButtonGeneric_OnClick", function(button)
function BankFrameItemButtonGeneric_OnClick(button)
if button == "LeftButton" and IsShiftKeyDown() and not this.isBag then if button == "LeftButton" and IsShiftKeyDown() and not this.isBag then
return _G.AceGUIMultiLineEditBoxInsertLink(GetContainerItemLink(BANK_CONTAINER, this:GetID())) return _G.AceGUIMultiLineEditBoxInsertLink(GetContainerItemLink(BANK_CONTAINER, this:GetID()))
end end
end end)
local orig_ContainerFrameItemButton_OnClick = ContainerFrameItemButton_OnClick hooksecurefunc("ContainerFrameItemButton_OnClick", function(button, ignoreModifiers)
function ContainerFrameItemButton_OnClick(button, ignoreModifiers)
if button == "LeftButton" and IsShiftKeyDown() and not ignoreModifiers then if button == "LeftButton" and IsShiftKeyDown() and not ignoreModifiers then
return _G.AceGUIMultiLineEditBoxInsertLink(GetContainerItemLink(this:GetParent():GetID(), this:GetID())) return _G.AceGUIMultiLineEditBoxInsertLink(GetContainerItemLink(this:GetParent():GetID(), this:GetID()))
end end
end end)
local orig_KeyRingItemButton_OnClick = KeyRingItemButton_OnClick hooksecurefunc("KeyRingItemButton_OnClick", function(button)
function KeyRingItemButton_OnClick(button)
if button == "LeftButton" and IsShiftKeyDown() and not this.isBag then if button == "LeftButton" and IsShiftKeyDown() and not this.isBag then
return _G.AceGUIMultiLineEditBoxInsertLink(GetContainerItemLink(KEYRING_CONTAINER, this:GetID())) return _G.AceGUIMultiLineEditBoxInsertLink(GetContainerItemLink(KEYRING_CONTAINER, this:GetID()))
end end
end end)
local orig_LootFrameItem_OnClick = LootFrameItem_OnClick hooksecurefunc("LootFrameItem_OnClick", function(button)
function LootFrameItem_OnClick(button)
if button == "LeftButton" and IsShiftKeyDown() then if button == "LeftButton" and IsShiftKeyDown() then
return _G.AceGUIMultiLineEditBoxInsertLink(GetLootSlotLink(this.slot)) return _G.AceGUIMultiLineEditBoxInsertLink(GetLootSlotLink(this.slot))
end end
end end)
local orig_SetItemRef = SetItemRef hooksecurefunc("SetItemRef", function(link, text, button)
function SetItemRef(link, text, button)
if IsShiftKeyDown() then if IsShiftKeyDown() then
if sub(link, 1, 6) == "player" then if strsub(link,1,6) == "player" then
local name = sub(link, 8) local name = strsub(link,8)
if name and name ~= "" then if name and (strlen(name) > 0) then
return _G.AceGUIMultiLineEditBoxInsertLink(name) return _G.AceGUIMultiLineEditBoxInsertLink(name)
end end
else else
return _G.AceGUIMultiLineEditBoxInsertLink(text) return _G.AceGUIMultiLineEditBoxInsertLink(text)
end end
end end
end end)
local orig_MerchantItemButton_OnClick = MerchantItemButton_OnClick hooksecurefunc("MerchantItemButton_OnClick", function(button, ignoreModifiers)
function MerchantItemButton_OnClick(button, ignoreModifiers)
if MerchantFrame.selectedTab == 1 and button == "LeftButton" and IsShiftKeyDown() and not ignoreModifiers then if MerchantFrame.selectedTab == 1 and button == "LeftButton" and IsShiftKeyDown() and not ignoreModifiers then
return _G.AceGUIMultiLineEditBoxInsertLink(GetMerchantItemLink(this:GetID())) return _G.AceGUIMultiLineEditBoxInsertLink(GetMerchantItemLink(this:GetID()))
end end
end end)
local orig_PaperDollItemSlotButton_OnClick = PaperDollItemSlotButton_OnClick hooksecurefunc("PaperDollItemSlotButton_OnClick", function(button, ignoreModifiers)
function PaperDollItemSlotButton_OnClick(button, ignoreModifiers)
if button == "LeftButton" and IsShiftKeyDown() and not ignoreModifiers then if button == "LeftButton" and IsShiftKeyDown() and not ignoreModifiers then
return _G.AceGUIMultiLineEditBoxInsertLink(GetInventoryItemLink("player", this:GetID())) return _G.AceGUIMultiLineEditBoxInsertLink(GetInventoryItemLink("player", this:GetID()))
end end
end end)
local orig_QuestItem_OnClick = QuestItem_OnClick hooksecurefunc("QuestItem_OnClick", function()
function QuestItem_OnClick()
if IsShiftKeyDown() and this.rewardType ~= "spell" then if IsShiftKeyDown() and this.rewardType ~= "spell" then
return _G.AceGUIMultiLineEditBoxInsertLink(GetQuestItemLink(this.type, this:GetID())) return _G.AceGUIMultiLineEditBoxInsertLink(GetQuestItemLink(this.type, this:GetID()))
end end
end end)
local orig_QuestRewardItem_OnClick = QuestRewardItem_OnClick hooksecurefunc("QuestRewardItem_OnClick", function()
function QuestRewardItem_OnClick()
if IsShiftKeyDown() and this.rewardType ~= "spell" then if IsShiftKeyDown() and this.rewardType ~= "spell" then
return _G.AceGUIMultiLineEditBoxInsertLink(GetQuestItemLink(this.type, this:GetID())) return _G.AceGUIMultiLineEditBoxInsertLink(GetQuestItemLink(this.type, this:GetID()))
end end
end end)
local orig_QuestLogTitleButton_OnClick = QuestLogTitleButton_OnClick hooksecurefunc("QuestLogTitleButton_OnClick", function(button)
function QuestLogTitleButton_OnClick(button)
if IsShiftKeyDown() and (not this.isHeader) then if IsShiftKeyDown() and (not this.isHeader) then
return _G.AceGUIMultiLineEditBoxInsertLink(gsub(this:GetText(), " *(.*)", "%1")) return _G.AceGUIMultiLineEditBoxInsertLink(gsub(this:GetText(), " *(.*)", "%1"))
end end
end end)
local orig_QuestLogRewardItem_OnClick = QuestLogRewardItem_OnClick hooksecurefunc("QuestLogRewardItem_OnClick", function()
function QuestLogRewardItem_OnClick()
if IsShiftKeyDown() and this.rewardType ~= "spell" then if IsShiftKeyDown() and this.rewardType ~= "spell" then
return _G.AceGUIMultiLineEditBoxInsertLink(GetQuestLogItemLink(this.type, this:GetID())) return _G.AceGUIMultiLineEditBoxInsertLink(GetQuestLogItemLink(this.type, this:GetID()))
end end
end end)
local orig_SpellButton_OnClick = SpellButton_OnClick hooksecurefunc("SpellButton_OnClick", function(drag)
function SpellButton_OnClick(drag)
local id = SpellBook_GetSpellID(this:GetID()) local id = SpellBook_GetSpellID(this:GetID())
if id <= MAX_SPELLS and (not drag) and IsShiftKeyDown() then if id <= MAX_SPELLS and (not drag) and IsShiftKeyDown() then
local spellName, subSpellName = GetSpellName(id, SpellBookFrame.bookType) local spellName, subSpellName = GetSpellName(id, SpellBookFrame.bookType)
if spellName and not IsSpellPassive(id, SpellBookFrame.bookType) then if spellName and not IsSpellPassive(id, SpellBookFrame.bookType) then
if subSpellName and subSpellName ~= "" then if subSpellName and (strlen(subSpellName) > 0) then
_G.AceGUIMultiLineEditBoxInsertLink(spellName.."("..subSpellName..")") _G.AceGUIMultiLineEditBoxInsertLink(spellName.."("..subSpellName..")")
else else
_G.AceGUIMultiLineEditBoxInsertLink(spellName) _G.AceGUIMultiLineEditBoxInsertLink(spellName)
end end
end end
end end
end end)
end end
function _G.AceGUIMultiLineEditBoxInsertLink(text) function _G.AceGUIMultiLineEditBoxInsertLink(text)