Cuberite Forum
[SOLVED] Get list (string) of item enchantments - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: [SOLVED] Get list (string) of item enchantments (/thread-2111.html)



[SOLVED] Get list (string) of item enchantments - DrMasik - 09-16-2015

I'm try to get item enchantments list. How can I do it?
Code:
armor = Player:GetInventory():GetArmorGrid();

local tmp = nil

for i = 0, armor:GetNumSlots()-1 do
  tmp = armor:GetSlot(i):IsEnchantable();
end

Return error.

Code:
error in function 'IsEnchantable'.
argument #1 is 'const cItem'; 'cItem' expected.

Any help me?


RE: Get list (string) of item enchantments - NiLSPACE - 09-16-2015

cItem:IsEnchantable is static. Use this:

tmp = cItem:IsEnchantable(armor:GetSlot(i).m_ItemType)



RE: Get list (string) of item enchantments - DrMasik - 09-16-2015

@NiLSPACE, thank you. I found other solution
Code:
armor:GetSlot(i).m_Enchantments:IsEmpty()



RE: Get list (string) of item enchantments - DrMasik - 09-16-2015

I found solution for my question:
Code:
armor:GetSlot(i).m_Enchantments:ToString()