# oonym/l2interludeserver architecture

> Architecture diagram of the GitHub repository oonym/l2interludeserver, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oonym/l2interludeserver
- Repository: https://github.com/oonym/l2interludeserver

## Overview

##### Main Components and Their Roles
- Client(s):
- The game client (official Lineage 2 client) that connects to the server.
- Login Server:
- Manages connections, authentication, and account verification.
- Includes packages under “net/sf/l2j/loginserver” (clientpackets, crypt, gameserverpackets, serverpackets, etc.).
- Game Server:
- Handles in-game logic, world management, and user actions.
- Organized under “net/sf/l2j/gameserver” and includes subpackages (clientpackets, communitybbs, events, handlers, network, object models, AI, geodata, etc.).
- Status Server:
- Provides server status updates and monitoring.
- Found in packages like “net/sf/l2j/status”.
- Database/Data Access Layer:
- Managed by classes such as L2DatabaseFactory and associated util classes.
- Uses configuration files and SQL scripts located in the “sql” directory.
- Scripting and Configuration:
- Supports dynamic behavior via scripting (see the “script” packages including jython-based quests and events).
- The configuration files in the “config” or “java/config” directories hold server properties and settings.
- Utility Components:
- Includes common utilities (e.g., “util” packages, task manager, id factories, and file logging), used across the application.
- External Libraries:
- The lib folder shows third-party libraries such as c3p0, jython, MySQL connector, etc., which are integrated to support database pooling, scripting, and network communications.

##### Relationships and Data Flow
- The game client first connects to the Login Server.
- The Login Server authenticates the client using credentials (by interacting with the database) and then passes a session or ticket to the Game Server.
- The Game Server uses this session to let the player connect, then loads and updates world data.
- Both servers use common utility classes to log actions, schedule tasks (via taskmanager), manage packets (network packages), and handle configuration.
- The Status Server monitors overall server health and reports game server and login server metrics.
- A clear flow exists: client → login server (auth) → game server (gameplay) with support from caching, task scheduling, and scripting modules.

##### Architectural Patterns and Design Principles
- Modular and Layered Architecture:
- The project is separated into logical modules: network communication, business logic (game mechanics, quest management), database interaction, and administration.
- Event-driven Design:
- Numerous classes in “clientpackets,” “serverpackets,” and “events” indicate that the system uses an event-based architecture to process and respond to messages.
- Dependency Injection / Factory Patterns:
- The presence of factories (IdFactory, L2DatabaseFactory) and handler interfaces (e.g., IAdminCommandHandler, IUserCommandHandler) suggest an extensible design that supports plug-in components.
- Task Scheduling:
- TaskManager classes and scheduled tasks indicate asynchronous processing (e.g., decay, cleanup, periodic updates) throughout the server.

##### Relevant Technologies and Frameworks
- Java Platform – core language and runtime.
- MySQL for the database with JDBC connectivity (mysql-connector-java) and connection pooling (c3p0).
- Jython for scripting support.
- Third-party libraries (e.g., Apache Commons Logging, Javolution) for performance and logging.

## Diagram (Mermaid)

```mermaid
flowchart TD
    client["Lineage 2 Game Client"]:::client
    login["Login Server Module"]:::server
    game["Game Server Module"]:::server
    status["Status Server"]:::server
    dbFactory["Database (L2DatabaseFactory)"]:::database
    sql["SQL Scripts"]:::database
    script["Scripting Engine"]:::scripting
    config["Configuration"]:::config
    util["Utilities (Task Manager, Logging)"]:::utility
    extern["External Libraries"]:::external

    client -->|"connectsTo"| login
    login -->|"sessionTicket"| game
    login -->|"dbAccess"| dbFactory
    game -->|"dbAccess"| dbFactory
    game -->|"loadsScripts"| script
    game -->|"readsConfigs"| config
    login -->|"usesUtilities"| util
    game -->|"usesUtilities"| util
    login -->|"dependsOn"| extern
    game -->|"dependsOn"| extern
    login -->|"monitoredBy"| status
    game -->|"monitoredBy"| status
    dbFactory -->|"SQLscripts"| sql

    click login "https://github.com/oonym/l2interludeserver/tree/Interlude/L2J_Server/java/net/sf/l2j/loginserver"
    click game "https://github.com/oonym/l2interludeserver/tree/Interlude/L2J_Server/java/net/sf/l2j/gameserver"
    click status "https://github.com/oonym/l2interludeserver/tree/Interlude/L2J_Server/java/net/sf/l2j/status"
    click dbFactory "https://github.com/oonym/l2interludeserver/blob/Interlude/L2J_Server/java/net/sf/l2j/L2DatabaseFactory.java"
    click sql "https://github.com/oonym/l2interludeserver/tree/Interlude/L2J_Server/sql"
    click script "https://github.com/oonym/l2interludeserver/tree/Interlude/L2J_Server/java/net/sf/l2j/gameserver/script"
    click config "https://github.com/oonym/l2interludeserver/tree/Interlude/L2J_Server/java/config"
    click util "https://github.com/oonym/l2interludeserver/tree/Interlude/L2J_Server/java/net/sf/l2j/util"
    click util "https://github.com/oonym/l2interludeserver/tree/Interlude/L2J_Server/java/net/sf/l2j/gameserver/taskmanager"
    click extern "https://github.com/oonym/l2interludeserver/tree/Interlude/L2J_Server/lib"

    classDef client fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef server fill:#ABEBC6,stroke:#229954,stroke-width:2px;
    classDef database fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef scripting fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef config fill:#FAD7A0,stroke:#E67E22,stroke-width:2px;
    classDef utility fill:#D7BDE2,stroke:#8E44AD,stroke-width:2px;
    classDef external fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
```
