support characters with emotions in subfolders
This commit is contained in:
		
							parent
							
								
									f82051aff5
								
							
						
					
					
						commit
						325928064e
					
				
							
								
								
									
										26
									
								
								gameview.py
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								gameview.py
									
									
									
									
									
								
							| @ -255,12 +255,17 @@ class AOCharMovie(QtGui.QLabel): | |||||||
|      |      | ||||||
|     def set_flipped(self, flip): |     def set_flipped(self, flip): | ||||||
|         self.m_flipped = flip |         self.m_flipped = flip | ||||||
|  |          | ||||||
|  |     def test_path(self, paths): | ||||||
|  |         for path in paths: | ||||||
|  |             if exists(path): | ||||||
|  |                 return path | ||||||
|  |         return False | ||||||
|      |      | ||||||
|     def play(self, p_char, p_emote, emote_prefix, scaling = SCALING_AUTO): |     def play(self, p_char, p_emote, emote_prefix, scaling = SCALING_AUTO): | ||||||
|         if p_emote[0] == "/" or p_emote[0] == "/": |         if p_emote[0] == "/" or p_emote[0] == "/": | ||||||
|             p_emote = p_emote[1:] |             p_emote = p_emote[1:] | ||||||
|         elif "../../characters" in p_emote: |         elif "../../characters" in p_emote: | ||||||
|             print p_emote |  | ||||||
|             a = p_emote.split("/") |             a = p_emote.split("/") | ||||||
|             p_char = a[3] |             p_char = a[3] | ||||||
|             emote = a[4] |             emote = a[4] | ||||||
| @ -273,15 +278,16 @@ class AOCharMovie(QtGui.QLabel): | |||||||
|         self.scaling = scaling |         self.scaling = scaling | ||||||
|          |          | ||||||
|         p_char = p_char.lower().decode('utf-8') |         p_char = p_char.lower().decode('utf-8') | ||||||
|          |         p_emote = p_emote.lower() | ||||||
|         original_path = AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".gif" | 
 | ||||||
|  |         original_path = self.test_path([AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".gif", AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".gif"]) | ||||||
|         alt_path = AOpath+"characters/"+p_char+"/"+p_emote+".png" |         alt_path = AOpath+"characters/"+p_char+"/"+p_emote+".png" | ||||||
|         apng_path = AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".apng" |         apng_path = self.test_path([AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".apng", AOpath+"characters/"+p_char+"/"+emote_prefix+"/"+p_emote+".apng"]) | ||||||
|         webp_path = AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".webp" |         webp_path = self.test_path([AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".webp", AOpath+"characters/"+p_char+"/"+emote_prefix+"/"+p_emote+".webp"]) | ||||||
|         placeholder_path = AO2XPpath+"themes/default/placeholder.gif" |         placeholder_path = AO2XPpath+"themes/default/placeholder.gif" | ||||||
|         gif_path = "" |         gif_path = "" | ||||||
|          | 
 | ||||||
|         if exists(apng_path): |         if apng_path: | ||||||
|             gif_path = apng_path |             gif_path = apng_path | ||||||
|             self.use_pillow = 1 |             self.use_pillow = 1 | ||||||
|         else: |         else: | ||||||
| @ -290,7 +296,7 @@ class AOCharMovie(QtGui.QLabel): | |||||||
|                 url = url.replace(" ", "%20") |                 url = url.replace(" ", "%20") | ||||||
|                 thread.start_new_thread(download_thread, (url, apng_path)) |                 thread.start_new_thread(download_thread, (url, apng_path)) | ||||||
| 
 | 
 | ||||||
|             if exists(webp_path): |             if webp_path: | ||||||
|                 gif_path = webp_path |                 gif_path = webp_path | ||||||
|                 self.use_pillow = 2 |                 self.use_pillow = 2 | ||||||
|             else: |             else: | ||||||
| @ -299,7 +305,7 @@ class AOCharMovie(QtGui.QLabel): | |||||||
|                     url = url.replace(" ", "%20") |                     url = url.replace(" ", "%20") | ||||||
|                     thread.start_new_thread(download_thread, (url, webp_path)) |                     thread.start_new_thread(download_thread, (url, webp_path)) | ||||||
| 
 | 
 | ||||||
|                 if exists(original_path): |                 if original_path: | ||||||
|                     gif_path = original_path |                     gif_path = original_path | ||||||
|                     self.use_pillow = 0 |                     self.use_pillow = 0 | ||||||
|                 else: |                 else: | ||||||
| @ -2027,7 +2033,7 @@ class gui(QtGui.QWidget): | |||||||
|         if "looping_sfx" in self.features: # AO 2.8 |         if "looping_sfx" in self.features: # AO 2.8 | ||||||
|             msg += emote[6]+"#" # loop sound? |             msg += emote[6]+"#" # loop sound? | ||||||
|             msg += "%d#" % self.shakebtn.isPressed() # screen shake |             msg += "%d#" % self.shakebtn.isPressed() # screen shake | ||||||
|             emotes_to_check = [emote[1], "(b)"+emote[2], "(a)"+emote[2]] |             emotes_to_check = [emote[1], "(b)"+emote[2], "(b)/"+emote[2], "(a)"+emote[2], "(a)/"+emote[2] ] | ||||||
|             effects_to_check = ["_FrameScreenshake", "_FrameRealization", "_FrameSFX"] |             effects_to_check = ["_FrameScreenshake", "_FrameRealization", "_FrameSFX"] | ||||||
| 
 | 
 | ||||||
|             for f_effect in effects_to_check: |             for f_effect in effects_to_check: | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user