From d40460ddd0a9ffa4d27cd047ddf8753b0b499981 Mon Sep 17 00:00:00 2001 From: ake1 Date: Wed, 8 Jan 2014 14:50:31 +0100 Subject: [PATCH] BattleShoutRemover Added an option to remove Battle Shout. Never/Always/Sometimes(all but warr/rog). --- _LazyPig/LazyPig.lua | 49 +++++++++++++++++++++++++++++++++++++++- _LazyPig/LazyPigMenu.lua | 15 +++++++++--- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/_LazyPig/LazyPig.lua b/_LazyPig/LazyPig.lua index 7f1be1a..f5c3d43 100644 --- a/_LazyPig/LazyPig.lua +++ b/_LazyPig/LazyPig.lua @@ -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 @@ -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", @@ -299,6 +301,7 @@ function LazyPig_OnUpdate() end LazyPig_CheckSalvation(); + LazyPig_CheckBattleShout(); ScheduleButtonClick(); ScheduleFunctionLaunch(); ScheduleItemSplit(); @@ -388,6 +391,7 @@ function LazyPig_OnEvent(event) LazyPigKeybindsFrame = LazyPig_CreateKeybindsFrame() LazyPig_CheckSalvation(); + LazyPig_CheckBattleShout(); Check_Bg_Status(); LazyPig_AutoLeaveBG(); LazyPig_AutoSummon(); @@ -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 @@ -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 @@ -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 @@ -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) diff --git a/_LazyPig/LazyPigMenu.lua b/_LazyPig/LazyPigMenu.lua index 3a82cfc..73c85a4 100644 --- a/_LazyPig/LazyPigMenu.lua +++ b/_LazyPig/LazyPigMenu.lua @@ -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" }, @@ -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( { @@ -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