antiblock
https://i.imgur.com/aJ17bf7.gif
  • Chatbox

    You don't have permission to chat.
    Load More
  • 0
Sign in to follow this  
K3nkσz

Duvida - Vanilla Core - Adeus .txt Ou Não?

Question

Boas comunidade.

Estou farto de usar o item_proto.txt e item_names.txt e isso tudo, e para além disso, é deveras de complicado de alterar algum item que seja.

Estive a procurar na google, e reparei que se usar o Vanilla Core e colocar no conf.txt (normalmente é no Auth no filezilla) isto: TXT_STARTUP = 0

Descobri este tópico num fórum que costumo frequentar: Clica.

 

Mas não sei se posso aplicar isso nas minhas files, nem sei como aplicar.

Existe alguma forma simples de desativar os ITEM_PROTO.TXT (etc..) e voltar a usar o navicat novamente?

O vanilla têm uma serie e definições novas, e eu só queria usa-lo para usufruir de uma definição.

 

Alguma ajuda?

 

Obrigado, cumprimentos.

Kenkoz.

Share this post


Link to post
Share on other sites

13 answers to this question

  • 0

Sim, existe, eu acho que postei aqui como o fazer.

Share this post


Link to post
Share on other sites
antiblock
Elveron
  • 0

Qualquer dúvida relacionada com esse Game Core acho melhor postar directamente na fonte, visto que o criador responde a tudo

Share this post


Link to post
Share on other sites
  • 0

Para por isso eu não sei mais na metin2dev a algum tempo tinha tutorial que ensinava a mudar umas cenas na db para iniciar tudo no navicat sem txt eu mesmo cheguei a testar e funcionava.

Share this post


Link to post
Share on other sites
  • 0

Está aqui, isso foi das primeiras coisas que fiz com o game: 

 

Isso é substituir 2 funções apenas, o que elas fazem é dar o mirrow dos TXT para a DB. E trabalham com a DB a partir daí

