Ejemplo n.º 1
0
def createItemByItem(item, amount, owner = None):
	"""
	根据一个已知物品来创建一个新的物品
	"""
	newItem = copy.deepcopy(item)
	newItem.setUUID(scutils.newUID())
	newItem.setAmount(amount)
	INFO_MSG("new item created. new item uuid=%i, src item uuid=%i" % (newItem.getUUID(), item.getUUID()))
	return newItem
Ejemplo n.º 2
0
def createItem(itemNO, amount = 1, owner = None):
	"""
	创建物品
	"""
	INFO_MSG("%i created. amount=%i" % (itemNO, amount))

	stackMax = getItemData(itemNO).get("overlayMax", 1)
	itemList = []
	while amount > 0:
		itemAmount = (amount < stackMax) and amount or stackMax
		item = getItemClass(itemNO)(itemNO, scutils.newUID(), itemAmount)
		item.onCreate(owner)
		itemList.append(item)
		amount -= itemAmount

	return itemList