Sha256: 53be13eeed45d9591fa3152e4bf5fadff63ae980cc1c58fd51c8ee3a15c9cb9d

Contents?: true

Size: 977 Bytes

Versions: 2

Compression:

Stored size: 977 Bytes

Contents

require 'yaml'
require 'tty-prompt'
require 'colorize'

require_relative 'v-town'
require_relative 'v-leaderboard.rb'

module LeaderboardController
    def menu(input)
        narcissist = input
        player = YAML.load(File.read("m-playerdata.yml"))
        achievement = player.achievements

        if (narcissist > 3 && achievement.include?('Narcissist') == false)
            achievement << 'Narcissist'
            player.achievements = achievement
            File.open('m-playerdata.yml', 'w') {|file| File.write('m-playerdata.yml', player.to_yaml)}
            Leaderboard::start
        else
            narcissist += 1
        end
        prompt = TTY::Prompt.new
        prompt.select("Are you done mirin'?") do |menu|
            menu.choice "Yeah, let's get back to it...".colorize(:green), -> {::Town.menu}
            menu.choice "Nah, not yet...".colorize(:red), -> {::LeaderboardController.menu(narcissist)}
        end
    end
    module_function :menu
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lotrd-0.1.6 lib/lotrd/c-leaderboardController.rb
lotrd-0.1.5 lib/lotrd/c-leaderboardController.rb