diff --git a/SOA.qsp b/SOA.qsp index 11d01b3..4463997 100644 Binary files a/SOA.qsp and b/SOA.qsp differ diff --git a/main.py b/main.py index 2ab5a54..7d0e734 100644 --- a/main.py +++ b/main.py @@ -630,7 +630,7 @@ 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})" @@ -638,10 +638,12 @@ def untranslate_filenames(): 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") @@ -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 "< 0: + if "<]+>>", 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): @@ -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]: @@ -799,4 +822,4 @@ def untranslate_filenames(): else: exit(-69) -untranslate_filenames() +correct_translations() diff --git a/soa.txt b/soa.txt index ccc9bab..0b5e128 100644 Binary files a/soa.txt and b/soa.txt differ diff --git a/translated/big_villa.qsrc b/translated/big_villa.qsrc index 9405eca..e419778 100644 --- a/translated/big_villa.qsrc +++ b/translated/big_villa.qsrc @@ -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' + $pan_leave=''big_villa'' & gt ''angel_event'',''ts_fuck_universal''">Have a drink' end if MGF>0:''else:'' diff --git a/translated/empire_entertainment.qsrc b/translated/empire_entertainment.qsrc index 73dfd2c..1e67594 100644 --- a/translated/empire_entertainment.qsrc +++ b/translated/empire_entertainment.qsrc @@ -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' + $pan_leave=''residential_area'' & gt ''angel_event'',''ts_fuck_universal''">Go to the elevator with her' '' '' @@ -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' + $pan_leave=''empire_group'' & gt ''angel_event'',''ts_fuck_universal''">Go to the bathroom' if hour>=17:'' if $rion_interview!3:'' if $rion_interview=3: - '' + '' '' '' if chain_of_lost_hometown_events=0: