WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   New artifact API (https://www.wowinterface.com/forums/showthread.php?t=56564)

gmarco 08-17-18 08:31 AM

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.

Rilgamon 08-17-18 09:06 AM

/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

gmarco 08-17-18 01:37 PM

Thanks so much.

Never known about it :)

gmarco 08-18-18 12:32 AM

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.

Rilgamon 08-18-18 06:23 AM

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))

gmarco 08-18-18 08:26 AM

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.

Ammako 08-18-18 09:07 AM

Check for the itemID, if it's not the heart necklace then abort :p

gmarco 08-18-18 02:22 PM

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 ? :)

dssd 08-18-18 02:32 PM

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


Seerah 08-18-18 06:29 PM

itemIDs and spellIDs very rarely (if ever) change, and if they did it would be with a patch.

gmarco 08-19-18 01:23 AM

Quote:

Originally Posted by dssd (Post 329684)
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.


All times are GMT -6. The time now is 06:04 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI