Client Systems & Python UI
Metin2 inventory window position: first-open fix and safe local persistence
M2City Client · Editorial · Published 2026-11-04 · Branch-specific details should be checked against your own source.
An inventory window should reopen where the player left it. The supplied implementation opens wndconf/<character>/inventory.pos unconditionally: on a new character, the directory can exist while the file does not. Empty or malformed coordinates can also interrupt Show(). This is a client UI change for private Metin2 administrators who maintain their own Python root and client source.
What M2City changed in r1
The inventory instructions now call m2city_window_position.py. Missing/unreadable files and invalid coordinates fall back to the normal window position. Saving creates the parent directory when needed and handles ordinary I/O failures. Coordinates are clamped using both screen and window dimensions, keeping the whole window reachable after a resolution change. Character/window path components reject separators, traversal and control characters.
Original instruction text is retained separately as M2CITY-UPSTREAM-uiinventory.py.txt. The original supplied RAR has SHA-256 d5351da4fe1c9eed5cf5c00c9f860cadd5c7f7747ecef43335929f6fae588e89; the download below is the patched ZIP, with its own checksum.
Integration order
1. Back up uiinventory.py, interfacemodule.py and your client source. Compare the included search anchors with your branch; these files are instructions, not complete engine files.
2. Merge ENABLE_SAVE_LAST_WINDOW_POSITION and its Python constant export consistently. This resource does not require a database migration or game-server change.
3. Pack m2city_window_position.py into root and use the replacement SetLastPosition/SaveLastPosition methods in the included uiinventory.py instructions.
4. Keep restore after the normal Show and save before Close/Destroy hides or destroys the visible window. Reconcile your equipment-tab positioning hook if your UI has one.
Checks completed and what to test next
Nine host-side regression tests pass under Python 3.13: missing file, save/read round trip, empty/corrupt coordinates, negative coordinates, resolution change, oversized window, unsafe names and a blocked save directory. The helper uses legacy-compatible syntax, but its Python 2 interpreter and Metin2 integration have not been executed. Run the included test_window_position.py, then check first login, close/reopen, resolution change and a second character in a disposable client. No game binary was run.
Credits and variant identity
The public release reference credits Aslan. The owner's supplied file was named Dracarys_Save_Windows_Status_Position.rar; that filename alone does not establish a different original author or an exact upstream revision. M2City claims only the new helper, defensive changes and regression tests. The helper/test licence is separate from the upstream resource.
Editorial resource — M2City
Version: Supplied legacy integration + M2City r1 (2026-11-04); exact client branch unspecified
Rights: Public redistribution confirmed by the supplying owner. Original author notices retained; no new open-source licence granted.
Validation: Archive CRC/SHA-256; source review; nine Python 3.13 helper regression tests. No client build or in-game validation; Python 2 runtime not tested.
Source: Public release reference (credits Aslan)
SHA-256: ec399f09dc5a8f93f25c54adae9168eba820abf942a6a96586024fe3b1c90838
Download package
3 download options · Sign in to download
metin2-window-position-m2city-r1.zipM2City downloadmetin2-window-position-m2city-r1.zipGoogle Drive mirrormetin2-window-position-m2city-r1.zipMEGA mirrorMAKE THE NEXT ANSWER BETTER
What happened on your build?
Share a small example, the exact error and how you verified your fix. The discussion is open on the forum.
Need a scoped quest, UI or proto fix? · Explore more development guides · Check your proto files free