From 6dff23b065bd933ff2f571d2264c86902173d40b Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 29 Sep 2017 18:36:57 -0400 Subject: Added ribbons Gift ribbons currently partially work: the correct ribbon image and name is shown, but the ribbon description is not yet extracted from the game and thus is just blank. --- app/models/pokeviewer/revision.rb | 298 +++++++++++++++++++++++++++++++++++++- 1 file changed, 297 insertions(+), 1 deletion(-) (limited to 'app/models') diff --git a/app/models/pokeviewer/revision.rb b/app/models/pokeviewer/revision.rb index 44388ca..4481bf0 100644 --- a/app/models/pokeviewer/revision.rb +++ b/app/models/pokeviewer/revision.rb @@ -8,7 +8,11 @@ module Pokeviewer :special_attack, :special_defense, :speed, :coolness, :beauty, :cuteness, :smartness, :toughness, :sheen, :hold_item, :move_1_id, :move_2_id, :move_3_id, :move_4_id, :move_1_pp_bonuses, :move_2_pp_bonuses, - :move_3_pp_bonuses, :move_4_pp_bonuses + :move_3_pp_bonuses, :move_4_pp_bonuses, :cool_ribbons, :beauty_ribbons, + :cute_ribbons, :smart_ribbons, :tough_ribbons, :champion_ribbon, + :winning_ribbon, :victory_ribbon, :artist_ribbon, :effort_ribbon, + :marine_ribbon, :land_ribbon, :sky_ribbon, :country_ribbon, + :national_ribbon, :earth_ribbon, :world_ribbon belongs_to :pokemon acts_as_sequenced scope: :pokemon_id @@ -103,5 +107,297 @@ module Pokeviewer greater_than_or_equal_to: 0, less_than_or_equal_to: 3, only_integer: true} + + validates :cool_ribbons, presence: true, + numericality: { + greater_than_or_equal_to: 0, + less_than_or_equal_to: 4, + only_integer: true} + + validates :beauty_ribbons, presence: true, + numericality: { + greater_than_or_equal_to: 0, + less_than_or_equal_to: 4, + only_integer: true} + + validates :cute_ribbons, presence: true, + numericality: { + greater_than_or_equal_to: 0, + less_than_or_equal_to: 4, + only_integer: true} + + validates :smart_ribbons, presence: true, + numericality: { + greater_than_or_equal_to: 0, + less_than_or_equal_to: 4, + only_integer: true} + + validates :tough_ribbons, presence: true, + numericality: { + greater_than_or_equal_to: 0, + less_than_or_equal_to: 4, + only_integer: true} + + def ribbons + result = [] + + if cool_ribbons >= 1 + result << { + filename: "cool-ribbon.png", + name: "Cool Ribbon", + description: "Cool Contest Normal Rank Winner!" + } + end + + if cool_ribbons >= 2 + result << { + filename: "cool-ribbon-super.png", + name: "Cool Ribbon Super", + description: "Cool Contest Super Rank Winner!" + } + end + + if cool_ribbons >= 3 + result << { + filename: "cool-ribbon-hyper.png", + name: "Cool Ribbon Hyper", + description: "Cool Contest Hyper Rank Winner!" + } + end + + if cool_ribbons == 4 + result << { + filename: "cool-ribbon-master.png", + name: "Cool Ribbon Master", + description: "Cool Contest Master Rank Winner!" + } + end + + if beauty_ribbons >= 1 + result << { + filename: "beauty-ribbon.png", + name: "Beauty Ribbon", + description: "Beauty Contest Normal Rank Winner!" + } + end + + if beauty_ribbons >= 2 + result << { + filename: "beauty-ribbon-super.png", + name: "Beauty Ribbon Super", + description: "Beauty Contest Super Rank Winner!" + } + end + + if beauty_ribbons >= 3 + result << { + filename: "beauty-ribbon-hyper.png", + name: "Beauty Ribbon Hyper", + description: "Beauty Contest Hyper Rank Winner!" + } + end + + if beauty_ribbons == 4 + result << { + filename: "beauty-ribbon-master.png", + name: "Beauty Ribbon Master", + description: "Beauty Contest Master Rank Winner!" + } + end + + if cute_ribbons >= 1 + result << { + filename: "cute-ribbon.png", + name: "Cute Ribbon", + description: "Cute Contest Normal Rank Winner!" + } + end + + if cute_ribbons >= 2 + result << { + filename: "cute-ribbon-super.png", + name: "Cute Ribbon Super", + description: "Cute Contest Super Rank Winner!" + } + end + + if cute_ribbons >= 3 + result << { + filename: "cute-ribbon-hyper.png", + name: "Cute Ribbon Hyper", + description: "Cute Contest Hyper Rank Winner!" + } + end + + if cute_ribbons == 4 + result << { + filename: "cute-ribbon-master.png", + name: "Cute Ribbon Master", + description: "Cute Contest Master Rank Winner!" + } + end + + if smart_ribbons >= 1 + result << { + filename: "smart-ribbon.png", + name: "Smart Ribbon", + description: "Smart Contest Normal Rank Winner!" + } + end + + if smart_ribbons >= 2 + result << { + filename: "smart-ribbon-super.png", + name: "Smart Ribbon Super", + description: "Smart Contest Super Rank Winner!" + } + end + + if smart_ribbons >= 3 + result << { + filename: "smart-ribbon-hyper.png", + name: "Smart Ribbon Hyper", + description: "Smart Contest Hyper Rank Winner!" + } + end + + if smart_ribbons == 4 + result << { + filename: "smart-ribbon-master.png", + name: "Smart Ribbon Master", + description: "Smart Contest Master Rank Winner!" + } + end + + if tough_ribbons >= 1 + result << { + filename: "tough-ribbon.png", + name: "Tough Ribbon", + description: "Tough Contest Normal Rank Winner!" + } + end + + if tough_ribbons >= 2 + result << { + filename: "tough-ribbon-super.png", + name: "Tough Ribbon Super", + description: "Tough Contest Super Rank Winner!" + } + end + + if tough_ribbons >= 3 + result << { + filename: "tough-ribbon-hyper.png", + name: "Tough Ribbon Hyper", + description: "Tough Contest Hyper Rank Winner!" + } + end + + if tough_ribbons == 4 + result << { + filename: "tough-ribbon-master.png", + name: "Tough Ribbon Master", + description: "Tough Contest Master Rank Winner!" + } + end + + if champion_ribbon + result << { + filename: "champion-ribbon.png", + name: "Champion Ribbon", + description: "Champion-beating, Hall of Fame Member Ribbon" + } + end + + if winning_ribbon + result << { + filename: "winning-ribbon.png", + name: "Winning Ribbon", + description: "Ribbon for clearing LV50 at the Battle Tower." + } + end + + if victory_ribbon + result << { + filename: "victory-ribbon.png", + name: "Victory Ribbon", + description: "Won for clearing LV100 at the Battle Tower." + } + end + + if artist_ribbon + result << { + filename: "artist-ribbon.png", + name: "Artist Ribbon", + description: "Ribbon for being chosen as a super sketch model." + } + end + + if effort_ribbon + result << { + filename: "effort-ribbon.png", + name: "Effort Ribbon", + description: "Ribbon awarded for being a hard worker." + } + end + + if marine_ribbon + result << { + filename: "marine-ribbon.png", + name: "Marine Ribbon", + description: "" + } + end + + if land_ribbon + result << { + filename: "land-ribbon.png", + name: "Land Ribbon", + description: "" + } + end + + if sky_ribbon + result << { + filename: "sky-ribbon.png", + name: "Sky Ribbon", + description: "" + } + end + + if country_ribbon + result << { + filename: "country-ribbon.png", + name: "Country Ribbon", + description: "" + } + end + + if national_ribbon + result << { + filename: "national-ribbon.png", + name: "National Ribbon", + description: "" + } + end + + if earth_ribbon + result << { + filename: "earth-ribbon.png", + name: "Earth Ribbon", + description: "" + } + end + + if world_ribbon + result << { + filename: "world-ribbon.png", + name: "World Ribbon", + description: "" + } + end + + result + end end end -- cgit 1.4.1