xP3NG3Rx

[C++] DB + NoTXT!

55 posts in this topic

Hey devs!

 

One word: Works! ;)

Follow the steps:

1.) Open "db/src/Main.cpp" file and write this to the top of the file, under to the includes:

// NOTXT_STARTUP_BEGIN
BOOL g_noTXT = false;
// NOTXT_STARTUP_END

bM7uA.png

2.) Search for this: "int iDisableHotBackup;" and put under this:

	// NOTXT_STARTUP_BEGIN
	int iNoTXT;
	if (CConfig::instance().GetValue("NO_TXT", &iNoTXT))
	{
		if (iNoTXT)
		{
			sys_log(0, "CONFIG: NO_TXT");
			g_noTXT = true;
		}
	}
	// NOTXT_STARTUP_END

bM7BK.png

3.) Save&Close. Now open "db/src/ClientManager.h" and replace:

	bool		InitializeMobTable();
	bool		InitializeItemTable();
With:

		// NOTXT_STARTUP_BEGIN
		bool		InitializeMobTableTXT();
		bool		InitializeItemTableTXT();
		bool		InitializeMobTableSQL();
		bool		InitializeItemTableSQL();
		// NOTXT_STARTUP_END

bM7GT.png

4.) Save&Close. Then open "db/src/ClientManagerBoot.cpp" and put this the top of the file:

// NOTXT_STARTUP_BEGIN
extern int g_noTXT;
// NOTXT_STARTUP_END

bM7Jt.png

5.) Replace this:

bool CClientManager::InitializeMobTable()
With this:

bool CClientManager::InitializeMobTableTXT()
And repeat it with ItemProto(::InitializeItemTable)

bMbDB.png

 

bMbFn.png

6.) Search for this: "bool CClientManager::InitializeTables()" and replace this:

	if (!InitializeMobTable())
	{
		sys_err("InitializeMobTable FAILED");
		return false;
	}
	if (!MirrorMobTableIntoDB())
	{
		sys_err("MirrorMobTableIntoDB FAILED");
		return false; 
	}

	if (!InitializeItemTable())
	{
		sys_err("InitializeItemTable FAILED");
		return false; 
	}

	if (!MirrorItemTableIntoDB())
	{
		sys_err("MirrorItemTableIntoDB FAILED");
		return false; 
	}
With this:

	// NOTXT_STARTUP_BEGIN
	if (g_noTXT) // item and mob proto
	{
		if (!InitializeMobTableSQL())
		{
			sys_err("InitializeMobTableSQL FAILED");
			return false;
		}
		if (!InitializeItemTableSQL())
		{
			sys_err("InitializeItemTableSQL FAILED");
			return false;
		}
	}
	else
	{
		if (!InitializeMobTableTXT())
		{
			sys_err("InitializeMobTableTXT FAILED");
			return false;
		}

		if (!MirrorMobTableIntoDB())
		{
			sys_err("MirrorMobTableIntoDB FAILED");
			return false;
		}

		if (!InitializeItemTableTXT())
		{
			sys_err("InitializeItemTableTXT FAILED");
			return false;
		}

		if (!MirrorItemTableIntoDB())
		{
			sys_err("MirrorItemTableIntoDB FAILED");
			return false;
		}
	}
	// NOTXT_STARTUP_END
7.) And last put these functions into the file:

// NOTXT_STARTUP_BEGIN
bool CClientManager::InitializeMobTableSQL()
{
	char query[4096];
	snprintf(query, sizeof(query),
		"SELECT vnum, name, %s, type, rank, battle_type, level, "
		"size+0, ai_flag+0, setRaceFlag+0, setImmuneFlag+0, "
		"on_click, empire, drop_item, resurrection_vnum, folder, "
		"st, dx, ht, iq, damage_min, damage_max, max_hp, regen_cycle, regen_percent, exp, "
		"gold_min, gold_max, def, attack_speed, move_speed, "
		"aggressive_hp_pct, aggressive_sight, attack_range, polymorph_item, "
		"enchant_curse, enchant_slow, enchant_poison, enchant_stun, enchant_critical, enchant_penetrate, "
		"resist_sword, resist_twohand, resist_dagger, resist_bell, resist_fan, resist_bow, "
		"resist_fire, resist_elect, resist_magic, resist_wind, resist_poison, "
		"dam_multiply, summon, drain_sp, "
		"skill_vnum0, skill_level0, skill_vnum1, skill_level1, skill_vnum2, skill_level2,"
		"skill_vnum3, skill_level3, skill_vnum4, skill_level4 , sp_berserk, sp_stoneskin, "
		"sp_godspeed, sp_deathblow, sp_revive "
		"FROM mob_proto%s ORDER BY vnum",
		g_stLocaleNameColumn.c_str(), GetTablePostfix());

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

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

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

	if (!m_vec_mobTable.empty())
	{
		sys_log(0, "RELOAD: mob_proto");
		m_vec_mobTable.clear();
	}

	m_vec_mobTable.resize(pRes->uiNumRows);
	memset(&m_vec_mobTable[0], 0, sizeof(TMobTable) * m_vec_mobTable.size());
	TMobTable * mob_table = &m_vec_mobTable[0];

	MYSQL_ROW data;
	int col;
	while ((data = mysql_fetch_row(pRes->pSQLResult)))
	{
		col = 0;
		str_to_number(mob_table->dwVnum, data[col++]);
		strlcpy(mob_table->szName, data[col++], sizeof(mob_table->szName));
		strlcpy(mob_table->szLocaleName, data[col++], sizeof(mob_table->szLocaleName));
		str_to_number(mob_table->bType, data[col++]);
		str_to_number(mob_table->bRank, data[col++]);
		str_to_number(mob_table->bBattleType, data[col++]);
		str_to_number(mob_table->bLevel, data[col++]);
		str_to_number(mob_table->bSize, data[col++]);
		str_to_number(mob_table->dwAIFlag, data[col++]);
		str_to_number(mob_table->dwRaceFlag, data[col++]);
		str_to_number(mob_table->dwImmuneFlag, data[col++]);
		str_to_number(mob_table->bOnClickType, data[col++]);
		str_to_number(mob_table->bEmpire, data[col++]);
		str_to_number(mob_table->dwDropItemVnum, data[col++]);
		str_to_number(mob_table->dwResurrectionVnum, data[col++]);
		strlcpy(mob_table->szFolder, data[col++], sizeof(mob_table->szFolder));
		str_to_number(mob_table->bStr, data[col++]);
		str_to_number(mob_table->bDex, data[col++]);
		str_to_number(mob_table->bCon, data[col++]);
		str_to_number(mob_table->bInt, data[col++]);
		str_to_number(mob_table->dwDamageRange[0], data[col++]);
		str_to_number(mob_table->dwDamageRange[1], data[col++]);
		str_to_number(mob_table->dwMaxHP, data[col++]);
		str_to_number(mob_table->bRegenCycle, data[col++]);
		str_to_number(mob_table->bRegenPercent, data[col++]);
		str_to_number(mob_table->dwExp, data[col++]);
		str_to_number(mob_table->dwGoldMin, data[col++]);
		str_to_number(mob_table->dwGoldMax, data[col++]);
		str_to_number(mob_table->wDef, data[col++]);
		str_to_number(mob_table->sAttackSpeed, data[col++]);
		str_to_number(mob_table->sMovingSpeed, data[col++]);
		str_to_number(mob_table->bAggresiveHPPct, data[col++]);
		str_to_number(mob_table->wAggressiveSight, data[col++]);
		str_to_number(mob_table->wAttackRange, data[col++]);
		str_to_number(mob_table->dwPolymorphItemVnum, data[col++]);

		int i;
		for (i = 0; i < MOB_ENCHANTS_MAX_NUM; ++i)
			str_to_number(mob_table->cEnchants[i], data[col++]);

		for (i = 0; i < MOB_RESISTS_MAX_NUM; ++i)
			str_to_number(mob_table->cResists[i], data[col++]);

		str_to_number(mob_table->fDamMultiply, data[col++]);
		str_to_number(mob_table->dwSummonVnum, data[col++]);
		str_to_number(mob_table->dwDrainSP, data[col++]);

		for (i = 0; i < MOB_SKILL_MAX_NUM; ++i)
		{
			str_to_number(mob_table->Skills[i].dwVnum, data[col++]);
			str_to_number(mob_table->Skills[i].bLevel, data[col++]);
		}

		str_to_number(mob_table->bBerserkPoint, data[col++]);
		str_to_number(mob_table->bStoneSkinPoint, data[col++]);
		str_to_number(mob_table->bGodSpeedPoint, data[col++]);
		str_to_number(mob_table->bDeathBlowPoint, data[col++]);
		str_to_number(mob_table->bRevivePoint, data[col++]);

		sys_log(1, "MOB #%-5d %-24s %-24s level: %-3u rank: %u empire: %d", mob_table->dwVnum, mob_table->szName, mob_table->szLocaleName, mob_table->bLevel, mob_table->bRank, mob_table->bEmpire);
		++mob_table;
	}

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

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%s ORDER BY vnum",
		g_stLocaleNameColumn.c_str(), GetTablePostfix());

	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;
}
// NOTXT_STARTUP_END

