View Single Post
  #2  
Unread 04-26-2017, 06:34 PM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Oct 2010
Posts: 340
Yes. You already have an item ID, "0x0000000000000000:0x7002B018"
The "0x0000000000000000" is a unique item identifier (in this case not specified) and the "0x7002B018" is the generic item id part.

If the generic part is 0, then the unique part MUST be specified, otherwise you can use the generic part. In this case, the easiest thing to do is just use the entire "0x0000000000000000:0x7002B018".
To use the itemID to create a shortcut, you have to replace the ":" with a "," like "0x0000000000000000,0x7002B018"

You can use that item ID to create a shortcut and then use the getItem method of the shortcut to get an Item. I would not suggest using the GetName method of the Item object, rather use GetItemInfo() to get an ItemInfo structure and use the GetName() from that (the GetName on the Item is a deprecated function and may not be supported at some point).

I will forgo the parsing and just assign the id to a variable, but you should be able to parse it easily enough.

Code:
  local itemId="0x0,0x7002B018"
  local name="undefined"
  local sc=Turbine.UI.Lotro.Shortcut(Turbine.UI.Lotro.ShortcutType.Item,itemId)
  if sc~=nil then
    local item=sc:GetItem()
    if item~=nil then
      local ii=item:GetItemInfo()
      if ii~=nil then
        name=ii:GetName()
      end
    end
  end
In this case, name="Medallion". Of course, you would want some error messages if sc, item or ii were ever nil, etc. but you should get the gist.

Last edited by Garan : 04-26-2017 at 06:45 PM.
Reply With Quote