Module: Lich::DragonRealms
- Includes:
- Lich
- Defined in:
- documented/dragonrealms/drinfomon/drexpmonitor.rb,
documented/games.rb,
documented/dragonrealms/drinfomon.rb,
documented/dragonrealms/commons/common.rb,
documented/dragonrealms/commons/slackbot.rb,
documented/dragonrealms/drinfomon/drdefs.rb,
documented/dragonrealms/drinfomon/drroom.rb,
documented/dragonrealms/drinfomon/events.rb,
documented/dragonrealms/drinfomon/drskill.rb,
documented/dragonrealms/drinfomon/drstats.rb,
documented/dragonrealms/drinfomon/startup.rb,
documented/dragonrealms/drinfomon/drparser.rb,
documented/dragonrealms/drinfomon/drspells.rb,
documented/dragonrealms/drinfomon/drbanking.rb,
documented/dragonrealms/commons/common-items.rb,
documented/dragonrealms/commons/common-money.rb,
documented/dragonrealms/commons/equipmanager.rb,
documented/dragonrealms/commons/common-arcana.rb,
documented/dragonrealms/commons/common-travel.rb,
documented/dragonrealms/drinfomon/drvariables.rb,
documented/dragonrealms/commons/common-healing.rb,
documented/dragonrealms/commons/common-theurgy.rb,
documented/dragonrealms/commons/common-crafting.rb,
documented/dragonrealms/commons/common-moonmage.rb,
documented/dragonrealms/commons/common-summoning.rb,
documented/dragonrealms/commons/common-money-data.rb,
documented/dragonrealms/commons/common-validation.rb,
documented/dragonrealms/dependency/settings_config.rb,
documented/dragonrealms/commons/common-healing-data.rb
Overview
Module containing configuration settings for DragonRealms.
This module holds the configuration constants used by the SettingsTransformer.
Defined Under Namespace
Modules: DRBanking, DRC, DRCA, DRCC, DRCH, DRCI, DRCM, DRCMM, DRCS, DRCT, DRCTH, DRDefsPattern, DRExpMonitor, DRInfomon, DRParser, DRSpells, DRStats, SettingsConfig Classes: CharacterValidator, DRRoom, DRSkill, EquipmentManager, Flags, Game, GameInstance, SlackBot
Constant Summary collapse
- DR_LEARNING_RATES =
Array of learning rates used in the DragonRealms.
[ 'clear', 'dabbling', 'perusing', 'learning', 'thoughtful', 'thinking', 'considering', 'pondering', 'ruminating', 'concentrating', 'attentive', 'deliberative', 'interested', 'examining', 'understanding', 'absorbing', 'intrigued', 'scrutinizing', 'analyzing', 'studious', 'focused', 'very focused', 'engaged', 'very engaged', 'cogitating', 'fascinated', 'captivated', 'engrossed', 'riveted', 'very riveted', 'rapt', 'very rapt', 'enthralled', 'nearly locked', 'mind lock' ].freeze
- DR_LONGEST_LEARNING_RATE_LENGTH =
Length of the longest learning rate name, used for padding in exp display Length of the longest learning rate name, used for padding in experience display.
DR_LEARNING_RATES.max_by(&:length).length
- DR_BALANCE_VALUES =
Array of balance values used in the DragonRealms.
[ 'completely', 'hopelessly', 'extremely', 'very badly', 'badly', 'somewhat off', 'off', 'slightly off', 'solidly', 'nimbly', 'adeptly', 'incredibly' ].freeze
- DR_SKILLS_DATA =
Hash containing skill data for various skillsets in DragonRealms.
{ skillsets: { 'Armor' => [ 'Shield Usage', 'Light Armor', 'Chain Armor', 'Brigandine', 'Plate Armor', 'Defending', 'Conviction' ].freeze, 'Lore' => [ 'Alchemy', 'Appraisal', 'Enchanting', 'Engineering', 'Forging', 'Outfitting', 'Performance', 'Scholarship', 'Tactics', 'Empathy', 'Bardic Lore', 'Trading', 'Mechanical Lore' ].freeze, 'Weapon' => [ 'Parry Ability', 'Small Edged', 'Large Edged', 'Twohanded Edged', 'Small Blunt', 'Large Blunt', 'Twohanded Blunt', 'Slings', 'Bow', 'Crossbow', 'Staves', 'Polearms', 'Light Thrown', 'Heavy Thrown', 'Brawling', 'Offhand Weapon', 'Melee Mastery', 'Missile Mastery', 'Expertise' ].freeze, 'Magic' => [ 'Primary Magic', 'Arcana', 'Attunement', 'Augmentation', 'Debilitation', 'Targeted Magic', 'Utility', 'Warding', 'Sorcery', 'Astrology', 'Summoning', 'Theurgy', 'Inner Magic', 'Inner Fire', 'Lunar Magic', 'Elemental Magic', 'Holy Magic', 'Life Magic', 'Arcane Magic' ].freeze, 'Survival' => [ 'Evasion', 'Athletics', 'Perception', 'Stealth', 'Locksmithing', 'Thievery', 'First Aid', 'Outdoorsmanship', 'Skinning', 'Instinct', 'Backstab', 'Thanatology' ].freeze }.freeze, guild_skill_aliases: { 'Cleric' => { 'Primary Magic' => 'Holy Magic' }.freeze, 'Necromancer' => { 'Primary Magic' => 'Arcane Magic' }.freeze, 'Warrior Mage' => { 'Primary Magic' => 'Elemental Magic' }.freeze, 'Thief' => { 'Primary Magic' => 'Inner Magic' }.freeze, 'Barbarian' => { 'Primary Magic' => 'Inner Fire' }.freeze, 'Ranger' => { 'Primary Magic' => 'Life Magic' }.freeze, 'Bard' => { 'Primary Magic' => 'Elemental Magic' }.freeze, 'Paladin' => { 'Primary Magic' => 'Holy Magic' }.freeze, 'Empath' => { 'Primary Magic' => 'Life Magic' }.freeze, 'Trader' => { 'Primary Magic' => 'Lunar Magic' }.freeze, 'Moon Mage' => { 'Primary Magic' => 'Lunar Magic' }.freeze }.freeze }.freeze
- KRONAR_BANKS =
Array of bank names in the Kronar region.
['Crossings', 'Dirge', 'Ilaya Taipa', 'Leth Deriel'].freeze
- LIRUM_BANKS =
["Aesry Surlaenis'a", "Hara'jaal", "Mer'Kresh", "Muspar'i", 'Ratha', 'Riverhaven', "Rossman's Landing", 'Therenborough', 'Throne City'].freeze
- DOKORA_BANKS =
['Ain Ghazal', 'Boar Clan', "Chyolvea Tayeu'a", 'Hibarnhvidar', 'Fang Cove', "Raven's Point", 'Shard'].freeze
- BANK_TITLES =
Hash mapping bank names to their titles in the DragonRealms.
{ "Aesry Surlaenis'a" => ['[[Tona Kertigen, Deposit Window]]'].freeze, 'Ain Ghazal' => ['[[Ain Ghazal, Private Depository]]'].freeze, 'Boar Clan' => ['[[Ranger Guild, Bank]]'].freeze, "Chyolvea Tayeu'a" => ["[[Chyolvea Tayeu'a, Teller]]"].freeze, 'Crossings' => ['[[Provincial Bank, Teller]]'].freeze, 'Dirge' => ["[[Dirge, Traveller's Bank]]"].freeze, 'Fang Cove' => ['[[First Council Banking, Vault]]'].freeze, "Hara'jaal" => ["[[Baron's Forset, Teller]]"].freeze, 'Hibarnhvidar' => ['[[Second Provincial Bank of Hibarnhvidar, Teller]]', '[[Hibarnhvidar, Teller Windows]]', '[[First Arachnid Bank, Lobby]]'].freeze, 'Ilaya Taipa' => ['[[Ilaya Taipa, Trader Outpost Bank]]'].freeze, 'Leth Deriel' => ['[[Imperial Depository, Domestic Branch]]'].freeze, "Mer'Kresh" => ["[[Harti Clemois Bank, Teller's Window]]"].freeze, "Muspar'i" => ["[[Old Lata'arna Keep, Teller Windows]]"].freeze, 'Ratha' => ['[[Lower Bank of Ratha, Cashier]]', '[[Sshoi-sson Palace, Grand Provincial Bank, Bursarium]]'].freeze, "Raven's Point" => ["[[Bank of Raven's Point, Depository]]"].freeze, 'Riverhaven' => ['[[Bank of Riverhaven, Teller]]'].freeze, "Rossman's Landing" => ["[[Traders' Guild Outpost, Depository]]"].freeze, 'Shard' => ["[[First Bank of Ilithi, Teller's Windows]]"].freeze, 'Therenborough' => ['[[Bank of Therenborough, Teller]]'].freeze, 'Throne City' => ['[[Faldesu Exchequer, Teller]]'].freeze }.freeze
- VAULT_TITLES =
Hash mapping vault names to their titles in the DragonRealms.
{ 'Crossings' => ['[[Crossing, Carousel Chamber]]'].freeze, 'Fang Cove' => ['[[Fang Cove, Carousel Chamber]]'].freeze, 'Leth Deriel' => ['[[Leth Deriel, Carousel Chamber]]'].freeze, "Mer'Kresh" => ["[[Mer'Kresh, Carousel Square]]"].freeze, "Muspar'i" => ["[[Muspar'i, Carousel Square]]"].freeze, 'Ratha' => ['[[Ratha, Carousel Square]]'].freeze, 'Riverhaven' => ['[[Riverhaven, Carousel Chamber]]'].freeze, 'Shard' => ['[[Shard, Carousel Chamber]]'].freeze, 'Therenborough' => ['[[Therenborough, Carousel Chamber]]'].freeze }.freeze
- UNKNOWN_DURATION =
Some spells may last for an unknown duration, such as cyclic spells that last as long as the caster can harness mana for it. Or, barbarian abilities when the character doesn't have Power Monger mastery to see true durations but only vague guestimates. In those situations, we set use this value. Constant representing an unknown duration for spells or abilities.
1000- HOMETOWN_REGEX_MAP =
Hash mapping hometown names to their corresponding regular expressions for matching.
{ 'Arthe Dale' => /^(arthe( dale)?)$/i, 'Crossing' => /^(cross(ing)?)$/i, 'Darkling Wood' => /^(darkling( wood)?)$/i, 'Dirge' => /^(dirge)$/i, "Fayrin's Rest" => /^(fayrin'?s?( rest)?)$/i, 'Leth Deriel' => /^(leth( deriel)?)$/i, 'Shard' => /^(shard)$/i, 'Steelclaw Clan' => /^(steel( )?claw( clan)?|SCC)$/i, 'Stone Clan' => /^(stone( clan)?)$/i, 'Tiger Clan' => /^(tiger( clan)?)$/i, 'Wolf Clan' => /^(wolf( clan)?)$/i, 'Riverhaven' => /^(river|haven|riverhaven)$/i, "Rossman's Landing" => /^(rossman'?s?( landing)?)$/i, 'Therenborough' => /^(theren(borough)?)$/i, 'Langenfirth' => /^(lang(enfirth)?)$/i, 'Fornsted' => /^(fornsted)$/i, 'Hvaral' => /^(hvaral)$/i, 'Ratha' => /^(ratha)$/i, 'Aesry' => /^(aesry)$/i, "Mer'Kresh" => /^(mer'?kresh)$/i, 'Throne City' => /^(throne( city)?)$/i, 'Hibarnhvidar' => /^(hib(arnhvidar)?)$/i, "Raven's Point" => /^(raven'?s?( point)?)$/i, 'Boar Clan' => /^(boar( clan)?)$/i, 'Fang Cove' => /^(fang( cove)?)$/i, "Muspar'i" => /^(muspar'?i)$/i, 'Ain Ghazal' => /^(ain( )?ghazal)$/i }.freeze
- HOMETOWN_LIST =
List of canonical town names, like 'Therenborough' and 'Langenfirth'. List of canonical town names, like 'Therenborough' and 'Langenfirth'.
HOMETOWN_REGEX_MAP.keys.freeze
- HOMETOWN_REGEX =
Union of regular expressions that match town names, like /^(theren(borough)?)$/i Union of regular expressions that match town names.
Regexp.union(HOMETOWN_REGEX_MAP.values)
- ORDINALS =
Array of ordinal numbers as strings.
%w[first second third fourth fifth sixth seventh eighth ninth tenth eleventh twelfth thirteenth fourteenth fifteenth sixteenth seventeenth eighteenth nineteenth twentieth].freeze
- CURRENCIES =
Array of currency names used in the DragonRealms.
%w[Kronars Lirums Dokoras].freeze
- ENC_MAP =
Hash mapping encumbrance descriptions to their corresponding values.
{ 'None' => 0, 'Light Burden' => 1, 'Somewhat Burdened' => 2, 'Burdened' => 3, 'Heavy Burden' => 4, 'Very Heavy Burden' => 5, 'Overburdened' => 6, 'Very Overburdened' => 7, 'Extremely Overburdened' => 8, 'Tottering Under Burden' => 9, 'Are you even able to move?' => 10, "It's amazing you aren't squashed!" => 11 }.freeze
- NUM_MAP =
Hash mapping number words to their corresponding integer values.
{ 'zero' => 0, 'one' => 1, 'two' => 2, 'three' => 3, 'four' => 4, 'five' => 5, 'six' => 6, 'seven' => 7, 'eight' => 8, 'nine' => 9, 'ten' => 10, 'eleven' => 11, 'twelve' => 12, 'thirteen' => 13, 'fourteen' => 14, 'fifteen' => 15, 'sixteen' => 16, 'seventeen' => 17, 'eighteen' => 18, 'nineteen' => 19, 'twenty' => 20, 'thirty' => 30, 'forty' => 40, 'fifty' => 50, 'sixty' => 60, 'seventy' => 70, 'eighty' => 80, 'ninety' => 90 }.freeze
- BOX_REGEX =
Regular expression for matching various types of boxes.
/((?:brass|copper|deobar|driftwood|iron|ironwood|mahogany|oaken|pine|steel|wooden) (?:box|caddy|casket|chest|coffer|crate|skippet|strongbox|trunk))/.freeze
- MANA_MAP =
Hash mapping mana quality descriptions to their corresponding arrays of strings.
{ 'weak' => %w[dim glowing bright].freeze, 'developing' => %w[faint muted glowing luminous bright].freeze, 'improving' => %w[faint hazy flickering shimmering glowing lambent shining fulgent glaring].freeze, 'good' => %w[faint dim hazy dull muted dusky pale flickering shimmering pulsating glowing lambent shining luminous radiant fulgent brilliant flaring glaring blazing blinding].freeze }.freeze
- PRIMARY_SIGILS_PATTERN =
Regular expression pattern for matching primary sigils.
/\b(?:abolition|congruence|induction|permutation|rarefaction) sigil\b/.freeze
- SECONDARY_SIGILS_PATTERN =
Regular expression pattern for matching secondary sigils.
/\b(?:antipode|ascension|clarification|decay|evolution|integration|metamorphosis|nurture|paradox|unity) sigil\b/.freeze
- VOL_MAP =
Hash mapping volume descriptions to their corresponding values.
{ 'enormous' => 20, 'massive' => 10, 'huge' => 5, 'large' => 4, 'medium' => 3, 'small' => 2, 'tiny' => 1 }.freeze
Constants included from Lich
MAX_DEBUG_LOGS_DEFAULT, MAX_DEBUG_LOGS_MINIMUM
Instance Method Summary collapse
-
#add_ordinals_to_duplicates(npc_list) ⇒ Array<String>
Adds ordinal numbers to duplicate NPC names in a list.
-
#check_exp_mods ⇒ void
Checks for experience modifiers in the game.
-
#clean_and_split(room_objs) ⇒ Array<String>
Cleans and splits room objects into an array.
-
#clean_npc_string(npc_string) ⇒ Array<String>
Cleans and normalizes a string of NPC names.
-
#convert2copper(amt, denomination) ⇒ Integer
Converts a given amount of currency to copper.
-
#convert2plats(copper) ⇒ String
Converts a given amount of copper to various denominations.
-
#extract_final_name(text) ⇒ String
Extracts just the creature name from a string.
-
#extract_last_creature(text) ⇒ String
Extracts the last creature name from a string, removing modifiers.
-
#extract_npcs(room_objs, select_dead: false) ⇒ Array<String>
Extracts non-player characters from room objects.
-
#extract_pcs(room_players, filter_pattern: nil, status_pattern: DRDefsPattern::PLAYER_STATUS) ⇒ Array<String>
Extracts player characters from a room player string.
-
#find_all_npcs(room_objs) ⇒ Array<String>
Finds all non-player characters in a room.
-
#find_dead_npcs(room_objs) ⇒ Array<String>
Finds dead non-player characters in a room.
-
#find_npcs(room_objs) ⇒ Array<String>
Finds non-player characters in a room.
-
#find_objects(room_objs) ⇒ Array<String>
Finds objects in a room, excluding certain patterns.
-
#find_pcs(room_players) ⇒ Array<String>
Finds player characters in a room.
-
#find_pcs_prone(room_players) ⇒ Array<String>
Finds player characters that are lying down in a room.
-
#find_pcs_sitting(room_players) ⇒ Array<String>
Finds player characters that are sitting in a room.
-
#normalize_creature_names(text) ⇒ String
Normalizes creature names based on specific patterns.
-
#normalize_trailing_and(text) ⇒ String
Normalizes the trailing "and" in a string.
-
#remove_html_tags(text) ⇒ String
Removes HTML tags from a string.
Methods included from Lich
db_mutex, mutex_lock, mutex_unlock
Instance Method Details
#add_ordinals_to_duplicates(npc_list) ⇒ Array<String>
Adds ordinal numbers to duplicate NPC names in a list.
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 319 def add_ordinals_to_duplicates(npc_list) flat_npcs = [] npc_list.uniq.each do |npc| # Count how many times this NPC appears count = npc_list.count(npc) # Create entries with ordinals for duplicates count.times do |index| if index.zero? flat_npcs << npc else # Use ordinal from $ORDINALS if available, otherwise generate one ordinal = $ORDINALS[index] || "#{index + 1}th" flat_npcs << "#{ordinal} #{npc}" end end end flat_npcs end |
#check_exp_mods ⇒ void
This method returns an undefined value.
Checks for experience modifiers in the game.
162 163 164 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 162 def check_exp_mods Lich::Util.issue_command("exp mods", /The following skills are currently under the influence of a modifier/, /^<output class=""/, quiet: true, include_end: false, usexml: false) end |
#clean_and_split(room_objs) ⇒ Array<String>
Cleans and splits room objects into an array.
186 187 188 189 190 191 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 186 def clean_and_split(room_objs) room_objs.sub(DRDefsPattern::YOU_ALSO_SEE, '') .sub(DRDefsPattern::MOUNT_DESCRIPTION, '') .strip .split(DRDefsPattern::COMMA_OR_AND) end |
#clean_npc_string(npc_string) ⇒ Array<String>
Cleans and normalizes a string of NPC names.
262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 262 def clean_npc_string(npc_string) # Normalize NPC names normalized_npcs = npc_string .map { |obj| normalize_creature_names(obj) } .map { |obj| (obj) } .map { |obj| extract_last_creature(obj) } .map { |obj| extract_final_name(obj) } .compact .sort # Count occurrences and add ordinals add_ordinals_to_duplicates(normalized_npcs) end |
#convert2copper(amt, denomination) ⇒ Integer
Converts a given amount of currency to copper.
145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 145 def convert2copper(amt, denomination) if denomination =~ /platinum/ (amt.to_i * 10_000) elsif denomination =~ /gold/ (amt.to_i * 1000) elsif denomination =~ /silver/ (amt.to_i * 100) elsif denomination =~ /bronze/ (amt.to_i * 10) else amt end end |
#convert2plats(copper) ⇒ String
Converts a given amount of copper to various denominations.
170 171 172 173 174 175 176 177 178 179 180 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 170 def convert2plats(copper) denominations = [[10_000, 'platinum'], [1000, 'gold'], [100, 'silver'], [10, 'bronze'], [1, 'copper']] denominations.inject([copper, []]) do |result, denomination| remaining = result.first display = result.last if remaining / denomination.first > 0 display << "#{remaining / denomination.first} #{denomination.last}" end [remaining % denomination.first, display] end.last.join(', ') end |
#extract_final_name(text) ⇒ String
Extracts just the creature name from a string.
310 311 312 313 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 310 def extract_final_name(text) # Extract just the creature name (letters, hyphens, apostrophes) text.strip.scan(DRDefsPattern::CREATURE_NAME).first end |
#extract_last_creature(text) ⇒ String
Extracts the last creature name from a string, removing modifiers.
301 302 303 304 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 301 def extract_last_creature(text) # Get the last creature name after "and", removing modifiers like "glowing with" text.split(/\sand\s/).last.sub(DRDefsPattern::GLOWING_WITH, '') end |
#extract_npcs(room_objs, select_dead: false) ⇒ Array<String>
Extracts non-player characters from room objects.
346 347 348 349 350 351 352 353 354 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 346 def extract_npcs(room_objs, select_dead: false) all_npcs = find_all_npcs(room_objs) filtered = if select_dead all_npcs.select { |obj| DRDefsPattern::DEAD_NPC.match?(obj) } else all_npcs.reject { |obj| DRDefsPattern::DEAD_NPC.match?(obj) } end clean_npc_string(filtered) end |
#extract_pcs(room_players, filter_pattern: nil, status_pattern: DRDefsPattern::PLAYER_STATUS) ⇒ Array<String>
Extracts player characters from a room player string.
211 212 213 214 215 216 217 218 219 220 221 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 211 def extract_pcs(room_players, filter_pattern: nil, status_pattern: DRDefsPattern::PLAYER_STATUS) return [] if room_players.nil? || room_players.empty? players = normalize_trailing_and(room_players).split(', ') players = players.select { |obj| filter_pattern.match?(obj) } if filter_pattern players .map { |obj| obj.sub(status_pattern, '').sub(DRDefsPattern::PARENTHETICAL, '') } .map { |obj| obj.strip.scan(DRDefsPattern::PLAYER_NAME).first } .compact end |
#find_all_npcs(room_objs) ⇒ Array<String>
Finds all non-player characters in a room.
251 252 253 254 255 256 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 251 def find_all_npcs(room_objs) room_objs.sub(DRDefsPattern::YOU_ALSO_SEE, '') .sub(DRDefsPattern::MOUNT_DESCRIPTION, '') .strip .scan(DRDefsPattern::NPC_SCAN) end |
#find_dead_npcs(room_objs) ⇒ Array<String>
Finds dead non-player characters in a room.
368 369 370 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 368 def find_dead_npcs(room_objs) extract_npcs(room_objs, select_dead: true) end |
#find_npcs(room_objs) ⇒ Array<String>
Finds non-player characters in a room.
360 361 362 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 360 def find_npcs(room_objs) extract_npcs(room_objs, select_dead: false) end |
#find_objects(room_objs) ⇒ Array<String>
Finds objects in a room, excluding certain patterns.
376 377 378 379 380 381 382 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 376 def find_objects(room_objs) # Use sub instead of sub! to avoid mutating frozen strings processed_objs = room_objs.sub(DRDefsPattern::GELAPOD, DRDefsPattern::GELAPOD_REPLACEMENT) clean_and_split(processed_objs) .reject { |obj| DRDefsPattern::PUSH_BOLD.match?(obj) } .map { |obj| obj.sub(DRDefsPattern::TRAILING_PERIOD, '').strip.sub(DRDefsPattern::LEADING_ARTICLE, '').strip } end |
#find_pcs(room_players) ⇒ Array<String>
Finds player characters in a room.
227 228 229 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 227 def find_pcs(room_players) extract_pcs(room_players) end |
#find_pcs_prone(room_players) ⇒ Array<String>
Finds player characters that are lying down in a room.
235 236 237 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 235 def find_pcs_prone(room_players) extract_pcs(room_players, filter_pattern: DRDefsPattern::LYING_DOWN, status_pattern: DRDefsPattern::WHO_STATUS) end |
#find_pcs_sitting(room_players) ⇒ Array<String>
Finds player characters that are sitting in a room.
243 244 245 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 243 def find_pcs_sitting(room_players) extract_pcs(room_players, filter_pattern: DRDefsPattern::SITTING, status_pattern: DRDefsPattern::WHO_STATUS) end |
#normalize_creature_names(text) ⇒ String
Normalizes creature names based on specific patterns.
280 281 282 283 284 285 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 280 def normalize_creature_names(text) text .sub(DRDefsPattern::ALFAR_WARRIOR_PATTERN, 'alfar warrior') .sub(DRDefsPattern::SINEWY_LEOPARD_PATTERN, 'sinewy leopard') .sub(DRDefsPattern::LESSER_NAGA_PATTERN, 'lesser naga') end |
#normalize_trailing_and(text) ⇒ String
Normalizes the trailing "and" in a string.
197 198 199 200 201 202 203 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 197 def normalize_trailing_and(text) if (match = text.match(DRDefsPattern::TRAILING_AND)) text.sub(DRDefsPattern::TRAILING_AND, ", #{match[:last]}") else text end end |
#remove_html_tags(text) ⇒ String
Removes HTML tags from a string.
291 292 293 294 295 |
# File 'documented/dragonrealms/drinfomon/drdefs.rb', line 291 def (text) text .sub('<pushBold/>', '') .sub(%r{<popBold/>.*}, '') end |