From f5f53ac7a8cc3a1a2f7bc0a5000522dbbe1a9032 Mon Sep 17 00:00:00 2001 From: Laurent Mazet Date: Mon, 23 Nov 2020 22:44:24 +0100 Subject: [PATCH] add an option to select who scores: last player or player who pressed on the button --- public/config.js.sample | 3 +++ public/trivabble.js | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/public/config.js.sample b/public/config.js.sample index 2abc6cd..6d36aaa 100644 --- a/public/config.js.sample +++ b/public/config.js.sample @@ -38,6 +38,9 @@ window.TrivabbleConf = { // The default premium for playing seven tiles on a turn PREMIUM_SEVEN_TILES: 50, + // Score is automically affected to last player. If false, score is automatically affected to the player who pressed the Score button + SCORE_LAST_PLAYER: true, + // I don't like trailing commas, here is a nice message for you reading this file :-) HAVE_FUN: true }; diff --git a/public/trivabble.js b/public/trivabble.js index 7e0ede4..4aaf1c0 100644 --- a/public/trivabble.js +++ b/public/trivabble.js @@ -61,6 +61,7 @@ setConf("FLASH_LIGHT_COLOR", "#ee6633"); setConf("API_ENTRY_POINT", Conf.APP_PATH + "/:trivabble"); setConf("PREMIUM_SEVEN_TILES", 50); + setConf("SCORE_LAST_PLAYER", true); function getSetting(key) { let type; @@ -1920,6 +1921,11 @@ totalScore += getSetting("PREMIUM_SEVEN_TILES"); } + /* Ѕcore player who pressed the button */ + if (!getSetting("SCORE_LAST_PLAYER")) { + lastPlayer = getSetting("PlayerName"); + } + myChoice( format(_("{0} points will be added to:"), totalScore), { choices: Object.keys(tablePlayers), -- 2.30.2