Created
August 29, 2012 02:45
-
-
Save benphelps/3506300 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Armor < ActiveRecord::Base | |
attr_accessible :back_id, :character_id, :chest_id, :feet_id, :hands_id, :head_id, :legs_id, :shoulder_id, :waist_id, :finger_id | |
belongs_to :character | |
attr_reader :back, :chest, :feet, :hands, :head, :legs, :shoulder, :waist, :finger | |
def hands | |
ArmorItem.find(hands_id) | |
end | |
belongs_to :back, :class_name => 'ArmorItem' | |
belongs_to :chest, :class_name => 'ArmorItem' | |
belongs_to :feet, :class_name => 'ArmorItem' | |
belongs_to :hands, :class_name => 'ArmorItem' | |
belongs_to :head, :class_name => 'ArmorItem' | |
belongs_to :legs, :class_name => 'ArmorItem' | |
belongs_to :shoulder, :class_name => 'ArmorItem' | |
belongs_to :waist, :class_name => 'ArmorItem' | |
belongs_to :finger, :class_name => 'ArmorItem' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ArmorItem < ActiveRecord::Base | |
attr_accessible :armor_tier_id, :bonus_id, :enchant_id, :name, :stat_set_id | |
belongs_to :armor_tier | |
belongs_to :enchant | |
belongs_to :bonus | |
belongs_to :stat_set | |
attr_reader :stat, :agility | |
def stat | |
StatSet.find(stat_set_id) | |
end | |
def agility | |
ArmorTier.find(armor_tier_id).stat.agility + StatSet.find(stat_set_id).agility | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ArmorMaterial < ActiveRecord::Base | |
attr_accessible :name | |
has_many :armor_tiers | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ArmorTier < ActiveRecord::Base | |
attr_accessible :level, :name, :deviation, :stat_set_id, :armor_material_id | |
belongs_to :armor_material | |
belongs_to :stat_set | |
attr_reader :stat | |
def stat | |
StatSet.find(stat_set_id) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bonus < ActiveRecord::Base | |
attr_accessible :name | |
has_many :stat_set | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment