Skip to content

Commit

Permalink
Extract field bash and effect apply text (#72745)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uwuewsky authored Apr 9, 2024
1 parent cc6ca5d commit 7e7089f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion data/json/effects.json
Original file line number Diff line number Diff line change
Expand Up @@ -1958,7 +1958,7 @@
],
"apply_message": [
[ "Your eyes are mildly irritated.", "bad" ],
[ "Your eyes watering out of smoke.", "bad" ],
[ "Your eyes are watering.", "bad" ],
[ "Your eyes sting badly and tears stream from them continuously.", "bad" ],
[
"You can barely see anything due to your massive eye irritation and the flood of tears streaming from them.",
Expand Down
12 changes: 9 additions & 3 deletions lang/string_extractor/parsers/effect_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ def parse_effect_type(json, origin):
.format(effect_name))

if "apply_message" in json:
write_text(json["apply_message"], origin,
comment="Apply message of effect type \"{}\""
.format(effect_name))
if type(json["apply_message"]) is list:
for msg in json["apply_message"]:
write_text(msg[0], origin,
comment="Apply message of effect type \"{}\""
.format(effect_name))
elif type(json["apply_message"]) is str:
write_text(json["apply_message"], origin,
comment="Apply message of effect type \"{}\""
.format(effect_name))

if "remove_message" in json:
write_text(json["remove_message"], origin,
Expand Down
9 changes: 9 additions & 0 deletions lang/string_extractor/parsers/field_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@


def parse_field_type(json, origin):
field_names = []

for fd in json.get("intensity_levels", []):
if "name" in fd:
write_text(fd["name"], origin, comment="Field intensity level")
id_or_name = fd["name"]
else:
id_or_name = json["id"]
field_names.append(id_or_name)
for eff in fd.get("effects", []):
if "message" in eff:
write_text(eff["message"], origin,
Expand All @@ -20,3 +23,9 @@ def parse_field_type(json, origin):
if "npc_complain" in json:
write_text(json["npc_complain"]["speech"], origin,
comment="Field NPC complaint")

if "bash" in json:
if "msg_success" in json["bash"]:
write_text(json["bash"]["msg_success"], origin,
comment="Bashing message of fields {}"
.format(", ".join(f"\"{n}\"" for n in field_names)))

0 comments on commit 7e7089f

Please sign in to comment.