Skip to content

Commit

Permalink
Added support for Call Pet for Hunters
Browse files Browse the repository at this point in the history
Added in additional logic to support Hunter's Call Pet ability - since this doesn't apply a buff to test against I needed to apply some custom checks.
Softrix committed Sep 13, 2022
1 parent 072e7c6 commit 1a05e4d
Showing 6 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion SmartBuff-Classic.toc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Interface: 11403
## Title: |TInterface\Addons\Smartbuff\Icons\IconEnabled:0|t SmartBuff |cffffffff(Classic Version)|r
## Version: 31.11403
## Version: 32.11403
## Author: |cff20d2ffCodermik (Mik / Castanova on EU-Mirage Raceway) & Aeldra|r (EU-Proudmoore)
## Notes: Cast the most important buffs on you or party, raid, pets and assigned tanks. Use /sbm for options menu.
## DefaultState: Enabled
2 changes: 1 addition & 1 deletion SmartBuff-Wrath.toc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Interface: 30400
## Title: |TInterface\Addons\Smartbuff\Icons\IconEnabled:0|t SmartBuff |cffffffff(Classic Version)|r
## Version: 31.30400
## Version: 32.30400
## Author: |cff20d2ffCodermik (Mik / Castanova on EU-Mirage Raceway) & Aeldra|r (EU-Proudmoore)
## Notes: Cast the most important buffs on you or party, raid, pets and assigned tanks. Use /sbm for options menu.
## DefaultState: Enabled
7 changes: 5 additions & 2 deletions SmartBuff.buffs.lua
Original file line number Diff line number Diff line change
@@ -359,6 +359,7 @@ function SMARTBUFF_InitSpellIDs()
-- Hunter
SMARTBUFF_TRUESHOTAURA = GetSpellInfo(19506); --"Trueshot Aura"
SMARTBUFF_RAPIDFIRE = GetSpellInfo(3045); --"Rapid Fire"
SMARTBUFF_CALLPET = GetSpellInfo(883); --"Call Pet"
SMARTBUFF_AOTH = GetSpellInfo(13165); --"Aspect of the Hawk"
SMARTBUFF_AOTM = GetSpellInfo(13163); --"Aspect of the Monkey"
SMARTBUFF_AOTW = GetSpellInfo(20043); --"Aspect of the Wild"
@@ -695,14 +696,16 @@ function SMARTBUFF_InitSpellList()
SMARTBUFF_BUFFLIST = {
{SMARTBUFF_TRUESHOTAURA, -1, SMARTBUFF_CONST_SELF},
{SMARTBUFF_RAPIDFIRE, 0.2, SMARTBUFF_CONST_SELF},
{SMARTBUFF_AOTDH, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects},

{SMARTBUFF_AOTDH, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects},
{SMARTBUFF_AOTH, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects},
{SMARTBUFF_AOTM, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects},
{SMARTBUFF_AOTV, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects},
{SMARTBUFF_AOTW, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects},
{SMARTBUFF_AOTB, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects},
{SMARTBUFF_AOTC, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects},
{SMARTBUFF_AOTP, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects}
{SMARTBUFF_AOTP, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects},
{SMARTBUFF_CALLPET, -1, SMARTBUFF_CONST_SELF},
};
end

18 changes: 12 additions & 6 deletions SmartBuff.lua
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@
-- Cast the most important buffs on you, tanks or party/raid members/pets.
-------------------------------------------------------------------------------

SMARTBUFF_DATE = "110922";
SMARTBUFF_VERSION = "r31."..SMARTBUFF_DATE;
SMARTBUFF_DATE = "130922 Dev";
SMARTBUFF_VERSION = "r32."..SMARTBUFF_DATE;
SMARTBUFF_VERSIONMIN = 11403; -- min version
SMARTBUFF_VERSIONNR = 30400; -- max version
SMARTBUFF_TITLE = "SmartBuff";
@@ -23,7 +23,7 @@ local SmartbuffSession = true;
local SmartbuffVerCheck = false; -- for my use when checking guild users/testers versions :)
local wowVersionString, wowBuild, _, wowTOC = GetBuildInfo();
local isWOTLKC = (_G.WOW_PROJECT_ID == 5 and wowTOC >= 30000);
local SmartbuffRevision = 30;
local SmartbuffRevision = 31;
local SmartbuffVerNotifyList = {}

-- Smartbuff now uses LibRangeCheck-2.0 by Mitchnull, not fully implemented
@@ -1905,12 +1905,12 @@ function SMARTBUFF_Check(mode, force)
i = i + 1;
end -- END while buffs
end

-- check buffs
if (units) then
for _, unit in pairs(units) do
if (isSetBuffs) then break; end
if (UnitInRange(unit) or unit == "player") then -- unit range checking doesnt work with "player", and only party or raid units.
if ((UnitInRange(unit) or unit == "player")) then -- unit range checking doesnt work with "player", and only party or raid units.
local spellName, actionType, slot, buffType, rankText;
i, actionType, spellName, slot, _, buffType, rankText = SMARTBUFF_BuffUnit(unit, subgroup, mode);
if (i <= 1) then
@@ -2039,7 +2039,13 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell)
bUsable = false;
end
end


-- check for hunter pet spawn and ignore call pet if its already active
if (bUsable and sPlayerClass == "HUNTER") then
if (buffnS == SMARTBUFF_CALLPET and IsPetActive()) then
bUsable = false;
end
end

if (bUsable and not (cBuff.Type == SMARTBUFF_CONST_TRACK or SMARTBUFF_IsItem(cBuff.Type))) then
-- check if you have enough mana/rage/energy to cast
2 changes: 1 addition & 1 deletion SmartBuff.toc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Interface: 20504
## Title: |TInterface\Addons\Smartbuff\Icons\IconEnabled:0|t SmartBuff |cffffffff(Classic Version)|r
## Version: 31.20504
## Version: 32.20504
## Author: |cff20d2ffCodermik (Mik / Castanova on EU-Mirage Raceway) & Aeldra|r (EU-Proudmoore)
## Notes: Cast the most important buffs on you or party, raid, pets and assigned tanks. Use /sbm for options menu.
## DefaultState: Enabled
7 changes: 3 additions & 4 deletions localization.en.lua
Original file line number Diff line number Diff line change
@@ -6,10 +6,9 @@
SMARTBUFF_WHATSNEW = "\n\n|cffffffff Whats new:|r\n\n"
.." |cffffffffClassic version by Codermik\n"
.." Please report any issues on Curse or Discord.|r\n\n\n"
.." Changes in r31:\n\n"
.." * Fixed an issue with DK presence where it would\n"
.." still prompt you even though the presence was\n"
.." currently active on you.\n"
.." Changes in r32:\n\n"
.." * Added support for Hunter's Call Pet which needed\n"
.." some additional logic since its not a buff.\n"
.."\n\n"
.." |c0000FF96Many thanks to Chris S. for his donation and\n"
.." supporting my addon development.\n\n"

0 comments on commit 1a05e4d

Please sign in to comment.