Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a way to convert spell descriptions into their equivalent stat bo…

…nuses.

For example, some items have "Increases spell power by 520." as a spell, but no equivalent bonusSpellPower entry. This would create that bonus for us. Currently only supports spell power and mana per 5, since those are the only ones I saw in my brief jaunt through my gear.
  • Loading branch information...
commit 1321eb0773ae1128df3f8f00214c3281392ce60c 1 parent 15158e5
@tsigo tsigo authored committed
Showing with 13 additions and 0 deletions.
  1. +13 −0 lib/wowr/item.rb
View
13 lib/wowr/item.rb
@@ -282,6 +282,19 @@ def initialize(elem, api = nil)
(elem%'spellData'/:spell).each do |spell|
@spells << ItemSpell.new(spell)
end
+
+ # Convert specific spell descriptions into bonus values
+ regex = {
+ :spell_power => /^Increases spell power by ([0-9]+)\.$/,
+ :mana_regen => /^Restores ([0-9]+) mana per 5 sec\.$/,
+ }
+ @spells.each do |spell|
+ regex.each do |bonus, exp|
+ if spell.description =~ exp
+ @bonuses[bonus] = spell.description.gsub(exp, '\1').to_i
+ end
+ end
+ end
end
@setData = ItemSetData.new(elem%'setData') if (elem%'setData')
Please sign in to comment.
Something went wrong with that request. Please try again.