web-next: rango de cuenta dinámico según PD en /account

La insignia de rango (antes fija a 1_Newbie/Nivel 1) ahora se calcula por los
PD de la cuenta: 14 niveles (getAccountRank en lib/account.ts) con umbrales
0/100/200…/900/1000/5000/10000/>10000 → imágenes nw-ranks 1_Newbie…14_GrandMaster
y título «Nivel N». Verificado end-to-end: dp=5500 → 12_Mentor «Nivel 12».

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-13 13:56:01 +00:00
parent 941633d791
commit ce39d0582c
2 changed files with 18 additions and 2 deletions
+15
View File
@@ -3,6 +3,21 @@ import { db, DB } from './db'
import type { SessionData } from './session'
import { getZoneName, getClassCss, getCharacterImage, getRaceName, getClassName } from './character-info'
// Rango de la cuenta según los PD (14 niveles). Umbral = PD mínimos por nivel.
const RANK_FILES = [
'1_Newbie', '2_Rookie', '3_Apprentice', '4_Explorer', '5_Contributor', '6_Enthusiast',
'7_Collaborator', '8_Regular', '9_RisingStar', '10_Proficient', '11_Experienced',
'12_Mentor', '13_Veteran', '14_GrandMaster',
]
const RANK_MIN = [0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 5000, 10000, 10001]
/** Nivel de rango (1-14) e imagen según los PD (dp). */
export function getAccountRank(dp: number): { level: number; image: string } {
let idx = 0
for (let i = 0; i < RANK_MIN.length; i++) if (dp >= RANK_MIN[i]) idx = i
return { level: idx + 1, image: `/nw-themes/nw-ryu/nw-images/nw-ranks/${RANK_FILES[idx]}.svg` }
}
export interface Character {
name: string
level: number