From 61fb810cfef6a894565ffe61e559c4a96579132a Mon Sep 17 00:00:00 2001 From: urnati Date: Mon, 12 Apr 2021 15:22:31 -0400 Subject: [PATCH] -- Fix for non ammo classes to show "--" as it used to. --- TitanClassicAmmo/TitanClassicAmmo.lua | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/TitanClassicAmmo/TitanClassicAmmo.lua b/TitanClassicAmmo/TitanClassicAmmo.lua index f39e7f7..96cf34d 100644 --- a/TitanClassicAmmo/TitanClassicAmmo.lua +++ b/TitanClassicAmmo/TitanClassicAmmo.lua @@ -108,6 +108,11 @@ end local function GetAmmoCount() weapon, weapon_type, ammo_type = GetWeaponInfo(rangedSlotID) +--[[ +print("GetAmmoCount" +.." '"..tostring(weapon).."'" +) +--]] if IsThrown(ammo_type) then ammo_name = select(1, GetItemInfo(GetInventoryItemID("player", rangedSlotID))) or _G["UNKNOWN"] @@ -179,7 +184,7 @@ function TitanPanelAmmoButton_PLAYER_LOGIN() -- Class check if class ~= "ROGUE" and class ~= "WARRIOR" and class ~= "HUNTER" then TitanPanelAmmoButton_PLAYER_LOGIN = nil - ammo_show = true + ClrAmmoInfo() return end @@ -256,25 +261,26 @@ function TitanPanelAmmoButton_GetButtonText(id) local labelText, ammoText, ammoRichText, color; - if not ammo_count then -- safeguard to prevent malformed labels - ClrAmmoInfo() - end - if (IsThrown(ammo_type)) then labelText = L["TITAN_AMMO_BUTTON_LABEL_THROWN"]; ammoText = format(L["TITAN_AMMO_FORMAT"], ammo_count); + labelText = weapon_type.." : " if TitanGetVar(TITAN_AMMO_ID, "ShowAmmoName") and ammo_name ~= "" then ammoText = ammoText.."|cffffff9a".." ("..ammo_name..")".."|r" end - else + elseif IsAmmo(ammo_type) then labelText = L["TITAN_AMMO_BUTTON_LABEL_AMMO"]; + labelText = weapon_type.." : " ammoText = format(L["TITAN_AMMO_FORMAT"], ammo_count); if TitanGetVar(TITAN_AMMO_ID, "ShowAmmoName") and ammo_name ~= "" then ammoText = ammoText.."|cffffff9a".." ("..ammo_name..")".."|r" end + else + ClrAmmoInfo() + ammoText = ammo_name + labelText = weapon_type.."" end - labelText = weapon_type.." : " --[[ print("_GetButtonText" .." '"..tostring(weapon_type).."'" -- 1.7.9.5