Exemple #1
0
bool CCasinoInterface::EnterBetsize(double total_betsize_in_dollars)
{
	POINT			cur_pos = {0};
	bool			lost_focus = false;
	POINT			point_null = {-1, -1};
	CString			swag_amt;

	write_log(preferences.debug_autoplayer(), "[AutoPlayer] Starting DoSwag...\n");

	// swag regions are hard coded as #3 for now, due to legacy WH standard
	if (!p_scraper_access->i3_edit_defined || !p_scraper_access->i3_button_available)
	{
		write_log(preferences.debug_autoplayer(), "[AutoPlayer] ...ending DoSwag early (no edit field or no i3button).\n");
		return false;
	}

	SelectSwagText();

	// First sleep(), THEN check for stolen focus, then act
	//  NOT the other way: http://www.maxinmontreal.com/forums/viewtopic.php?f=120&t=14791
	write_log(preferences.debug_autoplayer(), "[AutoPlayer] Sleeping %dms.\n", preferences.swag_delay_1());
	Sleep(preferences.swag_delay_1()); 

	// Check for stolen , and thus misswag
	if (TableLostFocus())
		lost_focus = true;
	
	DeleteSwagText();

	// Check for stolen focus, and thus misswag
	if (TableLostFocus())
		lost_focus = true;

	write_log(preferences.debug_autoplayer(), "[AutoPlayer] Sleeping %dms.\n", preferences.swag_delay_2());
	
	// SWAG AMOUNT ENTRY
	double swag_adjusted = AdjustedBetsize(p_autoplayer_functions->f$betsize());

	if (swag_adjusted != (int) swag_adjusted)
		swag_amt.Format("%.2f", swag_adjusted);
	else
		swag_amt.Format("%.0f", swag_adjusted);

	write_log(preferences.debug_autoplayer(), "[AutoPlayer] Swag amount (not adjusted): %.2f\n", p_autoplayer_functions->f$betsize());
	write_log(preferences.debug_autoplayer(), "[AutoPlayer] Swag amount; calling keyboard.dll to swag (adjusted): %s %d,%d %d,%d\n", 
		swag_amt, i3_edit_region.left, i3_edit_region.top, i3_edit_region.right, i3_edit_region.bottom);
	(theApp._dll_keyboard_sendstring) (p_autoconnector->attached_hwnd(), i3_edit_region, swag_amt, preferences.swag_use_comma(), NULL, point_null);

	Sleep(preferences.swag_delay_2());
	// Check for stolen focus, and thus misswag
	if (TableLostFocus())
		lost_focus = true;

	write_log(preferences.debug_autoplayer(), "[AutoPlayer] Sleeping %dms.\n", preferences.swag_delay_3());
	Sleep(preferences.swag_delay_3());

	// BET CONFIRMATION ACTION
	if (!lost_focus)
	{
		if (p_tablemap->swagconfirmationmethod() == BETCONF_ENTER)
		{
			write_log(preferences.debug_autoplayer(), "[AutoPlayer] Confirmation; calling keyboard.dll to press 'Enter'\n");
			(theApp._dll_keyboard_sendkey) (p_autoconnector->attached_hwnd(), r_null, VK_RETURN, GetFocus(), cur_pos);
		}
		else if (p_tablemap->swagconfirmationmethod() == BETCONF_CLICKBET 
			&& p_scraper_access->available_buttons[k_autoplayer_function_raise])
		{
			write_log(preferences.debug_autoplayer(), "[AutoPlayer] Bet Confirmation: Using raise button\n");

			if (p_tablemap->buttonclickmethod() == BUTTON_DOUBLECLICK)
			{
				ClickButtonSequence(k_autoplayer_function_raise, 
					k_autoplayer_function_raise, 
					k_double_click_delay);
			}
			else
			{
				ClickButton(k_autoplayer_function_raise);
			}
		}

		else if (p_tablemap->swagconfirmationmethod() == BETCONF_NOTHING)
		{
		}

		else
		{
			write_log(preferences.debug_autoplayer(), "[AutoPlayer] ...ending DoSwag early (invalid swagconfirmationmethod).\n");
			return false;
		}
		
		write_logautoplay(ActionConstantNames(k_prevaction_betsize));

	}
	int betround = p_betround_calculator->betround();
	write_log(preferences.debug_autoplayer(), "[AutoPlayer] ...ending DoSwag, 'didswag' now: %d\n", 
		p_symbol_engine_history->didswag(betround));
	return (!lost_focus);
}
bool CCasinoInterface::EnterBetsize(double total_betsize_in_dollars) {
	POINT			cur_pos = {0};
	bool			lost_focus = false;
	POINT			point_null = {-1, -1};
	CString		swag_amt;

	write_log(preferences.debug_autoplayer(), "[CasinoInterface] Starting DoBetsize...\n");
  // In some cases only call and fold are possible.
  // Then a betsize should be skipped.
  // We detect this situation by missing min-raise button.
  // No backup-action here:
  // OH-script doesn't provide that and OPPL eill do that automatically.
  // http://www.maxinmontreal.com/forums/viewtopic.php?f=117&t=18125
  if (!p_scraper_access->available_buttons[k_autoplayer_function_raise]) {
    write_log(preferences.debug_autoplayer(), "[CasinoInterface] ...ending DoBetsize early (no (min-)raise possible).\n");
		return false;
  }
	// swag regions are hard coded as #3 for now, due to legacy WH standard
	if (!p_scraper_access->i3_edit_defined || !p_scraper_access->i3_button_available)	{
		write_log(preferences.debug_autoplayer(), "[CasinoInterface] ...ending DoBetsize early (no edit field or no i3button).\n");
		return false;
	}
  SelectSwagText();
  // First sleep(), THEN check for stolen focus, then act
	//  NOT the other way: http://www.maxinmontreal.com/forums/viewtopic.php?f=120&t=14791
  write_log(preferences.debug_autoplayer(), "[CasinoInterface] Sleeping %dms.\n", preferences.swag_delay_1());
	Sleep(preferences.swag_delay_1()); 
	// Check for stolen , and thus misswag
	if (TableLostFocus()) {
		lost_focus = true;
  }
	DeleteSwagText();
  write_log(preferences.debug_autoplayer(), "[CasinoInterface] Sleeping %dms.\n", preferences.swag_delay_2());
	Sleep(preferences.swag_delay_2());
	// Check for stolen focus, and thus misswag
	if (TableLostFocus()) {
		lost_focus = true;
  }
	// SWAG AMOUNT ENTRY
	double swag_adjusted = AdjustedBetsize(total_betsize_in_dollars);
	swag_amt = Number2CString(swag_adjusted);
  // Also adapt f$betsize for correct logging later-on
  // http://www.maxinmontreal.com/forums/viewtopic.php?f=156&t=18648
  p_function_collection->SetAutoplayerFunctionValue(k_autoplayer_function_betsize, swag_adjusted);
	write_log(preferences.debug_autoplayer(), "[CasinoInterface] betsize (not adjusted): %.2f\n", total_betsize_in_dollars);
	write_log(preferences.debug_autoplayer(), "[CasinoInterface] calling keyboard.dll to enter betsize (adjusted): %s %d,%d %d,%d\n", 
		swag_amt, i3_edit_region.left, i3_edit_region.top, i3_edit_region.right, i3_edit_region.bottom);
  bool use_comma_instead_of_dot = p_tablemap->use_comma_instead_of_dot();
	(theApp._dll_keyboard_sendstring) (p_autoconnector->attached_hwnd(), i3_edit_region, 
    swag_amt, use_comma_instead_of_dot, NULL, point_null);

	write_log(preferences.debug_autoplayer(), "[CasinoInterface] Sleeping %dms.\n", preferences.swag_delay_3());
	Sleep(preferences.swag_delay_3());
	// Check for stolen focus, and thus misswag
	if (TableLostFocus()) {
    lost_focus = true;
  }
  // BET CONFIRMATION ACTION
	if (lost_focus) {
    // Print a very verbose warning in the log
    // Experience tell that beginenrs (and veterans) need that.
    write_log(k_always_log_errors, "[CasinoInterface] WARNING! Betsizing failed because of lost focus.\n");
    write_log(k_always_log_errors, "[CasinoInterface] Another window popped up and receives mouse and keyboard input.\n");
    write_log(k_always_log_errors, "[CasinoInterface] This might be caused by bad casino, bad hopper or by user-interaction.\n");
  } else {
		if (p_tablemap->swagconfirmationmethod() == BETCONF_ENTER) 	{
			write_log(preferences.debug_autoplayer(), "[CasinoInterface] Confirmation; calling keyboard.dll to press 'Enter'\n");
			(theApp._dll_keyboard_sendkey) (p_autoconnector->attached_hwnd(), r_null, VK_RETURN, GetFocus(), cur_pos);
		}	else if (p_tablemap->swagconfirmationmethod() == BETCONF_CLICKBET 
			  && p_scraper_access->available_buttons[k_autoplayer_function_raise]) 	{
			write_log(preferences.debug_autoplayer(), "[CasinoInterface] Bet Confirmation: Using raise button\n");
      if (p_tablemap->buttonclickmethod() == BUTTON_DOUBLECLICK) 	{
				ClickButtonSequence(k_autoplayer_function_raise, 
					k_autoplayer_function_raise, 
					k_double_click_delay);
			}	else {
				ClickButton(k_autoplayer_function_raise);
			}
		}	else if (p_tablemap->swagconfirmationmethod() == BETCONF_NOTHING)	{
		} else {
			write_log(preferences.debug_autoplayer(), "[CasinoInterface] ...ending DoBetsize early (invalid betsizeconfirmationmethod).\n");
      write_log(preferences.debug_autoplayer(), "[CasinoInterface] Valid options are: \"enter\", \"click bet\", \"nothing\"\n");
			return false;
		}
		p_autoplayer_trace->Print(ActionConstantNames(k_autoplayer_function_betsize), true);
	}
	int betround = p_betround_calculator->betround();
	write_log(preferences.debug_autoplayer(), "[CasinoInterface] ...ending DoBetsize, 'didbetsize' now: %d\n", 
		p_symbol_engine_history->didswag(betround));
	return (!lost_focus);
}
Exemple #3
0
bool CCasinoInterface::EnterBetsize(double total_betsize_in_dollars)
{
	POINT			cur_pos = {0};
	bool			lost_focus = false;
	POINT			point_null = {-1, -1};
	CString			swag_amt;

	write_log(prefs.debug_autoplayer(), "[AutoPlayer] Starting DoSwag...\n");

	// swag regions are hard coded as #3 for now, due to legacy WH standard
	if (!p_scraper_access->i3_edit_defined)
	{
		write_log(prefs.debug_autoplayer(), "[AutoPlayer] ...ending DoSwag early (no edit field).\n");
		return false;
	}

	SelectSwagText();

	// First sleep(), THEN check for stolen focus
	write_log(prefs.debug_autoplayer(), "[AutoPlayer] Sleeping %dms.\n", prefs.swag_delay_1());
	Sleep(prefs.swag_delay_1()); 

	// Check for stolen , and thus misswag
	if (GetForegroundWindow() != p_autoconnector->attached_hwnd())
		lost_focus = true;
	
	DeleteSwagText();

	// Check for stolen focus, and thus misswag
	if (GetForegroundWindow() != p_autoconnector->attached_hwnd())
		lost_focus = true;

	write_log(prefs.debug_autoplayer(), "[AutoPlayer] Sleeping %dms.\n", prefs.swag_delay_2());
	
	// SWAG AMOUNT ENTRY
	double swag_adjusted = SwagAmountAdjusted(p_autoplayer_functions->f$betsize());

	if (swag_adjusted != (int) swag_adjusted)
		swag_amt.Format("%.2f", swag_adjusted);
	else
		swag_amt.Format("%.0f", swag_adjusted);

	write_log(prefs.debug_autoplayer(), "[AutoPlayer] Swag amount (not adjusted): %.2f\n", p_autoplayer_functions->f$betsize());
	write_log(prefs.debug_autoplayer(), "[AutoPlayer] Swag amount; calling keyboard.dll to swag (adjusted): %s %d,%d %d,%d\n", 
		swag_amt, i3_edit_region.left, i3_edit_region.top, i3_edit_region.right, i3_edit_region.bottom);
	(theApp._dll_keyboard_sendstring) (p_autoconnector->attached_hwnd(), i3_edit_region, swag_amt, prefs.swag_use_comma(), NULL, point_null);

	Sleep(prefs.swag_delay_2());
	// Check for stolen focus, and thus misswag
	if (GetForegroundWindow() != p_autoconnector->attached_hwnd())
		lost_focus = true;

	write_log(prefs.debug_autoplayer(), "[AutoPlayer] Sleeping %dms.\n", prefs.swag_delay_3());
	Sleep(prefs.swag_delay_3());

	// BET CONFIRMATION ACTION
	if (!lost_focus)
	{
		if (p_tablemap->swagconfirmationmethod() == BETCONF_ENTER)
		{
			write_log(prefs.debug_autoplayer(), "[AutoPlayer] Confirmation; calling keyboard.dll to press 'Enter'\n");
			(theApp._dll_keyboard_sendkey) (p_autoconnector->attached_hwnd(), r_null, VK_RETURN, GetFocus(), cur_pos);
		}
		else if (p_tablemap->swagconfirmationmethod() == BETCONF_CLICKBET &&
				 (p_scraper_access->available_buttons[k_autoplayer_function_raise] || p_scraper_access->i3_button_available))
		{
			int confirmation_button = k_button_undefined;

			// use i3button region if it exists, otherwise use the bet/raise button region
			if (p_scraper_access->i3_button_available)
			{
				confirmation_button = k_button_i3;
				write_log(prefs.debug_autoplayer(), "[AutoPlayer] Bet Confirmation: Using i3button\n");
			}
			else
			{
				confirmation_button = k_button_raise;
				write_log(prefs.debug_autoplayer(), "[AutoPlayer] Bet Confirmation: Using raise button\n");
			}

			if (p_tablemap->buttonclickmethod() == BUTTON_DOUBLECLICK)
			{
				ClickButtonSequence(confirmation_button, confirmation_button, k_double_click_delay);
			}
			else
			{
				ClickButton(confirmation_button);
			}
		}

		else if (p_tablemap->swagconfirmationmethod() == BETCONF_NOTHING)
		{
		}

		else
		{
			write_log(prefs.debug_autoplayer(), "[AutoPlayer] ...ending DoSwag early (invalid swagconfirmationmethod).\n");
			return false;
		}
		
		p_symbols->RecordPrevAction(k_action_betsize);
		write_logautoplay(ActionConstantNames(k_action_betsize));

		p_heartbeat_thread->set_replay_recorded_this_turn(false);
	}
	int betround = p_betround_calculator->betround();
	write_log(prefs.debug_autoplayer(), "[AutoPlayer] ...ending DoSwag, 'didswag' now: %d\n", 
		p_symbol_engine_history->didswag(betround));
	return (!lost_focus);
}