Skip to content

Commit

Permalink
fixing location reference misstranslations
Browse files Browse the repository at this point in the history
  • Loading branch information
f95Lok committed Nov 12, 2023
1 parent b88c75a commit 561b3a4
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 21 deletions.
Binary file modified SOA.qsp
Binary file not shown.
57 changes: 40 additions & 17 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,18 +630,20 @@ def find_key_by_value(value, data_type):
return value


def untranslate_filenames():
def correct_translations():
regex_find_embedded_filenames = r"(?<=images)[/\\].*<<[^>]+>>"
regex_find_variable_assignment_beg = r"(?:^|(?<=\s|:|&))"
regex_find_variable_assignment_end = r"\s*[!=+\-*/<>]{1,2}\s*(?:'{1,2}[^']+'{1,2}|\"{1,2}[^\"]+\"{1,2})"
regex_find_event_start = r"if\s\$*(?:args|ARGS)\[0]\s*=\s*(?:'{1,2}[^']+'{1,2}|\"{1,2}[^\"]+\"{1,2}):"
regex_find_event_call_beg = r"(?:gt|gs)\s*(?:'{1,2}|\"{1,2})"
regex_find_event_call_mid = r"(?:'{1,2}|\"{1,2}),\s*(?:'{1,2}|\"{1,2})"
regex_find_event_call_end = r"(?:'{1,2}|\"{1,2})(?:,\s*(?:'{1,2}|\"{1,2})[^'\"]+(?:'{1,2}|\"{1,2}))"
regex_find_location_references = r"(?:gs|gt)\s*(?:'|\"){1,2}<<[^<>]+>>(?:'|\"){1,2}"

files = {}
filename_variables = []
filename_arguments = []
location_references = []

for file in os.listdir("translated/"):
file_reference = io.open("translated/" + file, 'r', encoding="utf-8")
Expand All @@ -653,23 +655,30 @@ def untranslate_filenames():
while i < len(files[file]):
line = files[file][i]
matches = re.findall(regex_find_embedded_filenames, line)
variables = []
for match in matches:
variables = re.findall(regex_embedded_variable, match)
while len(variables) > 0:
if "<<RAND" in variables[0] or "<<rand" in variables[0]:
variables.pop(0)
variables.extend(re.findall(regex_embedded_variable, match))

while len(variables) > 0:
if "<<RAND" in variables[0] or "<<rand" in variables[0]:
variables.pop(0)
else:
variables[0] = variables[0][2:-2].strip()
if ".name" in variables[0]:
filename_reference = re.search(r"images[/\\].*<<[^>]+>>", line).group(0)
new_line = files[file].pop(i).replace(filename_reference, filename_reference.replace(variables[0], variables[0].replace(".name", ".filename")))
files[file].insert(i, new_line)
if "args" in variables[0] or "ARGS" in variables[0]:
filename_arguments.append((file, i, variables.pop(0)))
elif variables[0] not in filename_variables:
filename_variables.append(variables.pop(0))
else:
variables[0] = variables[0][2:-2].strip()
if ".name" in variables[0]:
filename_reference = re.search(r"images[/\\].*<<[^>]+>>", line).group(0)
new_line = files[file].pop(i).replace(filename_reference, filename_reference.replace(variables[0], variables[0].replace(".name", ".filename")))
files[file].insert(i, new_line)
if "args" in variables[0] or "ARGS" in variables[0]:
filename_arguments.append((file, i, variables.pop(0)))
elif variables[0] not in filename_variables:
filename_variables.append(variables.pop(0))
else:
variables.pop(0)
variables.pop(0)

matches = re.findall(regex_find_location_references, line)
for match in matches:
location_references.append(re.findall(regex_embedded_variable, match)[0][2:-2].strip())

i += 1

for k, variable in zip(range(len(filename_variables)), filename_variables):
Expand Down Expand Up @@ -757,6 +766,20 @@ def untranslate_filenames():
new_line = files[location].pop(index).replace(argument, "$filename_reference")
files[location].insert(index, new_line)

for k, variable in zip(range(len(location_references)), location_references):
print("[" + str(k + 1) + "/" + str(len(location_references)) + "] Fixing location references: " + variable)
for file in files:
i = 0
while i < len(files[file]):
line = files[file][i]
matches = re.findall(regex_find_variable_assignment_beg + variable.replace("$", "\\$").replace(".", "\.") + regex_find_variable_assignment_end, line)
for match in matches:
string = extract_from_string(match)[0]
original = find_key_by_value(string, _text_)
new_line = files[file].pop(i).replace(match, match.replace(string, xml[_locations_][original]))
files[file].insert(i, new_line)
i += 1

for file in files:
file_reference = io.open("translated/"+file, 'w', encoding="utf-8")
for line in files[file]:
Expand Down Expand Up @@ -799,4 +822,4 @@ def untranslate_filenames():
else:
exit(-69)

