diff options
-rw-r--r-- | data.js | 2 | ||||
-rw-r--r-- | play.js | 62 | ||||
-rw-r--r-- | tools/gendata.js | 3 |
3 files changed, 65 insertions, 2 deletions
@@ -1,2 +1,2 @@ -const data = {"areas":[{"name":"Oran","type":1,"zone":"V","x":430.6,"y":588.8},{"name":"Algiers","type":1,"zone":"IV","x":1185.6,"y":346.8},{"name":"Constantine","type":1,"zone":"II","x":2066.6,"y":315.8},{"name":"France","type":3,"zone":null,"x":1605,"y":185.3,"w":266,"h":212.4},{"name":"Morocco","type":3,"zone":null,"x":109,"y":1765,"w":94,"h":94},{"name":"Tunisia","type":3,"zone":null,"x":2499.9,"y":1667.6,"w":94,"h":94},{"name":"Barika","type":0,"zone":"I","x":1708.1,"y":1117.9},{"name":"Batna","type":2,"zone":"I","x":2185.6,"y":1390.9},{"name":"Biskra","type":2,"zone":"I","x":1853.6,"y":1620.9},{"name":"Tebessa","type":0,"zone":"I","x":2299.6,"y":1120.9},{"name":"Setif","type":0,"zone":"II","x":1917.6,"y":800.8},{"name":"Souk Ahras","type":0,"zone":"II","x":2347.6,"y":848.9},{"name":"Phillippeville","type":0,"zone":"II","x":2200.6,"y":584.9},{"name":"Tizi Ouzou","type":0,"zone":"III","x":1473.6,"y":578.9},{"name":"Bordj Bou Arreridj","type":0,"zone":"III","x":1465.6,"y":832.9},{"name":"Bougie","type":0,"zone":"III","x":1703.6,"y":616.9},{"name":"Medea","type":0,"zone":"IV","x":1212,"y":727},{"name":"Orleansville","type":0,"zone":"IV","x":982,"y":780.2},{"name":"Mecheria","type":2,"zone":"V","x":234,"y":1485.7},{"name":"Tlemcen","type":0,"zone":"V","x":173,"y":1140.9},{"name":"Sidi Bel Abbes","type":0,"zone":"V","x":476,"y":1038},{"name":"Mostaganem","type":0,"zone":"V","x":741,"y":863.9},{"name":"Saida","type":2,"zone":"V","x":501,"y":1419.1},{"name":"Mascara","type":2,"zone":"V","x":785,"y":1302.9},{"name":"Ain Sefra","type":2,"zone":"V","x":752,"y":1670.9},{"name":"Laghouat","type":2,"zone":"V","x":1191,"y":1615.6}],"zones":{"V":["Oran","Mecheria","Tlemcen","Sidi Bel Abbes","Mostaganem","Saida","Mascara","Ain Sefra","Laghouat"],"IV":["Algiers","Medea","Orleansville"],"II":["Constantine","Setif","Souk Ahras","Phillippeville"],"I":["Barika","Batna","Biskra","Tebessa"],"III":["Tizi Ouzou","Bordj Bou Arreridj","Bougie"]}} +const data = {"areas":[{"name":"Oran","type":1,"zone":"V","x":430.6,"y":588.8},{"name":"Algiers","type":1,"zone":"IV","x":1185.6,"y":346.8},{"name":"Constantine","type":1,"zone":"II","x":2066.6,"y":315.8},{"name":"France","type":3,"zone":null,"x":1605,"y":185.3,"w":266,"h":212.4},{"name":"Morocco","type":3,"zone":null,"x":109,"y":1765,"w":94,"h":94},{"name":"Tunisia","type":3,"zone":null,"x":2499.9,"y":1667.6,"w":94,"h":94},{"name":"Barika","type":0,"zone":"I","x":1708.1,"y":1117.9},{"name":"Batna","type":2,"zone":"I","x":2185.6,"y":1390.9},{"name":"Biskra","type":2,"zone":"I","x":1853.6,"y":1620.9},{"name":"Tebessa","type":0,"zone":"I","x":2299.6,"y":1120.9},{"name":"Setif","type":0,"zone":"II","x":1917.6,"y":800.8},{"name":"Souk Ahras","type":0,"zone":"II","x":2347.6,"y":848.9},{"name":"Phillippeville","type":0,"zone":"II","x":2200.6,"y":584.9},{"name":"Tizi Ouzou","type":0,"zone":"III","x":1473.6,"y":578.9},{"name":"Bordj Bou Arreridj","type":0,"zone":"III","x":1465.6,"y":832.9},{"name":"Bougie","type":0,"zone":"III","x":1703.6,"y":616.9},{"name":"Medea","type":0,"zone":"IV","x":1212,"y":727},{"name":"Orleansville","type":0,"zone":"IV","x":982,"y":780.2},{"name":"Mecheria","type":2,"zone":"V","x":234,"y":1485.7},{"name":"Tlemcen","type":0,"zone":"V","x":173,"y":1140.9},{"name":"Sidi Bel Abbes","type":0,"zone":"V","x":476,"y":1038},{"name":"Mostaganem","type":0,"zone":"V","x":741,"y":863.9},{"name":"Saida","type":2,"zone":"V","x":501,"y":1419.1},{"name":"Mascara","type":2,"zone":"V","x":785,"y":1302.9},{"name":"Ain Sefra","type":2,"zone":"V","x":752,"y":1670.9},{"name":"Laghouat","type":2,"zone":"V","x":1191,"y":1615.6},{"name":"Sidi Aissa","type":2,"zone":"VI","x":1385,"y":1186},{"name":"Ain Qussera","type":0,"zone":"VI","x":1070.6,"y":1235.6}],"zones":{"V":["Oran","Mecheria","Tlemcen","Sidi Bel Abbes","Mostaganem","Saida","Mascara","Ain Sefra","Laghouat"],"IV":["Algiers","Medea","Orleansville"],"II":["Constantine","Setif","Souk Ahras","Phillippeville"],"I":["Barika","Batna","Biskra","Tebessa"],"III":["Tizi Ouzou","Bordj Bou Arreridj","Bougie"],"VI":["Sidi Aissa","Ain Qussera"]}} if (typeof module !== 'undefined') module.exports = data @@ -9,6 +9,13 @@ const URBAN = 1 const REMOTE = 2 const COUNTRY = 3 +const UG = 0 +const OPS = 1 +const PTL = 2 +const OC = 3 +// const BOXES = [UG, OPS, PTL, OC] +const BOX_NAMES = ["UG", "OPS", "PTL", "OC"] + let ui = { board: document.getElementById("map"), } @@ -56,21 +63,74 @@ function on_init() { return on_init_once = true + // Tracker + let x = 5 + let y = 5 + for (let i = 0; i < 100; ++i) { + let e = document.createElement("div") + e.id = `tracker-${i}` + e.className = "box" + e.style.left = x / SCALE + "px" + e.style.top = y / SCALE + "px" + e.style.width = 85 / SCALE + "px" + e.style.height = 85 / SCALE + "px" + document.getElementById("boxes").appendChild(e) + + if (i < 29) { + x += 90 + } else if (i < 50) { + y += 90 + } else if (i < 79) { + x -= 90 + } else { + y -= 90 + } + } + + // DRM + for (let i = 0; i < 4; ++i) { + let e = document.createElement("div") + e.id = `drm-${i}` + e.className = "box" + e.style.left = (288.2 + (i * 99)) / SCALE + "px" + e.style.top = 396 / SCALE + "px" + e.style.width = 94 / SCALE + "px" + e.style.height = 94 / SCALE + "px" + document.getElementById("boxes").appendChild(e) + } + + + // Areas for (let i = 0; i < data.areas.length; ++i) { let name = data.areas[i].name let type = data.areas[i].type let e = document.createElement("div") + e.id = `area-${name}` e.className = "box" e.style.left = data.areas[i].x / SCALE + "px" e.style.top = data.areas[i].y / SCALE + "px" if (type !== COUNTRY) { e.style.width = 193 / SCALE + "px" - e.style.height = 193 / SCALE+ "px" + e.style.height = 193 / SCALE + "px" } else { e.style.width = data.areas[i].w / SCALE + "px" e.style.height = data.areas[i].h / SCALE + "px" } document.getElementById("boxes").appendChild(e) + + if (type !== COUNTRY) { + for (let j = 0; j < 4; ++j) { + let e = document.createElement("div") + let box_name = BOX_NAMES[j] + e.id = `ops-${name}-${box_name}` + e.className = "box" + e.style.left = (data.areas[i].x + (j % 2) * 99) / SCALE + "px" + e.style.top = (data.areas[i].y + Math.floor(j / 2) * 99) / SCALE + "px" + e.style.width = 94 / SCALE + "px" + e.style.height = 94 / SCALE + "px" + document.getElementById("boxes").appendChild(e) + } + } } } diff --git a/tools/gendata.js b/tools/gendata.js index 072c48d..11fd048 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -56,6 +56,9 @@ def_area("Mascara", REMOTE, "V", 785, 1302.9) def_area("Ain Sefra", REMOTE, "V", 752, 1670.9) def_area("Laghouat", REMOTE, "V", 1191, 1615.6) +def_area("Sidi Aissa", REMOTE, "VI", 1385, 1186) +def_area("Ain Qussera", RURAL, "VI", 1070.6, 1235.6) + data.areas = areas data.zones = zones |