Quantcast

Made some changes to the way item completion is recognized, so it should be more reliable.

pschifferer [03-14-10 - 14:20]
Made some changes to the way item completion is recognized, so it should be more reliable.
Filename
CauldronMain.lua
CauldronQueue.lua
CauldronUtil.lua
Instructions.txt
Locale/Cauldron-enUS.lua
Locale/Cauldron-ruRU.lua
Locale/Cauldron-zhCN.lua
diff --git a/CauldronMain.lua b/CauldronMain.lua
index a3d1be1..9954948 100644
--- a/CauldronMain.lua
+++ b/CauldronMain.lua
@@ -597,7 +597,7 @@ end

 function Cauldron:OnSpellcastSucceed(event, unit, spell, rank)

- self:info("spell succeed - unit: "..tostring(unit).."; spell: "..tostring(spell).."; rank: "..tostring(rank));
+	 self:debug("spell succeed - unit: "..tostring(unit).."; spell: "..tostring(spell).."; rank: "..tostring(rank));

 	-- ignore if the unit was not the player
 	if unit ~= "player" then
@@ -608,7 +608,7 @@ function Cauldron:OnSpellcastSucceed(event, unit, spell, rank)

 	-- adjust queue, but only if window is open
 	if CauldronFrame:IsShown() then
-	self:info("makingItemSpell: "..tostring(self.makingItemSpell));
+		self:debug("makingItemSpell: "..tostring(self.makingItemSpell));
 		if self.makingItemSpell == spell then
 			self.processing = false;

@@ -865,13 +865,14 @@ function Cauldron:ProcessItem(skillInfo, queueInfo, amount)
 		-- record the item we're making
 		self:debug("skillInfo.itemLink: "..tostring(skillInfo.itemLink));
 		self.makingItem = Cauldron:GetNameFromLink(queueInfo.link);
-		self:info("makingItem: "..tostring(self.makingItem));
+		self:debug("makingItem: "..tostring(self.makingItem));
 --		self.makingItemId = Cauldron:GetIdFromLink(skillInfo.itemLink);
 --		self:debug("makingItemId: "..tostring(self.makingItemId));
 		self.itemCurrentCount = GetItemCount(skillInfo.itemLink);

+		self:debug("queueInfo.spell="..tostring(queueInfo.spell));
 		self.makingItemSpell = queueInfo.spell or Cauldron:GetNameFromLink(queueInfo.link);
-		self:info("makingItemSpell: "..tostring(self.makingItemSpell));
+		self:debug("makingItemSpell: "..tostring(self.makingItemSpell));
 		self.makingItemCount = amount;
 		self.queueInfo = queueInfo;

@@ -883,6 +884,7 @@ function Cauldron:ProcessItem(skillInfo, queueInfo, amount)
 		DoTradeSkill(skillInfo.index, amount);
 	else
 		-- TODO: notify player?
+		Cauldron:warn(L["Unable to process item due to play time limitation."]);
 	end

 end
diff --git a/CauldronQueue.lua b/CauldronQueue.lua
index bd156a9..a1ac3c1 100644
--- a/CauldronQueue.lua
+++ b/CauldronQueue.lua
@@ -163,7 +163,8 @@ function CauldronQueue:AddItem(queue, skillInfo, amount, suppressCalc)
 		item.amount = item.amount + amount;
 	else
 		-- it's not there, so create a new instance
-		queue.main[skillInfo.name] = CauldronQueue:NewItem(skillInfo.name, skillInfo.icon, amount, nil, skillInfo.tradeskill, skillInfo.itemLink, Cauldron:GetNameFromLink(skillInfo.recipeLink));
+		Cauldron:debug("AddItem: recipeLink="..tostring(skillInfo.recipeLink));
+		queue.main[skillInfo.name] = CauldronQueue:NewItem(skillInfo.name, skillInfo.icon, amount, nil, skillInfo.tradeskill, skillInfo.itemLink, Cauldron:GetSpellNameFromLink(skillInfo.recipeLink));
 	end

 	if not suppressCalc then
