Skip to content

Commit 73138ab

Browse files
committed
fix zzz unfiltered weapon items
1 parent 338f787 commit 73138ab

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

fetcher.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,23 @@ def fetch_zzz_update():
147147
if name_hash_id == "" or item_id == "":
148148
raise ValueError("Failed to fetch name_hash_id and item_id")
149149
else:
150-
logger.info(f"Successfully fetched name_hash_id: {name_hash_id} and item_id: {item_id} from zzz")
150+
logger.info(f"Successfully fetched name_hash_id: [{name_hash_id}] and item_id: [{item_id}] from zzz")
151151

152152
weapon_config_data = json.loads(httpx.get(target_host + weapon_config_file).text)
153153
key_name = list(weapon_config_data.keys())
154154
if len(key_name) == 1:
155155
weapon_config_data = weapon_config_data[key_name[0]]
156-
logger.info(f"Successfully fetched {len(avatar_config_data) + len(weapon_config_data)} items from zzz")
156+
157+
# filter weapon items
158+
def is_valid_weapon_item(name_hash_value: str):
159+
if name_hash_value.startswith("Bangboo_Name_"):
160+
return True
161+
if name_hash_value.startswith("Item_Weapon_"):
162+
return True
163+
return False
164+
weapon_config_data = list(filter(lambda x: is_valid_weapon_item(x[name_hash_id]), weapon_config_data))
165+
166+
logger.info(f"Successfully fetched {len(avatar_config_data)} avatar items + {len(weapon_config_data)} weapon items from zzz")
157167
chs_dict = json.loads(httpx.get(target_host + "TextMap/TextMapTemplateTb.json").text)
158168
cht_dict = json.loads(httpx.get(target_host + "TextMap/TextMap_CHTTemplateTb.json").text)
159169
de_dict = json.loads(httpx.get(target_host + "TextMap/TextMap_DETemplateTb.json").text)

0 commit comments

Comments
 (0)