Skip to content

Manager Classes

This section contains documentation for the manager classes that coordinate and manage collections of entities and game systems.

Overview

Manager classes implement the Manager pattern, providing centralized control over related functionality. They handle collections of objects, coordinate interactions, and maintain system state.

Contents

WorldEntityManager

Manages all world entities (trees, rocks, buildings, etc.) in the current map chunk. Handles entity spawning, despawning, and spatial organization.

GroundItemManager

Manages ground items (dropped loot, resources) in the game world. Handles item lifecycle, rendering, and spatial organization. Works closely with TargetActionManager for item interactions.

TargetActionManager

Manages available actions for different entity types. Determines what actions (attack, examine, use, etc.) are available when targeting entities. Integrates with GroundItemManager for ground item interactions and ItemManager for item-on-entity actions.

ItemManager

Manages player interactions with inventory items, including selecting, using, equipping, and performing actions like dropping or trading. Coordinates with TargetActionManager for item-on-entity interactions and uses MenuTypesEnumOriginal for UI context.

SpellManager

Manages spell-related actions including selecting, casting, and auto-casting spells. Handles different spell types (teleport, inventory, status, combat) and coordinates with TargetActionManager for spell targeting.

TargetActionEnum

Enumeration of all possible target actions. Documents the numeric IDs and string mappings for different interaction types. Used by TargetActionManager and SpellManager.

Enumeration of menu types used for UI context in item interactions. Defines contexts like Inventory, Bank, Shop, and various skill interfaces. Used by ItemManager for inventory actions.

Key Concepts

  • Manager Pattern: Centralized control over related functionality
  • State Coordination: How managers maintain consistent system state
  • Singleton Pattern: Most managers use singleton instances for global access
  • Event-Driven Design: Managers use listeners and callbacks for system coordination

Manager Responsibilities

WorldEntityManager

  • Entity Storage: Maintains collections of world entities
  • Entity Lifecycle: Handles entity creation and destruction

GroundItemManager

  • Ground Item Storage: Maintains collections of items on the ground
  • Spatial Management: Handles item culling based on map boundaries
  • Rendering Coordination: Manages drawing of all ground items

TargetActionManager

  • Context Awareness: Determines actions based on current game state
  • Interaction Logic: Coordinates action execution
  • Pathfinding: Handles player movement to target locations

ItemManager

  • Inventory Management: Handles item selection and actions
  • UI Integration: Coordinates confirmation dialogs and text input
  • Network Communication: Emits packets for server-side validation

SpellManager

  • Spell Selection: Manages currently selected spells
  • Auto-Casting: Handles automatic spell casting
  • Skill Integration: Updates player experience for spell casting

Cross-Manager Dependencies

  • TargetActionManager โ†” GroundItemManager: TargetActionManager uses GroundItemManager.Instance.getGroundItemByEntityId for ground item interactions
  • TargetActionManager โ†” ItemManager: TargetActionManager calls ItemManager methods for item-on-entity actions
  • ItemManager โ†” MenuTypesEnumOriginal: ItemManager uses menu types for UI context in inventory actions
  • SpellManager โ†” TargetActionManager: SpellManager integrates with TargetActionManager for spell targeting
  • All Managers โ†” Network Layer: All managers emit packets via SocketManager for server communication