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

BattleShoutRemover #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
49 changes: 48 additions & 1 deletion _LazyPig/LazyPig.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LPCONFIG = {DISMOUNT = true, CAM = false, GINV = true, FINV = true, SINV = nil, SUMM = true, EBG = true, LBG = true, QBG = false, SBG = false, LOOT = true, EPLATE = false, FPLATE = false, HPLATE = false, RIGHT = true, ZG = 1, DUEL = false, NOSAVE = false, GREEN = 2, SPECIALKEY = true, WORLDDUNGEON = false, WORLDRAID = false, WORLDBG = false, WORLDUNCHECK = nil, SPAM = false, SHIFTSPLIT = true, REZ = true, GOSSIP = true, SALVA = false}
LPCONFIG = {DISMOUNT = true, CAM = false, GINV = true, FINV = true, SINV = nil, SUMM = true, EBG = true, LBG = true, QBG = false, SBG = false, LOOT = true, EPLATE = false, FPLATE = false, HPLATE = false, RIGHT = true, ZG = 1, DUEL = false, NOSAVE = false, GREEN = 2, SPECIALKEY = true, WORLDDUNGEON = false, WORLDRAID = false, WORLDBG = false, WORLDUNCHECK = nil, SPAM = false, SHIFTSPLIT = true, REZ = true, GOSSIP = true, SALVA = false, BSR = false}

LP_VERSION = "5.00" --UPDATE THIS MANUALLY! This is NOT used, but hey, it's at top

