diff --git a/Condition.lua b/Condition.lua
index 5fb706e..d5c8157 100644
--- a/Condition.lua
+++ b/Condition.lua
@@ -434,6 +434,32 @@ Ovale.conditions=
ManaPercent = function(condition)
return compare(UnitPower("player")/UnitPowerMax("player"), condition[1], condition[2]/100)
end,
+ OtherDebuffExpires = function(condition)
+ Ovale:EnableOtherDebuffs()
+ local otherDebuff = Ovale.otherDebuffs[GetSpellInfo(condition[1])]
+ if otherDebuff then
+ local timeBefore = condition[2] or 0
+ local maxTime = condition[3] or 10
+ local minTime
+ for k,v in pairs(otherDebuff) do
+ local diff = v - Ovale.maintenant
+ if diff<-maxTime then
+ -- Ovale:Print("enlève obsolète sur "..k)
+ otherDebuff[k] = nil
+ elseif k~=UnitGUID("target") and (not minTime or diff<minTime) then
+ minTime = diff
+ end
+ end
+ if not minTime then
+ return nil
+ end
+ minTime = minTime - timeBefore
+ if minTime<0 then
+ minTime = 0
+ end
+ return minTime
+ end
+ end,
-- Test if any player pet is present (or not)
-- 1 : "yes" or "no"
PetPresent = function(condition)
diff --git a/Locale-enUS.lua b/Locale-enUS.lua
index 5a33793..404a84e 100644
--- a/Locale-enUS.lua
+++ b/Locale-enUS.lua
@@ -24,4 +24,5 @@ L["Affiche le temps de recharge sous forme numérique"] = "Show the remaining ti
L["Si cible uniquement"] = "If has target"
L["Verrouiller position"] = "Lock position"
L["Vertical"] = true
-L["Marge entre deux icônes"] = "Margin between icons"
\ No newline at end of file
+L["Marge entre deux icônes"] = "Margin between icons"
+L["Focus"] = true
\ No newline at end of file
diff --git a/Locale-frFR.lua b/Locale-frFR.lua
index 73dfa6d..2309ad0 100644
--- a/Locale-frFR.lua
+++ b/Locale-frFR.lua
@@ -24,4 +24,5 @@ L["Affiche le temps de recharge sous forme numérique"] = true
L["Si cible uniquement"] = true
L["Verrouiller position"] = true
L["Vertical"] = true
-L["Marge entre deux icônes"] = true
\ No newline at end of file
+L["Marge entre deux icônes"] = true
+L["Focus"] = true
\ No newline at end of file
diff --git a/Ovale.lua b/Ovale.lua
index 6c16bac..49c957b 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -32,6 +32,7 @@ Ovale.buff = {}
Ovale.className = nil
Ovale.state = {rune={}, cd = {}}
Ovale.scoreSpell = {}
+Ovale.otherDebuffs = {}
Ovale.arbre = {}
@@ -261,6 +262,44 @@ function Ovale:UPDATE_BINDINGS()
self:RemplirActionIndexes()
end
+function Ovale:GetOtherDebuffs(spellName)
+ if not self.otherDebuffs[spellName] then
+ self.otherDebuffs[spellName] = {}
+ end
+ return self.otherDebuffs[spellName]
+end
+
+function Ovale:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
+ if self.otherDebuffsEnabled then
+ local time, event, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags = select(1, ...)
+ -- self:Print("event="..event.." source="..sourceName.." destName="..destName)
+ if sourceName == UnitName("player") then
+ if string.find(event, "SPELL_AURA_") == 1 then
+ local spellId, spellName, spellSchool, auraType = select(9, ...)
+ if auraType == "DEBUFF" and self.spellInfo[spellName] and self.spellInfo[spellName].duration then
+ local otherDebuff = self:GetOtherDebuffs(spellName)
+ if event == "SPELL_AURA_APPLIED" or event == "SPELL_AURA_REFRESH" then
+ otherDebuff[destGUID] = Ovale.maintenant + self.spellInfo[spellName].duration
+ -- self:Print("ajout de "..spellName.." à "..destGUID)
+ elseif event == "SPELL_AURA_REMOVED" then
+ -- otherDebuff[destGUID] = nil
+ -- self:Print("suppression de "..spellName.." de "..destGUID)
+ end
+ end
+ end
+ end
+ if event == "UNIT_DIED" then
+ for k,v in pairs(self.otherDebuffs) do
+ for j,w in pairs(v) do
+ if j==destGUID then
+ v[j] = nil
+ end
+ end
+ end
+ end
+ end
+end
+
--[[
function Ovale:SaveAura(unit, filter)
local i=1
@@ -287,11 +326,6 @@ function Ovale:SaveAura(unit, filter)
end
end
-function Ovale:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
- local time, event, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags = select(1, ...)
- if (
- if (event
-end
function Ovale:PLAYER_TARGET_CHANGED()
Ovale.targetGUID = UnitGUID("target")
@@ -450,7 +484,8 @@ function Ovale:OnEnable()
self:RegisterEvent("ACTIONBAR_PAGE_CHANGED")
self:RegisterEvent("UNIT_SPELLCAST_SENT")
self:RegisterEvent("PLAYER_TARGET_CHANGED")
-
+ self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
+
if (not self.firstInit) then
self:FirstInit()
end
@@ -510,7 +545,7 @@ function Ovale:OnDisable()
self:UnregisterEvent("UNIT_AURA")
self:UnregisterEvent("UNIT_SPELLCAST_SENT")
self:UnregisterEvent("PLAYER_TARGET_CHANGED")
- -- self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
+ self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
self.frame:Hide()
end
@@ -698,6 +733,7 @@ function Ovale:AddSpellToStack(spellName, startCast, endCast, nextCast)
newSpell.info = nil
end
self.currentSpellName = spellName
+ self.startCast = startCast
self.attenteFinCast = nextCast
if startCast>=0 then
if newSpell.info then
@@ -774,12 +810,12 @@ function Ovale:InitCalculerMeilleureAction()
-- On attend que le sort courant soit fini
local spell, rank, displayName, icon, startTime, endTime, isTradeSkill = UnitCastingInfo("player")
if (spell) then
- self:AddSpellToStack(spell, startTime - Ovale.maintenant, endTime/1000 - Ovale.maintenant, endTime/1000 - Ovale.maintenant)
+ self:AddSpellToStack(spell, startTime/1000 - Ovale.maintenant, endTime/1000 - Ovale.maintenant, endTime/1000 - Ovale.maintenant)
end
local spell, rank, displayName, icon, startTime, endTime, isTradeSkill = UnitChannelInfo("player")
if (spell) then
- self:AddSpellToStack(spell, startTime - Ovale.maintenant, endTime/1000 - Ovale.maintenant, endTime/1000 - Ovale.maintenant)
+ self:AddSpellToStack(spell, startTime/1000 - Ovale.maintenant, endTime/1000 - Ovale.maintenant, endTime/1000 - Ovale.maintenant)
end
end
@@ -890,6 +926,12 @@ function Ovale:GetActionInfo(element)
actionShortcut = nil
actionIsCurrent = nil
end
+ elseif element.func=="Texture" then
+ actionTexture = "Interface\\Icons\\"..element.params[1]
+ actionCooldownStart = Ovale.maintenant
+ actionCooldownDuration = 0
+ actionEnable = 1
+ actionUsable = true
end
if (action and not actionTexture) then
@@ -910,7 +952,7 @@ function Ovale:GetActionInfo(element)
end
return actionTexture, actionInRange, actionCooldownStart, actionCooldownDuration,
- actionUsable, actionShortcut, actionIsCurrent, actionEnable, spellName
+ actionUsable, actionShortcut, actionIsCurrent, actionEnable, spellName, target
end
function Ovale:CalculerMeilleureAction(element)
@@ -924,7 +966,7 @@ function Ovale:CalculerMeilleureAction(element)
--TODO: créer un objet par type au lieu de ce if else if tout moche
if (element.type=="function")then
- if (element.func == "Spell" or element.func=="Macro" or element.func=="Item") then
+ if (element.func == "Spell" or element.func=="Macro" or element.func=="Item" or element.func=="Texture") then
local action
local actionTexture, actionInRange, actionCooldownStart, actionCooldownDuration,
actionUsable, actionShortcut, actionIsCurrent, actionEnable, spellName = self:GetActionInfo(element)
@@ -954,9 +996,28 @@ function Ovale:CalculerMeilleureAction(element)
else
restant = actionCooldownDuration - (self.maintenant - actionCooldownStart);
end
- if restant<self.attenteFinCast and (spellName==self.currentSpellName or not self.spellInfo[self.currentSpellName] or
- not self.spellInfo[self.currentSpellName].canStopChannelling) then
- restant = self.attenteFinCast
+
+ if restant<self.attenteFinCast then
+ if spellName==self.currentSpellName or not self.spellInfo[self.currentSpellName] or
+ not self.spellInfo[self.currentSpellName].canStopChannelling then
+ restant = self.attenteFinCast
+ else
+ --TODO: pas exact, parce que si ce sort est reporté de par exemple 0,5s par un debuff
+ --ça tombera entre deux ticks
+ local ticks = self.spellInfo[self.currentSpellName].canStopChannelling
+ local tickLength = (self.attenteFinCast - self.startCast) / ticks
+ local tickTime = self.startCast + tickLength
+ if (Ovale.trace) then
+ self:Print("ticks = "..ticks.." tickLength="..tickLength.." tickTime="..tickTime)
+ end
+ for i=1,ticks-1 do
+ if restant<=tickTime then
+ restant = tickTime
+ break
+ end
+ tickTime = tickTime + tickLength
+ end
+ end
end
if (Ovale.trace) then
self:Print("Action "..element.params[1].." remains "..restant)
@@ -1229,4 +1290,11 @@ end
function Ovale:ResetSpellInfo()
self.spellInfo = {}
+end
+
+function Ovale:EnableOtherDebuffs()
+ if self.otherDebuffsEnabled then
+ return
+ end
+ self.otherDebuffsEnabled = true
end
\ No newline at end of file
diff --git a/OvaleCompile.lua b/OvaleCompile.lua
index 492b93f..0f6bc6b 100644
--- a/OvaleCompile.lua
+++ b/OvaleCompile.lua
@@ -16,7 +16,7 @@ local function ParseParameters(params)
end
params = string.gsub(params,"%w+=%w+","")
local n=0
- for w in string.gmatch(params, "%w+") do
+ for w in string.gmatch(params, "[%w_]+") do
if (string.match(w,"^%-?%d+%.?%d*$")) then
w = tonumber(w)
end
diff --git a/OvaleFrame.lua b/OvaleFrame.lua
index e1e75c8..7499aff 100644
--- a/OvaleFrame.lua
+++ b/OvaleFrame.lua
@@ -136,13 +136,13 @@ do
local action = self.actions[k]
local actionTexture, actionInRange, actionCooldownStart, actionCooldownDuration,
- actionUsable, actionShortcut, actionIsCurrent, actionEnable, spellName = Ovale:GetActionInfo(element)
+ actionUsable, actionShortcut, actionIsCurrent, actionEnable, spellName, actionTarget = Ovale:GetActionInfo(element)
if (node.params.nocd and node.params.nocd == 1 and minAttente~=nil and minAttente>1.5) then
action.icons[1]:Update(nil)
else
action.icons[1]:Update(minAttente, actionTexture, actionInRange, actionCooldownStart, actionCooldownDuration,
- actionUsable, actionShortcut, actionIsCurrent, actionEnable, spellName)
+ actionUsable, actionShortcut, actionIsCurrent, actionEnable, spellName, actionTarget)
end
action.spellName = spellName
diff --git a/OvaleIcone.lua b/OvaleIcone.lua
index 4853a17..0b4e62e 100644
--- a/OvaleIcone.lua
+++ b/OvaleIcone.lua
@@ -1,7 +1,8 @@
local LBF = LibStub("LibButtonFacade", true)
+local L = LibStub("AceLocale-3.0"):GetLocale("Ovale")
local function Update(self, minAttente, actionTexture, actionInRange, actionCooldownStart, actionCooldownDuration,
- actionUsable, actionShortcut)
+ actionUsable, actionShortcut, actionIsCurrent, actionEnable, spellName, actionTarget)
if (not Ovale.bug) then
Ovale.traced = false
@@ -85,11 +86,17 @@ local function Update(self, minAttente, actionTexture, actionInRange, actionCool
else
self.aPortee:Hide()
end
+ if actionTarget=="focus" then
+ self.focusText:Show()
+ else
+ self.focusText:Hide()
+ end
else
self.icone:Hide()
self.aPortee:Hide()
self.shortcut:Hide()
self.remains:Hide()
+ self.focusText:Hide()
end
return minAttente,element
end
@@ -125,6 +132,12 @@ function OvaleIcone_OnLoad(self)
self.cd = _G[name.."Cooldown"]
self.normalTexture = _G[name.."NormalTexture"]
+ self.focusText = self:CreateFontString(nil, "OVERLAY");
+ self.focusText:SetFontObject("GameFontNormal");
+ self.focusText:SetAllPoints(self);
+ self.focusText:SetTextColor(1,1,1);
+ self.focusText:SetText(L["Focus"])
+
self:RegisterForClicks("LeftButtonUp")
self.SetSkinGroup = SetSkinGroup
self.Update = Update
diff --git a/OvaleIcone.xml b/OvaleIcone.xml
index 3bbeb3f..d12bc7b 100644
--- a/OvaleIcone.xml
+++ b/OvaleIcone.xml
@@ -2,7 +2,6 @@
<CheckButton name="OvaleIcone" virtual="true" inherits="ActionButtonTemplate">
<Scripts>
- <!--<OnUpdate>OvaleIcone_OnUpdate(self);</OnUpdate>-->
<OnLoad>OvaleIcone_OnLoad(self);</OnLoad>
<OnClick>OvaleIcone_OnClick(self)</OnClick>
</Scripts>
diff --git a/defaut/Pretre.lua b/defaut/Pretre.lua
index 6d18a4a..8b8facf 100644
--- a/defaut/Pretre.lua
+++ b/defaut/Pretre.lua
@@ -16,10 +16,11 @@ Define(Shadowfiend 34433)
# Spells with cast time that add buff or debuff
SpellAddTargetDebuff(SWP SWP=18)
+SpellInfo(SWP duration=18)
SpellAddBuff(SWP SW=15)
SpellAddTargetDebuff(VT VT=15)
SpellAddBuff(VT SW=15)
-SpellInfo(MF canStopChannelling=1)
+SpellInfo(MF canStopChannelling=3)
SpellAddBuff(MF SW=15)
SpellInfo(MB cd=5.5)
SpellAddBuff(MB SW=15)
@@ -63,6 +64,9 @@ Spell(MB)
if TargetDebuffExpires(DP 0 mine=1)
Spell(DP)
+if OtherDebuffExpires(SWP)
+ Texture(INV_Misc_Coin_01)
+
#cast Mind flay if nothing else can be done
Spell(MF priority=2)