Add a new plugin catch in 357 and switch getSpeaker full prompt to false

This commit is contained in:
DazedAnon 2025-01-27 00:41:43 -06:00
parent bd7de189e8
commit 75fad967dd
3 changed files with 183 additions and 108 deletions

View file

@ -80,13 +80,13 @@ POSITION = 0
LEAVE = False LEAVE = False
# Dialogue / Scroll / Choices (Main Codes) # Dialogue / Scroll / Choices (Main Codes)
CODE401 = True CODE401 = False
CODE405 = True CODE405 = False
CODE102 = True CODE102 = False
# Optional # Optional
CODE101 = False # Turn this one when names exist in 101 CODE101 = False # Turn this one when names exist in 101
CODE408 = False # Warning, translates comments and can inflate costs. CODE408 = True # Warning, translates comments and can inflate costs.
# Variables # Variables
CODE122 = False CODE122 = False
@ -1397,64 +1397,64 @@ def searchCodes(page, pbar, jobList, filename):
codeList[i]["parameters"][3][argVar] = translatedText codeList[i]["parameters"][3][argVar] = translatedText
pbar.update(1) pbar.update(1)
# if "TextPicture" in headerString or "BalloonInBattle" in headerString: if "TextPicture" in headerString or "BalloonInBattle" in headerString:
# argVar = "text" argVar = "text"
# font = None font = None
# ### Message Text First ### Message Text First
# if argVar in codeList[i]["parameters"][3]: if argVar in codeList[i]["parameters"][3]:
# acExist = False acExist = False
# jaString = codeList[i]["parameters"][3][argVar] jaString = codeList[i]["parameters"][3][argVar]
# # Check ac # Check ac
# if "\\ac" in jaString: if "\\ac" in jaString:
# acExist = True acExist = True
# else: else:
# acExist = False acExist = False
# # If there isn't any Japanese in the text just skip # If there isn't any Japanese in the text just skip
# # if not re.search(r'[一-龠]+|[ぁ-ゔ]+|[ァ-ヴー]+', jaString): # if not re.search(r'[一-龠]+|[ぁ-ゔ]+|[ァ-ヴー]+', jaString):
# # i += 1 # i += 1
# # continue # continue
# # Remove any textwrap & TL # Remove any textwrap & TL
# if '[Lewd Power' in jaString: if '[Lewd Power' in jaString:
# jaString = re.sub(r"\n", " ", jaString) jaString = re.sub(r"\n", " ", jaString)
# if acExist: if acExist:
# jaString = jaString.replace("\\ac ", " ") jaString = jaString.replace("\\ac ", " ")
# jaString = jaString.replace("\\ac", "") jaString = jaString.replace("\\ac", "")
# # Pass 1 # Pass 1
# if setData == False: if setData == False:
# list357.append(jaString) list357.append(jaString)
# # Pass 2 # Pass 2
# else: else:
# if len(list357) > 0: if len(list357) > 0:
# # Grab and Replace # Grab and Replace
# translatedText = list357[0] translatedText = list357[0]
# translatedText = jaString.replace(jaString, translatedText) translatedText = jaString.replace(jaString, translatedText)
# # Remove characters that may break scripts # Remove characters that may break scripts
# charList = ['"', "\\n"] charList = ['"', "\\n"]
# for char in charList: for char in charList:
# translatedText = translatedText.replace(char, "") translatedText = translatedText.replace(char, "")
# # Textwrap # Textwrap
# if '[Lewd Power' in jaString: if '[Lewd Power' in jaString:
# translatedText = textwrap.fill(translatedText, 50) translatedText = textwrap.fill(translatedText, 50)
# # Center Text # Center Text
# if acExist: if acExist:
# translatedText = f'\\ac {translatedText.replace('\n', '\n\\ac ')}' translatedText = f'\\ac {translatedText.replace('\n', '\n\\ac ')}'
# # Check and Set Font # Check and Set Font
# if "fontSize" in codeList[i]["parameters"][3]: if "fontSize" in codeList[i]["parameters"][3]:
# if font: if font:
# codeList[i]["parameters"][3]["fontSize"] = font codeList[i]["parameters"][3]["fontSize"] = font
# # Set # Set
# codeList[i]["parameters"][3][argVar] = translatedText codeList[i]["parameters"][3][argVar] = translatedText
# list357.pop(0) list357.pop(0)
if "QuestSystem" in headerString: if "QuestSystem" in headerString:
argVar = "DetailNote" argVar = "DetailNote"
@ -1516,6 +1516,66 @@ def searchCodes(page, pbar, jobList, filename):
codeList[i]["parameters"][3][argVar] = f"\"{translatedText}\"" codeList[i]["parameters"][3][argVar] = f"\"{translatedText}\""
list357.pop(0) list357.pop(0)
if "LL_InfoPopupWIndow" in headerString:
argVar = "messageText"
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
jaString = jaString.replace('\\n', ' ')
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
translatedText = textwrap.fill(translatedText, 80)
translatedText = translatedText.replace('\n', '\\n')
translatedText = re.sub(r"[\\]+c", r"\\\\c", translatedText)
translatedText = re.sub(r"[\\]+\*item", r"\\\\*item", translatedText)
# 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] = f"{translatedText}"
list357.pop(0)
## Event Code: 657 [Picture Text] [Optional] ## Event Code: 657 [Picture Text] [Optional]
if "code" in codeList[i] and codeList[i]["code"] == 657 and CODE657 is True: if "code" in codeList[i] and codeList[i]["code"] == 657 and CODE657 is True:
if "text" in codeList[i]["parameters"][0]: if "text" in codeList[i]["parameters"][0]:
@ -1661,7 +1721,7 @@ def searchCodes(page, pbar, jobList, filename):
## Event Code: 355 or 655 Scripts [Optional] ## 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: if "code" in codeList[i] and (codeList[i]["code"] == 355 or codeList[i]["code"] == 655) and CODE355655 is True:
jaString = codeList[i]["parameters"][0] jaString = codeList[i]["parameters"][0]
regexPatterns = [r"^'(.*)'\)$"] regexPatterns = [r"テキスト-(.*)"]
# Iterate over the list of regex patterns # Iterate over the list of regex patterns
for regex in regexPatterns: for regex in regexPatterns:
@ -2493,7 +2553,7 @@ def getSpeaker(speaker):
response = translateGPT( response = translateGPT(
f"{speaker}", f"{speaker}",
"Reply with the " + LANGUAGE + " translation of the NPC name.", "Reply with the " + LANGUAGE + " translation of the NPC name.",
True, False,
) )
response[0] = response[0].title() response[0] = response[0].title()
response[0] = response[0].replace("'S", "'s") response[0] = response[0].replace("'S", "'s")

