Skip to main content
Lich 5 provides extensive support for DragonRealms (DR), including game-specific modules for skill tracking, character statistics, guild systems, and utility functions. All DragonRealms-specific functionality is namespaced under Lich::DragonRealms.

Overview

The DragonRealms implementation includes:
  • DRInfomon: Core data tracking and parsing system
  • DRSkill: Comprehensive skill tracking and experience monitoring
  • DRStats: Character statistics and attributes
  • DRSpells: Spell and ability management
  • DRC (Commons): Extensive utility functions for scripting
  • EquipManager: Equipment management system
  • Guild-Specific Systems: Support for all DR guilds

Core Modules

DRSkill

The skill tracking system monitors all character skills, ranks, experience rates, and progress.
# Get skill information
rank = Lich::DragonRealms::DRSkill.getrank("Evasion")        # Earned ranks
exp = Lich::DragonRealms::DRSkill.getxp("Evasion")          # Current mindstate (0-34)
percent = Lich::DragonRealms::DRSkill.getpercent("Evasion") # Percent to next rank

# Get rank with modifiers (buffs/debuffs)
modrank = Lich::DragonRealms::DRSkill.getmodrank("Evasion")

# Get skillset
skillset = Lich::DragonRealms::DRSkill.getskillset("Evasion")
# Returns: "Armor", "Weapon", "Magic", "Survival", "Lore"

# Check if skill exists
if Lich::DragonRealms::DRSkill.include?("Empathy")
  # Skill is tracked
end
DRSkill automatically handles guild-specific skill aliases. For example, Barbarians’ “Inner Fire” maps to “Primary Magic”.

DRStats

Track character statistics, guild, race, and attributes.
# Character identity
Lich::DragonRealms::DRStats.name      # Character name
Lich::DragonRealms::DRStats.race      # Race
Lich::DragonRealms::DRStats.guild     # Guild name
Lich::DragonRealms::DRStats.gender    # Gender
Lich::DragonRealms::DRStats.age       # Age
Lich::DragonRealms::DRStats.circle    # Circle/level

Guild Detection

Convenience methods for guild-specific logic:
Guild Checks
# Check current guild
if Lich::DragonRealms::DRStats.barbarian?
  # Barbarian-specific code
elsif Lich::DragonRealms::DRStats.moon_mage?
  # Moon Mage-specific code
end

# All guild check methods:
Lich::DragonRealms::DRStats.barbarian?
Lich::DragonRealms::DRStats.bard?
Lich::DragonRealms::DRStats.cleric?
Lich::DragonRealms::DRStats.commoner?
Lich::DragonRealms::DRStats.empath?
Lich::DragonRealms::DRStats.moon_mage?
Lich::DragonRealms::DRStats.necromancer?
Lich::DragonRealms::DRStats.paladin?
Lich::DragonRealms::DRStats.ranger?
Lich::DragonRealms::DRStats.thief?
Lich::DragonRealms::DRStats.trader?
Lich::DragonRealms::DRStats.warrior_mage?

# Get native mana type
mana_type = Lich::DragonRealms::DRStats.native_mana
# Returns: 'arcane', 'lunar', 'elemental', 'holy', 'life', or nil

DRC: Commons Module

The DRC module (DragonRealms Commons) provides essential utility functions used across DR scripts.

Command Helpers

# Better than fput - waits for RT and retries
result = Lich::DragonRealms::DRC.bput("retreat", "You retreat", "already as far")

# With timeout
result = Lich::DragonRealms::DRC.bput(
  "forage grass",
  { 'timeout' => 5 },
  "You manage to find",
  "You fail to find"
)

# Ignore roundtime
result = Lich::DragonRealms::DRC.bput(
  "look",
  { 'ignore_rt' => true },
  /^\[.+\]/
)

Combat Helpers

Retreat and Combat
# Safe retreat from combat
Lich::DragonRealms::DRC.retreat

# The retreat function handles:
# - Already retreated
# - Held in place
# - No place to retreat
# - Prone state

Assess Teach

Teaching System
# Parse teaching information
teacher_data = Lich::DragonRealms::DRC.assess_teach
# Returns hash with teacher and skill info

Weapon Detection

Weapon Type Checks
# Check if weapon is ranged
weapon = "longbow"
if weapon =~ Lich::DragonRealms::DRC::COMMON_RANGED_WEAPONS_PATTERN
  # It's a common ranged weapon
end

if weapon =~ Lich::DragonRealms::DRC::RACIAL_RANGED_WEAPONS_PATTERN
  # It's a racial/Gamgweth ranged weapon
end

Advanced Commons Modules

The Commons system includes specialized modules for common scripting tasks:

Common Items

Item Management
# From: common-items.rb
# Provides item manipulation utilities
# - Container management
# - Item storage and retrieval
# - Equipment handling

Common Travel

