bool CAutoplayer::ExecutePrimaryFormulas() { write_log(prefs.debug_autoplayer(), "[AutoPlayer] ExecutePrimaryFormulas()\n"); // 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. if (!PrepareActionSequence()) { return false; } if (p_autoplayer_functions->f$alli()) { if (DoAllin()) { return true; } // Else continue with swag and betpot } if (DoSwag()) { return true; } if (DoBetPot()) { return true; } return ExecuteRaiseCallCheckFold(); }
bool CAutoplayer::DoBetPot(void) { bool success = false; // Start with 2 * potsize, continue with lower betsizes, finally 1/4 pot for (int i=k_autoplayer_function_betpot_2_1; i<=k_autoplayer_function_betpot_1_4; i++) { if (p_autoplayer_functions->GetAutoplayerFunctionValue(i)) { write_log(prefs.debug_autoplayer(), "[AutoPlayer] Function %s true.\n", k_autoplayer_functionname[i]); if (!PrepareActionSequence()) { return false; } if (p_tablemap->betpotmethod() == BETPOT_RAISE) { success = p_casino_interface->ClickButtonSequence(i, k_autoplayer_function_raise, /*betpot_delay* !! */ 400); } else { // Default: click only betpot success = p_casino_interface->ClickButton(i); } } if (success) { return true; } // Else continue trying with the next betpot function } // We didn't click any betpot-button return false; }
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(); }
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; }