From: Matteo Nastasi (mop) Date: Wed, 15 Feb 2017 07:23:47 +0000 (+0100) Subject: add tournment points visualization added X-Git-Tag: v5.3.0~9 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=db12d769481823f4c744ce0e3a50404cc6b01cd1;p=brisk.git add tournment points visualization added --- diff --git a/INSTALL.sh b/INSTALL.sh index 36e2f70..4dd75ee 100755 --- a/INSTALL.sh +++ b/INSTALL.sh @@ -85,7 +85,7 @@ function searchetc() { fi pp="$(dirname "$pp")" done - + return 1 } @@ -227,7 +227,7 @@ echo " web_only: \"$web_only\"" echo " test_add: \"$test_add\"" if [ ! -z "$outconf" ]; then - ( + ( echo "#" echo "# Produced automatically by brisk::INSTALL.sh" echo "#" @@ -324,7 +324,7 @@ if [ "$web_only" = "FALSE" ]; then exit 3 fi rm $ftokk_path/spy.txt - + # create the fs subtree to enable ftok-ing touch ${ftokk_path}/main chmod 666 ${ftokk_path}/main @@ -367,7 +367,7 @@ if [ "$web_only" = "FALSE" ]; then fi install -d ${web_path}__ for i in $(find web -type d | grep '/' | sed 's/^....//g'); do - install -d ${web_path}__/$i + install -d ${web_path}__/$i done for i in $(find web -name '.htaccess' -o -name '*.php' -o -name '*.phh' -o -name '*.pho' -o -name '*.css' -o -name '*.js' -o -name '*.mp3' -o -name '*.swf' -o -name 'terms-of-service*' | sed 's/^....//g'); do diff --git a/sql/sql.d/080-games-tourn-pts.sql b/sql/sql.d/080-games-tourn-pts.sql new file mode 100644 index 0000000..0efa468 --- /dev/null +++ b/sql/sql.d/080-games-tourn-pts.sql @@ -0,0 +1,4 @@ +-- add tourn_pts to bin5_games table +ALTER TABLE #PFX#bin5_games DROP COLUMN tourn_pts; +ALTER TABLE #PFX#bin5_games ADD COLUMN tourn_pts integer DEFAULT -1; -- points at the beginning of the hand + diff --git a/web/Obj/dbase_pgsql.phh b/web/Obj/dbase_pgsql.phh index 1baefa3..feb617c 100644 --- a/web/Obj/dbase_pgsql.phh +++ b/web/Obj/dbase_pgsql.phh @@ -633,7 +633,7 @@ class BriskDB $users[$gam_obj->asta_win]['login'] : ""), $gam_obj->friend, ($gam_obj->friend != -1 ? $users[$gam_obj->friend]['login'] : ""), - $gam_obj->pnt, $gam_obj->asta_pnt); + $gam_obj->pnt, $gam_obj->asta_pnt, $gam_obj->tourn_pts); // update matches with new ttok and table idx $mtc_sql = sprintf("UPDATE %sbin5_matches SET (ttok, tidx) = ('%s', %d) WHERE code = %d RETURNING *;", @@ -760,13 +760,14 @@ class BriskDB /* * games management */ - $gam_sql = sprintf("INSERT INTO %sbin5_games (mcode, tstamp, act, asta_pnt, pnt, asta_win, friend, mazzo, mult) - VALUES (%d, to_timestamp(%d), %d, %d, %d, %d, %d, %d, %d) RETURNING *;", + $gam_sql = sprintf("INSERT INTO %sbin5_games (mcode, tstamp, act, asta_pnt, pnt, asta_win, friend, mazzo, mult, tourn_pts) + VALUES (%d, to_timestamp(%d), %d, %d, %d, %d, %d, %d, %d, %d) RETURNING *;", $G_dbpfx, $mtc_obj->code, $date, $action, $table->old_asta_pnt, $table->old_pnt, $table->old_asta_win, $table->old_friend, - $table->old_mazzo, $table->old_mult); + $table->old_mazzo, $table->old_mult, + $table->old_tourn_pts); if (($gam_pg = $this->query($gam_sql)) == FALSE || pg_affected_rows($gam_pg) != 1) { log_crit(sprintf("bin5_points_save: failed at insert game [%s]", $gam_sql)); break; diff --git a/web/Obj/user.phh b/web/Obj/user.phh index d8230b4..000ad97 100644 --- a/web/Obj/user.phh +++ b/web/Obj/user.phh @@ -707,7 +707,8 @@ class User { } } } - if ($G_with_splash && + // if ($G_with_splash && + if ($this->is_auth() && (! $this->is_appr()) && $G_with_splash && ($splashdate < $curtime - $G_splash_interval || $splashdate > $curtime)) { $is_super = $this->flags & USER_FLAG_TY_SUPER; diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index f5db998..1e67bf8 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -42,8 +42,8 @@ $mlang_bin5_bin5 = array( 'info_curr' => array( 'it' => '%3$smano corrente%4$s', 'en' => '%3$scurrent hand%4$s'), // br, hr, b, /b, win, fri - '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'), + '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 'info_capp' => array( 'it' => 'hanno fatto %3$scappotto%4$s EBBRAVI!.%1$s', 'en' => 'and they made %3Dscapot%4$s WELL DONE!.%1$s'), @@ -62,8 +62,8 @@ $mlang_bin5_bin5 = array( 'en' => 'lost'), // br, hr, b, /b, win_name - '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'), + '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'), // 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'), @@ -185,6 +185,7 @@ class Bin5_table extends Table { var $asta_win; // the caller idx position at table var $briscola; + var $tourn_pts; // points in the caller hand var $friend; // the callee idx position at table var $match_id; // the id of the match on the database (-1 == just not saved) @@ -198,6 +199,8 @@ class Bin5_table extends Table { var $old_asta_win; // the old caller idx position at table var $old_friend; // the old callee idx position at table + var $old_tourn_pts; // the old tournment computed points in the hand of caller + function Bin5_table() { } @@ -223,6 +226,7 @@ class Bin5_table extends Table { $thiz->total = array( 0, 0, 0, 0, 0); $thiz->asta_win = -1; $thiz->briscola = -1; + $thiz->tourn_pts = -1; $thiz->friend = -1; $thiz->turn = 0; @@ -266,6 +270,7 @@ class Bin5_table extends Table { $thiz->asta_win = $from->asta_win; $thiz->briscola = $from->briscola; + $thiz->tourn_pts = $from->tourn_pts; $thiz->friend = $from->friend; $thiz->match_id = $from->match_id; @@ -436,6 +441,7 @@ class Bin5_table extends Table { $this->asta_pnt = 60; $this->asta_win = -1; $this->briscola = -1; + $this->tourn_pts = -1; $this->friend = -1; $this->turn = 0; @@ -638,6 +644,8 @@ class Bin5_table extends Table { // $this->old_mult, $this->old_pnt, $this->old_reason and $this->old_asta_win are specific $this->old_friend = $this->friend; + $this->old_tourn_pts = $this->tourn_pts; + $this->old_reason = game_description($action, 'html', $this->old_mult, $this->old_asta_win, ($this->old_asta_win != -1 ? @@ -645,7 +653,7 @@ class Bin5_table extends Table { $this->old_friend, ($this->old_friend != -1 ? $bri->user[$this->player[$this->old_friend]]->name : ""), - $this->old_pnt, $this->old_asta_pnt); + $this->old_pnt, $this->old_asta_pnt, $this->old_tourn_pts); if ($user->table_orig < TABLES_AUTH_N) { @@ -2004,7 +2012,7 @@ function log_points($remote_addr, $curtime, $user, $where, $mesg) } 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_pnt = -1, $old_asta_pnt = -1, $old_tourn_pts = -1) { GLOBAL $G_lang, $mlang_bin5_bin5; @@ -2046,7 +2054,8 @@ function game_description($act, $form, $old_mult, $win = -1, $win_name = "?1?", $noty .= sprintf($mlang_bin5_bin5['info_part'][$G_lang], $tg_br, $tg_hr, $tg_bo, $tg_bc, $win_name, - $fri_name); + $fri_name, + $old_tourn_pts); if ($old_pnt == 120) { $noty .= sprintf($mlang_bin5_bin5['info_capp'][$G_lang], $tg_br, $tg_hr, $tg_bo, $tg_bc ); @@ -2073,7 +2082,8 @@ function game_description($act, $form, $old_mult, $win = -1, $win_name = "?1?", else { $noty .= sprintf($mlang_bin5_bin5['info_alon'][$G_lang], $tg_br, $tg_hr, $tg_bo, $tg_bc, - $win_name); + $win_name, + $old_tourn_pts); if ($old_pnt == 120) { $noty .= sprintf($mlang_bin5_bin5['info_acap'][$G_lang], $tg_br, $tg_hr, $tg_bo, $tg_bc); diff --git a/web/briskin5/index_wr.php b/web/briskin5/index_wr.php index a0d60d4..c9b5b80 100644 --- a/web/briskin5/index_wr.php +++ b/web/briskin5/index_wr.php @@ -366,6 +366,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 + 10) ; $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; diff --git a/web/briskin5/stat-day.php b/web/briskin5/stat-day.php index 0359bfe..8ba7778 100644 --- a/web/briskin5/stat-day.php +++ b/web/briskin5/stat-day.php @@ -434,7 +434,7 @@ SELECT p.pts AS pts $gam_obj->friend, ($gam_obj->friend != -1 ? $users[$gam_obj->friend]['login'] : ""), - $gam_obj->pnt, $gam_obj->asta_pnt) ) + $gam_obj->pnt, $gam_obj->asta_pnt, $gam_obj->tourn_pts) ) ); } fprintf($fpexp, "\n"); diff --git a/web/index.php b/web/index.php index 73ebd17..2cfe731 100644 --- a/web/index.php +++ b/web/index.php @@ -992,7 +992,7 @@ supported by:
'.$altout_support_big.'
- + ' . ( /* NOTE: here facebook or fake facebook */ (!$G_is_local && $_cookie_law_3party == 'true') ? '
diff --git a/web/room.css b/web/room.css index 02d8cd6..8be8e60 100644 --- a/web/room.css +++ b/web/room.css @@ -149,8 +149,14 @@ table.placing { table.placing th { border: 1px solid gray; - text-align: center; - padding: 4px; + text-align: right; + padding: 8px; + min-width: 50px; +} + +table.placing th span { + font-weight: normal; + float: left; } table.placing td {