首页 > 代码库 > 外挂辅助技术研究-打开指定NPC对话

外挂辅助技术研究-打开指定NPC对话

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

外挂辅助技术研究-打开指定NPC对话