Jump to content

Can you make it, so wrobot does not count quiver/ammobag slots als normal bag slots?


Recommended Posts

Can you make wrobot distinct between ammo-bag-slots and actual real bag slots.
Setting a point on when to do a vendor run because of full bags with a hunter is horrible.
But as hunter is probably the best farmer class this is a huge problem for everyone running a hunter.

Link to comment
Share on other sites

Try this plugin, I made it ages ago for a friend, i think it does what you're after, you just have to give it the correct bag slot id, id 1 is the first bag next to your backpack, then its 2, 3, 4.

AmmoV2.cs

edit: if it works for you let me know and I'll post it for other people, i thought there was another plugin or something that covers this but can't find anything atm.

Edited by Marsbar
Link to comment
Share on other sites

@Marsbar you can do this completely automatically:
 

Lua.LuaDoString(@"
            if GetItemInfoFromItemLink ~= nil then return end

            function GetItemInfoFromItemLink(link)
                local itemId = nil;
                if ( type(link) == 'string' ) then
                    _,_, itemId = string.find(link, 'item:(%d+):');
                    if (itemId) then

                        local version, build, date = GetBuildInfo();
                        if (tonumber(build) > 5875) then
                            local itemName, itemLink, itemQuality, itemLevel, itemMinLevel, itemType, itemSubType, itemCount, itemEquipLoc, itemTexture = GetItemInfo(itemId);
                            return itemName, itemLink, itemQuality, itemLevel, itemType, itemSubType, itemCount, itemTexture;
                        else 
                            return GetItemInfo(itemId);
                        end
                    end
                end
            end
        ");

uint quiverSlotCount = Lua.LuaDoString<uint>(@"
                for slot = 20,23 do
                    local link = GetInventoryItemLink('player', slot);
                    if link then then
                        local itemName, itemLink, itemQuality, itemLevel, itemType, itemSubType, itemCount, itemTexture = GetItemInfoFromItemLink(link);
						if itemType == 'Quiver' then
                            return GetContainerNumSlots(slot - 19); -- gets back slot
                        end
                    end
                end    
            ");

Works at least vanilla => WotLK. So you can turn that into a free plugina nd post it here :)

Link to comment
Share on other sites

  • 1 month later...
On 12/15/2018 at 9:10 AM, Matenia said:

@Marsbar you can do this completely automatically:
 

Works at least vanilla => WotLK. So you can turn that into a free plugina nd post it here ?

couldn't actually get this to work so using this instead:

return Lua.LuaDoString<int>(@"
                for slot = 20,23 do
                    local link = GetInventoryItemLink('player', slot);
                    if link then
                        local _, _, _, _, _, itemType = GetItemInfo(link);
			if itemType == 'Quiver' then
                            return slot - 19; -- gets back slot
                        end
                    end
                end    
            "); 

 

Edited by Marsbar
Link to comment
Share on other sites

7 minutes ago, Droidz said:

I'll try to resolve this problem in bot, can you confirm than list of bags is complete here? https://www.wowhead.com/icon=133581/inv-misc-ammo-bullet-01#used-by-item:0+14-2 (items type Bag)? 

https://wotlk.evowow.com/?items=11

all types of hunter quiver/ammobags. These were removed cata onwards so it's only needed for WOTLK, TBC and Vanilla

Link to comment
Share on other sites

20 minutes ago, Droidz said:

I'll try to resolve this problem in bot, can you confirm than list of bags is complete here? https://www.wowhead.com/icon=133581/inv-misc-ammo-bullet-01#used-by-item:0+14-2 (items type Bag)? 

Also can you let me know once you've resolved it? Then I can get rid of https://wrobot.eu/files/file/1766-free-ammo/

 

Link to comment
Share on other sites

And code look like:

var QuiverAmmoBagsId = new List<int>
{
    29143,
    29144,
    29118,
    18714,
    44447,
    44448,
    34105,
    34106,
    34099,
    34100,
    19319,
    19320,
    2662,
    2663,
    8217,
    8218,
    7371,
    7372,
    3604,
    3605,
    3573,
    3574,
    11362,
    11363,
    5439,
    5441,
    7278,
    7279,
    2101,
    2102,
};

var freeSlots = 0;
var bags = wManager.Wow.ObjectManager.ObjectManager.GetObjectWoWContainer();
foreach (var b in bags)
{
    if (b.IsValid &&
        QuiverAmmoBagsId.Contains(b.Entry) &&
        b.Owner == wManager.Wow.ObjectManager.ObjectManager.Me.Guid &&
        (b.ContainedIn == 0 || b.ContainedIn == wManager.Wow.ObjectManager.ObjectManager.Me.Guid) &&
        !string.IsNullOrWhiteSpace(b.Name))
    {
        freeSlots += Lua.LuaDoString<int>($@"
                local freeSlots = 0;
                for bagID = 1, 4 do
	                if GetBagName(bagID) ~= nil and GetBagName(bagID) == '{b.Name.Replace("'", "\'")}' then
	                    for s=1,GetContainerNumSlots(bagID) do
		                    local i = GetContainerItemInfo(bagID,s);
		                    if not i then
			                    freeSlots = freeSlots + 1
		                    end
	                    end
	                end
                end
                return freeSlots;");
    }
}

 

Link to comment
Share on other sites

  • 4 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...