ff9mapkit 1.0.0b3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ff9mapkit/__init__.py +18 -0
- ff9mapkit/__main__.py +36 -0
- ff9mapkit/_animdb.py +2994 -0
- ff9mapkit/_animdb_all.py +14125 -0
- ff9mapkit/_fieldtable.py +1516 -0
- ff9mapkit/_fieldtext.py +845 -0
- ff9mapkit/_held_poses.py +44 -0
- ff9mapkit/_itemdb.py +65 -0
- ff9mapkit/_modeldb.py +725 -0
- ff9mapkit/_narrowmap_data.py +10 -0
- ff9mapkit/_npcparams.py +634 -0
- ff9mapkit/_regen_animdb.py +72 -0
- ff9mapkit/_regen_animdb_all.py +66 -0
- ff9mapkit/_regen_fieldtable.py +95 -0
- ff9mapkit/_regen_fieldtext.py +66 -0
- ff9mapkit/_regen_modeldb.py +67 -0
- ff9mapkit/_regen_npcparams.py +123 -0
- ff9mapkit/_regen_scenedb.py +57 -0
- ff9mapkit/_scenedb.py +869 -0
- ff9mapkit/abilities.py +225 -0
- ff9mapkit/animations.py +120 -0
- ff9mapkit/archetypes.py +218 -0
- ff9mapkit/areatitle.py +76 -0
- ff9mapkit/battle/__init__.py +21 -0
- ff9mapkit/battle/abilityfeatures.py +294 -0
- ff9mapkit/battle/actiondelta.py +441 -0
- ff9mapkit/battle/aiauthor.py +305 -0
- ff9mapkit/battle/ailint.py +140 -0
- ff9mapkit/battle/aipatch.py +175 -0
- ff9mapkit/battle/battleai.py +148 -0
- ff9mapkit/battle/battlecsv.py +390 -0
- ff9mapkit/battle/battlepatch.py +395 -0
- ff9mapkit/battle/build.py +558 -0
- ff9mapkit/battle/camera_codec.py +332 -0
- ff9mapkit/battle/camera_data.py +128 -0
- ff9mapkit/battle/characterdelta.py +789 -0
- ff9mapkit/battle/event_data.py +72 -0
- ff9mapkit/battle/extract.py +540 -0
- ff9mapkit/battle/fbx.py +223 -0
- ff9mapkit/battle/reskin.py +149 -0
- ff9mapkit/battle/scene_codec.py +314 -0
- ff9mapkit/battle/scene_data.py +369 -0
- ff9mapkit/battle/scenelint.py +125 -0
- ff9mapkit/battle/seqasm.py +131 -0
- ff9mapkit/battle/seqauthor.py +220 -0
- ff9mapkit/battle/seqcodec.py +300 -0
- ff9mapkit/battle/seqdis.py +106 -0
- ff9mapkit/battle/seqpatch.py +137 -0
- ff9mapkit/battle_bgm.py +133 -0
- ff9mapkit/binutils.py +60 -0
- ff9mapkit/build.py +5445 -0
- ff9mapkit/campaign.py +1276 -0
- ff9mapkit/catalog.py +316 -0
- ff9mapkit/chain.py +358 -0
- ff9mapkit/cli.py +3114 -0
- ff9mapkit/config.py +360 -0
- ff9mapkit/content/__init__.py +13 -0
- ff9mapkit/content/areatitle.py +36 -0
- ff9mapkit/content/ate.py +118 -0
- ff9mapkit/content/camera.py +123 -0
- ff9mapkit/content/chest.py +186 -0
- ff9mapkit/content/choice.py +163 -0
- ff9mapkit/content/conductor.py +217 -0
- ff9mapkit/content/cutscene.py +290 -0
- ff9mapkit/content/encounter.py +41 -0
- ff9mapkit/content/entry_settle.py +50 -0
- ff9mapkit/content/equipment.py +93 -0
- ff9mapkit/content/event.py +191 -0
- ff9mapkit/content/gateway.py +101 -0
- ff9mapkit/content/inventory.py +59 -0
- ff9mapkit/content/itemdata.py +644 -0
- ff9mapkit/content/itemtext.py +168 -0
- ff9mapkit/content/jump.py +114 -0
- ff9mapkit/content/ladder.py +633 -0
- ff9mapkit/content/movement.py +53 -0
- ff9mapkit/content/music.py +97 -0
- ff9mapkit/content/npc.py +348 -0
- ff9mapkit/content/object.py +340 -0
- ff9mapkit/content/onentry.py +135 -0
- ff9mapkit/content/party.py +111 -0
- ff9mapkit/content/pathfind.py +138 -0
- ff9mapkit/content/platform.py +314 -0
- ff9mapkit/content/player.py +168 -0
- ff9mapkit/content/prop.py +75 -0
- ff9mapkit/content/region.py +340 -0
- ff9mapkit/content/reinit.py +59 -0
- ff9mapkit/content/savepoint.py +90 -0
- ff9mapkit/content/shop.py +178 -0
- ff9mapkit/content/sps_trigger.py +66 -0
- ff9mapkit/content/startup.py +71 -0
- ff9mapkit/content/synthesis.py +106 -0
- ff9mapkit/content/text.py +183 -0
- ff9mapkit/content/textcarry.py +290 -0
- ff9mapkit/content/verbatim.py +86 -0
- ff9mapkit/content/walkmesh_hotfix.py +38 -0
- ff9mapkit/data/__init__.py +48 -0
- ff9mapkit/data/_regen_provenance.py +142 -0
- ff9mapkit/data/provenance/blank.es.patch +1 -0
- ff9mapkit/data/provenance/blank.fr.patch +1 -0
- ff9mapkit/data/provenance/blank.gr.patch +1 -0
- ff9mapkit/data/provenance/blank.it.patch +1 -0
- ff9mapkit/data/provenance/blank.jp.patch +1 -0
- ff9mapkit/data/provenance/blank.uk.patch +1 -0
- ff9mapkit/data/provenance/blank.us.patch +1 -0
- ff9mapkit/data/provenance/manifest.json +65 -0
- ff9mapkit/data/provenance/region_template.patch +1 -0
- ff9mapkit/data/reference_arcs.toml +89 -0
- ff9mapkit/data/region_catalog.toml +593 -0
- ff9mapkit/deploystack.py +358 -0
- ff9mapkit/dialogue.py +803 -0
- ff9mapkit/eb/__init__.py +12 -0
- ff9mapkit/eb/_exprtable.py +59 -0
- ff9mapkit/eb/_membertable.py +38 -0
- ff9mapkit/eb/_optables.py +537 -0
- ff9mapkit/eb/_regen_optables.py +76 -0
- ff9mapkit/eb/cmdasm.py +323 -0
- ff9mapkit/eb/disasm.py +332 -0
- ff9mapkit/eb/edit.py +439 -0
- ff9mapkit/eb/exprasm.py +158 -0
- ff9mapkit/eb/model.py +178 -0
- ff9mapkit/eb/opcodes.py +463 -0
- ff9mapkit/eblint.py +177 -0
- ff9mapkit/editor/__init__.py +20 -0
- ff9mapkit/editor/app.py +950 -0
- ff9mapkit/editor/battle_forms.py +240 -0
- ff9mapkit/editor/breadcrumb.py +89 -0
- ff9mapkit/editor/dialogs.py +116 -0
- ff9mapkit/editor/feedback.py +208 -0
- ff9mapkit/editor/forms.py +632 -0
- ff9mapkit/editor/graphview.py +350 -0
- ff9mapkit/editor/jobs.py +342 -0
- ff9mapkit/editor/model.py +243 -0
- ff9mapkit/editor/picker.py +120 -0
- ff9mapkit/editor/theme.py +212 -0
- ff9mapkit/eventscan.py +1441 -0
- ff9mapkit/extract.py +2279 -0
- ff9mapkit/flags.py +693 -0
- ff9mapkit/forkreport.py +1383 -0
- ff9mapkit/hub.py +477 -0
- ff9mapkit/idgated.py +101 -0
- ff9mapkit/infohub.py +580 -0
- ff9mapkit/items.py +63 -0
- ff9mapkit/itemstats.py +346 -0
- ff9mapkit/journey.py +1902 -0
- ff9mapkit/keyitems.py +93 -0
- ff9mapkit/logic_add.py +632 -0
- ff9mapkit/logic_edit.py +728 -0
- ff9mapkit/logic_map.py +526 -0
- ff9mapkit/pack.py +175 -0
- ff9mapkit/playerswap.py +231 -0
- ff9mapkit/prop_archetypes.py +228 -0
- ff9mapkit/provision.py +282 -0
- ff9mapkit/refarc.py +825 -0
- ff9mapkit/save.py +337 -0
- ff9mapkit/save_items.py +1673 -0
- ff9mapkit/scene/__init__.py +11 -0
- ff9mapkit/scene/arena.py +63 -0
- ff9mapkit/scene/bgart.py +140 -0
- ff9mapkit/scene/bgi.py +732 -0
- ff9mapkit/scene/bgs.py +174 -0
- ff9mapkit/scene/bgx.py +185 -0
- ff9mapkit/scene/cam.py +345 -0
- ff9mapkit/scene/guide.py +311 -0
- ff9mapkit/scene/paint.py +506 -0
- ff9mapkit/scene/placeholder.py +107 -0
- ff9mapkit/sjbinary.py +285 -0
- ff9mapkit/sps/__init__.py +17 -0
- ff9mapkit/sps/author.py +294 -0
- ff9mapkit/sps/catalog.py +88 -0
- ff9mapkit/sps/codec.py +264 -0
- ff9mapkit/sps/edit.py +184 -0
- ff9mapkit/sps/lint.py +58 -0
- ff9mapkit/sps/render.py +116 -0
- ff9mapkit/sps/templates.py +47 -0
- ff9mapkit/sps/texture.py +131 -0
- ff9mapkit/walkmesh_hotfixes.py +163 -0
- ff9mapkit/workspace/__init__.py +18 -0
- ff9mapkit/workspace/battledoc.py +985 -0
- ff9mapkit/workspace/builddoc.py +607 -0
- ff9mapkit/workspace/forms_qt.py +586 -0
- ff9mapkit/workspace/importdoc.py +665 -0
- ff9mapkit/workspace/mapview.py +131 -0
- ff9mapkit/workspace/palette.py +85 -0
- ff9mapkit/workspace/savedoc.py +664 -0
- ff9mapkit/workspace/shell.py +6907 -0
- ff9mapkit/workspace/style.py +105 -0
- ff9mapkit/workspace/tuningdialog.py +223 -0
- ff9mapkit-1.0.0b3.dist-info/METADATA +155 -0
- ff9mapkit-1.0.0b3.dist-info/RECORD +193 -0
- ff9mapkit-1.0.0b3.dist-info/WHEEL +5 -0
- ff9mapkit-1.0.0b3.dist-info/entry_points.txt +5 -0
- ff9mapkit-1.0.0b3.dist-info/licenses/LICENSE +31 -0
- ff9mapkit-1.0.0b3.dist-info/top_level.txt +1 -0
ff9mapkit/keyitems.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""Key/important-item NAMES, read LIVE from the install (provenance-clean) + the id<->name resolver.
|
|
2
|
+
|
|
3
|
+
FF9 has **no symbolic enum** for key items (unlike ``RegularItem``), so the kit ships no key-item name table.
|
|
4
|
+
Names are read LIVE from ``<install>/StreamingAssets/Text/<lang>/KeyItems.strings`` (entries
|
|
5
|
+
``"$keyNNNN" = "Name`` ...), cached in-memory, **shipping/committing nothing** (the same provenance-clean live
|
|
6
|
+
pattern as :mod:`ff9mapkit.itemstats`). If the install/file isn't reachable, every accessor returns ``None`` and
|
|
7
|
+
the editor falls back to raw numeric ids.
|
|
8
|
+
|
|
9
|
+
Usage::
|
|
10
|
+
|
|
11
|
+
from ff9mapkit import keyitems
|
|
12
|
+
keyitems.resolve("Silver Pendant") # -> 0
|
|
13
|
+
keyitems.name_of(4) # -> "Falcon Claw"
|
|
14
|
+
"""
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import re
|
|
18
|
+
|
|
19
|
+
# id <-> first-line name from the .strings file: "$key0004" = "Falcon Claw\n...help...";
|
|
20
|
+
_KEY_RE = re.compile(r'"\$key(\d+)"\s*=\s*"([^\n\r]*)')
|
|
21
|
+
KEYITEM_MAX = 255 # the main-block 2-bit rareItems bitfield covers 0-255
|
|
22
|
+
|
|
23
|
+
_CACHE = None # None = not loaded yet; False = tried + unavailable; dict = {id: name}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _norm(s) -> str:
|
|
27
|
+
return "".join(c for c in str(s).lower() if c.isalnum())
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _load(game=None, lang: str = "US"):
|
|
31
|
+
"""``{id: name}`` from the install's KeyItems.strings (cached), or ``None`` if it can't be read."""
|
|
32
|
+
global _CACHE
|
|
33
|
+
if _CACHE is not None:
|
|
34
|
+
return _CACHE or None
|
|
35
|
+
try:
|
|
36
|
+
from .config import find_game_path
|
|
37
|
+
p = find_game_path(game) / "StreamingAssets" / "Text" / lang / "KeyItems.strings"
|
|
38
|
+
text = p.read_text(encoding="utf-8-sig", errors="replace")
|
|
39
|
+
except Exception: # noqa: BLE001 -- install not reachable -> degrade
|
|
40
|
+
_CACHE = False
|
|
41
|
+
return None
|
|
42
|
+
out = {}
|
|
43
|
+
for m in _KEY_RE.finditer(text):
|
|
44
|
+
iid, name = int(m.group(1)), m.group(2).strip()
|
|
45
|
+
if name and iid not in out: # first entry per id (the file has story-variant dups)
|
|
46
|
+
out[iid] = name
|
|
47
|
+
_CACHE = out or False
|
|
48
|
+
return out or None
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def name_of(iid, game=None):
|
|
52
|
+
"""Canonical key-item name for an id, or ``None`` (id unknown / install unreachable)."""
|
|
53
|
+
d = _load(game)
|
|
54
|
+
return d.get(int(iid)) if d else None
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def resolve(name_or_id, game=None) -> int:
|
|
58
|
+
"""A key-item NAME or id -> its numeric id. An int / digit-string passes through (validated 0-255); a name is
|
|
59
|
+
matched case/space/punct-insensitively against the live name table. Raises ValueError on an unknown name /
|
|
60
|
+
out-of-range id (or if names can't be read and a name was given)."""
|
|
61
|
+
if isinstance(name_or_id, bool):
|
|
62
|
+
raise ValueError("key item cannot be a boolean")
|
|
63
|
+
if isinstance(name_or_id, int):
|
|
64
|
+
if not 0 <= name_or_id <= KEYITEM_MAX:
|
|
65
|
+
raise ValueError(f"key-item id {name_or_id} out of range (0-{KEYITEM_MAX})")
|
|
66
|
+
return name_or_id
|
|
67
|
+
s = str(name_or_id).strip()
|
|
68
|
+
if s.isdigit():
|
|
69
|
+
return resolve(int(s), game)
|
|
70
|
+
d = _load(game)
|
|
71
|
+
if d:
|
|
72
|
+
by_name = {_norm(v): k for k, v in d.items()}
|
|
73
|
+
key = _norm(s)
|
|
74
|
+
if key in by_name:
|
|
75
|
+
return by_name[key]
|
|
76
|
+
raise ValueError(f"unknown key item {name_or_id!r} (run `ff9mapkit items --keyitems` to list them)")
|
|
77
|
+
raise ValueError(f"cannot resolve key item {name_or_id!r}: the install's KeyItems.strings isn't reachable -- "
|
|
78
|
+
"pass a numeric id (0-255) instead")
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def available(game=None) -> bool:
|
|
82
|
+
"""True if the install's KeyItems.strings could be read (so key-item NAMES are live)."""
|
|
83
|
+
return _load(game) is not None
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def all_keyitems(game=None) -> list:
|
|
87
|
+
"""Sorted ``[(id, name), ...]`` (for the CLI / docs), or ``[]`` if unavailable."""
|
|
88
|
+
return sorted((_load(game) or {}).items())
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _reset_cache(): # for tests
|
|
92
|
+
global _CACHE
|
|
93
|
+
_CACHE = None
|