All pastes #286542 Raw Edit

Untitled

public text v1 · immutable
#286542 ·published 2006-12-20 19:30 UTC
rendered paste body
public L2ItemInstance createItem(String process, int itemId, int count, L2PcInstance actor, L2Object reference)
	{
        // Serial
		int serial = 0;  
		if( process.startsWith("exchange:")) 
			if( process.split(":").size == 2) serial = Integer.parseInt(process.split(":")[1]);
		
		// Create and Init the L2ItemInstance corresponding to the Item Identifier
		L2ItemInstance item = new L2ItemInstance(IdFactory.getInstance().getNextId(), itemId);
		
        if (process.equalsIgnoreCase("loot") && !Config.AUTO_LOOT)
        {
            item.setOwnerId(actor.getObjectId());
            ScheduledFuture itemLootShedule  = ThreadPoolManager.getInstance().scheduleGeneral(new resetOwner(item), 15000);
            item.setItemLootShedule(itemLootShedule);
        }
        
		if (Config.DEBUG) _log.fine("ItemTable: Item created  oid:" + item.getObjectId()+ " itemid:" + itemId);
		
		// Add the L2ItemInstance object to _allObjects of L2world
		L2World.getInstance().storeObject(item);

		// Set Item parameters
		if (item.isStackable() && count > 1) item.setCount(count);
		
		if (Config.LOG_ITEMS) 
		{
			LogRecord record = new LogRecord(Level.INFO, "CREATE:" + process);
			record.setLoggerName("item");
			record.setParameters(new Object[]{item, actor, reference});
			_logItems.log(record);
		}
        
		return item; 	
	}