Skip to content

Commit

Permalink
add oneclick signup option fixes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jodsderechte committed Aug 15, 2024
1 parent 4a311af commit c59bd66
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 0 deletions.
3 changes: 3 additions & 0 deletions GroupFinderRio.toc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ Util\SpecSortFrame.lua
Options\OptionDefaults.lua
Options\Options.lua

#Modules
Modules\OneClickSign.lua

# Core
Main.lua
GroupFinderRio.lua
Expand Down
3 changes: 3 additions & 0 deletions Locales/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,8 @@ if L then
L["shortenActivityNameDescription"] = "Shorten the Activity Name in the Group View"
L["showInfoInActivityName"] = "Show Info in Activity Name"
L["showInfoInActivityNameDescription"] = "Show information in the Activity Name in the Group View"
L["oneClickSignup"] = "One Click Signup"
L["oneClickSignupDescription"] = "Sign up for a group with one click"
L["OneClickSignupNotAvailable"] = "One Click Signup is not available with Premades Group Filter enabled please disable the option and use Premades Group Filters setting instead"
GFIO.localisation = L
end
5 changes: 5 additions & 0 deletions Main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ function GroupFinderRIO:OnInitialize()
AceConfigDialog:AddToBlizOptions(appName, appName)
self:RegisterChatCommand("gfio", "SlashCommand")
self:RegisterChatCommand("GFIO", "SlashCommand")
if not C_AddOns.IsAddOnLoaded("PremadeGroupsFilter") then
GFIO.hookFunc() -- hooking the LFGListSearchEntry_OnClick function if enabled and premades group filter is disabled
elseif GFIO.db.profile.oneClickSignup then
error(GFIO.getLocalisation("OneClickSignupNotAvailable"))
end
end


Expand Down
25 changes: 25 additions & 0 deletions Modules/OneClickSign.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
local _, GFIO = ...

local isHooked = false;

GFIO.hookFunc = function()
hooksecurefunc("LFGListSearchEntry_OnClick", function (self, button)
if not GFIO.db.profile.oneClickSignup then return end
local panel = LFGListFrame.SearchPanel
if button == "LeftButton" and LFGListSearchPanelUtil_CanSelectResult(self.resultID) and
LFGListFrame.SearchPanel.ScrollBox:IsVisible() == true and
panel.SignUpButton:IsEnabled() and LFGListFrame.SearchPanel.ScrollBox:IsMouseOver() == true then
if panel.selectedResult ~= self.resultID then
LFGListSearchPanel_SelectResult(panel, self.resultID)
end
LFGListSearchPanel_SignUp(panel)
end
end)
LFGListApplicationDialog:HookScript("OnShow", function(self)
if not GFIO.db.profile.oneClickSignup then return end
if self.SignUpButton:IsEnabled() and not IsShiftKeyDown() and LFGListFrame.SearchPanel.ScrollBox:IsVisible() == true
and LFGListFrame.SearchPanel.ScrollBox:IsMouseOver() == true then
self.SignUpButton:Click()
end
end)
end
1 change: 1 addition & 0 deletions Options/OptionDefaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ GFIO.OptionDefaults = {
addHighestDifficulty = true,
shortenActivityName = true,
showInfoInActivityName = true,
oneClickSignup = false,
wrongRoleScoreLimitForSorting = 100,
spec = {
[62] = true, -- arcane
Expand Down
11 changes: 11 additions & 0 deletions Options/Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,17 @@ GFIO.options = {
return GFIO.db.profile.showInfoInActivityName --Sets value of toggles depending on SavedVariables
end,
},
oneClickSignup = {
name = GFIO.getLocalisation("oneClickSignup"),
desc = GFIO.getLocalisation("oneClickSignupDescription"),
order = 30,
width = "full",
type = "toggle",
set = function(info,val) GFIO.db.profile.oneClickSignup = val end, --Sets value of SavedVariables depending on toggles
get = function(info)
return GFIO.db.profile.oneClickSignup --Sets value of toggles depending on SavedVariables
end,
},
}
}
}
Expand Down

0 comments on commit c59bd66

Please sign in to comment.