[Tutorial] Adauga HP Regen la Target Info System

  • Autor subiect darius95
  • Dată creare
  • Răspunsuri: Răspunsuri 0
  • Vizualizări: Vizualizări 4K

darius95

Member
2 Sep 2020
110
1
18
36
București
Monede Dragon
0
1. Client Source/UserInterface/PythonNonPlayer.cpp

cauta:

DWORD CPythonNonPlayer::GetMonsterMaxHP(DWORD dwVnum)

adauga:

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:

cauta:

DWORD GetMonsterMaxHP(DWORD dwVnum);

adauga:

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


PythonNonPlayerModule.cpp:

cauta:

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

adauga:

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


cauta:

{ "GetMonsterMaxHP", nonplayerGetMonsterMaxHP, METH_VARARGS },

adauga:

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


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

cauta:

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

adauga:

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

3. client/pack/locale/locale_game.txt

cauta:

TARGET_INFO_MAX_HP Max. HP : %s

adauga:

TARGET_INFO_REGEN Regenerare HP: %s%% la %s secunde

Done!





Bonus: Daca nu vrei sa apara "Daune: 1-5" la metine, in uitarget.py, modifica:

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

cu

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