Skip to content

Commit ecce791

Browse files
committed
#1830 Fix Keybinding and Actionbar Overrides interface
1 parent 2b3355e commit ecce791

5 files changed

Lines changed: 96 additions & 86 deletions

File tree

GSE/API/Events.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ local function GetSpec()
104104
if GSE.GameMode < 7 then
105105
return "1"
106106
else
107-
if GSE.GameMode < 12 then
108-
return tostring(GetSpecialization())
109-
else
110-
return tostring(C_SpecializationInfo.GetSpecialization())
107+
if GSE.GameMode < 12 then
108+
return tostring(GetSpecialization())
109+
else
110+
return tostring(C_SpecializationInfo.GetSpecialization())
111+
end
111112
end
112113
end
113-
end
114114

115115
local function playerSpec()
116116
if GSE.GameMode < 3 then

GSE/API/Serialisation.lua

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -527,78 +527,78 @@ end
527527
-- This filter function courtesy of WeakAuras -- https://github.com/WeakAuras/WeakAuras2/blob/main/WeakAuras/Transmission.lua#L147
528528

529529
-- #1830 Not compatible with Midnight
530-
-- local function filterFunc(_, event, msg, player, l, cs, t, flag, channelId, ...)
531-
-- if flag == "GM" or flag == "DEV" or (event == "CHAT_MSG_CHANNEL" and type(channelId) == "number" and channelId > 0) then
532-
-- return
533-
-- end
534-
535-
-- local newMsg = ""
536-
-- local remaining = msg
537-
-- local done
538-
-- repeat
539-
-- local start, finish, characterName, sequenceName, classID =
540-
-- remaining:find("%[GSE: ([^%s]+) %- ([^%s]+) %- ([^]]+)")
541-
-- if (characterName and sequenceName and classID) then
542-
-- characterName = characterName:gsub("|c[Ff][Ff]......", ""):gsub("|r", "")
543-
-- sequenceName = sequenceName:gsub("|c[Ff][Ff]......", ""):gsub("|r", "")
544-
-- classID = classID:gsub("|c[Ff][Ff]......", ""):gsub("|r", "")
545-
-- newMsg = newMsg .. remaining:sub(1, start - 1)
546-
-- newMsg = newMsg .. GSE.CreateSequenceLink(sequenceName, classID, characterName)
547-
-- remaining = remaining:sub(finish + 1)
548-
-- else
549-
-- done = true
550-
-- end
551-
-- until (done)
552-
-- if newMsg ~= "" then
553-
-- local trimmedPlayer = Ambiguate(player, "none")
554-
-- if event == "CHAT_MSG_WHISPER" and not UnitInRaid(trimmedPlayer) and not UnitInParty(trimmedPlayer) then -- XXX: Need a guild check
555-
-- local _, num = BNGetNumFriends()
556-
-- for i = 1, num do
557-
-- if C_BattleNet then -- introduced in 8.2.5 PTR
558-
-- local toon = C_BattleNet.GetFriendNumGameAccounts(i)
559-
-- for j = 1, toon do
560-
-- local gameAccountInfo = C_BattleNet.GetFriendGameAccountInfo(i, j)
561-
-- if
562-
-- gameAccountInfo and gameAccountInfo.characterName == trimmedPlayer and
563-
-- gameAccountInfo.clientProgram == "WoW"
564-
-- then
565-
-- return false, newMsg, player, l, cs, t, flag, channelId, ... -- Player is a real id friend, allow it
566-
-- end
567-
-- end
568-
-- else -- keep old method for 8.2 and Classic
569-
-- local toon = BNGetNumFriendGameAccounts(i)
570-
-- for j = 1, toon do
571-
-- local _, rName, rGame = BNGetFriendGameAccountInfo(i, j)
572-
-- if rName == trimmedPlayer and rGame == "WoW" then
573-
-- return false, newMsg, player, l, cs, t, flag, channelId, ... -- Player is a real id friend, allow it
574-
-- end
575-
-- end
576-
-- end
577-
-- end
578-
-- return true -- Filter strangers
579-
-- else
580-
-- return false, newMsg, player, l, cs, t, flag, channelId, ...
581-
-- end
582-
-- end
583-
-- end
530+
local function filterFunc(_, event, msg, player, l, cs, t, flag, channelId, ...)
531+
if flag == "GM" or flag == "DEV" or (event == "CHAT_MSG_CHANNEL" and type(channelId) == "number" and channelId > 0) then
532+
return
533+
end
584534

