-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #576 from Wolfy76700:game/kerrr3
Added assets for Koihime Enbu RyoRaiRai Version 3
- Loading branch information
Showing
39 changed files
with
365 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"name": "Koihime Enbu RyoRaiRai Version 3", | ||
"smashgg_game_id": 22404, | ||
"challonge_game_id": null, | ||
"character_to_codename": { | ||
"Bachō Mōki": { | ||
"codename": "Bacho" | ||
}, | ||
"Chō'un Shiryū": { | ||
"codename": "Choun" | ||
}, | ||
"Chōhi Yokutoku": { | ||
"codename": "Chochi" | ||
}, | ||
"Chōryō Bun'en": { | ||
"codename": "Choryo" | ||
}, | ||
"Gakushin Bunken": { | ||
"codename": "Gakushin" | ||
}, | ||
"Jokō Kōmei": { | ||
"codename": "Joko" | ||
}, | ||
"Kakōton Genjō": { | ||
"codename": "Kakoton" | ||
}, | ||
"Kakōen Myōsai": { | ||
"codename": "Kakoen" | ||
}, | ||
"Kan'u Unchō": { | ||
"codename": "Kanu" | ||
}, | ||
"Kannei Kōha": { | ||
"codename": "Kannei" | ||
}, | ||
"Sonken Kōyū": { | ||
"codename": "Kouyū" | ||
}, | ||
"Ryofu Hōsen": { | ||
"codename": "Ryofu" | ||
}, | ||
"Shūtai Yōhei": { | ||
"codename": "Shutai" | ||
}, | ||
"Sonken Chūbō": { | ||
"codename": "Sonken" | ||
}, | ||
"Sonshōkō": { | ||
"codename": "Sonshoko" | ||
}, | ||
"Sōsō Mōtoku": { | ||
"codename": "Soso" | ||
} | ||
}, | ||
"stage_to_codename": {}, | ||
"version": "1.0", | ||
"description": "Base config to use this game.", | ||
"credits": "Assets ripped from Mizuumi Wiki (https://wiki.gbl.gg/w/Koihime_Enbu/RyoRaiRai_V3)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"prefix": "icon_", | ||
"postfix": "_", | ||
"type": [ | ||
"icon" | ||
], | ||
"version": "1.0" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
{ | ||
"name": "Portraits", | ||
"description": "Character portraits", | ||
"prefix": "full_", | ||
"postfix": "_", | ||
"type": [ | ||
"full" | ||
], | ||
"credits": "Assets ripped from Mizuumi Wiki (https://wiki.gbl.gg/w/Koihime_Enbu/RyoRaiRai_V3)", | ||
"version": "1.0", | ||
"eyesights": { | ||
"Bacho": { | ||
"0": { | ||
"x": 306, | ||
"y": 290 | ||
} | ||
}, | ||
"Chochi": { | ||
"0": { | ||
"x": 856, | ||
"y": 427 | ||
} | ||
}, | ||
"Choryo": { | ||
"0": { | ||
"x": 929, | ||
"y": 194 | ||
} | ||
}, | ||
"Choun": { | ||
"0": { | ||
"x": 529, | ||
"y": 263 | ||
} | ||
}, | ||
"Gakushin": { | ||
"0": { | ||
"x": 387, | ||
"y": 149 | ||
} | ||
}, | ||
"Joko": { | ||
"0": { | ||
"x": 256, | ||
"y": 178 | ||
} | ||
}, | ||
"Kakoen": { | ||
"0": { | ||
"x": 577, | ||
"y": 515 | ||
} | ||
}, | ||
"Kakoton": { | ||
"0": { | ||
"x": 528, | ||
"y": 310 | ||
} | ||
}, | ||
"Kannei": { | ||
"0": { | ||
"x": 412, | ||
"y": 206 | ||
} | ||
}, | ||
"Kanu": { | ||
"0": { | ||
"x": 451, | ||
"y": 361 | ||
} | ||
}, | ||
"Kouy\u016b": { | ||
"0": { | ||
"x": 507, | ||
"y": 162 | ||
} | ||
}, | ||
"Ryofu": { | ||
"0": { | ||
"x": 695, | ||
"y": 467 | ||
} | ||
}, | ||
"Shutai": { | ||
"0": { | ||
"x": 526, | ||
"y": 248 | ||
} | ||
}, | ||
"Sonken": { | ||
"0": { | ||
"x": 570, | ||
"y": 190 | ||
} | ||
}, | ||
"Sonshoko": { | ||
"0": { | ||
"x": 622, | ||
"y": 271 | ||
} | ||
}, | ||
"Soso": { | ||
"0": { | ||
"x": 519, | ||
"y": 217 | ||
} | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
183 changes: 183 additions & 0 deletions
183
utilities/get_icons_from_mizuumi/get_icons_from_mizuumi_koihime.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
import requests | ||
from bs4 import BeautifulSoup as BS | ||
import json | ||
from pathlib import Path | ||
from unidecode import unidecode | ||
|
||
base_url = "https://wiki.gbl.gg/w/Koihime_Enbu/RyoRaiRai_V3/Chouhi_Yokutoku" | ||
|
||
mizuumi_page = requests.get(base_url) | ||
mizuumi_content = mizuumi_page.text | ||
mizuumi_soup = BS(mizuumi_content, features="html.parser") | ||
|
||
parse_tables = mizuumi_soup.findAll('tr') | ||
for tag in parse_tables: | ||
if "Characters" in str(tag): | ||
character_icons_table = tag.findAll( | ||
'span', {'style': f'text-align:center; float:left; overflow:hidden; margin-left:1px; margin-right:1px; font-size:1.0'}) | ||
|
||
game_id = 22404 | ||
|
||
download_folder_name = "../download_smashgg/download" | ||
base_files_folder_name = f"{download_folder_name}/base_files" | ||
portraits_folder_name = f"{download_folder_name}/full" | ||
icon_folder_name = f"{base_files_folder_name}/icon" | ||
for folder_name in (download_folder_name, base_files_folder_name, portraits_folder_name, icon_folder_name): | ||
Path(folder_name).mkdir(parents=True, exist_ok=True) | ||
|
||
|
||
def get_icon_from_character_name(character_name): | ||
list_img_tags = mizuumi_soup.findAll('img') | ||
for tag in list_img_tags: | ||
try: | ||
alt_text = tag["alt"] | ||
except: | ||
alt_text = None | ||
if (character_name in alt_text) and ("Icon" in tag["src"]): | ||
smol = f'https://wiki.gbl.gg{tag["src"]}' | ||
beeg = "/".join(smol.replace("/thumb", "").split("/")[:-1]) | ||
return(beeg) | ||
|
||
|
||
def get_portrait(character_name, page_link): | ||
character_page = requests.get(page_link) | ||
character_page_soup = BS(character_page.text, features="html.parser") | ||
character_page_links_tag_list = character_page_soup.findAll('a', href=True) | ||
portrait_wiki_link = None | ||
for tag in character_page_links_tag_list: | ||
link = tag["href"] | ||
if ("_Profile" in link) and ("File:Koihime" in link): | ||
portrait_wiki_link = link | ||
if portrait_wiki_link: | ||
portrait_wiki_page = requests.get( | ||
f"https://wiki.gbl.gg{portrait_wiki_link}") | ||
portrait_wiki_soup = BS(portrait_wiki_page.text, features="html.parser") | ||
portrait_page_links_tag_list = portrait_wiki_soup.findAll('a', href=True) | ||
# print(portrait_page_links_tag_list) | ||
for tag in portrait_page_links_tag_list: | ||
text = tag.get_text() | ||
link = tag["href"] | ||
if ("Original file" in text or "_Profile.png" in text) and "_Profile" in link: | ||
break | ||
return(f"https://wiki.gbl.gg{link}") | ||
else: | ||
return(None) | ||
|
||
|
||
def get_all_links(): | ||
list_characters = [] | ||
list_characters_page = [] | ||
|
||
for character_tag in character_icons_table: | ||
href_tags = character_tag.findAll('a', href=True) | ||
for href_tag in href_tags: | ||
if "Fate Unlimited Codes" not in href_tag["title"]: | ||
list_characters_page.append(f'https://wiki.gbl.gg{href_tag["href"]}') | ||
list_characters.append(href_tag.text) | ||
|
||
character_dict = {} | ||
|
||
for i in range(len(list_characters)): | ||
# icon_link = get_icon_from_character_name( | ||
# list_characters[i].encode("ascii", "ignore").decode()) | ||
icon_link = None | ||
portrait_link = get_portrait( | ||
list_characters[i], list_characters_page[i]) | ||
print(list_characters[i], portrait_link) | ||
character_dict[list_characters[i]] = { | ||
"codename": unidecode(list_characters[i]).replace(' ', '').replace('&', '').replace('.', '').replace('(', '').replace(')', '').replace('-', '').replace("'", ''), | ||
"portrait_url": portrait_link, | ||
"icon_url": icon_link | ||
} | ||
|
||
return(character_dict) | ||
|
||
|
||
def generate_configs(character_dict): | ||
with open(f"../download_smashgg/game_data.json", 'rt') as game_data_file: | ||
game_data = json.loads(game_data_file.read()) | ||
found = False | ||
for game in game_data: | ||
if game.get("smashgg_id") == game_id: | ||
game_name = game.get("name") | ||
image_type = game.get("image_type") | ||
challonge_id = game.get("challonge_id") | ||
found = True | ||
|
||
if not found: | ||
print("Game not found") | ||
exit(1) | ||
|
||
description = "Base config to use this game." | ||
credits = 'Assets ripped from Mizuumi Wiki (https://wiki.gbl.gg/w/Koihime_Enbu/RyoRaiRai_V3)' | ||
version = "1.0" | ||
|
||
config_dict: dict = { | ||
"name": str(game_name), | ||
"smashgg_game_id": game_id, | ||
"challonge_game_id": challonge_id, | ||
"character_to_codename": {}, | ||
"stage_to_codename": {}, | ||
"version": version, | ||
"description": str(description), | ||
"credits": str(credits) | ||
} | ||
|
||
icon_config_dict = { | ||
"prefix": "icon_", | ||
"postfix": "_", | ||
"type": ["icon"], | ||
"version": version | ||
} | ||
|
||
portrait_config_dict = { | ||
"name": "Portraits", | ||
"description": "Character portraits", | ||
"prefix": "full_", | ||
"postfix": "_", | ||
"type": ["full"], | ||
"credits": str(credits), | ||
"version": "1.0" | ||
} | ||
|
||
for character_name in character_dict.keys(): | ||
config_dict["character_to_codename"][character_name] = { | ||
"codename": character_dict.get(character_name).get("codename") | ||
} | ||
|
||
with open(f"{base_files_folder_name}/config.json", 'wt') as main_config_file: | ||
config_file_content = json.dumps(config_dict, indent=2) | ||
main_config_file.write(config_file_content) | ||
|
||
with open(f"{icon_folder_name}/config.json", 'wt') as icon_config_file: | ||
icon_config_file_content = json.dumps(icon_config_dict, indent=2) | ||
icon_config_file.write(icon_config_file_content) | ||
|
||
with open(f"{portraits_folder_name}/config.json", 'wt') as portrait_config_file: | ||
portrait_config_file_content = json.dumps( | ||
portrait_config_dict, indent=2) | ||
portrait_config_file.write(portrait_config_file_content) | ||
|
||
return config_dict, icon_config_dict, portrait_config_dict | ||
|
||
|
||
def download_all_images(character_dict: dict, icon_config_dict, portrait_config_dict): | ||
for character_name in character_dict.keys(): | ||
character_data = character_dict.get(character_name) | ||
icon_filename = f'{icon_folder_name}/{icon_config_dict.get("prefix")}{character_data.get("codename")}{icon_config_dict.get("postfix")}0.png' | ||
portrait_filename = f'{portraits_folder_name}/{portrait_config_dict.get("prefix")}{character_data.get("codename")}{portrait_config_dict.get("postfix")}0.png' | ||
|
||
if character_data.get("icon_url"): | ||
with open(icon_filename, 'wb') as f: | ||
icon_file = requests.get(character_data.get("icon_url")) | ||
f.write(icon_file.content) | ||
if character_data.get("portrait_url"): | ||
with open(portrait_filename, 'wb') as f: | ||
portrait_file = requests.get(character_data.get("portrait_url")) | ||
f.write(portrait_file.content) | ||
|
||
|
||
character_dict = get_all_links() | ||
# print(json.dumps(character_dict, indent=2)) | ||
main_config_dict, icon_config_dict, portrait_config_dict = generate_configs(character_dict) | ||
download_all_images(character_dict, icon_config_dict, portrait_config_dict) |