Skip to content

Commit

Permalink
glow env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
qimiko authored Feb 16, 2020
1 parent 8000331 commit e4dff59
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 24 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,33 @@ New releases will only be made if a breaking change is done that will change how
## Usage

### Level Converter
`levelConverter.py <id>`

Converts a level with id `<id>`.
`levelConverter.py <id>`
Converts a level with id `<id>`.
Will also use the following environment variables as settings:
* `DRY` - don't upload level, use to test if a level will reupload well
* `CLUB` - convert clubstep decoration into lined variants, may fix some decoration while breaking gameplay

### Level Downloader
* `DRY` - don't upload level, use to test if a level will reupload well
* `CLUB` - convert clubstep decoration into lined variants, may fix some decoration while breaking gameplay
* `GLOW` - convert 2.1 glow blocks, may break some decoration

`levelDownloader.py <id>`
### Level Downloader

`levelDownloader.py <id>`
Saves a text file named `<level name>.txt`

### Level Util

`levelUtil.py <level file>`

`levelUtil.py <level file>`
Converts a level in text named `<level file.txt>` and saves another file named `<level file>-conv.txt`

### Save Util

`saveUtil.py`

**May be slightly broken**
**Also requires PyInquirer module`
`saveUtil.py`
**May be slightly broken**
**Also requires PyInquirer module**

Put a `CCLocalLevels.dat` in the same directory as `saveUtil.py`.
Does the following actions:
* Exports a level to text file
* Imports a level from text file

* Exports a level to text file
* Imports a level from text file
10 changes: 9 additions & 1 deletion levelConverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ def uploadLevel(levelString: bytes, levelInfo: RobDict) -> int:
try:
mainID = int(sys.argv[1])
except:
print(f"Usage: {sys.argv[0]} <id>\nset env variable DRY to true if you want to skip upload\nset env variable CLUB to true to convert clubstep blocks 1-8")
print(f"""Usage: {sys.argv[0]} <id>\n
set env variable DRY to true to skip upload
set env variable CLUB to true to convert clubstep blocks 1-8
set env variable GLOW to true to convert the full glow blocks""")
sys.exit(os.EX_USAGE)

levelString: LevelString = LevelString(b"")
Expand All @@ -69,6 +72,9 @@ def uploadLevel(levelString: bytes, levelInfo: RobDict) -> int:
if os.getenv("CLUB", False):
print("Clubstep block conversion enabled!\nThis can make some levels impossible!")
levelUtil.convClubstep = True
if os.getenv("GLOW", False):
print("Glow conversion enabled!")
levelUtil.convGlow = True

print("Converting...\n")

Expand All @@ -83,6 +89,8 @@ def uploadLevel(levelString: bytes, levelInfo: RobDict) -> int:

if set(levelUtil.illegalObj).intersection(objCharts.clubstepObjConv):
print("Note: Enabling the CLUB environment variable will convert most of the clubstep blocks, but can make the level impossible!")
if set(levelUtil.illegalObj).intersection(objCharts.glowObj):
print("Note: Enabling the GLOW environment variable will convert most of the full glow blocks!")

if not illegalObjs:
print("All objects converted!")
Expand Down
3 changes: 3 additions & 0 deletions levelUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ def convObjID(string: str) -> str:

if convClubstep: # don't convert clubstep blocks by default
objConversionSheet = {**objConversionSheet, **objCharts.clubstepObjConv}
if convGlow:
objConversionSheet = {**objConversionSheet, **objCharts.glowObj}

parseObj = parseKeyVarArray(string, ',')
try:
Expand All @@ -189,6 +191,7 @@ def convObjID(string: str) -> str:

illegalObj: List[int] = []
convClubstep: bool = False
convGlow: bool = False

def parseKeyVarArray(string: str, splitter: str) -> RobDict:
"""
Expand Down
27 changes: 18 additions & 9 deletions objCharts.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,12 @@
}

"""
[2.1 color id, 1.9 equivalent]
[2.1 obj id, 1.9 equivalent]
"""
objColors: Dict[int, int] = {
1005: 1,
1006: 2,
1007: 5,
1: 3,
2: 4,
3: 6,
4: 7
glowObj: Dict[int, int] = {
1011: 503,
1012: 504,
1013: 505,
}

"""
Expand All @@ -229,6 +225,19 @@
4: 743
}

"""
[2.1 color id, 1.9 equivalent]
"""
objColors: Dict[int, int] = {
1005: 1,
1006: 2,
1007: 5,
1: 3,
2: 4,
3: 6,
4: 7
}

"""
[2.1 color id, 1.9 header equivalent]
"""
Expand Down

0 comments on commit e4dff59

Please sign in to comment.