Jump to content

Recommended Posts

  • Honorable Member

It is also an important for proto sharers.

  • Reversed from 23.0.6.0

This is the hidden content, please

 

Usage:

nonplayer.IsAIFlagByVID(nonplayer.AIFLAG_ELEMENT_BUFF_DARK)
Edited by Mali
  • Metin2 Dev 93
  • Confused 1
  • Good 10
  • Love 2
  • Love 35

 

Link to comment
https://metin2.dev/topic/30389-nonplayerisaiflagbyvid-reversed/
Share on other sites

  • Active Member
8 hours ago, Mali said:

It is also an important for proto sharers.

  • Reversed from 23.0.6.0

 

Hidden Content

 

.png

That dwUnkFlag is actually DWORD dwAIFlag -> DWORD dwAIFlag[2].

This is only client-side, you have to change server & dump_proto etc.

///@@@PythonNonPlayer.h:
		enum  EClickEvent
		{
			...
		};

///Add
		enum EAIFlags
		{
			AIFLAG_AGGRESSIVE = 0,
			AIFLAG_NOMOVE = 1,
			AIFLAG_COWARD = 2,
			AIFLAG_NOATTACKSHINSU = 3,
			AIFLAG_NOATTACKJINNO = 4,
			AIFLAG_NOATTACKCHUNJO = 5,
			AIFLAG_ATTACKMOB = 6,
			AIFLAG_BERSERK = 7,
			AIFLAG_STONESKIN = 8,
			AIFLAG_GODSPEED = 9,
			AIFLAG_DEATHBLOW = 10,
			AIFLAG_REVIVE = 11,
			AIFLAG_HEALER = 12,
			AIFLAG_COUNT = 13,
			AIFLAG_NORECOVERY = 14,
			AIFLAG_REFLECT = 15,
			AIFLAG_FALL = 16,
			AIFLAG_VIT = 17,
			AIFLAG_RATTSPEED = 18,
			AIFLAG_RCASTSPEED = 19,
			AIFLAG_RHP_REGEN = 20,
			AIFLAG_TIMEVIT = 21,
			AIFLAG_ELEMENT_BUFF_NONE = 26,
			AIFLAG_ELEMENT_BUFF_FIRE = 27,
			AIFLAG_ELEMENT_BUFF_ICE = 28,
			AIFLAG_ELEMENT_BUFF_ELECT = 29,
			AIFLAG_ELEMENT_BUFF_WIND = 30,
			AIFLAG_ELEMENT_BUFF_EARTH = 31,
			AIFLAG_ELEMENT_BUFF_DARK = 32,

			AIFLAG_MAX = 34 // 23.0.6.0
		};

//Find
			DWORD       dwAIFlag;

///Change
			DWORD       dwAIFlag[2];

//Find
		const char*			GetMonsterName(DWORD dwVnum);

///Add
		bool				IsAIFlag(DWORD dwVnum, int iFlagIndex);
///@@@PythonNonPlayer.cpp:

///Add
bool CPythonNonPlayer::IsAIFlag(DWORD dwVnum, int iFlagIndex)
{
	const CPythonNonPlayer::TMobTable* c_pTable = GetTable(dwVnum);
	if (!c_pTable)
		return false;

	if (iFlagIndex < 0 || iFlagIndex >= EAIFlags::AIFLAG_MAX)
		return false;

	return IS_SET(c_pTable->dwAIFlag[iFlagIndex >> 5], 1 << (iFlagIndex & 0x1F));
}
///@@@PythonNonPlayerModule.cpp:

///Add
PyObject* nonplayerIsAIFlagByVID(PyObject* poSelf, PyObject* poArgs)
{
	int iVirtualID;
	if (!PyTuple_GetInteger(poArgs, 0, &iVirtualID))
		return Py_BuildException();

	int iIndex;
	if (!PyTuple_GetInteger(poArgs, 1, &iIndex))
		return Py_BuildException();

	CInstanceBase* pInstance = CPythonCharacterManager::Instance().GetInstancePtr(iVirtualID);
	if (!pInstance)
		return Py_BuildValue("b", false);

	CPythonNonPlayer& rkNonPlayer = CPythonNonPlayer::Instance();
	return Py_BuildValue("b", rkNonPlayer.IsAIFlag(pInstance->GetVirtualID(), iIndex));
}

