1、打開指定NPC對話功能
DWORD GetNpcObjForName(char* szpNpcName);
DWORD OpenNpcTalkForName(char* szpNpcName);
//擷取指定NPC對象
push 0
push 0
push 0x401
mov ecx,2DF25598 //NPC對象位址
mov eax,[ecx]
mov eax,[eax+4] //打開NPC,測試通過
call eax
push 3
mov ecx,0XF598C0
mov ecx,[ecx]
mov ecx,[ecx+2c4]
mov ecx,[ecx+310]
mov ecx,[ecx+4]
mov eax,0x0735400
call eax //打開倉庫界面
push 3
mov ecx,BaseF1_F10ArgEcx
mov ecx,[ecx]
mov ecx,[ecx+0x2c4]
mov ecx,[ecx+0x310]
mov ecx,[ecx+0x4]
mov eax,baseCall_OpenDepot
call eax //打開倉庫界面
BOOL TRoleObj::SelNpcForName(char*szpNpcName)
{
for (int i=0;i<100;i++)
{
if (g_tMosterList.GetData()->tMonlist .szpName=NULL)
{
continue;
}
if (strcmp(g_tMosterList.GetData()->tMonlist.szpName,szpNpcName)==0)
{
SelObj(g_tMosterList.tMonlist.ndIndexForAllObjList);
return TRUE;
}
}
return FALSE;
}
BOOL TMonsterList::OpenNpcTalkForName(char* szpNpcName)
{
DWORD ndObj=GetNpcObjForName(szpNpcName);
if (ndObj==NULL)
{
return FALSE;
}
__try
{
g_tRoleobj.GetData()->SelNpcForName(szpNpcName);
__asm
{
push 0
push 0
push 0x401
mov ecx,ndObj //NPC對象位址
mov eax,[ecx]
mov eax,[eax+4] //打開NPC,測試通過
call eax
}
}__except(1)
{
DbgPrintf_Mine("BOOL TMonsterList::OpenNpcTalkForName(char* szpNpcName) \r\n");
return FALSE;
}
return TRUE;
}