From: Matteo Nastasi (mop) Date: Tue, 28 Feb 2017 07:22:40 +0000 (+0100) Subject: add rule step to manage beat phase X-Git-Tag: v5.4.1~20 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=a4964f13c6c883a655937d85ae50d0e0aff09226;p=brisk.git add rule step to manage beat phase --- diff --git a/web/briskin5/Obj/rules.phh b/web/briskin5/Obj/rules.phh index ce9e8f2..f9a825f 100644 --- a/web/briskin5/Obj/rules.phh +++ b/web/briskin5/Obj/rules.phh @@ -29,6 +29,7 @@ define('BIN5_RULES_OLDSCHEMA', -1); define('BIN5_RULES_FINISH', 0); define('BIN5_RULES_ABANDON', 1); define('BIN5_RULES_ALLPASS', 2); +define('BIN5_RULES_ASTA', 3); require_once("rules_base.phh"); require_once("rules_old_rules.phh"); diff --git a/web/briskin5/Obj/rules_old_rules.phh b/web/briskin5/Obj/rules_old_rules.phh index 21fc253..0d2259a 100644 --- a/web/briskin5/Obj/rules_old_rules.phh +++ b/web/briskin5/Obj/rules_old_rules.phh @@ -85,13 +85,25 @@ class Rules_old_rules extends Rules { } } - function engine(&$bri, $curtime, $action, $user) + function rules_asta(&$bri, $curtime, $action, $user, &$ret_s, $a_card, $a_pnt) { + if ($a_card >= 0 && $a_card < 9 && $a_card > $this->table->asta_card) + return TRUE; + else if ($a_card == 9 && $a_pnt > ($this->table->asta_pnt >= 61 ? $this->table->asta_pnt : 60) && $a_pnt <= 120) + return TRUE; + + return FALSE; + } + + function engine(&$bri, $curtime, $action, $user, &$opt1 = NULL, &$opt2 = NULL, &$opt3 = NULL) { GLOBAL $G_all_points, $G_dbasetype; $table = $this->table; $pnts_sav = array(); + if ($action == BIN5_RULES_ASTA) { + return ($this->rules_asta($bri, $curtime, $action, $user, &$opt1, $opt2, $opt3)); + } if ($action == BIN5_RULES_ALLPASS) { // return TRUE if all correct $table->old_act = $action; $table->old_asta_win = -1; diff --git a/web/briskin5/index_wr.php b/web/briskin5/index_wr.php index 37fd4d4..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); @@ -199,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) + $ret_s = ""; + if ($table->rules->engine(&$bin5, $curtime, BIN5_RULES_ASTA, $user, $ret_s, $a_card, $a_pnt)) { $again = FALSE; - else if ($a_card == 9 && $a_pnt > ($table->asta_pnt >= 61 ? $table->asta_pnt : 60) && $a_pnt <= 120) - $again = FALSE; - + } if ($again == FALSE) { log_wr("NUOVI ORZI."); @@ -219,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();