Skip to content

Commit

Permalink
Added the "auto select role" option to the random BG window, above th…
Browse files Browse the repository at this point in the history
…e role selection icons
  • Loading branch information
linaori committed Sep 6, 2022
1 parent 9d21e27 commit 22faa71
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local Private, _, Namespace = {}, ...
Namespace.Debug = {}
--@debug@
Namespace.Debug.enabled = true
Namespace.Meta.version = '1.8.0-dev'
Namespace.Meta.version = '1.9.0-dev'
--@end-debug@

local type, pairs, tostring, print, concat, select = type, pairs, tostring, print, table.concat, select
Expand Down
1 change: 1 addition & 0 deletions Locales/deDE.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ L['Send Say (/s)'] = true
L['Send Raid (/r)'] = true
L['Automation'] = true
L['Automatically Accept Role Selection'] = true
L['Auto Accept Role'] = true
L['Accepts the pre-selected role when your group applies for a battleground'] = true
L['Clear frame when exiting the battleground'] = true
L['Removes the instructions from the last battleground'] = true
Expand Down
1 change: 1 addition & 0 deletions Locales/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ L['Send Say (/s)'] = true
L['Send Raid (/r)'] = true
L['Automation'] = true
L['Automatically Accept Role Selection'] = true
L['Auto Accept Role'] = true
L['Accepts the pre-selected role when your group applies for a battleground'] = true
L['Clear frame when exiting the battleground'] = true
L['Removes the instructions from the last battleground'] = true
Expand Down
1 change: 1 addition & 0 deletions Locales/ruRU.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ L['Send Say (/s)'] = true
L['Send Raid (/r)'] = true
L['Automation'] = true
L['Automatically Accept Role Selection'] = true
L['Auto Accept Role'] = true
L['Accepts the pre-selected role when your group applies for a battleground'] = true
L['Clear frame when exiting the battleground'] = true
L['Removes the instructions from the last battleground'] = true
Expand Down
34 changes: 31 additions & 3 deletions QueueTools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,7 @@ function Private.UpdateQueueFrameVisibility(newVisibility)
end

function Private.InitializeBattlegroundModeCheckbox()
local PVPUIFrame = _G.PVPUIFrame
local checkbox = CreateFrame('CheckButton', 'BgcBattlegroundModeCheckbox', PVPUIFrame, 'UICheckButtonTemplate')
local checkbox = CreateFrame('CheckButton', 'BgcBattlegroundModeCheckbox', _G.PVPUIFrame, 'UICheckButtonTemplate')
checkbox:SetPoint('BOTTOMRIGHT', _G.PVEFrame, 'BOTTOMRIGHT', -2, 2)
checkbox:SetSize(24, 24)
checkbox:SetChecked(Namespace.Database.profile.QueueTools.showGroupQueueFrame)
Expand All @@ -402,7 +401,7 @@ function Private.InitializeBattlegroundModeCheckbox()
end)
checkbox:Show()

PVPUIFrame.BattlegroundModeCheckbox = checkbox
_G.PVPUIFrame.BattlegroundModeCheckbox = checkbox

local text = checkbox:CreateFontString(nil, 'ARTWORK', 'GameFontNormal')
text:SetText(L['Group Info'])
Expand All @@ -412,6 +411,31 @@ function Private.InitializeBattlegroundModeCheckbox()
checkbox.Text = text
end

function Private.InitializeAutoQueueCheckbox()
local checkbox = CreateFrame('CheckButton', 'BgcAutoQueueCheckbox', _G.HonorFrame.TankIcon, 'UICheckButtonTemplate')
checkbox:SetPoint('BOTTOMLEFT', _G.HonorFrame.TankIcon, 'TOPLEFT', -5, 8)
checkbox:SetSize(24, 24)
checkbox:SetChecked(Module:GetAutomationSetting('acceptRoleSelection'))
checkbox:SetScript('OnEnter', function (self)
local tooltip = _G.GameTooltip
tooltip:SetOwner(self, 'ANCHOR_RIGHT')
tooltip:SetText(L['Accepts the pre-selected role when your group applies for a battleground'], nil, nil, nil, nil, true)
tooltip:Show()
end)
checkbox:SetScript('OnLeave', function () _G.GameTooltip:Hide() end)
checkbox:SetScript('OnClick', function (self) Module:SetAutomationSetting('acceptRoleSelection', self:GetChecked()) end)
checkbox:Show()

_G.HonorFrame.TankIcon.AutoQueueCheckbox = checkbox

local text = checkbox:CreateFontString(nil, 'ARTWORK', 'GameFontNormal')
text:SetText(L['Auto Accept Role'])
text:SetPoint('LEFT', checkbox, 'RIGHT', 3, 0)
text:SetWordWrap(false)

checkbox.Text = text
end

function Private.ProcessSyncData(payload, data)
local time = GetTime()
-- renamed after 1.4.0, remove "remaining" index in the future
Expand Down Expand Up @@ -946,6 +970,7 @@ end

function Module:ADDON_LOADED(_, addonName)
if addonName == 'Blizzard_PVPUI' then
Private.InitializeAutoQueueCheckbox()
Private.InitializeBattlegroundModeCheckbox()
Private.InitializeGroupQueueFrame()
_G.PVPUIFrame:HookScript('OnShow', function ()
Expand All @@ -968,6 +993,9 @@ function Module:SetAutomationSetting(setting, value)
if setting == 'acceptRoleSelection' and value ~= Automation[setting] then
-- notify through sync data when this setting changed
Automation[setting] = value
if _G.BgcAutoQueueCheckbox then
_G.BgcAutoQueueCheckbox:SetChecked(value)
end
return Private.ScheduleSendSyncData()
end

Expand Down

0 comments on commit 22faa71

Please sign in to comment.