///Add to initNonPlayer
		{ "IsAIFlagByVID",				nonplayerIsAIFlagByVID,				METH_VARARGS },

//Find
	PyModule_AddIntConstant(poModule, "ON_CLICK_EVENT_VEHICLE",		CPythonNonPlayer::ON_CLICK_EVENT_VEHICLE);

///Add
	PyModule_AddIntConstant(poModule, "AIFLAG_AGGRESSIVE",			CPythonNonPlayer::EAIFlags::AIFLAG_AGGRESSIVE);
	PyModule_AddIntConstant(poModule, "AIFLAG_NOMOVE",				CPythonNonPlayer::EAIFlags::AIFLAG_NOMOVE);
	PyModule_AddIntConstant(poModule, "AIFLAG_COWARD",				CPythonNonPlayer::EAIFlags::AIFLAG_COWARD);
	PyModule_AddIntConstant(poModule, "AIFLAG_NOATTACKSHINSU",		CPythonNonPlayer::EAIFlags::AIFLAG_NOATTACKSHINSU);
	PyModule_AddIntConstant(poModule, "AIFLAG_NOATTACKJINNO",		CPythonNonPlayer::EAIFlags::AIFLAG_NOATTACKJINNO);
	PyModule_AddIntConstant(poModule, "AIFLAG_NOATTACKCHUNJO",		CPythonNonPlayer::EAIFlags::AIFLAG_NOATTACKCHUNJO);
	PyModule_AddIntConstant(poModule, "AIFLAG_ATTACKMOB",			CPythonNonPlayer::EAIFlags::AIFLAG_ATTACKMOB);
	PyModule_AddIntConstant(poModule, "AIFLAG_BERSERK",				CPythonNonPlayer::EAIFlags::AIFLAG_BERSERK);
	PyModule_AddIntConstant(poModule, "AIFLAG_STONESKIN",			CPythonNonPlayer::EAIFlags::AIFLAG_STONESKIN);
	PyModule_AddIntConstant(poModule, "AIFLAG_GODSPEED",			CPythonNonPlayer::EAIFlags::AIFLAG_GODSPEED);
	PyModule_AddIntConstant(poModule, "AIFLAG_DEATHBLOW",			CPythonNonPlayer::EAIFlags::AIFLAG_DEATHBLOW);
	PyModule_AddIntConstant(poModule, "AIFLAG_REVIVE",				CPythonNonPlayer::EAIFlags::AIFLAG_REVIVE);
	PyModule_AddIntConstant(poModule, "AIFLAG_HEALER",				CPythonNonPlayer::EAIFlags::AIFLAG_HEALER);
	PyModule_AddIntConstant(poModule, "AIFLAG_COUNT",				CPythonNonPlayer::EAIFlags::AIFLAG_COUNT);
	PyModule_AddIntConstant(poModule, "AIFLAG_NORECOVERY",			CPythonNonPlayer::EAIFlags::AIFLAG_NORECOVERY);
	PyModule_AddIntConstant(poModule, "AIFLAG_REFLECT",				CPythonNonPlayer::EAIFlags::AIFLAG_REFLECT);
	PyModule_AddIntConstant(poModule, "AIFLAG_FALL",				CPythonNonPlayer::EAIFlags::AIFLAG_FALL);
	PyModule_AddIntConstant(poModule, "AIFLAG_VIT",					CPythonNonPlayer::EAIFlags::AIFLAG_VIT);
	PyModule_AddIntConstant(poModule, "AIFLAG_RATTSPEED",			CPythonNonPlayer::EAIFlags::AIFLAG_RATTSPEED);
	PyModule_AddIntConstant(poModule, "AIFLAG_RCASTSPEED",			CPythonNonPlayer::EAIFlags::AIFLAG_RCASTSPEED);
	PyModule_AddIntConstant(poModule, "AIFLAG_RHP_REGEN",			CPythonNonPlayer::EAIFlags::AIFLAG_RHP_REGEN);
	PyModule_AddIntConstant(poModule, "AIFLAG_TIMEVIT",				CPythonNonPlayer::EAIFlags::AIFLAG_TIMEVIT);
	PyModule_AddIntConstant(poModule, "AIFLAG_ELEMENT_BUFF_NONE",	CPythonNonPlayer::EAIFlags::AIFLAG_ELEMENT_BUFF_NONE);
	PyModule_AddIntConstant(poModule, "AIFLAG_ELEMENT_BUFF_FIRE",	CPythonNonPlayer::EAIFlags::AIFLAG_ELEMENT_BUFF_FIRE);
	PyModule_AddIntConstant(poModule, "AIFLAG_ELEMENT_BUFF_ICE",	CPythonNonPlayer::EAIFlags::AIFLAG_ELEMENT_BUFF_ICE);
	PyModule_AddIntConstant(poModule, "AIFLAG_ELEMENT_BUFF_ELECT",	CPythonNonPlayer::EAIFlags::AIFLAG_ELEMENT_BUFF_ELECT);
	PyModule_AddIntConstant(poModule, "AIFLAG_ELEMENT_BUFF_WIND",	CPythonNonPlayer::EAIFlags::AIFLAG_ELEMENT_BUFF_WIND);
	PyModule_AddIntConstant(poModule, "AIFLAG_ELEMENT_BUFF_EARTH",	CPythonNonPlayer::EAIFlags::AIFLAG_ELEMENT_BUFF_EARTH);
	PyModule_AddIntConstant(poModule, "AIFLAG_ELEMENT_BUFF_DARK",	CPythonNonPlayer::EAIFlags::AIFLAG_ELEMENT_BUFF_DARK);

 

 

 