7+1.) New item_proto_table.sql:

DROP TABLE IF EXISTS `item_proto`;
CREATE TABLE `item_proto` (
  `vnum` int(11) unsigned NOT NULL DEFAULT '0',
  `vnum_range` int(11) unsigned NOT NULL DEFAULT '0',
  `name` varbinary(200) NOT NULL DEFAULT 'Noname                  ',
  `locale_name` varbinary(24) NOT NULL DEFAULT 'Noname                  ',
  `type` tinyint(2) NOT NULL DEFAULT '0',
  `subtype` tinyint(2) NOT NULL DEFAULT '0',
  `weight` tinyint(3) DEFAULT '0',
  `size` tinyint(3) DEFAULT '0',
  `antiflag` int(11) DEFAULT '0',
  `flag` int(11) DEFAULT '0',
  `wearflag` int(11) DEFAULT '0',
  `immuneflag` set('PARA','CURSE','STUN','SLEEP','SLOW','POISON','TERROR') CHARACTER SET big5 NOT NULL DEFAULT '',
  `gold` int(11) DEFAULT '0',
  `shop_buy_price` int(10) unsigned NOT NULL DEFAULT '0',
  `refined_vnum` int(10) unsigned NOT NULL DEFAULT '0',
  `refine_set` smallint(11) unsigned NOT NULL DEFAULT '0',
  `refine_set2` smallint(5) unsigned NOT NULL DEFAULT '0',
  `magic_pct` tinyint(4) NOT NULL DEFAULT '0',
  `limittype0` tinyint(4) DEFAULT '0',
  `limitvalue0` int(11) DEFAULT '0',
  `limittype1` tinyint(4) DEFAULT '0',
  `limitvalue1` int(11) DEFAULT '0',
  `applytype0` tinyint(4) DEFAULT '0',
  `applyvalue0` int(11) DEFAULT '0',
  `applytype1` tinyint(4) DEFAULT '0',
  `applyvalue1` int(11) DEFAULT '0',
  `applytype2` tinyint(4) DEFAULT '0',
  `applyvalue2` int(11) DEFAULT '0',
  `value0` int(11) DEFAULT '0',
  `value1` int(11) DEFAULT '0',
  `value2` int(11) DEFAULT '0',
  `value3` int(11) DEFAULT '0',
  `value4` int(11) DEFAULT '0',
  `value5` int(11) DEFAULT '0',
  `socket0` tinyint(4) DEFAULT '-1',
  `socket1` tinyint(4) DEFAULT '-1',
  `socket2` tinyint(4) DEFAULT '-1',
  `socket3` tinyint(4) DEFAULT '-1',
  `socket4` tinyint(4) DEFAULT '-1',
  `socket5` tinyint(4) DEFAULT '-1',
  `specular` tinyint(4) NOT NULL DEFAULT '0',
  `socket_pct` tinyint(4) NOT NULL DEFAULT '0',
  `addon_type` smallint(6) NOT NULL DEFAULT '0',
  PRIMARY KEY (`vnum`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
But you can modify your item_proto with "Design table" option in navicat, just make the vnum_range column to the second column after the vnum, as you can see in the query.

conf.txt:

NO_TXT                     = 1
0: TXT

1: SQL


Special thanks to:

- iMer, Zonni for the snippets ^^

Changelog:

 - "0"


 

If you find any errors or problems just post a message into this thread.

I tested on win.

I hope you like it. :lol:

With regards,

P3NG3R.

  • Like 23

Share this post


Link to post
Share on other sites

`magic_pct` tinyint(4) NOT NULL DEFAULT '0',

`limittype0` tinyint(4) DEFAULT '0',

`limitvalue0` int(11) DEFAULT '0',

Be aware of the signedness of the fields (not only those three I pointed out) and whether they could be NULL or not. (actually, there are few cases in which you could get bugs)
  • Like 2

Share this post


Link to post
Share on other sites

@martysama0134: I never leave anything blank(NULL), if it has allowed to be NULL or not.

Signed/Unsigned? There are the str_to_number functions to do the correct converting.

 

@Zika: In the txt protos the vnum_range is looks like this:

160400~160499	ĂÖ°í±Ţ ŔĎąÝ Čć·ćĽ®	ITEM_DS	DS_SLOT6	1	NONE	NONE	NONE	NONE	0	0	0	0	0	TIMER_BASED_ON_WEAR	86400	LIMIT_NONE	0	APPLY_NONE	0	APPLY_NONE	0	APPLY_NONE	0	0	0	0	0	0	0	0	0	0

The vnum is 160400 and the vnum_range is 99. Check in the source if you doesn't understand.(db/src/ProtoReader.cpp)

 

Bad format(!):

160400~99	ĂÖ°í±Ţ ŔĎąÝ Čć·ćĽ®	ITEM_DS	DS_SLOT6	1	NONE	NONE	NONE	NONE	0	0	0	0	0	TIMER_BASED_ON_WEAR	86400	LIMIT_NONE	0	APPLY_NONE	0	APPLY_NONE	0	APPLY_NONE	0	0	0	0	0	0	0	0	0	0

In this case the vnum_range will be "-160301"

 

Share this post


Link to post
Share on other sites

@martysama0134: I never leave anything blank(NULL), if it has allowed to be NULL or not.

Signed/Unsigned? There are the str_to_number functions to do the correct converting.

I'm not referring to str_to_number, which is overloaded.

I quoted the table structure not the remaining of the code/thread:

`magic_pct` tinyint(4) NOT NULL DEFAULT '0',

`limittype0` tinyint(4) DEFAULT '0',

`limitvalue0` int(11) DEFAULT '0',

What we have here? Fields set as signed (even though the real type should be unsigned; you'll get the real unsigned/signed issue from a different field btw)

Example:

typedef struct SItemLimit
{
	BYTE	bType;
	long	lValue;
} TItemLimit;
You also didn't set the fields as NOT NULL, so you could fetch NULL fields and get a runtime crash.

Example:

            str_to_number(item_table->aLimits[i].bType, data[col++]);
*NULL = crash

Would not it be better to remove vnum_range because my current one does not have it?

Remove it by yourself if that is the problem. It's a line of code.

Share this post


Link to post
Share on other sites

Hello, I compiled the source on windows, when I run the DB everything is ok, but when I start the game-server i get this error:

Game-Server syserr

"CInputDB::Boot: ITEM ID RANGE size error"

Screenshots:

EROARE1.png

 

EROARE2.png

 

Does someone have any idea ??

 

P.S.:

conf.txt : ITEM_ID_RANGE = 2000000000 2100000000

 

Thank you in advance .

 

 

Share this post


Link to post
Share on other sites

 

That is the Error:

5d0ac215af.png

747a653aa0.png

 

same error

 

 

Found a fix for that:

 

Put the class "FCompareVnum" above the Function "InitializeMobTableSQL()":

 

b4093637a0.png

Share this post


Link to post
Share on other sites

NO_TXT                     = 1

a233h.png

 

Could some one help me please?

I'm tired of these txt's.  :angry:

  • Like 2

Share this post


Link to post
Share on other sites

NO_TXT                     = 1

a233h.png

 

Could some one help me please?

I'm tired of these txt's.  :angry:

 

Ok, so the problem now is different.

I don't get connection refused, but I can't log in the client.

 

I've one more question, my syserrs are crazy...

They're out of date, how can I solve that?

 

Can't someone share with us a clean db source folder with this problem fix?

Please?

  • Like 1

Share this post


Link to post
Share on other sites

// NOTXT_STARTUP_BEGIN
bool CClientManager::InitializeMobTableSQL()
{
	char query[4096];
	snprintf(query, sizeof(query),
		"SELECT vnum, name, %s, type, rank, battle_type, level, "
		"size+0, ai_flag+0, setRaceFlag+0, setImmuneFlag+0, "
		"on_click, empire, drop_item, resurrection_vnum, folder, "
		"st, dx, ht, iq, damage_min, damage_max, max_hp, regen_cycle, regen_percent, exp, "
		"gold_min, gold_max, def, attack_speed, move_speed, "
		"aggressive_hp_pct, aggressive_sight, attack_range, polymorph_item, "
		"enchant_curse, enchant_slow, enchant_poison, enchant_stun, enchant_critical, enchant_penetrate, "
		"resist_sword, resist_twohand, resist_dagger, resist_bell, resist_fan, resist_bow, "
		"resist_fire, resist_elect, resist_magic, resist_wind, resist_poison, "
		"dam_multiply, summon, drain_sp, "
		"skill_vnum0, skill_level0, skill_vnum1, skill_level1, skill_vnum2, skill_level2,"
		"skill_vnum3, skill_level3, skill_vnum4, skill_level4 , sp_berserk, sp_stoneskin, "
		"sp_godspeed, sp_deathblow, sp_revive "
		"FROM mob_proto%s ORDER BY vnum",
		g_stLocaleNameColumn.c_str(), GetTablePostfix());

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

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

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

	if (!m_vec_mobTable.empty())
	{
		sys_log(0, "RELOAD: mob_proto");
		m_vec_mobTable.clear();
	}

	m_vec_mobTable.resize(pRes->uiNumRows);
	memset(&m_vec_mobTable[0], 0, sizeof(TMobTable) * m_vec_mobTable.size());
	TMobTable * mob_table = &m_vec_mobTable[0];

	MYSQL_ROW data;
	int col;
	while ((data = mysql_fetch_row(pRes->pSQLResult)))
	{
		col = 0;
		str_to_number(mob_table->dwVnum, data[col++]);
		strlcpy(mob_table->szName, data[col++], sizeof(mob_table->szName));
		strlcpy(mob_table->szLocaleName, data[col++], sizeof(mob_table->szLocaleName));
		str_to_number(mob_table->bType, data[col++]);
		str_to_number(mob_table->bRank, data[col++]);
		str_to_number(mob_table->bBattleType, data[col++]);
		str_to_number(mob_table->bLevel, data[col++]);
		str_to_number(mob_table->bSize, data[col++]);
		str_to_number(mob_table->dwAIFlag, data[col++]);
		str_to_number(mob_table->dwRaceFlag, data[col++]);
		str_to_number(mob_table->dwImmuneFlag, data[col++]);
		str_to_number(mob_table->bOnClickType, data[col++]);
		str_to_number(mob_table->bEmpire, data[col++]);
		str_to_number(mob_table->dwDropItemVnum, data[col++]);
		str_to_number(mob_table->dwResurrectionVnum, data[col++]);
		strlcpy(mob_table->szFolder, data[col++], sizeof(mob_table->szFolder));
		str_to_number(mob_table->bStr, data[col++]);
		str_to_number(mob_table->bDex, data[col++]);
		str_to_number(mob_table->bCon, data[col++]);
		str_to_number(mob_table->bInt, data[col++]);
		str_to_number(mob_table->dwDamageRange[0], data[col++]);
		str_to_number(mob_table->dwDamageRange[1], data[col++]);
		str_to_number(mob_table->dwMaxHP, data[col++]);
		str_to_number(mob_table->bRegenCycle, data[col++]);
		str_to_number(mob_table->bRegenPercent, data[col++]);
		str_to_number(mob_table->dwExp, data[col++]);
		str_to_number(mob_table->dwGoldMin, data[col++]);
		str_to_number(mob_table->dwGoldMax, data[col++]);
		str_to_number(mob_table->wDef, data[col++]);
		str_to_number(mob_table->sAttackSpeed, data[col++]);
		str_to_number(mob_table->sMovingSpeed, data[col++]);
		str_to_number(mob_table->bAggresiveHPPct, data[col++]);
		str_to_number(mob_table->wAggressiveSight, data[col++]);
		str_to_number(mob_table->wAttackRange, data[col++]);
		str_to_number(mob_table->dwPolymorphItemVnum, data[col++]);

		int i;
		for (i = 0; i < MOB_ENCHANTS_MAX_NUM; ++i)
			str_to_number(mob_table->cEnchants[i], data[col++]);

		for (i = 0; i < MOB_RESISTS_MAX_NUM; ++i)
			str_to_number(mob_table->cResists[i], data[col++]);

		str_to_number(mob_table->fDamMultiply, data[col++]);
		str_to_number(mob_table->dwSummonVnum, data[col++]);
		str_to_number(mob_table->dwDrainSP, data[col++]);

		for (i = 0; i < MOB_SKILL_MAX_NUM; ++i)
		{
			str_to_number(mob_table->Skills[i].dwVnum, data[col++]);
			str_to_number(mob_table->Skills[i].bLevel, data[col++]);
		}

		str_to_number(mob_table->bBerserkPoint, data[col++]);
		str_to_number(mob_table->bStoneSkinPoint, data[col++]);
		str_to_number(mob_table->bGodSpeedPoint, data[col++]);
		str_to_number(mob_table->bDeathBlowPoint, data[col++]);
		str_to_number(mob_table->bRevivePoint, data[col++]);

		sys_log(1, "MOB #%-5d %-24s %-24s level: %-3u rank: %u empire: %d", mob_table->dwVnum, mob_table->szName, mob_table->szLocaleName, mob_table->bLevel, mob_table->bRank, mob_table->bEmpire);
		++mob_table;
	}

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

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%s ORDER BY vnum",
		g_stLocaleNameColumn.c_str(), GetTablePostfix());

	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;
}
// NOTXT_STARTUP_END

where to insert them ?

Share this post


Link to post
Share on other sites

// NOTXT_STARTUP_BEGIN
bool CClientManager::InitializeMobTableSQL()
{
	char query[4096];
	snprintf(query, sizeof(query),
		"SELECT vnum, name, %s, type, rank, battle_type, level, "
		"size+0, ai_flag+0, setRaceFlag+0, setImmuneFlag+0, "
		"on_click, empire, drop_item, resurrection_vnum, folder, "
		"st, dx, ht, iq, damage_min, damage_max, max_hp, regen_cycle, regen_percent, exp, "
		"gold_min, gold_max, def, attack_speed, move_speed, "
		"aggressive_hp_pct, aggressive_sight, attack_range, polymorph_item, "
		"enchant_curse, enchant_slow, enchant_poison, enchant_stun, enchant_critical, enchant_penetrate, "
		"resist_sword, resist_twohand, resist_dagger, resist_bell, resist_fan, resist_bow, "
		"resist_fire, resist_elect, resist_magic, resist_wind, resist_poison, "
		"dam_multiply, summon, drain_sp, "
		"skill_vnum0, skill_level0, skill_vnum1, skill_level1, skill_vnum2, skill_level2,"
		"skill_vnum3, skill_level3, skill_vnum4, skill_level4 , sp_berserk, sp_stoneskin, "
		"sp_godspeed, sp_deathblow, sp_revive "
		"FROM mob_proto%s ORDER BY vnum",
		g_stLocaleNameColumn.c_str(), GetTablePostfix());

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

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

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

	if (!m_vec_mobTable.empty())
	{
		sys_log(0, "RELOAD: mob_proto");
		m_vec_mobTable.clear();
	}

	m_vec_mobTable.resize(pRes->uiNumRows);
	memset(&m_vec_mobTable[0], 0, sizeof(TMobTable) * m_vec_mobTable.size());
	TMobTable * mob_table = &m_vec_mobTable[0];

	MYSQL_ROW data;
	int col;
	while ((data = mysql_fetch_row(pRes->pSQLResult)))
	{
		col = 0;
		str_to_number(mob_table->dwVnum, data[col++]);
		strlcpy(mob_table->szName, data[col++], sizeof(mob_table->szName));
		strlcpy(mob_table->szLocaleName, data[col++], sizeof(mob_table->szLocaleName));
		str_to_number(mob_table->bType, data[col++]);
		str_to_number(mob_table->bRank, data[col++]);
		str_to_number(mob_table->bBattleType, data[col++]);
		str_to_number(mob_table->bLevel, data[col++]);
		str_to_number(mob_table->bSize, data[col++]);
		str_to_number(mob_table->dwAIFlag, data[col++]);
		str_to_number(mob_table->dwRaceFlag, data[col++]);
		str_to_number(mob_table->dwImmuneFlag, data[col++]);
		str_to_number(mob_table->bOnClickType, data[col++]);
		str_to_number(mob_table->bEmpire, data[col++]);
		str_to_number(mob_table->dwDropItemVnum, data[col++]);
		str_to_number(mob_table->dwResurrectionVnum, data[col++]);
		strlcpy(mob_table->szFolder, data[col++], sizeof(mob_table->szFolder));
		str_to_number(mob_table->bStr, data[col++]);
		str_to_number(mob_table->bDex, data[col++]);
		str_to_number(mob_table->bCon, data[col++]);
		str_to_number(mob_table->bInt, data[col++]);
		str_to_number(mob_table->dwDamageRange[0], data[col++]);
		str_to_number(mob_table->dwDamageRange[1], data[col++]);
		str_to_number(mob_table->dwMaxHP, data[col++]);
		str_to_number(mob_table->bRegenCycle, data[col++]);
		str_to_number(mob_table->bRegenPercent, data[col++]);
		str_to_number(mob_table->dwExp, data[col++]);
		str_to_number(mob_table->dwGoldMin, data[col++]);
		str_to_number(mob_table->dwGoldMax, data[col++]);
		str_to_number(mob_table->wDef, data[col++]);
		str_to_number(mob_table->sAttackSpeed, data[col++]);
		str_to_number(mob_table->sMovingSpeed, data[col++]);
		str_to_number(mob_table->bAggresiveHPPct, data[col++]);
		str_to_number(mob_table->wAggressiveSight, data[col++]);
		str_to_number(mob_table->wAttackRange, data[col++]);
		str_to_number(mob_table->dwPolymorphItemVnum, data[col++]);

		int i;
		for (i = 0; i < MOB_ENCHANTS_MAX_NUM; ++i)
			str_to_number(mob_table->cEnchants[i], data[col++]);

		for (i = 0; i < MOB_RESISTS_MAX_NUM; ++i)
			str_to_number(mob_table->cResists[i], data[col++]);

		str_to_number(mob_table->fDamMultiply, data[col++]);
		str_to_number(mob_table->dwSummonVnum, data[col++]);
		str_to_number(mob_table->dwDrainSP, data[col++]);

		for (i = 0; i < MOB_SKILL_MAX_NUM; ++i)
		{
			str_to_number(mob_table->Skills[i].dwVnum, data[col++]);
			str_to_number(mob_table->Skills[i].bLevel, data[col++]);
		}

		str_to_number(mob_table->bBerserkPoint, data[col++]);
		str_to_number(mob_table->bStoneSkinPoint, data[col++]);
		str_to_number(mob_table->bGodSpeedPoint, data[col++]);
		str_to_number(mob_table->bDeathBlowPoint, data[col++]);
		str_to_number(mob_table->bRevivePoint, data[col++]);

		sys_log(1, "MOB #%-5d %-24s %-24s level: %-3u rank: %u empire: %d", mob_table->dwVnum, mob_table->szName, mob_table->szLocaleName, mob_table->bLevel, mob_table->bRank, mob_table->bEmpire);
		++mob_table;
	}

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

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%s ORDER BY vnum",
		g_stLocaleNameColumn.c_str(), GetTablePostfix());

	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;
}
// NOTXT_STARTUP_END

where to insert them ?

 

db/src/ClientManagerBoot.cpp

Share this post


Link to post
Share on other sites

 

// NOTXT_STARTUP_BEGIN
bool CClientManager::InitializeMobTableSQL()
{
	char query[4096];
	snprintf(query, sizeof(query),
		"SELECT vnum, name, %s, type, rank, battle_type, level, "
		"size+0, ai_flag+0, setRaceFlag+0, setImmuneFlag+0, "
		"on_click, empire, drop_item, resurrection_vnum, folder, "
		"st, dx, ht, iq, damage_min, damage_max, max_hp, regen_cycle, regen_percent, exp, "
		"gold_min, gold_max, def, attack_speed, move_speed, "
		"aggressive_hp_pct, aggressive_sight, attack_range, polymorph_item, "
		"enchant_curse, enchant_slow, enchant_poison, enchant_stun, enchant_critical, enchant_penetrate, "
		"resist_sword, resist_twohand, resist_dagger, resist_bell, resist_fan, resist_bow, "
		"resist_fire, resist_elect, resist_magic, resist_wind, resist_poison, "
		"dam_multiply, summon, drain_sp, "
		"skill_vnum0, skill_level0, skill_vnum1, skill_level1, skill_vnum2, skill_level2,"
		"skill_vnum3, skill_level3, skill_vnum4, skill_level4 , sp_berserk, sp_stoneskin, "
		"sp_godspeed, sp_deathblow, sp_revive "
		"FROM mob_proto%s ORDER BY vnum",
		g_stLocaleNameColumn.c_str(), GetTablePostfix());

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

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

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

	if (!m_vec_mobTable.empty())
	{
		sys_log(0, "RELOAD: mob_proto");
		m_vec_mobTable.clear();
	}

	m_vec_mobTable.resize(pRes->uiNumRows);
	memset(&m_vec_mobTable[0], 0, sizeof(TMobTable) * m_vec_mobTable.size());
	TMobTable * mob_table = &m_vec_mobTable[0];

	MYSQL_ROW data;
	int col;
	while ((data = mysql_fetch_row(pRes->pSQLResult)))
	{
		col = 0;
		str_to_number(mob_table->dwVnum, data[col++]);
		strlcpy(mob_table->szName, data[col++], sizeof(mob_table->szName));
		strlcpy(mob_table->szLocaleName, data[col++], sizeof(mob_table->szLocaleName));
		str_to_number(mob_table->bType, data[col++]);
		str_to_number(mob_table->bRank, data[col++]);
		str_to_number(mob_table->bBattleType, data[col++]);
		str_to_number(mob_table->bLevel, data[col++]);
		str_to_number(mob_table->bSize, data[col++]);
		str_to_number(mob_table->dwAIFlag, data[col++]);
		str_to_number(mob_table->dwRaceFlag, data[col++]);
		str_to_number(mob_table->dwImmuneFlag, data[col++]);
		str_to_number(mob_table->bOnClickType, data[col++]);
		str_to_number(mob_table->bEmpire, data[col++]);
		str_to_number(mob_table->dwDropItemVnum, data[col++]);
		str_to_number(mob_table->dwResurrectionVnum, data[col++]);
		strlcpy(mob_table->szFolder, data[col++], sizeof(mob_table->szFolder));
		str_to_number(mob_table->bStr, data[col++]);
		str_to_number(mob_table->bDex, data[col++]);
		str_to_number(mob_table->bCon, data[col++]);
		str_to_number(mob_table->bInt, data[col++]);
		str_to_number(mob_table->dwDamageRange[0], data[col++]);
		str_to_number(mob_table->dwDamageRange[1], data[col++]);
		str_to_number(mob_table->dwMaxHP, data[col++]);
		str_to_number(mob_table->bRegenCycle, data[col++]);
		str_to_number(mob_table->bRegenPercent, data[col++]);
		str_to_number(mob_table->dwExp, data[col++]);
		str_to_number(mob_table->dwGoldMin, data[col++]);
		str_to_number(mob_table->dwGoldMax, data[col++]);
		str_to_number(mob_table->wDef, data[col++]);
		str_to_number(mob_table->sAttackSpeed, data[col++]);
		str_to_number(mob_table->sMovingSpeed, data[col++]);
		str_to_number(mob_table->bAggresiveHPPct, data[col++]);
		str_to_number(mob_table->wAggressiveSight, data[col++]);
		str_to_number(mob_table->wAttackRange, data[col++]);
		str_to_number(mob_table->dwPolymorphItemVnum, data[col++]);

		int i;
		for (i = 0; i < MOB_ENCHANTS_MAX_NUM; ++i)
			str_to_number(mob_table->cEnchants[i], data[col++]);

		for (i = 0; i < MOB_RESISTS_MAX_NUM; ++i)
			str_to_number(mob_table->cResists[i], data[col++]);

		str_to_number(mob_table->fDamMultiply, data[col++]);
		str_to_number(mob_table->dwSummonVnum, data[col++]);
		str_to_number(mob_table->dwDrainSP, data[col++]);

		for (i = 0; i < MOB_SKILL_MAX_NUM; ++i)
		{
			str_to_number(mob_table->Skills[i].dwVnum, data[col++]);
			str_to_number(mob_table->Skills[i].bLevel, data[col++]);
		}

		str_to_number(mob_table->bBerserkPoint, data[col++]);
		str_to_number(mob_table->bStoneSkinPoint, data[col++]);
		str_to_number(mob_table->bGodSpeedPoint, data[col++]);
		str_to_number(mob_table->bDeathBlowPoint, data[col++]);
		str_to_number(mob_table->bRevivePoint, data[col++]);

		sys_log(1, "MOB #%-5d %-24s %-24s level: %-3u rank: %u empire: %d", mob_table->dwVnum, mob_table->szName, mob_table->szLocaleName, mob_table->bLevel, mob_table->bRank, mob_table->bEmpire);
		++mob_table;
	}

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

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%s ORDER BY vnum",
		g_stLocaleNameColumn.c_str(), GetTablePostfix());

	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;
}
// NOTXT_STARTUP_END

where to insert them ?

 

 

db/src/ClientManagerBoot.cpp

Hi Error Help me :(

 

[spoiler]compile Config.cpp
compile NetBase.cpp
compile Peer.cpp
compile PeerBase.cpp
compile Main.cpp
compile Lock.cpp
compile DBManager.cpp
compile Cache.cpp
compile LoginData.cpp
compile ClientManager.cpp
compile ClientManagerPlayer.cpp
compile ClientManagerLogin.cpp
compile ClientManagerBoot.cpp
In file included from ClientManager.cpp:6:
../../common/VnumHelper.h:59:32: warning: no newline at end of file
Cache.cpp:365:7: warning: no newline at end of file
compile ClientManagerParty.cpp
compile ClientManagerGuild.cpp
compile GuildManager.cpp
compile HB.cpp
compile PrivManager.cpp
compile MoneyLog.cpp
compile ItemAwardManager.cpp
compile ClientManagerEventFlag.cpp
compile Marriage.cpp
compile Monarch.cpp
compile BlockCountry.cpp
compile ItemIDRangeManager.cpp
In file included from ClientManagerBoot.cpp:8:
ProtoReader.h:36:7: warning: no newline at end of file
ItemAwardManager.cpp:129:2: warning: no newline at end of file
compile ClientManagerHorseName.cpp
ClientManagerPlayer.cpp: In member function 'char* CClientManager::GetCommand(ch ar*)':
ClientManagerPlayer.cpp:433: warning: address of local variable 'command' return ed
compile version.cpp
compile AuctionManager.cpp
compile ProtoReader.cpp
compile CsvReader.cpp
AuctionManager.cpp:719:7: warning: no newline at end of file
In file included from ProtoReader.cpp:4:
ProtoReader.h:36:7: warning: no newline at end of file
ClientManagerBoot.cpp:19: error: expected unqualified-id before 'if'
CsvReader.cpp: In member function 'const char* cCsvAlias::operator[](size_t) con st':
CsvReader.cpp:72: warning: left-hand operand of comma has no effect
CsvReader.cpp:72: warning: right-hand operand of comma has no effect
CsvReader.cpp: In member function 'size_t cCsvAlias::operator[](const char*) con st':
CsvReader.cpp:90: warning: left-hand operand of comma has no effect
CsvReader.cpp:90: warning: right-hand operand of comma has no effect
gmake: *** [.obj/ClientManagerBoot.o] Error 1
gmake: *** Waiting for unfinished jobs....
ProtoReader.cpp: In function 'std::string* StringSplit(std::string, std::string) ':
ProtoReader.cpp:33: warning: comparison between signed and unsigned integer expr essions
ProtoReader.cpp: In function 'int get_Item_Type_Value(std::string)':
ProtoReader.cpp:87: warning: comparison between signed and unsigned integer expr essions
ProtoReader.cpp: In function 'int get_Item_SubType_Value(int, std::string)':
ProtoReader.cpp:204: warning: comparison between signed and unsigned integer exp ressions
ProtoReader.cpp:207: warning: comparison between signed and unsigned integer exp ressions
ProtoReader.cpp: In function 'int get_Item_AntiFlag_Value(std::string)':
ProtoReader.cpp:250: warning: comparison between signed and unsigned integer exp ressions
ProtoReader.cpp: In function 'int get_Item_Flag_Value(std::string)':
ProtoReader.cpp:279: warning: comparison between signed and unsigned integer exp ressions
ProtoReader.cpp: In function 'int get_Item_WearFlag_Value(std::string)':
ProtoReader.cpp:307: warning: comparison between signed and unsigned integer exp ressions
ProtoReader.cpp: In function 'int get_Item_Immune_Value(std::string)':
ProtoReader.cpp:333: warning: comparison between signed and unsigned integer exp ressions
ProtoReader.cpp: In function 'int get_Item_LimitType_Value(std::string)':
ProtoReader.cpp:361: warning: comparison between signed and unsigned integer exp ressions
ProtoReader.cpp: In function 'int get_Item_ApplyType_Value(std::string)':
ProtoReader.cpp:400: warning: comparison between signed and unsigned integer exp ressions
ProtoReader.cpp: In function 'int get_Mob_Rank_Value(std::string)':
ProtoReader.cpp:426: warning: comparison between signed and unsigned integer exp ressions
ProtoReader.cpp: In function 'int get_Mob_Type_Value(std::string)':
ProtoReader.cpp:448: warning: comparison between signed and unsigned integer exp ressions
ProtoReader.cpp: In function 'int get_Mob_BattleType_Value(std::string)':
ProtoReader.cpp:469: warning: comparison between signed and unsigned integer exp ressions
ProtoReader.cpp: In function 'int get_Mob_Size_Value(std::string)':
ProtoReader.cpp:490: warning: comparison between signed and unsigned integer exp ressions
ProtoReader.cpp: In function 'int get_Mob_AIFlag_Value(std::string)':
ProtoReader.cpp:512: warning: comparison between signed and unsigned integer exp ressions
ProtoReader.cpp: In function 'int get_Mob_RaceFlag_Value(std::string)':
ProtoReader.cpp:537: warning: comparison between signed and unsigned integer exp ressions
ProtoReader.cpp: In function 'int get_Mob_ImmuneFlag_Value(std::string)':
ProtoReader.cpp:561: warning: comparison between signed and unsigned integer exp ressions
ProtoReader.cpp: In function 'bool Set_Proto_Item_Table(TItemTable*, cCsvTable&, std::map<int, const char*, std::less<int>, std::allocator<std::pair<const int, const char*> > >&)':
ProtoReader.cpp:696: warning: comparison between signed and unsigned integer exp ressions
ProtoReader.cpp:757: warning: comparison between signed and unsigned integer exp ressions[/spoiler]

Share this post


Link to post
Share on other sites

Hey devs!

 

One word: Works! ;)

