mirror of
https://github.com/asphyxia-core/plugins.git
synced 2026-09-08 11:15:32 -05:00
* Added experimental 'Shared Favorite Songs' option. If disabled, players will be able to keep separate lists of favorite songs for each version of Gitadora, as well as between Guitar Freaks and Drummania. Enable this option to have a single unified list of favorite songs for both games, and across all versions. Default is false, to match original arcade behaviour.
* Added a leaderboards page to the WebUI. This page displays the rank of all players per game and version, ordered by Skill rating. * More code cleanups to Profiles.ts
This commit is contained in:
85
gitadora@asphyxia/webui/leaderboards.pug
Normal file
85
gitadora@asphyxia/webui/leaderboards.pug
Normal file
@@ -0,0 +1,85 @@
|
||||
//DATA//
|
||||
infos: DB.Find(null, { collection: 'playerinfo' })
|
||||
profiles: DB.Find(null, { collection: 'profile' })
|
||||
-
|
||||
|
||||
-
|
||||
function getFullGameName(shortName) {
|
||||
switch (shortName) {
|
||||
case "dm" :
|
||||
return "Drummania"
|
||||
case "gf":
|
||||
return "Guitar Freaks"
|
||||
default:
|
||||
return "Unknown"
|
||||
}
|
||||
}
|
||||
|
||||
const versions = ["exchain", "nextage"]
|
||||
const games = ["gf", "dm"]
|
||||
|
||||
function generateLeaderboards(infos, profiles) {
|
||||
let result = []
|
||||
|
||||
for (const version of versions) {
|
||||
for (const game of games) {
|
||||
result.push(generateLeaderboard(infos, profiles, version, game))
|
||||
}
|
||||
}
|
||||
|
||||
// Hide versions and games with no entries
|
||||
result = result.filter((e) => e.entries.length > 0)
|
||||
return result
|
||||
}
|
||||
|
||||
function generateLeaderboard(infos, profiles, version, game) {
|
||||
let entries = []
|
||||
let idx = 1
|
||||
let currentProfiles = profiles.filter((e) => e.game === game && e.version === version)
|
||||
currentProfiles = currentProfiles.sort((a, b) => b.skill - a.skill)
|
||||
|
||||
for (const profile of currentProfiles) {
|
||||
const info = infos.find(i => i.__refid === profile.__refid)
|
||||
const name = info ? info.name : "Unknown"
|
||||
const scoreData = {
|
||||
rank: idx,
|
||||
name: name,
|
||||
skill: profile.skill / 100,
|
||||
all_skill: profile.all_skill / 100,
|
||||
clear_music_num : profile.clear_music_num,
|
||||
clear_diff: profile.clear_diff / 100
|
||||
}
|
||||
entries.push(scoreData)
|
||||
idx++
|
||||
}
|
||||
|
||||
let result = {
|
||||
version: version,
|
||||
game: game,
|
||||
entries: entries
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
-
|
||||
|
||||
each board in generateLeaderboards(infos, profiles)
|
||||
h3 #{getFullGameName(board.game)} #{board.version}
|
||||
table
|
||||
tr
|
||||
th Rank
|
||||
th Name
|
||||
th Skill
|
||||
th All Skill
|
||||
th Songs Cleared
|
||||
th Hardest Clear
|
||||
each e in board.entries
|
||||
tr
|
||||
td #{e.rank}
|
||||
td #{e.name}
|
||||
td #{e.skill}
|
||||
td #{e.all_skill}
|
||||
td #{e.clear_music_num}
|
||||
td #{e.clear_diff}
|
||||
|
||||
script(src="js/leaderboards.js")
|
||||
@@ -67,7 +67,7 @@ div
|
||||
.control
|
||||
input.input(type="text" name="all_skill", value=(pr.all_skill/100) readonly)
|
||||
.field
|
||||
label.label Stages Cleared
|
||||
label.label Songs Cleared
|
||||
.control
|
||||
input.input(type="text" name="clear_num", value=pr.clear_num readonly)
|
||||
.field
|
||||
|
||||
Reference in New Issue
Block a user