kpeno 1 Posted October 21, 2017 Share Posted October 21, 2017 "wManager.Wow.Helpers.Bag.GetBagItem()" - not return itemtype "Container" in bags :( Link to comment https://wrobot.eu/forums/topic/7447-baggetbagitem/ Share on other sites More sharing options...
Droidz 2738 Posted October 21, 2017 Share Posted October 21, 2017 Hello, do you use wow addons? if yes try to disable all Link to comment https://wrobot.eu/forums/topic/7447-baggetbagitem/#findComment-33956 Share on other sites More sharing options...
kpeno 1 Posted October 21, 2017 Author Share Posted October 21, 2017 35 minutes ago, Droidz said: Hello, do you use wow addons? if yes try to disable all No one addon. In DevelopmentTools if click :"bag items list" - also empty for itemtype "Container" Link to comment https://wrobot.eu/forums/topic/7447-baggetbagitem/#findComment-33957 Share on other sites More sharing options...
alchemy 0 Posted October 21, 2017 Share Posted October 21, 2017 foreach (var woWItem in wManager.Wow.Helpers.Bag.GetBagItem()) { uint temp = wManager.Wow.Helpers.ItemsManager.GetIdByName(woWItem.Name); //Item ID } Link to comment https://wrobot.eu/forums/topic/7447-baggetbagitem/#findComment-33959 Share on other sites More sharing options...
Marsbar 228 Posted October 21, 2017 Share Posted October 21, 2017 To add another question onto this, Bag.GetBagItem() only shows 1 instance of the item, even if there are more of them in different bags, anyway to get the containerid/slot for each? Link to comment https://wrobot.eu/forums/topic/7447-baggetbagitem/#findComment-33964 Share on other sites More sharing options...
reapler 154 Posted October 21, 2017 Share Posted October 21, 2017 @Marsbar Hello, i've written a method for this: public struct BagInfo { public int Bag; public int Slot; public BagInfo(int bag, int slot) { Bag = bag; Slot = slot; } public override string ToString() { return "Bag = " + Bag + " ; Slot = " + Slot; } } /// <summary> /// Used to get a list of locations of the item as bag and slot position. /// </summary> /// <param name="itemName">The item name to search.</param> /// <returns></returns> public static List<BagInfo> GetItemLocations(string itemName) { var execute = "local bs = {}" + "for b=0,4 do " + "if GetBagName(b) then " + "for s=1, GetContainerNumSlots(b) do " + "local itemLink = GetContainerItemLink(b, s) " + "if itemLink then " + "local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, itemSellPrice = GetItemInfo(itemLink) \t" + "if itemName == '"+itemName+"' "; execute += "then " + "table.insert(bs, b); " + "table.insert(bs, s); " + "\tend\tend\tend end end return unpack(bs);"; var bs = Lua.LuaDoString<List<int>>(execute); var list = new List<BagInfo>(); for (var i = 0; i < bs.Count; i += 2) list.Add(new BagInfo(bs[i], bs[i+1])); return list; } Usage: GetItemLocations("Mutton Chop").ForEach(i => Logging.Write(i.ToString())); Here are also other similar methods to interact with items: Marsbar 1 Link to comment https://wrobot.eu/forums/topic/7447-baggetbagitem/#findComment-33965 Share on other sites More sharing options...
Marsbar 228 Posted October 22, 2017 Share Posted October 22, 2017 @reapler Sadly not working for me. Getting a Index was out of range error. I'm doing this for soul shard management, wanting to delete all soul shards exepct for a certain amount. Link to comment https://wrobot.eu/forums/topic/7447-baggetbagitem/#findComment-33988 Share on other sites More sharing options...
reapler 154 Posted October 22, 2017 Share Posted October 22, 2017 2 hours ago, Marsbar said: @reapler Sadly not working for me. Getting a Index was out of range error. I'm doing this for soul shard management, wanting to delete all soul shards exepct for a certain amount. Not fully tested, but this should work: /// <summary> /// Used to get the item quantity by name. /// </summary> /// <param name="itemName">The item name.</param> /// <remarks>Replacement for GetItemCount in vanilla.</remarks> /// <returns></returns> public static int GetItemQuantity(string itemName) { var execute = "local itemCount = 0; " + "for b=0,4 do " + "if GetBagName(b) then " + "for s=1, GetContainerNumSlots(b) do " + "local itemLink = GetContainerItemLink(b, s) " + "if itemLink then " + "local _, stackCount = GetContainerItemInfo(b, s)\t " + "if string.find(itemLink, \"" + itemName + "\") then " + "itemCount = itemCount + stackCount; " + "end " + "end " + "end " + "end " + "end; " + "return itemCount; "; return Lua.LuaDoString<int>(execute); } /// <summary> /// Used to delete all items by name. /// </summary> /// <param name="itemName">The item to delete.</param> /// <param name="leaveAmount">The amount of items which remain in the bag.</param> /// <remarks>Bug at links with "-"</remarks> public static void DeleteItems(string itemName, int leaveAmount) { var itemQuantity = GetItemQuantity(itemName) - leaveAmount; if (string.IsNullOrWhiteSpace(itemName) || itemQuantity <= 0) return; var execute = "local itemCount = "+itemQuantity+"; " + "local deleted = 0; " + "for b=0,4 do " + "if GetBagName(b) then " + "for s=1, GetContainerNumSlots(b) do " + "local itemLink = GetContainerItemLink(b, s) " + "if itemLink then " + "local _, stackCount = GetContainerItemInfo(b, s)\t " + "local leftItems = itemCount - deleted; " + "if string.find(itemLink, \""+ itemName + "\") and leftItems > 0 then " + "if stackCount <= 1 then " + "PickupContainerItem(b, s); " + "DeleteCursorItem(); " + "deleted = deleted + 1; " + "else " + "if (leftItems > stackCount) then " + "SplitContainerItem(b, s, stackCount); " + "DeleteCursorItem(); " + "deleted = deleted + stackCount; " + "else " + "SplitContainerItem(b, s, leftItems); " + "DeleteCursorItem(); " + "deleted = deleted + leftItems; " + "end " + "end " + "end " + "end " + "end " + "end " + "end; "; Lua.LuaDoString(execute); } Usage: DeleteItems("Soul Shard", 20); nudl, Marsbar, sowelu and 1 other 4 Link to comment https://wrobot.eu/forums/topic/7447-baggetbagitem/#findComment-33992 Share on other sites More sharing options...
Marsbar 228 Posted October 22, 2017 Share Posted October 22, 2017 25 minutes ago, reapler said: Not fully tested, but this should work: Usage: DeleteItems("Soul Shard", 20); Works perfectly, thanks a lot! Link to comment https://wrobot.eu/forums/topic/7447-baggetbagitem/#findComment-33993 Share on other sites More sharing options...
kpeno 1 Posted October 24, 2017 Author Share Posted October 24, 2017 Maybe anyone have idea how convert item entry to wowitem ?:) Link to comment https://wrobot.eu/forums/topic/7447-baggetbagitem/#findComment-34056 Share on other sites More sharing options...
reapler 154 Posted October 25, 2017 Share Posted October 25, 2017 51 minutes ago, kpeno said: Maybe anyone have idea how convert item entry to wowitem ?:) Hello, you need to access the objectmanager to get your desired object: WoWItem item = ObjectManager.GetObjectWoWItem().FirstOrDefault(i => i.Entry == 1205);//Melon Juice Logging.Write(item?.Name ?? "Item not found"); Link to comment https://wrobot.eu/forums/topic/7447-baggetbagitem/#findComment-34059 Share on other sites More sharing options...
jiraiyasm 1 Posted August 17, 2019 Share Posted August 17, 2019 hi all. i have no idea about the codes posted here. I was trying to search how to get my warlock create a spellstone then use it. i tried to base the "create healthstone" but I don't know how to get the itemID for the spellstone. if anyone can help me out that would be really great! Link to comment https://wrobot.eu/forums/topic/7447-baggetbagitem/#findComment-55583 Share on other sites More sharing options...
Findeh 34 Posted August 17, 2019 Share Posted August 17, 2019 3 hours ago, jiraiyasm said: hi all. i have no idea about the codes posted here. I was trying to search how to get my warlock create a spellstone then use it. i tried to base the "create healthstone" but I don't know how to get the itemID for the spellstone. if anyone can help me out that would be really great! You can use wowhead: Or you can start wrobot and use Tool/Development Tool: And then "Bag Items" or "Get all Objects" (if you have the spellstone already) or "Info by name". P.S. Don't use 41191 from my screenshot. It's most likely not a spellstone you are looking for. Link to comment https://wrobot.eu/forums/topic/7447-baggetbagitem/#findComment-55584 Share on other sites More sharing options...
jiraiyasm 1 Posted August 18, 2019 Share Posted August 18, 2019 12 hours ago, Findeh said: You can use wowhead: Or you can start wrobot and use Tool/Development Tool: And then "Bag Items" or "Get all Objects" (if you have the spellstone already) or "Info by name". P.S. Don't use 41191 from my screenshot. It's most likely not a spellstone you are looking for. how can I set my warlock to use the master spellstone? Thank you. Link to comment https://wrobot.eu/forums/topic/7447-baggetbagitem/#findComment-55585 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now