Class: Osu::DB::Score
- Inherits:
-
Object
- Object
- Osu::DB::Score
- Defined in:
- lib/osu-db/score.rb
Overview
Structure of scores.db
-
str[rdoc-ref:StringIO#read_str] #beatmapcode: digest of Beatmap
-
str[rdoc-ref:StringIO#read_str] #user: username
-
str[rdoc-ref:StringIO#read_str] #scorecode: digest of Score
-
int[rdoc-ref:StringIO#read_int] #x300, #x100, #x50: the number of 300s, 100s and 50s
-
int[rdoc-ref:StringIO#read_int] #geki, #katsu, #miss: these attributes may have different meaning is special modes
-
int[rdoc-ref:StringIO#read_int] #score, #combo: score and max combo
-
bool[rdoc-ref:StringIO#read_bool] #perfect?: full combo or not
-
bitset[rdoc-ref:StringIO#read_int] #mods: mods or game modifiers, see Mod and Mods
-
time[rdoc-ref:StringIO#read_time] #datetime: played time
-
0xFFFFFFFF
-
int[rdoc-ref:StringIO#read_int] #scoreid: score id
Direct Known Subclasses
Instance Attribute Summary collapse
-
#beatmapcode ⇒ Object
readonly
Returns the value of attribute beatmapcode.
-
#combo ⇒ Object
readonly
Returns the value of attribute combo.
-
#datetime ⇒ Object
readonly
Returns the value of attribute datetime.
-
#dummy ⇒ Object
readonly
Returns the value of attribute dummy.
-
#game_mode ⇒ Object
readonly
Returns the value of attribute game_mode.
-
#geki ⇒ Object
readonly
Returns the value of attribute geki.
-
#katsu ⇒ Object
readonly
Returns the value of attribute katsu.
-
#miss ⇒ Object
readonly
Returns the value of attribute miss.
-
#mods ⇒ Object
readonly
Returns the value of attribute mods.
-
#perfect ⇒ Object
(also: #perfect?, #full_combo)
readonly
Returns the value of attribute perfect.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
-
#scorecode ⇒ Object
readonly
Returns the value of attribute scorecode.
-
#scoreid ⇒ Object
readonly
Returns the value of attribute scoreid.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
-
#x100 ⇒ Object
readonly
Returns the value of attribute x100.
-
#x300 ⇒ Object
readonly
Returns the value of attribute x300.
-
#x50 ⇒ Object
readonly
Returns the value of attribute x50.
Instance Method Summary collapse
- #accuracy ⇒ Object
- #grade ⇒ Object
- #hits ⇒ Object
-
#initialize(game_mode, ios = nil) ⇒ Score
constructor
A new instance of Score.
- #load(ios) ⇒ Object
Constructor Details
#initialize(game_mode, ios = nil) ⇒ Score
Returns a new instance of Score.
35 36 37 38 |
# File 'lib/osu-db/score.rb', line 35 def initialize(game_mode, ios = nil) @game_mode = game_mode load(ios) if ios end |
Instance Attribute Details
#beatmapcode ⇒ Object (readonly)
Returns the value of attribute beatmapcode.
27 28 29 |
# File 'lib/osu-db/score.rb', line 27 def beatmapcode @beatmapcode end |
#combo ⇒ Object (readonly)
Returns the value of attribute combo.
27 28 29 |
# File 'lib/osu-db/score.rb', line 27 def combo @combo end |
#datetime ⇒ Object (readonly)
Returns the value of attribute datetime.
27 28 29 |
# File 'lib/osu-db/score.rb', line 27 def datetime @datetime end |
#dummy ⇒ Object (readonly)
Returns the value of attribute dummy.
27 28 29 |
# File 'lib/osu-db/score.rb', line 27 def dummy @dummy end |
#game_mode ⇒ Object (readonly)
Returns the value of attribute game_mode.
27 28 29 |
# File 'lib/osu-db/score.rb', line 27 def game_mode @game_mode end |
#geki ⇒ Object (readonly)
Returns the value of attribute geki.
27 28 29 |
# File 'lib/osu-db/score.rb', line 27 def geki @geki end |
#katsu ⇒ Object (readonly)
Returns the value of attribute katsu.
27 28 29 |
# File 'lib/osu-db/score.rb', line 27 def katsu @katsu end |
#miss ⇒ Object (readonly)
Returns the value of attribute miss.
27 28 29 |
# File 'lib/osu-db/score.rb', line 27 def miss @miss end |
#mods ⇒ Object (readonly)
Returns the value of attribute mods.
27 28 29 |
# File 'lib/osu-db/score.rb', line 27 def mods @mods end |
#perfect ⇒ Object (readonly) Also known as: perfect?, full_combo
Returns the value of attribute perfect.
27 28 29 |
# File 'lib/osu-db/score.rb', line 27 def perfect @perfect end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
27 28 29 |
# File 'lib/osu-db/score.rb', line 27 def score @score end |
#scorecode ⇒ Object (readonly)
Returns the value of attribute scorecode.
27 28 29 |
# File 'lib/osu-db/score.rb', line 27 def scorecode @scorecode end |
#scoreid ⇒ Object (readonly)
Returns the value of attribute scoreid.
27 28 29 |
# File 'lib/osu-db/score.rb', line 27 def scoreid @scoreid end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
27 28 29 |
# File 'lib/osu-db/score.rb', line 27 def user @user end |
#x100 ⇒ Object (readonly)
Returns the value of attribute x100.
27 28 29 |
# File 'lib/osu-db/score.rb', line 27 def x100 @x100 end |
#x300 ⇒ Object (readonly)
Returns the value of attribute x300.
27 28 29 |
# File 'lib/osu-db/score.rb', line 27 def x300 @x300 end |
#x50 ⇒ Object (readonly)
Returns the value of attribute x50.
27 28 29 |
# File 'lib/osu-db/score.rb', line 27 def x50 @x50 end |
Instance Method Details
#accuracy ⇒ Object
44 45 46 |
# File 'lib/osu-db/score.rb', line 44 def accuracy raise NotImplementedError end |
#grade ⇒ Object
48 49 50 |
# File 'lib/osu-db/score.rb', line 48 def grade raise NotImplementedError end |
#hits ⇒ Object
40 41 42 |
# File 'lib/osu-db/score.rb', line 40 def hits raise NotImplementedError end |
#load(ios) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/osu-db/score.rb', line 52 def load(ios) ios.read_version @beatmapcode = ios.read_str @user = ios.read_str @scorecode = ios.read_str @x300, @x100, @x50, @geki, @katsu, @miss = *ios.unpack(12, 'v6') @score = ios.read_int(4) @combo = ios.read_int(2) @perfect = ios.read_bool @mods = Mods.new(ios.read_int(5)) @datetime = ios.read_time @dummy = ios.read_int(4) # TODO: always = 0xFFFFFFFF @scoreid = ios.read_int(4) end |