Module: Lich::DragonRealms::DRCS

Defined in:
documented/dragonrealms/commons/common-summoning.rb

Class Method Summary collapse

Class Method Details

.break_summoned_weapon(item) ⇒ void

This method returns an undefined value.

Breaks a summoned weapon.

Examples:

break_summoned_weapon('sword')

Parameters:

  • item (Object)

    The item to break.



62
63
64
65
66
# File 'documented/dragonrealms/commons/common-summoning.rb', line 62

def break_summoned_weapon(item)
  return if item.nil?

  DRC.bput("break my #{item}", 'Focusing your will', 'disrupting its matrix', "You can't break", "Break what")
end

.get_ingot(ingot, swap) ⇒ void

This method returns an undefined value.

Retrieves an ingot for use in summoning.

Examples:

get_ingot('iron', true)

Parameters:

  • ingot (Object)

    The type of ingot to retrieve.

  • swap (Boolean)

    Indicates whether to swap the ingot.



39
40
41
42
43
44
# File 'documented/dragonrealms/commons/common-summoning.rb', line 39

def get_ingot(ingot, swap)
  return unless ingot

  DRC.bput("get my #{ingot} ingot", 'You get')
  DRC.bput('swap', 'You move') if swap
end

.identify_summoned_weapon(settings = nil) ⇒ Object?

Identifies the summoned weapon in hand.

Examples:

weapon = identify_summoned_weapon(settings)

Parameters:

  • settings (Object, nil) (defaults to: nil)

    Additional settings (optional).

Returns:

  • (Object, nil)

    The identified weapon or nil if not found.



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'documented/dragonrealms/commons/common-summoning.rb', line 115

