I need a way to get the GUID's of every item in a player's inventory. I've poked around and it doesn't look like there's a script lying around anywhere.
I'm using MangosZero w/ Eluna right now.
I need a way to get the GUID's of every item in a player's inventory. I've poked around and it doesn't look like there's a script lying around anywhere.
I'm using MangosZero w/ Eluna right now.
https://github.com/ElunaLuaEngine/El...aFunctions.cpp
Your item reference can be returned by:
Then to get the item's GUID you will need to expose the GetGUID function by the looks of it, as it does not seem to exist for some strange reason. You can loop through the entire players inventory this way.Code:{ "GetItemByEntry", &LuaPlayer::GetItemByEntry }, // :GetItemByEntry(entry) - Gets an item if the player has it { "GetEquippedItemBySlot", &LuaPlayer::GetEquippedItemBySlot }, // :GetEquippedItemBySlot(slotId) - Returns equipped item by slot
In regards to PM, do something like this:
If you want to get the item ID's the player has, change item:GetGUID() to item:GetEntry().Code:local function getPlayersInventory(plr) local items = {} for i=0,23 do -- need to iterate through every slot, this does not include items in bag I think, need to get the ID's for these from the emulator local item = plr:GetEquippedItemBySlot(i) if item then table.insert(items, item:GetGUID()) end end return items end
Code:... local items = getPlayersInventory(player) -- call our custom function passing in the player -- Assume item ID's were returned not GUIDs for _,v in pairs(items) do player:AddItem(v) end
Last edited by stoneharry; 08-09-2014 at 08:53 AM.