🐛 修复map插件路径问题

This commit is contained in:
zhxy-CN 2022-09-03 20:47:28 +08:00
parent d978793f14
commit a3828debd7
Signed by: zhxycn
GPG Key ID: CC305996B88B3C03

View File

@ -169,10 +169,8 @@ class MapHelper:
icon = await self.download_icon(icon_url)
icon = icon.resize((150, 150))
box_alpha = Image.open(
os.path.join(os.path.dirname(__file__), os.path.pardir,
"resources", "icon", "box_alpha.png")).getchannel("A")
box = Image.open(os.path.join(os.path.dirname(__file__), os.path.pardir, "resources", "icon", "box.png"))
box_alpha = Image.open(f"resources{os.sep}icon{os.sep}box_alpha.png").getchannel("A")
box = Image.open(f"resources{os.sep}icon{os.sep}box.png")
try:
icon_alpha = icon.getchannel("A")
@ -244,11 +242,10 @@ class ResourceMap:
def get_icon_path(self):
# 检查有没有图标,有返回正确图标,没有返回默认图标
icon_path = os.path.join(os.path.dirname(__file__), os.path.pardir,
"resources", "icon", f"{self.resource_id}.png")
icon_path = os.path.join(f"resources{os.sep}icon", f"{self.resource_id}.png")
if os.path.exists(icon_path):
return icon_path
return os.path.join(os.path.dirname(__file__), os.path.pardir, "resources", "icon", "0.png")
return os.path.join(f"resources{os.sep}icon{os.sep}0.png")
def get_resource_point_list(self):
temp_list = []
@ -307,4 +304,4 @@ class ResourceMap:
self.map_image.save(f'cache{os.sep}map.jpg', format='JPEG')
def get_resource_count(self):
return len(self.resource_xy_list)
return len(self.resource_xy_list)