From f241767b994e8cba0e92d2f76d73ec34c2c4c2ab Mon Sep 17 00:00:00 2001 From: DazedAnon Date: Tue, 21 Jan 2025 15:05:10 -0600 Subject: [PATCH] Ignore symbol only lines in rpgmv for 401 --- modules/csv.py | 12 ++++++--- modules/rpgmakermvmz.py | 16 ++++++----- modules/wolf.py | 60 ++++++++++++++++++++--------------------- vocab.txt | 1 + 4 files changed, 49 insertions(+), 40 deletions(-) diff --git a/modules/csv.py b/modules/csv.py index c2663a6..0643982 100644 --- a/modules/csv.py +++ b/modules/csv.py @@ -286,19 +286,24 @@ def translateCSV(data, pbar, writer, filename, translatedList, format): # In Place Format case "3": # Set columns to translate. Leave empty to translate all. - targetColumns = [] + targetColumns = [0] # False - Place translation in source column # True - Place translation in next column targetNextRow = False + # Skip 1st Row + skipFirstRow = True + for j in range(len(data[i])): - if j not in targetColumns: + if skipFirstRow and i == 0: + continue + if j in targetColumns and data[i][j]: # Check if Translated jaString = data[i][j] # Remove Textwrap - jaString = jaString.replace("\\n", " ") + jaString = jaString.replace("\n", " ") # Pass 1 if not translatedList: @@ -312,7 +317,6 @@ def translateCSV(data, pbar, writer, filename, translatedList, format): # Add Wordwrap translatedText = textwrap.fill(translatedText, WIDTH) - translatedText = translatedText.replace("\n", "\\n") # Set Data if targetNextRow: diff --git a/modules/rpgmakermvmz.py b/modules/rpgmakermvmz.py index c33b978..317af14 100644 --- a/modules/rpgmakermvmz.py +++ b/modules/rpgmakermvmz.py @@ -75,19 +75,19 @@ POSITION = 0 LEAVE = False # Dialogue / Scroll / Choices (Main Codes) -CODE401 = True -CODE405 = True -CODE102 = True +CODE401 = False +CODE405 = False +CODE102 = False # Optional -CODE101 = True # 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. # Variables CODE122 = False # Other -CODE355655 = False +CODE355655 = True CODE357 = False CODE657 = False CODE356 = False @@ -872,6 +872,10 @@ def searchCodes(page, pbar, jobList, filename): # Grab String if len(codeList[i]["parameters"]) > 0: jaString = codeList[i]["parameters"][0] + # Check if there is text to translate + if not re.search(r'\w+', jaString): + i += 1 + continue oldjaString = jaString else: codeList[i]["code"] = -1 @@ -1647,7 +1651,7 @@ def searchCodes(page, pbar, jobList, filename): ## 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'const.+=\s?\"(.+?)\"'] + regexPatterns = [r'_logWindow.addText\(\"(.+)\"'] # Iterate over the list of regex patterns for regex in regexPatterns: diff --git a/modules/wolf.py b/modules/wolf.py index bd12da8..b87438e 100644 --- a/modules/wolf.py +++ b/modules/wolf.py @@ -75,13 +75,13 @@ LEAVE = False PBAR = None FILENAME = None -# Dialogue / Scroll -CODE101 = False +# Dialogue / Choices +CODE101 = True CODE102 = False # Set String (Fragile but necessary) CODE122 = False -CODE150 = True +CODE150 = False # Other CODE210 = False @@ -93,12 +93,12 @@ SCENARIOFLAG = False OPTIONSFLAG = False NPCFLAG = False DBNAMEFLAG = False -ITEMFLAG = True +ITEMFLAG = False STATEFLAG = False ENEMYFLAG = False -ARMORFLAG = True -WEAPONFLAG = True -SKILLFLAG = True +ARMORFLAG = False +WEAPONFLAG = False +SKILLFLAG = False def handleWOLF(filename, estimate): @@ -761,6 +761,8 @@ def searchDB(events, pbar, jobList, filename): global LOCK global NAMESLIST global MISMATCH + global PBAR + PBAR = pbar # Begin Parsing File try: @@ -810,32 +812,30 @@ def searchDB(events, pbar, jobList, filename): dataList[j].update({"value": translatedText}) npcList[1].pop(0) - # Grab Scenarios - if table["name"] == "MGP_参加者" and SCENARIOFLAG == True: - for hScenario in table["data"]: - dataList = hScenario["data"] + # Grab Scenario + if table["name"] == "マップキャラ配置マスタ" and SCENARIOFLAG == True: + for scenario in table["data"]: + dataList = scenario["data"] # Parse - # Pass 1 (Grab Data) - if setData == False: - if dataList[1].get("value") != "": - scenarioList[0].append(dataList[1].get("value")) - if dataList[44].get("value") != "": - scenarioList[1].append(dataList[44].get("value")) - if dataList[45].get("value") != "": - scenarioList[2].append(dataList[45].get("value")) + for j in range(len(dataList)): + # Name + if "テキスト" in dataList[j].get("name"): + if dataList[j].get("value"): + jaStringList = dataList[j].get("value").split("\r\nPFD\r\n") + for jaString in jaStringList: + # Pass 1 (Grab Data) + if setData == False: + jaString = jaString.replace('\n', ' ') + jaString = jaString.replace('\r', '') + scenarioList[0].append(jaString) - # Pass 2 (Set Data) - else: - if dataList[1].get("value") != "": - dataList[1].update({"value": scenarioList[0][0]}) - scenarioList[0].pop(0) - if dataList[44].get("value") != "": - dataList[44].update({"value": scenarioList[1][0]}) - scenarioList[1].pop(0) - if dataList[45].get("value") != "": - dataList[45].update({"value": scenarioList[2][0]}) - scenarioList[2].pop(0) + # Pass 2 (Set Data) + else: + translatedText = scenarioList[0][0] + scenarioList[0].pop(0) + translatedText = textwrap.fill(translatedText, 35) + dataList[j].update({"value": dataList[j].get("value").replace(jaString, translatedText)}) # Grab Options if table["name"] == "選択肢説明" and OPTIONSFLAG == True: diff --git a/vocab.txt b/vocab.txt index 699d38e..bc0e915 100644 --- a/vocab.txt +++ b/vocab.txt @@ -45,6 +45,7 @@ Here are some vocabulary and terms so that you know the proper spelling and tran お姉ちゃん (onee-chan) ねえさん (nee-san) おじさん (oji-san) +あいつ (they) # System 初めから (Start)