bool CAutoplayer::ExecuteSecondaryFormulasIfNecessary() { if (!TimeToHandleSecondaryFormulas()) { write_log(prefs.debug_autoplayer(), "[AutoPlayer] Not executing secondary formulas this heartbeat\n"); return false; } if (!AnySecondaryFormulaTrue()) { write_log(prefs.debug_autoplayer(), "[AutoPlayer] All secondary formulas false.\n"); write_log(prefs.debug_autoplayer(), "[AutoPlayer] Nothing to do.\n"); return false; } for (int i=k_autoplayer_function_prefold; i<=k_autoplayer_function_chat; i++) { // Prefold, close, rebuy and chat work require different treatment, // more than just clicking a simple region... if (p_autoplayer_functions->GetAutoplayerFunctionValue(k_autoplayer_function_prefold)) { // Prefold is technically more than a simple button-click, // because we need to create an autoplayer-trace afterwards. return DoPrefold(); } if (p_autoplayer_functions->GetAutoplayerFunctionValue(k_autoplayer_function_close)) { // CloseWindow is "final". // We don't expect any further action after that // and can return immediatelly. return p_casino_interface->CloseWindow(); } if (p_autoplayer_functions->GetAutoplayerFunctionValue(k_autoplayer_function_rebuy)) { // This requires an external script and some time. // No further actions here eihter, but immediate return. p_rebuymanagement->TryToRebuy(); return true; } if (p_autoplayer_functions->GetAutoplayerFunctionValue(k_autoplayer_function_chat)) { return DoChat(); } // Otherwise: it is a simple button-click if (p_autoplayer_functions->GetAutoplayerFunctionValue(i)) { if (p_casino_interface->ClickButton(i)) { return true; } } } return false; }
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; }