-
Notifications
You must be signed in to change notification settings - Fork 0
/
Utils.py
76 lines (62 loc) · 1.48 KB
/
Utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
"""
A class full of tools needed for mod conversion.
"""
from . import Constants
def character(name:str) -> str:
"""
Some characters might have changed names in the Base Game,
this will help you convert their names.
Args:
name (str): Name of the character.
"""
return Constants.CHARACTERS.get(name, name)
def stage(name:str) -> str:
"""
Some stages might have changed names in the Base Game,
this will help you convert their names.
Args:
name (str): Name of the stage.
"""
return Constants.STAGES.get(name, name)
def timeChange(timeStamp:float, bpm:float, timeSignatureNum:int, timeSignatureDen:int, beatTime:int, beatTuplets:list) -> dict:
"""
Function created for faster creation of song time changes.
"""
return {
"t": timeStamp,
"b": beatTime,
"bpm": bpm,
"n": timeSignatureNum,
"d": timeSignatureDen,
"bt": beatTuplets
}
def note(time:str, data:int, length:float) -> dict:
"""
Function created for faster creation of note data.
"""
return {
"t": time,
"d": data,
"l": length
}
def event(time:float, event:str, values:dict) -> dict:
"""
Function created for faster creation of events.
"""
return {
"t": time,
"e": event,
"v": values
}
def focusCamera(time:float, char:bool):
"""
Function created for faster creation of camera change events.
"""
return event(time, "FocusCamera", {"char": "0" if char else "1"})
def toString(val:any) -> str:
"""
Converts any value to a string
"""
if type(val) == str:
return val
return str(val).lower()