From beacedc2e4ac22bf69843e38a1f1cd6d04f2e98c Mon Sep 17 00:00:00 2001 From: urnati Date: Fri, 9 Aug 2019 02:13:25 -0400 Subject: [PATCH] Updated Ammo w/o name due to API --- TitanClassicAmmo/TitanClassicAmmo.lua | 36 +++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/TitanClassicAmmo/TitanClassicAmmo.lua b/TitanClassicAmmo/TitanClassicAmmo.lua index 5a531e0..67e8ca0 100644 --- a/TitanClassicAmmo/TitanClassicAmmo.lua +++ b/TitanClassicAmmo/TitanClassicAmmo.lua @@ -55,30 +55,30 @@ function TitanPanelAmmoButton_OnLoad(self) ShowAmmoName = false, } }; -TitanDebug("TitanPanelAmmoButton_OnLoad") +--TitanDebug("TitanPanelAmmoButton_OnLoad") self:SetScript("OnEvent", function(_, event, arg1, ...) -TitanDebug("OnEvent") +--TitanDebug("OnEvent") if event == "PLAYER_LOGIN" then -TitanDebug("PLAYER_LOGIN") +--TitanDebug("PLAYER_LOGIN") TitanPanelAmmoButton_PLAYER_LOGIN() elseif event == "UNIT_INVENTORY_CHANGED" then -TitanDebug("UNIT_INVENTORY_CHANGED") +--TitanDebug("UNIT_INVENTORY_CHANGED") TitanPanelAmmoButton_UNIT_INVENTORY_CHANGED(arg1, ...) elseif event == "UPDATE_INVENTORY_DURABILITY" then -TitanDebug("UPDATE_INVENTORY_DURABILITY") +--TitanDebug("UPDATE_INVENTORY_DURABILITY") TitanPanelAmmoButton_UPDATE_INVENTORY_DURABILITY() elseif event == "MERCHANT_CLOSED" or event == "PLAYER_ENTERING_WORLD" then -TitanDebug("MERCHANT_CLOSED / PLAYER_ENTERING_WORLD") +--TitanDebug("MERCHANT_CLOSED / PLAYER_ENTERING_WORLD") TitanPanelAmmoButton_MERCHANT_CLOSED() elseif event == "ACTIONBAR_HIDEGRID" then TitanPanelAmmoButton_ACTIONBAR_HIDEGRID() end end) ---[[ TitanPanelAmmoButton:RegisterEvent("PLAYER_LOGIN") +--[[ TitanPanelAmmoButton:RegisterEvent("UNIT_INVENTORY_CHANGED") TitanPanelAmmoButton:RegisterEvent("UPDATE_INVENTORY_DURABILITY") TitanPanelAmmoButton:RegisterEvent("MERCHANT_CLOSED") @@ -117,6 +117,7 @@ if class ~= "ROGUE" and class ~= "WARRIOR" and class ~= "HUNTER" then return end +--TitanDebug("TitanPanelAmmoButton_PLAYER_LOGIN") local itemlink = GetInventoryItemLink("player", rangedSlotID) currentlink = itemlink; local loc = ""; @@ -132,6 +133,7 @@ end isAmmo = true; isThrown = nil; end +--TitanDebug("UNIT_INVENTORY_CHANGED register") TitanPanelAmmoButton:RegisterEvent("UNIT_INVENTORY_CHANGED") TitanPanelAmmoButton:RegisterEvent("MERCHANT_CLOSED") TitanPanelAmmoButton:RegisterEvent("PLAYER_ENTERING_WORLD") @@ -166,9 +168,9 @@ end function TitanPanelAmmoButton_MERCHANT_CLOSED() if isThrown then count = GetInventoryItemDurability(rangedSlotID) or count - elseif isAmmo and GetInventoryItemLink("player", ammoSlotID) then + elseif isAmmo then --and GetInventoryItemLink("player", ammoSlotID) count = GetInventoryItemCount("player", ammoSlotID) or count - AmmoName = GetItemInfo(GetInventoryItemLink("player", ammoSlotID)) or _G["UNKNOWN"] + -- AmmoName = GetItemInfo(GetInventoryItemLink("player", ammoSlotID)) or _G["UNKNOWN"] else --isThrown = nil; count = 0; @@ -184,11 +186,11 @@ function TitanPanelAmmoButton_ACTIONBAR_HIDEGRID() prev = prev + e if prev > 2 then TitanPanelAmmoButton:SetScript("OnUpdate", nil) - if GetInventoryItemLink("player", ammoSlotID) then +-- if GetInventoryItemLink("player", ammoSlotID) then count = GetInventoryItemCount("player", ammoSlotID) or count - else - count = 0; - end +-- else +-- count = 0; +-- end TitanPanelButton_UpdateButton(TITAN_AMMO_ID); end end) @@ -236,11 +238,11 @@ end isAmmo = true; isThrown = nil; - if GetInventoryItemLink("player", ammoSlotID) then +-- if GetInventoryItemLink("player", ammoSlotID) then count = GetInventoryItemCount("player", ammoSlotID) - else - count = 0; - end +-- else +-- count = 0; +-- end end -- 1.7.9.5