From 7bce1581c401366efb48c759dfc8321898ebfab8 Mon Sep 17 00:00:00 2001 From: Xruptor Date: Mon, 24 Sep 2012 19:11:26 -0400 Subject: [PATCH] -Updated for MOP --- XanDurability.lua | 21 +++++++++++++-------- XanDurability.toc | 4 ++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/XanDurability.lua b/XanDurability.lua index da5f482..3c09708 100644 --- a/XanDurability.lua +++ b/XanDurability.lua @@ -46,6 +46,9 @@ function f:PLAYER_LOGIN() local ver = GetAddOnMetadata("xanDurability","Version") or '1.0' DEFAULT_CHAT_FRAME:AddMessage(string.format("|cFF99CC33%s|r [v|cFFDF2B2B%s|r] Loaded", "xanDurability", ver or "1.0")) + f:GetDurabilityInfo() + f:UpdatePercent() + self:UnregisterEvent("PLAYER_LOGIN") self.PLAYER_LOGIN = nil end @@ -170,15 +173,17 @@ function f:GetDurabilityInfo() equipCost = 0 for _, slotName in ipairs(Slots) do local item = _G["Character" .. slotName] - local hasItem, _, repairCost = tmpTip:SetInventoryItem("player", item:GetID()) - local Minimum, Maximum = GetInventoryItemDurability(item:GetID()) + if item then + local hasItem, _, repairCost = tmpTip:SetInventoryItem("player", item:GetID()) + local Minimum, Maximum = GetInventoryItemDurability(item:GetID()) - if hasItem and repairCost and repairCost > 0 then - equipCost = equipCost + repairCost - end - if Minimum and Maximum then - pEquipDura.min = pEquipDura.min + Minimum - pEquipDura.max = pEquipDura.max + Maximum + if hasItem and repairCost and repairCost > 0 then + equipCost = equipCost + repairCost + end + if Minimum and Maximum then + pEquipDura.min = pEquipDura.min + Minimum + pEquipDura.max = pEquipDura.max + Maximum + end end end diff --git a/XanDurability.toc b/XanDurability.toc index 475eba3..981c820 100644 --- a/XanDurability.toc +++ b/XanDurability.toc @@ -1,8 +1,8 @@ -## Interface: 40300 +## Interface: 50001 ## Title: xanDurability ## Notes: A small window that displays the total current armour durability. ## Author: Xruptor -## Version: 2.5 +## Version: 2.6 ## SavedVariablesPerCharacter: XanDUR_DB xanDurability.lua -- 1.7.9.5