[Fix] V21 Dungeon NPC

03/19/2022 19:15 Ssam_#1
Hi everyone,

V21 WorldDialog doesn't contain the code for the NPC that teleports you into the Contamined Trails dungeon.
More infos about this dungeon and how to enter it [Only registered and activated users can see links. Click Here To Register...].

Here's the fix for this! (Note that in the server source, the define for this is SCRIPT_ENTER_INSTANCEDUNGEON).

Quote:
+ in WorldDialog/FunctionsInfo.h

Find
Code:
typedef int (WINAPI *PFAddGPPoint)( NPCDIALOG_INFO* pInfo , int nAddGPPoint );
Add right after
Code:
typedef int	(WINAPI* PFEnterInstanceDungeon)(NPCDIALOG_INFO* pInfo, DWORD dwTeleWorld, int nX, int nY, int nZ);
typedef int	(WINAPI* PFChkPartyLowLevel)(NPCDIALOG_INFO* pInfo, int nLv);
Find
Code:
PFAddGPPoint AddGPPoint;
Add right after
Code:
PFEnterInstanceDungeon EnterInstanceDungeon;
PFChkPartyLowLevel ChkPartyLowLevel;
+ in WorldDialog/NpcScript.cpp

Find the g_nKeys array, go at the end, you should have something like this
Code:
42,
43,
865,
866,
};
Add right after 866,
Code:
1812,
Find
Code:
if (::strcmp("AddGPPoint", szFunc) == 0)
{
	/*kNPCScript.*/AddGPPoint(args.at(0));
	return 0;
}
Add right after
Code:
if (::strcmp("EnterInstanceDungeon", szFunc) == 0)
{
	return EnterInstanceDungeon(static_cast<DWORD>(args.at(0)), args.at(1), args.at(2), args.at(3));
}
if (::strcmp("ChkPartyLowLevel", szFunc) == 0)
{
	return ChkPartyLowLevel(args.at(0));
}
+ in WorldDialog/NpcScript.h

Find
Code:
void	AddGPPoint( int nAddGPPoint );
Add right after
Code:
int	EnterInstanceDungeon(DWORD dwTeleWorld, int nX, int nY, int nZ);
int	ChkPartyLowLevel(int nLvl);
+ in WorldDialog/NpcScriptHelper.cpp

Find
Code:
void CNpcScript::AddGPPoint( int nAddGPPoint )
{
	if( m_pInfo != NULL )
	{
		Functions* pTable = m_pInfo->GetFunctions();
		if( pTable != NULL )
		{
			pTable->AddGPPoint( m_pInfo , nAddGPPoint );
		}
	}
}
Add right after
Code:
int CNpcScript::EnterInstanceDungeon(DWORD dwTeleWorld, int nX, int nY, int nZ)
{
	if (m_pInfo != NULL)
	{
		Functions* pTable = m_pInfo->GetFunctions();
		if (pTable != NULL)
		{
			return pTable->EnterInstanceDungeon(m_pInfo, dwTeleWorld, nX, nY, nZ);
		}
	}
	return 0;
}

int CNpcScript::ChkPartyLowLevel(int nLvl)
{
	if (m_pInfo != NULL)
	{
		Functions* pTable = m_pInfo->GetFunctions();
		if (pTable != NULL)
		{
			return pTable->ChkPartyLowLevel(m_pInfo, nLvl);
		}
	}
	return 0;
}
Hope this kind of release will encourage you to use V21 :cool:

Ssam.
03/20/2022 17:29 xTwiLightx#2
You forgot to add both functions to the Functions struct. :)

FunctionsInfo.h, below
Code:
PFAddGPPoint AddGPPoint;
add those
Code:
	PFEnterInstanceDungeon EnterInstanceDungeon;
	PFChkPartyLowLevel ChkPartyLowLevel;
03/20/2022 20:40 Ssam_#3
Quote:
Originally Posted by xTwiLightx View Post
You forgot to add both functions to the Functions struct. :)

FunctionsInfo.h, below
Code:
PFAddGPPoint AddGPPoint;
add those
Code:
	PFEnterInstanceDungeon EnterInstanceDungeon;
	PFChkPartyLowLevel ChkPartyLowLevel;
Thanks I updated the thread !