Jump to content
This site uses cookies! Learn More

This site uses cookies!

By continuing to use this site, you agree to allow us to store cookies on your computer. :)

Losmy

How to get Rolled item as WowItem?

Recommended Posts

Hi! I'm trying to create a plugin that automaticly needs on the rolled item if the bot needs it otherwise greeds/passes/DE. But I've got problem that I can't always find the ID from the item.
Right now I'm getting the item's name from "GetLootRollItemInfo" and I then I use this code to get it as a WowItem.

 WoWItem item = ObjectManager.GetObjectWoWItem().FirstOrDefault(i => i.Entry == ItemsManager.GetIdByName(name));

This does not always work, I sometimes get the ID 0. This would also not work on items with random enchants because they all have same item ID but not same stats. I have seen there is itemlink aswell but I can't find much information about it, GetLootRollItemLink.

If you have any piece of advice how to get the rolled item as a wowItem it would be great because then I don't have to change any of the other code.

 

Best Regards A.Z

Share this post


Link to post
Share on other sites
17 hours ago, Losmy said:

Hi! I'm trying to create a plugin that automaticly needs on the rolled item if the bot needs it otherwise greeds/passes/DE. But I've got problem that I can't always find the ID from the item.
Right now I'm getting the item's name from "GetLootRollItemInfo" and I then I use this code to get it as a WowItem.

 WoWItem item = ObjectManager.GetObjectWoWItem().FirstOrDefault(i => i.Entry == ItemsManager.GetIdByName(name));

This does not always work, I sometimes get the ID 0. This would also not work on items with random enchants because they all have same item ID but not same stats. I have seen there is itemlink aswell but I can't find much information about it, GetLootRollItemLink.

If you have any piece of advice how to get the rolled item as a wowItem it would be great because then I don't have to change any of the other code.

 

Best Regards A.Z

Do you need to roll based on ID? Sounds a bit like double work to first convert to ID?
Can't you just make the roll based on item name?
Another solution is to get itemlink from the frame itself. You can use framestack to figure out what frame it is, then you can both get stats as well as item id from that. 🙂
Edit: I obviously didn't mean itemlink, I meant tooltip lol

Edited by Ordush

Share this post


Link to post
Share on other sites

I'm using weightstats in deciding if the item is needed or not before needing/passing on the item. Problem is when I get items such as "....of the hawk,bear,tiger " etc because they all have the same item ID but different "random enchants". 

It's surely an idea to get the stats from the frame itself, I'll have a look! Thanks!

 

Edit: I missunderstood your first part I believe. The reason I want to make it into an WowItem class is because I can skip modifying parts of the code I already made.

Share this post


Link to post
Share on other sites
3 minutes ago, Losmy said:

I'm using weightstats in deciding if the item is needed or not before needing/passing on the item. Problem is when I get items such as "....of the hawk,bear,tiger " etc because they all have the same item ID but different "random enchants". 

It's surely an idea to get the stats from the frame itself, I'll have a look! Thanks!

I understand, are you only able to roll based on ID? Because if not, then the 0 ID bug, can be avoided simply by using name. 🙂
You could make a table with the item name and stats, if the stats meets your satisfactory, then roll need on the item otherwise greed/disenchant.

Edit: Tables (Lua) is about the same as 'arrays' in c#. 🙂

Edited by Ordush

Share this post


Link to post
Share on other sites

Where would I find/create these tables? It would require me to download the entire item database and keep in a table?

Right now the code only takes the argument WowItem which is a problem since I don't know how to create a WowItem from the name or ID.

 

Thank you, my lua knowledge is very limited to only the wow lua api right now, only been doing c#.

Share this post


Link to post
Share on other sites
25 minutes ago, Losmy said:

Where would I find/create these tables? It would require me to download the entire item database and keep in a table?

Right now the code only takes the argument WowItem which is a problem since I don't know how to create a WowItem from the name or ID.

 

Thank you, my lua knowledge is very limited to only the wow lua api right now, only been doing c#.

You create these tables yourself, and no you don't need to download anything.
You actually might not even need to make a table, it was just some way for you to keep your stuff sorted.
Get the stats from the tooltip, compare these stats with your weight, if the stats comes out as something you'd roll on, then roll on that item.
Do you HAVE to make it an wow item? Can you not skip this alltogether? I personally haven't used wrobot to roll.

Edited by Ordush

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...