Quantcast

Fixed an error that occured when trying to equip an item the player doesn't have the proficiency for

James Whitehead II [08-15-08 - 11:05]
Fixed an error that occured when trying to equip an item the player doesn't have the proficiency for
Filename
DressToKill.lua
diff --git a/DressToKill.lua b/DressToKill.lua
index e88124d..bfa7cb3 100644
--- a/DressToKill.lua
+++ b/DressToKill.lua
@@ -192,13 +192,18 @@ end
 local eventFrame = CreateFrame("Frame")
 eventFrame:RegisterEvent("UNIT_INVENTORY_CHANGED")
 eventFrame:RegisterEvent("EQUIP_BIND_CONFIRM")
+eventFrame:RegisterEvent("UI_ERROR_MESSAGE")

-local function OnEvent(self, event)
+local function OnEvent(self, event, arg1)
 	self.equipped = true
 	if event == "EQUIP_BIND_CONFIRM" and CursorHasItem() then
 		self.equipped = false
 		debug(L["Clearing non-soulbound item"])
 		ClearCursor()
+	elseif event == "UI_ERROR_MESSAGE" and arg1 == ERR_PROFICIENCY_NEEDED then
+		self.equipped = false
+		debug(L["Clearing item we don't have the proficiency for"])
+		ClearCursor()
 	end

 	local thread = DressToKill.currentThread