diff --git a/CauldronUtil.lua b/CauldronUtil.lua
index cf965a7..7e23eae 100644
--- a/CauldronUtil.lua
+++ b/CauldronUtil.lua
@@ -131,21 +131,30 @@ end

 function Cauldron:GetIdFromLink(link)
   	if not link then return end
---  local _,_,id,name = strfind(link,"|Hitem:(%d+):.+%[(.+)%]")
-  	local _,_,id = strfind(link,"item:(%d+):")
+--  local _,_,id,name = strfind(link,"|Hitem:(%d+):.+%[(.+)%]");
+  	local _,_,id = strfind(link,"item:(%d+):");
   	if not id then
---  	local _,_,id,name = strfind(link,"|Henchant:(%d+)|h%[(.+)%]")
-  		local _,_,id = strfind(link,"enchant:(%d+)")
+--  	local _,_,id,name = strfind(link,"|Henchant:(%d+)|h%[(.+)%]");
+  		local _,_,id = strfind(link,"enchant:(%d+)");
 	  	if id then return tonumber(id) end
 	else
-		return tonumber(id)
+		return tonumber(id);
 	end
 end

 function Cauldron:GetNameFromLink(link)
 	if not link then return end
-  	local _,_,name = strfind(link,"|Hitem:.+%[(.+)%]")
-	return name
+  	local _,_,name = strfind(link,"|Hitem:.+%[(.+)%]");
+  	if not name then
+  		_,_,name = strfind(link,"|Henchant:.+%[(.+)%]");
+  	end
+	return name;
+end
+
+function Cauldron:GetSpellNameFromLink(link)
+	if not link then return end
+  	local _,_,name = strfind(link,"|Henchant:.+%[.+: (.+)%]");
+	return name;
 end

 function Cauldron:ScanBags()
diff --git a/Instructions.txt b/Instructions.txt
index 3c32d83..a0d5bf0 100644
--- a/Instructions.txt
+++ b/Instructions.txt
@@ -9,7 +9,7 @@ An enhanced tradeskill addon.  Cauldron provides:

 == Release Notes ==

-=== r202 ===
+=== r206 ===

 * Simplified Chinese localization!
 * Interface options control tooltip modification and shopping list auto-open.
diff --git a/Locale/Cauldron-enUS.lua b/Locale/Cauldron-enUS.lua
index 5499b56..3aca30a 100644
--- a/Locale/Cauldron-enUS.lua
+++ b/Locale/Cauldron-enUS.lua
@@ -167,3 +167,4 @@ L["Oh. Smells like barbecued dog hair."] = true
 -- error messages
 L["Crafting %1$s requires the %2$s skill."] = true

+L["Unable to process item due to play time limitation."] = true
diff --git a/Locale/Cauldron-ruRU.lua b/Locale/Cauldron-ruRU.lua
index 551e3d1..f8ad5f5 100755
--- a/Locale/Cauldron-ruRU.lua
+++ b/Locale/Cauldron-ruRU.lua
@@ -165,3 +165,5 @@ L["Oh. Smells like barbecued dog hair."] = "Oh. Smells like barbecued dog hair."

 -- error messages
 L["Crafting %1$s requires the %2$s skill."] = "Создание %1$s требует %2$s |4навык:навыка:навыков;"
+
+L["Unable to process item due to play time limitation."] = true
diff --git a/Locale/Cauldron-zhCN.lua b/Locale/Cauldron-zhCN.lua
index cb6bd4c..a5dabe8 100644
--- a/Locale/Cauldron-zhCN.lua
+++ b/Locale/Cauldron-zhCN.lua
@@ -148,3 +148,5 @@ L["Oh. Smells like barbecued dog hair."] = "嗷. 闻起来就像烧焦的狗毛.

 -- error messages
 L["Crafting %1$s requires the %2$s skill."] = "制造 %1$s 需要 %2$s 技能;"
+
+L["Unable to process item due to play time limitation."] = true