Follow the steps:

1.) Open "db/src/Main.cpp" file and write this to the top of the file, under to the includes:

// NOTXT_STARTUP_BEGIN
BOOL g_noTXT = false;
// NOTXT_STARTUP_END

bM7uA.png

2.) Search for this: "int iDisableHotBackup;" and put under this:

	// NOTXT_STARTUP_BEGIN
	int iNoTXT;
	if (CConfig::instance().GetValue("NO_TXT", &iNoTXT))
	{
		if (iNoTXT)
		{
			sys_log(0, "CONFIG: NO_TXT");
			g_noTXT = true;
		}
	}
	// NOTXT_STARTUP_END

bM7BK.png

3.) Save&Close. Now open "db/src/ClientManager.h" and replace:

	bool		InitializeMobTable();
	bool		InitializeItemTable();

With:

		// NOTXT_STARTUP_BEGIN
		bool		InitializeMobTableTXT();
		bool		InitializeItemTableTXT();
		bool		InitializeMobTableSQL();
		bool		InitializeItemTableSQL();
		// NOTXT_STARTUP_END

bM7GT.png

4.) Save&Close. Then open "db/src/ClientManagerBoot.cpp" and put this the top of the file:

// NOTXT_STARTUP_BEGIN
extern int g_noTXT;
// NOTXT_STARTUP_END

