Quantcast

- Ammo : Fix for Thrown difference between Wrath and CE

urnati [01-27-24 - 12:08]
- Ammo : Fix for Thrown difference between Wrath and CE
Filename
TitanAmmo/TitanClassicAmmo.lua
diff --git a/TitanAmmo/TitanClassicAmmo.lua b/TitanAmmo/TitanClassicAmmo.lua
index 39447e5..d3d0a45 100644
--- a/TitanAmmo/TitanClassicAmmo.lua
+++ b/TitanAmmo/TitanClassicAmmo.lua
@@ -28,6 +28,8 @@ local LIM_GOOD = 2
 local LIM_OK   = 1.5
 local LIM_BAD  = .5

+local game_version = select(4, GetBuildInfo())
+
 local TITAN_AMMO_THRESHOLD_TABLE = { -- Use ammo stack and threshold limits above to calc colored text
 	["INVTYPE_RANGEDRIGHT"] = {
 		 Values = { SHOOT_STACK*LIM_BAD, SHOOT_STACK*LIM_OK, SHOOT_STACK*LIM_GOOD }, -- 100,150,400
@@ -149,8 +151,23 @@ local function GetAmmoCount()
 			subammoID = subclassID

 			label = L["TITAN_AMMO_BUTTON_LABEL_THROWN"]
-			text = TitanUtils_GetGoldText("*")

+			ammo_name = select(1, GetItemInfo(GetInventoryItemID("player", rangedSlotID))) or _G["UNKNOWN"]
+			if ammo_name == _G["UNKNOWN"] then
+				ammo_count = 0
+			else
+				if game_version < 30000 then
+					-- CE thrown has count
+					ammo_count = GetInventoryItemCount("player", rangedSlotID) or ammo_count
+					text = format(L["TITAN_AMMO_FORMAT"], ammo_count);
+				else
+					-- Wrath thrown has no count or durability
+					text = TitanUtils_GetGoldText("*")
+				end
+			end
+			if TitanGetVar(TITAN_AMMO_ID, "ShowAmmoName") and ammo_name ~= "" then
+				text = text.."|cffffff9a".." ("..ammo_name..")".."|r"
+			end
 			tool_tip = itemName
 			-- no mismatch
 		elseif (subclassID == 3)  -- Gun