Quantcast New artifact API - WoWInterface
Thread Tools Display Modes
08-17-18, 08:31 AM   #1
gmarco
A Frostmaul Preserver
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 254
New artifact API

Hi all,
is the function HasArtifactEquipped and all the C_ArtifactUI.* valid only for legion artifacts ?

I'd like to check infos of the new neck in BFA.
Where can I find the way to read it ?

It is really very frustrating that blizzard don't provide an official documentation of their api and the changes they do (or probably I am not able to find them

Thanks again to all for attention.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
08-17-18, 09:06 AM   #2
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 746
/api ArtifactUI list

Edit: There is an addon for browsing the functions in a nice window. But I dont remember its name
Edit2: https://www.curseforge.com/wow/addons/apiinterface
__________________
The cataclysm broke the world ... and the pandas could not fix it!

Last edited by Rilgamon : 08-17-18 at 09:10 AM.
  Reply With Quote
08-17-18, 01:37 PM   #3
gmarco
A Frostmaul Preserver
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 254
Thanks so much.

Never known about it
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
08-18-18, 12:32 AM   #4
gmarco
A Frostmaul Preserver
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 254
Hi,

After the advice on /api helper I easily succeded in implement a simple tracking of the new artifact in my LDB gmexp.

The only thing that I am unable to do is to get the name ("HEART OF AZEROTH") from the item
Is it defined as a global value G_* ?

Now I have made an ugly string but I'd like to avoid a variable to prevent to localize it by hand.

Lua Code:
  1. if C_AzeriteItem.HasActiveAzeriteItem() then
  2.  
  3.         tooltip:AddLine(" ")
  4.    
  5.         local azeriteItemLocation = C_AzeriteItem.FindActiveAzeriteItem()
  6.         local xp, totalLevelXP = C_AzeriteItem.GetAzeriteItemXPInfo(azeriteItemLocation)
  7.        
  8.         tooltip:AddDoubleLine(L["Artifact"], "Heart of Azeroth",1, 1, 1, 0, 1, 1)
  9.         tooltip:AddDoubleLine(L["Artifact Power"],C_AzeriteItem.GetPowerLevel(azeriteItemLocation), 1, 1, 1, 0, 1, 0)
  10.         tooltip:AddDoubleLine(L["Power to next rank"],totalLevelXP - xp, 1, 1, 1, 1, 0, 0)
  11.         tooltip:AddDoubleLine(L["Progress in rank %"], string_format("%.1f", xp/totalLevelXP*100) , 1, 1, 1, 0, 1, 0)
  12.        
  13.     end

Thanks to everyone for attention.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
08-18-18, 06:23 AM   #5
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 746
I've not yet tested the api ... but the name of the item should still be available through the item-api.
Code:
local itemName = GetItemInfo(GetInventoryItemID("player", INVSLOT_NECK))
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
08-18-18, 08:26 AM   #6
gmarco
A Frostmaul Preserver
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 254
Hi,
thanks for your answer ... it works nicely but it supposes that we always wear the artifact neck ( HEART OF AZEROTH



This happens when I change it , for another set for example .
So I was looking for a specific "azerite" function that give me back the name of the azerite artifact like the old one works before:

Lua Code:
  1. local _, _, ArtName,ArtIcon,ArtPower,ArtPointsSpent ,  _, _, _, _, _, _, artifactTier = C_ArtifactUI.GetEquippedArtifactInfo();

Btw thanks for the input. It is much appreciated.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
08-18-18, 09:07 AM   #7
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
Check for the itemID, if it's not the heart necklace then abort
  Reply With Quote
08-18-18, 02:22 PM   #8
gmarco
A Frostmaul Preserver
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 254
Thinking about itemID ...

I can just write something like:

Lua Code:
  1. local itemName, _ = GetItemInfo(158075)


... and cross fingers about Blizzard doesn't change itemiID of Heart of Azeroth in the next steps ...

Any others ideas ? :)
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
08-18-18, 02:32 PM   #9
dssd
A Fallenroot Satyr
Join Date: May 2016
Posts: 25
In BfA there's two new Lua API namespaces for Azerite items.

The necklace is considered an "Azerite Item" and is under the C_AzeriteItem namespace, see /api AzeriteItem

The other pieces that are powered by the necklace are considered "Azerite Empowered Items" and are in the C_AzeriteEmpoweredItem namespace, see /api AzeriteEmpoweredItem


To answer your question on the name, this is how Blizzard does it.
Code:
local azeriteItemLocation = C_AzeriteItem.FindActiveAzeriteItem()
if azeriteItemLocation then
    local azeriteItem = Item:CreateFromItemLocation(azeriteItemLocation);
    print(azeriteItem:GetItemName())
end
  Reply With Quote
08-18-18, 06:29 PM   #10
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,609
itemIDs and spellIDs very rarely (if ever) change, and if they did it would be with a patch.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
08-19-18, 01:23 AM   #11
gmarco
A Frostmaul Preserver
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 254
Originally Posted by dssd View Post
To answer your question on the name, this is how Blizzard does it.
Code:
local azeriteItemLocation = C_AzeriteItem.FindActiveAzeriteItem()
if azeriteItemLocation then
    local azeriteItem = Item:CreateFromItemLocation(azeriteItemLocation);
    print(azeriteItem:GetItemName())
end
I have seen this but I had not understood very well what the line:

Lua Code:
  1. local azeriteItem = Item:CreateFromItemLocation(azeriteItemLocation);

did.

Now I see it creates an obj item and then I can get the name with :GetItemName())
It is a so different approach from legion artifact ... who knows why they change so much ? :)

Btw it works :))

Thanks so much to everyone.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » New artifact API

Thread Tools
Display Modes

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