From f7ad7fc3be5682f3e67fcefa564ce140acecf694 Mon Sep 17 00:00:00 2001 From: urnati Date: Fri, 9 Aug 2019 02:50:24 -0400 Subject: [PATCH] Update Ammo to should count of thrown items --- TitanClassicAmmo/TitanClassicAmmo.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/TitanClassicAmmo/TitanClassicAmmo.lua b/TitanClassicAmmo/TitanClassicAmmo.lua index 67e8ca0..cac6139 100644 --- a/TitanClassicAmmo/TitanClassicAmmo.lua +++ b/TitanClassicAmmo/TitanClassicAmmo.lua @@ -127,13 +127,12 @@ end if loc == "INVTYPE_THROWN" then TitanPanelAmmoButton:RegisterEvent("UPDATE_INVENTORY_DURABILITY") isThrown = true; - isAmmo = nil; + isAmmo = nil; else TitanPanelAmmoButton:RegisterEvent("ACTIONBAR_HIDEGRID") isAmmo = true; isThrown = nil; end ---TitanDebug("UNIT_INVENTORY_CHANGED register") TitanPanelAmmoButton:RegisterEvent("UNIT_INVENTORY_CHANGED") TitanPanelAmmoButton:RegisterEvent("MERCHANT_CLOSED") TitanPanelAmmoButton:RegisterEvent("PLAYER_ENTERING_WORLD") @@ -142,11 +141,11 @@ end function TitanPanelAmmoButton_UNIT_INVENTORY_CHANGED(arg1, ...) -TitanDebug("TitanPanelAmmoButton_UNIT_INVENTORY_CHANGED") +--TitanDebug("TitanPanelAmmoButton_UNIT_INVENTORY_CHANGED") if arg1 == "player" then TitanPanelAmmoUpdateDisplay(); -- if isAmmo then - TitanDebug("ammoSlotID: " .. ammoSlotID); +-- TitanDebug("ammoSlotID: " .. ammoSlotID); -- TitanDebug("GetInventoryItemLink: " .. tostring(GetInventoryItemLink("player", ammoSlotID))); -- if GetInventoryItemLink("player", ammoSlotID) then count = GetInventoryItemCount("player", ammoSlotID) or count @@ -155,19 +154,20 @@ TitanDebug("TitanPanelAmmoButton_UNIT_INVENTORY_CHANGED") -- count = 0; -- AmmoName = ""; -- end - TitanPanelButton_UpdateButton(TITAN_AMMO_ID); +-- TitanPanelButton_UpdateButton(TITAN_AMMO_ID); -- end end end function TitanPanelAmmoButton_UPDATE_INVENTORY_DURABILITY() - count = GetInventoryItemDurability(rangedSlotID) or count + count = GetInventoryItemCount("player", rangedSlotID) or count -- GetInventoryItemDurability(rangedSlotID) or count TitanPanelButton_UpdateButton(TITAN_AMMO_ID); end function TitanPanelAmmoButton_MERCHANT_CLOSED() if isThrown then - count = GetInventoryItemDurability(rangedSlotID) or count + count = GetInventoryItemCount("player", rangedSlotID) or count +-- count = GetInventoryItemDurability(rangedSlotID) or count elseif isAmmo then --and GetInventoryItemLink("player", ammoSlotID) count = GetInventoryItemCount("player", ammoSlotID) or count -- AmmoName = GetItemInfo(GetInventoryItemLink("player", ammoSlotID)) or _G["UNKNOWN"] @@ -224,7 +224,8 @@ end isThrown = true; isAmmo = nil; - count = GetInventoryItemDurability(rangedSlotID); + count = GetInventoryItemCount("player", rangedSlotID) or count +-- count = GetInventoryItemDurability(rangedSlotID); else -- 1.7.9.5