bM7Jt.png

5.) Replace this:

bool CClientManager::InitializeMobTable()

With this:

bool CClientManager::InitializeMobTableTXT()

And repeat it with ItemProto(::InitializeItemTable)

bMbDB.png

 

bMbFn.png

6.) Search for this: "bool CClientManager::InitializeTables()" and replace this:

	if (!InitializeMobTable())
	{
		sys_err("InitializeMobTable FAILED");
		return false;
	}
	if (!MirrorMobTableIntoDB())
	{
		sys_err("MirrorMobTableIntoDB FAILED");
		return false; 
	}

	if (!InitializeItemTable())
	{
		sys_err("InitializeItemTable FAILED");
		return false; 
	}

	if (!MirrorItemTableIntoDB())
	{
		sys_err("MirrorItemTableIntoDB FAILED");
		return false; 
	}

With this:

	// NOTXT_STARTUP_BEGIN
	if (g_noTXT) // item and mob proto
	{
		if (!InitializeMobTableSQL())
		{
			sys_err("InitializeMobTableSQL FAILED");
			return false;
		}
		if (!InitializeItemTableSQL())
		{
			sys_err("InitializeItemTableSQL FAILED");
			return false;
		}
	}
	else
	{
		if (!InitializeMobTableTXT())
		{
			sys_err("InitializeMobTableTXT FAILED");
			return false;
		}

		if (!MirrorMobTableIntoDB())
		{
			sys_err("MirrorMobTableIntoDB FAILED");
			return false;
		}

		if (!InitializeItemTableTXT())
		{
			sys_err("InitializeItemTableTXT FAILED");
			return false;
		}

		if (!MirrorItemTableIntoDB())
		{
			sys_err("MirrorItemTableIntoDB FAILED");
			return false;
		}
	}
	// NOTXT_STARTUP_END

