Esempio n. 1
0
bool CAutoplayer::DoAllin(void)
{
	bool success = false;
	write_log(preferences.debug_autoplayer(), "[AutoPlayer] Starting DoAllin...\n");

	int number_of_clicks = 1; // Default is: single click with the mouse
	if (p_tablemap->buttonclickmethod() == BUTTON_DOUBLECLICK)
	{
		number_of_clicks = 2;
	}

	// TM symbol allinmethod.
	//	0: swag the balance (default)
	//	1: click max (or allin), then raise
	//	2: click only max (or allin) [Spew and THF]
	//	3: use the slider
	if (p_tablemap->allinmethod() == 1)
	{
		// Clicking max (or allin) and then raise
		success = p_casino_interface->ClickButtonSequence(k_autoplayer_function_allin,
			k_autoplayer_function_raise, preferences.swag_delay_3());

		write_logautoplay(ActionConstantNames(k_prevaction_allin));
	}
	else  if (p_tablemap->allinmethod() == 2)
	{
		success = p_casino_interface->ClickButton(k_autoplayer_function_allin);

		write_logautoplay(ActionConstantNames(k_prevaction_allin));
	}
	else if (p_tablemap->allinmethod() == 3)
	{
		success = p_casino_interface->UseSliderForAllin();
		write_logautoplay(ActionConstantNames(k_prevaction_allin));
	}
	else
	{
		// Fourth case (default = 0): swagging the balance
		int userchair = p_symbol_engine_userchair->userchair();
		double betsize_for_allin = p_symbol_engine_chip_amounts->currentbet(userchair)
			+ p_symbol_engine_chip_amounts->balance(userchair); 
		success = p_casino_interface->EnterBetsize(betsize_for_allin);
	}
	if (success)
	{
		// Not really necessary to register the action,
		// as the game is over and there is no doallin-symbol,
		// but it does not hurt to register it anyway.
		p_symbol_engine_history->RegisterAction(k_autoplayer_function_allin);
		return true;
	}
	return false;
}
Esempio n. 2
0
bool CAutoplayer::DoAllin(void)
{
	bool success = false;
	write_log(prefs.debug_autoplayer(), "[AutoPlayer] Starting DoAllin...\n");

	int number_of_clicks = 1; // Default is: single click with the mouse
	if (p_tablemap->buttonclickmethod() == BUTTON_DOUBLECLICK)
	{
		number_of_clicks = 2;
	}

	// TM symbol allinmethod.
	//	0: swag the balance (default)
	//	1: click max (or allin), then raise
	//	2: click only max (or allin) [Spew and THF]
	//	3: use the slider
	if (p_tablemap->allinmethod() == 1)
	{
		// Clicking max (or allin) and then raise
		success = p_casino_interface->ClickButtonSequence(k_autoplayer_function_allin,
			k_autoplayer_function_raise, prefs.swag_delay_3());

		write_logautoplay(ActionConstantNames(k_action_allin));
	    p_heartbeat_thread->set_replay_recorded_this_turn(false);
		return success;
	}
	else  if (p_tablemap->allinmethod() == 2)
	{
		success = p_casino_interface->ClickButton(k_autoplayer_function_allin);

		write_logautoplay(ActionConstantNames(k_action_allin));
	    p_heartbeat_thread->set_replay_recorded_this_turn(false);
		return success;
	}
	else if (p_tablemap->allinmethod() == 3)
	{
		success = p_casino_interface->UseSliderForAllin();
		write_logautoplay(ActionConstantNames(k_action_allin));
	    p_heartbeat_thread->set_replay_recorded_this_turn(false);
		return success;
	}
	else
	{
		// Fourth case (default = 0): swagging the balance
		int userchair = p_symbol_engine_userchair->userchair();
		double betsize_for_allin = p_symbol_engine_chip_amounts->currentbet(userchair)
			+ p_symbol_engine_chip_amounts->balance(userchair); 
		return p_casino_interface->EnterBetsize(betsize_for_allin);
	}
}
Esempio n. 3
0
bool CAutoplayer::DoPrefold(void)
{
    assert(p_autoplayer_functions->f$prefold() == 0);
    if (p_casino_interface->ClickButton(k_autoplayer_function_prefold))
    {
        p_symbols->RecordPrevAction(k_action_fold);
        write_logautoplay(ActionConstantNames(k_action_fold));
        p_autoplayer_functions->CalcAutoTrace();
        write_log(prefs.debug_autoplayer(), "[AutoPlayer] Prefold executed.\n");
        return true;
    }
    return false;
}
Esempio n. 4
0
void CAutoplayer::DoPrefold(void) 
{
	write_log(prefs.debug_autoplayer(), "[AutoPlayer] Starting DoPrefold...\n");

	if (p_autoplayer_functions->f$prefold() == 0)  
	{
		return;
	}
	p_casino_interface->ClickButton(k_autoplayer_function_prefold);

	p_symbols->RecordPrevAction(k_action_fold);
	write_logautoplay(ActionConstantNames(k_action_fold));
	p_autoplayer_functions->CalcAutoTrace();
	write_log(prefs.debug_autoplayer(), "[AutoPlayer] ...ending DoPrefold.\n");
}
Esempio n. 5
0
bool CAutoplayer::ExecuteRaiseCallCheckFold()
{
    write_log(prefs.debug_autoplayer(), "[AutoPlayer] ExecuteRaiseCallCheckFold()\n");
    if (p_autoplayer_functions->f$rais())
    {
        if (p_casino_interface->ClickButton(k_autoplayer_function_raise))
        {
            p_symbols->RecordPrevAction(k_action_raise);
            write_logautoplay(ActionConstantNames(k_action_raise));
            return true;
        }
    }
    if (p_autoplayer_functions->f$call())
    {
        if (p_casino_interface->ClickButton(k_autoplayer_function_call))
        {
            p_symbols->RecordPrevAction(k_action_call);
            write_logautoplay(ActionConstantNames(k_action_call));
            return true;
        }
    }
    // Try to check
    if (p_casino_interface->ClickButton(k_autoplayer_function_check))
    {
        p_symbols->RecordPrevAction(k_action_check);
        write_logautoplay(ActionConstantNames(k_action_check));
        return true;
    }
    else
    {
        // Otherwise: fold
        p_symbols->RecordPrevAction(k_action_fold);
        write_logautoplay(ActionConstantNames(k_action_fold));
        return p_casino_interface->ClickButton(k_autoplayer_function_fold);
    }
}
Esempio n. 6
0
bool CAutoplayer::ExecuteRaiseCallCheckFold()
{
	write_log(preferences.debug_autoplayer(), "[AutoPlayer] ExecuteRaiseCallCheckFold()\n");
	for (int i=k_autoplayer_function_raise; i<=k_autoplayer_function_fold; i++)
	{
		if (p_autoplayer_functions->autoplayer_function_values(i))
		{
			if (p_casino_interface->ClickButton(i))
			{
				write_logautoplay(ActionConstantNames(i));  //!!!
				p_symbol_engine_history->RegisterAction(i);
				return true;
			}
		}
	}
	return false;
}
Esempio n. 7
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);
}
Esempio n. 8
0
bool CCasinoInterface::UseSliderForAllin()
{

	POINT			cur_pos = {0};
	POINT			point_null = {-1, -1};

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

	if (!(p_scraper_access->i3_slider_defined && p_scraper_access->i3_handle_defined))
	{
		write_log(preferences.debug_autoplayer(), "[AutoPlayer] ...ending DoSlider early (i3handle or i3slider are not defined in the tablemap)\n");
		return false;
	}
	if (!p_scraper->handle_found_at_xy())
	{
		write_log(preferences.debug_autoplayer(), "[AutoPlayer] ...ending DoSlider early (handle not found - i3handle must use a transform that resolves to either 'handle' or 'true')\n");
		return false;
	}

	// Click and drag handle
	RECT drag_region;
	drag_region.left      = p_scraper->handle_xy().x + ((i3_handle_region.right - i3_handle_region.left)/2);
	drag_region.top       = p_scraper->handle_xy().y + ((i3_handle_region.bottom - i3_handle_region.top)/2);
	drag_region.right     = p_scraper->handle_xy().x + (i3_slider_region.right - i3_slider_region.left);
	drag_region.bottom    = drag_region.top;		

	write_log(preferences.debug_autoplayer(), "[AutoPlayer] Slider : Calling mouse.dll to jam from %d,%d to %d,%d\n", drag_region.left, drag_region.top, drag_region.right, drag_region.bottom);
	(theApp._dll_mouse_click_drag) (p_autoconnector->attached_hwnd(), drag_region, NULL, point_null);

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

	// Click confirmation button
	if (p_tablemap->swagconfirmationmethod() == BETCONF_ENTER)
	{
		write_log(preferences.debug_autoplayer(), "[AutoPlayer] Slider 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 allin button if it exists,  
		// otherwise use the bet/raise button region
		if (p_scraper_access->available_buttons[k_autoplayer_function_allin])
		{
			write_log(preferences.debug_autoplayer(), "[AutoPlayer] Slider Confirmation : Using the allin button\n");
			confirmation_button = k_autoplayer_function_allin;
		}
		else
		{
			write_log(preferences.debug_autoplayer(), "[AutoPlayer] Slider Confirmation : Using the raise button\n");
			confirmation_button = k_autoplayer_function_raise;
		}

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

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

	write_logautoplay(ActionConstantNames(k_prevaction_jam));
	write_log(preferences.debug_autoplayer(), "[AutoPlayer] Jam complete: %d,%d,%d,%d\n", drag_region.left, drag_region.top, drag_region.right, drag_region.bottom);

	// reset elapsedauto symbol
	write_log(preferences.debug_autoplayer(), "[AutoPlayer] ...ending DoSlider.\n");
	return true;
}
Esempio n. 9
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);
}