Quantcast

Updating DressToKill to actually work correctly

James Whitehead II [04-25-09 - 20:41]
Updating DressToKill to actually work correctly
Filename
DressToKill.lua
DressToKill.toc
diff --git a/DressToKill.lua b/DressToKill.lua
index 067c872..c6d7eb8 100644
--- a/DressToKill.lua
+++ b/DressToKill.lua
@@ -272,7 +272,7 @@ local function scanFunction(weightFunction)
 		for mask,item in pairs(avail) do
 			if not blacklist[mask] then
 				local name,link = GetItemInfo(item)
-				debug(L["Trying on %s"], link)
+				debug(L["Trying on %s for slot %s"], link, slotId)
 				local equipped = DressToKill:EquipItem(slotId, mask, stash)
 				if equipped then
 					local link = GetInventoryItemLink("player", slotId)
@@ -309,15 +309,14 @@ local function scanFunction(weightFunction)
 end

 function DressToKill:EquipItem(slotId, mask, stash)
-	local bag,slot = DressToKill:ItemInBag(mask)
-	local eqslot = DressToKill:ItemEquipped(mask)
+    local player, bank, bags, slot, bag = EquipmentManager_UnpackLocation(mask)
 	if bag then
 		-- Equip the item
 		PickupContainerItem(bag, slot)
 		EquipCursorItem(slotId)
 		local equipped = coroutine.yield()
 		return equipped
-	elseif eqslot then
+	elseif player then
 		-- The item was equipped, so find the current slot in the stash
 		PickupContainerItem(stash.bag, stash.slot)
 		EquipCursorItem(slotId)
@@ -327,14 +326,13 @@ function DressToKill:EquipItem(slotId, mask, stash)
 end

 function DressToKill:UnequipItem(slotId, mask, stash)
-	local bag,slot = DressToKill:ItemInBag(mask)
-	local eqslot = DressToKill:ItemEquipped(mask)
+    local player, bank, bags, slot, bag = EquipmentManager_UnpackLocation(mask)
 	if bag then
 		-- Just put the item back
 		PickupInventoryItem(slotId)
 		PickupContainerItem(bag, slot)
 		coroutine.yield()
-	elseif eqslot then
+	elseif player then
 		-- Put it back into the stash slot
 		PickupInventoryItem(slotId)
 		PickupContainerItem(stash.bag, stash.slot)
diff --git a/DressToKill.toc b/DressToKill.toc
index 269d54e..dd0d8f8 100644
--- a/DressToKill.toc
+++ b/DressToKill.toc
@@ -1,4 +1,4 @@
-## Interface: 20400
+## Interface: 30100
 ## Title: DressToKill
 ## Version: wowi:revision
 ## Notes: When you go out, make sure you're prepared to kill..