Skip to content

Commit 5533c2b

Browse files
authored
0.1.2
Fixed: 1. Error with None on material cards. 2. Error with icons, paths switched to large case [PyPi] - https://pypi.org/project/wuwaimagen/
1 parent 112b2ca commit 5533c2b

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "wuwaimagen"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
description = "WuWaImaGen - is a Python module that allows you to generate images for projects based on the game Wuthering Waves"
55
authors = ["DeviantUa <[email protected]>"]
66
license = "MIT"

wuwaimagen/src/components/material.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async def get_items(self):
3535
for key in self.consume:
3636
item = next(filter(lambda x: x["Id"] == int(key), self.ItemInfo), None)
3737
if not item is None:
38-
icon = item.get("Icon").split("Image")[1].lower().split(".")[0]
38+
icon = item.get("Icon").split("Image")[1].split(".")[0]
3939
items[key] = {"id": int(key), "icon": utils.link_icon + icon + ".png", "rarity": item.get("QualityId"), "value": self.consume[key]}
4040

4141
return utils.sort_items(items)
@@ -119,7 +119,10 @@ async def add_skill(
119119
if str(key["SkillLevelGroupId"])[-1:] == "7":
120120
if forte_circuit.min >= key["SkillId"] or forte_circuit.max < key["SkillId"]:
121121
continue
122-
122+
123+
if key["Consume"] is None:
124+
continue
125+
123126
for items_id in key["Consume"]:
124127
if not items_id in self.consume:
125128
self.consume[items_id] = key["Consume"][items_id]
@@ -198,7 +201,7 @@ async def get_weapon(self, config: MaterialWeapon) -> WeaponInfo:
198201
weapon_info = next(filter(lambda x: x["ItemId"] == int(config.id), self.WeaponConf), None)
199202
name = weapon_info.get("WeaponName")
200203

201-
return WeaponInfo(id = weapon_info.get("ItemId"), name = self.MultiText.get(name), rarity= weapon_info.get("QualityId"), icon= utils.WUTHERY_CDN + f"p/GameData/UIResources/common/image/iconweapon/t_iconweapon{weapon_info.get("ItemId")}_ui.png")
204+
return WeaponInfo(id = weapon_info.get("ItemId"), name = self.MultiText.get(name), rarity= weapon_info.get("QualityId"), icon= utils.WUTHERY_CDN + f"p/GameData/UIResources/Common/Image/IconWeapon/T_IconWeapon{weapon_info.get("ItemId")}_UI.png")
202205

203206
async def get_material(
204207
self,

wuwaimagen/src/generator/convene.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ async def create_icons(self, data: RecordCalculator) -> Image.Image:
8686
name = await create_image_with_text(data.name, 40, max_width=388, color=(255, 255, 255, 255))
8787
background.alpha_composite(name, (int(208-name.size[0]/2), int(520-name.size[1]/2)))
8888

89-
return background
89+
return {"icon": background, "rarity": data.qualityLevel}
9090

9191
async def build(self, color: tuple) -> Image.Image:
9292
frame = await files.frame
@@ -100,11 +100,11 @@ async def build(self, color: tuple) -> Image.Image:
100100
position_x = 353
101101
position_y = 69
102102

103-
for _, key in enumerate(self.icon):
103+
for _, key in enumerate(reversed(self.icon)):
104104
if _ in [5,10]:
105105
position_y += 177
106106
position_x = 353
107-
background.alpha_composite(key.resize((115,158)),(position_x,position_y))
107+
background.alpha_composite(key["icon"].resize((115,158)),(position_x,position_y))
108108

109109
position_x += 146
110110

@@ -132,7 +132,7 @@ async def start(self, art: str) -> Image.Image:
132132

133133
self.icon = []
134134
i = 1
135-
for key in self.data.data:
135+
for key in reversed(self.data.data):
136136
if i == 15:
137137
break
138138

wuwaimagen/src/model/convene.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __init__(self, *args, **kwargs):
5151

5252
async def get_icon(self):
5353
if len(str(self.resourceId)) > 5:
54-
icon = WUTHERY_CDN + f"p/GameData/UIResources/common/image/iconweapon/t_iconweapon{self.resourceId}_ui.png"
54+
icon = WUTHERY_CDN + f"d/GameData/UIResources/Common/Image/IconWeapon/T_IconWeapon{self.resourceId}_UI.png"
5555
return RecordIcon(icon = icon, banner = icon)
5656
else:
5757
''' ===== Outdated way =======
@@ -62,7 +62,7 @@ async def get_icon(self):
6262
banner = data.get("Background", "").split(".")[1]
6363
'''
6464

65-
return RecordIcon(icon = WUTHERY_CDN + f"p/GameData/IDFiedResources/Common/Image/IconRoleHead256/{self.resourceId}.png", banner = WUTHERY_CDN + f"p/GameData/IDFiedResources/Common/Image/IconRolePile/{self.resourceId}.png")
65+
return RecordIcon(icon = WUTHERY_CDN + f"d/GameData/IDFiedResources/Common/Image/IconRoleHead256/{self.resourceId}.png", banner = WUTHERY_CDN + f"d/GameData/IDFiedResources/Common/Image/IconRolePile/{self.resourceId}.png")
6666

6767
class Calculator(BaseModel):
6868
info: Info

wuwaimagen/src/tools/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async def auto_link(game_path: str) -> str:
9191
except Exception as e:
9292
raise Exception("An error occurred: {}".format(e))
9393

94-
link_icon = "https://files.wuthery.com/p/GameData/UIResources/common/image"
94+
link_icon = "https://files.wuthery.com/p/GameData/UIResources/Common/Image"
9595

9696
conditions = {
9797
4: [StatBonusForteCircuit, [1,3]],

0 commit comments

Comments
 (0)