Quantcast

- bug fixes with trinkets

Sidoine De Wispelaere [07-05-09 - 13:06]
- bug fixes with trinkets

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@84 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Ovale.lua
defaut/Demoniste.lua
defaut/Mage.lua
diff --git a/Ovale.lua b/Ovale.lua
index 291a254..8d42e28 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -675,40 +675,62 @@ function Ovale:CalculerMeilleureAction(element)
 	if (element.type=="function")then
 		if (element.func == "Spell" or element.func=="Macro" or element.func=="Item") then
 			local action
+			local actionTexture, actionInRange, actionCooldownStart, actionCooldownDuration,
+				actionUsable, actionShortcut, actionIsCurrent, actionEnable
+
 			if (element.func == "Spell" ) then
 				local sort = self:GetSpellInfoOrNil(element.params[1])
 				action = self.actionSort[sort]
+				if (not action or not GetActionTexture(action)) then
+					actionTexture = GetSpellTexture(sort)
+					actionInRange = IsSpellInRange(sort, "target")
+					actionCooldownStart, actionCooldownDuration, actionEnable = GetSpellCooldown(sort)
+					actionUsable = IsUsableSpell(sort)
+					actionShortcut = nil
+					local casting = UnitCastingInfo("player")
+					if (casting == sort) then
+						actionIsCurrent = 1
+					else
+						actionIsCurrent = nil
+					end
+					-- not quite the same as IsCurrentAction. Why did they remove IsCurrentCast?
+				end
 			elseif (element.func=="Macro") then
 				action = self.actionMacro[element.params[1]]
 			elseif (element.func=="Item") then
-				action = self.actionObjet[element.params[1]]
+				local itemId
+				if (type(element.params[1]) == "number") then
+					itemId = element.params[1]
+				else
+					local _,_,id = string.find(GetInventoryItemLink("player",GetInventorySlotInfo(element.params[1])) or "","item:(%d+):%d+:%d+:%d+")
+					itemId = tonumber(id)
+				end
+				if (Ovale.trace) then
+					self:Print("Item "..itemId)
+				end
+
+				actionUsable = (GetItemSpell(itemId)~=nil)
+
+				action = self.actionObjet[itemId]
+				if (not action or not GetActionTexture(action)) then
+					actionTexture = GetItemIcon(itemId)
+					actionInRange = IsItemInRange(itemId, "target")
+					actionCooldownStart, actionCooldownDuration, actionEnable = GetItemCooldown(itemId)
+					actionShortcut = nil
+					actionIsCurrent = nil
+				end
 			end
-			local actionTexture, actionInRange, actionCooldownStart, actionCooldownDuration,
-				actionUsable, actionShortcut, actionIsCurrent, actionEnable
-
-			if (action) then
+
+			if (action and not actionTexture) then
 				actionTexture = GetActionTexture(action)
 				actionInRange = IsActionInRange(action, "target")
 				actionCooldownStart, actionCooldownDuration, actionEnable = GetActionCooldown(action)
-				actionUsable = IsUsableAction(action)
+				if (actionUsable == nil) then
+					actionUsable = IsUsableAction(action)
+				end
 				actionShortcut = self.shortCut[action]
 				actionIsCurrent = IsCurrentAction(action)
 			end
-			if (not actionTexture and element.func == "Spell") then
-				local sort = self:GetSpellInfoOrNil(element.params[1])
-				actionTexture = GetSpellTexture(sort)
-				actionInRange = IsSpellInRange(sort, "target")
-				actionCooldownStart, actionCooldownDuration, actionEnable = GetSpellCooldown(sort)
-				actionUsable = IsUsableSpell(sort)
-				actionShortcut = nil
-				local casting = UnitCastingInfo("player")
-				if (casting == sort) then
-					actionIsCurrent = 1
-				else
-					actionIsCurrent = nil
-				end
-				-- not quite the same as IsCurrentAction. Why did they remove IsCurrentCast?
-			end

 			if (not actionTexture) then
 				if (Ovale.trace) then
diff --git a/defaut/Demoniste.lua b/defaut/Demoniste.lua
index 66f66f2..049cd10 100644
--- a/defaut/Demoniste.lua
+++ b/defaut/Demoniste.lua
@@ -1,6 +1,5 @@
 Ovale.defaut["WARLOCK"]=
 [[
-Define(CURSERECKLESSNESS 704)
 Define(CURSEELEMENTS 1490)
 Define(CURSEAGONY 980)
 Define(CURSEDOOM 603)
@@ -23,15 +22,16 @@ Define(SHADOWEMBRACE 32391)
 Define(TALENTSHADOWEMBRACE 1763)
 Define(METAMORPHOSIS 47241)

-AddListItem(curse recklessness SpellName(CURSERECKLESSNESS))
 AddListItem(curse elements SpellName(CURSEELEMENTS))
 AddListItem(curse agony SpellName(CURSEAGONY))
 AddListItem(curse doom SpellName(CURSEDOOM))
 AddListItem(curse tongues SpellName(CURSETONGUES))
 AddListItem(curse weakness SpellName(CURSEWEAKNESS))

+
 AddIcon
 {
+if List(curse elements) and TargetDebuffExpires(CURSEELEMENTS 2) Spell(CURSEELEMENTS)
 if TalentPoints(TALENTSHADOWEMBRACE more 0) and TargetDebuffExpires(SHADOWEMBRACE 0) Spell(SHADOWBOLT)
 if TargetDebuffExpires(HAUNT 1.5 mine=1) Spell(HAUNT doNotRepeat=1)
 if TargetDebuffExpires(UNSTABLEAFFLICTION 1.5 mine=1 haste=spell) Spell(UNSTABLEAFFLICTION doNotRepeat=1)
@@ -39,7 +39,6 @@ if TalentPoints(TALENTBACKDRAFT more 0) and TargetDebuffExpires(IMMOLATE 3 mine=
    and TargetDebuffPresent(IMMOLATE mine=1) Spell(CONFLAGRATE doNotRepeat=1)
 if TargetDebuffExpires(IMMOLATE 1.5 mine=1 haste=spell) and TargetLifePercent(more 25) Spell(IMMOLATE doNotRepeat=1)
 if List(curse recklessness) and TargetDebuffExpires(CURSERECKLESSNESS 2) Spell(CURSERECKLESSNESS)
-if List(curse elements) and TargetDebuffExpires(CURSEELEMENTS 2) Spell(CURSEELEMENTS)
 if List(curse doom) and TargetDebuffExpires(CURSEDOOM 0 mine=1) Spell(CURSEDOOM)
 if List(curse tongues) and TargetDebuffExpires(CURSETONGUES 2) Spell(CURSETONGUES)
 if List(curse weakness) and TargetDebuffExpires(CURSEWEAKNESS 2) Spell(CURSEWEAKNESS)
@@ -55,5 +54,8 @@ Spell(SHADOWBOLT)
 AddIcon
 {
 	Spell(METAMORPHOSIS)
+	Item(Trinket0Slot usable=1)
+	Item(Trinket1Slot usable=1)
 }
+
 ]]
diff --git a/defaut/Mage.lua b/defaut/Mage.lua
index 40ab90d..815b3b3 100644
--- a/defaut/Mage.lua
+++ b/defaut/Mage.lua
@@ -72,6 +72,8 @@ AddIcon
        Spell(COMBUSTION)
        Spell(ICYVEINS)
        Spell(PRESENCEOFMIND)
+       Item(Trinket0Slot usable=1)
+       Item(Trinket1Slot usable=1)
 }

 ]]
\ No newline at end of file