Jump to content

Add HP Regen to Target Info System


Recommended Posts

Image: 

 

 

1. Client Source/UserInterface/PythonNonPlayer.cpp

search:

DWORD CPythonNonPlayer::GetMonsterMaxHP(DWORD dwVnum)

below this function, add:

DWORD CPythonNonPlayer::GetMonsterRegenPercent(DWORD dwVnum)
{
	const CPythonNonPlayer::TMobTable* c_pTable = GetTable(dwVnum);
	if (!c_pTable)
	{
		DWORD bRegenPercent = 0;
		return bRegenPercent;
	}

	return c_pTable->bRegenPercent;
}

DWORD CPythonNonPlayer::GetMonsterRegenRate(DWORD dwVnum)
{
	const CPythonNonPlayer::TMobTable* c_pTable = GetTable(dwVnum);
	if (!c_pTable)
	{
		DWORD bRegenCycle = 0;
		return bRegenCycle;
	}

	return c_pTable->bRegenCycle;
}

PythonNonPlayer.h:

search:

		DWORD				GetMonsterMaxHP(DWORD dwVnum);

below, add:

		DWORD               GetMonsterRegenRate(DWORD dwVnum);
		DWORD               GetMonsterRegenPercent(DWORD dwVnum);

PythonNonPlayerModule.cpp:

search:

PyObject * nonplayerGetMonsterMaxHP(PyObject * poSelf, PyObject * poArgs)

add below:

PyObject * nonplayerGetMonsterRegenRate(PyObject * poSelf, PyObject * poArgs)
{
	int race;
	if (!PyTuple_GetInteger(poArgs, 0, &race))
		return Py_BuildException();

	CPythonNonPlayer& rkNonPlayer=CPythonNonPlayer::Instance();

	return Py_BuildValue("i", rkNonPlayer.GetMonsterRegenRate(race));
}
PyObject * nonplayerGetMonsterRegenPercent(PyObject * poSelf, PyObject * poArgs)
{
	int race;
	if (!PyTuple_GetInteger(poArgs, 0, &race))
		return Py_BuildException();

	CPythonNonPlayer& rkNonPlayer=CPythonNonPlayer::Instance();

	return Py_BuildValue("i", rkNonPlayer.GetMonsterRegenPercent(race));
}

search:

{ "GetMonsterMaxHP",			nonplayerGetMonsterMaxHP,			METH_VARARGS },

below, add:

		{ "GetMonsterRegenRate",		nonplayerGetMonsterRegenRate,		METH_VARARGS },
		{ "GetMonsterRegenPercent",		nonplayerGetMonsterRegenPercent,	METH_VARARGS },

2. client/pack/root/uitarget.py:

search:

				self.AppendTextLine(localeInfo.TARGET_INFO_EXP % str(iExp))

add below:

				self.AppendTextLine(localeInfo.TARGET_INFO_REGEN % (str(nonplayer.GetMonsterRegenPercent(race)), str(nonplayer.GetMonsterRegenRate(race))))

3. client/pack/locale/locale_game.txt

search:

TARGET_INFO_MAX_HP	Max. HP : %s

add:

TARGET_INFO_REGEN	HP Regen: %s%% every %s seconds

Done!

 

 

Bonus: If you don't want Target Info to show "Damage: 1-5" for Metin stones, in uitarget.py, replace:

self.AppendTextLine(localeInfo.TARGET_INFO_DAMAGE % (str(iDamMin), str(iDamMax)))

with

				if not(nonplayer.IsMonsterStone(race)):
					self.AppendTextLine(localeInfo.TARGET_INFO_DAMAGE % (str(iDamMin), str(iDamMax)))

 

Spoiler

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 3
  • Think 1
  • Good 2
  • Love 2
  • Love 7
Link to comment
Share on other sites

  • 1 month later...

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.