Overview
The DRSkill class provides comprehensive access to character skill information including ranks, experience (mindstate), learning rates, and progress tracking. It automatically parses skill data from the game stream and maintains state for all skills.
DRSkill Class Methods
find_skill
Finds a skill by name or alias.
DRSkill.find_skill(skill_name)
The skill name (e.g., “Evasion”) or guild-specific alias (e.g., “Inner Fire” for Barbarians)
Returns:
DRSkill instance if found
nil if skill doesn’t exist
Example:
skill = DRSkill.find_skill("Evasion")
if skill
echo "#{skill.name}: Rank #{skill.rank}"
end
getrank
Gets the earned ranks for a skill.
DRSkill.getrank(skill_name)
Returns:
- Integer rank value
0 if skill not found
Example:
evasion_ranks = DRSkill.getrank("Evasion")
# => 425
if DRSkill.getrank("Backstab") > 100
echo "Backstab is over 100 ranks!"
end
getmodrank
Gets the rank including modifiers (buffs/debuffs).
DRSkill.getmodrank(skill_name)
Returns:
- Integer rank plus modifier
0 if skill not found
Example:
# Base rank: 425, Modifier: +75
modified_rank = DRSkill.getmodrank("Athletics")
# => 500
# Check modifiers separately
base = DRSkill.getrank("Athletics")
modifier = DRSkill.exp_modifiers["Athletics"]
echo "Athletics: #{base} + #{modifier} = #{base + modifier}"
getxp
Gets the current learning rate (mindstate) for a skill.
DRSkill.getxp(skill_name)
Returns:
- Integer from 0-34 representing mindstate
0 if skill not found or mind is clear
- Skills at 1750+ ranks are capped at 34
Example:
mindstate = DRSkill.getxp("Evasion")
# => 24 (representing "cogitating" learning rate)
if DRSkill.getxp("Evasion") >= 34
echo "Evasion is locked!"
end
# Wait for skill to reach threshold
waitrt?
wait_until { DRSkill.getxp("Stealth") >= 28 }
echo "Stealth is engrossed or better"
getpercent
Gets the percent progress toward the next rank.
DRSkill.getpercent(skill_name)
Returns:
- Integer from 0-100
0 if skill not found
Example:
percent = DRSkill.getpercent("Evasion")
# => 73
echo "Evasion is #{percent}% to next rank"
getskillset
Gets the skillset category for a skill.
DRSkill.getskillset(skill_name)
Returns:
- String: “Armor”, “Lore”, “Weapon”, “Magic”, or “Survival”
nil if skill not found
Example:
set = DRSkill.getskillset("Evasion")
# => "Survival"
if DRSkill.getskillset("Augmentation") == "Magic"
echo "Augmentation is a magic skill"
end
gained_exp
Gets the cumulative ranks gained since the baseline was reset.
DRSkill.gained_exp(skill_name)
Returns:
- Float representing ranks gained (rounded to 2 decimal places)
0.00 if skill not found or no gains
Example:
# Check progress during training session
DRSkill.reset # Reset baseline
# ... train for a while ...
gains = DRSkill.gained_exp("Evasion")
# => 2.45
echo "Gained #{gains} ranks in Evasion this session"
reset
Resets the baseline for all skills to current values.
Behavior:
- Clears the
gained_skills array
- Resets
start_time to current time
- Sets each skill’s baseline to its current value
- Used to track progress for a play session
Example:
# Start a new training session
DRSkill.reset
echo "Skill tracking reset"
# Later, check progress
DRSkill.list.each do |skill|
gain = skill.current - skill.baseline
echo "#{skill.name}: +#{gain.round(2)}" if gain > 0
end
start_time
Gets the time when skill tracking started.
Returns:
Time object representing when tracking began
Example:
start = DRSkill.start_time
elapsed = Time.now - start
echo "Training for #{(elapsed / 60).round} minutes"
gained_skills
Accesses the array of skill gains (used by exp-monitor).
Returns:
- Array of hashes:
[{skill: "Evasion", change: 2}, ...]
- Array is continuously populated as skills gain experience
Example:
# Drain and process skill gains
gains = DRSkill.gained_skills.shift(DRSkill.gained_skills.size)
gains.each do |gain|
echo "#{gain[:skill]} increased by #{gain[:change]}"
end
list
Gets all tracked skills.
Returns:
- Array of
DRSkill instances
Example:
# Find all magic skills
magic_skills = DRSkill.list.select { |s| s.skillset == "Magic" }
magic_skills.each do |skill|
echo "#{skill.name}: #{skill.rank}.#{skill.percent}% [#{skill.exp}/34]"
end
listall
Prints all skills to the console.
Output:
DRSkill: Evasion: 425.73% [24/34]
DRSkill: Athletics: 380.45% [18/34]
...
include?
Checks if a skill exists.
DRSkill.include?(skill_name)
Returns:
true if skill is tracked
false otherwise
Example:
if DRSkill.include?("Inner Fire")
echo "You're a Barbarian!"
end
update
Updates skill information (called automatically by parser).
DRSkill.update(name, rank, exp, percent)
Percent to next rank (0-100)
Behavior:
- Creates new skill if it doesn’t exist
- Updates existing skill data
- Triggers experience change tracking
- Automatically called by XML parser
clear_mind
Clears the mindstate for a skill.
DRSkill.clear_mind(skill_name)
Behavior:
- Sets skill’s exp to 0
- Does nothing if skill not found
lookup_alias
Resolves guild-specific skill aliases.
DRSkill.lookup_alias(skill_name)
The skill name or guild-specific alias
Returns:
- Canonical skill name
- Original name if no alias exists
Example:
# For Barbarians, "Inner Fire" is their "Primary Magic"
canonical = DRSkill.lookup_alias("Inner Fire")
# => "Primary Magic" (if character is Barbarian)
# For other guilds
canonical = DRSkill.lookup_alias("Holy Magic")
# => "Primary Magic" (if character is Cleric or Paladin)
Rested Experience
rested_exp_stored
Gets stored rested experience in seconds.
DRSkill.rested_exp_stored
Returns:
- Integer seconds of stored rested experience
0 if none
rested_exp_usable
Gets usable rested experience in seconds.
DRSkill.rested_exp_usable
Returns:
- Integer seconds of usable rested experience
0 if none
rested_exp_refresh
Gets time until rested experience refreshes in seconds.
DRSkill.rested_exp_refresh
Returns:
- Integer seconds until refresh
0 if none
rested_active?
Checks if rested experience is active.
Returns:
true if both stored and usable > 0
false otherwise
Example:
if DRSkill.rested_active?
stored = DRSkill.rested_exp_stored / 3600.0
usable = DRSkill.rested_exp_usable / 3600.0
echo "Rested EXP: #{stored.round(1)}h stored, #{usable.round(1)}h usable"
end
update_rested_exp
Updates rested experience values (called automatically by parser).
DRSkill.update_rested_exp(stored, usable, refresh)
Stored time string (e.g., “4:38 hours”)
Usable time string (e.g., “38 minutes”)
Experience Modifiers
exp_modifiers
Accesses the hash of skill modifiers.
Returns:
- Hash:
{"Athletics" => 75, "Evasion" => -10, ...}
- Empty hash if no modifiers
Example:
DRSkill.exp_modifiers.each do |skill, mod|
sign = mod > 0 ? "+" : ""
echo "#{skill}: #{sign}#{mod}"
end
update_mods
Updates experience modifiers (called automatically by parser).
DRSkill.update_mods(name, rank)
Modifier value (positive or negative)
Instance Attributes
Each DRSkill instance has the following attributes:
Skill name (e.g., “Evasion”)
Earned ranks in the skill
Percent to next rank (0-100)
Current exact rank (rank + percent/100)
Baseline rank for tracking gains
Skillset category: “Armor”, “Lore”, “Weapon”, “Magic”, or “Survival”
Learning Rates
DragonRealms uses a 35-state learning rate system (0-34):
DR_LEARNING_RATES = [
'clear', # 0
'dabbling', # 1
'perusing', # 2
'learning', # 3
# ... (see lib/dragonrealms/drinfomon/drvariables.rb:5-41)
'mind lock' # 34
]
Example:
exp_num = DRSkill.getxp("Evasion")
exp_word = DR_LEARNING_RATES[exp_num]
echo "Evasion: #{exp_word} (#{exp_num}/34)"
# => "Evasion: cogitating (24/34)"
Skill Data
Skill categories and guild aliases are defined in DR_SKILLS_DATA:
DR_SKILLS_DATA = {
skillsets: {
'Armor' => ['Shield Usage', 'Light Armor', ...],
'Lore' => ['Alchemy', 'Appraisal', ...],
'Weapon' => ['Parry Ability', 'Small Edged', ...],
'Magic' => ['Primary Magic', 'Arcana', ...],
'Survival' => ['Evasion', 'Athletics', ...]
},
guild_skill_aliases: {
'Barbarian' => { 'Primary Magic' => 'Inner Fire' },
'Cleric' => { 'Primary Magic' => 'Holy Magic' },
# ... (see lib/dragonrealms/drinfomon/drvariables.rb:61-157)
}
}
Common Patterns
Training Loop
# Reset tracking
DRSkill.reset
# Train until skill reaches threshold
loop do
# ... perform training action ...
pause 4
break if DRSkill.getxp("Evasion") >= 28
end
# Report gains
gained = DRSkill.gained_exp("Evasion")
echo "Gained #{gained} Evasion ranks"
Multi-Skill Tracking
skills_to_train = ["Evasion", "Athletics", "Stealth"]
# Check which need training
skills_to_train.select do |skill|
DRSkill.getxp(skill) < 28
end
Session Report
DRSkill.reset
# ... play session ...
# Generate report
echo "=== Session Report ==="
DRSkill.list.each do |skill|
gain = skill.current - skill.baseline
echo "#{skill.name}: +#{gain.round(2)}" if gain > 0.01
end
elapsed = Time.now - DRSkill.start_time
echo "Session duration: #{(elapsed / 60).round} minutes"