untranslate_filenames()
correct_translations()
Binary file modified soa.txt
Binary file not shown.
2 changes: 1 addition & 1 deletion translated/big_villa.qsrc
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ if $args[0] ='angel_room':
$general_selection_9=''Back position'' & $general_selection_10=''Accelerate thrusting'' & $general_selection_11=''Bukkake'' & $general_selection_12=''Lick clean'' &
$pan_dialogue_1=''After drinking before going to bed, you still need a high-quality sex to help you sleep!'' & $pan_dialogue_2=''Don`t be fainted by me.''& $pan_dialogue_3=''Come on, then fuck me out, you`re amazing❤''&
$pan_dialogue_4=''So cool ❤ You are awesome, dear❤''& $pan_dialogue_5=''You too ❤''&
$pan_leave=''Big_villa'' & gt ''angel_event'',''ts_fuck_universal''">Have a drink</a></div>'
$pan_leave=''big_villa'' & gt ''angel_event'',''ts_fuck_universal''">Have a drink</a></div>'
end

if MGF>0:'<div class="buttonS"><a href="exec:MGF-=1 & gt ''angel_event'',''ts_fuck_strong_medicine''">Use McGovern</a></div>'else:'<div class="buttonGr"><a href="exec:">Lack of McGovern</a></div>'
Expand Down
4 changes: 2 additions & 2 deletions translated/empire_entertainment.qsrc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if $args[0]="":
$general_selection_5=''Oral sex'' & $general_selection_6=''Hurry up'' & $general_selection_7=''Ejaculation'' & $general_selection_8=''dialogue'' &
$pan_dialogue_1=''We will go directly to the highest level of the empire in a while. As my adjutant, you can`t drop the chain.'' & $pan_dialogue_2=''I`m still a little nervous when you say that''& $pan_dialogue_3=''If you are nervous, I will relax for you, and there is plenty of time to rise!''&
$pan_dialogue_4=''How`s it going... no pressure, right?''& $pan_dialogue_5=''More pressure…''&
$pan_leave=''Residential area'' & gt ''angel_event'',''ts_fuck_universal''">Go to the elevator with her</a></div>'
$pan_leave=''residential_area'' & gt ''angel_event'',''ts_fuck_universal''">Go to the elevator with her</a></div>'

'<div class="button"><a href="exec:minutes+=15 & gt ''empire_entertainment''">Kill time</a></div>'
'</div>'
Expand Down Expand Up @@ -516,7 +516,7 @@ if $args[0]="recording_studio":
$general_selection_5=''Hold the whole root'' & $general_selection_6=''Enjoy oral sex'' & $general_selection_7=''Shoot her in the mouth'' & $general_selection_8=''Lick clean'' &
$pan_dialogue_1=''What`s happened?Won`t you talk to them more?They are all excellent music producers…'' & $pan_dialogue_2=''They are too noisy…''& $pan_dialogue_3=''Is it too quiet here?The quieter the place, the more restless it will be❤''&
$pan_dialogue_4=''Okay, let`s go back together after being comfortable❤''& $pan_dialogue_5=''If they go back together, they will doubt it, right?''&
$pan_leave=''Empire Group'' & gt ''angel_event'',''ts_fuck_universal''">Go to the bathroom</a></div>'
$pan_leave=''empire_group'' & gt ''angel_event'',''ts_fuck_universal''">Go to the bathroom</a></div>'

if hour>=17:'<div class="buttonPu4"><a href="exec:$universal_location=''录音2'' & fxnum=12 &
$general_selection_1=''Drink and lie on them'' & $general_selection_2=''dialogue'' & $general_selection_3=''kiss'' & $general_selection_4=''Lick'' &
Expand Down
2 changes: 1 addition & 1 deletion translated/immigration_administration.qsrc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if $ARGS[0]="":
if $rion_interview!3:'<div class="button"><a href="exec: gt ''immigration_administration'',''audit_requirements''">Ask for review requirements</a></div>'
if $rion_interview!3:'<div class="button"><a href="exec: gt ''immigration_administration'',''interview''">Interview auditor</a></div>'
if $rion_interview=3:
'<div class="buttonR1"><a href="exec:$chat=''RION''& $where_to_go_out = ''City hall'' & addlove=0 &addbad=0 & gt ''universal_chat''">interaction</a></div>'
'<div class="buttonR1"><a href="exec:$chat=''RION''& $where_to_go_out = ''city_hall'' & addlove=0 &addbad=0 & gt ''universal_chat''">interaction</a></div>'
'<div class="buttonR2"><a href="exec: gt ''rion_event'',''rion_event_observation''">Observation review</a></div>'
'<div class="buttonR3"><a href="exec: gt ''second_generation_project_event'',''edm_fuck_threat''">Unconventional audit</a></div>'
if chain_of_lost_hometown_events=0:
Expand Down

0 comments on commit 561b3a4

Please sign in to comment.