DWORD __stdcall searchthread(PVOID pData) { lockit lk(bzsrchhandle); if (CSidlScreenWnd *ptr = (CSidlScreenWnd *)pBazaarSearchWnd->GetChildItem("BZR_QueryButton")) { ULONGLONG startwait = MQGetTickCount64(); startwait += 5000; while (ptr->Enabled == 0) { Sleep(100); if (startwait < MQGetTickCount64()) { MacroError("timed out in /bzsrch waiting for BZR_QueryButton to enable."); break; } } if (ptr->Enabled) { if (CListWnd *ptr = (CListWnd *)pBazaarSearchWnd->GetChildItem("BZR_ItemList")) { ptr->DeleteAll(); } BzCount = 0; BzDone = 0; SendWndClick2((CXWnd*)ptr, "leftmouseup"); } else { MacroError("woah! hold your horses there bazaarmule... BZR_QueryButton is not enabled, I suggest you check that in your macro before you issue a /bzsrch command."); } } return 0; }
DWORD __stdcall openpickzonewnd(PVOID pData) { if(!cmdPickZone) return 0; lockit lk(ghLockPickZone); int nInst = (int)pData; CHAR szInst[32] = { 0 }; itoa(nInst, szInst, 10); if (PCHARINFO pCharInfo = GetCharInfo()) { cmdPickZone(pCharInfo->pSpawn, NULL); Sleep(2000);//i need to make this hardcoded wait dynamic but im in a hurry ill do it later -eqmule if (CXWnd *krwnd = FindMQ2Window("MIZoneSelectWnd")) { if (krwnd->dShow) { if (CListWnd *clist = (CListWnd*)krwnd->GetChildItem("MIZ_ZoneList")) { if (DWORD numitems = ((CSidlScreenWnd*)clist)->Items) { if (CButtonWnd *cbutt = (CButtonWnd*)krwnd->GetChildItem("MIZ_SelectButton")) { CHAR szOut[255] = { 0 }; CXStr Str; std::string s; bool itsmain = false; bool clickit = false; for (DWORD i = 0; i<numitems; i++) { clist->GetItemText(&Str, i, 0); GetCXStr(Str.Ptr, szOut, 254); if (szOut[0] != '\0') { s = szOut; if (std::string::npos == s.find_first_of("123456789")) { itsmain = true; } if (itsmain && nInst == 0) { clickit = true; } else if (nInst >= 1) { if (std::string::npos != s.find_first_of(szInst)) { clickit = true; } } if (clickit) { SendListSelect("MIZoneSelectWnd", "MIZ_ZoneList", i); Sleep(500); SendWndClick2((CXWnd*)cbutt, "leftmouseup"); WriteChatf("%s selected.", szOut); return 0; } } } WriteChatf("%s instance %d NOT found in list", GetFullZone(pCharInfo->zoneId), nInst); } } } } } } return 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; }
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; }
VOID BZQuery(PSPAWNINFO pChar, PCHAR szLine) { if (CSidlScreenWnd *pQueryButton = (CSidlScreenWnd *)pBazaarSearchWnd->GetChildItem("BZR_QueryButton")) { SendWndClick2((CXWnd*)pQueryButton, "leftmouseup"); } }