Thread Tools Display Modes
08-25-16, 11:18 AM   #1
Nightmareic
A Defias Bandit
 
Nightmareic's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 2
Attaching ArtifactPower SpellIDs to Tooltips

Hey all,

I've been struggling with trying to hook in Spell IDs for Artifact Traits into their tooltips. I'm attempting to update idTip (https://mods.curse.com/addons/wow/spellid) and have successfully added PowerIDs in this way:

Code:
hooksecurefunc(GameTooltip, "SetArtifactPowerByID", function(self, id)
    if id then 
        addLine(self, id, types.artifactpower);
    end
end)

--Types are a table for the tooltip string:
local types = {
 artifactpower = "ArtifactPowerID:"
}
There is this thread (http://www.wowinterface.com/forums/s...d.php?p=316276) discussing how to dump Artifact Power info, and a macro was made for dumping that:
  1. /run local u,e,a=UIParent,"ARTIFACT_UPDATE",C_ArtifactUI;u:UnregisterEvent(e);SocketInventoryItem(16);for i,p in ipairs(a.GetPowers()) do print(GetSpellInfo((a.GetPowerInfo(p)))) end;a.Clear();u:RegisterEvent(e)

I've looked at how Spell IDs were added to other tooltips and looked through Blizzard_ArtifactUI.lua and simply can't figure out how to connect the two. Here's the full code that I currently have: http://pastebin.com/WfN8JYVq Any help would be greatly appreciated!

Last edited by Nightmareic : 08-25-16 at 11:24 AM.
  Reply With Quote
08-26-16, 07:22 AM   #2
kokomala
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 29
Whilst I'm unskilled with hooking into tooltips, you'll want to look at the code in the Blizzard_ArtifactUI.

The following will print your spellID (and details).

Code:
hooksecurefunc(GameTooltip, "SetArtifactPowerByID", function(self, id)
    -- Note: id == artifact power id
    -- Return args for C_ArtifactUI.GetPowerInfo(id):
    -- spellID, upgradeCost, curRank, maxRank, bonusRank, xpos, ypos, prereqsMet, isStart, isGoldMedal, isFinal

    spellid = C_ArtifactUI.GetPowerInfo(id)
    print(spellid, GetSpellInfo(spellid))
end)
You should be able to continue on from there.

Last edited by kokomala : 08-26-16 at 07:25 AM.
  Reply With Quote
08-26-16, 11:14 AM   #3
Nightmareic
A Defias Bandit
 
Nightmareic's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 2
Got it, Thanks!

Code:
-- ArtifactPowerIDs
hooksecurefunc(GameTooltip, "SetArtifactPowerByID", function(self, id)
    if id then 
    	local spellid = C_ArtifactUI.GetPowerInfo(id)
        addLine(self, id, types.artifactpower);
        addLine(self, spellid, types.spell)
    end
end)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Attaching ArtifactPower SpellIDs to Tooltips


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