コード例 #1
0
ファイル: game_item_manager.cpp プロジェクト: mixxit/solinia
//----------------------------------------------------------------------------
// CGameItemManager::buildNpcSpecificItems
//----------------------------------------------------------------------------
void CGameItemManager::buildNpcSpecificItems()
{
	if (EGSLight)
		return;

	for( CAllStaticItems::const_iterator it = CSheets::getItemMapForm().begin(); it != CSheets::getItemMapForm().end(); ++it )
	{
		// only keep npc items
//		if( (*it).first.toString().substr(0,4) != "npc_" ) //obsolete, now we want be able to have all non craftable item
		if( (*it).first.toString().substr(0,2) == "ic" )
		{
			continue;
		}
		
		CGameItemPtr item;
//		item.newItem( CEntityId::Unknown, (*it).first, 1, 0, false,false );
		item.newItem( it->first, 1, false,false );
		
		_NpcSpecificItems.push_back(item);
		
#ifdef NL_DEBUG
		nldebug("built npc item item %s", (*it).first.toString().c_str());
#endif
	}
} // CGameItemManager //
コード例 #2
0
ファイル: game_item_manager.cpp プロジェクト: mixxit/solinia
//---------------------------------------------------
// getNewItem :
//
//---------------------------------------------------
//CGameItemPtr CGameItemManager::getNewItem( CEntityId& id, CSheetId& sheetId, uint16 quality, bool destroyable , bool dropable)
CGameItemPtr CGameItemManager::getNewItem( const CSheetId& sheetId, uint16 quality, bool destroyable , bool dropable)
{
	CAllStaticItems::iterator itForm = CSheets::getItemMapFormNoConst().find( sheetId );
	if( itForm != CSheets::getItemMapFormNoConst().end() )
	{
		// get the slot count
//		sint16 slotCount = 0;
		//nldebug("<CGameItemManager::getNewItem> Family type: %s", ITEMFAMILY::toString( (*itForm).second.Family ).c_str() );
//		if( ( (*itForm).second.Family == ITEMFAMILY::BAG ) || ( (*itForm).second.Family == ITEMFAMILY::STACK ) )
//		{
//			slotCount = (*itForm).second.SlotCount;
//		}
		
		// create the item
		CGameItemPtr item;
//		item.newItem( id, sheetId, quality, slotCount, destroyable, dropable );
		item.newItem( sheetId, quality, destroyable, dropable );

//		if( item!=NULL )
//		{
			// init the dynamic values from sheet -> DONE in CGameItemCreator
			//(*item).Quality = (*itForm).second.Quality;
			//(*item).HP = (*itForm).second.HitPoints;
			
			// if this item contains sub items we create them
//			if( (*itForm).second.Family == ITEMFAMILY::CORPSE || (*itForm).second.Family == ITEMFAMILY::CARRION )
//			{
				// create the content
/*				for (uint i=0; i < (*itForm).second.Content.size(); i++)
				{
					CSheetId itemSheetId( (*itForm).second.Content[i] );
					createItem( itemSheetId, quality, id, -1, destroyable,dropable );
				}
*/
				// if the item is a corpse, we push it to list and erase the olds one if we reached max corpse count
//				if( (*itForm).second.Family == ITEMFAMILY::CORPSE )
//				{
//					_Corpses.push( item );
//					if( _Corpses.size() > CorpseMaxCount )
//					{
//						CGameItemPtr itemTmp = _Corpses.front();
//						destroyItem( itemTmp );
//						_Corpses.pop();
//					}
//				}
//			}
//		}

		return item;
	}
	return NULL;

} // getNewItem //