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.

Points are the core currency of every HADOS dice tournament. Each player’s score is stored as a decimal number in Firestore, and the full ranking is recalculated and saved in a single atomic batch write every time any score changes. This guarantees that the leaderboard is always consistent — no manual sorting or refresh is required.

Who Can Modify Points

Access to point-management tools is controlled by the canModifyPoints() check in the app. The following roles pass this check:
RoleScope
global_adminCan modify points in any Dado
dado_adminCan modify points in their own Dado
intermediarioCan modify points in the Dado they are assigned to
Players with the jugador role see the leaderboard in read-only mode. The “Cargar puntos” button, the “Crear Usuario” button, and all quick-add action columns are hidden for them.
The role displayed in the top-right corner of the navbar reflects your active role in the currently selected Dado, not your global role. If you are a Global Admin viewing a specific Dado, you see global admin. If you are a jugador in that Dado, you see jugador — even if you have a higher role elsewhere.

Method 1 — Quick-Add Buttons

The fastest way to award or deduct points is to use the inline quick-add buttons that appear in List and Grid view modes when you have the right role. List view shows a +10 and +50 button in the Acciones column of every player row. Grid view shows four buttons on each player card: +10, +50, -10, and -50. Clicking any of these buttons immediately calls handleQuickAddPoints, which:
  1. Adds the chosen amount to the player’s current points value (floored at 0).
  2. Rounds the result to one decimal place using toFixed(1).
  3. Triggers updateRanksAndSave to re-sort and batch-write the entire Dado’s rankings.
Quick-add buttons are ideal for awarding standard round values during a live session without opening a modal.

Method 2 — Cargar Puntos Modal

For precise adjustments — including fractional values or deductions — use the “Cargar Puntos” modal, opened by clicking the “Cargar puntos” button in the filter bar above the leaderboard.
1

Open the modal

Click the “Cargar puntos” button (purple accent colour) in the action bar above the leaderboard. The modal “Cargar Puntos a Usuario” opens.
2

Search for the player

Click the “Seleccionar Usuario” combobox and start typing the player’s Habbo username. The dropdown filters in real time and shows each player’s current points next to their avatar thumbnail. Click the desired player to select them.
3

Enter the points value

Type the number of points to add into the “Puntos a Cargar” field. The field accepts:
  • Integers — e.g. 25
  • Decimals — e.g. 15.5
  • Negative values — e.g. -10 to subtract points
4

Review the live preview

As soon as a valid number is entered, a preview box appears showing:
Puntos actuales: X → Nuevo total: Y
The new total is calculated as currentPoints + enteredValue, rounded to one decimal place. Verify this before confirming.
5

Confirm the change

Click “Cargar Puntos”. HADOS calls handleAddPoints, which updates the player’s score (minimum 0) and then calls updateRanksAndSave to persist the full ranking.
Entering a negative value is a valid and intentional way to subtract points from a player — for example, -10 reduces their score by 10. There is no separate “deduct” action; the same field handles both additions and subtractions. Always check the live preview before confirming to avoid accidental over-deductions. Note that points cannot go below 0 — the result is clamped using Math.max(0, newValue).

How Rankings Are Recalculated

After every point change — whether from a quick-add button or the modal — HADOS runs updateRanksAndSave:
  1. All players in the active Dado are sorted descending by points.
  2. Each player’s previousRank is set to their current currentRank before the update.
  3. Each player’s currentRank is set to their new position (index + 1).
  4. All updates are submitted as a single Firestore batch write, so no partial states are visible to other users.
  5. The lastUpdatedText display value resets to “hace unos instantes”.
This means changing one player’s score can shift every other player’s rank simultaneously — the leaderboard is always fully consistent after each save.

Points Precision

All point values are stored and displayed to one decimal place. The calculation parseFloat((value).toFixed(1)) is applied on every write, so:
  • 15 is stored and shown as 15 (or 15.0 internally)
  • 15.55 entered by the user becomes 15.6 after rounding
  • 0.04 added to 0 becomes 0 (rounds to 0.0)
When displayed on the leaderboard, points use the es-ES locale formatter, so large values appear with period-separated thousands — e.g. 1.250 for twelve hundred and fifty points.

Build docs developers (and LLMs) love