osu-repy/README.md

114 lines
1.8 KiB
Markdown
Raw Normal View History

2019-03-13 05:42:11 +01:00
# osu-repy
2019-03-13 10:59:06 +01:00
osu! replay helper in python
2019-03-13 05:42:11 +01:00
2019-03-13 10:59:06 +01:00
## Sample
```python
from osuRepy.frame import ReplayFrame # ReplayFrame
from osuRepy.replay import Replay # Replay instance
from osuRepy.helpers import osuButtons, osuMods # Enum helpers
2019-03-13 11:13:55 +01:00
replay = Replay(beatmap_hash = "9e66c0a0eadced7d07f06b3968a74cc0") # Create replay instance
2019-03-13 10:59:06 +01:00
replay.write( ReplayFrame(2, 256, 192, osuButtons.M1) ) # Add replay frame (time, x, y, buttons)
replay.set_score(score = 29284624,
s300 = 416,
s50 = 2,
miss = 1,
combo = 358) # Set score info
replay.set_mods(osuMods.HIDDEN | osuMods.DOUBLETIME) # Enable HDDT mods
replay.set_timestamp(1552466941) # Set unix timestamp
replay.save("myReplay.osr") # Export replay to file
```
# Enums (from helpers)
### osuButtons
|Name|Value|
|-|-|
|NONE|0|
|LEFTMOUSE|1|
|RIGHTMOUSE|2|
|LEFTKEY|4|
|RIGHTKEY|8|
|SMOKE|16|
|M1|1|
|M2|2|
|K1|5|
|K2|10|
### osuModes
|Name|Value|
|-|-|
|STANDARD|0|
|TAIKO|1|
|CATCH_THE_BEAT|2|
|MANIA|3|
### osuMods
|Name|Value|
|-|-|
|NOMOD|0|
|NOFAIL|1|
|EASY|2|
|TOUCHSCREEN|4|
|HIDDEN|8|
|HARDROCK|16|
|SUDDENDEATH|32|
|DOUBLETIME|64|
|RELAX|128|
|HALFTIME|256|
|NIGHTCORE|512|
|FLASHLIGHT|1024|
|AUTOPLAY|2048|
|SPUNOUT|4096|
|AUTOPILOT|8192|
|PERFECT|16384|
|KEY4|32768|
|KEY5|65536|
|KEY6|131072|
|KEY7|262144|
|KEY8|524288|
|KEYMOD|1048576|
|FADEIN|2097152|
|RANDOM|4194304|
|LASTMOD|8388608|
|KEY9|16777216|
|KEY10|33554432|
|KEY1|67108864|
|KEY3|134217728|
|KEY2|268435456|
|SCOREV2|536870912|
### osuRanks
|Name|Value|
|-|-|
|SSH|0|
|SH|1|
|SS|2|
|S|3|
|A|4|
|B|5|
|C|6|
|D|7|
|F|8|
|N|9|
(We dont speak of typeSerializer)
# Tips
```python
if you.style is 'passing arrays of information':
```
```python
frames = [
ReplayFrame(0, 256, 192, osuButtons.NONE),
ReplayFrame(8, 258, 191, osuButtons.NONE),
ReplayFrame(13, 257, 198, osuButtons.M1 | osuButtons.SMOKE)
]
replay = Replay()
replay.write( frames )
```