7.) And last put these functions into the file:

// NOTXT_STARTUP_BEGIN
bool CClientManager::InitializeMobTableSQL()
{
	char query[4096];
	snprintf(query, sizeof(query),
		"SELECT vnum, name, %s, type, rank, battle_type, level, "
		"size+0, ai_flag+0, setRaceFlag+0, setImmuneFlag+0, "
		"on_click, empire, drop_item, resurrection_vnum, folder, "
		"st, dx, ht, iq, damage_min, damage_max, max_hp, regen_cycle, regen_percent, exp, "
		"gold_min, gold_max, def, attack_speed, move_speed, "
		"aggressive_hp_pct, aggressive_sight, attack_range, polymorph_item, "
		"enchant_curse, enchant_slow, enchant_poison, enchant_stun, enchant_critical, enchant_penetrate, "
		"resist_sword, resist_twohand, resist_dagger, resist_bell, resist_fan, resist_bow, "
		"resist_fire, resist_elect, resist_magic, resist_wind, resist_poison, "
		"dam_multiply, summon, drain_sp, "
		"skill_vnum0, skill_level0, skill_vnum1, skill_level1, skill_vnum2, skill_level2,"
		"skill_vnum3, skill_level3, skill_vnum4, skill_level4 , sp_berserk, sp_stoneskin, "
		"sp_godspeed, sp_deathblow, sp_revive "
		"FROM mob_proto%s ORDER BY vnum",
		g_stLocaleNameColumn.c_str(), GetTablePostfix());

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

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

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

	if (!m_vec_mobTable.empty())
	{
		sys_log(0, "RELOAD: mob_proto");
		m_vec_mobTable.clear();
	}

	m_vec_mobTable.resize(pRes->uiNumRows);
	memset(&m_vec_mobTable[0], 0, sizeof(TMobTable) * m_vec_mobTable.size());
	TMobTable * mob_table = &m_vec_mobTable[0];

	MYSQL_ROW data;
	int col;
	while ((data = mysql_fetch_row(pRes->pSQLResult)))
	{
		col = 0;
		str_to_number(mob_table->dwVnum, data[col++]);
		strlcpy(mob_table->szName, data[col++], sizeof(mob_table->szName));
		strlcpy(mob_table->szLocaleName, data[col++], sizeof(mob_table->szLocaleName));
		str_to_number(mob_table->bType, data[col++]);
		str_to_number(mob_table->bRank, data[col++]);
		str_to_number(mob_table->bBattleType, data[col++]);
		str_to_number(mob_table->bLevel, data[col++]);
		str_to_number(mob_table->bSize, data[col++]);
		str_to_number(mob_table->dwAIFlag, data[col++]);
		str_to_number(mob_table->dwRaceFlag, data[col++]);
		str_to_number(mob_table->dwImmuneFlag, data[col++]);
		str_to_number(mob_table->bOnClickType, data[col++]);
		str_to_number(mob_table->bEmpire, data[col++]);
		str_to_number(mob_table->dwDropItemVnum, data[col++]);
		str_to_number(mob_table->dwResurrectionVnum, data[col++]);
		strlcpy(mob_table->szFolder, data[col++], sizeof(mob_table->szFolder));
		str_to_number(mob_table->bStr, data[col++]);
		str_to_number(mob_table->bDex, data[col++]);
		str_to_number(mob_table->bCon, data[col++]);
		str_to_number(mob_table->bInt, data[col++]);
		str_to_number(mob_table->dwDamageRange[0], data[col++]);
		str_to_number(mob_table->dwDamageRange[1], data[col++]);
		str_to_number(mob_table->dwMaxHP, data[col++]);
		str_to_number(mob_table->bRegenCycle, data[col++]);
		str_to_number(mob_table->bRegenPercent, data[col++]);
		str_to_number(mob_table->dwExp, data[col++]);
		str_to_number(mob_table->dwGoldMin, data[col++]);
		str_to_number(mob_table->dwGoldMax, data[col++]);
		str_to_number(mob_table->wDef, data[col++]);
		str_to_number(mob_table->sAttackSpeed, data[col++]);
		str_to_number(mob_table->sMovingSpeed, data[col++]);
		str_to_number(mob_table->bAggresiveHPPct, data[col++]);
		str_to_number(mob_table->wAggressiveSight, data[col++]);
		str_to_number(mob_table->wAttackRange, data[col++]);
		str_to_number(mob_table->dwPolymorphItemVnum, data[col++]);

		int i;
		for (i = 0; i < MOB_ENCHANTS_MAX_NUM; ++i)
			str_to_number(mob_table->cEnchants[i], data[col++]);

		for (i = 0; i < MOB_RESISTS_MAX_NUM; ++i)
			str_to_number(mob_table->cResists[i], data[col++]);

		str_to_number(mob_table->fDamMultiply, data[col++]);
		str_to_number(mob_table->dwSummonVnum, data[col++]);
		str_to_number(mob_table->dwDrainSP, data[col++]);

		for (i = 0; i < MOB_SKILL_MAX_NUM; ++i)
		{
			str_to_number(mob_table->Skills[i].dwVnum, data[col++]);
			str_to_number(mob_table->Skills[i].bLevel, data[col++]);
		}

		str_to_number(mob_table->bBerserkPoint, data[col++]);
		str_to_number(mob_table->bStoneSkinPoint, data[col++]);
		str_to_number(mob_table->bGodSpeedPoint, data[col++]);
		str_to_number(mob_table->bDeathBlowPoint, data[col++]);
		str_to_number(mob_table->bRevivePoint, data[col++]);

		sys_log(1, "MOB #%-5d %-24s %-24s level: %-3u rank: %u empire: %d", mob_table->dwVnum, mob_table->szName, mob_table->szLocaleName, mob_table->bLevel, mob_table->bRank, mob_table->bEmpire);
		++mob_table;
	}

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

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%s ORDER BY vnum",
		g_stLocaleNameColumn.c_str(), GetTablePostfix());

	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;
}
// NOTXT_STARTUP_END

