VOID DoMQ2ChatBind(PCHAR Name, BOOL Down) { if (!Down) { if (MQChatWnd != NULL) { CXRect rect = ((CXWnd*)MQChatWnd->InputBox)->GetScreenRect(); CXPoint pt = rect.CenterPoint(); ((CXWnd*)MQChatWnd->InputBox)->SetWindowTextA(CXStr("")); ((CXWnd*)MQChatWnd->InputBox)->HandleLButtonDown(&pt, 0); } } }
VOID BzSrchMe(PSPAWNINFO pChar, PCHAR szLine) { lockit lk(bzsrchhandle); CHAR szArg[MAX_STRING] = { 0 }; CHAR szItem[MAX_STRING] = { 0 }; PCHARINFO pCharInfo = GetCharInfo(); BOOL bArg = TRUE; bool first = true; if (CButtonWnd *ptr = (CButtonWnd *)pBazaarSearchWnd->GetChildItem("BZR_Default")) { SendWndClick2((CXWnd*)ptr, "leftmouseup"); } while (bArg) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); if (szArg[0] == 0) { bArg = FALSE; } else if (!strcmp(szArg, "class")) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); DoClass(szArg); } else if (!_stricmp(szArg, "race")) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); DoRace(szArg); } else if (!_stricmp(szArg, "stat")) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); DoCombo(szArg, "Stat", "BZR_StatSlotCombobox"); } else if (!_stricmp(szArg, "slot")) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); DoCombo(szArg, "Slot", "BZR_ItemSlotCombobox"); } else if (!_stricmp(szArg, "type")) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); DoCombo(szArg, "Type", "BZR_ItemTypeCombobox"); } else if (!strcmp(szArg, "price")) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); if (szArg[0] == 0) { MacroError("Bad price low."); goto error_out; } if (CXWnd *pEdit = (CXWnd *)pBazaarSearchWnd->GetChildItem("BZR_MinPriceInput")) { pEdit->SetWindowTextA(CXStr(szArg)); } GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); if (szArg[0] == 0) { MacroError("Bad price high."); goto error_out; } if (CXWnd *pEdit = (CXWnd *)pBazaarSearchWnd->GetChildItem("BZR_MaxPriceInput")) { pEdit->SetWindowTextA(CXStr(szArg)); } } else if (!_stricmp(szArg, "trader")) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); DoCombo(szArg, "Trader", "BZR_PlayersCombobox"); } else if (!_stricmp(szArg, "prestige")) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); DoCombo(szArg, "Prestige", "BZR_ItemPrestigeCombobox"); } else if (!_stricmp(szArg, "augment")) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); DoCombo(szArg, "Augment", "BZR_ItemAugmentCombobox"); } else { if (first) { first = false; } else { strcat(szItem, " "); } strcat(szItem, szArg); } } if (CXWnd *pEdit = (CXWnd *)pBazaarSearchWnd->GetChildItem("BZR_ItemNameInput")) { pEdit->SetWindowTextA(CXStr(szItem)); DWORD nThreadID = 0; CreateThread(NULL, NULL, searchthread, 0, 0, &nThreadID); } error_out: return; }
int WndNotification(CXWnd *pWnd, unsigned int Message, void *data) { if (pWnd==(CXWnd*)InputBox) { if (Message==XWM_HITENTER) { char szBuffer[MAX_STRING] = { 0 }; GetCXStr((PCXSTR)InputBox->InputText,szBuffer, MAX_STRING); if (szBuffer[0]) { if (!sCmdHistory.size() || sCmdHistory.front().compare(szBuffer)) { if (sCmdHistory.size()>CMD_HIST_MAX) { sCmdHistory.pop_back(); } sCmdHistory.insert(sCmdHistory.begin(),string(szBuffer)); } iCurrentCmd=-1; //bool bScrollDown=bAutoScroll?true:(MQChatWnd->OutputBox->VScrollPos==MQChatWnd->OutputBox->VScrollMax?true:false); //char szProcessed[MAX_STRING]; //MQToSTML(szBuffer,szProcessed,MAX_STRING); //strcat_s(szProcessed,"<br>"); //CXStr NewText(szProcessed); //OutputBox->AppendSTML(NewText); //if (bScrollDown) ((CXWnd*)MQChatWnd->OutputBox)->SetVScrollPos(MQChatWnd->OutputBox->VScrollMax); SetCXStr(&InputBox->InputText,""); if (szBuffer[0]=='/') { DoCommand(((PCHARINFO)pCharData)->pSpawn,szBuffer); } else { Echo(((PCHARINFO)pCharData)->pSpawn,szBuffer); } } ((CXWnd*)InputBox)->ClrFocus(); } else if (Message == XWM_HISTORY) { if (data) { int* pInt=(int*)data; int iKeyPress=pInt[1]; if (iKeyPress==0xc8) // KeyUp { if (sCmdHistory.size()>0) { iCurrentCmd++; if (iCurrentCmd<((int)sCmdHistory.size()) && iCurrentCmd>=0) { string s=(string)sCmdHistory.at(iCurrentCmd); ((CXWnd*)InputBox)->SetWindowTextA(CXStr(s.c_str())); } else { iCurrentCmd=((int)sCmdHistory.size())-1; } } } else if (iKeyPress==0xd0) // KeyDown { if (sCmdHistory.size()>0) { iCurrentCmd--; if (iCurrentCmd>=0 && sCmdHistory.size()>0) { string s=(string)sCmdHistory.at(iCurrentCmd); ((CXWnd*)InputBox)->SetWindowTextA(CXStr(s.c_str())); } else if (iCurrentCmd<0) { iCurrentCmd=-1; SetCXStr(&InputBox->InputText,""); } } } } } else { DebugSpew("InputBox message %Xh, value: %Xh",Message,data); } } else if (pWnd==0) { if (Message==XWM_CLOSE) { dShow=1; return 1; } } else if (Message==XWM_LINK) { class CChatWindow *p = (class CChatWindow *)this; if (OutputBox!=(CStmlWnd *)pWnd) { CStmlWnd *tmp; int ret; //DebugSpew("MQ2ChatWnd: 0x%X, Msg: 0x%X, value: %Xh",pWnd,Message,data); //DebugSpew("MQ2ChatWnd: pWnd 0x%x != OutputBox 0x%x\n",pWnd,OutputBox); tmp=OutputBox; OutputBox=(CStmlWnd*)pWnd; ret=p->WndNotification(pWnd,Message,data); OutputBox=tmp; return ret; } return p->WndNotification(pWnd,Message,data); } else { //DebugSpew("MQ2ChatWnd: 0x%X, Msg: 0x%X, value: %Xh",pWnd,Message,data); } return CSidlScreenWnd::WndNotification(pWnd,Message,data); };
VOID BzSrchMe(PSPAWNINFO pChar, PCHAR szLine) { lockit lk(bzsrchhandle,"BzSrchMe"); BzDone = FALSE; CHAR szArg[MAX_STRING] = { 0 }; CHAR szItem[MAX_STRING] = { 0 }; PCHARINFO pCharInfo = GetCharInfo(); BOOL bArg = TRUE; bool first = true; if (CButtonWnd *pDefaultButton = (CButtonWnd *)pBazaarSearchWnd->GetChildItem("BZR_Default")) { if (pDefaultButton && pDefaultButton->Enabled) { SendWndClick2((CXWnd*)pDefaultButton, "leftmouseup"); } else { MacroError("Whats wrong? BZR_Default wasnt enabled."); } } else { MacroError("Whats wrong? Counldnt find the BZR_Default window."); } if (CListWnd *pList = (CListWnd *)pBazaarSearchWnd->GetChildItem("BZR_ItemList")) { pList->DeleteAll(); } BzCount = 0; while (bArg) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); if (szArg[0] == 0) { bArg = FALSE; } else if (!strcmp(szArg, "class")) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); DoClass(szArg); } else if (!_stricmp(szArg, "race")) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); DoRace(szArg); } else if (!_stricmp(szArg, "stat")) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); DoCombo(szArg, "Stat", "BZR_StatSlotCombobox"); } else if (!_stricmp(szArg, "slot")) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); DoCombo(szArg, "Slot", "BZR_ItemSlotCombobox"); } else if (!_stricmp(szArg, "type")) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); DoCombo(szArg, "Type", "BZR_ItemTypeCombobox"); } else if (!strcmp(szArg, "price")) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); if (szArg[0] == 0) { MacroError("Bad price low."); goto error_out; } if (CXWnd *pEdit = (CXWnd *)pBazaarSearchWnd->GetChildItem("BZR_MinPriceInput")) { pEdit->SetWindowTextA(CXStr(szArg)); } GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); if (szArg[0] == 0) { MacroError("Bad price high."); goto error_out; } if (CXWnd *pEdit = (CXWnd *)pBazaarSearchWnd->GetChildItem("BZR_MaxPriceInput")) { pEdit->SetWindowTextA(CXStr(szArg)); } } else if (!_stricmp(szArg, "trader")) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); DoCombo(szArg, "Trader", "BZR_PlayersCombobox"); } else if (!_stricmp(szArg, "prestige")) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); DoCombo(szArg, "Prestige", "BZR_ItemPrestigeCombobox"); } else if (!_stricmp(szArg, "augment")) { GetArg(szArg, szLine, 1); szLine = GetNextArg(szLine, 1); DoCombo(szArg, "Augment", "BZR_ItemAugmentCombobox"); } else { if (first) { first = false; } else { strcat_s(szItem, " "); } strcat_s(szItem, szArg); } } if (CXWnd *pMaxEdit = (CXWnd *)pBazaarSearchWnd->GetChildItem("BZR_MaxResultsPerTraderInput")) { pMaxEdit->SetWindowTextA(CXStr("200")); } else { MacroError("Whats wrong? couldnt find the BZR_MaxResultsPerTraderInput window."); } if (CXWnd *pEdit = (CXWnd *)pBazaarSearchWnd->GetChildItem("BZR_ItemNameInput")) { pEdit->SetWindowTextA(CXStr(szItem)); DWORD nThreadID = 0; CreateThread(NULL, NULL, searchthread, 0, 0, &nThreadID); } else { MacroError("Whats wrong? couldnt find the BZR_ItemNameInput window."); } error_out: return; }