// ***************************************************************************
// Function:    Cleanup
// Description: Our '/cleanup' command
//              Sends i, esc, esc, esc, esc, i
// Usage:       /cleanup
// ***************************************************************************
VOID Cleanup(PSPAWNINFO pChar, PCHAR szLine)
{
    DebugSpewNoFile("Cleanup - Cleaning up screen");
    DWORD i;
    KeyCombo Escape;
    ParseKeyCombo("Esc",Escape);
    if(ppContainerMgr && pContainerMgr) {
        PEQ_CONTAINERWND_MANAGER ContainerMgr = (PEQ_CONTAINERWND_MANAGER)pContainerMgr;
        DWORD concount=2; //Close inv + clear target
        if (ContainerMgr->pWorldContents && ContainerMgr->pWorldContents->Open==1) concount++;
        for (i=0;i<25;i++) {
            if (ContainerMgr->pPCContainers[i] && ContainerMgr->pPCContainers[i]->Wnd.dShow==1) concount++;
        }
        for (i=0;i<concount;i++) 
        {
            MQ2HandleKeyDown(Escape);
            MQ2HandleKeyUp(Escape);
        }
        if (!ppInventoryWnd) {
            PCSIDLWND pInvWindow = (PCSIDLWND)pInventoryWnd;
            if (pInvWindow && pInvWindow->dShow==0) 
                DoMappable(pChar,"inventory");
        }
    } else {
        DoMappable(pChar,"inventory");
        for (i=0;i<10;i++) 
        {
            MQ2HandleKeyDown(Escape);
            MQ2HandleKeyUp(Escape);
        }
        DoMappable(pChar,"inventory");
    }
}
Exemple #2
0
//EQLIB_API VOID DoMappable(PSPAWNINFO pChar, PCHAR szLine)
int CMD_Keypress(int argc, char *argv[])
{
	if (argc<2)
	{
		WriteChatf("Syntax: %s <eqcommand|keycombo> [hold|chat]",argv[0]);
		return 0;
	}
	bool bHold=false;
	bool bChat=false;
	if (argc==3)
	{
		if (!stricmp(argv[2],"hold"))
		{
			bHold=true;
		}
		else if (!stricmp(argv[2],"chat"))
		{
			bChat=true;
		}
	}
	if (!PressMQ2KeyBind(argv[1],bHold))
	{
		int N=FindMappableCommand(argv[1]);
		if (N>=0)
		{
			ExecuteCmd(N,1,0);
			if (!bHold)
				ExecuteCmd(N,0,0);
			return 0;
		}
		KeyCombo Temp;
		if (ParseKeyCombo(argv[1],Temp))
		{
			if (bChat)
			{
				pWndMgr->HandleKeyboardMsg(Temp.Data[3],1);
				pWndMgr->HandleKeyboardMsg(Temp.Data[3],0);
			}
			else
			{
				MQ2HandleKeyDown(Temp);
				if (!bHold)
					MQ2HandleKeyUp(Temp);
			}
			return 0;
		}

		WriteChatf("Invalid mappable command or key combo '%s'",argv[1]);
		return -1;
	}
	return 0;
}