From bf3f1b6064a7f23cc8e38d69ecc16eb4b3f3e031 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sun, 19 Mar 2017 10:46:55 +0100 Subject: [PATCH] more consistent matches descriptions --- web/briskin5/Obj/rules_base.phh | 8 +- web/briskin5/Obj/rules_old_rules.phh | 6 +- web/briskin5/Obj/rules_together17.phh | 121 ++++++++++++++++++++++++++ web/briskin5/stat-day.php | 3 +- 4 files changed, 128 insertions(+), 10 deletions(-) diff --git a/web/briskin5/Obj/rules_base.phh b/web/briskin5/Obj/rules_base.phh index cb8aa93..6f93892 100644 --- a/web/briskin5/Obj/rules_base.phh +++ b/web/briskin5/Obj/rules_base.phh @@ -26,8 +26,8 @@ require_once("briskin5.phh"); $mlang_bin5_rules = array( // br, hr, b, /b, win, fri - 'info_part' => array( 'it' => 'Ha chiamato %3$s%5$s%4$s (punti torneo %7$d), il socio era %3$s%6$s%4$s,%1$s', - 'en' => 'The declarer was %3$s%5$s%4$s (tournment points %7$d), the partner was %3$s%6$s%4$s,%1$s'), + 'info_part' => array( 'it' => 'Ha chiamato %3$s%5$s%4$s, il socio era %3$s%6$s%4$s,%1$s', + 'en' => 'The declarer was %3$s%5$s%4$s, the partner was %3$s%6$s%4$s,%1$s'), // br, hr, b, /b 'info_capp' => array( 'it' => 'hanno fatto %3$scappotto%4$s EBBRAVI!.%1$s', 'en' => 'and they made %3Dscapot%4$s WELL DONE!.%1$s'), @@ -46,8 +46,8 @@ $mlang_bin5_rules = array( 'en' => 'lost'), // br, hr, b, /b, win_name - 'info_alon' => array( 'it' => '%3$s%5$s%4$s si è chiamato in mano (punti torneo %6$d),%1$s', - 'en' => '%3$s%5$s%4$s play alone against each other (tournment points %6$d),%1$s'), + 'info_alon' => array( 'it' => '%3$s%5$s%4$s si è chiamato in mano,%1$s', + 'en' => '%3$s%5$s%4$s play alone against each other,%1$s'), // br, hr, b, /b, old_asta_pnt, old_pnt, winornot 'info_aleaa' => array( 'it' => 'doveva fare %3$salmeno %5$d%4$s punti e ne ha fatti %3$s%6$d%4$s: ha %3$s%7$s%4$s.%1$s', 'en' => 'he/she had to do %3$sat least %5$d%4$s points and they had made %3$s%6$d%4$s: he/she had %3$s%7$s%4$s.%1$s'), diff --git a/web/briskin5/Obj/rules_old_rules.phh b/web/briskin5/Obj/rules_old_rules.phh index 291f9d0..ffa1a1b 100644 --- a/web/briskin5/Obj/rules_old_rules.phh +++ b/web/briskin5/Obj/rules_old_rules.phh @@ -362,8 +362,7 @@ class Rules_old_rules extends Rules { $noty .= sprintf($mlang_bin5_rules['info_part'][$G_lang], $tg_br, $tg_hr, $tg_bo, $tg_bc, $win_name, - $fri_name, - $old_tourn_pts); + $fri_name); if ($old_pnt == 120) { $noty .= sprintf($mlang_bin5_rules['info_capp'][$G_lang], $tg_br, $tg_hr, $tg_bo, $tg_bc ); @@ -390,8 +389,7 @@ class Rules_old_rules extends Rules { else { $noty .= sprintf($mlang_bin5_rules['info_alon'][$G_lang], $tg_br, $tg_hr, $tg_bo, $tg_bc, - $win_name, - $old_tourn_pts); + $win_name); if ($old_pnt == 120) { $noty .= sprintf($mlang_bin5_rules['info_acap'][$G_lang], $tg_br, $tg_hr, $tg_bo, $tg_bc); diff --git a/web/briskin5/Obj/rules_together17.phh b/web/briskin5/Obj/rules_together17.phh index 8ab688d..d57186d 100644 --- a/web/briskin5/Obj/rules_together17.phh +++ b/web/briskin5/Obj/rules_together17.phh @@ -25,6 +25,17 @@ require_once("briskin5.phh"); require_once("rules_base.phh"); + +$mlang_bin5_toge17_rules = + array( + // br, hr, b, /b, win, fri + 'info_part' => array( 'it' => 'Ha chiamato %3$s%5$s%4$s (punti torneo %7$d), il socio era %3$s%6$s%4$s,%1$s', + 'en' => 'The declarer was %3$s%5$s%4$s (tournment points %7$d), the partner was %3$s%6$s%4$s,%1$s'), + // br, hr, b, /b, win_name + 'info_alon' => array( 'it' => '%3$s%5$s%4$s si è chiamato in mano (punti torneo %6$d),%1$s', + 'en' => '%3$s%5$s%4$s play alone against each other (tournment points %6$d),%1$s') + ); + class Rules_together17 extends Rules_no_draw { function __construct($table) { @@ -186,6 +197,116 @@ oppure asso, tre, cavallo, 7, 6, 5 e 4 ). return TRUE; } + + + static function game_description($act, $form, $old_mult, $win = -1, $win_name = "?1?", $fri = -1, $fri_name = "?2?", + $old_pnt = -1, $old_asta_pnt = -1, $old_tourn_pts = -1) + { + GLOBAL $G_lang, $mlang_bin5_rules, $mlang_bin5_toge17_rules; + + if ($form == 'html') { + $tg_br = "
"; + $tg_hr = "
"; + $tg_bo = ""; + $tg_bc = ""; + $win_name = xcape($win_name); + $fri_name = xcape($fri_name); + } + else { + $tg_br = " "; + $tg_hr = " "; + $tg_bo = ""; + $tg_bc = ""; + } + + if ($act == BIN5_RULES_OLDSCHEMA) { + return (""); + } + else if ($act == BIN5_RULES_ALLPASS) { + return (sprintf($mlang_bin5_rules['info_alpa'][$G_lang], + $tg_br, $tg_hr, $tg_bo, $tg_bc)); + } + else if ($act == BIN5_RULES_ABANDON) { + return (sprintf($mlang_bin5_rules['info_aban'][$G_lang], + $tg_br, $tg_hr, $tg_bo, $tg_bc, + $win_name)); + } + else { + $wol = static::game_result($old_asta_pnt, $old_pnt); + + $noty = ""; + + if ($win != $fri) { // not alone case + /* MLANG: "
Nell'ultima mano ha chiamato %s, il socio era %s,
", "hanno fatto cappotto EBBRAVI!.
", "dovevano fare %s punti e ne hanno fatti %d: hanno %s.
", "
Nell'ultima mano %s si è chiamato in mano,
", "ha fatto cappotto EBBRAVO!.
", "doveva fare %s punti e ne ha fatti %d: ha %s.
", ($table->old_asta_pnt > 61 ? "almeno ".$table->old_asta_pnt : 'più di 60'), $table->old_pnt, ($wol == 1 ? "vinto" : ($wol == 0 ? "pareggiato" : "perso" */ + + $noty .= sprintf($mlang_bin5_toge17_rules['info_part'][$G_lang], + $tg_br, $tg_hr, $tg_bo, $tg_bc, + $win_name, + $fri_name, + $old_tourn_pts); + if ($old_pnt == 120) { + $noty .= sprintf($mlang_bin5_rules['info_capp'][$G_lang], + $tg_br, $tg_hr, $tg_bo, $tg_bc ); + } + else { + if ($old_asta_pnt > 61) { + $noty .= sprintf($mlang_bin5_rules['info_alea'][$G_lang], + $tg_br, $tg_hr, $tg_bo, $tg_bc, + $old_asta_pnt, $old_pnt, + ($wol == 1 ? $mlang_bin5_rules['info_win'][$G_lang] : + ($wol == 0 ? $mlang_bin5_rules['info_peer'][$G_lang] : + $mlang_bin5_rules['info_lost'][$G_lang]))); + } + else { + $noty .= sprintf($mlang_bin5_rules['info_more'][$G_lang], + $tg_br, $tg_hr, $tg_bo, $tg_bc, + $old_pnt, + ($wol == 1 ? $mlang_bin5_rules['info_win'][$G_lang] : + ($wol == 0 ? $mlang_bin5_rules['info_peer'][$G_lang] : + $mlang_bin5_rules['info_lost'][$G_lang]))); + } // else of if ($old_asta_pnt > 61) { + } // else of if ($old_pnt == 120) { + } // if ($win != $fri) { // not alone case + else { + $noty .= sprintf($mlang_bin5_toge17_rules['info_alon'][$G_lang], + $tg_br, $tg_hr, $tg_bo, $tg_bc, + $win_name, + $old_tourn_pts); + if ($old_pnt == 120) { + $noty .= sprintf($mlang_bin5_rules['info_acap'][$G_lang], + $tg_br, $tg_hr, $tg_bo, $tg_bc); + } + else { + if ($old_asta_pnt > 61) { + $noty .= sprintf($mlang_bin5_rules['info_aleaa'][$G_lang], + $tg_br, $tg_hr, $tg_bo, $tg_bc, + $old_asta_pnt, $old_pnt, + ($wol == 1 ? $mlang_bin5_rules['info_win'][$G_lang] : + ($wol == 0 ? $mlang_bin5_rules['info_peer'][$G_lang] : + $mlang_bin5_rules['info_lost'][$G_lang]))); + } + else { + $noty .= sprintf($mlang_bin5_rules['info_morea'][$G_lang], + $tg_br, $tg_hr, $tg_bo, $tg_bc, + $old_pnt, + ($wol == 1 ? $mlang_bin5_rules['info_win'][$G_lang] : + ($wol == 0 ? $mlang_bin5_rules['info_peer'][$G_lang] : + $mlang_bin5_rules['info_lost'][$G_lang]))); + } + } + } + } + + $old_multer = static::s_multer($old_mult, $old_asta_pnt); + if ($old_multer > 1) { + $noty .= sprintf($mlang_bin5_rules['info_omul'][$G_lang], + $tg_br, $tg_hr, $tg_bo, $tg_bc, + multoval($old_multer)); + } + $noty .= sprintf('%2$s', $tg_br, $tg_hr); + + return ($noty); + } } // class Rules_no_draw ?> \ No newline at end of file diff --git a/web/briskin5/stat-day.php b/web/briskin5/stat-day.php index f12b303..8d3dd3e 100644 --- a/web/briskin5/stat-day.php +++ b/web/briskin5/stat-day.php @@ -248,8 +248,7 @@ SELECT p.pts AS pts ($tmt_obj->minus_one_is_old == -1 ? "td" : "th")); } if ($tmt_obj->minus_one_is_old != -1) { - // FIXME - $rules_name = "Rules_old_rules"; + $rules_name = rules_id2name($trn_obj->code); fprintf($fpexp, "%s%s", $users[$gam_obj->mazzo]['login'], xcape( ${rules_name}::game_description($gam_obj->act, 'plain', $gam_obj->mult, $gam_obj->asta_win, -- 2.17.1