Commit Graph

24 Commits

Author SHA1 Message Date
bridge
094a8fdd00 feat: data reload system 2026-01-18 16:47:54 +08:00
4thfever
df8b1b9433 Refactor/event (#31)
重构事件机制和部分拍卖会机制
2026-01-14 16:58:50 +08:00
4thfever
63fc2f828e Feat/auction (#30)
Add gathering events, in which multiple avatars participate
Add auction event

Closes #24
2026-01-14 02:33:13 +08:00
4thfever
95e1f11502 Refactor/history (#25)
add multi process history modification
2026-01-12 23:25:53 +08:00
bridge
c6a574a2ac refactor: remove switch weapon action 2026-01-08 22:19:56 +08:00
Zihao Xu
a1f08dd0ab feat: SQLite event storage with pagination and filtering
Implement SQLite-based event persistence as specified in sqlite-event-manager.md.

## Changes

### Backend
- **EventStorage** (`src/classes/event_storage.py`): New SQLite storage layer
  - Cursor-based pagination with compound cursor `{month_stamp}_{rowid}`
  - Avatar filtering (single and pair queries)
  - Major/minor event separation
  - Cleanup API with `keep_major` and `before_month_stamp` filters

- **EventManager** (`src/classes/event_manager.py`): Refactored to use SQLite
  - Delegates to EventStorage for persistence
  - Memory fallback mode for testing
  - New `get_events_paginated()` method

- **API** (`src/server/main.py`):
  - `GET /api/events` - Paginated event retrieval with filtering
  - `DELETE /api/events/cleanup` - User-triggered cleanup

### Frontend
- **EventPanel.vue**: Scroll-to-load pagination, dual-person filter UI
- **world.ts**: Event state management with pagination
- **game.ts**: New API client methods

### Testing
- 81 new tests for EventStorage, EventManager, and API
- Added `pytest-asyncio` and `httpx` to requirements.txt

## Known Issues: Save/Load is Currently Broken

After loading a saved game, the following issues occur:

1. **Wrong database used**: API returns events from the startup database instead
   of the loaded save's `_events.db` file
2. **Events from wrong time period**: Shows events from year 115 when loaded
   save is at year 114
3. **Pagination broken after load**: `has_more` returns `False` despite hundreds
   of events in the saved database
4. **Filter functionality broken**: Character selection filter stops working
   after loading a game

Root cause: `load_game.py` does not properly switch the EventManager's database
connection to the loaded save's events database.
2026-01-07 00:40:34 -08:00
bridge
8d7e11b021 add elixir 2026-01-05 23:04:55 +08:00
bridge
5b5cd79cb5 add circulation manager 2026-01-03 22:15:25 +08:00
bridge
e2d03b587d refactor world desc 2026-01-03 21:25:24 +08:00
bridge
f7a4fb23c8 refactor world desc 2026-01-03 20:25:25 +08:00
bridge
8124537cff update distance 2025-12-08 22:39:44 +08:00
bridge
303bffe413 decide only one avatar each time 2025-12-08 22:08:53 +08:00
bridge
d7549d7d32 update celestial phenon 2025-11-29 13:30:06 +08:00
bridge
d2cf568154 add long term objective 2025-11-19 00:04:38 +08:00
bridge
62fa84a809 update celestial phenon 2025-11-13 12:15:08 +08:00
bridge
86be290633 refactor event handler 2025-10-24 23:50:05 +08:00
bridge
110f15bb4f refactor map info 2025-10-12 02:24:29 +08:00
bridge
e17c9e35a9 add observe range 2025-10-04 22:08:10 +08:00
bridge
40ef5b9cb6 update prompt 2025-09-21 17:25:27 +08:00
bridge
7933f20614 update city 2025-09-12 23:02:41 +08:00
bridge
d83379e3a5 update prompt 2025-09-07 20:12:04 +08:00
bridge
3047de0367 add action chain 2025-09-02 00:35:07 +08:00
bridge
96615c0c0d add new actions and AI 2025-08-28 22:25:05 +08:00
bridge
7851cbba0d add map 2025-08-20 01:18:04 +08:00