The Effects module provides a unified interface for querying active effects on your character, including spells, buffs, debuffs, and cooldowns.
Overview
Effects are organized into four registries, each providing methods to check activation status, expiration times, and remaining duration.
Registries
Effects::Spells
Tracks active spells cast on or by the character.
Effects::Spells.active?(103) # Check if spell 103 is active
Effects::Spells.time_left("Spirit Barrier") # Minutes remaining
Effects::Buffs
Tracks beneficial effects that are not traditional spells.
Effects::Buffs.active?("Well Rested")
Effects::Buffs.expiration("Sign of Wracking")
Effects::Debuffs
Tracks negative effects and debuffs on the character.
Effects::Debuffs.active?("Stunned")
Effects::Debuffs.time_left("Bleeding")
Effects::Cooldowns
Tracks ability cooldowns and reuse timers.
Effects::Cooldowns.active?("Sigil of Major Bane")
Effects::Cooldowns.time_left(/bane/i)
Registry Methods
All four registries (Spells, Buffs, Debuffs, Cooldowns) share the same interface:
active?
Check if an effect is currently active.
active = Effects::Spells.active?(effect_name)
effect
String | Integer | Regexp
required
Effect name, spell number, or regular expression pattern to match.
Returns true if the effect is active (expiration time is in the future), false otherwise.
Example:
if Effects::Spells.active?("Spirit Barrier")
echo "Spirit Barrier is protecting you"
end
if Effects::Cooldowns.active?(/bane/i)
echo "A bane ability is on cooldown"
end
expiration
Get the expiration timestamp for an effect.
expiration_time = Effects::Buffs.expiration(effect_name)
effect
String | Integer | Regexp
required
Effect name, spell number, or regular expression pattern to match.
Unix timestamp (seconds since epoch) when the effect expires, or 0 if not active.
Example:
expires = Effects::Spells.expiration(911)
if expires > 0
echo "Mass Blur expires at #{Time.at(expires)}"
else
echo "Mass Blur is not active"
end
time_left
Get the remaining duration of an effect in minutes.
minutes = Effects::Spells.time_left(effect_name)
effect
String | Integer | Regexp
required
Effect name, spell number, or regular expression pattern to match.
Minutes remaining until expiration, or 0 if not active.
Example:
time_left = Effects::Spells.time_left("Elemental Barrier")
if time_left > 0
echo "Elemental Barrier expires in #{time_left.round(1)} minutes"
else
echo "Elemental Barrier is not active"
end
to_h
Get all effects in the registry as a hash.
all_effects = Effects::Spells.to_h
Hash mapping effect identifiers to expiration timestamps.
Example:
Effects::Spells.to_h.each do |spell, expires_at|
echo "#{spell}: expires at #{Time.at(expires_at)}"
end
each
Iterate over all effects in the registry.
Effects::Buffs.each do |name, expiration|
# Process each buff
end
Block that receives effect name/ID and expiration timestamp.
Example:
Effects::Spells.each do |spell_id, expires_at|
time_left = ((expires_at - Time.now) / 60.0).round(1)
echo "Spell #{spell_id}: #{time_left} minutes remaining"
end
Module Methods
Effects.display
Display a formatted table of all active effects.
Outputs a formatted table showing all active spells, cooldowns, buffs, and debuffs with their durations.
This method uses the Terminal::Table gem to format output and displays durations in a human-readable format.
Example:
# Display all effects
Effects.display
Output:
+------+-----------+--------------------+----------+
| ID | Type | Name | Duration |
+------+-----------+--------------------+----------+
| 103 | Spells | Spirit Barrier | 45:30 |
| 215 | Spells | Heroism | 1:15:20 |
+------+-----------+--------------------+----------+
| | Cooldowns | No cooldowns found!| |
+------+-----------+--------------------+----------+
Usage Examples
Check for protective spells
protective_spells = [103, 202, 303, 414, 919]
missing_spells = []
protective_spells.each do |spell_num|
unless Effects::Spells.active?(spell_num)
missing_spells << Spell[spell_num].name
end
end
if missing_spells.any?
echo "Missing protection spells: #{missing_spells.join(', ')}"
else
echo "All protection spells active"
end
Monitor spell duration
loop do
time_left = Effects::Spells.time_left(911) # Mass Blur
if time_left == 0
echo "Mass Blur has expired!"
break
elsif time_left < 5
echo "WARNING: Mass Blur expires in #{time_left.round(1)} minutes"
end
pause 60 # Check every minute
end
Wait for cooldown
ability = "Sigil of Major Bane"
if Effects::Cooldowns.active?(ability)
remaining = Effects::Cooldowns.time_left(ability)
echo "#{ability} on cooldown for #{remaining.round(1)} more minutes"
# Wait until ready
waitrt?
wait_until { !Effects::Cooldowns.active?(ability) }
echo "#{ability} is ready!"
else
echo "#{ability} is available"
end
Find effects by pattern
# Find all barrier spells
barriers = Effects::Spells.to_h.select { |name, _|
name.to_s =~ /barrier/i
}
if barriers.any?
echo "Active barriers:"
barriers.each do |spell, expires|
time_left = ((expires - Time.now) / 60.0).round(1)
echo " #{spell}: #{time_left} minutes"
end
end
Check for debuffs before action
bad_effects = ["Stunned", "Immobilized", "Webbed"]
bad_effects.each do |debuff|
if Effects::Debuffs.active?(debuff)
echo "Cannot act: #{debuff}"
exit
end
end
echo "Ready to proceed"
Data Source
Effect data is sourced from XMLData dialogs, which are populated by the game client’s XML stream. The four dialog types are “Active Spells”, “Buffs”, “Debuffs”, and “Cooldowns”.
Notes
- Effect identifiers can be spell numbers (Integer), names (String), or patterns (Regexp)
- Expiration times are Unix timestamps (seconds since epoch)
- Duration values returned by
time_left are in minutes (Float)
- Effects with expiration times far in the future (>86400 seconds) are considered “Indefinite” by the display method
- Pattern matching with Regexp allows flexible effect queries across similar abilities