View file

@ -198,10 +198,11 @@ def translatePlugin(data, pbar, filename, translatedList):
while i < len(data): while i < len(data):
voice = False voice = False
speaker = "" speaker = ""
newline = r"\n" newline = r"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n"
colorCode = r"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\C"
# Custom # Custom
regex = r'{.+?"Text[\\]+":[\\]+"[\\]+}[\\]*(.+?)[\\]' regex = r'\\+"HelpText\\+":\\+"(.+?)\\+",'
matchList = re.findall(regex, data[i]) matchList = re.findall(regex, data[i])
if len(matchList) > 0: if len(matchList) > 0:
for match in matchList: for match in matchList:
@ -209,8 +210,12 @@ def translatePlugin(data, pbar, filename, translatedList):
jaString = match jaString = match
originalString = jaString originalString = jaString
# Replace \n and \c
jaString = re.sub(r"\\+n", r"\\n", jaString)
jaString = re.sub(r"\\+C", r"\\C", jaString)
# Remove any textwrap # Remove any textwrap
jaString = jaString.replace(newline, " ") # jaString = jaString.replace(newline, " ")
# Pass 1 # Pass 1
if setData == False: if setData == False:
@ -225,10 +230,18 @@ def translatePlugin(data, pbar, filename, translatedList):
# Set to None if empty list # Set to None if empty list
if len(translatedList) <= 0: if len(translatedList) <= 0:
translatedList = None translatedList = None
# Replace Single Quotes # Replace Single Quotes
translatedText = re.sub(r'[^\\]"', '\\"', translatedText) translatedText = re.sub(r"([^\\'])'", r"\1\\'", translatedText)
translatedText = re.sub(r"([^\\'])\"", r"\1\\'", translatedText)
# Textwrap
# translatedText = textwrap.fill(translatedText, WIDTH)
# Replace \n and \c
translatedText = re.sub(r"\\+n", re.escape(newline), translatedText)
translatedText = re.sub(r"\\+C", re.escape(colorCode), translatedText)
# Set Data # Set Data
data[i] = data[i].replace(originalString, translatedText) data[i] = data[i].replace(originalString, translatedText)

100
vocab.txt
View file

