756 lines
26 KiB
Markdown
756 lines
26 KiB
Markdown
# Odinsea Elixir Port - Progress Tracker
|
|
|
|
## Project Overview
|
|
|
|
**Reference:** Java MapleStory server (odinsea) at `/home/ra/lucid`
|
|
**Target:** Elixir/OTP implementation at `/home/ra/odinsea-elixir`
|
|
**Client Version:** GMS v342 (Rev 342)
|
|
|
|
---
|
|
|
|
## Phase 1: Foundation ✅ COMPLETE
|
|
|
|
### 1.1 Project Structure & Tooling ✅
|
|
- [x] Initialize Elixir project with `mix new`
|
|
- [x] Configure project dependencies (mix.exs)
|
|
- [x] Create directory structure aligned with domain boundaries
|
|
- [x] Set up development tooling placeholders (credo, dialyzer)
|
|
|
|
**Dependencies Configured:**
|
|
- Networking: `:ranch`, `:gen_state_machine`
|
|
- Database: `:ecto_sql`, `:myxql`, `:redix`
|
|
- Utilities: `:jason`, `:decimal`, `:timex`, `:poolboy`, `:nimble_pool`
|
|
- Observability: `:telemetry`, `:logger_file_backend`
|
|
- Development: `:credo`, `:dialyxir`
|
|
|
|
### 1.2 Configuration System ✅
|
|
- [x] Port `config/global.properties` → `config/runtime.exs`
|
|
- [x] Port `config/plugin.properties` → feature flags
|
|
- [x] Create `config/config.exs` for defaults
|
|
|
|
**Files Created:**
|
|
- `config/config.exs` - Default configuration
|
|
- `config/runtime.exs` - Environment-based configuration
|
|
|
|
### 1.3 Core Types & Constants ✅
|
|
- [x] Port `GameConstants` → `Odinsea.Constants.Game`
|
|
- [x] Port `ServerConstants` → `Odinsea.Constants.Server`
|
|
|
|
**Files Created:**
|
|
- `lib/odinsea/constants/server.ex` - Server/protocol constants
|
|
- `lib/odinsea/constants/game.ex` - Game mechanics constants
|
|
|
|
---
|
|
|
|
## Phase 2: Networking Layer ✅ COMPLETE
|
|
|
|
### 2.1 Packet Infrastructure ✅
|
|
- [x] Port `InPacket` → `Odinsea.Net.Packet.In`
|
|
- [x] Port `OutPacket` → `Odinsea.Net.Packet.Out`
|
|
- [x] Port `HexTool` → `Odinsea.Net.Hex`
|
|
|
|
**Files Created:**
|
|
- `lib/odinsea/net/packet/in.ex` - Incoming packet decoder (little-endian)
|
|
- `lib/odinsea/net/packet/out.ex` - Outgoing packet encoder (little-endian)
|
|
- `lib/odinsea/net/hex.ex` - Hex encoding/decoding utilities
|
|
|
|
### 2.2 Cryptography ✅
|
|
- [x] Port AES encryption (`AESCipher`)
|
|
- [x] Port InnoGames cipher (`IGCipher` - shuffle/hash)
|
|
- [x] Port ClientCrypto (IV management, header encoding/decoding)
|
|
- [x] Port LoginCrypto (password hashing SHA-1/SHA-512, RSA decryption)
|
|
- [x] Port BitTools utilities (byte manipulation, string extraction)
|
|
|
|
**Files Created:**
|
|
- `lib/odinsea/net/cipher/aes_cipher.ex` - AES-ECB encryption with IV handling
|
|
- `lib/odinsea/net/cipher/ig_cipher.ex` - InnoGames IV hash transformation
|
|
- `lib/odinsea/net/cipher/client_crypto.ex` - Client crypto coordinator (encrypt/decrypt/header)
|
|
- `lib/odinsea/net/cipher/login_crypto.ex` - Password hashing and RSA operations
|
|
- `lib/odinsea/util/bit_tools.ex` - Bit/byte manipulation utilities
|
|
|
|
**Reference Files:**
|
|
- `src/handling/netty/cipher/AESCipher.java` ✅
|
|
- `src/handling/netty/cipher/IGCipher.java` ✅
|
|
- `src/handling/netty/ClientCrypto.java` ✅
|
|
- `src/client/LoginCrypto.java` ✅
|
|
- `src/tools/BitTools.java` ✅
|
|
|
|
### 2.3 Client Connection ✅ (Basic)
|
|
- [x] Implement TCP acceptor pool with gen_tcp
|
|
- [x] Port `ClientHandler` → `Odinsea.Net.Client`
|
|
- [x] Implement connection state machine structure
|
|
- [ ] Implement alive ack/ping handling
|
|
|
|
**Files Created:**
|
|
- `lib/odinsea/login/listener.ex` - Login server TCP listener
|
|
- `lib/odinsea/login/client.ex` - Login client handler
|
|
- `lib/odinsea/channel/server.ex` - Channel server TCP listener
|
|
- `lib/odinsea/channel/client.ex` - Channel client handler
|
|
- `lib/odinsea/shop/listener.ex` - Cash shop TCP listener
|
|
- `lib/odinsea/shop/client.ex` - Cash shop client handler
|
|
|
|
### 2.4 Packet Processor / Opcodes ✅
|
|
- [x] Port packet opcode definitions (`ClientPacket`/`LoopbackPacket`)
|
|
- [x] Port `PacketProcessor` → `Odinsea.Net.Processor`
|
|
|
|
**Files Created:**
|
|
- `lib/odinsea/net/opcodes.ex` - All client/server packet opcodes
|
|
- `lib/odinsea/net/processor.ex` - Central packet routing/dispatch system
|
|
|
|
---
|
|
|
|
## Phase 3: Database Layer 🔄 PARTIAL
|
|
|
|
### 3.1 Database Connection ✅
|
|
- [x] Configure Ecto with MyXQL adapter
|
|
- [x] Port connection pool settings
|
|
- [ ] Set up migration structure
|
|
|
|
**Files Created:**
|
|
- `lib/odinsea/database/repo.ex` - Ecto repository
|
|
|
|
### 3.2 Schemas & Repos 🔄 PARTIAL
|
|
- [x] Create Ecto schemas for core tables:
|
|
- [x] accounts
|
|
- [x] characters
|
|
- [ ] inventory_items
|
|
- [ ] storage
|
|
- [ ] buddies
|
|
- [ ] guilds
|
|
- [ ] parties
|
|
- [x] Implement Database Context module (Odinsea.Database.Context)
|
|
|
|
**Files Created:**
|
|
- `lib/odinsea/database/schema/account.ex` - Account schema with changesets
|
|
- `lib/odinsea/database/schema/character.ex` - Character schema with changesets
|
|
|
|
### 3.3 Redis Connection ✅ (Basic)
|
|
- [x] Configure Redix connection
|
|
- [x] Implement migration token storage (Redis + ETS)
|
|
- [ ] Port pub/sub messaging system
|
|
- [ ] Implement full cross-server message passing
|
|
|
|
---
|
|
|
|
## Phase 4: Login Server ✅ HANDLERS COMPLETE
|
|
|
|
### 4.1 Login Handlers ✅
|
|
- [x] Port `CharLoginHandler` → `Odinsea.Login.Handler`
|
|
- [x] Implement auth flow:
|
|
- [x] Permission request
|
|
- [x] Password check (with SPW)
|
|
- [x] World selection
|
|
- [x] Character list
|
|
- [x] Character creation/deletion
|
|
- [x] Character selection
|
|
- [x] Integrate with database (Odinsea.Database.Context)
|
|
|
|
**Files Created:**
|
|
- `lib/odinsea/login/handler.ex` - All login packet handlers
|
|
|
|
**Reference Files:**
|
|
- `src/handling/login/handler/CharLoginHandler.java` ✅
|
|
|
|
### 4.2 Login Packets ✅
|
|
- [x] Port `LoginPacket` → `Odinsea.Login.Packets`
|
|
- [x] Implement packet builders:
|
|
- [x] Hello/handshake packets
|
|
- [x] Authentication responses
|
|
- [x] Server/world list
|
|
- [x] Character list
|
|
- [x] Character name check
|
|
- [x] Character creation/deletion
|
|
- [x] Migration command
|
|
|
|
**Files Created:**
|
|
- `lib/odinsea/login/packets.ex` - Login server packet builders
|
|
|
|
**Reference Files:**
|
|
- `src/tools/packet/LoginPacket.java` ✅
|
|
|
|
### 4.3 Account Management ⏳
|
|
- [ ] Port `MapleClient` → `Odinsea.Login.Session`
|
|
- [ ] Implement account storage/caching
|
|
- [ ] Handle session state transitions
|
|
|
|
---
|
|
|
|
## Phase 5: Game World Core 🔄 STRUCTURE READY
|
|
|
|
### 5.1 World Server ✅ (Structure)
|
|
- [x] Port `World` → `Odinsea.World` (placeholder)
|
|
- [ ] Implement cross-server messaging
|
|
- [ ] Port party/guild/family/alliance management
|
|
|
|
**Files Created:**
|
|
- `lib/odinsea/world.ex` - World state
|
|
- `lib/odinsea/world/supervisor.ex` - World services supervisor
|
|
- `lib/odinsea/world/party.ex` - Party service (placeholder)
|
|
- `lib/odinsea/world/guild.ex` - Guild service (placeholder)
|
|
- `lib/odinsea/world/family.ex` - Family service (placeholder)
|
|
- `lib/odinsea/world/expedition.ex` - Expedition service (placeholder)
|
|
- `lib/odinsea/world/messenger.ex` - Messenger service (placeholder)
|
|
|
|
### 5.2 Channel Server ✅ (Structure)
|
|
- [x] Port `ChannelServer` → `Odinsea.Channel` (structure)
|
|
- [x] Implement channel registry
|
|
- [ ] Handle player storage per channel
|
|
|
|
**Files Created:**
|
|
- `lib/odinsea/channel/supervisor.ex` - Channel supervisor
|
|
- `lib/odinsea/channel/server.ex` - Individual channel server
|
|
|
|
### 5.3 Player Storage ✅
|
|
- [x] Port `PlayerStorage` → `Odinsea.Channel.Players`
|
|
- [x] Implement character loading/saving (via Context)
|
|
- [x] Handle channel transfers (Migration system)
|
|
|
|
### 5.4 Migration System ✅
|
|
- [x] Port `CharacterTransfer` → `Odinsea.World.Migration`
|
|
- [x] Implement migration token creation/validation
|
|
- [x] Cross-server token storage (ETS + Redis)
|
|
- [x] Token expiration and cleanup
|
|
|
|
### 5.5 Inter-Server Handler ✅
|
|
- [x] Port `InterServerHandler` → `Odinsea.Channel.Handler.InterServer`
|
|
- [x] Implement MigrateIn handling
|
|
- [x] Implement ChangeChannel handling
|
|
|
|
### 5.6 Character (In-Game State) ✅
|
|
- [x] Port `MapleCharacter` → `Odinsea.Game.Character` (minimal)
|
|
- [x] Implement character stats structure
|
|
- [x] Implement position tracking
|
|
- [x] Character loading from database
|
|
- [x] Character saving to database
|
|
- [x] Map change logic
|
|
|
|
**Files Created:**
|
|
- `lib/odinsea/game/character.ex` - In-game character GenServer
|
|
|
|
**Reference Files:**
|
|
- `src/client/MapleCharacter.java` ✅ (minimal - 150 fields remaining)
|
|
- `src/client/PlayerStats.java` ✅ (minimal)
|
|
|
|
---
|
|
|
|
## Phase 6: Game Systems ⏳ NOT STARTED
|
|
|
|
### 6.1 Maps 🔄 STARTED
|
|
- [x] Port `MapleMap` → `Odinsea.Game.Map` (minimal implementation)
|
|
- [x] Implement player spawn/despawn on maps
|
|
- [x] Implement map broadcasting (packets to all players)
|
|
- [ ] Port `MapleMapFactory` → map loading/caching
|
|
- [ ] Implement map objects (reactors, portals)
|
|
- [ ] Load map data from WZ files
|
|
|
|
**Files Created:**
|
|
- `lib/odinsea/game/map.ex` - Map instance GenServer
|
|
|
|
**Reference Files:**
|
|
- `src/server/maps/MapleMap.java` ✅ (partially)
|
|
|
|
### 6.2 Life (Mobs/NPCs) ⏳
|
|
- [ ] Port `MapleLifeFactory` → `Odinsea.Game.Life`
|
|
- [ ] Port `MapleMonster` → monster handling
|
|
- [ ] Port `MapleNPC` → NPC handling
|
|
|
|
**Reference Files:**
|
|
- `src/server/life/*.java`
|
|
|
|
### 6.3 Items & Inventory ⏳
|
|
- [ ] Port `MapleItemInformationProvider`
|
|
- [ ] Port `MapleInventory` → `Odinsea.Game.Inventory`
|
|
- [ ] Implement item types (equip, use, setup, etc.)
|
|
|
|
**Reference Files:**
|
|
- `src/server/MapleItemInformationProvider.java`
|
|
- `src/client/inventory/*.java`
|
|
|
|
### 6.4 Skills & Buffs ⏳
|
|
- [ ] Port `SkillFactory` → `Odinsea.Game.Skills`
|
|
- [ ] Implement buff management
|
|
- [ ] Port cooldown handling
|
|
|
|
**Reference Files:**
|
|
- `src/client/SkillFactory.java`
|
|
- `src/client/status/*.java`
|
|
|
|
### 6.6 Movement ✅ (Simplified)
|
|
- [x] Port `MovementParse` → `Odinsea.Game.Movement` (simplified)
|
|
- [x] Parse movement commands
|
|
- [x] Extract final position from movement data
|
|
- [ ] Full movement type parsing (40+ movement command types)
|
|
- [ ] Movement validation and anti-cheat
|
|
|
|
**Files Created:**
|
|
- `lib/odinsea/game/movement.ex` - Movement parsing
|
|
|
|
**Reference Files:**
|
|
- `src/handling/channel/handler/MovementParse.java` ✅ (simplified)
|
|
|
|
### 6.5 Quests ⏳
|
|
- [ ] Port `MapleQuest` → `Odinsea.Game.Quests`
|
|
- [ ] Implement quest management
|
|
|
|
**Reference Files:**
|
|
- `src/server/quest/MapleQuest.java`
|
|
|
|
---
|
|
|
|
## Phase 7: Channel Handlers 🔄 IN PROGRESS
|
|
|
|
### 7.1 Player Handlers 🔄 PARTIAL
|
|
- [x] Port `PlayerHandler` → `Odinsea.Channel.Handler.Player` (basic)
|
|
- [x] Implement movement (MovePlayer)
|
|
- [x] Implement map changes (ChangeMap)
|
|
- [x] Implement keybinding changes (ChangeKeymap)
|
|
- [x] Implement skill macro changes (ChangeSkillMacro)
|
|
- [x] Stub attack handlers (CloseRange, Ranged, Magic)
|
|
- [x] Stub damage handler (TakeDamage)
|
|
- [ ] Full attack implementation (damage calculation, mob interaction)
|
|
- [ ] Stats handling (AP/SP distribution)
|
|
- [ ] Skill usage and buffs
|
|
- [ ] Item effects
|
|
- [ ] Chair usage
|
|
- [ ] Emotion changes
|
|
|
|
**Files Created:**
|
|
- `lib/odinsea/channel/handler/player.ex` - Player action handlers
|
|
|
|
**Reference Files:**
|
|
- `src/handling/channel/handler/PlayerHandler.java` ✅ (partial)
|
|
- `src/handling/channel/handler/StatsHandling.java` ⏳
|
|
|
|
### 7.2 Inventory Handlers ⏳
|
|
- [ ] Port `InventoryHandler` → `Odinsea.Channel.Handler.Inventory`
|
|
- [ ] Implement item usage, scrolling, sorting
|
|
|
|
**Reference Files:**
|
|
- `src/handling/channel/handler/InventoryHandler.java`
|
|
|
|
### 7.3 Mob Handlers ⏳
|
|
- [ ] Port `MobHandler` → `Odinsea.Channel.Handler.Mob`
|
|
- [ ] Implement mob movement, damage, skills
|
|
|
|
**Reference Files:**
|
|
- `src/handling/channel/handler/MobHandler.java`
|
|
|
|
### 7.4 NPC Handlers ⏳
|
|
- [ ] Port `NPCHandler` → `Odinsea.Channel.Handler.NPC`
|
|
- [ ] Implement NPC talk, shops, storage
|
|
|
|
**Reference Files:**
|
|
- `src/handling/channel/handler/NPCHandler.java`
|
|
|
|
### 7.5 Chat & Social Handlers ✅ CHAT COMPLETE
|
|
- [x] Port `ChatHandler` → `Odinsea.Channel.Handler.Chat`
|
|
- [x] Implement general chat (map broadcast)
|
|
- [x] Implement party chat routing (buddy, party, guild, alliance, expedition)
|
|
- [x] Implement whisper/find player
|
|
- [x] Add chat packet builders (UserChat, Whisper, MultiChat, FindPlayer)
|
|
- [ ] Port `BuddyListHandler` → buddy system
|
|
- [ ] Port `PartyHandler`, `GuildHandler`, `FamilyHandler`
|
|
|
|
**Files Created:**
|
|
- `lib/odinsea/channel/handler/chat.ex` - Chat packet handlers
|
|
|
|
**Reference Files:**
|
|
- `src/handling/channel/handler/ChatHandler.java` ✅
|
|
- `src/handling/channel/handler/BuddyListHandler.java` ⏳
|
|
- `src/handling/channel/handler/PartyHandler.java` ⏳
|
|
- `src/handling/channel/handler/GuildHandler.java` ⏳
|
|
|
|
---
|
|
|
|
## Phase 8: Cash Shop ⏳ NOT STARTED
|
|
|
|
### 8.1 Cash Shop Server ✅ (Structure)
|
|
- [x] Port `CashShopServer` → `Odinsea.Shop` (structure)
|
|
- [ ] Implement cash item handling
|
|
- [ ] Implement coupon system
|
|
|
|
**Files Created:**
|
|
- `lib/odinsea/shop/listener.ex` - Cash shop listener
|
|
- `lib/odinsea/shop/client.ex` - Cash shop client
|
|
|
|
### 8.2 Channel Packets 🔄 PARTIAL
|
|
- [x] Basic channel packet builders
|
|
- [x] Character spawn packet (simplified)
|
|
- [x] Character despawn packet
|
|
- [x] Chat packets (UserChat, Whisper, MultiChat, FindPlayer)
|
|
- [x] Movement packet (MovePlayer)
|
|
- [ ] Full character encoding (equipment, buffs, pets)
|
|
- [ ] Damage packets
|
|
- [ ] Skill effect packets
|
|
- [ ] Attack packets
|
|
|
|
**Files Updated:**
|
|
- `lib/odinsea/channel/packets.ex` - Added spawn_player, remove_player, chat packets
|
|
|
|
---
|
|
|
|
## Phase 9: Scripting System ⏳ NOT STARTED
|
|
|
|
### 9.1 Script Engine ⏳
|
|
- [ ] Integrate QuickJS or Lua runtime
|
|
- [ ] Port `AbstractScriptManager`
|
|
- [ ] Implement script globals (cm, em, pi, etc.)
|
|
|
|
**Reference Files:**
|
|
- `src/scripting/*.java`
|
|
|
|
---
|
|
|
|
## Phase 10: Advanced Features ⏳ NOT STARTED
|
|
|
|
### 10.1 Timers & Scheduling ⏳
|
|
- [ ] Port timer system to Elixir processes
|
|
- [ ] World timer, Map timer, Buff timer, etc.
|
|
|
|
**Reference Files:**
|
|
- `src/server/Timer.java`
|
|
|
|
### 10.2 Anti-Cheat ⏳
|
|
- [ ] Port `MapleAntiCheat` → `Odinsea.AntiCheat`
|
|
- [ ] Implement lie detector system
|
|
|
|
**Reference Files:**
|
|
- `src/client/anticheat/*.java`
|
|
|
|
### 10.3 Events ⏳
|
|
- [ ] Port event system
|
|
- [ ] Implement scheduled events
|
|
|
|
**Reference Files:**
|
|
- `src/server/events/*.java`
|
|
|
|
### 10.4 Admin Commands ⏳
|
|
- [ ] Port `AdminHandler` → `Odinsea.Admin`
|
|
- [ ] Implement command system
|
|
|
|
**Reference Files:**
|
|
- `src/handling/admin/*.java`
|
|
|
|
---
|
|
|
|
## Phase 11: Testing & Optimization ⏳ NOT STARTED
|
|
|
|
- [ ] Unit tests for packet encoding/decoding
|
|
- [ ] Integration tests for login flow
|
|
- [ ] Load testing for channel capacity
|
|
- [ ] Performance optimization
|
|
- [ ] Documentation
|
|
|
|
---
|
|
|
|
## File Mapping Reference
|
|
|
|
### Core Application
|
|
| Java | Elixir | Status |
|
|
|------|--------|--------|
|
|
| `src/app/Program.java` | `lib/odinsea/application.ex` | ✅ Structure ready |
|
|
| `src/app/ServerStart.java` | `lib/odinsea/application.ex` | ✅ Structure ready |
|
|
| `src/app/ServerStop.java` | `lib/odinsea/application.ex` | ✅ Structure ready |
|
|
| `src/app/Config.java` | `config/runtime.exs` | ✅ Done |
|
|
| `src/app/Plugin.java` | `config/runtime.exs` (features) | ✅ Done |
|
|
| `src/app/Logging.java` | Elixir Logger | ✅ Native |
|
|
|
|
### Networking
|
|
| Java | Elixir | Status |
|
|
|------|--------|--------|
|
|
| `src/handling/PacketProcessor.java` | `lib/odinsea/net/processor.ex` | ✅ Done |
|
|
| `src/handling/ClientPacket.java` | `lib/odinsea/net/opcodes.ex` | ✅ Done |
|
|
| `src/tools/data/InPacket.java` | `lib/odinsea/net/packet/in.ex` | ✅ Done |
|
|
| `src/tools/data/OutPacket.java` | `lib/odinsea/net/packet/out.ex` | ✅ Done |
|
|
| `src/tools/HexTool.java` | `lib/odinsea/net/hex.ex` | ✅ Done |
|
|
| `src/handling/netty/cipher/AESCipher.java` | `lib/odinsea/net/cipher/aes_cipher.ex` | ✅ Done |
|
|
| `src/handling/netty/cipher/IGCipher.java` | `lib/odinsea/net/cipher/ig_cipher.ex` | ✅ Done |
|
|
| `src/handling/netty/ClientCrypto.java` | `lib/odinsea/net/cipher/client_crypto.ex` | ✅ Done |
|
|
| `src/client/LoginCrypto.java` | `lib/odinsea/net/cipher/login_crypto.ex` | ✅ Done |
|
|
| `src/tools/BitTools.java` | `lib/odinsea/util/bit_tools.ex` | ✅ Done |
|
|
|
|
### Database
|
|
| Java | Elixir | Status |
|
|
|------|--------|--------|
|
|
| `src/database/DatabaseConnection.java` | `lib/odinsea/database/repo.ex` | ✅ Structure ready |
|
|
| `src/database/RedisConnection.java` | `config/runtime.exs` | ✅ Config ready |
|
|
|
|
### Login
|
|
| Java | Elixir | Status |
|
|
|------|--------|--------|
|
|
| `src/handling/login/handler/CharLoginHandler.java` | `lib/odinsea/login/handler.ex` | ✅ Done |
|
|
| `src/tools/packet/LoginPacket.java` | `lib/odinsea/login/packets.ex` | ✅ Done |
|
|
| `src/client/MapleClient.java` | `lib/odinsea/login/session.ex` | ⏳ TODO |
|
|
| N/A | `lib/odinsea/login/listener.ex` | ✅ Created |
|
|
| N/A | `lib/odinsea/login/client.ex` | ✅ Created |
|
|
|
|
### World
|
|
| Java | Elixir | Status |
|
|
|------|--------|--------|
|
|
| `src/handling/world/World.java` | `lib/odinsea/world.ex` | ✅ Structure ready |
|
|
| `src/handling/world/MapleParty.java` | `lib/odinsea/world/party.ex` | ✅ Structure ready |
|
|
| `src/handling/world/guild/*.java` | `lib/odinsea/world/guild.ex` | ✅ Structure ready |
|
|
| `src/handling/world/family/*.java` | `lib/odinsea/world/family.ex` | ✅ Structure ready |
|
|
|
|
### Channel
|
|
| Java | Elixir | Status |
|
|
|------|--------|--------|
|
|
| `src/handling/channel/ChannelServer.java` | `lib/odinsea/channel/server.ex` | ✅ Structure ready |
|
|
| `src/handling/channel/PlayerStorage.java` | `lib/odinsea/channel/players.ex` | ✅ Done |
|
|
| `src/handling/channel/handler/MovementParse.java` | `lib/odinsea/game/movement.ex` | 🔄 Simplified |
|
|
| `src/handling/channel/handler/ChatHandler.java` | `lib/odinsea/channel/handler/chat.ex` | ✅ Done |
|
|
| `src/handling/channel/handler/PlayerHandler.java` | `lib/odinsea/channel/handler/player.ex` | 🔄 Partial (movement, stubs) |
|
|
| N/A | `lib/odinsea/channel/supervisor.ex` | ✅ Created |
|
|
| N/A | `lib/odinsea/channel/client.ex` | ✅ Created + wired handlers |
|
|
| N/A | `lib/odinsea/channel/packets.ex` | 🔄 Partial + chat packets |
|
|
|
|
### Shop
|
|
| Java | Elixir | Status |
|
|
|------|--------|--------|
|
|
| `src/handling/cashshop/CashShopServer.java` | `lib/odinsea/shop/listener.ex` | ✅ Structure ready |
|
|
| N/A | `lib/odinsea/shop/client.ex` | ✅ Created |
|
|
|
|
### Game Systems
|
|
| Java | Elixir | Status |
|
|
|------|--------|--------|
|
|
| `src/client/MapleCharacter.java` | `lib/odinsea/game/character.ex` | 🔄 Minimal (stats + position) |
|
|
| `src/client/PlayerStats.java` | `lib/odinsea/game/character.ex` | 🔄 Minimal |
|
|
| `src/server/maps/MapleMap.java` | `lib/odinsea/game/map.ex` | 🔄 Minimal (spawn/despawn) |
|
|
| `src/server/maps/MapleMapFactory.java` | ⏳ TODO | ⏳ Not started |
|
|
| `src/client/inventory/MapleInventory.java` | ⏳ TODO | ⏳ Not started |
|
|
| `src/client/SkillFactory.java` | ⏳ TODO | ⏳ Not started |
|
|
|
|
---
|
|
|
|
## Project Statistics
|
|
|
|
| Metric | Count |
|
|
|--------|-------|
|
|
| Files Created | 40+ |
|
|
| Lines of Code (Elixir) | ~7,500+ |
|
|
| Modules Implemented | 37+ |
|
|
| Opcodes Defined | 160+ |
|
|
| Registries | 5 (Player, Channel, Character, Map, Client) |
|
|
| Supervisors | 4 (World, Channel, Client, Map) |
|
|
| Channel Handlers | 2 (Chat ✅, Player 🔄) |
|
|
|
|
---
|
|
|
|
## Progress Summary
|
|
|
|
| Phase | Status | % Complete |
|
|
|-------|--------|------------|
|
|
| 1. Foundation | ✅ Complete | 100% |
|
|
| 2. Networking | ✅ Complete | 100% |
|
|
| 3. Database | 🔄 Partial | 65% |
|
|
| 4. Login Server | ✅ Complete | 100% |
|
|
| 5. World/Channel | 🔄 Core Complete | 70% |
|
|
| 6. Game Systems | 🔄 Started | 20% |
|
|
| 7. Handlers | 🔄 In Progress | 25% |
|
|
| 8. Cash Shop | 🔄 Structure + Packets | 30% |
|
|
| 9. Scripting | ⏳ Not Started | 0% |
|
|
| 10. Advanced | ⏳ Not Started | 0% |
|
|
| 11. Testing | ⏳ Not Started | 0% |
|
|
|
|
**Overall Progress: ~45%**
|
|
|
|
---
|
|
|
|
## Next Session Recommendations
|
|
|
|
### High Priority (Database Integration)
|
|
1. **Integrate Login Handlers with Database**
|
|
- Implement `authenticate_user/3` with actual DB queries
|
|
- Load characters from database in `load_characters/2`
|
|
- Character name validation against DB
|
|
- Account/character creation in database
|
|
- Ban checking (IP, MAC, account)
|
|
|
|
2. **Implement Migration System**
|
|
- Create Ecto migrations for accounts/characters tables
|
|
- Set up migration tokens for channel transfers
|
|
- Session management across servers
|
|
|
|
3. **Complete Packet Sending**
|
|
- Implement actual packet sending in `send_packet/2`
|
|
- Add encryption/header generation before sending
|
|
- Test full login flow with real client
|
|
|
|
### Medium Priority (Channel Server)
|
|
4. **Implement Channel Packet Handlers**
|
|
- Port `InterServerHandler` (migration in)
|
|
- Port `PlayerHandler` (movement, attacks)
|
|
- Port `InventoryHandler` (items)
|
|
- Port `NPCHandler` (dialogs, shops)
|
|
|
|
5. **Implement Map System**
|
|
- Port `MapleMapFactory`
|
|
- Create map cache (ETS)
|
|
- Map loading from WZ data
|
|
|
|
6. **Implement Character Loading**
|
|
- Load full character data from database
|
|
- Load inventory/equipment
|
|
- Load skills/buffs/quests
|
|
|
|
---
|
|
|
|
## Notes for Future Agents
|
|
|
|
### Architecture Decisions
|
|
|
|
1. **Concurrency Model:**
|
|
- One process per client connection (GenServer)
|
|
- One process per map instance (GenServer)
|
|
- ETS tables for shared caches (items, maps, mobs)
|
|
- Registry for player lookups by name/ID
|
|
|
|
2. **Packet Handling:**
|
|
- Little-endian encoding (MapleStory standard)
|
|
- Opcode dispatch pattern in client handlers
|
|
- Separate modules for each handler type
|
|
|
|
3. **Database Strategy:**
|
|
- Ecto for type safety and migrations
|
|
- Keep SQL schema compatible with Java server
|
|
- Consider read replicas for static data
|
|
|
|
4. **State Management:**
|
|
- GenServer state for connection/session
|
|
- ETS for global/shared state
|
|
- Redis for cross-server pub/sub
|
|
|
|
### Key Files to Reference
|
|
|
|
- `src/handling/PacketProcessor.java` - Packet dispatch logic
|
|
- `src/handling/netty/cipher/` - Encryption algorithms
|
|
- `src/handling/login/handler/CharLoginHandler.java` - Login flow
|
|
- `src/tools/packet/LoginPacket.java` - Login packet formats
|
|
- `src/server/maps/MapleMap.java` - Map system
|
|
|
|
---
|
|
|
|
## Session History
|
|
|
|
### Session 2026-02-14
|
|
**Completed:**
|
|
- ✅ Implemented `Odinsea.Net.Processor` (central packet routing)
|
|
- ✅ Implemented `Odinsea.Login.Handler` (all login packet handlers)
|
|
- ✅ Implemented `Odinsea.Login.Packets` (login packet builders)
|
|
- ✅ Created `Odinsea.Database.Schema.Account` (Ecto schema)
|
|
- ✅ Created `Odinsea.Database.Schema.Character` (Ecto schema)
|
|
- ✅ Integrated PacketProcessor with Login.Client
|
|
|
|
### Session 2026-02-14 (continued)
|
|
**Completed:**
|
|
- ✅ Implemented `Odinsea.Database.Context` - Full database context module
|
|
- Account authentication (with SHA-512 password verification)
|
|
- Login state management
|
|
- IP logging
|
|
- Character CRUD operations
|
|
- Character name validation
|
|
- ✅ Integrated login handlers with database (real queries instead of stubs)
|
|
- ✅ Implemented `Odinsea.World.Migration` - Server transfer system
|
|
- Migration token creation/validation
|
|
- Cross-server storage (ETS + Redis)
|
|
- Token expiration and cleanup
|
|
- ✅ Implemented `Odinsea.Channel.Players` - Player storage (ETS-based)
|
|
- ✅ Implemented `Odinsea.Channel.Handler.InterServer` - Migration handler
|
|
- ✅ Added `verify_salted_sha512/3` to LoginCrypto
|
|
- ✅ Implemented actual packet sending via TCP sockets
|
|
|
|
**Next Steps:**
|
|
- Channel packet handlers (PlayerHandler, InventoryHandler, etc.)
|
|
- Map system implementation (MapleMap)
|
|
- Character full data loading (inventory, skills, quests)
|
|
- Testing the login flow with real client
|
|
|
|
### Session 2026-02-14 (Game Systems - Vertical Slice)
|
|
**Completed:**
|
|
- ✅ Implemented `Odinsea.Game.Character` - In-game character state GenServer
|
|
- Character stats (str, dex, int, luk, hp, mp, etc.)
|
|
- Position tracking (x, y, foothold, stance)
|
|
- Map transitions (change_map/3)
|
|
- Load from database / save to database
|
|
- SP array parsing (comma-separated to list)
|
|
- ✅ Implemented `Odinsea.Game.Map` - Map instance GenServer
|
|
- Player spawn/despawn on map
|
|
- Object ID (OID) allocation
|
|
- Broadcasting packets to all players
|
|
- Broadcasting packets except specific player
|
|
- Dynamic map loading via DynamicSupervisor
|
|
- ✅ Added Character and Map registries to application
|
|
- `Odinsea.CharacterRegistry` for character_id → pid lookups
|
|
- `Odinsea.MapRegistry` for {map_id, channel_id} → pid lookups
|
|
- `Odinsea.MapSupervisor` for dynamic map instance supervision
|
|
- ✅ Implemented `Odinsea.Game.Movement` - Movement parsing (simplified)
|
|
- Parse movement commands from packets
|
|
- Extract final position from movement data
|
|
- Support for basic movement types (absolute, relative, teleport)
|
|
- TODO: Full 40+ movement command types
|
|
- ✅ Updated `Odinsea.Channel.Packets`
|
|
- `spawn_player/2` - Spawn player on map (minimal encoding)
|
|
- `remove_player/1` - Remove player from map
|
|
- Helper functions for appearance/buffs/mounts/pets (minimal)
|
|
- ✅ Updated `Odinsea.Net.Opcodes`
|
|
- Added `lp_spawn_player/0` (184)
|
|
- Added `lp_remove_player_from_map/0` (185)
|
|
- Added `lp_chattext/0` (186)
|
|
- Added `lp_move_player/0` (226)
|
|
- Added `lp_update_char_look/0` (241)
|
|
|
|
**Architecture Notes:**
|
|
- Took vertical slice approach: minimal character → minimal map → spawn/movement
|
|
- Each character is a GenServer (isolation, crash safety)
|
|
- Each map instance is a GenServer (per-channel map isolation)
|
|
- Registry pattern for lookups (distributed-ready)
|
|
- DynamicSupervisor for on-demand map loading
|
|
|
|
**Next Steps:**
|
|
- Implement basic PlayerHandler (movement, chat, map changes)
|
|
- Expand character encoding (equipment, buffs, pets)
|
|
- Implement full movement parsing (all 40+ command types)
|
|
- Add inventory system
|
|
- Add NPC interaction
|
|
|
|
### Session 2026-02-14 (Channel Handlers - Chat & Movement)
|
|
**Completed:**
|
|
- ✅ Implemented `Odinsea.Channel.Handler.Chat` - Full chat handler
|
|
- General chat (broadcast to map)
|
|
- Party chat (buddy, party, guild, alliance, expedition routing)
|
|
- Whisper system (find player, send whisper)
|
|
- ✅ Implemented `Odinsea.Channel.Handler.Player` - Player action handler
|
|
- MovePlayer (character movement with broadcast)
|
|
- ChangeMap (portal-based map transitions)
|
|
- ChangeKeymap (keybinding changes)
|
|
- ChangeSkillMacro (skill macro management)
|
|
- Attack stubs (CloseRange, Ranged, Magic - ready for implementation)
|
|
- TakeDamage stub
|
|
- ✅ Added chat packet builders to `Odinsea.Channel.Packets`
|
|
- UserChat (general chat)
|
|
- WhisperReceived / WhisperReply
|
|
- FindPlayerReply / FindPlayerWithMap
|
|
- MultiChat (party/guild/alliance/expedition)
|
|
- ✅ Wired handlers into `Odinsea.Channel.Client` packet dispatcher
|
|
- Integrated ChatHandler for all chat opcodes
|
|
- Integrated PlayerHandler for movement, map changes, attacks
|
|
- ✅ Added missing opcodes (lp_whisper, lp_multi_chat)
|
|
|
|
**Architecture Notes:**
|
|
- Chat system routes through World services for cross-channel support
|
|
- Movement broadcasts to all players on map except mover
|
|
- Handlers use character GenServer for state management
|
|
- Map GenServer handles player tracking and packet broadcasting
|
|
|
|
**Next Steps:**
|
|
- Implement full attack system (damage calculation, mob interaction)
|
|
- Port NPC handler (NPC talk, shops)
|
|
- Port Inventory handler (item usage, equipping)
|
|
- Implement mob system (spawning, movement, AI)
|
|
- Implement party/guild/buddy systems in World layer
|
|
|
|
---
|
|
|
|
*Last Updated: 2026-02-14*
|
|
*Current Phase: Channel Handlers (40% → 45%)*
|