7+1.) New item_proto_table.sql:

DROP TABLE IF EXISTS `item_proto`;
CREATE TABLE `item_proto` (
  `vnum` int(11) unsigned NOT NULL DEFAULT '0',
  `vnum_range` int(11) unsigned NOT NULL DEFAULT '0',
  `name` varbinary(200) NOT NULL DEFAULT 'Noname                  ',
  `locale_name` varbinary(24) NOT NULL DEFAULT 'Noname                  ',
  `type` tinyint(2) NOT NULL DEFAULT '0',
  `subtype` tinyint(2) NOT NULL DEFAULT '0',
  `weight` tinyint(3) DEFAULT '0',
  `size` tinyint(3) DEFAULT '0',
  `antiflag` int(11) DEFAULT '0',
  `flag` int(11) DEFAULT '0',
  `wearflag` int(11) DEFAULT '0',
  `immuneflag` set('PARA','CURSE','STUN','SLEEP','SLOW','POISON','TERROR') CHARACTER SET big5 NOT NULL DEFAULT '',
  `gold` int(11) DEFAULT '0',
  `shop_buy_price` int(10) unsigned NOT NULL DEFAULT '0',
  `refined_vnum` int(10) unsigned NOT NULL DEFAULT '0',
  `refine_set` smallint(11) unsigned NOT NULL DEFAULT '0',
  `refine_set2` smallint(5) unsigned NOT NULL DEFAULT '0',
  `magic_pct` tinyint(4) NOT NULL DEFAULT '0',
  `limittype0` tinyint(4) DEFAULT '0',
  `limitvalue0` int(11) DEFAULT '0',
  `limittype1` tinyint(4) DEFAULT '0',
  `limitvalue1` int(11) DEFAULT '0',
  `applytype0` tinyint(4) DEFAULT '0',
  `applyvalue0` int(11) DEFAULT '0',
  `applytype1` tinyint(4) DEFAULT '0',
  `applyvalue1` int(11) DEFAULT '0',
  `applytype2` tinyint(4) DEFAULT '0',
  `applyvalue2` int(11) DEFAULT '0',
  `value0` int(11) DEFAULT '0',
  `value1` int(11) DEFAULT '0',
  `value2` int(11) DEFAULT '0',
  `value3` int(11) DEFAULT '0',
  `value4` int(11) DEFAULT '0',
  `value5` int(11) DEFAULT '0',
  `socket0` tinyint(4) DEFAULT '-1',
  `socket1` tinyint(4) DEFAULT '-1',
  `socket2` tinyint(4) DEFAULT '-1',
  `socket3` tinyint(4) DEFAULT '-1',
  `socket4` tinyint(4) DEFAULT '-1',
  `socket5` tinyint(4) DEFAULT '-1',
  `specular` tinyint(4) NOT NULL DEFAULT '0',
  `socket_pct` tinyint(4) NOT NULL DEFAULT '0',
  `addon_type` smallint(6) NOT NULL DEFAULT '0',
  PRIMARY KEY (`vnum`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin;

But you can modify your item_proto with "Design table" option in navicat.

conf.txt:

NO_TXT                     = 1

0: TXT

1: SQL


Special thanks to:

- iMer, Zonni for the snippets ^^

Changelog:

 - "0"


 

If you find any errors or problems just post a message into this thread.

I tested on win.

I hope you like it. :lol:

 

With regards,

P3NG3R.

Hi P3NG3R 

Ready ClientManagerBoot.cpp Give me  ? :( 

 

Share this post


Link to post
Share on other sites

My Error:

linking ...
/usr/bin/ld: cannot find -lthecore
Makefile:47: recipe for target '../db_r40146' failed
gamke: *** [../db_r40146] Error 1

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

  • Recently Browsing   0 members

    No registered users viewing this page.