Usage:

nonplayer.IsAIFlagByVID(nonplayer.AIFLAG_ELEMENT_BUFF_DARK)

Also important to know,
They're using "ELEMENT_BUFF_DARK" inside of the new AIFlag, because the dumper stores just until "ELEMENT_BUFF_EARTH"
If you extend it, the Protos are in a missmatch then.
Example from offical protos: 
spacer.png

Btw @ Malii've send you a git request, if you're interested in to join my Tool.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Honorable Member
1 hour ago, Deso said:

They're using "ELEMENT_BUFF_DARK" inside of the new AIFlag, because the dumper stores just until "ELEMENT_BUFF_EARTH"
spacer.png

Yes because ELEMENT_BUFF_DARK's index is big equal than 32. Those greater than or equal to 32 are will be stored in dwAIFlag[1].

Example:

.png

Edited by Mali
  • Metin2 Dev 1

 

Cool ! - Btw a question.

Yesterday i changed the old struct With the New one (1 instead of 1 << 0 and so on) on Server and dumper ... 

On serverside there are alot of IS_BIT Codes With aiflags. 

Need to Change also 1 << (flagtype & 0x1F) ? (Sorry im on phone its a Bit hard to explain Here

Later i can edit With an example or Like on IsAggressive Codes With the Return of such Bits, need to Change Them too?

  • Honorable Member
9 hours ago, JeeX said:

Cool ! - Btw a question.

Yesterday i changed the old struct With the New one (1 instead of 1 << 0 and so on) on Server and dumper ... 

On serverside there are alot of IS_BIT Codes With aiflags. 

Need to Change also 1 << (flagtype & 0x1F) ? (Sorry im on phone its a Bit hard to explain Here

Later i can edit With an example or Like on IsAggressive Codes With the Return of such Bits, need to Change Them too?

just make same bit operations and change EAIFlags for indexes 0,1,23,4(like this topic), it will be fine

 

21 minutes ago, Mali said:

just make same bit operations and change EAIFlags for indexes 0,1,23,4(like this topic), it will be fine

Sorry for replay again.

Like that? (I usually wanted to be 100% Sure. Thank you!

bool CHARACTER::IsAggressive() const

{

    return IS_SET(m_pointsInstant.dwAIFlag[0], 1 << (AIFLAG_AGGRESSIVE & 0x1F));

}

 

void CHARACTER::SetAttackMob()

{

    SET_BIT(m_pointsInstant.dwAIFlag[0], 1 << (AIFLAG_ATTACKMOB & 0x1F));

}

 

Thank you!

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.