Skip to content

Commit

Permalink
Merge pull request #16 from mascaldotfr/ownstats
Browse files Browse the repository at this point in the history
TSTATS: introduce open sourced trainer stats
  • Loading branch information
mascaldotfr authored Jan 28, 2024
2 parents 90c520e + 85c9740 commit 2eaf9e0
Show file tree
Hide file tree
Showing 10 changed files with 407 additions and 4 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ skipped.
If you want to make changes to CoRT or run it locally, you can use python to
[create a temporary local webserver](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Tools_and_setup/set_up_a_local_testing_server#using_python).

## Hidden pages

* **[tstats.html](https://mascaldotfr.github.io/CoRT/tstats.html)** is CoRT's own
Trainer statistics page. For more infos on why it's not the default, see
[the collect README](collect/README.md#Javascript).
* **[beta.html](https://mascaldotfr.github.io/CoRT/beta.html)** is a part of the
[upgrade cycle process](UPDATING.md).

## License

This repo is released under the terms of the GNU Affero General Public
Expand Down
20 changes: 17 additions & 3 deletions collect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ it's easier to deploy for people having a standard PHP enabled webhosting.

## Data exploitation

A simple python exploit code can be found at [exploit.py](exploit.py) in this
directory. It is supposedly simple enough to understand.

Note that this requires accessing the trainerdata sets on this repository,
because your exploitation code will require to sideload them.

Expand All @@ -52,3 +49,20 @@ with spaces.
- Odd indexes: skilltree level
- Even indexes: concatenation of each skill powerpoints on 1 digit

## Implementations

### Python

A simple python exploit code can be found at [exploit.py](exploit.py) in this
directory. It is supposedly simple enough to understand.

### Javascript

A faster and leaner version of [Halvdan's trainer stat
page](https://poludnica.shinyapps.io/configs/) is available in this repository,
see [tstats.js](../js/tstats.js). You can check it out at https://mascaldotfr.github.io/CoRT/tstats.html.

Halv's page is still used by default because it has stats older than CoRT and
has more features, but i wanted to do an open source implementation of it.


1 change: 1 addition & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ h1 {
.faded { color: var(--faded); }
.center { text-align:center; }
.bold { font-weight: bold; }
.italic { font-style: italic; }
.nodeco { text-decoration: none; }

@media (max-width: 799px) {
Expand Down
67 changes: 67 additions & 0 deletions css/tstats.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#ts-content {
display: grid;
grid-template-columns: 1fr 2fr;
}
#ts-side {
display: grid;
grid-template-rows: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 6fr;
}
#ts-center {
display: grid;
grid-template-rows: auto 1fr;
}
#ts-side label {
display: flex;
align-items: center;
}
#ts-side h3 {
text-align: center;
background: var(--menu_background);
margin-bottom: 0;
padding-top: var(--default_margin_padding);
margin-top: calc(4 * var(--default_margin_padding));
}
#ts-center h2 {
text-align: center;
}
#ts-powergraph-graph svg {
background: var(--menu_background);
min-height: 400px;
}
#ts-powergraph-graph .ct-bar {
stroke-width: 25px;
}
#ts-powergraph-x {
padding: var(--default_margin_padding);
background: var(--menu_background);
font-size: 80%;
margin-bottom: calc(var(--default_margin_padding) * 3);
}
#ts-maingraph svg {
min-height: 800px;
}
.ct-label, .ct-axis {
color: var(--foreground);
}
.ct-start {
font-size: 12px;
}
.ct-grid {
stroke: var(--faded);
}
.ct-series-a .ct-bar {
stroke: var(--blue);
}
.ct-label.ct-horizontal {
margin-left: -.3em;
}
@media(max-width: 799px) {
#ts-content {
grid-template-columns: 1fr;
}
#ts-maingraph .ct-bar {
stroke-width: 10px;
}
}


40 changes: 40 additions & 0 deletions data/i18n_db.js
Original file line number Diff line number Diff line change
Expand Up @@ -579,5 +579,45 @@ export const __i18n__ = {
"fr": "Forts",
"es": "Fuertes",
"de": "Forts"
},
"No setups for that combo, bailing out!": {
"fr": "Aucune configuration disponible pour cette combinaison, j'abandonne !",
"es": "No hay configuración disponible para esta combinación, ¡me rindo!",
"de": "Für diese Kombination ist keine Konfiguration verfügbar, ich gebe auf!"
},
"Version:": {
"fr": "Version :",
"es": "Versión:",
"de": "Version:"
},
"Power:": {
"fr": "Pouvoir :",
"es": "Habilidad:",
"de": "Skill:"
},
"Class:": {
"fr": "Classe :",
"es": "Clase:",
"de": "Klass:"
},
"Skill level (frequency)": {
"fr": "Niveau de pouvoir (fréquence)",
"es": "Nivel de habilidad (frecuencia)",
"de": "Skillslevel (Häufigkeit)"
},
"Downloading": {
"fr": "Téléchargement de",
"es": "Descargando",
"de": "Heruntergeladen"
},
"Crunching numbers": {
"fr": "Calcul des statistiques",
"es": "Cálculo de estadísticas",
"de": "Berechnung von Statistiken"
},
"Percentual use": {
"fr": "Pourcentage d'utilisation",
"es": "Uso porcentual",
"de": "Prozentuale Nutzung"
}
};
1 change: 1 addition & 0 deletions js/api_url.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const __api__frontsite_dir = "/CoRT";

export const __api__urls = {
"submit_trainer": `${__api__base}/collect/submit.php`,
"trainer_data": `${__api__base}/collect/data.txt`,
"events": `${__api__base}/warstatus/stats/allevents.json`,
"stats": `${__api__base}/warstatus/stats/statistics.json`,
"wstatus": `${__api__base}/warstatus/warstatus.json`
Expand Down
6 changes: 6 additions & 0 deletions js/lamaiquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ export const $ = (function (selector) {
document.querySelector(selector).innerHTML = "";
}
},
get: async function(url) {
const reply = await fetch(url)
.then(reply => reply.text())
.catch(error => { throw(error); });
return reply;
},
getJSON: async function(url) {
const reply = await fetch(url)
.then(reply => reply.json())
Expand Down
2 changes: 1 addition & 1 deletion js/menu.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2eaf9e0

Please sign in to comment.