def identify_summoned_weapon(settings = nil)
  if DRStats.moon_mage?
    return DRC.right_hand if DRCMM.is_moon_weapon?(DRC.right_hand)
    return DRC.left_hand  if DRCMM.is_moon_weapon?(DRC.left_hand)
  elsif DRStats.warrior_mage?
    custom_adjective = settings&.summoned_weapons_adjective ? (settings.summoned_weapons_adjective + '|') : ''
    weapon_regex = /^You tap (?:a|an|some)(?:[\w\s\-]+)((#{custom_adjective}stone|fiery|icy|electric) [\w\s\-]+) that you are holding.$/
    # For a two-worded weapon like 'short sword' the only way to know
    # which element it was summoned with is by tapping it. That's the only
    # way we can infer if it's a summoned sword or a regular one.
    # However, the <adj> <noun> of the item we return must be what's in
    # their hands, not what the regex matches in the tap.
    return DRC.right_hand if DRCI.tap(DRC.right_hand) =~ weapon_regex
    return DRC.left_hand if DRCI.tap(DRC.left_hand) =~ weapon_regex
  else
    echo "Unable to summon weapons as a #{DRStats.guild}"
  end
end

.pull_summoned_weaponvoid

This method returns an undefined value.

Pulls the summoned weapon.

Examples:

pull_summoned_weapon


166
167
168
169
170
171
172
173
174
# File 'documented/dragonrealms/commons/common-summoning.rb', line 166

def pull_summoned_weapon
  case DRC.bput("pull my #{GameObj.right_hand.noun}", 'You lack the elemental charge', 'Closing your eyes', 'That\'s as')
  when 'You lack the elemental charge'
    summon_admittance
    pull_summoned_weapon
  end
  pause 1
  waitrt?
end

.push_summoned_weaponvoid

This method returns an undefined value.

Pushes the summoned weapon.

Examples:

push_summoned_weapon


152
153
154
155
156
157
158
159
160
# File 'documented/dragonrealms/commons/common-summoning.rb', line 152

def push_summoned_weapon
  case DRC.bput("push my #{GameObj.right_hand.noun}", 'You lack the elemental charge', 'Closing your eyes', 'That\'s as')
  when 'You lack the elemental charge'
    summon_admittance
    push_summoned_weapon
  end
  pause 1
  waitrt?
end

.shape_summoned_weapon(skill, ingot = nil, settings = nil) ⇒ void

This method returns an undefined value.

Shapes a summoned weapon to a specified skill.

Examples:

shape_summoned_weapon('blunt', 'iron')

Parameters:

  • skill (Object)

    The skill to shape the weapon.

  • ingot (Object, nil) (defaults to: nil)

    The ingot used (optional).

  • settings (Object, nil) (defaults to: nil)

    Additional settings (optional).



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'documented/dragonrealms/commons/common-summoning.rb', line 75

def shape_summoned_weapon(skill, ingot = nil, settings = nil)
  summoned_weapon = identify_summoned_weapon(settings)
  if DRStats.moon_mage?
    skill_to_shape = { 'Staves' => 'blunt', 'Twohanded Edged' => 'huge', 'Large Edged' => 'heavy', 'Small Edged' => 'normal' }
    shape = skill_to_shape[skill]
    if DRCMM.hold_moon_weapon?
      DRC.bput("shape #{summoned_weapon} to #{shape}", 'you adjust the magic that defines its shape', 'already has', 'You fumble around')
    end
  elsif DRStats.warrior_mage?
    shape_failures = ['You lack the elemental charge', 'You reach out', 'You fumble around', "You don't know how to manipulate your weapon in that way"]
    get_ingot(ingot, false)
    case DRC.bput("shape my #{summoned_weapon} to #{skill}", shape_failures + ['What type of weapon were you trying'])
    when 'You lack the elemental charge'
      summon_admittance
      shape_summoned_weapon(skill, nil, settings)
    when 'What type of weapon were you trying'
      # currently custom adjectives from https://elanthipedia.play.net/Books_of_Binding tomes
      # aren't recognized for shaping summoned elemental weapons, and the error message itself is misleading
      # thankfully breaking, turning, pulling, pushing work fine with custom adj
      unless summoned_weapon.nil?
        case DRC.bput("shape my #{summoned_weapon.sub(settings&.summoned_weapons_adjective || '', '')} to #{skill}", shape_failures)
        when 'You lack the elemental charge'
          summon_admittance
          shape_summoned_weapon(skill, nil, settings)
        end
      end
    end
    stow_ingot(ingot)
  else
    echo "Unable to shape weapons as a #{DRStats.guild}"
  end
  pause 1
  waitrt?
end

.stow_ingot(ingot) ⇒ void

This method returns an undefined value.

Stows the specified ingot.

Examples:

stow_ingot('iron')

Parameters:

  • ingot (Object)

    The type of ingot to stow.



51
52
53
54
55
# File 'documented/dragonrealms/commons/common-summoning.rb', line 51

def stow_ingot(ingot)
  return unless ingot

  DRC.bput("stow my #{ingot} ingot", 'You put')
end

.summon_admittancevoid

This method returns an undefined value.

Handles the admittance process for summoning.

Examples:

summon_admittance


180
181
182
183
184
185
186
187
188
189
# File 'documented/dragonrealms/commons/common-summoning.rb', line 180

def summon_admittance
  case DRC.bput('summon admittance', 'You align yourself to it', 'further increasing your proximity', 'Going any further while in this plane would be fatal', 'Summon allows Warrior Mages to draw', 'You are a bit too distracted')
  when 'You are a bit too distracted'
    DRC.retreat
    summon_admittance
  end
  pause 1
  waitrt?
  DRC.fix_standing
end

.summon_weapon(moon = nil, element = nil, ingot = nil, skill = nil) ⇒ void

This method returns an undefined value.

Summons a weapon based on the provided parameters.

Examples:

summon_weapon('full', 'fire', 'iron', 'sword')

Parameters:

  • moon (Object, nil) (defaults to: nil)

    The moon phase (optional).

  • element (Object, nil) (defaults to: nil)

    The elemental type of the weapon (optional).

  • ingot (Object, nil) (defaults to: nil)

    The type of ingot used (optional).

  • skill (Object, nil) (defaults to: nil)

    The skill level for summoning (optional).



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'documented/dragonrealms/commons/common-summoning.rb', line 14

def summon_weapon(moon = nil, element = nil, ingot = nil, skill = nil)
  if DRStats.moon_mage?
    DRCMM.hold_moon_weapon?
  elsif DRStats.warrior_mage?
    get_ingot(ingot, true)
    case DRC.bput("summon weapon #{element} #{skill}", 'You lack the elemental charge', 'you draw out')
    when 'You lack the elemental charge'
      summon_admittance
      summon_weapon(moon, element, nil, skill)
    end
    stow_ingot(ingot)
  else
    echo "Unable to summon weapons as a #{DRStats.guild}"
  end
  pause 1
  waitrt?
  DRC.fix_standing
end

.turn_summoned_weaponvoid

This method returns an undefined value.

Turns the summoned weapon.

Examples:

turn_summoned_weapon


138
139
140
141
142
143
144
145
146
# File 'documented/dragonrealms/commons/common-summoning.rb', line 138

def turn_summoned_weapon
  case DRC.bput("turn my #{GameObj.right_hand.noun}", 'You lack the elemental charge', 'You reach out')
  when 'You lack the elemental charge'
    summon_admittance
    turn_summoned_weapon
  end
  pause 1
  waitrt?
end