Fix course bitfield table: correct bit positions and values

The table had courses renumbered sequentially as bits 0-10, but the
code uses value = 2^ID where bit position equals the course ID.
Every row was wrong (e.g. HunterLife was listed as bit 0/value 1,
actually ID 2/value 4; NetCafe is 2^26, not 256). Fix all values
and update the SQL examples accordingly.
houmgaor
2026-02-18 13:49:35 +01:00
parent 1415f023af
commit 8d5c165366

@@ -256,30 +256,36 @@ Courses are stored as a bitfield in `users.rights`. Players toggle available cou
#### Bitfield Encoding
| Course | Bit | Value |
|--------|-----|-------|
| HunterLife | 0 | 1 |
| Extra | 1 | 2 |
| Premium | 2 | 4 |
| Assist | 3 | 8 |
| N | 4 | 16 |
| Hiden | 5 | 32 |
| HunterSupport | 6 | 64 |
| NBoost | 7 | 128 |
| NetCafe | 8 | 256 |
| HLRenewing | 9 | 512 |
| EXRenewing | 10 | 1024 |
The bit position equals the course ID (`value = 2^ID`), matching [Enumerations](Enumerations#course-types).
Add values together for combinations. Example: HunterLife + Extra + NetCafe = 1 + 2 + 256 = **259**.
| Course | ID (Bit) | Value |
|--------|----------|-------|
| Trial | 1 | 2 |
| HunterLife | 2 | 4 |
| Extra | 3 | 8 |
| ExtraB | 4 | 16 |
| Mobile | 5 | 32 |
| Premium | 6 | 64 |
| Pallone | 7 | 128 |
| Assist | 8 | 256 |
| N | 9 | 512 |
| Hiden | 10 | 1024 |
| HunterSupport | 11 | 2048 |
| NBoost | 12 | 4096 |
| NetCafe | 26 | 67108864 |
| HLRenewing | 27 | 134217728 |
| EXRenewing | 28 | 268435456 |
Add values together for combinations. Example: HunterLife + Extra + NetCafe = 4 + 8 + 67108864 = **67108876**.
#### Manual Database Override
```sql
-- Enable all courses for a user
UPDATE users SET rights = 2047 WHERE username = 'player';
-- Enable core gameplay courses (Trial + HunterLife + Extra + Premium + Assist)
UPDATE users SET rights = 334 WHERE username = 'player';
-- Enable only HunterLife + Extra + NetCafe
UPDATE users SET rights = 259 WHERE username = 'player';
UPDATE users SET rights = 67108876 WHERE username = 'player';
```
#### Example Configs