コード例 #1
0
bool CCasinoInterface::ClickI86ButtonIfAvailable(int button_number) {
	assert(button_number >= 0);
	assert(button_number < k_max_number_of_i86X_buttons);
  if (p_scraper_access->i86X_button_available[button_number])	{
		CMyMutex	mutex;
    if (!mutex.IsLocked()) return false;
		write_log(preferences.debug_autoplayer(), "[CasinoInterface] Found valid i86X (%d) button and clicked it.\n", button_number);
		ClickRect(i86X_button[button_number]);
		return true;
	}
  return false;
}
コード例 #2
0
bool CAutoplayer::ExecutePrimaryFormulasIfNecessary() {
	write_log(preferences.debug_autoplayer(), "[AutoPlayer] ExecutePrimaryFormulasIfNecessary()\n");
	if (!AnyPrimaryFormulaTrue())
	{
		write_log(preferences.debug_autoplayer(), "[AutoPlayer] No primary formula true. Nothing to do\n");
		return false;
	}
	// Execute beep (if necessary) independent of all other conditions (mutex, etc.)
	// and with autoplayer-actions.
	ExecuteBeep();

	assert(p_symbol_engine_autoplayer->isfinalanswer());
	assert(p_symbol_engine_autoplayer->ismyturn());
	// Precondition: my turn and isfinalanswer
	// So we have to take an action and are able to do so.
	// This function will ALWAYS try to click a button,
	// so we can handle the preparation once at the very beginning.
	CMyMutex mutex;

	if (!mutex.IsLocked())
	{
		return false;
	}

	PrepareActionSequence();

	if (p_function_collection->EvaluateAutoplayerFunction(k_autoplayer_function_allin))
	{
		if (DoAllin())
		{
			return true;
		}
		// Else continue with swag and betpot
	}
	if (DoBetPot())
	{
		return true;
	}
	if (DoBetsize())
	{
		return true;
	}
	return ExecuteRaiseCallCheckFold();
}
コード例 #3
0
bool CAutoplayer::ExecuteSecondaryFormulasIfNecessary() {
	int executed_secondary_function = kUndefined;
	if (!AnySecondaryFormulaTrue())	{
		write_log(preferences.debug_autoplayer(), "[AutoPlayer] All secondary formulas false.\n");
		write_log(preferences.debug_autoplayer(), "[AutoPlayer] Nothing to do.\n");
		return false;
	}

	CMyMutex mutex;

	if (!mutex.IsLocked())
	{
		return false;
	}

	PrepareActionSequence();
	// Prefold, close, rebuy and chat work require different treatment,
	// more than just clicking a simple region...
	if (p_autoplayer_functions->GetAutoplayerFunctionValue(k_standard_function_prefold)) {
		// Prefold is technically more than a simple button-click,
		// because we need to create an autoplayer-trace afterwards.
		if (DoPrefold()) {
			executed_secondary_function = k_standard_function_prefold;
		}
	}
	else if (p_autoplayer_functions->GetAutoplayerFunctionValue(k_hopper_function_close))	{
		// CloseWindow is "final".
		// We don't expect any further action after that
		// and can return immediatelly.
		if (p_casino_interface->CloseWindow()) {
			executed_secondary_function = k_hopper_function_close;
		}
	}
	else if (p_autoplayer_functions->GetAutoplayerFunctionValue(k_hopper_function_rebuy))	{
		// This requires an external script and some time.
		// No further actions here eihter, but immediate return.
		p_rebuymanagement->TryToRebuy();
		// No waz to check for success here
		executed_secondary_function = k_hopper_function_rebuy;
	}
	else if (p_autoplayer_functions->GetAutoplayerFunctionValue(k_standard_function_chat)) 	{
			if (DoChat()) {
				executed_secondary_function = k_standard_function_chat;
			}
	}
	// Otherwise: handle the simple simple button-click
	// k_hopper_function_sitin,
	// k_hopper_function_sitout,
	// k_hopper_function_leave,
  // k_hopper_function_rematch,
	// k_hopper_function_autopost,
	else 
    for (int i=k_hopper_function_sitin; i<=k_hopper_function_autopost; ++i)	{
		if (p_autoplayer_functions->GetAutoplayerFunctionValue(i))	{
			if (p_casino_interface->ClickButton(i)) {
				executed_secondary_function = i;
				break;
			}
		}
	}
	if (executed_secondary_function != kUndefined) {
		FinishActionSequenceIfNecessary();
		p_autoplayer_trace->Print(ActionConstantNames(executed_secondary_function), false);
		return true;
	}
	action_sequence_needs_to_be_finished = false;
	return false;
}
コード例 #4
0
void CheckBringKeyboard(void) {
	HMENU			bringsysmenu = NULL;
	MENUITEMINFO mii;
	int				input_count = 0, i = 0;
	INPUT			input[100] = {0};
	char			temp[256] = {0};
	CString		c_text = "";
	int				keybd_item_pos = 0;
	int				e = SUCCESS;

	if (!p_symbol_engine_casino->ConnectedToBring()) 	{
		 write_log(preferences.debug_autoplayer(), "[BringKeyBoard] Not connected to bring, therefore no bring-keyboard to be enabled.\n");
		return;
	}

	 write_log(preferences.debug_autoplayer(), "[BringKeyBoard] Connected to bring.\n");
	 write_log(preferences.debug_autoplayer(), "[BringKeyBoard] Enabling bring-keyboard if necessary.\n");

	// Init locals
	memset(&mii, 0, sizeof(MENUITEMINFO));

	// Find position of "Keyboard" item on system menu
	bringsysmenu = GetSystemMenu(p_autoconnector->attached_hwnd(), false);

	mii.cbSize = sizeof(MENUITEMINFO);
	mii.fMask = MIIM_STRING;
	mii.fType = MFT_STRING;
	mii.dwTypeData = temp;
	keybd_item_pos = kUndefined;
	for (int i=GetMenuItemCount(bringsysmenu)-1; i>=0; --i)	{
		mii.cch = 256;
	
		// Get the text of this menu item
		GetMenuItemInfo(bringsysmenu, i, true, &mii);
		c_text = temp;

		// See if this is the "keyboard" menu item
		if (c_text.MakeLower().Find("keyboard") != -1) {
			keybd_item_pos = i;
			continue;
		}
	}

	// Get state of keyboard menu item
	if (keybd_item_pos == kUndefined) {
		return;
  }
	mii.cbSize = sizeof(MENUITEMINFO);
	mii.fMask = MIIM_STATE;
	GetMenuItemInfo(bringsysmenu, keybd_item_pos, true, &mii);
	
	if (!(mii.fState&MFS_CHECKED)) 	{
		HWND			hwnd_focus;
		POINT			cur_pos = {0};

		input_count = 0;
		// Alt key down
		ZeroMemory(&input[input_count],sizeof(INPUT));
		input[input_count].type = INPUT_KEYBOARD;
		input[input_count].ki.wVk = VK_MENU;
		input_count++;

		// Space bar down
		ZeroMemory(&input[input_count],sizeof(INPUT));
		input[input_count].type = INPUT_KEYBOARD;
		input[input_count].ki.wVk = VK_SPACE;
		input_count++;

		// Space bar up
		ZeroMemory(&input[input_count],sizeof(INPUT));
		input[input_count].type = INPUT_KEYBOARD;
		input[input_count].ki.wVk = VK_SPACE;
		input[input_count].ki.dwFlags = KEYEVENTF_KEYUP;
		input_count++;

		// Alt key up
		ZeroMemory(&input[input_count],sizeof(INPUT));
		input[input_count].type = INPUT_KEYBOARD;
		input[input_count].ki.wVk = VK_MENU;
		input[input_count].ki.dwFlags = KEYEVENTF_KEYUP;
		input_count++;

		CMyMutex mutex;
    if (!mutex.IsLocked()) return;

		hwnd_focus = GetFocus();
		GetCursorPos(&cur_pos);

		SetFocus(p_autoconnector->attached_hwnd());
		SetForegroundWindow(p_autoconnector->attached_hwnd());
		SetActiveWindow(p_autoconnector->attached_hwnd());
		SendInput(input_count, input, sizeof(INPUT));

		Sleep(200);
    input_count = 0;
		// K down
		ZeroMemory(&input[input_count],sizeof(INPUT));
		input[input_count].type = INPUT_KEYBOARD;
		input[input_count].ki.wVk = 'K';
		input_count++;

		// K up
		ZeroMemory(&input[input_count],sizeof(INPUT));
		input[input_count].type = INPUT_KEYBOARD;
		input[input_count].ki.wVk = 'K';
		input[input_count].ki.dwFlags = KEYEVENTF_KEYUP;
		input_count++;

		SetFocus(p_autoconnector->attached_hwnd());
		SetForegroundWindow(p_autoconnector->attached_hwnd());
		SetActiveWindow(p_autoconnector->attached_hwnd());
		SendInput(input_count, input, sizeof(INPUT));

		SetActiveWindow(hwnd_focus);
		SetForegroundWindow(hwnd_focus);
		SetFocus(hwnd_focus);

		SetCursorPos(cur_pos.x, cur_pos.y);
	}
}