Quantcast

Update Ammo to fix thrown count

urnati [08-09-19 - 07:04]
Update Ammo to fix thrown count
Filename
TitanClassicAmmo/TitanClassicAmmo.lua
diff --git a/TitanClassicAmmo/TitanClassicAmmo.lua b/TitanClassicAmmo/TitanClassicAmmo.lua
index cac6139..36fce10 100644
--- a/TitanClassicAmmo/TitanClassicAmmo.lua
+++ b/TitanClassicAmmo/TitanClassicAmmo.lua
@@ -141,14 +141,25 @@ end


 function TitanPanelAmmoButton_UNIT_INVENTORY_CHANGED(arg1, ...)
---TitanDebug("TitanPanelAmmoButton_UNIT_INVENTORY_CHANGED")
  if arg1 == "player" then
+TitanDebug("TitanPanelAmmoButton_UNIT_INVENTORY_CHANGED")
  	TitanPanelAmmoUpdateDisplay();
+ if isThrown then
+	count = GetInventoryItemCount("player", rangedSlotID) or count
+ elseif isAmmo then --and GetInventoryItemLink("player", ammoSlotID)
+	count = GetInventoryItemCount("player", ammoSlotID) or count
+	-- AmmoName = GetItemInfo(GetInventoryItemLink("player", ammoSlotID)) or _G["UNKNOWN"]
+ else
+ --isThrown = nil;
+ 	count = 0;
+ 	AmmoName = "";
+ end
+ 		TitanPanelButton_UpdateButton(TITAN_AMMO_ID);
 -- 	if isAmmo then
 --	TitanDebug("ammoSlotID: " .. ammoSlotID);
 --	TitanDebug("GetInventoryItemLink: " .. tostring(GetInventoryItemLink("player", ammoSlotID)));
 --  		if GetInventoryItemLink("player", ammoSlotID) then
-				count = GetInventoryItemCount("player", ammoSlotID) or count
+--				count = GetInventoryItemCount("player", ammoSlotID) or count
 --				AmmoName = GetItemInfo(GetInventoryItemLink("player", ammoSlotID)) or _G["UNKNOWN"]
 --			else
 --				count = 0;