Skip to content

Commit

Permalink
GUI: add chat announce on checkbutton spell links
Browse files Browse the repository at this point in the history
Shift-click
  • Loading branch information
Zidras committed Feb 12, 2023
1 parent 473e7b2 commit ece4237
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DBM-Core/DBM-Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ local function currentFullDate()
end

DBM = {
Revision = parseCurseDate("20230211181804"),
Revision = parseCurseDate("20230212114559"),
DisplayVersion = "9.2.26 alpha", -- the string that is shown as version
ReleaseRevision = releaseDate(2022, 11, 1) -- the date of the latest stable version that is available, optionally pass hours, minutes, and seconds for multiple releases in one day
}
Expand Down
14 changes: 13 additions & 1 deletion DBM-GUI/modules/PanelPrototype.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ local L = DBM_GUI_L
local CL = DBM_COMMON_L

local setmetatable, select, type, tonumber, strsplit, mmax, tinsert = setmetatable, select, type, tonumber, strsplit, math.max, table.insert
local CreateFrame, GetCursorPosition, UIParent, GameTooltip, NORMAL_FONT_COLOR, GameFontNormal = CreateFrame, GetCursorPosition, UIParent, GameTooltip, NORMAL_FONT_COLOR, GameFontNormal
local CreateFrame, GetCursorPosition, ChatEdit_GetActiveWindow, IsShiftKeyDown, UIParent, GameTooltip, NORMAL_FONT_COLOR, GameFontNormal = CreateFrame, GetCursorPosition, ChatEdit_GetActiveWindow, IsShiftKeyDown, UIParent, GameTooltip, NORMAL_FONT_COLOR, GameFontNormal
local IsInInstance, GetNumRaidMembers = IsInInstance, GetNumRaidMembers
local DBM, DBM_GUI = DBM, DBM_GUI
local ElvUI = ElvUI

Expand Down Expand Up @@ -407,6 +408,17 @@ do
buttonText = CreateFrame("SimpleHTML", "$parentText", button)
buttonText:SetFontObject("p", "GameFontNormal")
buttonText:SetHyperlinksEnabled(true)
buttonText:SetScript("OnHyperlinkClick", function(self, _, link)
if IsShiftKeyDown() then
local msg = link:gsub("|h(.*)|h", "|h[%1]|h")
local chatWindow = ChatEdit_GetActiveWindow()
if chatWindow then
chatWindow:Insert(msg)
else
SendChatMessage(msg, (select(2, IsInInstance()) == "pvp" and "BATTLEGROUND") or (GetNumRaidMembers() > 0 and "RAID") or "PARTY")
end
end
end)
buttonText:SetScript("OnHyperlinkEnter", function(self, data)
GameTooltip:SetOwner(self, "ANCHOR_NONE")
local linkType = strsplit(":", data)
Expand Down

0 comments on commit ece4237

Please sign in to comment.