You've already forked PythonLib
mirror of
https://github.com/lifebottle/PythonLib.git
synced 2026-02-13 15:25:50 -08:00
Add CLI flags for inserting text
This commit is contained in:
33
Tales_Exe.py
33
Tales_Exe.py
@@ -158,6 +158,33 @@ def get_arguments(argv=None):
|
||||
help="(Optional) - Only for extract Iso command",
|
||||
)
|
||||
|
||||
sp_insert.add_argument(
|
||||
"--with-proofreading",
|
||||
required=False,
|
||||
action="store_const",
|
||||
const="Proofreading",
|
||||
default="",
|
||||
help="(Optional) - Insert lines in 'Proofreading' status",
|
||||
)
|
||||
|
||||
sp_insert.add_argument(
|
||||
"--with-editing",
|
||||
required=False,
|
||||
action="store_const",
|
||||
const="Editing",
|
||||
default="",
|
||||
help="(Optional) - Insert lines in 'Editing' status",
|
||||
)
|
||||
|
||||
sp_insert.add_argument(
|
||||
"--with-problematic",
|
||||
required=False,
|
||||
action="store_const",
|
||||
const="Problematic",
|
||||
default="",
|
||||
help="(Optional) - Insert lines in 'Problematic' status",
|
||||
)
|
||||
|
||||
# Debug commands
|
||||
sp_debug = sp.add_parser(
|
||||
"debug",
|
||||
@@ -228,7 +255,11 @@ def hex2bytes(tales_instance, hex_value):
|
||||
def getTalesInstance(args, game_name):
|
||||
|
||||
if game_name == "TOR":
|
||||
talesInstance = ToolsTOR.ToolsTOR(args.project.resolve())
|
||||
if args.action == "insert":
|
||||
insert_mask = [args.with_proofreading, args.with_editing, args.with_problematic]
|
||||
else:
|
||||
insert_mask = [""]
|
||||
talesInstance = ToolsTOR.ToolsTOR(args.project.resolve(), insert_mask)
|
||||
elif game_name == "NDX":
|
||||
talesInstance = ToolsNDX.ToolsNDX("TBL_All.json")
|
||||
else:
|
||||
|
||||
@@ -46,7 +46,7 @@ class ToolsTOR(ToolsTales):
|
||||
LOW_BITS = 0x3F
|
||||
|
||||
|
||||
def __init__(self, project_file: Path) -> None:
|
||||
def __init__(self, project_file: Path, insert_mask: list[str]) -> None:
|
||||
base_path = project_file.parent
|
||||
self.jsonTblTags = {}
|
||||
self.ijsonTblTags = {}
|
||||
@@ -71,7 +71,8 @@ class ToolsTOR(ToolsTales):
|
||||
# byteCode
|
||||
self.story_byte_code = b"\xF8"
|
||||
self.string_opcode = InstructionType.STRING
|
||||
self.list_status_insertion: list[str] = ['Done', 'Proofreading', 'Editing']
|
||||
self.list_status_insertion: list[str] = ['Done']
|
||||
self.list_status_insertion.append(*insert_mask)
|
||||
|
||||
|
||||
# Extract the story files
|
||||
|
||||
Reference in New Issue
Block a user