Skip to content

Commit

Permalink
- Optimized all song/buff getters to not do additional spell lookups …
Browse files Browse the repository at this point in the history
…for no reason.
  • Loading branch information
DerpleMQ2 committed Mar 8, 2024
1 parent f6fe65b commit 7fb5324
Show file tree
Hide file tree
Showing 16 changed files with 176 additions and 90 deletions.
10 changes: 5 additions & 5 deletions class_configs/ber_class_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,8 @@ return {
name = "Battle Leap",
type = "AA",
cond = function(self, aaName)
return RGMercUtils.GetSetting('DoBattleLeap') and not RGMercUtils.SongActive("Battle Leap Warcry") and
not RGMercUtils.SongActive("Group Bestial Alignment")
return RGMercUtils.GetSetting('DoBattleLeap') and not RGMercUtils.SongActiveByName("Battle Leap Warcry") and
not RGMercUtils.SongActiveByName("Group Bestial Alignment")
end,
},
{
Expand Down Expand Up @@ -595,7 +595,7 @@ return {
name = "SharedBuff",
type = "Disc",
cond = function(self, discSpell)
return RGMercUtils.PCDiscReady(discSpell) and not RGMercUtils.SongActive(discSpell.RankName())
return RGMercUtils.PCDiscReady(discSpell) and not RGMercUtils.SongActiveByName(discSpell.RankName())
end,
},
{
Expand Down Expand Up @@ -678,14 +678,14 @@ return {
name = "FrenzyBoost",
type = "Disc",
cond = function(self, discSpell)
return not RGMercUtils.BuffActiveByName(discSpell.Name() or "None")
return not RGMercUtils.BuffActive(discSpell)
end,
},
{
name = "CryDmg",
type = "Disc",
cond = function(self, discSpell)
return not RGMercUtils.SongActive(discSpell.Name() or "None")
return not RGMercUtils.SongActiveByName(discSpell.Name() or "None")
end,
},
{
Expand Down
38 changes: 19 additions & 19 deletions class_configs/bst_class_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -707,24 +707,24 @@ return {
},
['HelperFunctions'] = {
BeastialAligmentCheck = function(self)
return not RGMercUtils.SongActive(self.ResolvedActionMap['HHEFuryDisc'].RankName() or "None") and
not RGMercUtils.SongActive('Bestial Alignment') and
return not RGMercUtils.SongActiveByName(self.ResolvedActionMap['HHEFuryDisc'].RankName() or "None") and
not RGMercUtils.SongActiveByName('Bestial Alignment') and
not RGMercUtils.BuffActiveByName('Ferociousness')
end,
HHEFuryDiscCheckPrimary = function(self)
return not RGMercUtils.SongActive(self.ResolvedActionMap['HHEFuryDisc'].RankName() or "None") and
not RGMercUtils.SongActive('Bestial Alignment') and
return not RGMercUtils.SongActiveByName(self.ResolvedActionMap['HHEFuryDisc'].RankName() or "None") and
not RGMercUtils.SongActiveByName('Bestial Alignment') and
not RGMercUtils.BuffActiveByName('Ferociousness') and
not RGMercUtils.PCAAReady("Bestial Alignment")
end,
HHEFuryDiscCheckSecondary = function(self)
return RGMercUtils.SongActive(self.ResolvedActionMap['HHEFuryDisc'].RankName() or "None") and
not RGMercUtils.SongActive('Bestial Alignment') and
return RGMercUtils.SongActiveByName(self.ResolvedActionMap['HHEFuryDisc'].RankName() or "None") and
not RGMercUtils.SongActiveByName('Bestial Alignment') and
not RGMercUtils.BuffActiveByName('Ferociousness')
end,
FerociousnessCheck = function(self)
return not RGMercUtils.SongActive(self.ResolvedActionMap['HHEFuryDisc'].RankName() or "None") and
not RGMercUtils.SongActive('Bestial Alignment')
return not RGMercUtils.SongActiveByName(self.ResolvedActionMap['HHEFuryDisc'].RankName() or "None") and
not RGMercUtils.SongActiveByName('Bestial Alignment')
end,
},
['Rotations'] = {
Expand Down Expand Up @@ -842,7 +842,7 @@ return {
cond = function(self, spell, target, uiCheck)
-- force the target for StacksTarget to work.
if not uiCheck then RGMercUtils.SetTarget(target.ID() or 0) end
return RGMercUtils.GetSetting('DoSlow') and not RGMercUtils.CanUseAA("Sha's Reprisal") and not RGMercUtils.TargetHasBuffByName(spell.RankName()) and
return RGMercUtils.GetSetting('DoSlow') and not RGMercUtils.CanUseAA("Sha's Reprisal") and not RGMercUtils.TargetHasBuff(spell) and
RGMercUtils.SpellStacksOnTarget(spell) and
spell.SlowPct() > (RGMercUtils.GetTargetSlowedPct())
end,
Expand Down Expand Up @@ -1006,23 +1006,23 @@ return {
type = "Spell",
cond = function(self, spell, target, uiCheck)
if not uiCheck then RGMercUtils.SetTarget(target.ID() or 0) end
return RGMercUtils.GetSetting('DoRunSpeed') and not RGMercUtils.TargetHasBuffByName(spell.RankName())
return RGMercUtils.GetSetting('DoRunSpeed') and not RGMercUtils.TargetHasBuff(spell)
end,
},
{
name = "ManaRegenBuff",
type = "Spell",
cond = function(self, spell, target, uiCheck)
if not uiCheck then RGMercUtils.SetTarget(target.ID() or 0) end
return RGMercConfig.Constants.RGCasters:contains(target.Class.ShortName()) and not RGMercUtils.TargetHasBuffByName(spell.RankName())
return RGMercConfig.Constants.RGCasters:contains(target.Class.ShortName()) and not RGMercUtils.TargetHasBuff(spell)
end,
},
{
name = "AvatarSpell",
type = "Spell",
cond = function(self, spell, target, uiCheck)
if not uiCheck then RGMercUtils.SetTarget(target.ID() or 0) end
return RGMercConfig.Constants.RGMelee:contains(target.Class.ShortName()) and not RGMercUtils.TargetHasBuffByName(spell.RankName()) and
return RGMercConfig.Constants.RGMelee:contains(target.Class.ShortName()) and not RGMercUtils.TargetHasBuff(spell) and
RGMercUtils.GetSetting('DoAvatar')
end,
},
Expand All @@ -1032,7 +1032,7 @@ return {
cond = function(self, spell, target, uiCheck)
-- force the target for StacksTarget to work.
if not uiCheck then RGMercUtils.SetTarget(target.ID() or 0) end
return not RGMercUtils.TargetHasBuffByName(spell.RankName()) and RGMercUtils.SpellStacksOnTarget(spell)
return not RGMercUtils.TargetHasBuff(spell) and RGMercUtils.SpellStacksOnTarget(spell)
end,
},
{
Expand All @@ -1042,7 +1042,7 @@ return {
-- force the target for StacksTarget to work.
if not uiCheck then RGMercUtils.SetTarget(target.ID() or 0) end
local targetClass = target.Class.ShortName()
return (targetClass == "WAR" or targetClass == "PAL" or targetClass == "SHD") and not RGMercUtils.TargetHasBuffByName(spell.RankName()) and
return (targetClass == "WAR" or targetClass == "PAL" or targetClass == "SHD") and not RGMercUtils.TargetHasBuff(spell) and
RGMercUtils.SpellStacksOnTarget(spell)
end,
},
Expand All @@ -1052,7 +1052,7 @@ return {
cond = function(self, spell, target, uiCheck)
-- force the target for StacksTarget to work.
if not uiCheck then RGMercUtils.SetTarget(target.ID() or 0) end
return not RGMercUtils.TargetHasBuffByName(spell.RankName()) and RGMercUtils.SpellStacksOnTarget(spell)
return not RGMercUtils.TargetHasBuff(spell) and RGMercUtils.SpellStacksOnTarget(spell)
end,
},
{
Expand All @@ -1062,7 +1062,7 @@ return {
local targetClass = target.Class.ShortName()
-- force the target for StacksTarget to work.
if not uiCheck then RGMercUtils.SetTarget(target.ID() or 0) end
return (targetClass == "WAR" or targetClass == "PAL" or targetClass == "SHD") and not RGMercUtils.TargetHasBuffByName(spell.RankName()) and
return (targetClass == "WAR" or targetClass == "PAL" or targetClass == "SHD") and not RGMercUtils.TargetHasBuff(spell) and
RGMercUtils.SpellStacksOnTarget(spell)
end,
},
Expand All @@ -1072,7 +1072,7 @@ return {
cond = function(self, spell, target, uiCheck)
-- force the target for StacksTarget to work.
if not uiCheck then RGMercUtils.SetTarget(target.ID() or 0) end
return not RGMercUtils.TargetHasBuffByName(spell.RankName()) and RGMercUtils.SpellStacksOnTarget(spell)
return not RGMercUtils.TargetHasBuff(spell) and RGMercUtils.SpellStacksOnTarget(spell)
end,
},
{
Expand All @@ -1082,7 +1082,7 @@ return {
local targetClass = target.Class.ShortName()
-- force the target for StacksTarget to work.
if not uiCheck then RGMercUtils.SetTarget(target.ID() or 0) end
return (targetClass == "WAR" or targetClass == "PAL" or targetClass == "SHD") and not RGMercUtils.TargetHasBuffByName(spell.RankName()) and
return (targetClass == "WAR" or targetClass == "PAL" or targetClass == "SHD") and not RGMercUtils.TargetHasBuff(spell) and
RGMercUtils.SpellStacksOnTarget(spell)
end,
},
Expand Down Expand Up @@ -1209,7 +1209,7 @@ return {
name = "PetGrowl",
type = "Spell",
cond = function(self, spell)
return (not RGMercUtils.GetSetting('DoSwarmPet')) and not RGMercUtils.SongActive(spell.RankName())
return (not RGMercUtils.GetSetting('DoSwarmPet')) and not RGMercUtils.SongActiveByName(spell.RankName())
end,
},
},
Expand Down
2 changes: 1 addition & 1 deletion class_configs/clr_class_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ local _ClassConfig = {
type = "Spell",
cond = function(self)
return RGMercUtils.GetTargetDistance() < RGMercUtils.GetSetting('AssistRange') and
not RGMercUtils.SongActive("Healing Twincast") and
not RGMercUtils.SongActiveByName("Healing Twincast") and
RGMercUtils.GetTargetPctHPs() <= RGMercUtils.GetSetting('AutoAssistAt')
end,
},
Expand Down
11 changes: 5 additions & 6 deletions class_configs/dru_class_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1142,8 +1142,7 @@ local _ClassConfig = {
name = "Blessing of Ro",
type = "AA",
cond = function(self, aaName, target)
return not RGMercUtils.TargetHasBuffByName(mq.TLO.Me.AltAbility(aaName).Spell.Trigger(1).RankName
.Name()) and
return not RGMercUtils.TargetHasBuff(mq.TLO.Me.AltAbility(aaName).Spell.Trigger(1)) and
mq.TLO.FindItemCount(mq.TLO.Me.AltAbility("Blessing of Ro").Spell.Trigger(1).NoExpendReagentID(1)())() >
0
end,
Expand Down Expand Up @@ -1210,7 +1209,7 @@ local _ClassConfig = {
type = "Spell",
active_cond = function(self, spell) return true end,
cond = function(self, spell, target)
return not RGMercUtils.TargetHasBuffByName(spell.RankName.Name()) and target and target and
return not RGMercUtils.TargetHasBuff(spell) and target and target and
Set.new({ "BRD", "SHD", "PAL", "WAR", "ROG", "BER", "MNK", "RNG", }):contains(target.Class
.ShortName())
end,
Expand All @@ -1220,7 +1219,7 @@ local _ClassConfig = {
type = "Spell",
active_cond = function(self, spell) return true end,
cond = function(self, spell, target)
return not RGMercUtils.TargetHasBuffByName(spell.RankName.Name()) and target and target and
return not RGMercUtils.TargetHasBuff(spell) and target and target and
RGMercConfig.Constants.RGTank:contains(target.Class.ShortName())
end,
},
Expand All @@ -1239,7 +1238,7 @@ local _ClassConfig = {
type = "Spell",
active_cond = function(self, spell) return true end,
cond = function(self, spell, target)
return not RGMercUtils.TargetHasBuffByName(spell.RankName.Name()) and target and target and
return not RGMercUtils.TargetHasBuff(spell) and target and target and
Set.new({ "SHD", "WAR", }):contains(target.Class.ShortName())
end,
},
Expand All @@ -1258,7 +1257,7 @@ local _ClassConfig = {
type = "AA",
active_cond = function(self, aaName) return true end,
cond = function(self, aaName, target)
return not RGMercUtils.TargetHasBuffByName(mq.TLO.Me.AltAbility(aaName).Spell.RankName.Name()) and
return not RGMercUtils.TargetHasBuff(mq.TLO.Me.AltAbility(aaName).Spell) and
target.ID() == RGMercUtils.GetMainAssistId()
end,
},
Expand Down
6 changes: 3 additions & 3 deletions class_configs/mag_class_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ _ClassConfig = {
name = "AllianceBuff",
type = "Spell",
cond = function(self, spell)
return RGMercUtils.IsNamed(mq.TLO.Target) and not RGMercUtils.TargetHasBuffByName(self.ResolvedActionMap['AllianceBuff']) and
return RGMercUtils.IsNamed(mq.TLO.Target) and not RGMercUtils.TargetHasBuff(spell) and
RGMercUtils.GetSetting('DoAlliance') and RGMercUtils.CanAlliance()
end,
},
Expand Down Expand Up @@ -1462,7 +1462,7 @@ _ClassConfig = {
-- name = "AllianceBuff",
-- type = "Spell",
-- cond = function(self, spell)
-- return RGMercUtils.IsNamed(mq.TLO.Target) and not RGMercUtils.TargetHasBuffByName(spell.RankName()) and
-- return RGMercUtils.IsNamed(mq.TLO.Target) and not RGMercUtils.TargetHasBuff(spell) and
-- RGMercUtils.GetSetting('DoAlliance') and RGMercUtils.CanAlliance()
-- end,
-- },
Expand Down Expand Up @@ -1619,7 +1619,7 @@ _ClassConfig = {
name = "PetManaConv",
type = "Spell",
cond = function(self, spell)
return spell and spell() and not RGMercUtils.BuffActiveByName(mq.TLO.Spell(spell.AutoCast() or "").Name() or "") and mq.TLO.Me.Pet.ID() > 0
return spell and spell() and not RGMercUtils.BuffActive(mq.TLO.Spell(spell.AutoCast() or "")) and mq.TLO.Me.Pet.ID() > 0
end,
},
{
Expand Down
2 changes: 1 addition & 1 deletion class_configs/mnk_class_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ local _ClassConfig = {
name = "FistsWu",
type = "Disc",
cond = function(self, discSpell)
return not RGMercUtils.SongActive(discSpell.RankName() or "None")
return not RGMercUtils.SongActive(discSpell)
end,
},
{
Expand Down
10 changes: 5 additions & 5 deletions class_configs/nec_class_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1003,8 +1003,8 @@ local _ClassConfig = {
--{
-- name = "BestowBuff",
-- type = "Spell",
-- active_cond = function(self, spell) return RGMercUtils.SongActive(spell.RankName()) end,
-- cond = function(self, spell) return not RGMercUtils.SongActive(spell.RankName()) end,
-- active_cond = function(self, spell) return RGMercUtils.SongActiveByName(spell.RankName()) end,
-- cond = function(self, spell) return not RGMercUtils.SongActiveByName(spell.RankName()) end,
--},
},
['Downtime'] = {
Expand Down Expand Up @@ -1057,15 +1057,15 @@ local _ClassConfig = {
{
name = "Death Bloom",
type = "AA",
active_cond = function(self, aaName) return RGMercUtils.SongActive(mq.TLO.AltAbility(aaName).Spell.RankName()) end,
active_cond = function(self, aaName) return RGMercUtils.SongActiveByName(mq.TLO.AltAbility(aaName).Spell.RankName()) end,
cond = function(self, aaName) return RGMercUtils.AAReady(aaName) and mq.TLO.Me.PctMana() < RGMercUtils.GetSetting('DeathBloomPercent') end,
},
-- Leaving this out because it mems every 60s and thats wonky.
--{
-- name = "BestowBuff",
-- type = "Spell",
-- active_cond = function(self, spell) return RGMercUtils.SongActive(spell.RankName()) end,
-- cond = function(self, spell) return not RGMercUtils.SongActive(spell.RankName()) end,
-- active_cond = function(self, spell) return RGMercUtils.SongActiveByName(spell.RankName()) end,
-- cond = function(self, spell) return not RGMercUtils.SongActiveByName(spell.RankName()) end,
--},
{
name = "PetSpellWar",
Expand Down
4 changes: 2 additions & 2 deletions class_configs/pal_class_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,8 @@ return {
name = "Spire of ChivalryValorous Rage",
type = "AA",
cond = function(self, aaName)
return mq.TLO.Me.Level() < 80 and RGMercUtils.AAReady(aaName) and not RGMercUtils.SongActive('Group Armor of the Inquisitor') and
not RGMercUtils.SongActive('Armor of the Inquisitor') and not RGMercUtils.BuffActiveByName('Spire of Chivalry')
return mq.TLO.Me.Level() < 80 and RGMercUtils.AAReady(aaName) and not RGMercUtils.SongActiveByName('Group Armor of the Inquisitor') and
not RGMercUtils.SongActiveByName('Armor of the Inquisitor') and not RGMercUtils.BuffActiveByName('Spire of Chivalry')
end,
},
{
Expand Down

0 comments on commit 7fb5324

Please sign in to comment.