X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Fbriskin5%2Findex_wr.php;h=ee5d30442c46e9ff794521f411582b56fc518485;hb=a4964f13c6c883a655937d85ae50d0e0aff09226;hp=451b86ae1c9194f11533295ca25e04d67e25d6ea;hpb=f76a3d402e2b87a09ad1ad702c73019846da68db;p=brisk.git diff --git a/web/briskin5/index_wr.php b/web/briskin5/index_wr.php index 451b86a..ee5d304 100644 --- a/web/briskin5/index_wr.php +++ b/web/briskin5/index_wr.php @@ -34,6 +34,7 @@ require_once("Obj/briskin5.phh"); function bin5_index_wr_main(&$bin5, $remote_addr_full, $get, $post, $cookie) { GLOBAL $G_base, $G_dbasetype, $G_ban_list, $G_black_list; + GLOBAL $mlang_indwr, $G_lang; $remote_addr = addrtoipv4($remote_addr_full); @@ -50,15 +51,11 @@ function bin5_index_wr_main(&$bin5, $remote_addr_full, $get, $post, $cookie) log_wr('COMM: '.$mesg); - if (($CO_bin5_pref_ring_endauct = gpcs_var('CO_bin5_pref_ring_endauct', $get, $post, $cookie)) === FALSE) $CO_bin5_pref_ring_endauct = ""; - - log_wr(0, 'bin::index_wr.php: COMM: '.xcapemesg($mesg)); - if (($user = &$bin5->get_user($sess, &$idx)) == FALSE) { echo "Get User Error"; log_wr("Get User Error"); @@ -110,7 +107,7 @@ function bin5_index_wr_main(&$bin5, $remote_addr_full, $get, $post, $cookie) $user->step_inc(); } else if ($argz[0] == 'chatt') { - $bin5->chatt_send(&$user,$mesg); + $bin5->chatt_send(&$user, $mesg); } else if ($argz[0] == 'preferences_update') { log_wr("PER DI PREFERENCES_UPDATE"); @@ -172,33 +169,7 @@ function bin5_index_wr_main(&$bin5, $remote_addr_full, $get, $post, $cookie) } else if ($user->subst == 'asta') { if ($argz[0] == 'lascio') { - // && $user->handpt <= 2) { - /* $index_cur = $table->gstart % BIN5_PLAYERS_N; */ - - /* log_wr(sprintf("GIOCO FINITO !!!")); */ - - /* $table->mult += 1; */ - /* $table->old_reason = sprintf("Ha lasciato %s perché aveva al massimo 2 punti.", xcape($user->name)); */ - - /* // Non si cambia mazzo se si abbandona la partita */ - /* $table->game_next(0); */ - - /* if ($user->table_orig < TABLES_AUTH_N) { */ - /* require_once("../Obj/dbase_".$G_dbasetype.".phh"); */ - - /* if (($bdb = BriskDB::create()) != FALSE) { */ - /* $bdb->bin5_points_save($curtime, $table, $user->table_orig, $ucodes, $pt_cur); */ - /* unset($bdb); */ - /* } */ - /* else { */ - /* log_points($remote_addr, $curtime, $user, "STAT:BRISKIN5:FINISH_GAME", "DATABASE CONNECTION FAILED"); */ - /* } */ - /* log_points($curtime, $user, "STAT:BRISKIN5:FINISH_GAME", $plist); */ - /* } */ - - /* $table->game_init(&$bin5->user); */ - - if ($table->rules_engine(&$bin5, $curtime, BIN5_RULES_ABANDON, $user)) { + if ($table->rules->engine(&$bin5, $curtime, BIN5_RULES_ABANDON, $user)) { for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) { $user_cur = &$bin5->user[$table->player[$i]]; @@ -229,11 +200,10 @@ function bin5_index_wr_main(&$bin5, $remote_addr_full, $get, $post, $cookie) $again = FALSE; } else if ($a_card <= 9) { - if ($a_card >= 0 && $a_card < 9 && $a_card > $table->asta_card) - $again = FALSE; - else if ($a_card == 9 && $a_pnt > ($table->asta_pnt >= 61 ? $table->asta_pnt : 60) && $a_pnt <= 120) + $ret_s = ""; + if ($table->rules->engine(&$bin5, $curtime, BIN5_RULES_ASTA, $user, $ret_s, $a_card, $a_pnt)) { $again = FALSE; - + } if ($again == FALSE) { log_wr("NUOVI ORZI."); @@ -249,6 +219,9 @@ function bin5_index_wr_main(&$bin5, $remote_addr_full, $get, $post, $cookie) if ($again) { // Qualcosa non andato bene, rifare $ret = sprintf('gst.st = %d; asta_pnt_set(%d);', $user->step+1, ($table->asta_pnt > 60 ? $table->asta_pnt + 1 : 61) ); + if ($ret_s != "") { + $ret .= show_notify($ret_s, 0, $mlang_indwr['btn_close'][$G_lang], 400, 150); + } $user->comm[$user->step % COMM_N] = $ret; $user->step_inc(); @@ -302,7 +275,7 @@ function bin5_index_wr_main(&$bin5, $remote_addr_full, $get, $post, $cookie) else if ($table->asta_pla_n == 0) { log_wr("PASSANO TUTTI!"); - if ($table->rules_engine(&$bin5, $curtime, BIN5_RULES_ALLPASS, $user)) { + if ($table->rules->engine(&$bin5, $curtime, BIN5_RULES_ALLPASS, $user)) { for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) { $user_cur = &$bin5->user[$table->player[$i]]; @@ -366,6 +339,16 @@ function bin5_index_wr_main(&$bin5, $remote_addr_full, $get, $post, $cookie) $a_brisco = $argz[1]; if ($a_brisco >= 0 && $a_brisco < (BIN5_CARD_HAND * BIN5_PLAYERS_N)) { $table->briscola = $a_brisco; + + $tourn_values = array(11, 10, 4,3,2, 1,1,1,1,1); + $table->tourn_pts = 0; + $seed = $a_brisco - ($a_brisco % 10); + for ($i = $seed ; $i < ($seed + min(10, BIN5_CARD_HAND * BIN5_PLAYERS_N)) ; $i++) { + if ($table->card[$i]->owner == $table->asta_win) { + $table->tourn_pts += $tourn_values[$i - $seed]; + } + } + $table->friend = $table->card[$a_brisco]->owner; log_wr("GSTART 2"); $table->gstart = ($table->mazzo+1) % BIN5_PLAYERS_N; @@ -490,7 +473,7 @@ function bin5_index_wr_main(&$bin5, $remote_addr_full, $get, $post, $cookie) if ($table->turn == (BIN5_PLAYERS_N * BIN5_CARD_HAND)) { /* game finished */ log_wr(sprintf("GIOCO FINITO !!!")); - if ($table->rules_engine(&$bin5, $curtime, BIN5_RULES_FINISH, $user)) { + if ($table->rules->engine(&$bin5, $curtime, BIN5_RULES_FINISH, $user)) { for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) { $user_cur = &$bin5->user[$table->player[$i]]; $retar[$i] .= show_table(&$bin5,&$user_cur,$user_cur->step+1,TRUE, TRUE);