Couple of fixes to rpgm
This commit is contained in:
parent
6fc68e8565
commit
5fb0191b17
3 changed files with 173 additions and 86 deletions
|
|
@ -38,6 +38,7 @@ ESTIMATE = ""
|
|||
TOKENS = [0, 0]
|
||||
NAMESLIST = []
|
||||
FIRSTLINESPEAKERS = False # If 1st line of dialogue is a speaker, set to True
|
||||
FACENAME101 = False # Find Speakers in 101 Codes based on Face Name
|
||||
NAMES = False # Output a list of all the character names found
|
||||
BRFLAG = False # If the game uses <br> instead
|
||||
FIXTEXTWRAP = True # Overwrites textwrap
|
||||
|
|
@ -580,6 +581,14 @@ def searchNames(data, pbar, context):
|
|||
tokensResponse = translateNote(data[i], r"<MapText:(.*?)>")
|
||||
totalTokens[0] += tokensResponse[0]
|
||||
totalTokens[1] += tokensResponse[1]
|
||||
if "<WATs:" in data[i]["note"]:
|
||||
tokensResponse = translateNote(data[i], r"WATs:(.+?)>")
|
||||
totalTokens[0] += tokensResponse[0]
|
||||
totalTokens[1] += tokensResponse[1]
|
||||
if "<ADT:" in data[i]["note"]:
|
||||
tokensResponse = translateNote(data[i], r"ADTs?:(.+?)>")
|
||||
totalTokens[0] += tokensResponse[0]
|
||||
totalTokens[1] += tokensResponse[1]
|
||||
|
||||
i += 1
|
||||
else:
|
||||
|
|
@ -620,6 +629,16 @@ def searchNames(data, pbar, context):
|
|||
else:
|
||||
number += 1
|
||||
|
||||
# Notes
|
||||
if "<WAT:" in data[i]["note"]:
|
||||
tokensResponse = translateNote(data[i], r"WATs:(.+?)>")
|
||||
totalTokens[0] += tokensResponse[0]
|
||||
totalTokens[1] += tokensResponse[1]
|
||||
if "<ADT:" in data[i]["note"]:
|
||||
tokensResponse = translateNote(data[i], r"ADTs?:(.+?)>")
|
||||
totalTokens[0] += tokensResponse[0]
|
||||
totalTokens[1] += tokensResponse[1]
|
||||
|
||||
i += 1
|
||||
else:
|
||||
batchFull = True
|
||||
|
|
@ -1364,8 +1383,67 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
codeList[i]["parameters"][3][argVar] = translatedText
|
||||
pbar.update(1)
|
||||
|
||||
if "TextPicture" in headerString or "BalloonInBattle" in headerString:
|
||||
argVar = "text"
|
||||
# if "TextPicture" in headerString or "BalloonInBattle" in headerString:
|
||||
# argVar = "text"
|
||||
# font = None
|
||||
# ### Message Text First
|
||||
# if argVar in codeList[i]["parameters"][3]:
|
||||
# acExist = False
|
||||
# jaString = codeList[i]["parameters"][3][argVar]
|
||||
|
||||
# # Check ac
|
||||
# if "\\ac" in jaString:
|
||||
# acExist = True
|
||||
# else:
|
||||
# acExist = False
|
||||
|
||||
# # If there isn't any Japanese in the text just skip
|
||||
# # if not re.search(r'[一-龠]+|[ぁ-ゔ]+|[ァ-ヴー]+', jaString):
|
||||
# # i += 1
|
||||
# # continue
|
||||
|
||||
# # Remove any textwrap & TL
|
||||
# if '[Lewd Power' in jaString:
|
||||
# jaString = re.sub(r"\n", " ", jaString)
|
||||
# if acExist:
|
||||
# jaString = jaString.replace("\\ac ", " ")
|
||||
# jaString = jaString.replace("\\ac", "")
|
||||
|
||||
# # Pass 1
|
||||
# if setData == False:
|
||||
# list357.append(jaString)
|
||||
|
||||
# # Pass 2
|
||||
# else:
|
||||
# if len(list357) > 0:
|
||||
# # Grab and Replace
|
||||
# translatedText = list357[0]
|
||||
# translatedText = jaString.replace(jaString, translatedText)
|
||||
|
||||
# # Remove characters that may break scripts
|
||||
# charList = ['"', "\\n"]
|
||||
# for char in charList:
|
||||
# translatedText = translatedText.replace(char, "")
|
||||
|
||||
# # Textwrap
|
||||
# if '[Lewd Power' in jaString:
|
||||
# translatedText = textwrap.fill(translatedText, 50)
|
||||
|
||||
# # Center Text
|
||||
# if acExist:
|
||||
# translatedText = f'\\ac {translatedText.replace('\n', '\n\\ac ')}'
|
||||
|
||||
# # Check and Set Font
|
||||
# if "fontSize" in codeList[i]["parameters"][3]:
|
||||
# if font:
|
||||
# codeList[i]["parameters"][3]["fontSize"] = font
|
||||
|
||||
# # Set
|
||||
# codeList[i]["parameters"][3][argVar] = translatedText
|
||||
# list357.pop(0)
|
||||
|
||||
if "QuestSystem" in headerString:
|
||||
argVar = "DetailNote"
|
||||
font = None
|
||||
### Message Text First
|
||||
if argVar in codeList[i]["parameters"][3]:
|
||||
|
|
@ -1384,7 +1462,7 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
# continue
|
||||
|
||||
# Remove any textwrap & TL
|
||||
jaString = re.sub(r"\n", " ", jaString)
|
||||
jaString = jaString.replace('\\n', ' ')
|
||||
if acExist:
|
||||
jaString = jaString.replace("\\ac ", " ")
|
||||
jaString = jaString.replace("\\ac", "")
|
||||
|
|
@ -1406,8 +1484,9 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
translatedText = translatedText.replace(char, "")
|
||||
|
||||
# Textwrap
|
||||
translatedText = textwrap.fill(translatedText, WIDTH)
|
||||
translatedText = translatedText.replace("- ", "-")
|
||||
translatedText = textwrap.fill(translatedText, 80)
|
||||
translatedText = translatedText.replace('\n', '\\n')
|
||||
translatedText = re.sub(r"[\\]+c", r"\\\\c", translatedText)
|
||||
|
||||
# Center Text
|
||||
if acExist:
|
||||
|
|
@ -1419,7 +1498,7 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
codeList[i]["parameters"][3]["fontSize"] = font
|
||||
|
||||
# Set
|
||||
codeList[i]["parameters"][3][argVar] = translatedText
|
||||
codeList[i]["parameters"][3][argVar] = f"\"{translatedText}\""
|
||||
list357.pop(0)
|
||||
|
||||
## Event Code: 657 [Picture Text] [Optional]
|
||||
|
|
@ -1522,7 +1601,7 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
continue
|
||||
|
||||
# Get Speaker
|
||||
if "\\" not in jaString:
|
||||
if "\\" not in jaString and jaString:
|
||||
response = getSpeaker(jaString)
|
||||
totalTokens[0] += response[1][0]
|
||||
totalTokens[1] += response[1][1]
|
||||
|
|
@ -1541,11 +1620,33 @@ def searchCodes(page, pbar, jobList, filename):
|
|||
continue
|
||||
else:
|
||||
speaker = ""
|
||||
elif FACENAME101:
|
||||
faceName = codeList[i]["parameters"][0]
|
||||
if faceName == "Actor1_1":
|
||||
speaker = "Sakura"
|
||||
if faceName == "Actor2_1":
|
||||
speaker = "Suzune"
|
||||
if faceName == "Actor3_1":
|
||||
speaker = "Kaji"
|
||||
if faceName == "Actor4_1":
|
||||
speaker = "Kirari"
|
||||
if faceName == "Actor5_1":
|
||||
speaker = "Onsen"
|
||||
if faceName == "Actor6_1":
|
||||
speaker = "Gufu"
|
||||
if faceName == "Actor7_1":
|
||||
speaker = "Kahimeru"
|
||||
if faceName == "Actor10_1":
|
||||
speaker = "Miuma"
|
||||
if faceName == "Actor11_1":
|
||||
speaker = "Nurari"
|
||||
if faceName == "Actor12_1":
|
||||
speaker = "Kokotsuzumi"
|
||||
|
||||
## Event Code: 355 or 655 Scripts [Optional]
|
||||
if "code" in codeList[i] and (codeList[i]["code"] == 355 or codeList[i]["code"] == 655) and CODE355655 is True:
|
||||
jaString = codeList[i]["parameters"][0]
|
||||
regexPatterns = [r'.*subject=(.*?)"', r"テキスト-(.*)"]
|
||||
regexPatterns = [r'const.+=\s?\"(.+?)\"']
|
||||
|
||||
# Iterate over the list of regex patterns
|
||||
for regex in regexPatterns:
|
||||
|
|
|
|||
|
|
@ -194,39 +194,40 @@ def translatePlugin(data, pbar, filename, translatedList):
|
|||
newline = r"\n"
|
||||
|
||||
# Custom
|
||||
regex = r'hint:\s"(.*)"'
|
||||
match = re.search(regex, data[i])
|
||||
if match:
|
||||
# Save Original String
|
||||
jaString = match.group(1)
|
||||
originalString = jaString
|
||||
regex = r'{.+?"Text[\\]+":[\\]+"[\\]+}[\\]*(.+?)[\\]'
|
||||
matchList = re.findall(regex, data[i])
|
||||
if len(matchList) > 0:
|
||||
for match in matchList:
|
||||
# Save Original String
|
||||
jaString = match
|
||||
originalString = jaString
|
||||
|
||||
# Remove any textwrap
|
||||
jaString = jaString.replace(newline, " ")
|
||||
# Remove any textwrap
|
||||
jaString = jaString.replace(newline, " ")
|
||||
|
||||
# Pass 1
|
||||
if setData == False:
|
||||
custom.append(jaString.strip())
|
||||
# Pass 1
|
||||
if setData == False:
|
||||
custom.append(jaString.strip())
|
||||
|
||||
# Pass 2
|
||||
else:
|
||||
if custom:
|
||||
# Grab and Pop
|
||||
translatedText = custom[0]
|
||||
custom.pop(0)
|
||||
# Pass 2
|
||||
else:
|
||||
if custom:
|
||||
# Grab and Pop
|
||||
translatedText = custom[0]
|
||||
custom.pop(0)
|
||||
|
||||
# Set to None if empty list
|
||||
if len(translatedList) <= 0:
|
||||
translatedList = None
|
||||
# Set to None if empty list
|
||||
if len(translatedList) <= 0:
|
||||
translatedList = None
|
||||
|
||||
# Replace Single Quotes
|
||||
translatedText = re.sub(r'[^\\]"', '\\"', translatedText)
|
||||
# Replace Single Quotes
|
||||
translatedText = re.sub(r'[^\\]"', '\\"', translatedText)
|
||||
|
||||
# Set Data
|
||||
data[i] = re.sub(r"\b%s\b" % originalString, translatedText, data[i])
|
||||
# Set Data
|
||||
data[i] = data[i].replace(originalString, translatedText)
|
||||
|
||||
# Quest Name
|
||||
regex = r'[\\]+"QuestName[\\]+":[\\]+"(.*?)[\\]+"'
|
||||
regex = r'[\\]+"Titled[\\]+":[\\]+"(.*?)[\\]+"'
|
||||
matchList = re.findall(regex, data[i])
|
||||
if len(matchList) > 0:
|
||||
for match in matchList:
|
||||
|
|
@ -255,14 +256,14 @@ def translatePlugin(data, pbar, filename, translatedList):
|
|||
translatedList = None
|
||||
|
||||
# Replace Single Quotes
|
||||
translatedText = re.sub(r"[^\\]'", "\\'", translatedText)
|
||||
translatedText = re.sub(r'[^\\]"', '\\"', translatedText)
|
||||
translatedText = translatedText.replace('"', "'")
|
||||
translatedText = re.sub(r"([^\\'])'", r"\1\\'", translatedText)
|
||||
|
||||
# Set Data
|
||||
data[i] = re.sub(r"\b%s\b" % originalString, translatedText, data[i])
|
||||
data[i] = data[i].replace(originalString, translatedText)
|
||||
|
||||
# Quest Client
|
||||
regex = r'QuestClientName[\\]+":[\\]+"(.*?)[\\]+"'
|
||||
regex = r'Requesterd[\\]+":[\\]+"(.*?)[\\]+"'
|
||||
matchList = re.findall(regex, data[i])
|
||||
if len(matchList) > 0:
|
||||
for match in matchList:
|
||||
|
|
@ -288,14 +289,14 @@ def translatePlugin(data, pbar, filename, translatedList):
|
|||
translatedList = None
|
||||
|
||||
# Replace Single Quotes
|
||||
translatedText = re.sub(r"[^\\]'", "\\'", translatedText)
|
||||
translatedText = re.sub(r'[^\\]"', '\\"', translatedText)
|
||||
translatedText = translatedText.replace('"', "'")
|
||||
translatedText = re.sub(r"([^\\'])'", r"\1\\'", translatedText)
|
||||
|
||||
# Set Data
|
||||
data[i] = re.sub(r"\b%s\b" % originalString, translatedText, data[i])
|
||||
data[i] = data[i].replace(originalString, translatedText)
|
||||
|
||||
# Quest Location
|
||||
regex = r'QuestLocation[\\]+":[\\]+"(.*?)[\\]+"'
|
||||
regex = r'Placed[\\]+":[\\]+"(.*?)[\\]+"'
|
||||
matchList = re.findall(regex, data[i])
|
||||
if len(matchList) > 0:
|
||||
for match in matchList:
|
||||
|
|
@ -321,14 +322,14 @@ def translatePlugin(data, pbar, filename, translatedList):
|
|||
translatedList = None
|
||||
|
||||
# Replace Single Quotes
|
||||
translatedText = re.sub(r"[^\\]'", "\\'", translatedText)
|
||||
translatedText = re.sub(r'[^\\]"', '\\"', translatedText)
|
||||
translatedText = translatedText.replace('"', "'")
|
||||
translatedText = re.sub(r"([^\\'])'", r"\1\\'", translatedText)
|
||||
|
||||
# Set Data
|
||||
data[i] = re.sub(r"\b%s\b" % originalString, translatedText, data[i])
|
||||
data[i] = data[i].replace(originalString, translatedText)
|
||||
|
||||
# Quest Target
|
||||
regex = r'PlaceInformation[\\]+":[\\]+"(.*?)[\\]+"'
|
||||
regex = r'PlacedInformation[\\]+":[\\]+"(.*?)[\\]+"'
|
||||
matchList = re.findall(regex, data[i])
|
||||
if len(matchList) > 0:
|
||||
for match in matchList:
|
||||
|
|
@ -354,14 +355,14 @@ def translatePlugin(data, pbar, filename, translatedList):
|
|||
translatedList = None
|
||||
|
||||
# Replace Single Quotes
|
||||
translatedText = re.sub(r"[^\\]'", "\\'", translatedText)
|
||||
translatedText = re.sub(r'[^\\]"', '\\"', translatedText)
|
||||
translatedText = translatedText.replace('"', "'")
|
||||
translatedText = re.sub(r"([^\\'])'", r"\1\\'", translatedText)
|
||||
|
||||
# Set Data
|
||||
data[i] = re.sub(r"\b%s\b" % originalString, translatedText, data[i])
|
||||
data[i] = data[i].replace(originalString, translatedText)
|
||||
|
||||
# Quest Summary
|
||||
regex = r'QuestContent[\\]+":[\\]+"[\\]+"(.*?)[\\]+"'
|
||||
regex = r'[\\]+"DetaildNote[\\]+":[\\]+"[\\]+"(.*?)[\\]+"[\\]+"'
|
||||
matchList = re.findall(regex, data[i])
|
||||
if len(matchList) > 0:
|
||||
for match in matchList:
|
||||
|
|
@ -371,6 +372,7 @@ def translatePlugin(data, pbar, filename, translatedList):
|
|||
|
||||
# Remove any textwrap
|
||||
match = match.replace(r"\\\\\\\\n", " ")
|
||||
match = match.replace(r"\\\\\\\\\\\\\\\\c", "\\c")
|
||||
|
||||
# Pass 1
|
||||
if setData == False:
|
||||
|
|
@ -392,10 +394,11 @@ def translatePlugin(data, pbar, filename, translatedList):
|
|||
# Textwrap
|
||||
translatedText = textwrap.fill(translatedText, width=WIDTH)
|
||||
translatedText = translatedText.replace("\n", r"\\\\\\\\n")
|
||||
match = match.replace("\\c", r"\\\\\\\\\\\\\\\\c")
|
||||
|
||||
# Replace Single Quotes
|
||||
translatedText = re.sub(r"[^\\]'", "\\'", translatedText)
|
||||
translatedText = re.sub(r'[^\\]"', '\\"', translatedText)
|
||||
translatedText = translatedText.replace('"', "'")
|
||||
translatedText = re.sub(r"([^\\'])'", r"\1\\'", translatedText)
|
||||
|
||||
# Set Data
|
||||
data[i] = data[i].replace(originalString, translatedText)
|
||||
|
|
@ -434,8 +437,8 @@ def translatePlugin(data, pbar, filename, translatedList):
|
|||
translatedText = translatedText.replace("\n", r"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n")
|
||||
|
||||
# Replace Single Quotes
|
||||
translatedText = re.sub(r"[^\\]'", "\\'", translatedText)
|
||||
translatedText = re.sub(r'[^\\]"', '\\"', translatedText)
|
||||
translatedText = translatedText.replace('"', "'")
|
||||
translatedText = re.sub(r"([^\\'])'", r"\1\\'", translatedText)
|
||||
|
||||
# Set Data
|
||||
data[i] = data[i].replace(originalString, translatedText)
|
||||
|
|
|
|||
49
vocab.txt
49
vocab.txt
|
|
@ -1,38 +1,18 @@
|
|||
Here are some vocabulary and terms so that you know the proper spelling and translation.
|
||||
```
|
||||
# Game Characters
|
||||
ココナ (Kokona) - Female
|
||||
センリ (Senri) - Female
|
||||
カナミ (Kanami) - Female
|
||||
サキ (Saki) - Female
|
||||
ミユ (Miyu) - Female
|
||||
カナミ (Kanami) - Female
|
||||
ノノカ (Nonoka) - Female
|
||||
シンジ (Shinji)
|
||||
タクオ (Takuo)
|
||||
ユヅキ (Yuzuki)
|
||||
マリナ (Marina)
|
||||
レン (Ren)
|
||||
コクリュウ (Kokuryu)
|
||||
センリ (Senri)
|
||||
ノノカ (Nonoka)
|
||||
ミユ (Miyu)
|
||||
リツコ (Ritsuko)
|
||||
カスゾウ (Kasuzou)
|
||||
ヨシオ (Yoshio)
|
||||
ブスジマ (Busujima)
|
||||
タロウ (Tarou)
|
||||
オリバー (Oliver)
|
||||
デブオ (Debuo)
|
||||
ミン (Min)
|
||||
ザコ戦闘員 (Zako Combatant)
|
||||
Dr.ゲーリー (Dr. Gary)
|
||||
キャプテンブランドー (Captain Brando)
|
||||
サンタコロース (Santa Claus)
|
||||
一ノ瀬 茂 (Shigeru Ichinose)
|
||||
クズオ (Kuzuo)
|
||||
ガリオ (Gario)
|
||||
シゲさん (Shige-san)
|
||||
桜 謳歌 (Sakura Ouka) - Female
|
||||
鈴音 (Suzune) - Female
|
||||
鍛冶 演歌 (Kaji Enka) - Female
|
||||
希来里 (Kirari) - Female
|
||||
温泉 玉子 (Onsen Tamago) - Female
|
||||
愚譜 徳朗 (Gufu Tokuro) - Unknown
|
||||
華姫瑠 (Kahimeru) - Unknown
|
||||
枝切 はらら (Edakiri Harara) - Unknown
|
||||
枝切 鋏 (Edakiri Hasami) - Unknown
|
||||
御馬 忠勝 (Miuma Tadakatsu) - Unknown
|
||||
ぬらり (Nurari) - Unknown
|
||||
狐鼓 (Kokotsuzumi) - Unknown
|
||||
|
||||
# Lewd Terms
|
||||
マンコ (pussy)
|
||||
|
|
@ -121,6 +101,9 @@ ME 音量 (ME Volume)
|
|||
ローバー (Roper)
|
||||
w ((lol))
|
||||
巫女 (Shrine Maiden)
|
||||
コイツ (this bastard)
|
||||
2万 (20,000)
|
||||
|
||||
# Locations
|
||||
サイノ河 (Saino River)
|
||||
オソレ峠 一幕 (Osore Pass Act One)
|
||||
```
|
||||
Loading…
Reference in a new issue