ModernUO/dev-docs/claude-skills/migrate-from-runuo/migrate-commands-events.md
Kamron Batman 4f9bc1d9f6
feat: Adds AI skills to migrate from RunUO (#2366)
## Summary

Adds comprehensive RunUO → ModernUO migration documentation and Claude AI skills to help shard owners and script authors convert RunUO 2.7 code to ModernUO.

- **10 migration skills** (`dev-docs/claude-skills/migrate-from-runuo/`) — system-by-system conversion guides (foundation, serialization, timers, gumps, packets, property lists, commands/events, persistence, items/mobiles, systems/engines)
- **12 reference docs** (`dev-docs/runuo-migration-docs/`) — deep-reference with before/after examples, API mapping tables, edge cases, and gotchas
- **Updated existing skills** — `modernuo-timers`, `modernuo-serialization`, and `modernuo-threading` now document that `Serialize()` runs on background threads and timers are not thread-safe
- **Updated `CLAUDE.md`** — added migration skill lookup table

### Key migration patterns covered
- Manual `Serialize()`/`Deserialize()` → source-generated `[SerializableField]`
- `Packet` class hierarchy → static `SpanWriter`/`SpanReader` methods
- `Timer` subclasses → `TimerExecutionToken` fire-and-forget
- `Gump` → `StaticGump<T>`/`DynamicGump` with builders
- `EventSink.WorldSave` → `GenericPersistence`
- `ObjectPropertyList` → `IPropertyList` with string hole rules
- Universal changes: naming (`m_` → `_`), `[Constructable]` → `[Constructible]`, logging, spatial queries
2026-03-13 00:33:45 -07:00

39 lines
1.7 KiB
Markdown

---
name: migrate-commands-events
description: >
Trigger: when converting RunUO command registration, EventSink handlers, or event delegate patterns.
Covers: event name changes, delegate removal, Configure vs Initialize.
---
# RunUO -> ModernUO Commands & Events Migration
## When This Activates
- Converting `EventSink` subscriptions
- Converting event handler signatures
- Moving from `Initialize()` to `Configure()`
- Converting WorldSave/WorldLoad events to GenericPersistence
## Conversion Steps
1. Change `Initialize()` to `Configure()` for event registration
2. Remove delegate constructors: `new LoginEventHandler(OnLogin)` -> `OnLogin`
3. Rename events: `Login` -> `Connected`, `Logout` -> `Disconnected`
4. Update signatures: `OnLogin(LoginEventArgs e)` -> `OnConnected(Mobile m)`
5. WorldSave persistence -> convert to `GenericPersistence` (see migrate-persistence skill)
## Event Mapping
| RunUO | ModernUO |
|---|---|
| `EventSink.Login` | `EventSink.Connected` (Action<Mobile>) |
| `EventSink.Logout` | `EventSink.Disconnected` (Action<Mobile>) |
| `EventSink.WorldSave` | `EventSink.WorldSave` (Action -- no args) |
| `EventSink.Crashed` | `EventSink.ServerCrashed` |
| `new XXXEventHandler(method)` | `method` (direct reference) |
## Commands (Minimal Changes)
Commands use the same `CommandSystem.Register()` API. Main change: use `Configure()` for registration.
## See Also
- `dev-docs/runuo-migration-docs/07-commands-events.md` -- detailed migration reference
- `dev-docs/events.md` -- complete ModernUO event system
- `dev-docs/claude-skills/modernuo-events.md` -- ModernUO events skill
- `dev-docs/claude-skills/modernuo-commands-targeting.md` -- ModernUO commands skill