diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/character.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/character.rb b/app/models/character.rb index aa434ef..df4938d 100644 --- a/app/models/character.rb +++ b/app/models/character.rb @@ -13,12 +13,16 @@ class Character < ApplicationRecord def shift_item(gid, amount) CharacterItem.transaction do - item = self.character_items.find_or_initialize_by(item: Item.find_by_gid(gid)) + item = self.character_items.find_or_initialize_by(item: Item.find_by_gid(gid.to_s)) item.increment(:quantity, amount) item.save end end + def add_skill_xp(skill, amount) + CharacterSkill.find_by(skill: skill).increment!(:xp, amount) + end + def skill_level(gid) self.character_skills.find_by(skill: Skill.find_by_gid(gid.to_s)).level end |