## 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
50 lines
2.2 KiB
Markdown
50 lines
2.2 KiB
Markdown
---
|
|
name: migrate-foundation
|
|
description: >
|
|
Trigger: when migrating ANY RunUO code to ModernUO. Always load this skill first.
|
|
Covers: namespace changes, naming conventions, attribute renames, logging, threading, performance.
|
|
---
|
|
|
|
# RunUO -> ModernUO Foundation Migration
|
|
|
|
## When This Activates
|
|
- Converting ANY RunUO 2.7 script to ModernUO
|
|
- Always apply these changes FIRST before system-specific migration
|
|
|
|
## Universal Changes Checklist
|
|
1. File-scoped namespace: `namespace X { ... }` -> `namespace X;`
|
|
2. `using ModernUO.Serialization;` -- add for any serializable type
|
|
3. Rename fields: `m_FieldName` -> `_fieldName`
|
|
4. `[Constructable]` -> `[Constructible]`
|
|
5. `Console.WriteLine` -> `LogFactory.GetLogger(typeof(X))` -> `logger.Information(...)`
|
|
6. `DateTime.UtcNow` -> `Core.Now`
|
|
7. `World.Mobiles`/`World.Items` iteration -> spatial queries (`map.GetMobilesInRange<T>()`)
|
|
8. Remove `lock`, `volatile`, `ConcurrentDictionary`, `Mutex` -- server is single-threaded
|
|
9. Remove `Task.Run`, `new Thread` -- use `Timer.StartTimer()` instead
|
|
10. `ArrayPool<T>.Shared` -> `STArrayPool<T>.Shared`
|
|
11. `new List<T>()` on hot paths -> `PooledRefList<T>.Create()`
|
|
12. Modernize property syntax: `{ get { return x; } }` -> `{ get => x; }`
|
|
13. Delete `MyType(Serial serial) : base(serial)` constructor -- auto-generated
|
|
14. `Name = "text"` in constructor -> `public override string DefaultName => "text";`
|
|
|
|
## Quick Reference
|
|
| RunUO | ModernUO |
|
|
|---|---|
|
|
| `[Constructable]` | `[Constructible]` |
|
|
| `m_Field` | `_field` |
|
|
| `Console.WriteLine(...)` | `logger.Information(...)` |
|
|
| `DateTime.UtcNow` | `Core.Now` |
|
|
| `MyItem(Serial serial) : base(serial)` | DELETE |
|
|
| `lock (_obj) { }` | Remove entirely |
|
|
| `ConcurrentDictionary` | `Dictionary` |
|
|
| `ArrayPool<T>.Shared` | `STArrayPool<T>.Shared` |
|
|
|
|
## Anti-Patterns
|
|
- Don't rename existing `m_` fields in code you're not otherwise migrating
|
|
- Don't add threading constructs -- everything is single-threaded
|
|
- Don't use allocating LINQ (`.ToList()`, `.GroupBy()`, etc.) on hot paths
|
|
|
|
## See Also
|
|
- `dev-docs/runuo-migration-docs/01-foundation-changes.md` -- complete foundation changes reference
|
|
- `dev-docs/code-standards.md` -- ModernUO coding standards and LINQ tiers
|
|
- `dev-docs/threading-model.md` -- Why single-threaded, what's allowed
|