Customizing Quest Parameters
Relevant source files
The following files were used as context for generating this wiki page:
The Quest Parameter system in the Solo-System project provides a dynamic framework for managing user progression through a "Solo Leveling" inspired penalty and reward mechanism. The system leverages localized time tracking (Asia/Riyadh) and browser-based storage to persist user statistics, rank configurations, and daily task states.
This module focuses on the programmatic definition of task difficulties, rank-based scaling of rewards and penalties, and the logic governing level progression. By adjusting parameters within the JavaScript logic, developers can modify the intensity of the experience, the thresholds for ranking up, and the specific requirements for task completion across physical, mental, and discipline categories.
Quest Data Structures and Storage
The quest system relies on a central data object and a categorized task database. Data is persisted using localStorage under the key solo_penalty_v1 to ensure progress is maintained across sessions.
System Data Object
The systemData object tracks the core state of the user's progress.
| Field | Type | Description |
|---|---|---|
points | Number | The current XP or points accumulated by the user. |
lastUpdate | String | The last date (ISO format) the daily cycle was checked. |
dailyTasks | Array | A collection of task objects generated for the current day. |
lastPenalty | Number | The amount of points deducted during the last cycle failure. |
Sources: Quest.html:128-130, index.html:128-130
Task Database
Tasks are categorized into physical, discipline, and mental groups. Each task contains multiple strings mapped to difficulty tiers (f, d, a, r).
const taskDatabase = {
physical: [
{ f: "ضغط 10 عدات", d: "ضغط 25 عدة", a: "ضغط 50 عدة", r: "ضغط 100 عدة" },
// ...
],
discipline: [
{ f: "ترتيب السرير", d: "تنظيم المكتب", r: "تنظيف المنزل بالكامل" },
// ...
]
};
Sources: Quest.html:115-126, index.html:115-126
Rank and Level Logic
Progression is governed by two distinct systems: Ranks (alphabetical/tier-based) and Levels (numerical).
Rank Configuration
The getRankConfig(pts) function maps point totals to specific difficulty tiers and reward/penalty ratios. Higher ranks increase both the potential rewards and the severity of penalties for failure.
| Points Threshold | Rank | Reward | Penalty | Requirement (XP) | Difficulty Tier |
|---|---|---|---|---|---|
| 3000+ | R | 6 | 8 | 50 | r |
| 2000+ | SS | 6 | 8 | 40 | r |
| 1200+ | S | 4 | 6 | 30 | a |
| 800+ | A | 4 | 6 | 25 | a |
| 500+ | B | 4 | 6 | 20 | d |
| 300+ | C | 3 | 5 | 15 | d |
| 150+ | D | 3 | 5 | 12 | d |
| 0-149 | E/F | 2 | 3 | 10 | f |
Sources: Quest.html:132-142, index.html:132-142
Level Calculation Flow
The level system uses a variable requirement logic where the XP needed to level up increases based on the user's current rank.
The logic uses a base requirement of 5 XP for levels under 6, after which it pulls the req value from the corresponding rank configuration.
Sources: Quest.html:144-152, index.html:144-152
Quest Generation and Cycle Management
Quests are generated daily based on the user's current rank difficulty tier. The system validates the date against the Asia/Riyadh timezone to trigger new task generation and apply penalties for unfinished tasks from the previous day.
Daily Cycle Workflow
The following diagram illustrates how the system handles the transition between days.
The generateTasks() function ensures variety by shuffling the database and selecting a specific subset of tasks: 2 Physical, 2 Discipline, and 1 Mental.
Sources: Quest.html:171-193, index.html:171-193, Quest.html:162-169
User Interface Interaction
The UI dynamically updates Quest parameters visually, including the rank color and the XP progress bar.
Parameter Rendering
When updateUI() is called, the system performs the following:
- Rank Display: Updates text and shadow color based on the
colorproperty ingetRankConfig. - XP Bar: Calculates width as a percentage of
lvData.progress. - Status Message: Toggles between showing current reward/penalty values or a warning message if
lastPenaltyis greater than zero.
Sources: Quest.html:154-160, index.html:154-160
Task Interaction
Toggling a task (toggleTask(i)) immediately recalculates the user's total points based on the current rank's reward parameter and saves the state.
Sources: Quest.html:195-202, index.html:195-202
The system provides a highly configurable environment where the difficulty of quests and the stakes of progression are tightly coupled to the user's performance and current standing within the ranking hierarchy.