Class: GodvilleKit::Hero

Inherits:
Object
  • Object
show all
Defined in:
lib/godville_kit/hero.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_hero_data, raw_pantheons_data) ⇒ Hero

Returns a new instance of Hero.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/godville_kit/hero.rb', line 44

def initialize(raw_hero_data, raw_pantheons_data)
  if raw_hero_data
    @name = raw_hero_data['hero']['name'].to_s
    @god_name = raw_hero_data['hero']['godname'].to_s
    @level = raw_hero_data['hero']['level'].to_s
    @quest = raw_hero_data['hero']['quest'].to_s
    @quest_progress = raw_hero_data['hero']['quest_progress'].to_s
    @exp_progress = raw_hero_data['hero']['exp_progress'].to_s
    @health = raw_hero_data['hero']['health'].to_s
    @max_health = raw_hero_data['hero']['max_health'].to_s
    @alignment = raw_hero_data['hero']['alignment'].to_s
    @motto = raw_hero_data['hero']['motto'].to_s
    @guild = raw_hero_data['hero']['clan'].to_s
    @guild_rank = raw_hero_data['hero']['clan_position'].to_s
    @temple_completed_at = raw_hero_data['hero']['temple_completed_at'].to_s
    @ark_completed_at = raw_hero_data['hero']['ark_completed_at'].to_s
    @town = raw_hero_data['hero']['town_name'].to_s
    @next_town = raw_hero_data['hero']['c_town'].to_s
    @distance = raw_hero_data['hero']['distance'].to_s
    @bricks = raw_hero_data['hero']['bricks_cnt'].to_s
    @wood = raw_hero_data['hero']['wood'].to_s
    @god_power = raw_hero_data['hero']['godpower'].to_s
    @gold = raw_hero_data['hero']['gold'].to_s
    @monsters_killed = raw_hero_data['hero']['monsters_killed'].to_s
    @deaths = raw_hero_data['hero']['death_count'].to_s
    @arena_wins = raw_hero_data['hero']['arena_won'].to_s
    @arena_losses = raw_hero_data['hero']['arena_lost'].to_s
    @approximate_age = raw_hero_data['hero']['age_str'].to_s
    @birthday = raw_hero_data['hero']['birthday'].to_s
    @accumulator = raw_hero_data['hero']['accumulator'].to_s
    @quests_completed = raw_hero_data['hero']['quests_completed'].to_s
    @monster_name = raw_hero_data['hero']['monster_name'].to_s
    @monster_progress = raw_hero_data['hero']['monster_progress'].to_s
    @aura_name = raw_hero_data['hero']['aura_name'].to_s
    @aura_time = raw_hero_data['hero']['aura_time'].to_s
    @max_inventory = raw_hero_data['hero']['inventory_max_num'].to_s

    # Inventory
    @inventory = raw_hero_data['inventory'].keys.map do |key|
      GodvilleKit::Item.new(key, raw_hero_data['inventory'][key].to_s)
    end

    # Equipment
    @equipment = GodvilleKit::Equipment.new(raw_hero_data['equipment'])

    # Skils
    @skills = raw_hero_data['skills'].map do |raw_skill_data|
      GodvilleKit::Skill.new(raw_skill_data)
    end

    # Diary
    @diary = raw_hero_data['diary'].map do |raw_diary_entry_data|
      GodvilleKit::DiaryEntry.new(raw_diary_entry_data)
    end
  end

  # Pantheons
  if raw_pantheons_data
    @pantheons = GodvilleKit::Pantheons.new(raw_pantheons_data)
  end
end

Instance Attribute Details

#accumulatorObject (readonly)

Returns the value of attribute accumulator.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def accumulator
  @accumulator
end

#alignmentObject (readonly)

Returns the value of attribute alignment.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def alignment
  @alignment
end

#approximate_ageObject (readonly)

Returns the value of attribute approximate_age.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def approximate_age
  @approximate_age
