add an option to select who scores: last player or player who pressed on the button
authorLaurent Mazet <mazet@softndesign.org>
Mon, 23 Nov 2020 21:44:24 +0000 (22:44 +0100)
committerLaurent Mazet <mazet@softndesign.org>
Mon, 23 Nov 2020 21:44:24 +0000 (22:44 +0100)
public/config.js.sample
public/trivabble.js

index 2abc6cd93daf482f923c37f43a53348bda4112cb..6d36aaa0535c07fa5dbfe50fa39321d70181d48d 100644 (file)
@@ -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
 };
index 7e0ede41e033f994cdd735a1d3f45f7abaa81215..4aaf1c0d586ae5d1d4cbc5d8cd80f7d90d4609cf 100644 (file)
@@ -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;
             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),