// *************************************************************************** // 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"); } }
PLUGIN_API VOID SetGameState(DWORD GameState) { DebugSpew("MQ2ChatWnd::SetGameState()"); if (GameState==GAMESTATE_CHARSELECT) { if (bNoCharSelect) { // destroy chatwnd at charselect if NoCharSelect=on DestroyChatWnd(); } else { AddMQ2KeyBind("MQ2CSCHAT",DoMQ2ChatBind); KeyCombo Combo; ParseKeyCombo("/",Combo); SetMQ2KeyBind("MQ2CSCHAT",FALSE,Combo); } } else { if (GameState!=GAMESTATE_CHARCREATE) RemoveMQ2KeyBind("MQ2CSCHAT"); if (GameState==GAMESTATE_INGAME && !MQChatWnd) { // we entered the game, set up shop DebugTry(CreateChatWindow()); } } }
//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; }
void EQGamestateService(bool Broadcast, unsigned int MSG, void *lpData) { if (MSG == GAMESTATESERVICE_CHANGED) { DWORD GameState = (DWORD)lpData; if (GameState == GAMESTATE_CHARSELECT) { AddMQ2KeyBind("MQ2CSCHAT", DoMQ2ChatBind); KeyCombo Combo; ParseKeyCombo("/", Combo); SetMQ2KeyBind("MQ2CSCHAT", 0, Combo); } else { RemoveMQ2KeyBind("MQ2CSCHAT"); if (GameState == GAMESTATE_INGAME && !MQChatWnd) { // we entered the game, set up shop DebugTry(CreateChatWindow()); } } } }
HotkeyCombo::HotkeyCombo(std::wstring keyCombo, std::wstring action, bool backup) { wcscpy(this->keyCombo, keyCombo.c_str()); wcscpy(this->action, action.c_str()); modifiers = 0; ParseKeyCombo(); ID = 0; // The backup list is only used to write the original hotkey combinations to // the XML file in the event the user cancels, so don't generate an ID if (!backup) { ID = GlobalAddAtom(keyCombo.c_str()); } valid = true; }