bool CClientManager::InitializeItemTable(){	//================== ÇÔ¼ö ¼³¸í ==================//	//1. ¿ä¾à : 'item_proto.txt', 'item_proto_test.txt', 'item_names.txt' ÆÄÀÏÀ» Àаí,	//		<item_table>(TItemTable), <m_map_itemTableByVnum> ¿ÀºêÁ§Æ®¸¦ »ý¼ºÇÑ´Ù.	//2. ¼ø¼­	//	1) 'item_names.txt' ÆÄÀÏÀ» Àо (a)[localMap](vnum:name) ¸ÊÀ» ¸¸µç´Ù.	//	2) 'item_proto_text.txt'ÆÄÀÏ°ú (a)[localMap] ¸ÊÀ¸·Î	//		(b)[test_map_itemTableByVnum](vnum:TItemTable) ¸ÊÀ» »ý¼ºÇÑ´Ù.	//	3) 'item_proto.txt' ÆÄÀÏ°ú (a)[localMap] ¸ÊÀ¸·Î	//		(!)[item_table], <m_map_itemTableByVnum>À» ¸¸µç´Ù.	//			<Âü°í>	//			°¢ row µé Áß,	//			(b)[test_map_itemTableByVnum],(!)[mob_table] ¸ðµÎ¿¡ ÀÖ´Â row´Â	//			(b)[test_map_itemTableByVnum]ÀÇ °ÍÀ» »ç¿ëÇÑ´Ù.	//	4) (b)[test_map_itemTableByVnum]ÀÇ rowÁß, (!)[item_table]¿¡ ¾ø´Â °ÍÀ» Ãß°¡ÇÑ´Ù.	//3. Å×½ºÆ®	//	1)'item_proto.txt' Á¤º¸°¡ item_table¿¡ Àß µé¾î°¬´ÂÁö. -> ¿Ï·á	//	2)'item_names.txt' Á¤º¸°¡ item_table¿¡ Àß µé¾î°¬´ÂÁö.	//	3)'item_proto_test.txt' ¿¡¼­ [°ãÄ¡´Â] Á¤º¸°¡ item_table ¿¡ Àß µé¾î°¬´ÂÁö.	//	4)'item_proto_test.txt' ¿¡¼­ [»õ·Î¿î] Á¤º¸°¡ item_table ¿¡ Àß µé¾î°¬´ÂÁö.	//	5) (ÃÖÁ¾) °ÔÀÓ Å¬¶óÀ̾ðÆ®¿¡¼­ Á¦´ë·Î ÀÛµ¿ ÇÏ´ÂÁö.	//_______________________________________________//	//=================================================================================//	//	1) 'item_names.txt' ÆÄÀÏÀ» Àо (a)[localMap](vnum:name) ¸ÊÀ» ¸¸µç´Ù.	//=================================================================================//	bool isNameFile = true;	map<int,const char*> localMap;	cCsvTable nameData;	if(!nameData.Load("item_names.txt",'t'))	{		fprintf(stderr, "item_names.txt was loaded successfully.n");		isNameFile = false;	} else {		nameData.Next();		while(nameData.Next()) {			localMap[atoi(nameData.AsStringByIndex(0))] = nameData.AsStringByIndex(1);		}	}	//_________________________________________________________________//	//=================================================================//	//	2) 'item_proto_text.txt'ÆÄÀÏ°ú (a)[localMap] ¸ÊÀ¸·Î	//		(b)[test_map_itemTableByVnum](vnum:TItemTable) ¸ÊÀ» »ý¼ºÇÑ´Ù.	//=================================================================//	map<DWORD, TItemTable *> test_map_itemTableByVnum;	//1. ÆÄÀÏ Àоî¿À±â.	cCsvTable test_data;	if(!test_data.Load("item_proto_test.txt",'t'))	{		fprintf(stderr, "item_proto_test.txt was loaded successfully.n");		//return false;	} else {		test_data.Next();	//¼³¸í ·Î¿ì ³Ñ¾î°¡±â.		//2. Å×½ºÆ® ¾ÆÀÌÅÛ Å×ÀÌºí »ý¼º.		TItemTable * test_item_table = NULL;		int test_itemTableSize = test_data.m_File.GetRowCount()-1;		test_item_table = new TItemTable[test_itemTableSize];		memset(test_item_table, 0, sizeof(TItemTable) * test_itemTableSize);		//3. Å×½ºÆ® ¾ÆÀÌÅÛ Å×ÀÌºí¿¡ °ªÀ» ³Ö°í, ¸Ê¿¡±îÁö ³Ö±â.		while(test_data.Next()) {			if (!Set_Proto_Item_Table(test_item_table, test_data, localMap))			{				fprintf(stderr, "¾ÆÀÌÅÛ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ.n");						}			test_map_itemTableByVnum.insert(std::map<DWORD, TItemTable *>::value_type(test_item_table->dwVnum, test_item_table));			test_item_table++;		}	}	//______________________________________________________________________//	//========================================================================//	//	3) 'item_proto.txt' ÆÄÀÏ°ú (a)[localMap] ¸ÊÀ¸·Î	//		(!)[item_table], <m_map_itemTableByVnum>À» ¸¸µç´Ù.	//			<Âü°í>	//			°¢ row µé Áß,	//			(b)[test_map_itemTableByVnum],(!)[mob_table] ¸ðµÎ¿¡ ÀÖ´Â row´Â	//			(b)[test_map_itemTableByVnum]ÀÇ °ÍÀ» »ç¿ëÇÑ´Ù.	//========================================================================//	//vnumµéÀ» ÀúÀåÇÒ ¼Â. »õ·Î¿î Å×½ºÆ® ¾ÆÀÌÅÛÀ» ÆǺ°ÇÒ¶§ »ç¿ëµÈ´Ù.	set<int> vnumSet;	//ÆÄÀÏ Àоî¿À±â.	cCsvTable data;	if(!data.Load("item_proto.txt",'t'))	{		fprintf(stderr, "item_proto.txt was loaded successfully.n");		return false;	}	data.Next(); //¸Ç À­ÁÙ Á¦¿Ü (¾ÆÀÌÅÛ Ä®·³À» ¼³¸íÇÏ´Â ºÎºÐ)	if (!m_vec_itemTable.empty())	{		sys_log(0, "RELOAD: item_proto");		m_vec_itemTable.clear();		m_map_itemTableByVnum.clear();	}	//===== ¾ÆÀÌÅÛ Å×ÀÌºí »ý¼º =====//	//»õ·Î Ãß°¡µÇ´Â °¹¼ö¸¦ ÆľÇÇÑ´Ù.	int addNumber = 0;	while(data.Next()) {		int vnum = atoi(data.AsStringByIndex(0));		std::map<DWORD, TItemTable *>::iterator it_map_itemTable;		it_map_itemTable = test_map_itemTableByVnum.find(vnum);		if(it_map_itemTable != test_map_itemTableByVnum.end()) {			addNumber++;		}	}	//data¸¦ ´Ù½Ã ùÁÙ·Î ¿Å±ä´Ù.(´Ù½Ã Àоî¿Â´Ù;;)	data.Destroy();	if(!data.Load("item_proto.txt",'t'))	{		fprintf(stderr, "item_proto.txt was loaded successfully.n");		return false;	}	data.Next(); //¸Ç À­ÁÙ Á¦¿Ü (¾ÆÀÌÅÛ Ä®·³À» ¼³¸íÇÏ´Â ºÎºÐ)	m_vec_itemTable.resize(data.m_File.GetRowCount() - 1 + addNumber);	memset(&m_vec_itemTable[0], 0, sizeof(TItemTable) * m_vec_itemTable.size());	int testValue = m_vec_itemTable.size();	TItemTable * item_table = &m_vec_itemTable[0];	while (data.Next())	{		int col = 0;		std::map<DWORD, TItemTable *>::iterator it_map_itemTable;		it_map_itemTable = test_map_itemTableByVnum.find(atoi(data.AsStringByIndex(col)));		if(it_map_itemTable == test_map_itemTableByVnum.end()) {			//°¢ Ä®·³ µ¥ÀÌÅÍ ÀúÀå						if (!Set_Proto_Item_Table(item_table, data, localMap))			{				fprintf(stderr, "¾ÆÀÌÅÛ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ.n");						}					} else {	//$$$$$$$$$$$$ Å×½ºÆ® ¾ÆÀÌÅÛ Á¤º¸°¡ ÀÖ´Ù!				TItemTable *tempTable = it_map_itemTable->second;			item_table->dwVnum = tempTable->dwVnum;			strlcpy(item_table->szName, tempTable->szName, sizeof(item_table->szName));			strlcpy(item_table->szLocaleName, tempTable->szLocaleName, sizeof(item_table->szLocaleName));			item_table->bType = tempTable->bType;			item_table->bSubType = tempTable->bSubType;			item_table->bSize = tempTable->bSize;			item_table->dwAntiFlags = tempTable->dwAntiFlags;			item_table->dwFlags = tempTable->dwFlags;			item_table->dwWearFlags = tempTable->dwWearFlags;			item_table->dwImmuneFlag = tempTable->dwImmuneFlag;			item_table->dwGold = tempTable->dwGold;			item_table->dwShopBuyPrice = tempTable->dwShopBuyPrice;			item_table->dwRefinedVnum =tempTable->dwRefinedVnum;			item_table->wRefineSet =tempTable->wRefineSet;			item_table->bAlterToMagicItemPct = tempTable->bAlterToMagicItemPct;			item_table->cLimitRealTimeFirstUseIndex = -1;			item_table->cLimitTimerBasedOnWearIndex = -1;			int i;			for (i = 0; i < ITEM_LIMIT_MAX_NUM; ++i)			{				item_table->aLimits[i].bType = tempTable->aLimits[i].bType;				item_table->aLimits[i].lValue = tempTable->aLimits[i].lValue;				if (LIMIT_REAL_TIME_START_FIRST_USE == item_table->aLimits[i].bType)					item_table->cLimitRealTimeFirstUseIndex = (char)i;				if (LIMIT_TIMER_BASED_ON_WEAR == item_table->aLimits[i].bType)					item_table->cLimitTimerBasedOnWearIndex = (char)i;			}			for (i = 0; i < ITEM_APPLY_MAX_NUM; ++i)			{				item_table->aApplies[i].bType = tempTable->aApplies[i].bType;				item_table->aApplies[i].lValue = tempTable->aApplies[i].lValue;			}			for (i = 0; i < ITEM_VALUES_MAX_NUM; ++i)				item_table->alValues[i] = tempTable->alValues[i];			item_table->bGainSocketPct = tempTable->bGainSocketPct;			item_table->sAddonType = tempTable->sAddonType;			item_table->bWeight = tempTable->bWeight;		}		vnumSet.insert(item_table->dwVnum);		m_map_itemTableByVnum.insert(std::map<DWORD, TItemTable *>::value_type(item_table->dwVnum, item_table));		++item_table;	}	//_______________________________________________________________________//	//========================================================================//	//	4) (b)[test_map_itemTableByVnum]ÀÇ rowÁß, (!)[item_table]¿¡ ¾ø´Â °ÍÀ» Ãß°¡ÇÑ´Ù.	//========================================================================//	test_data.Destroy();	if(!test_data.Load("item_proto_test.txt",'t'))	{		fprintf(stderr, "item_proto_test.txt was loaded successfully.n");		//return false;	} else {		test_data.Next();	//¼³¸í ·Î¿ì ³Ñ¾î°¡±â.		while (test_data.Next())	//Å×½ºÆ® µ¥ÀÌÅÍ °¢°¢À» ÈȾ°¡¸ç,»õ·Î¿î °ÍÀ» Ãß°¡ÇÑ´Ù.		{			//Áߺ¹µÇ´Â ºÎºÐÀÌ¸é ³Ñ¾î°£´Ù.			set<int>::iterator itVnum;			itVnum=vnumSet.find(atoi(test_data.AsStringByIndex(0)));			if (itVnum != vnumSet.end()) {				continue;			}						if (!Set_Proto_Item_Table(item_table, test_data, localMap))			{				fprintf(stderr, "¾ÆÀÌÅÛ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ.n");						}			m_map_itemTableByVnum.insert(std::map<DWORD, TItemTable *>::value_type(item_table->dwVnum, item_table));			item_table++;		}	}	// QUEST_ITEM_PROTO_DISABLE	// InitializeQuestItemTable();	// END_OF_QUEST_ITEM_PROTO_DISABLE	m_map_itemTableByVnum.clear();	itertype(m_vec_itemTable) it = m_vec_itemTable.begin();	while (it != m_vec_itemTable.end())	{		TItemTable * item_table = &(*(it++));		sys_log(1, "ITEM: #%-5lu %-24s %-24s VAL: %ld %ld %ld %ld %ld %ld WEAR %lu ANTI %lu IMMUNE %lu REFINE %lu REFINE_SET %u MAGIC_PCT %u",				item_table->dwVnum,				item_table->szName,				item_table->szLocaleName,				item_table->alValues[0],				item_table->alValues[1],				item_table->alValues[2],				item_table->alValues[3],				item_table->alValues[4],				item_table->alValues[5],				item_table->dwWearFlags,				item_table->dwAntiFlags,				item_table->dwImmuneFlag,				item_table->dwRefinedVnum,				item_table->wRefineSet,				item_table->bAlterToMagicItemPct);		m_map_itemTableByVnum.insert(std::map<DWORD, TItemTable *>::value_type(item_table->dwVnum, item_table));	}	sort(m_vec_itemTable.begin(), m_vec_itemTable.end(), FCompareVnum());	return true;}
bool CClientManager::InitializeItemTable() {std::ostringstream query;query << "SELECT vnum, type, subtype, name, " << g_stLocaleNameColumn << ", gold, shop_buy_price, weight, size, flag, wearflag, antiflag, immuneflag+0, refined_vnum, refine_set, magic_pct, socket_pct, addon_type, limittype0, limitvalue0, limittype1, limitvalue1, applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2, value0, value1, value2, value3, value4, value5, socket0, socket1, socket2 FROM item_proto ORDER BY vnum";SQLMsg* sqlMsg = CDBManager::instance().DirectQuery(query.str().c_str(), 0);if (sqlMsg == nullptr) {sys_err("libdb::InitializeItemTable", __LINE__, "Could not load item_proto. Query failed!");return false;}MYSQL_RES* pRes = sqlMsg->vec_pkResult[0]->pSQLResult;if (pRes == nullptr) {sys_err("libdb::InitializeItemTable", __LINE__, "Could not load item_proto. No result!");return 0;}if (!m_vec_itemTable.empty()) {sys_log(__LINE__, " Reloading item_proto");m_vec_itemTable.clear();}MYSQL_ROW row;while ((row = mysql_fetch_row(pRes))) {SItemTable temp = {};if (row[0]&&*row[0]) temp.dwVnum = strtoul(row[0], NULL, 10);if (row[1]&&*row[1]) temp.bType = strtoul(row[1], NULL, 10);if (row[2]&&*row[2]) temp.bSubType = strtoul(row[2], NULL, 10);if (row[3]&&*row[3]) snprintf(temp.szName, 25, "%s", row[3]);if (row[4]&&*row[4]) snprintf(temp.szLocaleName, 25, "%s", row[4]);if (row[5]&&*row[5]) temp.dwGold = strtoul(row[5], NULL, 10);if (row[6]&&*row[6]) temp.dwShopBuyPrice = strtoul(row[6], NULL, 10);if (row[7]&&*row[7]) temp.bWeight = strtoul(row[7], NULL, 10);if (row[8]&&*row[8]) temp.bSize = strtoul(row[8], NULL, 10);if (row[9]&&*row[9]) temp.dwFlags = strtoul(row[9], NULL, 10);if (row[10]&&*row[10]) temp.dwWearFlags = strtoul(row[10], NULL, 10);if (row[11]&&*row[11]) temp.dwAntiFlags = strtoul(row[11], NULL, 10);if (row[12]&&*row[12]) temp.dwImmuneFlag = strtoul(row[12], NULL, 10);if (row[13]&&*row[13]) temp.dwRefinedVnum = strtoul(row[13], NULL, 10);if (row[14]&&*row[14]) temp.wRefineSet = strtoul(row[14], NULL, 10);if (row[15]&&*row[15]) temp.bAlterToMagicItemPct = strtoul(row[15], NULL, 10);if (row[16]&&*row[16]) temp.bGainSocketPct = strtoul(row[16], NULL, 10);if (row[17]&&*row[17]) temp.sAddonType = strtoul(row[17], NULL, 10);if (row[18]&&*row[18]) temp.aLimits[0].bType = strtoul(row[18], NULL, 10);if (row[19]&&*row[19]) temp.aLimits[0].lValue = strtoul(row[19], NULL, 10);if (row[20]&&*row[20]) temp.aLimits[1].bType = strtoul(row[20], NULL, 10);if (row[21]&&*row[21]) temp.aLimits[1].lValue = strtoul(row[21], NULL, 10);if (row[22]&&*row[22]) temp.aApplies[0].bType = strtoul(row[22], NULL, 10);if (row[23]&&*row[23]) temp.aApplies[0].lValue = strtoul(row[23], NULL, 10);if (row[24]&&*row[24]) temp.aApplies[1].bType = strtoul(row[24], NULL, 10);if (row[25]&&*row[25]) temp.aApplies[1].lValue = strtoul(row[25], NULL, 10);if (row[26]&&*row[26]) temp.aApplies[2].bType = strtoul(row[26], NULL, 10);if (row[27]&&*row[27]) temp.aApplies[2].lValue = strtoul(row[27], NULL, 10);if (row[28]&&*row[28]) temp.alValues[0] = strtoul(row[28], NULL, 10);if (row[29]&&*row[29]) temp.alValues[1] = strtoul(row[29], NULL, 10);if (row[30]&&*row[30]) temp.alValues[2] = strtoul(row[30], NULL, 10);if (row[31]&&*row[31]) temp.alValues[3] = strtoul(row[31], NULL, 10);if (row[32]&&*row[32]) temp.alValues[4] = strtoul(row[32], NULL, 10);if (row[33]&&*row[33]) temp.alValues[5] = strtoul(row[33], NULL, 10);temp.cLimitRealTimeFirstUseIndex = -1;temp.cLimitTimerBasedOnWearIndex = -1;for (int i = 0; i < ITEM_LIMIT_MAX_NUM; ++i) {if (LIMIT_REAL_TIME_START_FIRST_USE == temp.aLimits[i].bType)temp.cLimitRealTimeFirstUseIndex = (char) i;if (LIMIT_TIMER_BASED_ON_WEAR == temp.aLimits[i].bType)temp.cLimitTimerBasedOnWearIndex = (char) i;}m_vec_itemTable.push_back(temp);}std::cout << "CClientManager::InitializeItemTable:: " << m_vec_itemTable.size() << " items loaded." << std::endl;mysql_free_result(pRes);m_map_itemTableByVnum.clear();auto it = m_vec_itemTable.begin();while (it != m_vec_itemTable.end()) {TItemTable * item_table = &(*(it++));sys_log(1, "ITEM: #%-5lu %-24s %-24s VAL: %ld %ld %ld %ld %ld %ld WEAR %lu ANTI %lu IMMUNE %lu REFINE %lu REFINE_SET %u MAGIC_PCT %u",item_table->dwVnum,item_table->szName,item_table->szLocaleName,item_table->alValues[0],item_table->alValues[1],item_table->alValues[2],item_table->alValues[3],item_table->alValues[4],item_table->alValues[5],item_table->dwWearFlags,item_table->dwAntiFlags,item_table->dwImmuneFlag,item_table->dwRefinedVnum,item_table->wRefineSet,item_table->bAlterToMagicItemPct);m_map_itemTableByVnum.insert(std::map<DWORD, TItemTable *>::value_type(item_table->dwVnum, item_table));}sort(m_vec_itemTable.begin(), m_vec_itemTable.end(), FCompareVnum());return true;}

Share this post


Link to post
Share on other sites
  • 0

Obrigado pelas respostas de todos, já consegui colocar o game a funcionar, o problema agora é que isto trouxe um ficheiro chamado: dbcache, não sei onde o colocar no /var/db, se não o colocar na maquina da-me o seguinte erro:

  • [*]
sem_wait: invalid argument

E isto aparece aos kilos na minha maquina, o que será?

Será de não ter colocado o DBCache?

Alguem sabe onde o meter?

Share this post


Link to post
Share on other sites
  • 0

Acho que tens de o substituir pelo teu db core

Share this post


Link to post
Share on other sites
  • 0

dbcache é a db...

Share this post


Link to post
Share on other sites
  • 0

dbcache é a db...

 

Eu sei, mas onde está a DB? Não encontrei nada, visto que o game se chama: fk_y o db também deve ter outro nome estranho, sabes me dizer o diretório?

Share this post


Link to post
Share on other sites
  • 0

Eu sei, mas onde está a DB? Não encontrei nada, visto que o game se chama: fk_y o db também deve ter outro nome estranho, sabes me dizer o diretório?

Nós não advinhamos isso, deverás ter um symlink na pasta que usas para a DB que vai dar à db, se não estiver mesmo lá.

Share this post


Link to post
Share on other sites
  • 0

o TXT_STARTUP esta desativado por default, logo mal o implementes já n precisas de meter isso, podes e meter isso mas com 1 para ativar isso

Share this post


Link to post
Share on other sites
  • 0

 

Está aqui, isso foi das primeiras coisas que fiz com o game: 

 

Isso é substituir 2 funções apenas, o que elas fazem é dar o mirrow dos TXT para a DB. E trabalham com a DB a partir daí

bool CClientManager::InitializeItemTable(){	//================== ÇÔ¼ö ¼³¸í ==================//	//1. ¿ä¾à : 'item_proto.txt', 'item_proto_test.txt', 'item_names.txt' ÆÄÀÏÀ» Àаí,	//		<item_table>(TItemTable), <m_map_itemTableByVnum> ¿ÀºêÁ§Æ®¸¦ »ý¼ºÇÑ´Ù.	//2. ¼ø¼­	//	1) 'item_names.txt' ÆÄÀÏÀ» Àо (a)[localMap](vnum:name) ¸ÊÀ» ¸¸µç´Ù.	//	2) 'item_proto_text.txt'ÆÄÀÏ°ú (a)[localMap] ¸ÊÀ¸·Î	//		(b)[test_map_itemTableByVnum](vnum:TItemTable) ¸ÊÀ» »ý¼ºÇÑ´Ù.	//	3) 'item_proto.txt' ÆÄÀÏ°ú (a)[localMap] ¸ÊÀ¸·Î	//		(!)[item_table], <m_map_itemTableByVnum>À» ¸¸µç´Ù.	//			<Âü°í>	//			°¢ row µé Áß,	//			(b)[test_map_itemTableByVnum],(!)[mob_table] ¸ðµÎ¿¡ ÀÖ´Â row´Â	//			(b)[test_map_itemTableByVnum]ÀÇ °ÍÀ» »ç¿ëÇÑ´Ù.	//	4) (b)[test_map_itemTableByVnum]ÀÇ rowÁß, (!)[item_table]¿¡ ¾ø´Â °ÍÀ» Ãß°¡ÇÑ´Ù.	//3. Å×½ºÆ®	//	1)'item_proto.txt' Á¤º¸°¡ item_table¿¡ Àß µé¾î°¬´ÂÁö. -> ¿Ï·á	//	2)'item_names.txt' Á¤º¸°¡ item_table¿¡ Àß µé¾î°¬´ÂÁö.	//	3)'item_proto_test.txt' ¿¡¼­ [°ãÄ¡´Â] Á¤º¸°¡ item_table ¿¡ Àß µé¾î°¬´ÂÁö.	//	4)'item_proto_test.txt' ¿¡¼­ [»õ·Î¿î] Á¤º¸°¡ item_table ¿¡ Àß µé¾î°¬´ÂÁö.	//	5) (ÃÖÁ¾) °ÔÀÓ Å¬¶óÀ̾ðÆ®¿¡¼­ Á¦´ë·Î ÀÛµ¿ ÇÏ´ÂÁö.	//_______________________________________________//	//=================================================================================//	//	1) 'item_names.txt' ÆÄÀÏÀ» Àо (a)[localMap](vnum:name) ¸ÊÀ» ¸¸µç´Ù.	//=================================================================================//	bool isNameFile = true;	map<int,const char*> localMap;	cCsvTable nameData;	if(!nameData.Load("item_names.txt",'t'))	{		fprintf(stderr, "item_names.txt was loaded successfully.n");		isNameFile = false;	} else {		nameData.Next();		while(nameData.Next()) {			localMap[atoi(nameData.AsStringByIndex(0))] = nameData.AsStringByIndex(1);		}	}	//_________________________________________________________________//	//=================================================================//	//	2) 'item_proto_text.txt'ÆÄÀÏ°ú (a)[localMap] ¸ÊÀ¸·Î	//		(b)[test_map_itemTableByVnum](vnum:TItemTable) ¸ÊÀ» »ý¼ºÇÑ´Ù.	//=================================================================//	map<DWORD, TItemTable *> test_map_itemTableByVnum;	//1. ÆÄÀÏ Àоî¿À±â.	cCsvTable test_data;	if(!test_data.Load("item_proto_test.txt",'t'))	{		fprintf(stderr, "item_proto_test.txt was loaded successfully.n");		//return false;	} else {		test_data.Next();	//¼³¸í ·Î¿ì ³Ñ¾î°¡±â.		//2. Å×½ºÆ® ¾ÆÀÌÅÛ Å×ÀÌºí »ý¼º.		TItemTable * test_item_table = NULL;		int test_itemTableSize = test_data.m_File.GetRowCount()-1;		test_item_table = new TItemTable[test_itemTableSize];		memset(test_item_table, 0, sizeof(TItemTable) * test_itemTableSize);		//3. Å×½ºÆ® ¾ÆÀÌÅÛ Å×ÀÌºí¿¡ °ªÀ» ³Ö°í, ¸Ê¿¡±îÁö ³Ö±â.		while(test_data.Next()) {			if (!Set_Proto_Item_Table(test_item_table, test_data, localMap))			{				fprintf(stderr, "¾ÆÀÌÅÛ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ.n");						}			test_map_itemTableByVnum.insert(std::map<DWORD, TItemTable *>::value_type(test_item_table->dwVnum, test_item_table));			test_item_table++;		}	}	//______________________________________________________________________//	//========================================================================//	//	3) 'item_proto.txt' ÆÄÀÏ°ú (a)[localMap] ¸ÊÀ¸·Î	//		(!)[item_table], <m_map_itemTableByVnum>À» ¸¸µç´Ù.	//			<Âü°í>	//			°¢ row µé Áß,	//			(b)[test_map_itemTableByVnum],(!)[mob_table] ¸ðµÎ¿¡ ÀÖ´Â row´Â	//			(b)[test_map_itemTableByVnum]ÀÇ °ÍÀ» »ç¿ëÇÑ´Ù.	//========================================================================//	//vnumµéÀ» ÀúÀåÇÒ ¼Â. »õ·Î¿î Å×½ºÆ® ¾ÆÀÌÅÛÀ» ÆǺ°ÇÒ¶§ »ç¿ëµÈ´Ù.	set<int> vnumSet;	//ÆÄÀÏ Àоî¿À±â.	cCsvTable data;	if(!data.Load("item_proto.txt",'t'))	{		fprintf(stderr, "item_proto.txt was loaded successfully.n");		return false;	}	data.Next(); //¸Ç À­ÁÙ Á¦¿Ü (¾ÆÀÌÅÛ Ä®·³À» ¼³¸íÇÏ´Â ºÎºÐ)	if (!m_vec_itemTable.empty())	{		sys_log(0, "RELOAD: item_proto");		m_vec_itemTable.clear();		m_map_itemTableByVnum.clear();	}	//===== ¾ÆÀÌÅÛ Å×ÀÌºí »ý¼º =====//	//»õ·Î Ãß°¡µÇ´Â °¹¼ö¸¦ ÆľÇÇÑ´Ù.	int addNumber = 0;	while(data.Next()) {		int vnum = atoi(data.AsStringByIndex(0));		std::map<DWORD, TItemTable *>::iterator it_map_itemTable;		it_map_itemTable = test_map_itemTableByVnum.find(vnum);		if(it_map_itemTable != test_map_itemTableByVnum.end()) {			addNumber++;		}	}	//data¸¦ ´Ù½Ã ùÁÙ·Î ¿Å±ä´Ù.(´Ù½Ã Àоî¿Â´Ù;;)	data.Destroy();	if(!data.Load("item_proto.txt",'t'))	{		fprintf(stderr, "item_proto.txt was loaded successfully.n");		return false;	}	data.Next(); //¸Ç À­ÁÙ Á¦¿Ü (¾ÆÀÌÅÛ Ä®·³À» ¼³¸íÇÏ´Â ºÎºÐ)	m_vec_itemTable.resize(data.m_File.GetRowCount() - 1 + addNumber);	memset(&m_vec_itemTable[0], 0, sizeof(TItemTable) * m_vec_itemTable.size());	int testValue = m_vec_itemTable.size();	TItemTable * item_table = &m_vec_itemTable[0];	while (data.Next())	{		int col = 0;		std::map<DWORD, TItemTable *>::iterator it_map_itemTable;		it_map_itemTable = test_map_itemTableByVnum.find(atoi(data.AsStringByIndex(col)));		if(it_map_itemTable == test_map_itemTableByVnum.end()) {			//°¢ Ä®·³ µ¥ÀÌÅÍ ÀúÀå						if (!Set_Proto_Item_Table(item_table, data, localMap))			{				fprintf(stderr, "¾ÆÀÌÅÛ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ.n");						}					} else {	//$$$$$$$$$$$$ Å×½ºÆ® ¾ÆÀÌÅÛ Á¤º¸°¡ ÀÖ´Ù!				TItemTable *tempTable = it_map_itemTable->second;			item_table->dwVnum = tempTable->dwVnum;			strlcpy(item_table->szName, tempTable->szName, sizeof(item_table->szName));			strlcpy(item_table->szLocaleName, tempTable->szLocaleName, sizeof(item_table->szLocaleName));			item_table->bType = tempTable->bType;			item_table->bSubType = tempTable->bSubType;			item_table->bSize = tempTable->bSize;			item_table->dwAntiFlags = tempTable->dwAntiFlags;			item_table->dwFlags = tempTable->dwFlags;			item_table->dwWearFlags = tempTable->dwWearFlags;			item_table->dwImmuneFlag = tempTable->dwImmuneFlag;			item_table->dwGold = tempTable->dwGold;			item_table->dwShopBuyPrice = tempTable->dwShopBuyPrice;			item_table->dwRefinedVnum =tempTable->dwRefinedVnum;			item_table->wRefineSet =tempTable->wRefineSet;			item_table->bAlterToMagicItemPct = tempTable->bAlterToMagicItemPct;			item_table->cLimitRealTimeFirstUseIndex = -1;			item_table->cLimitTimerBasedOnWearIndex = -1;			int i;			for (i = 0; i < ITEM_LIMIT_MAX_NUM; ++i)			{				item_table->aLimits[i].bType = tempTable->aLimits[i].bType;				item_table->aLimits[i].lValue = tempTable->aLimits[i].lValue;				if (LIMIT_REAL_TIME_START_FIRST_USE == item_table->aLimits[i].bType)					item_table->cLimitRealTimeFirstUseIndex = (char)i;				if (LIMIT_TIMER_BASED_ON_WEAR == item_table->aLimits[i].bType)					item_table->cLimitTimerBasedOnWearIndex = (char)i;			}			for (i = 0; i < ITEM_APPLY_MAX_NUM; ++i)			{				item_table->aApplies[i].bType = tempTable->aApplies[i].bType;				item_table->aApplies[i].lValue = tempTable->aApplies[i].lValue;			}			for (i = 0; i < ITEM_VALUES_MAX_NUM; ++i)				item_table->alValues[i] = tempTable->alValues[i];			item_table->bGainSocketPct = tempTable->bGainSocketPct;			item_table->sAddonType = tempTable->sAddonType;			item_table->bWeight = tempTable->bWeight;		}		vnumSet.insert(item_table->dwVnum);		m_map_itemTableByVnum.insert(std::map<DWORD, TItemTable *>::value_type(item_table->dwVnum, item_table));		++item_table;	}	//_______________________________________________________________________//	//========================================================================//	//	4) (b)[test_map_itemTableByVnum]ÀÇ rowÁß, (!)[item_table]¿¡ ¾ø´Â °ÍÀ» Ãß°¡ÇÑ´Ù.	//========================================================================//	test_data.Destroy();	if(!test_data.Load("item_proto_test.txt",'t'))	{		fprintf(stderr, "item_proto_test.txt was loaded successfully.n");		//return false;	} else {		test_data.Next();	//¼³¸í ·Î¿ì ³Ñ¾î°¡±â.		while (test_data.Next())	//Å×½ºÆ® µ¥ÀÌÅÍ °¢°¢À» ÈȾ°¡¸ç,»õ·Î¿î °ÍÀ» Ãß°¡ÇÑ´Ù.		{			//Áߺ¹µÇ´Â ºÎºÐÀÌ¸é ³Ñ¾î°£´Ù.			set<int>::iterator itVnum;			itVnum=vnumSet.find(atoi(test_data.AsStringByIndex(0)));			if (itVnum != vnumSet.end()) {				continue;			}						if (!Set_Proto_Item_Table(item_table, test_data, localMap))			{				fprintf(stderr, "¾ÆÀÌÅÛ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ.n");						}			m_map_itemTableByVnum.insert(std::map<DWORD, TItemTable *>::value_type(item_table->dwVnum, item_table));			item_table++;		}	}	// QUEST_ITEM_PROTO_DISABLE	// InitializeQuestItemTable();	// END_OF_QUEST_ITEM_PROTO_DISABLE	m_map_itemTableByVnum.clear();	itertype(m_vec_itemTable) it = m_vec_itemTable.begin();	while (it != m_vec_itemTable.end())	{		TItemTable * item_table = &(*(it++));		sys_log(1, "ITEM: #%-5lu %-24s %-24s VAL: %ld %ld %ld %ld %ld %ld WEAR %lu ANTI %lu IMMUNE %lu REFINE %lu REFINE_SET %u MAGIC_PCT %u",				item_table->dwVnum,				item_table->szName,				item_table->szLocaleName,				item_table->alValues[0],				item_table->alValues[1],				item_table->alValues[2],				item_table->alValues[3],				item_table->alValues[4],				item_table->alValues[5],				item_table->dwWearFlags,				item_table->dwAntiFlags,				item_table->dwImmuneFlag,				item_table->dwRefinedVnum,				item_table->wRefineSet,				item_table->bAlterToMagicItemPct);		m_map_itemTableByVnum.insert(std::map<DWORD, TItemTable *>::value_type(item_table->dwVnum, item_table));	}	sort(m_vec_itemTable.begin(), m_vec_itemTable.end(), FCompareVnum());	return true;}
bool CClientManager::InitializeItemTable() {std::ostringstream query;query << "SELECT vnum, type, subtype, name, " << g_stLocaleNameColumn << ", gold, shop_buy_price, weight, size, flag, wearflag, antiflag, immuneflag+0, refined_vnum, refine_set, magic_pct, socket_pct, addon_type, limittype0, limitvalue0, limittype1, limitvalue1, applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2, value0, value1, value2, value3, value4, value5, socket0, socket1, socket2 FROM item_proto ORDER BY vnum";SQLMsg* sqlMsg = CDBManager::instance().DirectQuery(query.str().c_str(), 0);if (sqlMsg == nullptr) {sys_err("libdb::InitializeItemTable", __LINE__, "Could not load item_proto. Query failed!");return false;}MYSQL_RES* pRes = sqlMsg->vec_pkResult[0]->pSQLResult;if (pRes == nullptr) {sys_err("libdb::InitializeItemTable", __LINE__, "Could not load item_proto. No result!");return 0;}if (!m_vec_itemTable.empty()) {sys_log(__LINE__, " Reloading item_proto");m_vec_itemTable.clear();}MYSQL_ROW row;while ((row = mysql_fetch_row(pRes))) {SItemTable temp = {};if (row[0]&&*row[0]) temp.dwVnum = strtoul(row[0], NULL, 10);if (row[1]&&*row[1]) temp.bType = strtoul(row[1], NULL, 10);if (row[2]&&*row[2]) temp.bSubType = strtoul(row[2], NULL, 10);if (row[3]&&*row[3]) snprintf(temp.szName, 25, "%s", row[3]);if (row[4]&&*row[4]) snprintf(temp.szLocaleName, 25, "%s", row[4]);if (row[5]&&*row[5]) temp.dwGold = strtoul(row[5], NULL, 10);if (row[6]&&*row[6]) temp.dwShopBuyPrice = strtoul(row[6], NULL, 10);if (row[7]&&*row[7]) temp.bWeight = strtoul(row[7], NULL, 10);if (row[8]&&*row[8]) temp.bSize = strtoul(row[8], NULL, 10);if (row[9]&&*row[9]) temp.dwFlags = strtoul(row[9], NULL, 10);if (row[10]&&*row[10]) temp.dwWearFlags = strtoul(row[10], NULL, 10);if (row[11]&&*row[11]) temp.dwAntiFlags = strtoul(row[11], NULL, 10);if (row[12]&&*row[12]) temp.dwImmuneFlag = strtoul(row[12], NULL, 10);if (row[13]&&*row[13]) temp.dwRefinedVnum = strtoul(row[13], NULL, 10);if (row[14]&&*row[14]) temp.wRefineSet = strtoul(row[14], NULL, 10);if (row[15]&&*row[15]) temp.bAlterToMagicItemPct = strtoul(row[15], NULL, 10);if (row[16]&&*row[16]) temp.bGainSocketPct = strtoul(row[16], NULL, 10);if (row[17]&&*row[17]) temp.sAddonType = strtoul(row[17], NULL, 10);if (row[18]&&*row[18]) temp.aLimits[0].bType = strtoul(row[18], NULL, 10);if (row[19]&&*row[19]) temp.aLimits[0].lValue = strtoul(row[19], NULL, 10);if (row[20]&&*row[20]) temp.aLimits[1].bType = strtoul(row[20], NULL, 10);if (row[21]&&*row[21]) temp.aLimits[1].lValue = strtoul(row[21], NULL, 10);if (row[22]&&*row[22]) temp.aApplies[0].bType = strtoul(row[22], NULL, 10);if (row[23]&&*row[23]) temp.aApplies[0].lValue = strtoul(row[23], NULL, 10);if (row[24]&&*row[24]) temp.aApplies[1].bType = strtoul(row[24], NULL, 10);if (row[25]&&*row[25]) temp.aApplies[1].lValue = strtoul(row[25], NULL, 10);if (row[26]&&*row[26]) temp.aApplies[2].bType = strtoul(row[26], NULL, 10);if (row[27]&&*row[27]) temp.aApplies[2].lValue = strtoul(row[27], NULL, 10);if (row[28]&&*row[28]) temp.alValues[0] = strtoul(row[28], NULL, 10);if (row[29]&&*row[29]) temp.alValues[1] = strtoul(row[29], NULL, 10);if (row[30]&&*row[30]) temp.alValues[2] = strtoul(row[30], NULL, 10);if (row[31]&&*row[31]) temp.alValues[3] = strtoul(row[31], NULL, 10);if (row[32]&&*row[32]) temp.alValues[4] = strtoul(row[32], NULL, 10);if (row[33]&&*row[33]) temp.alValues[5] = strtoul(row[33], NULL, 10);temp.cLimitRealTimeFirstUseIndex = -1;temp.cLimitTimerBasedOnWearIndex = -1;for (int i = 0; i < ITEM_LIMIT_MAX_NUM; ++i) {if (LIMIT_REAL_TIME_START_FIRST_USE == temp.aLimits[i].bType)temp.cLimitRealTimeFirstUseIndex = (char) i;if (LIMIT_TIMER_BASED_ON_WEAR == temp.aLimits[i].bType)temp.cLimitTimerBasedOnWearIndex = (char) i;}m_vec_itemTable.push_back(temp);}std::cout << "CClientManager::InitializeItemTable:: " << m_vec_itemTable.size() << " items loaded." << std::endl;mysql_free_result(pRes);m_map_itemTableByVnum.clear();auto it = m_vec_itemTable.begin();while (it != m_vec_itemTable.end()) {TItemTable * item_table = &(*(it++));sys_log(1, "ITEM: #%-5lu %-24s %-24s VAL: %ld %ld %ld %ld %ld %ld WEAR %lu ANTI %lu IMMUNE %lu REFINE %lu REFINE_SET %u MAGIC_PCT %u",item_table->dwVnum,item_table->szName,item_table->szLocaleName,item_table->alValues[0],item_table->alValues[1],item_table->alValues[2],item_table->alValues[3],item_table->alValues[4],item_table->alValues[5],item_table->dwWearFlags,item_table->dwAntiFlags,item_table->dwImmuneFlag,item_table->dwRefinedVnum,item_table->wRefineSet,item_table->bAlterToMagicItemPct);m_map_itemTableByVnum.insert(std::map<DWORD, TItemTable *>::value_type(item_table->dwVnum, item_table));}sort(m_vec_itemTable.begin(), m_vec_itemTable.end(), FCompareVnum());return true;}

onde  instalo isto   estou precisando eliminar os  txt do meu servidor 

para traduzir as sql 

Share this post


Link to post
Share on other sites
  • 0

onde  instalo isto   estou precisando eliminar os  txt do meu servidor 

para traduzir as sql 

Tens de perceber de c++, isso aí é c++ e tens que editar na source

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this