Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/VasquezRivero92/HabboCafe/llms.txt

Use this file to discover all available pages before exploring further.

In HADOS, a tournament is not a separate database entity — it is a phase of a Dado. All tournament configuration (dates, prize, rules, schedule, qualifying count) is stored directly on the Dado document, and each player’s score and rank are stored on their individual HabboUser profile with dadoId linking them to the correct Dado. This means that at any moment, opening a Dado gives you the complete live state of its current tournament.

Tournament lifecycle

1

Setup

The Dado Admin opens the Dado Panel tab and fills in the tournament configuration. These fields are written directly to the Dado document in Firestore:
  • Start date (startDate) and end date (endDate) — displayed on the tournament info panel after formatting to DD/MM.
  • Total prize (totalPrize) — a free-text string such as "3000 USDT" shown in the info widget.
  • Qualifying count (qualifyingCount) — the number of top-ranked players who qualify for the final stage (default: 12).
  • Rules (rules) — a newline-separated block of text; each line becomes one entry in the rules array and is rendered individually in the Reglas tab.
  • Schedule (schedule) — a newline-separated block of text; each line becomes one entry in the schedule array shown in the Fecha y horarios tab.
Click Guardar Configuración to persist all fields in a single updateDoc call. Changes appear in every connected session immediately.
2

Active — points loading

Once the tournament is underway, Intermediarios and Dado Admins load points through two mechanisms:
  • Points modal — Click Cargar puntos, search for the target player via the autocomplete combobox, enter a positive or negative decimal value (e.g. 15.5 or -10), and submit. The modal previews the player’s current total and the resulting new total before confirming.
  • Quick actions — In List and Grid view modes, inline +10 and +50 buttons (and -10 / -50 in Grid mode) allow rapid point adjustments without opening the modal.
After every point change, the platform immediately recalculates rankings, writes the new currentRank to every player in the Dado, and promotes the previous currentRank into previousRank — all in a single Firestore batch write.
// Ranking recalculation on every point update
const sorted = [...updatedUsers].sort((a, b) => b.points - a.points);
const batch = writeBatch(db);

sorted.forEach((user, index) => {
  const newRank = index + 1;
  batch.update(doc(db, 'users', user.id), {
    points: user.points,
    previousRank: user.currentRank || user.previousRank,
    currentRank: newRank,
  });
});

await batch.commit();
3

Reset — start a new tournament

When the Dado Admin is ready to run a new edition, they click Crear Nuevo Torneo (Reiniciar) in the Dado Panel. This opens the reset modal where they must:
  1. Set a new start date.
  2. Set a new end date.
  3. Type REINICIAR into the confirmation field (the check normalizes input to uppercase before comparing).
On submission, a single Firestore batch write updates the Dado document’s startDate and endDate, then iterates every player in the Dado and sets their points, previousRank, and currentRank all to 0 / 1 / 1 respectively. The player roster is preserved — only scores and dates change.

Rank tracking: previousRank vs currentRank

Every HabboUser document stores two rank fields that work together to power the leaderboard’s trend indicators:
FieldDescription
currentRankThe player’s rank after the most recent point update. Position 1 is the highest scorer.
previousRankThe player’s rank before the most recent point update. Set to the former currentRank on every write.
The leaderboard UI computes the delta as previousRank − currentRank. A positive delta means the player moved up (rendered as a green upward chevron with the number of positions gained); a negative delta means they dropped (red downward chevron); zero means no movement (grey dash).
const rankDiff = user.previousRank - user.currentRank;
// rankDiff > 0  → climbed up (green ▲)
// rankDiff < 0  → dropped down (red ▼)
// rankDiff === 0 → no change (grey —)
Both previousRank and currentRank are initialized to users.length + 1 when a new player is created, and both are reset to 1 on tournament reset. This ensures the trend indicator shows a neutral dash for all players at the start of a fresh tournament.

The qualifyingCount field

qualifyingCount is a number stored on the Dado document that represents how many top-ranked players in the tournament earn a spot in the final. It is displayed in the tournament information panel:
“Clasifican 12 jugadores”
The Dado Admin can update this value at any time from the Cantidad de Clasificados input in the Dado Panel configuration form. The platform stores no automatic enforcement logic around this number — it is informational, shown to all players so they know what rank they must reach to qualify.

Score reset: confirmation and irreversibility

The reset flow requires typing the exact word REINICIAR into a confirmation field before the platform will proceed. This is enforced in code:
if (confirmResetText.trim().toUpperCase() !== 'REINICIAR') {
  alert('Debes escribir "REINICIAR" para confirmar la acción.');
  return;
}
Resetting a tournament is irreversible. Once confirmed, all player point totals in the Dado are permanently overwritten to 0 and all rank fields are reset to 1. There is no undo, no archive, and no way to recover the previous scores from within the application. Before triggering a reset, ensure all final standings have been recorded externally.

Tournament information tabs

Players can view tournament details from the Torneo activo tab, which exposes three sub-tabs:
Shows four summary widgets: the tournament duration (formatted start → end dates), the qualifying count, the total prize, and the last updated timestamp. All values are sourced live from the active Dado document.

Build docs developers (and LLMs) love