|
22 | 22 | # Main
|
23 | 23 |
|
24 | 24 | charts = []
|
| 25 | +characterMap = { |
| 26 | + # 'charactr': 'Name In English' |
| 27 | +} |
25 | 28 | vocalSplitMasterToggle = True
|
26 | 29 |
|
27 | 30 | def folderMake(folder_path):
|
@@ -197,6 +200,10 @@ def convert(psych_mod_folder, result_folder, options):
|
197 | 200 |
|
198 | 201 | converted_char.convert()
|
199 | 202 | converted_char.save()
|
| 203 | + # For THOSE |
| 204 | + fileBasename = converted_char.iconID.replace('icon-', '') |
| 205 | + characterMap[fileBasename] = converted_char.characterName |
| 206 | + logging.info(f'Saved {converted_char.characterName} to character map using their icon id: {fileBasename}.') |
200 | 207 | else:
|
201 | 208 | logging.warn(f'{character} is a directory, or not a json! Skipped')
|
202 | 209 |
|
@@ -225,17 +232,27 @@ def convert(psych_mod_folder, result_folder, options):
|
225 | 232 |
|
226 | 233 | destination = f'{result_folder}/{modFoldername}{bgCharacterAssets}{filename}'
|
227 | 234 | fileCopy(character, destination)
|
228 |
| - # Woah, freeplay icons |
229 |
| - logging.getLogger('PIL').setLevel(logging.INFO) |
230 |
| - with Image.open(character) as img: |
231 |
| - # Get the winning/normal half of icons |
232 |
| - normal_half = img.crop((0, 0, 150, 150)) |
233 |
| - # Scale to 50x50, same size as BF and GF pixel icons |
234 |
| - pixel_img = normal_half.resize((50, 50), Image.Resampling.NEAREST) |
235 |
| - pixel_name = filename[5:-4] + 'pixel' + filename[-4:] |
236 |
| - freeplay_destination = f'{result_folder}/{modFoldername}{freeplayDir}/{pixel_name}' |
237 |
| - pixel_img.save(freeplay_destination) |
238 |
| - logging.info(f'Saving converted freeplay icon to {freeplay_destination}') |
| 235 | + keyForThisIcon = filename.replace('icon-', '').replace('.png', '') |
| 236 | + logging.info('Checking if ' + keyForThisIcon + ' is in the characterMap') |
| 237 | + |
| 238 | + if characterMap.get(keyForThisIcon, None) != None: |
| 239 | + try: |
| 240 | + # Woah, freeplay icons |
| 241 | + logging.getLogger('PIL').setLevel(logging.INFO) |
| 242 | + with Image.open(character) as img: |
| 243 | + # Get the winning/normal half of icons |
| 244 | + normal_half = img.crop((0, 0, 150, 150)) |
| 245 | + # Scale to 50x50, same size as BF and GF pixel icons |
| 246 | + pixel_img = normal_half.resize((50, 50), Image.Resampling.NEAREST) |
| 247 | + |
| 248 | + |
| 249 | + pixel_name = characterMap.get(keyForThisIcon) + 'pixel.png' |
| 250 | + |
| 251 | + freeplay_destination = f'{result_folder}/{modFoldername}{freeplayDir}/{pixel_name}' |
| 252 | + pixel_img.save(freeplay_destination) |
| 253 | + logging.info(f'Saving converted freeplay icon to {freeplay_destination}') |
| 254 | + except Exception as ___exc: |
| 255 | + logging.error(f"Failed to create character {keyForThisIcon}'s freeplay icon: {___exc}") |
239 | 256 | except Exception as e:
|
240 | 257 | logging.error(f'Could not copy asset {character}: {e}')
|
241 | 258 | else:
|
|
0 commit comments