Class: MaimaiNet::Constants::GameVersion

Inherits:
Object
  • Object
show all
Includes:
ModuleExt
Defined in:
lib/maimai_net/constants.rb

Constant Summary collapse

ORIGINAL_VERSIONS =
%w(maimai GReeN ORANGE PiNK MURASAKi MiLK FiNALE)
DELUXE_VERSIONS =
%w(Deluxe Splash UNiVERSE FESTiVAL BUDDiES PRiSM CiRCLE)
VERSIONS =
{}.tap do |ver|
  ORIGINAL_VERSIONS.slice(0...-1).flat_map do |k|
    [k, "#{k}_PLUS"]
  end.push(ORIGINAL_VERSIONS.last).map(&:upcase).map(&:to_sym).each_with_index.map do |k, i|
    case i
    when 0..8
      [k, 100 + i * 10]
    else
      [k, [180 + (i - 8) * 5, 199].min]
    end
  end.to_h.tap(&ver.method(:update))
  DELUXE_VERSIONS.map(&:upcase).flat_map do |k|
    [k, "#{k}_PLUS"]
  end.map(&:to_sym).each_with_index.map do |k, i|
    [k, 200 + i * 5]
  end.to_h.tap(&ver.method(:update))
end
ORIGINAL =
VERSIONS.select do |k, v| v < 200 end
DELUXE =
VERSIONS.select do |k, v| v >= 200 end.transform_values do |v| v - 100 end
LIBRARY =
VERSIONS
DELUXE_WEBSITE =
LIBRARY.keys.each_with_index.to_h

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key) ⇒ GameVersion

Returns a new instance of GameVersion.



429
430
431
432
433
434
435
436
437
438
# File 'lib/maimai_net/constants.rb', line 429

def initialize(key)
  @key = key

  @id            = LIBRARY[key]
  @original_id   = ORIGINAL[key]
  @deluxe_id     = DELUXE[key]
  @deluxe_web_id = DELUXE_WEBSITE[key]

  freeze
end

Instance Attribute Details

#deluxe_idObject (readonly)

Returns the value of attribute deluxe_id.



441
442
443
# File 'lib/maimai_net/constants.rb', line 441

def deluxe_id
  @deluxe_id
end

#deluxe_web_idObject (readonly)

Returns the value of attribute deluxe_web_id.



441
442
443
# File 'lib/maimai_net/constants.rb', line 441

def deluxe_web_id
  @deluxe_web_id
end

#idObject (readonly) Also known as: to_i

Returns the value of attribute id.



441
442
443
# File 'lib/maimai_net/constants.rb', line 441

def id
  @id
end

#keyObject (readonly) Also known as: to_sym

Returns the value of attribute key.



440
441
442
# File 'lib/maimai_net/constants.rb', line 440

def key
  @key
end

#original_idObject (readonly)

Returns the value of attribute original_id.



441
442
443
# File 'lib/maimai_net/constants.rb', line 441

def original_id
  @original_id
end