end

#arena_lossesObject (readonly)

Returns the value of attribute arena_losses.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def arena_losses
  @arena_losses
end

#arena_winsObject (readonly)

Returns the value of attribute arena_wins.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def arena_wins
  @arena_wins
end

#arkObject (readonly)

Returns the value of attribute ark.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def ark
  @ark
end

#ark_completed_atObject (readonly)

Returns the value of attribute ark_completed_at.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def ark_completed_at
  @ark_completed_at
end

#aura_nameObject (readonly)

Returns the value of attribute aura_name.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def aura_name
  @aura_name
end

#aura_timeObject (readonly)

Returns the value of attribute aura_time.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def aura_time
  @aura_time
end

#birthdayObject (readonly)

Returns the value of attribute birthday.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def birthday
  @birthday
end

#bricksObject (readonly)

Returns the value of attribute bricks.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def bricks
  @bricks
end

#deathsObject (readonly)

Returns the value of attribute deaths.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def deaths
  @deaths
end

#diaryObject (readonly)

Returns the value of attribute diary.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def diary
  @diary
end

#distanceObject (readonly)

Returns the value of attribute distance.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def distance
  @distance
end

#equipmentObject (readonly)

Returns the value of attribute equipment.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def equipment
  @equipment
end

#exp_progressObject (readonly)

Returns the value of attribute exp_progress.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def exp_progress
  @exp_progress
end

#god_nameObject (readonly)

Returns the value of attribute god_name.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def god_name
  @god_name
end

#god_powerObject (readonly)

Returns the value of attribute god_power.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def god_power
  @god_power
end

#goldObject (readonly)

Returns the value of attribute gold.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def gold
  @gold
end

#guildObject (readonly)

Returns the value of attribute guild.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def guild
  @guild
end

#guild_rankObject (readonly)

Returns the value of attribute guild_rank.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def guild_rank
  @guild_rank
end

#healthObject (readonly)

Returns the value of attribute health.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def health
  @health
end

#inventoryObject (readonly)

Returns the value of attribute inventory.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def inventory
  @inventory
end

#levelObject (readonly)

Returns the value of attribute level.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def level
  @level
end

#max_healthObject (readonly)

Returns the value of attribute max_health.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def max_health
  @max_health
end

#max_inventoryObject (readonly)

Returns the value of attribute max_inventory.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def max_inventory
  @max_inventory
end

#monster_nameObject (readonly)

Returns the value of attribute monster_name.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def monster_name
  @monster_name
end

#monster_progressObject (readonly)

Returns the value of attribute monster_progress.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def monster_progress
  @monster_progress
end

#monsters_killedObject (readonly)

Returns the value of attribute monsters_killed.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def monsters_killed
  @monsters_killed
end

#mottoObject (readonly)

Returns the value of attribute motto.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def motto
  @motto
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def name
  @name
end

#next_townObject (readonly)

Returns the value of attribute next_town.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def next_town
  @next_town
end

#pantheonsObject (readonly)

Returns the value of attribute pantheons.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def pantheons
  @pantheons
end

#questObject (readonly)

Returns the value of attribute quest.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def quest
  @quest
end

#quest_progressObject (readonly)

Returns the value of attribute quest_progress.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def quest_progress
  @quest_progress
end

#quests_completedObject (readonly)

Returns the value of attribute quests_completed.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def quests_completed
  @quests_completed
end

#skillsObject (readonly)

Returns the value of attribute skills.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def skills
  @skills
end

#temple_completed_atObject (readonly)

Returns the value of attribute temple_completed_at.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def temple_completed_at
  @temple_completed_at
end

#townObject (readonly)

Returns the value of attribute town.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def town
  @town
end

#woodObject (readonly)

Returns the value of attribute wood.



3
4
5
# File 'lib/godville_kit/hero.rb', line 3

def wood
  @wood
end