Jump to content

How To Add Vnum Range DS


Recommended Posts

// Open service.h and add

#define ENABLE_VNUMRANGE
  
// 1. Open ClientManagerBoot.cpp and earch enum IProtoT and after , value5 add
  
 #ifdef ENABLE_VNUMRANGE
	, vnum_range
#endif
  
// 2. Search bool CClientManager::InitializeItemTableFromDB() and after , value5" add
  
#ifdef ENABLE_VNUMRANGE
		" , vnum_range"
#endif
  // or replace the function with 
  
  bool CClientManager::InitializeItemTableFromDB()
{
	char query[2048];
	fprintf(stdout, "Loading item_proto from MySQL\n");
	snprintf(query, sizeof(query),
		"SELECT vnum, type, subtype, name, %s, 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"
#ifdef ENABLE_VNUMRANGE
		" , vnum_range"
#endif
		" FROM item_proto%s ORDER BY vnum;",
		g_stLocaleNameColumn.c_str(),
		GetTablePostfix()
	);
    
// 3. Search VERIFY_IFIELD(IProto::addon_type,		item_table->sAddonType); and after add
    
#ifdef ENABLE_VNUMRANGE
		VERIFY_IFIELD(IProto::vnum_range,		item_table->dwVnumRange);
#endif
  
// 4. Open player.item_proto, select Design Table and add
  
  `vnum_range` tinyint(4) NOT NULL DEFAULT '0',

 

  • Love 3
Link to comment
Share on other sites

  • 1 month later...

this is not good.. is just copy/paste from martysama source, in a normal source this will not work..

this is corect structure for ItemTableFromDb:

bool CClientManager::InitializeItemTableSQL()
{
	char query[4096];
	snprintf(query, sizeof(query),
		"SELECT vnum, vnum_range, name, %s, type, subtype, 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 "
		"FROM item_proto ORDER BY vnum",
		g_stLocaleNameColumn.c_str());

	std::auto_ptr<SQLMsg> pkMsg(CDBManager::instance().DirectQuery(query));
	SQLResult * pRes = pkMsg->Get();

	if (!pRes->uiNumRows)
	{
		sys_err("Could not load item_proto. No results!");
		return false;
	}

	sys_log(0, "ITEM_PROTO loading...");

	if (!m_vec_itemTable.empty())
	{
		sys_log(0, "RELOAD: item_proto");
		m_vec_itemTable.clear();
		m_map_itemTableByVnum.clear();
	}

	m_vec_itemTable.resize(pRes->uiNumRows);
	memset(&m_vec_itemTable[0], 0, sizeof(TItemTable) * m_vec_itemTable.size());
	TItemTable * item_table = &m_vec_itemTable[0];

	MYSQL_ROW data;
	int col;

	while ((data = mysql_fetch_row(pRes->pSQLResult)))
	{
		col = 0;

		str_to_number(item_table->dwVnum, data[col++]);
		str_to_number(item_table->dwVnumRange, data[col++]);
		strlcpy(item_table->szName, data[col++], sizeof(item_table->szName));
		strlcpy(item_table->szLocaleName, data[col++], sizeof(item_table->szLocaleName));
		str_to_number(item_table->bType, data[col++]);
		str_to_number(item_table->bSubType, data[col++]);
		str_to_number(item_table->dwGold, data[col++]);
		str_to_number(item_table->dwShopBuyPrice, data[col++]);
		str_to_number(item_table->bWeight, data[col++]);
		str_to_number(item_table->bSize, data[col++]);
		str_to_number(item_table->dwFlags, data[col++]);
		str_to_number(item_table->dwWearFlags, data[col++]);
		str_to_number(item_table->dwAntiFlags, data[col++]);
		str_to_number(item_table->dwImmuneFlag, data[col++]);
		str_to_number(item_table->dwRefinedVnum, data[col++]);
		str_to_number(item_table->wRefineSet, data[col++]);
		str_to_number(item_table->bAlterToMagicItemPct, data[col++]);
		str_to_number(item_table->bGainSocketPct, data[col++]);
		str_to_number(item_table->sAddonType, data[col++]);

		item_table->cLimitRealTimeFirstUseIndex = -1;
		item_table->cLimitTimerBasedOnWearIndex = -1;

		int i;
		for (i = 0; i < ITEM_LIMIT_MAX_NUM; ++i)
		{
			str_to_number(item_table->aLimits[i].bType, data[col++]);
			str_to_number(item_table->aLimits[i].lValue, data[col++]);

			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)
		{
			str_to_number(item_table->aApplies[i].bType, data[col++]);
			str_to_number(item_table->aApplies[i].lValue, data[col++]);
		}

		for (i = 0; i < ITEM_VALUES_MAX_NUM; ++i)
			str_to_number(item_table->alValues[i], data[col++]);

		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));
		++item_table;
	}

	sort(m_vec_itemTable.begin(), m_vec_itemTable.end(), FCompareVnum());
	sys_log(0, "CClientManager::InitializeMobTable:: %d items loaded.n", m_vec_itemTable.size());
	return true;
}

 

  • Love 1
Link to comment
Share on other sites

  • 3 weeks later...
La 21.12.2017 la 15:12, Colossus a spus:

I don t say ” This code is mine ” so shut the fuck up 1, and 2

If we look in your activity , 90% of posts are in question and answer

Nice Elijah or other kids wich you puth them to comment

Wtf dude, i have only one topic here because i am not perfect as you.. i am not developer or something, for me metin2 is just a hobby, if you post something post corectly!

Sorry for my english!

L.E: i solved myself the problem with taskbar so stfu

Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.