@@ -41,6 +41,17 @@ def get_map_img(map_name: str, mvp_id: str, output_path: Path) -> None:
41
41
)
42
42
43
43
44
+ def get_animated_sprite (mvp_id : str , output_path : Path ) -> None :
45
+ download_img (
46
+ output_path .joinpath ('mvps_icons_animated' , f'{ mvp_id } .png' ),
47
+ f'https://db.irowiki.org/image/monster/{ mvp_id } .png' ,
48
+ f'[{ mvp_id } ] Animated sprite already exists, skipping...' ,
49
+ f'[{ mvp_id } ] Downloading animated mvp icon { mvp_id } .png' ,
50
+ f'[{ mvp_id } ] Completed download animated mvp icon { mvp_id } .png' ,
51
+ f'[{ mvp_id } ] Failed to download animated mvp icon { mvp_id } .png' ,
52
+ )
53
+
54
+
44
55
def get_mvps_id () -> list [str ]:
45
56
print ('Fetching mvps ids from divine pride...' )
46
57
ids = []
@@ -92,6 +103,7 @@ class Extractor:
92
103
def __init__ (self ,
93
104
use_filter : bool = False ,
94
105
no_icons : bool = False ,
106
+ no_animated_sprites : bool = False ,
95
107
no_map_images : bool = False ,
96
108
ignore_mvp_with_empty_maps : bool = False ,
97
109
desired_stats : Optional [list [str ]] = None ,
@@ -101,6 +113,7 @@ def __init__(self,
101
113
) -> None :
102
114
self .use_filter = use_filter
103
115
self .no_icons = no_icons
116
+ self .no_animated_sprites = no_animated_sprites
104
117
self .no_map_images = no_map_images
105
118
self .ignore_mvp_with_empty_maps = ignore_mvp_with_empty_maps
106
119
self .desired_stats = desired_stats
@@ -132,6 +145,9 @@ def get_mvp_data(self, mvp_id: str) -> Optional[dict]:
132
145
if not self .no_icons :
133
146
get_mvp_icon (mvp_id .rstrip ('\n ' ), self .output_path )
134
147
148
+ if not self .no_animated_sprites :
149
+ get_animated_sprite (mvp_id .rstrip ('\n ' ), self .output_path )
150
+
135
151
if not self .no_map_images :
136
152
for map_item in mvp_info ['spawn' ]:
137
153
get_map_img (map_item ['mapname' ], mvp_id , self .output_path )
@@ -142,11 +158,15 @@ def extract(self) -> None:
142
158
try :
143
159
print (f'MVPs will { "not " if not self .use_filter else "" } be filtered.' )
144
160
print (f'MVPs Icons will { "not " if self .no_icons else "" } be downloaded.' )
161
+ print (f'MVPs Animated Sprites will { "not " if self .no_animated_sprites else "" } be downloaded.' )
145
162
print (f'MVPs Maps will { "not " if self .no_map_images else "" } be downloaded.' )
146
163
147
164
if not self .no_icons and not self .output_path .joinpath ('mvps_icons' ).exists ():
148
165
Path .mkdir (self .output_path .joinpath ('mvps_icons' ), parents = True , exist_ok = True )
149
166
167
+ if not self .no_animated_sprites and not self .output_path .joinpath ('mvps_icons_animated' ).exists ():
168
+ Path .mkdir (self .output_path .joinpath ('mvps_icons_animated' ), parents = True , exist_ok = True )
169
+
150
170
if not self .no_map_images and not self .output_path .joinpath ('maps' ).exists ():
151
171
Path .mkdir (self .output_path .joinpath ('maps' ), parents = True , exist_ok = True )
152
172
@@ -169,7 +189,7 @@ def extract(self) -> None:
169
189
except KeyboardInterrupt :
170
190
print ('Aborting...' )
171
191
except Exception as e :
172
- # print(f'{e} | {e.__class__.__name__}')
192
+ print (f'{ e } | { e .__class__ .__name__ } ' )
173
193
exit ()
174
194
175
195
@@ -182,13 +202,15 @@ def start() -> None:
182
202
return print ('Divine pride api not found, aborting...' )
183
203
184
204
no_icons = env .bool ('NO_ICONS' , False )
205
+ no_animated_sprites = env .bool ('NO_ANIMATED_SPRITES' , False )
185
206
no_map_images = env .bool ('NO_MAP_IMAGES' , False )
186
207
ignore_mvp_with_empty_maps = env .bool ('IGNORE_MVP_WITH_EMPTY_MAPS' , False )
187
208
use_filter = env .bool ('USE_FILTER' , False )
188
209
desired_stats = env .list ('DESIRED_STATS' , None )
189
210
output_path = get_output_path ()
190
211
191
- extractor = Extractor (use_filter , no_icons , no_map_images , ignore_mvp_with_empty_maps , desired_stats ,
212
+ extractor = Extractor (use_filter , no_icons , no_animated_sprites , no_map_images ,
213
+ ignore_mvp_with_empty_maps , desired_stats ,
192
214
divine_pride_api_key ,
193
215
output_path = output_path )
194
216
extractor .extract ()
0 commit comments