new runTimeItem()
a class that helps manage runtime items, that is items that were created from code alone at runtime.
Members
-
_data :rm.types.Item
-
the actual data item of this class
Methods
-
addRecipe(itemIds, unlockItemId,)
-
add a recipe to the current item
Parameters:
Name Type Description itemIds
Array.<id> array of items needed for this recipe
unlockItemId,
id the item that will unlock the recipe for this item
-
buildDefaultParams()
-
create the default data item
Returns:
-the default dataItem obj
-
setCallback()
-
set a callback to be called when this item is used
-
setCraftingCallback(cb)
-
set a callback to occur when this item is crafted
Parameters:
Name Type Description cb
function the callback to be called
-
setDescription(desc)
-
set the desc of this item
Parameters:
Name Type Description desc
String the new desc
-
setItemType()
-
1: normal, 0: weapon, 0: armor?, 2: book
-
setName(name)
-
set the name of this item
Parameters:
Name Type Description name
String the new name