diff --git a/Ovale.toc b/Ovale.toc
index fa5ec41..7ad6c5d 100644
--- a/Ovale.toc
+++ b/Ovale.toc
@@ -3,7 +3,7 @@
## Notes: Show the icon of the next spell to cast
## Notes-frFR: Affiche l'icône du prochain sort à lancer
## Author: Sidoine
-## Version: 4.3.12
+## Version: 4.3.13
## OptionalDeps: Ace3, Masque, Recount, Skada, LibBabble-CreatureType-3.0, LibRangeCheck-2.0
## SavedVariables: OvaleDB
## SavedVariablesPerCharacter: OvaleDBPC
diff --git a/OvaleCondition.lua b/OvaleCondition.lua
index a66f6d8..3fe49b7 100644
--- a/OvaleCondition.lua
+++ b/OvaleCondition.lua
@@ -235,12 +235,12 @@ local function GetManaAndRate(withBerserker)
if className == "ROGUE" or (className == "DRUID" and GetShapeshiftForm(true) == 3) then
rate = 10 * OvaleAura.meleeHaste
if (className == "ROGUE") then
- local rush = OvaleState:GetAura("player", 13750)
+ local rush = OvaleState:GetAura("player", 13750, true)
if rush and rush.stacks>0 then
rate = rate * 2
end
elseif withBerserker then
- local berserk = OvaleState:GetAura("player", 50334)
+ local berserk = OvaleState:GetAura("player", 50334, true)
if berserk and berserk.stacks>0 then
mana = mana/2
end
@@ -438,7 +438,7 @@ OvaleCondition.conditions=
local spellId = condition[1]
local target = getTarget(condition.target)
if spellId then
- local aura = OvaleState:GetAura(target,spellId)
+ local aura = OvaleState:GetAura(target,spellId, true)
if not aura then
return 0
end
diff --git a/OvaleState.lua b/OvaleState.lua
index 854c943..be073f7 100644
--- a/OvaleState.lua
+++ b/OvaleState.lua
@@ -189,7 +189,7 @@ function OvaleState:AddSpellToStack(spellId, startCast, endCast, nextCast, nocd,
end
--On vrifie si le buff "buffnocd" est prsent, auquel cas le CD du sort n'est pas dclench
if newSpellInfo.buffnocd and not nocd then
- local buffAura = self:GetAura("player", newSpellInfo.buffnocd)
+ local buffAura = self:GetAura("player", newSpellInfo.buffnocd, true)
if self.traceAura then
if buffAura then
Ovale:Print("buffAura stacks = "..buffAura.stacks.." start="..nilstring(buffAura.start).." ending = "..nilstring(buffAura.ending))
@@ -226,12 +226,12 @@ function OvaleState:AddSpellToStack(spellId, startCast, endCast, nextCast, nocd,
end
end
if newSpellInfo.starsurge then
- local buffAura = self:GetAura("player", 48517) --Solar
+ local buffAura = self:GetAura("player", 48517, true) --Solar
if buffAura and buffAura.stacks>0 then
Ovale:Log("starsurge with solar buff = " .. (- newSpellInfo.starsurge))
self.state.eclipse = self.state.eclipse - newSpellInfo.starsurge
else
- buffAura = self:GetAura("player", 48518) --Lunar
+ buffAura = self:GetAura("player", 48518, true) --Lunar
if buffAura and buffAura.stacks>0 then
Ovale:Log("starsurge with lunar buff = " .. newSpellInfo.starsurge)
self.state.eclipse = self.state.eclipse + newSpellInfo.starsurge
@@ -252,57 +252,69 @@ function OvaleState:AddSpellToStack(spellId, startCast, endCast, nextCast, nocd,
end
end
+
--Auras causs par le sort
if newSpellInfo.aura then
for target, targetInfo in pairs(newSpellInfo.aura) do
for filter, filterInfo in pairs(targetInfo) do
for auraSpellId, spellData in pairs(filterInfo) do
- local newAura
+
+ local duration = spellData
+ local stacks = duration
+ local previousAura
+ local auraGUID
if target == "target" then
- newAura = self:NewAura(targetGUID, auraSpellId)
+ auraGUID = targetGUID
else
- newAura = self:NewAura(UnitGUID(target), auraSpellId)
+ auraGUID = UnitGUID(target)
end
- newAura.mine = true
- local duration = spellData
- local stacks = duration
- --Optionnellement, on va regarder la dure du buff
- if auraSpellId and OvaleData.spellInfo[auraSpellId] and OvaleData.spellInfo[auraSpellId].duration then
- duration = OvaleData.spellInfo[auraSpellId].duration
- elseif stacks~="refresh" and stacks > 0 then
- stacks = 1
+
+ if stacks == "refresh" then
+ previousAura = self:GetAuraByGUID(auraGUID, auraSpellId, true, target)
end
- if stacks=="refresh" then
- if newAura.ending then
- newAura.ending = endCast + duration
+
+ if stacks ~= "refresh" or previousAura then
+ local newAura = self:NewAura(auraGUID, auraSpellId)
+
+ newAura.mine = true
+ --Optionnellement, on va regarder la dure du buff
+ if auraSpellId and OvaleData.spellInfo[auraSpellId] and OvaleData.spellInfo[auraSpellId].duration then
+ duration = OvaleData.spellInfo[auraSpellId].duration
+ elseif stacks~="refresh" and stacks > 0 then
+ stacks = 1
end
- elseif stacks<0 and newAura.ending then
- --Buff are immediatly removed when the cast ended, do not need to do it again
- if filter~="HELPFUL" or target~="player" or endCast>=self.maintenant then
- newAura.stacks = newAura.stacks + stacks
- if Ovale.trace then
- Ovale:Print("removing one stack of "..auraSpellId.." because of ".. spellId.." to ".. newAura.stacks)
- end
- --Plus de stacks, on supprime l'aura
- if newAura.stacks<=0 then
- Ovale:Log("Aura is completly removed")
- newAura.stacks = 0
- newAura.ending = 0
+ if stacks=="refresh" then
+ newAura.start = previousAura.start
+ newAura.stacks = previousAura.stacks
+ newAura.ending = endCast + duration
+ elseif stacks<0 and newAura.ending then
+ --Buff are immediatly removed when the cast ended, do not need to do it again
+ if filter~="HELPFUL" or target~="player" or endCast>=self.maintenant then
+ newAura.stacks = newAura.stacks + stacks
+ if Ovale.trace then
+ Ovale:Print("removing one stack of "..auraSpellId.." because of ".. spellId.." to ".. newAura.stacks)
+ end
+ --Plus de stacks, on supprime l'aura
+ if newAura.stacks<=0 then
+ Ovale:Log("Aura is completly removed")
+ newAura.stacks = 0
+ newAura.ending = 0
+ end
end
- end
- elseif newAura.ending and newAura.ending >= endCast then
- newAura.ending = endCast + duration
- newAura.stacks = newAura.stacks + stacks
- else
- newAura.start = endCast
- newAura.ending = endCast + duration
- newAura.stacks = stacks
- end
- if Ovale.trace then
- if auraSpellId then
- Ovale:Print(spellId.." adding "..stacks.." aura "..auraSpellId.." to "..target.." "..filter.." "..newAura.start..","..newAura.ending)
+ elseif newAura.ending and newAura.ending >= endCast then
+ newAura.ending = endCast + duration
+ newAura.stacks = newAura.stacks + stacks
else
- Ovale:Print("adding nil aura")
+ newAura.start = endCast
+ newAura.ending = endCast + duration
+ newAura.stacks = stacks
+ end
+ if Ovale.trace then
+ if auraSpellId then
+ Ovale:Print(spellId.." adding "..stacks.." aura "..auraSpellId.." to "..target.." "..filter.." "..newAura.start..","..newAura.ending)
+ else
+ Ovale:Print("adding nil aura")
+ end
end
end
end
@@ -360,16 +372,19 @@ function OvaleState:AddEclipse(endCast, spellId)
newAura.ending = nil
end
-function OvaleState:GetAura(target, spellId, mine)
- local guid = UnitGUID(target)
-
- if self.aura[guid] and self.aura[guid][spellId] and self.aura[guid][spellId].serial == self.serial then
+function OvaleState:GetAuraByGUID(guid, spellId, mine, target)
+ if mine and self.aura[guid] and self.aura[guid][spellId] and self.aura[guid][spellId].serial == self.serial then
return self.aura[guid][spellId]
else
return OvaleAura:GetAuraByGUID(guid, spellId, mine, target)
end
end
+function OvaleState:GetAura(target, spellId, mine)
+ return self:GetAuraByGUID(UnitGUID(target), spellId, mine, target)
+end
+
+
function OvaleState:GetExpirationTimeOnAnyTarget(spellId)
local starting, ending = OvaleAura:GetExpirationTimeOnAnyTarget(spellId)
for unitId,auraTable in pairs(self.aura) do