@ -1,10 +1,16 @@
Here are some vocabulary and terms so that you know the proper spelling and translation. Here are some vocabulary and terms so that you know the proper spelling and translation.
``` ```
# Game Characters # Game Characters
イルミナ (Lumina) - Female レイア (Leia) - Female
セラ (Sera) - Female リード (Reed) - Male
リアン (Lian) - Female プリシア (Priscia) - Female
イニス (Inis) - Female ゲイル (Gale) - Male
ミシェル (Michelle) - Female
アルベール (Albert) - Male
ケイシー (Casey) - Gender Neutral
エリオット (Elliot) - Male
ローザ (Rosa) - Female
ユーリ (Yuri) - Gender Neutral
# Lewd Terms # Lewd Terms
マンコ (pussy) マンコ (pussy)
@ -96,50 +102,46 @@ w ((lol))
巫女 (Shrine Maiden) 巫女 (Shrine Maiden)
2万 (20,000) 2万 (20,000)
# Locations #Weapons
サイノ河 (Saino River) ショートソード (Short Sword)
オソレ峠 一幕 (Osore Pass Act One) ロングソード (Long Sword)
ファルシオン (Falchion)
ミスリルソード (Mithril Sword)
ドラゴンブレード (Dragon Blade)
ウッドスタッフ (Wood Staff)
マジックワンド (Magic Wand)
フォースワンド (Force Wand)
ミスリルロッド (Mithril Rod)
ドラゴンスタッフ (Dragon Staff)
ストーンフレイル (Stone Flail)
ブロンズフレイル (Bronze Flail)
モーニングスター (Morning Star)
ミスリルフレイル (Mithril Flail)
ドラゴンフレイル (Dragon Flail)
ハンドアクス (Hand Axe)
バトルアクス (Battle Axe)
バルディッシュ (Bardiche)
ミスリルアクス (Mithril Axe)
ドラゴンアクス (Dragon Axe)
ショートスピア (Short Spear)
ロングスピア (Long Spear)
ハルバード (Halberd)
ミスリルスピア (Mithril Spear)
ドラゴンスピア (Dragon Spear)
セスタス (Cestus)
バグナウ (Bagh Nakh)
アイアンクロウ (Iron Claw)
ミスリルクロウ (Mithril Claw)
ドラゴンクロウ (Dragon Claw)
ショートボウ (Short Bow)
ロングボウ (Long Bow)
クロスボウ (Crossbow)
ミスリルボウ (Mithril Bow)
ドラゴンボウ (Dragon Bow)
ナイフ (Knife)
ダガー (Dagger)
マシェット (Machete)
ミスリルダガー (Mithril Dagger)
ドラゴンダガー (Dragon Dagger)
#Skills
ヒール (Heal)
ファイア (Fire)
スパーク (Spark)
アーマーブレイク (Armor Break)
チートアタック (Cheat Attack)
ゴブリン拘束攻撃 (Goblin Restraint Attack)
ゴブリン拘束攻撃バックアップ (Goblin Restraint Attack Backup)
■↓イルミナの技↓■ (■↓Lumina's Skills↓■)
ホーリーインパクト (Holy Impact)
セイントアロー (Saint Arrow)
ホーリーインパクトII (Holy Impact II)
セイントアローII (Saint Arrow II)
ヒール (Heal)
クリアウィンド (Clear Wind)
エクスプロージョン (Explosion)
アンチマジック (Anti-Magic)
リザレクション (Resurrection)
リジェネ (Regen)
ルミナス・ゲイル (Luminous Gale)
プロメテウスバースト (Prometheus Burst)
コキュートス (Cocytus)
ディエス・イラ (Dies Irae)
■インフェリアード行動■ (■ Inferiard Actions ■)
ブロッサムスラッシュ (Blossom Slash)
ラッシュオブアイビー (Rush of Ivy)
デバウアーブロッサム (Devour Blossom)
■マクスウェル行動■ (■ Maxwell Actions ■)
チャージ (Charge)
サンダーフォース (Thunder Force)
オーバードライブ・キャノン (Overdrive Cannon)
マシンガン (Machine Gun)
■ナイトメア (■ Nightmare)
イントロイトゥス (Introitus)
タルタロス・ハウル (Tartarus Howl)
ユーディキウム (Eudicium)
ソムニウム・シネフィーネ (Somnium Cinefine)
ラクリモーサ (Lacrimosa)
モルス・ウルティマ (Mors Ultima)
リベラ・メ (Libera Me)
ディエス・イレ (Dies Irae)
乱舞 (Wild Dance)
``` ```