Thread Tools Display Modes
07-01-09, 12:26 PM   #1
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Owner names on pets/vehicles

I'm currently doing this for raid members but not sure how to do it on other units.

Code:
if string.find(unit, "raidpet%d") then
	self.Name:SetText(UnitName(string.gsub(unit, "raidpet", "raid")))
end
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.

Last edited by v6o : 07-01-09 at 12:31 PM.
  Reply With Quote
07-01-09, 05:55 PM   #2
jadakren
A Flamescale Wyrmkin
 
jadakren's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 103
i don't suppose you have tried matching for the generic 'pet' term, instead of the specific 'raidpet' term.

Code:
 print(("raidpet3"):gmatch("pet(%d)")())

Last edited by jadakren : 07-01-09 at 05:58 PM.
  Reply With Quote
07-02-09, 11:43 AM   #3
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
My code works for group members (party / raid) i'm looking for a way to do it on, for example, target.

Would it require a tooltip scan or how do people do it?
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.

Last edited by v6o : 07-02-09 at 11:50 AM.
  Reply With Quote
07-02-09, 01:19 PM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
Unless a valid UnitID points to the pet's owner, there's no way to get info about that unit other than getting their name from the pet's tooltip.

Note that there is no UnitID that refers to a pet's owner directly, you'll have to find it through party/raid or target/focus.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
07-02-09, 07:10 PM   #5
acapela
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 241
FYI, Aloft uses a tooltip scan for these things (for unit "Comments", such as appear on vendors, as well as pet ownership; don't know about vehicles).
__________________
Retired author/maintainer of Aloft (the nameplate addon)
http://www.wowinterface.com/download...AloftBeta.html
-----
Zippy said it best: "All life is a BLUR of Republicans and Meat!"
  Reply With Quote
07-04-09, 07:54 AM   #6
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Not being the best coder but I got it to work
If anyone notice some flaws and know if this is in need of optimization then I'd be grateful if you pointed it out

Code:
CreateFrame("GameTooltip", "oufscan")
oufscan:SetOwner(WorldFrame, "ANCHOR_NONE")
oufscan:AddFontStrings(
	oufscan:CreateFontString("$parentTextLeft1", nil, "GameTooltipText"),
	oufscan:CreateFontString("$parentTextRight1", nil, "GameTooltipText")
)

local function UnitIsPet(unit)
	local guidtype = tonumber(strsub(UnitGUID(unit),5,5),16)%8
	if guidtype==4 then return true end
	return false
end

local function GetPetOwner(unit)
	oufscan:SetUnit(unit)
	local name = strmatch(oufscanTextLeft2:GetText(), ("(.+)'"))
	oufscan:ClearLines()
	if name then return name end
	return nil
end
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.

Last edited by v6o : 07-04-09 at 08:24 AM.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Owner names on pets/vehicles


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off