Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure O.SBButtonDownVal is initialized correctly (hack) #27

Merged
merged 1 commit into from
May 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions SmartBuff.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2115,10 +2115,12 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell)
-- we have a buff, set the cvar - this will be reverted back
-- once smartbuff has finished its work. If we are in combat
-- lockdown then keep it at 0

if not InCombatLockdown() and O.SBButtonFix then
C_CVar.SetCVar("ActionButtonUseKeyDown",1 );
elseif O.SBButtonFix then
if (O.SBButtonDownVal == nil) then
O.SBButtonDownVal = C_CVar.GetCVarBool("ActionButtonUseKeyDown");
end
C_CVar.SetCVar("ActionButtonUseKeyDown", O.SBButtonDownVal );
end

Expand Down Expand Up @@ -2271,11 +2273,21 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell)
end
else
-- finished
if O.SBButtonFix then C_CVar.SetCVar("ActionButtonUseKeyDown", O.SBButtonDownVal ); end
if O.SBButtonFix then
if (O.SBButtonDownVal == nil) then
O.SBButtonDownVal = C_CVar.GetCVarBool("ActionButtonUseKeyDown");
end
C_CVar.SetCVar("ActionButtonUseKeyDown", O.SBButtonDownVal );
end
end
else
-- target does not need this buff
if O.SBButtonFix then C_CVar.SetCVar("ActionButtonUseKeyDown", O.SBButtonDownVal ); end
if O.SBButtonFix then
if (O.SBButtonDownVal == nil) then
O.SBButtonDownVal = C_CVar.GetCVarBool("ActionButtonUseKeyDown");
end
C_CVar.SetCVar("ActionButtonUseKeyDown", O.SBButtonDownVal );
end
end
else
-- cooldown
Expand Down Expand Up @@ -3473,8 +3485,13 @@ function SMARTBUFF_OToggleDebug()
end

function SMARTBUFF_ToggleFixBuffing()
O.SBButtonFix = not O.SBButtonFix;
if not O.SBButtonFix then C_CVar.SetCVar("ActionButtonUseKeyDown", O.SBButtonDownVal ); end
O.SBButtonFix = not O.SBButtonFix;
if (O.SBButtonDownVal == nil) then
O.SBButtonDownVal = C_CVar.GetCVarBool("ActionButtonUseKeyDown");
end
if not O.SBButtonFix then
C_CVar.SetCVar("ActionButtonUseKeyDown", O.SBButtonDownVal );
end
end

function SMARTBUFF_OptionsFrame_Toggle()
Expand Down