View Single Post
10-09-22, 05:03 PM   #1
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 521
Another beta vs PTR difference: getting npcID names

For years I've been getting the name of an npcID by doing this:

Code:
-- takes an npcID and returns the name of the npc
-- if the return is nil, the npcID is invalid or it's not been cached yet
function tamer:GetNameFromNpcID(npcID)
	local tooltip = BattlePetDailyTamerScanTooltip
	tooltip:SetOwner(UIParent, "ANCHOR_NONE")
	tooltip:SetHyperlink(format("unit:Creature-0-0-0-0-%d-0000000000", npcID))
	if tooltip:NumLines() > 0 then
		local name = BattlePetDailyTamerScanTooltipTextLeft1:GetText()
		tooltip:Hide()
		return name
	end
end
On the PTR this still works. It spoofs a GUID of the npcID and lifts the localized name from the tooltip.

On the beta this seems to drop the first line (the name) from the tooltip and leaves the rest; generally giving names like 'Master Pet Trainer' and such. It's does not appear to be a caching issue.

Is this a bug or will it become the new normal? Have any methods been added to get the localized name of an npcID, or any that I've missed?

This is (I hope!) a bug on the beta but I can't post to the official beta forums, and the 255-character limit is too small to explain this. It's incredibly frustrating.
  Reply With Quote