Skip to content

Commit

Permalink
aoe4 leaderboards update
Browse files Browse the repository at this point in the history
  • Loading branch information
denniske committed Aug 3, 2023
1 parent f32104c commit fb5f231
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 17 deletions.
4 changes: 4 additions & 0 deletions app/assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@
"enum.leaderboardid.e1v1": "RM 1v1",
"enum.leaderboardid.esolo": "RM Solo",
"enum.leaderboardid.eteam": "RM Team",
"enum.leaderboardid.rm1v1elo": "RM 1v1",
"enum.leaderboardid.rm2v2elo": "RM 2v2",
"enum.leaderboardid.rm3v3elo": "RM 3v3",
"enum.leaderboardid.rm4v4elo": "RM 4v4",

"leaderboard.heading.unranked": "UNR.",
"leaderboard.heading.dm1v1": "DM 1V1",
Expand Down
8 changes: 8 additions & 0 deletions app/src/api/leaderboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ const aoe4WorldLeaderboardMapReverse = {
1001: 'rm_1v1',
1002: 'rm_solo',
1003: 'rm_team',
1010: 'rm_1v1_elo',
1011: 'rm_2v2_elo',
1012: 'rm_3v3_elo',
1013: 'rm_4v4_elo',
};

const aoe4WorldLeaderboardMap = {
Expand All @@ -60,6 +64,10 @@ const aoe4WorldLeaderboardMap = {
'rm_1v1': 1001,
'rm_solo': 1002,
'rm_team': 1003,
'rm_1v1_elo': 1010,
'rm_2v2_elo': 1011,
'rm_3v3_elo': 1012,
'rm_4v4_elo': 1013,
};

function aoe4worldLeaderboardToAoe2NetLeaderboard(leaderboard4: Aoe4WorldLeaderboard) {
Expand Down
6 changes: 6 additions & 0 deletions app/src/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ export interface IChangelog {
// https://www.ageofempires.com/news/age-of-empires-iv-season-one-update-release-notes/

export const changelog4: IChangelog = {
'11.0.0': [
{
type: 'bugfix',
title: 'Fix leaderboard names/colors',
},
],
'10.0.0': [
{
type: 'bugfix',
Expand Down
24 changes: 16 additions & 8 deletions app/src/helper/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@ const leaderboardColors: Record<number, string> = {
4: '#8970AE',
13: '#D65154',
14: '#E19659',
17: '#6188C1',
18: '#8970AE',
19: '#D65154',
20: '#E19659',
17: '#385c93',
18: '#5f4e79',
19: '#95383a',
20: '#9d693e',
1001: '#328f18',
1002: '#328f18',
1003: '#86d06d',
1010: '#5084d3',
1011: '#8560be',
1012: '#c52026',
1013: '#ff943d',
};

const darkLeaderboardColors: Record<number, string> = {
Expand Down Expand Up @@ -71,13 +75,17 @@ const leaderboardTextColors: Record<number, string> = {
4: '#8560be',
13: '#c52026',
14: '#ff943d',
17: '#5084d3',
18: '#8560be',
19: '#c52026',
20: '#ff943d',
17: '#385c93',
18: '#5f4e79',
19: '#95383a',
20: '#9d693e',
1001: '#328f18',
1002: '#328f18',
1003: '#86d06d',
1010: '#5084d3',
1011: '#8560be',
1012: '#c52026',
1013: '#ff943d',
};

const darkLeaderboardTextColors: Record<number, string> = {
Expand Down
8 changes: 7 additions & 1 deletion app/src/service/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const aoe4WorldLeaderboardMap = {
'rm_1v1': 1001,
'rm_solo': 1002,
'rm_team': 1003,
'rm_1v1_elo': 1010,
'rm_2v2_elo': 1011,
'rm_3v3_elo': 1012,
'rm_4v4_elo': 1013,
};

export async function loadProfileLegacy4(userId: UserIdBase): Promise<any | null> {
Expand All @@ -42,7 +46,9 @@ export async function loadProfileLegacy4(userId: UserIdBase): Promise<any | null
steam_id: json.steam_id,
games: sumBy(Object.values(json.modes), m => m.games_count),
drops: sumBy(Object.values(json.modes), m => m.drops_count),
leaderboards: Object.entries(json.modes).map(([modeKey, mode]) => ({
leaderboards: Object.entries(json.modes)
.filter(([modeKey, mode]) => mode.games_count > 0)
.map(([modeKey, mode]) => ({
leaderboard: [{
profile_id: json.profile_id,
steam_id: json.steam_id,
Expand Down
8 changes: 7 additions & 1 deletion app/src/service/rating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ const aoe4WorldLeaderboardMap = {
'rm_1v1': 1001,
'rm_solo': 1002,
'rm_team': 1003,
'rm_1v1_elo': 1010,
'rm_2v2_elo': 1011,
'rm_3v3_elo': 1012,
'rm_4v4_elo': 1013,
};

// "rating": 2096,
Expand All @@ -45,7 +49,9 @@ export async function loadRatingHistoriesLegacy4(userId: UserIdBase): Promise<IR
delete json.modes.rm_1v1;
}

const ratingHistoryRows: IRatingHistoryRow[] = Object.entries(json.modes).map(([modeKey, mode]) => ({
const ratingHistoryRows: IRatingHistoryRow[] = Object.entries(json.modes)
.filter(([modeKey, mode]) => mode.games_count > 0)
.map(([modeKey, mode]) => ({
data: Object.entries(mode.rating_history || {}).map(([timestamp, entry]) => ({
timestamp: fromUnixTime(timestamp),
rating: entry.rating,
Expand Down
6 changes: 3 additions & 3 deletions app4.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {
"userInterfaceStyle": "automatic",
"jsEngine": "hermes",
"runtimeVersion": process.env.RUNTIME_VERSION,
"version": "10.0.0",
"version": "11.0.0",
"orientation": "portrait",
"privacy": "public",
"githubUrl": "https://github.com/denniske/aoe2companion",
Expand Down Expand Up @@ -62,7 +62,7 @@ export default {
"android": {
"userInterfaceStyle": "automatic",
"package": "com.aoe4companion",
"versionCode": 100000,
"versionCode": 110000,
"permissions": [],
"googleServicesFile": "./google-services4.json",
"splash": splash,
Expand All @@ -71,7 +71,7 @@ export default {
"userInterfaceStyle": "automatic",
"icon": "./app4/assets/icon-no-alpha.png",
"bundleIdentifier": "com.aoe4companion",
"buildNumber": "10.0.0",
"buildNumber": "11.0.0",
"supportsTablet": false,
"config": {
"usesNonExemptEncryption": false
Expand Down
8 changes: 4 additions & 4 deletions data/src/api/player-matches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ const aoe4WorldCivMap = {

const aoe4WorldLeaderboardMap = {
'custom': 0,
'qm_1v1': 17,
'qm_2v2': 18,
'qm_3v3': 19,
'qm_4v4': 20,
'rm_1v1_elo': 17,
'rm_2v2_elo': 18,
'rm_3v3_elo': 19,
'rm_4v4_elo': 20,
'rm_1v1': 1001,
'rm_solo': 1002,
'rm_team': 1003,
Expand Down
4 changes: 4 additions & 0 deletions dataset4/src/data/leaderboards.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ export const abbreviationsData = {
1001: 'e1v1',
1002: 'esolo',
1003: 'eteam',
1010: 'rm1v1elo',
1011: 'rm2v2elo',
1012: 'rm3v3elo',
1013: 'rm4v4elo',
};

export const leaderboardMappingData: any = {
Expand Down

0 comments on commit fb5f231

Please sign in to comment.