GameTooltip:HookScript("OnTooltipCleared", function(self) self.ncItemTooltip=nil end)
GameTooltip:HookScript("OnTooltipSetItem", function(self)
	if ncItemTooltip and not self.ncItemTooltip and (ncItemTooltip.id or ncItemTooltip.count) then
		local item, link = self:GetItem()
		local num = GetItemCount(link)
		local stack = select(8, GetItemInfo(link))
		local append = ""
		
		if ncItemTooltip.id then
			append = "|cFF00FFFFID|r: "..link:match(":(%w+)")
		end
		
		if ncItemTooltip.count and num > 1 then
			append = append..(ncItemTooltip.id and " - " or "").."|cFF00FFFFCount|r: "..num
		end
		
		if ncItemTooltip.stack and stack > 1 then
			append = append..((ncItemTooltip.id or ncItemTooltip.count) and " - " or "").."|cFF00FFFFStack|r: "..stack
		end
		
		self:AddLine(append, 1, 1, 1)
		self.ncItemTooltip = 1
	end
end)

local f = CreateFrame("Frame")
f:RegisterEvent("ADDON_LOADED")
f:SetScript("OnEvent", function(_, _, name)
	if name ~= "ncItemTooltip" then return end
	f:UnregisterEvent("ADDON_LOADED")
	f:SetScript("OnEvent", nil)
	ncItemTooltip = ncItemTooltip or {count=true,id=true,stack=false}
end)

SLASH_NCITEMTOOLTIP1 = "/ncit"
SLASH_NCITEMTOOLTIP2 = "/ncitemtooltip"
SlashCmdList.NCITEMTOOLTIP = function(arg)
	if arg=="count" then
		ncItemTooltip.count = not ncItemTooltip.count
	elseif arg=="id" then
		ncItemTooltip.id = not ncItemTooltip.id
	elseif arg=="stack" then
		ncItemTooltip.stack = not ncItemTooltip.stack
	else
		print("ncItemTooltip config\n/ncit count - toggles the item count display\n/ncit id - toggle the item id display\n/ncit stack - toggle the stack limit display")
	end
end