Attributes and Statistics
Relevant source files
The following files were used as context for generating this wiki page:
The "Attributes and Statistics" system serves as the core progression engine for the Solo Leveling project. It translates user activity—specifically the completion of daily tasks—into quantifiable data points, including Experience Points (XP), Levels, and Ranks. This system is designed to simulate a gamified progression environment where consistency is rewarded and negligence results in automated penalties.
The system relies on a central data structure stored in the browser's local storage, which tracks total points, daily tasks, and historical penalty data. This data is processed through mathematical functions to determine the user's current standing within the hierarchy.
Sources: index.html:106-108, Quest.html:106-108
Data Model and Persistence
The system state is maintained within a single JSON object persisted via localStorage. This ensures that a user's progress is saved across sessions without the need for a backend database.
System Data Structure
| Field | Type | Description |
|---|---|---|
points | Number | The cumulative XP earned by the user. |
lastUpdate | String | ISO date string of the last daily reset. |
dailyTasks | Array | Objects containing the name, category, and completion status of today's tasks. |
lastPenalty | Number | The amount of XP deducted during the last daily cycle reset. |
Sources: index.html:106-108, Quest.html:106-108
The diagram above illustrates the relationship between the primary system state and the daily task entries.
Progression Mechanics: Ranks and Levels
The progression logic is bifurcated into Ranks (qualitative milestones) and Levels (quantitative granular progress).
Rank Configuration
Ranks are determined by the getRankConfig(pts) function. Each rank tier defines the rewards for task completion, the penalties for failure, and the difficulty level of tasks assigned.
| Point Threshold | Rank | Reward (+XP) | Penalty (-XP) | Difficulty Key |
|---|---|---|---|---|
| 3000+ | R | 6 | 8 | r |
| 2000 | SS | 6 | 8 | r |
| 1200 | S | 4 | 6 | a |
| 800 | A | 4 | 6 | a |
| 500 | B | 4 | 6 | d |
| 300 | C | 3 | 5 | d |
| 150 | D | 3 | 5 | d |
| 70 | E | 2 | 3 | f |
| < 70 | F | 2 | 3 | f |
Sources: index.html:110-120, Quest.html:110-120
Level Calculation Logic
Levels are calculated dynamically based on a sliding scale requirement. For levels 1 through 5, the requirement is fixed at 5 points. Beyond level 5, the requirement for the next level is determined by the current rank's req value.
Sources: index.html:122-130, Quest.html:122-130
The Daily Cycle and Penalty System
The system operates on a 24-hour cycle based on the Asia/Riyadh timezone. This cycle governs task generation and penalty application.
Cycle Logic Flow
- Date Validation: The system compares
lastUpdatewith the current date in Riyadh. - Penalty Assessment: If the dates differ, the system iterates through
dailyTasksfrom the previous day. For every task whered(done) isfalse, a penalty is deducted frompointsbased on the rank'spenvalue. - Task Generation: New tasks are randomly selected from the
taskDatabasebased on the current rank's difficulty (f, d, a, or r).
Sources: index.html:157-183, Quest.html:157-183
The flow diagram depicts the automated maintenance routine executed upon system initialization.
Implementation Details
Task Database
Tasks are categorized into physical, discipline, and mental. Each task provides varying descriptions based on the difficulty level mapped from the user's rank.
const taskDatabase = {
physical: [
{ f: "10 Pushups", d: "25 Pushups", a: "50 Pushups", r: "100 Pushups" },
// ... other tasks
]
};
Sources: index.html:90-104, Quest.html:90-104
UI Synchronization
The updateUI() function handles the visual representation of statistics. It updates the Level Badge, Rank Display (including dynamic colors and text shadows), the XP Progress Bar, and status messages indicating recent rewards or penalties.
Sources: index.html:132-148, Quest.html:132-148
Summary
The Attributes and Statistics system provides a robust framework for tracking personal growth. By integrating a dynamic ranking system with a strict daily penalty cycle, it ensures that "points" and "levels" reflect genuine consistency. The architecture leverages local storage for persistence and uses timezone-aware logic to synchronize the experience with the user's real-world day.