Expand Down Expand Up @@ -103,6 +103,8 @@ local LazyPigMenuStrings = {
[52]= "Queue BattleGround",
[60]= "Always",
[61]= "Warrior Shield/Druid Bear",
[70]= "Always",
[71]= "Sometimes",
[90]= "Summon Auto Accept",
[91]= "Loot Window Auto Position",
[92]= "Improved Right Click",
Expand Down Expand Up @@ -299,6 +301,7 @@ function LazyPig_OnUpdate()
end

LazyPig_CheckSalvation();
LazyPig_CheckBattleShout();
ScheduleButtonClick();
ScheduleFunctionLaunch();
ScheduleItemSplit();
Expand Down Expand Up @@ -388,6 +391,7 @@ function LazyPig_OnEvent(event)
LazyPigKeybindsFrame = LazyPig_CreateKeybindsFrame()

LazyPig_CheckSalvation();
LazyPig_CheckBattleShout();
Check_Bg_Status();
LazyPig_AutoLeaveBG();
LazyPig_AutoSummon();
Expand All @@ -409,6 +413,9 @@ function LazyPig_OnEvent(event)
elseif (LPCONFIG.SALVA and (event == "PLAYER_AURAS_CHANGED" or event == "UPDATE_BONUS_ACTIONBAR" and LazyPig_PlayerClass("Druid", "player") or event == "UNIT_INVENTORY_CHANGED")) then
LazyPig_CheckSalvation()

elseif (LPCONFIG.BSR and (event == "PLAYER_AURAS_CHANGED")) then
LazyPig_CheckBattleShout()

elseif(event == "DUEL_REQUESTED") then
duel_active = true
if LPCONFIG.DUEL and not IsShiftKeyDown() then --dnd_active and
Expand Down Expand Up @@ -1551,6 +1558,8 @@ function LazyPig_GetOption(num)
or num == 52 and LPCONFIG.QBG
or num == 60 and LPCONFIG.SALVA == 1
or num == 61 and LPCONFIG.SALVA == 2
or num == 70 and LPCONFIG.BSR == 1
or num == 71 and LPCONFIG.BSR == 2
or num == 90 and LPCONFIG.SUMM
or num == 91 and LPCONFIG.LOOT
or num == 92 and LPCONFIG.RIGHT
Expand Down Expand Up @@ -1695,6 +1704,16 @@ function LazyPig_SetOption(num)
if not checked then LPCONFIG.SALVA = nil end
LazyPigMenuObjects[60]:SetChecked(nil)
LazyPig_CheckSalvation()
elseif num == 70 then
LPCONFIG.BSR = 1
if not checked then LPCONFIG.BSR = nil end
LazyPigMenuObjects[71]:SetChecked(nil)
LazyPig_CheckBattleShout()
elseif num == 71 then
LPCONFIG.BSR = 2
if not checked then LPCONFIG.BSR = nil end
LazyPigMenuObjects[70]:SetChecked(nil)
LazyPig_CheckBattleShout()
elseif num == 90 then
LPCONFIG.SUMM = true
if not checked then LPCONFIG.SUMM = nil end
Expand Down Expand Up @@ -1884,6 +1903,34 @@ function LazyPig_CheckSalvation()
end
end

function LazyPig_CancelBattleShoutBuff()
local buff = {"Ability_Warrior_BattleShout"}
local counter = 0
while GetPlayerBuff(counter) >= 0 do
local index, untilCancelled = GetPlayerBuff(counter)
if untilCancelled ~= 1 then
local i =1
while buff[i] do
if string.find(GetPlayerBuffTexture(index), buff[i]) then
CancelPlayerBuff(index);
UIErrorsFrame:Clear();
UIErrorsFrame:AddMessage("Battle Shout Removed");
return
end
i = i + 1
end
end
counter = counter + 1
end
return nil
end

function LazyPig_CheckBattleShout()
if(LPCONFIG.BSR == 1 or LPCONFIG.BSR == 2 and (LazyPig_PlayerClass("Warrior", "player") == false and LazyPig_PlayerClass("Rogue", "player") == false)) then
LazyPig_CancelBattleShoutBuff()
end
end

function LazyPig_ShowBindings(bind, fs, desc)
local bind1, bind2 = GetBindingKey(bind)
local fsl = getglobal(fs)
Expand Down
15 changes: 12 additions & 3 deletions _LazyPig/LazyPigMenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ local CheckBoxTables = {
[2] = { "LazyPigCheckbox61", "Warrior Shield/Druid Bear" },
},

["Intelligent Battle Shout Remover"] = {
[0] = "LazyPigCheckboxGroupBattleShoutRemover",
[1] = { "LazyPigCheckbox70", "Always" },
[2] = { "LazyPigCheckbox71", "Sometimes" },
},

["Nameplates Display Rules"] = {
[0] = "LazyPigCheckboxGroupNameplates",
[1] = { "LazyPigCheckbox40", "Show Friends" },
Expand Down Expand Up @@ -128,7 +134,7 @@ function LazyPig_CreateOptionsFrame()
frame:SetScale(.81)

frame:SetWidth(480)
frame:SetHeight(380)
frame:SetHeight(410)

frame:SetPoint("TOPLEFT", nil, "TOPLEFT", 250, -50)
frame:SetBackdrop( {
Expand Down Expand Up @@ -231,12 +237,15 @@ function LazyPig_CreateOptionsFrame()

local str = "Intelligent Salvation Remover"
frame.cbgroup_salvationremover = CheckBoxGroup(frame, 250, -45, str, CheckBoxTables[str])

local str = "Intelligent Battle Shout Remover"
frame.cbgroup_battleshoutremover = CheckBoxGroup(frame, 250, -90, str, CheckBoxTables[str])

local str = "Group Invite Accept Rules"
frame.cbgroup_groupinvite = CheckBoxGroup(frame, 250, -90, str, CheckBoxTables[str])
frame.cbgroup_groupinvite = CheckBoxGroup(frame, 250, -135, str, CheckBoxTables[str])

local str = "Single Choise Rules"
frame.cbgroup_singlechoise = CheckBoxGroup(frame, 250, -150, str, CheckBoxTables[str])
frame.cbgroup_singlechoise = CheckBoxGroup(frame, 250, -195, str, CheckBoxTables[str])

return frame

Expand Down