diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/character.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/character.rb b/app/models/character.rb index f6ddb92..b3d8c25 100644 --- a/app/models/character.rb +++ b/app/models/character.rb @@ -16,6 +16,7 @@ class Character < ApplicationRecord has_many :states has_many :chat_messages has_many :monster_kills + has_many :monster_spawn_combats has_many :bazaar_orders validates :name, presence: true # TODO: Make defaults better. This has to allow nil so the `attribute` default works, and I don't like that. @@ -459,6 +460,11 @@ class Character < ApplicationRecord base end + def monster_spawns_attacked_in_past_24_hours + # TODO: Don't load into memory + monster_spawn_combats.where(created_at: 24.hours.ago..).map { |msc| msc.monster_spawn }.uniq + end + private def create_skills Skill.all.each { |skill| self.character_skills.create(skill: skill, xp: 0) } |