mud_server.db.characters_repo
Character repository operations for the SQLite backend.
This module isolates character persistence and room/inventory state operations
from the compatibility facade in mud_server.db.database.
Functions
|
Return a world-scoped character name for an exact character identity. |
|
Create a character for an existing account. |
|
Return |
|
Return a character row by name, or |
|
Return a character row by name scoped to a specific world, or |
|
Return a character row by id, or |
|
Return the character name for an id, or |
|
Return ordered character rows owned by a user in one explicit world. |
|
Soft-delete a character by unlinking owner and renaming tombstone row. |
|
Permanently delete a character row and return whether one row changed. |
|
Return the character's current room in the requested world. |
|
Set the character room for a world-scoped character identity. |
|
Return active character names in a room for the selected world. |
|
Return character inventory as a JSON-decoded list for an explicit world. |
|
Persist character inventory as JSON for a world-scoped character identity. |
Module Contents
- mud_server.db.characters_repo.resolve_character_name(name, *, world_id)[source]
Return a world-scoped character name for an exact character identity.
- mud_server.db.characters_repo.create_character_for_user(user_id, name, *, is_guest_created=False, room_id='spawn', world_id, state_seed=None)[source]
Create a character for an existing account.
The function enforces world-scoped slot limits and seeds both location and axis/snapshot state in the same transaction.
- mud_server.db.characters_repo.character_exists(name)[source]
Return
Truewhen a character with this name exists in any world.
- mud_server.db.characters_repo.get_character_by_name(name)[source]
Return a character row by name, or
Nonewhen missing.
- mud_server.db.characters_repo.get_character_by_name_in_world(name, world_id)[source]
Return a character row by name scoped to a specific world, or
Nonewhen missing.This is the preferred lookup for the translation layer and any system that must avoid cross-world name collisions. Two characters in different worlds may share the same name; a bare
get_character_by_namelookup would return whichever row the DB engine happens to surface first, which is a silent correctness bug in multi-world contexts.
- mud_server.db.characters_repo.get_character_by_id(character_id)[source]
Return a character row by id, or
Nonewhen missing.
- mud_server.db.characters_repo.get_character_name_by_id(character_id)[source]
Return the character name for an id, or
Nonewhen missing.
- mud_server.db.characters_repo.get_user_characters(user_id, *, world_id)[source]
Return ordered character rows owned by a user in one explicit world.
- mud_server.db.characters_repo.tombstone_character(character_id)[source]
Soft-delete a character by unlinking owner and renaming tombstone row.
- mud_server.db.characters_repo.delete_character(character_id)[source]
Permanently delete a character row and return whether one row changed.
- mud_server.db.characters_repo.get_character_room(name, *, world_id)[source]
Return the character’s current room in the requested world.
- mud_server.db.characters_repo.set_character_room(name, room, *, world_id)[source]
Set the character room for a world-scoped character identity.
- mud_server.db.characters_repo.get_characters_in_room(room, *, world_id)[source]
Return active character names in a room for the selected world.