This file contains hidden or 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 | |
This file contains hidden or 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 | |
This file contains hidden or 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 |
This file contains hidden or 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
Character | |
Armor | |
Armor Item | |
Item Tier (Base stats all tier items share) | |
Item (Specific item stats) | |
Item Bonus (Bonus stats added via other means) | |
Enchant (Bonus stats added via an enchant) | |
Enchant + Bonus + Item + Tier = Item stats | |
This file contains hidden or 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, :stamina, :strength, :intellect | |
This file contains hidden or 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 | |
[:back, :chest, :feet, :hands, :head, :legs, :shoulder, :waist, :finger].each do |part| | |
belongs_to part, :class_name => 'ArmorItem' | |
define_method part do | |
# what do I place here? I'm using :class_name to route it to an ArmorItem | |
ArmorItem.find(:part[_id]) |
This file contains hidden or 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 | |
[:back, :chest, :feet, :hands, :head, :legs, :shoulder, :waist, :finger].each do |part| | |
belongs_to part, :class_name => 'ArmorItem' | |
end | |
end |
This file contains hidden or 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 | |
def stat | |
StatSet.find(stat_set_id) |
This file contains hidden or 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
<div class="armor"> | |
<% @armor.each do |a| if a != nil then %> | |
<div class="armor-item"> | |
<h1><%= a.name %> <%= a.armor_tier.name %></h1> | |
<span class="stat-bonus"><%= a.stat.agility %> Agility</span> | |
<span class="stat-bonus"><%= a.stat.stamina %> Stamina</span> | |
<span class="stat-bonus"><%= a.stat.strength %> Strength</span> | |
<span class="stat-bonus"><%= a.stat.intellect %> Strength</span> | |
<span class="stat-level">Level <%= a.armor_tier.level %></span> | |
</div> |
This file contains hidden or 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
DEPRECATION WARNING: Database connections will not be closed automatically, please close your database connection at the end of the thread by calling `close` on your connection. For example: ActiveRecord::Base.connection.close |