fixes from MR comments
authorLaurent Mazet <mazet@softndesign.org>
Tue, 5 May 2020 06:30:39 +0000 (08:30 +0200)
committerLaurent Mazet <mazet@softndesign.org>
Tue, 5 May 2020 06:30:39 +0000 (08:30 +0200)
public/trivabble.js
server/de.js [deleted file]
server/en.js [deleted file]
server/es.js [deleted file]
server/fr.js [deleted file]
server/lang/de.js [new file with mode: 0644]
server/lang/en.js [new file with mode: 0644]
server/lang/es.js [new file with mode: 0644]
server/lang/fr.js [new file with mode: 0644]
server/trivabble-server.js

index 34a93305942c64f3f86bf54ca8704f372f81657d..21a3eff3641734fca283db53f1605f1cbfe75e41 100644 (file)
                 document.getElementById("number").textContent = localStorage.trivabbleGameNumber = value;
                 break;
             case "boardLang":
-                document.getElementById("board-lang").textContent =
-                    langName[localStorage.trivabbleBoardLang = value];
+                localStorage.trivabbleBoardLang = value;
+                document.getElementById("board-lang").textContent = langName[value];
                 break;
         }
     }
 
     function changeBoardLang(lang) {
         myConfirm(
-            _("Are you sure you want to change board to '" + langName[lang] + "'? This will put all the tiles back in the bag an start another game."),
+            format(_("Are you sure you want to change board to '{0}'? This will put all the tiles back in the bag and start another game."), langName[lang]),
             function () {
                 sendCmds([{cmd: "changeBoard", lang: lang}]);
             }
diff --git a/server/de.js b/server/de.js
deleted file mode 100644 (file)
index 2a0f454..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * Copyright (C) 2020 Laurent Mazet <mazet@softndesign.org>
- *
- * @licstart
- * This file is part of Trivabble.
- *
- * Trivabble is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License (GNU AGPL)
- * as published by the Free Software Foundation, either version 3 of
- * the License, or (at your option) any later version.
- *
- * Trivabble is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with Trivabble.  If not, see <http://www.gnu.org/licenses/>.
- * @licend
- *
- * @source: https://trivabble.1s.fr/
- * @source: https://gitlab.com/raphj/trivabble/
- */
-
-module.exports = {
-
-  /*
-     102 jetons:
-     - 0 point: Joker *2
-     - 1 point : E *15, N *9, S *7, I *6, R *6, T *6, U *6, A *5, D *4
-     - 2 points : H *4, G *3, L *3, O *3
-     - 3 points : M *4, B *2, W *1, Z *1
-     - 4 points : C *2, F *2, K *2, P *1
-     - 6 points : Ä *1, J *1, Ü *1, V *1
-     - 8 points : Ö *1, X *1
-     - 10 points : Q *1, Y *1
-   */
-
-  bag: [
-    " ", " ", // Joker
-    "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E",
-    "N", "N", "N", "N", "N", "N", "N", "N", "N",
-    "S", "S", "S", "S", "S", "S", "S",
-    "I", "I", "I", "I", "I", "I",
-    "R", "R", "R", "R", "R", "R",
-    "T", "T", "T", "T", "T", "T",
-    "U", "U", "U", "U", "U", "U",
-    "A", "A", "A", "A", "A",
-    "D", "D", "D", "D",
-    "H", "H", "H", "H",
-    "G", "G", "G",
-    "L", "L", "L",
-    "O", "O", "O",
-    "M", "M", "M", "M",
-    "B", "B",
-    "W",
-    "Z",
-    "C", "C",
-    "F", "F",
-    "K", "K",
-    "P",
-    "Ä",
-    "J",
-    "Ü",
-    "V",
-    "Ö",
-    "X",
-    "Q",
-    "Y"
-  ],
-
-  values: {
-    " ": 0,
-    "E": 1,
-    "N": 1,
-    "S": 1,
-    "I": 1,
-    "R": 1,
-    "T": 1,
-    "U": 1,
-    "A": 1,
-    "D": 1,
-    "H": 2,
-    "G": 2,
-    "L": 2,
-    "O": 2,
-    "M": 3,
-    "B": 3,
-    "W": 3,
-    "Z": 3,
-    "C": 4,
-    "F": 4,
-    "K": 4,
-    "P": 4,
-    "Ä": 6,
-    "J": 6,
-    "Ü": 6,
-    "V": 6,
-    "Ö": 8,
-    "X": 8,
-    "Q": 10,
-    "Y": 10
-  }
-};
diff --git a/server/en.js b/server/en.js
deleted file mode 100644 (file)
index 26f9894..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Copyright (C) 2020 Laurent Mazet <mazet@softndesign.org>
- *
- * @licstart
- * This file is part of Trivabble.
- *
- * Trivabble is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License (GNU AGPL)
- * as published by the Free Software Foundation, either version 3 of
- * the License, or (at your option) any later version.
- *
- * Trivabble is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with Trivabble.  If not, see <http://www.gnu.org/licenses/>.
- * @licend
- *
- * @source: https://trivabble.1s.fr/
- * @source: https://gitlab.com/raphj/trivabble/
- */
-
-module.exports = {
-  /*
-     100 jetons:
-     - 0 point: Blank *2
-     - 1 point : E *12, A *9, I *9, O *8, R *6, N *6, T *6, L *4, S *4, U *4
-     - 2 points : D *4, G *3
-     - 3 points : B *2, C *2, M *2, P *2
-     - 4 points : F *2, H *2, V *2, W *2, Y *2
-     - 5 points : K *1
-     - 8 points : J *1, X *1
-     - 10 points : Q *1, Z *1
-   */
-
-  bag: [
-    " ", " ", // Blanks
-    "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E",
-    "A", "A", "A", "A", "A", "A", "A", "A", "A",
-    "I", "I", "I", "I", "I", "I", "I", "I", "I",
-    "O", "O", "O", "O", "O", "O", "O", "O",
-    "R", "R", "R", "R", "R", "R",
-    "N", "N", "N", "N", "N", "N",
-    "T", "T", "T", "T", "T", "T",
-    "L", "L", "L", "L",
-    "S", "S", "S", "S",
-    "U", "U", "U", "U",
-    "D", "D", "D", "D",
-    "G", "G", "G",
-    "B", "B",
-    "C", "C",
-    "M", "M",
-    "P", "P",
-    "F", "F",
-    "H", "H",
-    "V", "V",
-    "W", "W",
-    "Y", "Y",
-    "K",
-    "J",
-    "X",
-    "Q",
-    "Z"
-  ],
-
-  values: {
-    " ": 0,
-    "E": 1,
-    "A": 1,
-    "I": 1,
-    "O": 1,
-    "R": 1,
-    "N": 1,
-    "T": 1,
-    "L": 1,
-    "S": 1,
-    "U": 1,
-    "D": 2,
-    "G": 2,
-    "B": 3,
-    "C": 3,
-    "M": 3,
-    "P": 3,
-    "F": 4,
-    "H": 4,
-    "V": 4,
-    "W": 4,
-    "Y": 4,
-    "K": 5,
-    "J": 8,
-    "X": 8,
-    "Q": 10,
-    "Z": 10
-  }
-};
diff --git a/server/es.js b/server/es.js
deleted file mode 100644 (file)
index 69b2ead..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * Copyright (C) 2020 Laurent Mazet <mazet@softndesign.org>
- *
- * @licstart
- * This file is part of Trivabble.
- *
- * Trivabble is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License (GNU AGPL)
- * as published by the Free Software Foundation, either version 3 of
- * the License, or (at your option) any later version.
- *
- * Trivabble is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with Trivabble.  If not, see <http://www.gnu.org/licenses/>.
- * @licend
- *
- * @source: https://trivabble.1s.fr/
- * @source: https://gitlab.com/raphj/trivabble/
- */
-
-module.exports = {
-  /*
-     100 jetons:
-     - 0 point: Comodin *2
-     - 1 point : A *12, E *12, O *9, I *6, S *6, N *5, R *5, U *5, L *4, T *4
-     - 2 points : D *5, G *2
-     - 3 points : C *4, B *2, M *2, P *2
-     - 4 points : H *2, F *1, V *1, Y *1
-     - 5 points : CH *1, Q *1
-     - 8 points : J *1, LL *1, Ñ *1, RR *1, X *1
-     - 10 points : Z *1
-   */
-
-  bag: [
-    " ", " ", // Comodines
-    "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
-    "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E",
-    "O", "O", "O", "O", "O", "O", "O", "O", "O",
-    "I", "I", "I", "I", "I", "I",
-    "S", "S", "S", "S", "S", "S",
-    "N", "N", "N", "N", "N",
-    "R", "R", "R", "R", "R",
-    "U", "U", "U", "U", "U",
-    "L", "L", "L", "L",
-    "T", "T", "T", "T",
-    "D", "D", "D", "D", "D",
-    "G", "G",
-    "C", "C", "C", "C",
-    "B", "B",
-    "M", "M",
-    "P", "P",
-    "H", "H",
-    "F",
-    "V",
-    "Y",
-    "CH",
-    "Q",
-    "J",
-    "LL",
-    "Ñ",
-    "RR",
-    "X",
-    "Z"
-  ],
-
-  values: {
-    " ": 0,
-    "A": 1,
-    "E": 1,
-    "O": 1,
-    "I": 1,
-    "S": 1,
-    "N": 1,
-    "R": 1,
-    "U": 1,
-    "L": 1,
-    "T": 1,
-    "D": 2,
-    "G": 2,
-    "C": 3,
-    "B": 3,
-    "M": 3,
-    "P": 3,
-    "H": 4,
-    "F": 4,
-    "V": 4,
-    "Y": 4,
-    "CH": 5,
-    "Q": 5,
-    "J": 8,
-    "LL": 8,
-    "Ñ": 8,
-    "RR": 8,
-    "X": 8,
-    "Z": 10
-  }
-};
diff --git a/server/fr.js b/server/fr.js
deleted file mode 100644 (file)
index 744e1f9..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * Copyright (C) 2020 Laurent Mazet <mazet@softndesign.org>
- *
- * @licstart
- * This file is part of Trivabble.
- *
- * Trivabble is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License (GNU AGPL)
- * as published by the Free Software Foundation, either version 3 of
- * the License, or (at your option) any later version.
- *
- * Trivabble is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with Trivabble.  If not, see <http://www.gnu.org/licenses/>.
- * @licend
- *
- * @source: https://trivabble.1s.fr/
- * @source: https://gitlab.com/raphj/trivabble/
- */
-
-module.exports = {
-/*
-   102 jetons
-   - 0 point : Joker *2
-   - 1 point : E *15, A *9, I *8, N *6, O *6, R *6, S *6, T *6, U *6, L *5
-   - 2 points : D *3, M *3, G *2
-   - 3 points : B *2, C *2, P *2
-   - 4 points : F *2, H *2, V *2
-   - 8 points : J *1, Q *1
-   - 10 points : K *1, W *1, X *1, Y *1, Z *1
- */
-
-  bag: [
-    " ", " ", // Jokers
-    "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E",
-    "A", "A", "A", "A", "A", "A", "A", "A", "A",
-    "I", "I", "I", "I", "I", "I", "I", "I",
-    "N", "N", "N", "N", "N", "N",
-    "O", "O", "O", "O", "O", "O",
-    "R", "R", "R", "R", "R", "R",
-    "S", "S", "S", "S", "S", "S",
-    "T", "T", "T", "T", "T", "T",
-    "U", "U", "U", "U", "U", "U",
-    "L", "L", "L", "L", "L",
-    "D", "D", "D",
-    "M", "M", "M",
-    "G", "G",
-    "B", "B",
-    "C", "C",
-    "P", "P",
-    "F", "F",
-    "H", "H",
-    "V", "V",
-    "J",
-    "Q",
-    "K",
-    "W",
-    "X",
-    "Y",
-    "Z"
-  ],
-
-  values: {
-    " ": 0,
-    "E": 1,
-    "A": 1,
-    "I": 1,
-    "N": 1,
-    "O": 1,
-    "R": 1,
-    "S": 1,
-    "T": 1,
-    "U": 1,
-    "L": 1,
-    "D": 2,
-    "M": 2,
-    "G": 2,
-    "B": 3,
-    "C": 3,
-    "P": 3,
-    "F": 4,
-    "H": 4,
-    "V": 4,
-    "J": 8,
-    "Q": 8,
-    "K": 10,
-    "W": 10,
-    "X": 10,
-    "Y": 10,
-    "Z": 10
-  }
-};
diff --git a/server/lang/de.js b/server/lang/de.js
new file mode 100644 (file)
index 0000000..9e9e4b9
--- /dev/null
@@ -0,0 +1,104 @@
+/**
+ * Copyright (C) 2020 Laurent Mazet <mazet@softndesign.org>
+ *
+ * @licstart
+ * This file is part of Trivabble.
+ *
+ * Trivabble is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License (GNU AGPL)
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * Trivabble is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Trivabble.  If not, see <http://www.gnu.org/licenses/>.
+ * @licend
+ *
+ * @source: https://trivabble.1s.fr/
+ * @source: https://gitlab.com/raphj/trivabble/
+ */
+
+module.exports = {
+
+  /*
+     102 jetons:
+     - 0 point: Joker *2
+     - 1 point : E *15, N *9, S *7, I *6, R *6, T *6, U *6, A *5, D *4
+     - 2 points : H *4, G *3, L *3, O *3
+     - 3 points : M *4, B *2, W *1, Z *1
+     - 4 points : C *2, F *2, K *2, P *1
+     - 6 points : Ä *1, J *1, Ü *1, V *1
+     - 8 points : Ö *1, X *1
+     - 10 points : Q *1, Y *1
+   */
+
+  bag: [
+    " ", " ", // Joker
+    "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E",
+    "N", "N", "N", "N", "N", "N", "N", "N", "N",
+    "S", "S", "S", "S", "S", "S", "S",
+    "I", "I", "I", "I", "I", "I",
+    "R", "R", "R", "R", "R", "R",
+    "T", "T", "T", "T", "T", "T",
+    "U", "U", "U", "U", "U", "U",
+    "A", "A", "A", "A", "A",
+    "D", "D", "D", "D",
+    "H", "H", "H", "H",
+    "G", "G", "G",
+    "L", "L", "L",
+    "O", "O", "O",
+    "M", "M", "M", "M",
+    "B", "B",
+    "W",
+    "Z",
+    "C", "C",
+    "F", "F",
+    "K", "K",
+    "P",
+    "Ä",
+    "J",
+    "Ü",
+    "V",
+    "Ö",
+    "X",
+    "Q",
+    "Y"
+  ],
+
+  letterValues: {
+    " ": 0,
+    "E": 1,
+    "N": 1,
+    "S": 1,
+    "I": 1,
+    "R": 1,
+    "T": 1,
+    "U": 1,
+    "A": 1,
+    "D": 1,
+    "H": 2,
+    "G": 2,
+    "L": 2,
+    "O": 2,
+    "M": 3,
+    "B": 3,
+    "W": 3,
+    "Z": 3,
+    "C": 4,
+    "F": 4,
+    "K": 4,
+    "P": 4,
+    "Ä": 6,
+    "J": 6,
+    "Ü": 6,
+    "V": 6,
+    "Ö": 8,
+    "X": 8,
+    "Q": 10,
+    "Y": 10
+  }
+};
diff --git a/server/lang/en.js b/server/lang/en.js
new file mode 100644 (file)
index 0000000..d118e9d
--- /dev/null
@@ -0,0 +1,97 @@
+/**
+ * Copyright (C) 2020 Laurent Mazet <mazet@softndesign.org>
+ *
+ * @licstart
+ * This file is part of Trivabble.
+ *
+ * Trivabble is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License (GNU AGPL)
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * Trivabble is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Trivabble.  If not, see <http://www.gnu.org/licenses/>.
+ * @licend
+ *
+ * @source: https://trivabble.1s.fr/
+ * @source: https://gitlab.com/raphj/trivabble/
+ */
+
+module.exports = {
+  /*
+     100 jetons:
+     - 0 point: Blank *2
+     - 1 point : E *12, A *9, I *9, O *8, R *6, N *6, T *6, L *4, S *4, U *4
+     - 2 points : D *4, G *3
+     - 3 points : B *2, C *2, M *2, P *2
+     - 4 points : F *2, H *2, V *2, W *2, Y *2
+     - 5 points : K *1
+     - 8 points : J *1, X *1
+     - 10 points : Q *1, Z *1
+   */
+
+  bag: [
+    " ", " ", // Blanks
+    "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E",
+    "A", "A", "A", "A", "A", "A", "A", "A", "A",
+    "I", "I", "I", "I", "I", "I", "I", "I", "I",
+    "O", "O", "O", "O", "O", "O", "O", "O",
+    "R", "R", "R", "R", "R", "R",
+    "N", "N", "N", "N", "N", "N",
+    "T", "T", "T", "T", "T", "T",
+    "L", "L", "L", "L",
+    "S", "S", "S", "S",
+    "U", "U", "U", "U",
+    "D", "D", "D", "D",
+    "G", "G", "G",
+    "B", "B",
+    "C", "C",
+    "M", "M",
+    "P", "P",
+    "F", "F",
+    "H", "H",
+    "V", "V",
+    "W", "W",
+    "Y", "Y",
+    "K",
+    "J",
+    "X",
+    "Q",
+    "Z"
+  ],
+
+  letterValues: {
+    " ": 0,
+    "E": 1,
+    "A": 1,
+    "I": 1,
+    "O": 1,
+    "R": 1,
+    "N": 1,
+    "T": 1,
+    "L": 1,
+    "S": 1,
+    "U": 1,
+    "D": 2,
+    "G": 2,
+    "B": 3,
+    "C": 3,
+    "M": 3,
+    "P": 3,
+    "F": 4,
+    "H": 4,
+    "V": 4,
+    "W": 4,
+    "Y": 4,
+    "K": 5,
+    "J": 8,
+    "X": 8,
+    "Q": 10,
+    "Z": 10
+  }
+};
diff --git a/server/lang/es.js b/server/lang/es.js
new file mode 100644 (file)
index 0000000..6a94781
--- /dev/null
@@ -0,0 +1,101 @@
+/**
+ * Copyright (C) 2020 Laurent Mazet <mazet@softndesign.org>
+ *
+ * @licstart
+ * This file is part of Trivabble.
+ *
+ * Trivabble is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License (GNU AGPL)
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * Trivabble is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Trivabble.  If not, see <http://www.gnu.org/licenses/>.
+ * @licend
+ *
+ * @source: https://trivabble.1s.fr/
+ * @source: https://gitlab.com/raphj/trivabble/
+ */
+
+module.exports = {
+  /*
+     100 jetons:
+     - 0 point: Comodin *2
+     - 1 point : A *12, E *12, O *9, I *6, S *6, N *5, R *5, U *5, L *4, T *4
+     - 2 points : D *5, G *2
+     - 3 points : C *4, B *2, M *2, P *2
+     - 4 points : H *2, F *1, V *1, Y *1
+     - 5 points : CH *1, Q *1
+     - 8 points : J *1, LL *1, Ñ *1, RR *1, X *1
+     - 10 points : Z *1
+   */
+
+  bag: [
+    " ", " ", // Comodines
+    "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
+    "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E",
+    "O", "O", "O", "O", "O", "O", "O", "O", "O",
+    "I", "I", "I", "I", "I", "I",
+    "S", "S", "S", "S", "S", "S",
+    "N", "N", "N", "N", "N",
+    "R", "R", "R", "R", "R",
+    "U", "U", "U", "U", "U",
+    "L", "L", "L", "L",
+    "T", "T", "T", "T",
+    "D", "D", "D", "D", "D",
+    "G", "G",
+    "C", "C", "C", "C",
+    "B", "B",
+    "M", "M",
+    "P", "P",
+    "H", "H",
+    "F",
+    "V",
+    "Y",
+    "CH",
+    "Q",
+    "J",
+    "LL",
+    "Ñ",
+    "RR",
+    "X",
+    "Z"
+  ],
+
+  letterValues: {
+    " ": 0,
+    "A": 1,
+    "E": 1,
+    "O": 1,
+    "I": 1,
+    "S": 1,
+    "N": 1,
+    "R": 1,
+    "U": 1,
+    "L": 1,
+    "T": 1,
+    "D": 2,
+    "G": 2,
+    "C": 3,
+    "B": 3,
+    "M": 3,
+    "P": 3,
+    "H": 4,
+    "F": 4,
+    "V": 4,
+    "Y": 4,
+    "CH": 5,
+    "Q": 5,
+    "J": 8,
+    "LL": 8,
+    "Ñ": 8,
+    "RR": 8,
+    "X": 8,
+    "Z": 10
+  }
+};
diff --git a/server/lang/fr.js b/server/lang/fr.js
new file mode 100644 (file)
index 0000000..06ae809
--- /dev/null
@@ -0,0 +1,96 @@
+/**
+ * Copyright (C) 2020 Laurent Mazet <mazet@softndesign.org>
+ *
+ * @licstart
+ * This file is part of Trivabble.
+ *
+ * Trivabble is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License (GNU AGPL)
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * Trivabble is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Trivabble.  If not, see <http://www.gnu.org/licenses/>.
+ * @licend
+ *
+ * @source: https://trivabble.1s.fr/
+ * @source: https://gitlab.com/raphj/trivabble/
+ */
+
+module.exports = {
+/*
+   102 jetons
+   - 0 point : Joker *2
+   - 1 point : E *15, A *9, I *8, N *6, O *6, R *6, S *6, T *6, U *6, L *5
+   - 2 points : D *3, M *3, G *2
+   - 3 points : B *2, C *2, P *2
+   - 4 points : F *2, H *2, V *2
+   - 8 points : J *1, Q *1
+   - 10 points : K *1, W *1, X *1, Y *1, Z *1
+ */
+
+  bag: [
+    " ", " ", // Jokers
+    "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E",
+    "A", "A", "A", "A", "A", "A", "A", "A", "A",
+    "I", "I", "I", "I", "I", "I", "I", "I",
+    "N", "N", "N", "N", "N", "N",
+    "O", "O", "O", "O", "O", "O",
+    "R", "R", "R", "R", "R", "R",
+    "S", "S", "S", "S", "S", "S",
+    "T", "T", "T", "T", "T", "T",
+    "U", "U", "U", "U", "U", "U",
+    "L", "L", "L", "L", "L",
+    "D", "D", "D",
+    "M", "M", "M",
+    "G", "G",
+    "B", "B",
+    "C", "C",
+    "P", "P",
+    "F", "F",
+    "H", "H",
+    "V", "V",
+    "J",
+    "Q",
+    "K",
+    "W",
+    "X",
+    "Y",
+    "Z"
+  ],
+
+  letterValues: {
+    " ": 0,
+    "E": 1,
+    "A": 1,
+    "I": 1,
+    "N": 1,
+    "O": 1,
+    "R": 1,
+    "S": 1,
+    "T": 1,
+    "U": 1,
+    "L": 1,
+    "D": 2,
+    "M": 2,
+    "G": 2,
+    "B": 3,
+    "C": 3,
+    "P": 3,
+    "F": 4,
+    "H": 4,
+    "V": 4,
+    "J": 8,
+    "Q": 8,
+    "K": 10,
+    "W": 10,
+    "X": 10,
+    "Y": 10,
+    "Z": 10
+  }
+};
index 66539747aa8f0a38f6fde196bfbd66decf77d83c..571050579de8a4bb41d0041a8db732a24ecbe075 100644 (file)
@@ -59,10 +59,10 @@ const REQUEST_TYPE_WEBSOCKET    = 3;
 
 /* Manage multi language board */
 const boardPieces = {
-    "de": require ("./de.js"),
-    "en": require ("./en.js"),
-    "es": require ("./es.js"),
-    "fr": require ("./fr.js")
+    "de": require ("./lang/de.js"),
+    "en": require ("./lang/en.js"),
+    "es": require ("./lang/es.js"),
+    "fr": require ("./lang/fr.js")
 };
 const defaultLang = "fr";
 
@@ -214,7 +214,7 @@ Game.prototype.init = function (lang) {
     this.board = newBoard();
     this.lang = lang || defaultLang;
     this.bag = boardPieces[this.lang].bag.slice();
-    this.values = boardPieces[this.lang].values;
+    this.letterValues = boardPieces[this.lang].letterValues;
     this.racks = {};
     this.scores = {};
     this.lastUpdated = new Date();
@@ -240,7 +240,7 @@ Game.fromJSON = function (obj) {
     game.board            = obj.board  || newBoard();
     game.lang             = obj.lang   || defaultLang;
     game.bag              = boardPieces[game.lang].bag.slice();
-    game.values           = boardPieces[game.lang].values;
+    game.letterValues     = boardPieces[game.lang].letterValues;
     game.racks            = obj.racks  || {};
     game.scores           = obj.scores || {};
     game.lastUpdated      = obj.lastUpdated ? new Date(obj.lastUpdated) : new Date();
@@ -479,7 +479,7 @@ function handleCommand(cmdNumber, message, response) {
                 rack: game.getPlayerRack(playerName),
                 board: game.board,
                 remainingLetters: game.bag.length,
-                letterValues: game.values,
+                letterletterValues: game.letterValues,
                 version: VERSION
             });
             break;
@@ -704,7 +704,7 @@ function handleCommands(message, responseAndType) {
                 currentPlayer:    game.currentPlayer,
                 gameNumber:       gameNumber,
                 boardLang:        game.lang,
-                letterValues:     game.values,
+                letterValues:     game.letterValues,
                 rack:             game.getPlayerRack(message.playerName),
                 board:            game.board,
                 remainingLetters: game.bag.length,