function update_actions($glob) { $arr_action = give_action(); $cur_list_action = $glob['list_action']; $arr_action_add = array(); $arr_tmp = array(); for ($i = 0, $flag = 0; $cur_list_action[$i]; $i++) { for ($j = 0; $arr_action[$j]; $j++) { if (substr($cur_list_action[$i]['nom_action'], 0, 2) == "b_") { if ($cur_list_action[$i]['done'] == 0) { if ($cur_list_action[$i]['nom_action'] == $arr_action[$j]['nom']) { if ($flag == 0) { for ($k = 0; $arr_action[$j]['actions'][$k]; $k++) { array_push($arr_action_add, name_to_arr($arr_action[$j]['actions'][$k])); $arr_tmp = array(); } $cur_list_action = add_action_place($cur_list_action, $arr_action_add, $i); $arr_action_add = array(); $flag = 1; } } } } } } $cur_list_action = update_order($cur_list_action); $glob['list_action'] = $cur_list_action; return $glob; }
function check_bouff($glob) { if ($glob['bouff_c'] < 130) { $place_to_add = find_action_where_add($glob, $rempl); $arr = array(name_to_arr("b_bouff_20"), name_to_arr("b_bouff_20"), name_to_arr("b_bouff_20")); $glob['list_action'] = add_action_place($glob['list_action'], $arr, $place_to_add); } return $glob; }
function launch_repeat($glob, $str) { $randou = rand(0, 3); if ($randou == 1) { $place_to_add = find_action_where_add($glob, $rempl); $arr = array(name_to_arr('send_repeat')); $glob['list_action'] = add_action_place($glob['list_action'], $arr, $place_to_add); $glob['repeat'] = $str; return $glob; } }
function error_to_go($glob, $obj) { aff_client("Pas de " . $obj . " devant moi, je pars en chercher"); if ($obj == 'b_bouff_20') { $rempl = 'b_go_bouf'; } else { if (strstr($obj, '_sg_') == TRUE) { $rempl = 'b_go_' . substr($obj, 5); } else { $rempl = $obj; } } $place_to_add = find_action_where_add($glob, $rempl); $arr = array(name_to_arr(rand_way()), name_to_arr($obj)); $glob['list_action'] = add_action_place($glob['list_action'], $arr, $place_to_add); return $glob; }
function new_job($glob) { if ($glob['list_action'][0]['done'] == 0) { $glob = first_work($glob); } else { if ($glob['nb_pote'] >= 2 && $glob['lvl'] == 2) { $glob = work_for_lvl3($glob); } else { if ($glob['nb_pote'] > 1 && $glob['lvl'] == 1) { $glob = work_for_lvl2($glob); } else { if ($glob['nb_pote'] == 0 && $glob['lvl'] == 1 && count($glob['time_to_fork']) > 1 && count($glob['time_to_fork']) < 3) { $glob = work_forker($glob); } else { $glob['list_action'] = add_action_place($glob['list_action'], name_to_arr("b_rand")); } } } } $glob = update_actions($glob); return $glob; }