Jump to content

Searching official function: GetElementByVID (PythonPlayerModule.cpp)


Go to solution Solved by xP3NG3Rx,

Recommended Posts

  • Premium

It is not reversed, but seems to work just fine (https://metin2.download/picture/2vYkRa9le60NGVOjaxlz81nad7RJoDNG/.png)

This is the hidden content, please

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 14
  • Love 5
Link to comment
Share on other sites

  • Honorable Member
  • Solution

I don't think so that this will help you, but here it is what you asked for.

Spoiler
PyObject * playerGetElementByVID(PyObject* poSelf, PyObject* poArgs)
{
	DWORD dwVID = 0;
	if (!PyTuple_GetUnsignedLong(poArgs, 0, &dwVID))
		return Py_BadArgument();

	CInstanceBase * pTargetInstance = CPythonCharacterManager::Instance().GetInstancePtr(dwVID);
	if (!pTargetInstance)
		return Py_BuildValue("i", 0);

	CItemData * pPendantItem = NULL;
	const DWORD dwItemVnum = pTargetInstance->GetPart(CRaceData::PART_PENDANT);
	if (CItemManager::Instance().GetItemDataPointer(dwItemVnum, &pPendantItem))
	{
		for (BYTE i = 0; i < CItemData::ITEM_APPLY_MAX_NUM; ++i)
		{
			CItemData::TItemApply ItemApply;
			if (!pPendantItem->GetApply(i, &ItemApply))
				return Py_BuildException();

			switch (ItemApply.wType)
			{
			case CItemData::APPLY_ENCHANT_ELECT:
				return Py_BuildValue("i", CPythonNonPlayer::RACE_FLAG_ATT_ELEC);
				break;
			case CItemData::APPLY_ENCHANT_FIRE:
				return Py_BuildValue("i", CPythonNonPlayer::RACE_FLAG_ATT_FIRE);
				break;
			case CItemData::APPLY_ENCHANT_ICE:
				return Py_BuildValue("i", CPythonNonPlayer::RACE_FLAG_ATT_ICE);
				break;
			case CItemData::APPLY_ENCHANT_WIND:
				return Py_BuildValue("i", CPythonNonPlayer::RACE_FLAG_ATT_WIND);
				break;
			case CItemData::APPLY_ENCHANT_EARTH:
				return Py_BuildValue("i", CPythonNonPlayer::RACE_FLAG_ATT_EARTH);
				break;
			case CItemData::APPLY_ENCHANT_DARK:
				return Py_BuildValue("i", CPythonNonPlayer::RACE_FLAG_ATT_DARK);
				break;
			default:
				continue;
			}
		}
	}

	return Py_BuildValue("i", 0);
}
Spoiler
int __cdecl playerGetElementByVID(int a1, int a2)
{
    int result; // eax
    char v3; // al
    __int16 v4[4]; // [esp+8h] [ebp-1Ch] BYREF
    int i; // [esp+10h] [ebp-14h]
    int v6; // [esp+14h] [ebp-10h] BYREF
    _WORD *v7; // [esp+18h] [ebp-Ch] BYREF
    int v9; // [esp+20h] [ebp-4h]

    if ( !PyTuple_GetUnsignedLong(a2, 0, &v6) )
        return Py_BadArgument();
    v9 = CPythonCharacterManager;
    if ( !(*(int (__thiscall **)(int, int))(*(_DWORD *)(CPythonCharacterManager + 4) + 8))(
              CPythonCharacterManager + 4,
              v6) )
        return Py_BuildValue("i", 0);
    v3 = CInstanceBase::GetPart(6);
    if ( CItemManager::GetItemDataPointer(v3, &v7) )
    {
        for ( i = 0; i < 4; ++i )
        {
            if ( CItemData::GetApply(v7, i, (int)v4) )
            {
                switch ( v4[0] )
                {
                    case 99:
                        result = Py_BuildValue("i", 2048);
                        break;
                    case 100:
                        result = Py_BuildValue("i", 4096);
                        break;
                    case 101:
                        result = Py_BuildValue("i", 8192);
                        break;
                    case 102:
                        result = Py_BuildValue("i", 16384);
                        break;
                    case 103:
                        result = Py_BuildValue("i", 32768);
                        break;
                    case 104:
                        result = Py_BuildValue("i", 65536);
                        break;
                    default:
                        continue;
                }
                return result;
            }
        }
    }
    return Py_BuildValue("i", 0);
}

 

 

Btw this code has been completely removed after the renewal of the pendant system. They changed the way of the system, for monsters the values are inside the mob_proto, and for players: the second parameter of the CPythonNetworkStream::SendTargetPacket function requests the data which will be loaded from the server through packet (CPythonNetworkStreamPhaseGame.cpp[CPythonNetworkStream::RecvTargetPacket] --> game.py[ShowTargetElementEnchant] --> uitarget.py[ShowElementImg]).

  • Metin2 Dev 2
Link to comment
Share on other sites

10 minutes ago, xP3NG3Rx said:

I don't think so that this will help you, but here it is what you asked for.

  Reveal hidden contents
PyObject * playerGetElementByVID(PyObject* poSelf, PyObject* poArgs)
{
	DWORD dwVID = 0;
	if (!PyTuple_GetUnsignedLong(poArgs, 0, &dwVID))
		return Py_BadArgument();

	CInstanceBase * pTargetInstance = CPythonCharacterManager::Instance().GetInstancePtr(dwVID);
	if (!pTargetInstance)
		return Py_BuildValue("i", 0);

	CItemData * pPendantItem = NULL;
	const DWORD dwItemVnum = pTargetInstance->GetPart(CRaceData::PART_PENDANT);
	if (CItemManager::Instance().GetItemDataPointer(dwItemVnum, &pPendantItem))
	{
		for (BYTE i = 0; i < CItemData::ITEM_APPLY_MAX_NUM; ++i)
		{
			CItemData::TItemApply ItemApply;
			if (!pPendantItem->GetApply(i, &ItemApply))
				return Py_BuildException();

			switch (ItemApply.wType)
			{
			case CItemData::APPLY_ENCHANT_ELECT:
				return Py_BuildValue("i", CPythonNonPlayer::RACE_FLAG_ATT_ELEC);
				break;
			case CItemData::APPLY_ENCHANT_FIRE:
				return Py_BuildValue("i", CPythonNonPlayer::RACE_FLAG_ATT_FIRE);
				break;
			case CItemData::APPLY_ENCHANT_ICE:
				return Py_BuildValue("i", CPythonNonPlayer::RACE_FLAG_ATT_ICE);
				break;
			case CItemData::APPLY_ENCHANT_WIND:
				return Py_BuildValue("i", CPythonNonPlayer::RACE_FLAG_ATT_WIND);
				break;
			case CItemData::APPLY_ENCHANT_EARTH:
				return Py_BuildValue("i", CPythonNonPlayer::RACE_FLAG_ATT_EARTH);
				break;
			case CItemData::APPLY_ENCHANT_DARK:
				return Py_BuildValue("i", CPythonNonPlayer::RACE_FLAG_ATT_DARK);
				break;
			default:
				continue;
			}
		}
	}

	return Py_BuildValue("i", 0);
}
  Reveal hidden contents
int __cdecl playerGetElementByVID(int a1, int a2)
{
    int result; // eax
    char v3; // al
    __int16 v4[4]; // [esp+8h] [ebp-1Ch] BYREF
    int i; // [esp+10h] [ebp-14h]
    int v6; // [esp+14h] [ebp-10h] BYREF
    _WORD *v7; // [esp+18h] [ebp-Ch] BYREF
    int v9; // [esp+20h] [ebp-4h]

    if ( !PyTuple_GetUnsignedLong(a2, 0, &v6) )
        return Py_BadArgument();
    v9 = CPythonCharacterManager;
    if ( !(*(int (__thiscall **)(int, int))(*(_DWORD *)(CPythonCharacterManager + 4) + 8))(
              CPythonCharacterManager + 4,
              v6) )
        return Py_BuildValue("i", 0);
    v3 = CInstanceBase::GetPart(6);
    if ( CItemManager::GetItemDataPointer(v3, &v7) )
    {
        for ( i = 0; i < 4; ++i )
        {
            if ( CItemData::GetApply(v7, i, (int)v4) )
            {
                switch ( v4[0] )
                {
                    case 99:
                        result = Py_BuildValue("i", 2048);
                        break;
                    case 100:
                        result = Py_BuildValue("i", 4096);
                        break;
                    case 101:
                        result = Py_BuildValue("i", 8192);
                        break;
                    case 102:
                        result = Py_BuildValue("i", 16384);
                        break;
                    case 103:
                        result = Py_BuildValue("i", 32768);
                        break;
                    case 104:
                        result = Py_BuildValue("i", 65536);
                        break;
                    default:
                        continue;
                }
                return result;
            }
        }
    }
    return Py_BuildValue("i", 0);
}

 

 

Btw this code has been completely removed after the renewal of the pendant system. They changed the way of the system, for monsters the values are inside the mob_proto, and for players: the second parameter of the CPythonNetworkStream::SendTargetPacket function requests the data which will be loaded from the server through packet (CPythonNetworkStreamPhaseGame.cpp[CPythonNetworkStream::RecvTargetPacket] --> game.py[ShowTargetElementEnchant] --> uitarget.py[ShowElementImg]).

This was exactly what i needed, thank you!!!!!!!!!!!!!!!!!!!!! ❤️ 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

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.