Modify_Item

Pilus edited this page Aug 11, 2015 · 1 revision
Clone this wiki locally

Syntax

obj = GHI_CreateItem()

OR

obj = GHI_EditItem(guid)

Arguments

guid
''String''
The GUID of the item you wish to modify. Only needed when using the edit version.
## Returns

GHI_CreateItem() and GHI_EditItem() return an object. Use the Modify Item API: Item Info and the Modify Item API: Edit Item to set or read parameters for the item you are creating / modifying.

Example

Create Item Example:

local item = GHI_CreateItem()

item.SetName("Tasty Fruit")

item.SetIcon("Interface\\Icons\\INV_Misc_Food_22")

item.SetConsumed(true)

item.SetCooldown(10)

item.SetQuality(3)

item.SetWhite1("A piece of Tasty Fruit for you to enjoy.")

item.SetComment("Juicy!")

item.SetUseText("Eat Me.")

item.SetStackSize(5)

item.Save()

Edit Item Example:

local item = GHI_EditItem(stack.GetItemGuid())

``

local fruit = function()

item.SetName("Tasty Fruit")

item.SetIcon("Interface\\Icons\\INV_Misc_Food_22")

item.SetCooldown(10)

item.SetQuality(3)

item.SetWhite1("A piece of Tasty Fruit for you to enjoy.")

item.SetComment("Juicy!")

item.SetUseText("Eat Me.")

item.SetStackSize(5)

item.Save()

end

``

local box = function()

item.SetName("Box of Tasty Fruit")

item.SetIcon("Interface\\Icons\\INV_Crate_08")

item.SetCooldown(1)

item.SetQuality(1)

item.SetWhite1("A box of Tasty Fruit.")

item.SetComment("It's Heavy.")

item.SetUseText("Open Me")

item.SetStackSize(5)

item.Save()

end

local itemName = item.GetItemInfo();

if itemName == "Box of Tasty Fruit" then

fruit()

elseif itemName == "Tasty Fruit" then

box()

else

box()

end