3pT2BS: Fix action composition.

This commit is contained in:
Casper V. Kristensen 2020-10-18 04:17:49 +02:00
parent ecd81ac57a
commit 054d03039f
Signed by: caspervk
GPG key ID: 289CA03790535054

View file

@ -5,7 +5,7 @@ ThreepT2BS.author = GetAddOnMetadata("3pT2BS", "Author")
print(("Loaded %s v%s by %s."):format(ThreepT2BS.title, ThreepT2BS.version, ThreepT2BS.author))
local lastT2BattleShout = 0
local actionMacros = {}
local actions = {}
local function hasRecentlyBattleShouted()
@ -38,18 +38,18 @@ button:SetScript("PreClick", function (self, button, down)
return
end
if hasRecentlyBattleShouted() then
return self:SetAttribute("macrotext", actionMacros.takeWrathOff)
return self:SetAttribute("macrotext", actions.takeWrathOff)
end
if not hasEnoughRageForBattleShout() then
if isBloodRageReady() then
return self:SetAttribute("macrotext", actionMacros.putWrathOn .. actionMacros.castBloodRage)
return self:SetAttribute("macrotext", actions.putWrathOn .. actions.castBloodRage)
end
return self:SetAttribute("macrotext", actionMacros.takeWrathOff)
return self:SetAttribute("macrotext", actions.takeWrathOff)
end
if not has3pT2() then
return self:SetAttribute("macrotext", actionMacros.putWrathOn)
return self:SetAttribute("macrotext", actions.putWrathOn)
end
return self:SetAttribute("macrotext", actionMacros.castBattleShout)
return self:SetAttribute("macrotext", actions.castBattleShout .. actions.takeWrathOff)
end)
@ -101,7 +101,7 @@ function events:ADDON_LOADED()
},
}
for action, lines in pairs(ThreepT2BSDB.actions) do
actionMacros[action] = table.concat(lines, "\n")
actions[action] = table.concat(lines, "\n") .. "\n" -- extra newline allows for action composition
end
end