View Single Post
12-04-12, 11:05 AM   #27
Billtopia
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 110
so this is currently what I have the tooltip down to and it works fine (well it did as I made some changes here and have yet to test them)... you call it and it returns true if they are the same faction and false if not. I still think an added return to for GetPlayerInfoByGUID would be a better solution... and since this is a WISH LIST... I can wish all I want lol

Lua Code:
  1. local guidCache = {}
  2. local utip = CreateFrame("GameTooltip", "uTip", UIParent, "GameTooltipTemplate")
  3. utip:SetOwner( WorldFrame, "ANCHOR_NONE")
  4.  
  5. SameFaction = function (guid)
  6.      if IsPlayerNeutral() then
  7.          return true
  8.      end
  9.      local _, myFaction = UnitFactionGroup('player')
  10.      uTip:ClearLines()
  11.      if guid and tonumber(guid:sub(5,5), 16) % 8 == 0 then
  12.          if not( guidCache[guid] ) then
  13.              utip:SetHyperlink('unit:'..guid)
  14.              local tipName, numLines = "uTipTextLeft", _G["uTip"]:NumLines()
  15.              local faction = _G[tipName..tostring(numLines)]:GetText() == PVP and _G[tipName..tostring(numLines-1)]:GetText() or _G[tipName..tostring(numLines)]:GetText()
  16.              if faction ~= FACTION_ALLIANCE or faction ~= FACTION_HORDE then
  17.                  if myFaction == FACTION_ALLIANCE then
  18.                           faction = FACTION_HORDE
  19.                  else
  20.                      faction = FACTION_ALLIANCE
  21.                  end
  22.               end
  23.              guidCache[guid] = faction
  24.         end
  25.         return guidCache[guid] == myFaction
  26.      end
  27. end

Last edited by Billtopia : 12-04-12 at 11:15 AM. Reason: formatting the tabs
  Reply With Quote