535+
local newMsg = ""
536+
local remaining = msg
537+
local done
538+
repeat
539+
local start, finish, characterName, sequenceName, classID =
540+
remaining:find("%[GSE: ([^%s]+) %- ([^%s]+) %- ([^]]+)")
541+
if (characterName and sequenceName and classID) then
542+
characterName = characterName:gsub("|c[Ff][Ff]......", ""):gsub("|r", "")
543+
sequenceName = sequenceName:gsub("|c[Ff][Ff]......", ""):gsub("|r", "")
544+
classID = classID:gsub("|c[Ff][Ff]......", ""):gsub("|r", "")
545+
newMsg = newMsg .. remaining:sub(1, start - 1)
546+
newMsg = newMsg .. GSE.CreateSequenceLink(sequenceName, classID, characterName)
547+
remaining = remaining:sub(finish + 1)
548+
else
549+
done = true
550+
end
551+
until (done)
552+
if newMsg ~= "" then
553+
local trimmedPlayer = Ambiguate(player, "none")
554+
if event == "CHAT_MSG_WHISPER" and not UnitInRaid(trimmedPlayer) and not UnitInParty(trimmedPlayer) then -- XXX: Need a guild check
555+
local _, num = BNGetNumFriends()
556+
for i = 1, num do
557+
if C_BattleNet then -- introduced in 8.2.5 PTR
558+
local toon = C_BattleNet.GetFriendNumGameAccounts(i)
559+
for j = 1, toon do
560+
local gameAccountInfo = C_BattleNet.GetFriendGameAccountInfo(i, j)
561+
if
562+
gameAccountInfo and gameAccountInfo.characterName == trimmedPlayer and
563+
gameAccountInfo.clientProgram == "WoW"
564+
then
565+
return false, newMsg, player, l, cs, t, flag, channelId, ... -- Player is a real id friend, allow it
566+
end
567+
end
568+
else -- keep old method for 8.2 and Classic
569+
local toon = BNGetNumFriendGameAccounts(i)
570+
for j = 1, toon do
571+
local _, rName, rGame = BNGetFriendGameAccountInfo(i, j)
572+
if rName == trimmedPlayer and rGame == "WoW" then
573+
return false, newMsg, player, l, cs, t, flag, channelId, ... -- Player is a real id friend, allow it
574+
end
575+
end
576+
end
577+
end
578+
return true -- Filter strangers
579+
else
580+
return false, newMsg, player, l, cs, t, flag, channelId, ...
581+
end
582+
end
583+
end
585584
-- #1830 Not compatible with Midnight
586-
-- ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", filterFunc)
587-
-- ChatFrame_AddMessageEventFilter("CHAT_MSG_YELL", filterFunc)
588-
-- ChatFrame_AddMessageEventFilter("CHAT_MSG_GUILD", filterFunc)
589-
-- ChatFrame_AddMessageEventFilter("CHAT_MSG_OFFICER", filterFunc)
590-
-- ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY", filterFunc)
591-
-- ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY_LEADER", filterFunc)
592-
-- ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID", filterFunc)
593-
-- ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID_LEADER", filterFunc)
594-
-- ChatFrame_AddMessageEventFilter("CHAT_MSG_SAY", filterFunc)
595-
-- ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", filterFunc)
596-
-- ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_INFORM", filterFunc)
597-
-- ChatFrame_AddMessageEventFilter("CHAT_MSG_BN_WHISPER", filterFunc)
598-
-- ChatFrame_AddMessageEventFilter("CHAT_MSG_BN_WHISPER_INFORM", filterFunc)
599-
-- ChatFrame_AddMessageEventFilter("CHAT_MSG_INSTANCE_CHAT", filterFunc)
600-
-- ChatFrame_AddMessageEventFilter("CHAT_MSG_INSTANCE_CHAT_LEADER", filterFunc)
601-
585+
if GSE.GameMode < 12 then
586+
ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", filterFunc)
587+
ChatFrame_AddMessageEventFilter("CHAT_MSG_YELL", filterFunc)
588+
ChatFrame_AddMessageEventFilter("CHAT_MSG_GUILD", filterFunc)
589+
ChatFrame_AddMessageEventFilter("CHAT_MSG_OFFICER", filterFunc)
590+
ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY", filterFunc)
591+
ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY_LEADER", filterFunc)
592+
ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID", filterFunc)
593+
ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID_LEADER", filterFunc)
594+
ChatFrame_AddMessageEventFilter("CHAT_MSG_SAY", filterFunc)
595+
ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", filterFunc)
596+
ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_INFORM", filterFunc)
597+
ChatFrame_AddMessageEventFilter("CHAT_MSG_BN_WHISPER", filterFunc)
598+
ChatFrame_AddMessageEventFilter("CHAT_MSG_BN_WHISPER_INFORM", filterFunc)
599+
ChatFrame_AddMessageEventFilter("CHAT_MSG_INSTANCE_CHAT", filterFunc)
600+
ChatFrame_AddMessageEventFilter("CHAT_MSG_INSTANCE_CHAT_LEADER", filterFunc)
601+
end
602602
-- process chatlinks
603603
hooksecurefunc(
604604
"SetItemRef",

GSE_GUI/Ace3_Extensions/AceGUI-3.0-GSETreeGroup.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ local function Button_OnEnter(frame)
219219
tooltip:SetOwner(frame, "ANCHOR_NONE")
220220
tooltip:ClearAllPoints()
221221
tooltip:SetPoint("LEFT", frame, "RIGHT")
222-
tooltip:SetText(frame.text:GetText() or "", 1, .82, true)
222+
tooltip:SetText(frame.text:GetText() or "", 1, .82, 0, true)
223223

224224
tooltip:Show()
225225
end

GSE_GUI/Editor.lua

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2849,13 +2849,17 @@ function GSE.CreateEditor()
28492849
local function showKeybind(bind, button, specialization, loadout, type, rightContainer)
28502850
if type == "KB" then
28512851
if not specialization then
2852-
if GSE.GameMode > 10 then
2853-
specialization = C_Specialization.GetSpecialization()
2854-
else
2852+
if GSE.GameMode < 10 then
28552853
specialization = 1
2854+
else
2855+
if GSE.GameMode < 12 then
2856+
specialization = GetSpecialization()
2857+
else
2858+
specialization = C_SpecializationInfo.GetSpecialization()
2859+
end
28562860
end
28572861
end
2858-
local initialbind = bind
2862+
local initialbind = bind
28592863
rightContainer:ReleaseChildren()
28602864
local keybind = AceGUI:Create("ControllerKeybinding")
28612865
keybind:SetLabel(L["Keybind"])
@@ -3032,18 +3036,22 @@ function GSE.CreateEditor()
30323036
rightContainer:AddChild(row)
30333037
rightContainer:AddChild(row2)
30343038
elseif type == "AO" then
3039+
30353040
if not button then
30363041
button = {}
30373042
end
30383043
if button.Bind then
30393044
bind = button.Bind
30403045
end
3041-
30423046
if not specialization then
3043-
if GSE.GameMode > 10 then
3044-
specialization = C_Specialization.GetSpecialization()
3045-
else
3047+
if GSE.GameMode < 10 then
30463048
specialization = 1
3049+
else
3050+
if GSE.GameMode < 12 then
3051+
specialization = GetSpecialization()
3052+
else
3053+
specialization = C_SpecializationInfo.GetSpecialization()
3054+
end
30473055
end
30483056
end
30493057
local initialbind = bind
@@ -4521,7 +4529,7 @@ end]],
45214529
local bind, loadout, type, button
45224530
type = unique[2]
45234531
local specialization = unique[3]
4524-
if GetSpecialization then
4532+
if C_SpecializationInfo or GetSpecialization then
45254533
bind = unique[4]
45264534
if #unique == 6 then
45274535
loadout = unique[4]

GSE_Utils/Events.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,6 @@ function GSE:UNIT_SPELLCAST_SUCCEEDED(event, unit, action)
134134
end
135135
end
136136

137-
-- GSE:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
137+
if GSE.GameMode < 12 then
138+
GSE:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
139+
end

0 commit comments

Comments
 (0)