LiteMount

LiteMount

2M Downloads

Tooltip for whether or not the target's mount has been collected

pcg79 opened this issue ยท 2 comments

commented

It would be cool if, upon mouseover on a mounted player, if the tooltip said whether or not I owned that mount.

I know something like this isn't really LiteMount's domain (probably something more like MountCollector). But LiteMount is in a good position to do it given it already compiles a list of available mounts and has utility methods for whether or not a mount is owned (when it attempts to cast the same mount as the target).

(I'll admit I tried to do it but couldn't figure out how to hook into onenter events.)

commented

I think you are right (sorry) that this is better suited to MountCollector.

Here is the code that would be needed to be added to MountCollector to make it work. Please check with the author if they would be willing to add it. I put this in a file UnitTooltip.lua in the MountCollector folder and added a line for it at the end of the MountCollector.toc file:

local addonName, addon = ...

local function AddCollectedLines(tt, ttData)
   local unit = UnitTokenFromGUID(ttData.guid)

   if not unit or not UnitIsPlayer(unit) then
      return
   end

   local playerItems, mountIds = addon:GetPlayerItems()

   AuraUtil.ForEachAura(unit, 'HELPFUL', nil,
      function (auraData)
         local mountId = mountIds[auraData.spellId]
         if mountId then
            local owned = playerItems[auraData.spellId]
            local name = C_MountJournal.GetMountInfoByID(mountId)
            tt:AddLine(" ")
            tt:AddLine(addonName)
            tt:AddDoubleLine(name, owned and COLLECTED or NOT_COLLECTED, 1, 1, 1, 1, 1, 1)
            return true
         end
      end, true
   )
end

TooltipDataProcessor.AddTooltipPostCall(
   Enum.TooltipDataType.Unit,
   function (tt, data)
      if not InCombatLockdown() then
         AddCollectedLines(tt, data)
      end
   end
)
commented

Wow, that's really impressive. Thank you for the code. I'll see about submitting it.