Movement Utilities
# From: common-travel.rb
# Provides pathfinding and movement
# - Room navigation
# - Obstacle handling
# - Travel optimization

Common Money

Currency Management
# From: common-money.rb
# Handles DR currency operations
# - Coin management
# - Banking operations
# - Transaction tracking

Common Healing

Healing System
# From: common-healing.rb
# Manages healing operations
# - Wound tracking
# - Healing methods
# - Herb usage

Guild-Specific Commons

Common Arcana

Arcane magic utilities for magical guilds

Common Moonmage

Moon Mage-specific functionality (prediction, constellation tracking)

Common Theurgy

Holy magic utilities for Clerics and Paladins

Common Summoning

Summoning creature management

Common Crafting

Crafting System
# From: common-crafting.rb
# Comprehensive crafting support
# - All crafting disciplines
# - Recipe management
# - Material tracking
# - Quality control

EquipManager

Manage equipment sets and gear swapping.
Equipment Management
# From: equipmanager.rb
# Handles equipment configurations
# - Save equipment sets
# - Quick gear swapping
# - Combat/travel loadouts
# - Wounded equipment handling

DRSpells

Spell and ability tracking for DragonRealms.
Spell Management
# Spell state tracking
# Ability cooldowns
# Spell slot management

DRRoom

Room information and tracking.
Room Data
# Current room information
# Area tracking
# Environment detection

DRExpMonitor

Automatic experience gain monitoring and display.
Experience Monitor
# Automatically tracks and displays experience gains
# Controlled by Lich settings:

# Toggle on/off
;display expgains

# Toggle inline display
;display inlineexp
DRExpMonitor automatically starts based on the Lich.display_expgains setting. It defaults to ON for non-Genie frontends.

Banking System

From drbanking.rb, provides banking operations:
Banking
# Banking utilities
# - Deposit/withdraw
# - Balance checking
# - Multi-bank support

Event System

DragonRealms event handling from events.rb:
Events
# Game event detection
# Custom event handlers
# Event-driven scripting

Slackbot Integration

Slack Notifications
# From: slackbot.rb
# Send notifications to Slack
# - Death notifications
# - Milestone alerts
# - Custom messages

Variable System

From drvariables.rb, manages script variables and configuration:
Variables
# Persistent variable storage
# Character-specific settings
# Cross-script data sharing

Parser System

From drparser.rb, handles game output parsing:
Parsing
# Game output interpretation
# Data extraction
# Pattern matching

Skill Data

From drdefs.rb, provides skill definitions and constants:
Skill Definitions
# DR_SKILLS_DATA constant
# - Skillset mappings
# - Guild aliases
# - Skill relationships

Best Practices

1

Use DRC.bput for Commands

Always prefer DRC.bput over fput for DR scripts. It handles roundtime and retries automatically.
2

Check Guild Before Using Guild-Specific Features

Use DRStats.guild_name? methods to ensure guild-specific code only runs for appropriate characters.
3

Track Baselines

Call DRSkill.reset at the start of your script to establish a baseline for tracking progress.
4

Handle Skill Aliases

Use DRSkill.lookup_alias when working with guild-specific skill names.
5

Leverage Commons Modules

The Commons modules (common-items, common-travel, etc.) contain battle-tested utilities. Use them instead of reimplementing.

Common Patterns

Skill Training Loop

Skill Training
Lich::DragonRealms::DRSkill.reset  # Set baseline

loop do
  # Train skills
  result = Lich::DragonRealms::DRC.bput("practice", "You practice", "You need")
  
  # Check progress
  gained = Lich::DragonRealms::DRSkill.gained_exp("Evasion")
  break if gained >= 1.0  # Stop after 1 rank
  
  pause 30
end

Guild-Specific Behavior

Guild Behavior
if Lich::DragonRealms::DRStats.empath?
  # Empath healing logic
  Lich::DragonRealms::DRC.bput("heal self", "You begin")
elsif Lich::DragonRealms::DRStats.moon_mage?
  # Moon Mage prediction
  Lich::DragonRealms::DRC.bput("predict weather", "You close your eyes")
end

Resource Management

Resource Check
# Check if resources are sufficient
if Lich::DragonRealms::DRStats.mana < 20
  echo "Low mana, pausing to recover"
  pause 60
end

if Lich::DragonRealms::DRStats.fatigue < 30
  echo "Tired, resting"
  pause 60
end

Migration from Lich 4

If migrating scripts from Lich 4:
Ensure you use the full namespace Lich::DragonRealms:: prefix for all DR-specific modules. Legacy scripts may have relied on global namespace pollution.
# Old style - may not work
DRSkill.getrank("Evasion")
DRStats.guild

See Also

XMLData API

Core character data APIs

GameObj API

Working with game objects

Script Development

Script development fundamentals

Global Methods

Available script commands

Build docs developers (and LLMs) love