Author SHA1 Message Date
shenandshen 00ebdf0d43 Keep smaller mobile menus along the top edge clear of the original skill arc 2026-10-19 07:15:49 -07:00
shenandshen 24c1b3b416 Integrate AVA2 native shop and refine mobile controls and locale tooltips 2026-10-19 07:13:56 -07:00
shenandshen 1359eab806 feat: integrate native AVA2 battle pass, wiki, drop finder and calendar 2026-10-18 23:36:35 -07:00
shenandshen 62b61bafd0 Complete attribute lock links and active switchbot tooltips 2026-10-18 22:08:48 -07:00
shenandshen e9c26b86c1 docs: record live attr lock view acceptance and fixture restoration 2026-10-18 21:37:48 -07:00
shenandshen 0558166243 feat(mobile): optimize touch skill layout and add auto-hunt HUD and combat entries 2026-10-18 18:23:28 -07:00
shenandshen 82251cb524 feat: add read-only attr lock views for exchange, shop and storage tooltips 2026-10-18 18:23:02 -07:00
shenandshen 708e1c8379 feat: port AVA2 native channel dialog and preserve warp endpoint 2026-10-18 17:05:24 -07:00
shenandshen ab516feb7b Preserve live reconnect endpoints and execute QA commands between frames 2026-10-18 16:43:51 -07:00
shenandshen 95f1c30be2 Complete own-item attribute lock selection and tooltip flow 2026-10-18 16:28:16 -07:00
shenandshen 5decc93798 Port AVA2 native tracker and item-currency ticket shop 2026-10-18 10:41:51 -07:00
shenandshen 83809631ed feat: port native AVA2 chest preview and CG235 pickup flows 2026-10-18 04:01:56 -07:00
shenandshen b61140b8f4 fix: preserve D3D texture addressing in native UI sampling 2026-10-18 03:49:11 -07:00
shenandshen fe6e41dc8e docs: update AVA2 parity gaps and stone relogin acceptance 2026-10-17 23:36:31 -07:00
shenandshen e271e4ba49 feat: import AVA2 spirit stone catalogue and Chinese names 2026-10-17 23:32:59 -07:00
shenandshen a4e96a1559 test: verify switchbot cast speed selection and document probe interference 2026-10-17 17:01:05 -07:00
shenandshen dc24e0e8e1 fix: restore readable dark panels in the AVA2 switchbot window 2026-10-17 16:47:21 -07:00
shenandshen 042bd77413 fix: allow combat state in the packaged auto hunt server patch 2026-10-17 16:40:54 -07:00
shenandshen e446ae8449 feat: add AVA2 minimap buttons and expanded taskbar entries 2026-10-17 16:40:54 -07:00
shenandshen 3efa607908 fix: complete Chinese building names and dragon soul interface labels 2026-10-17 16:40:54 -07:00
shenandshen 9fbeaeb7a2 feat: align travel ring menus and validate destinations against 203 maps 2026-10-17 16:40:54 -07:00
shenandshen 0b828387aa fix: let auto hunt recover from an occupied blocked terrain cell 2026-10-17 05:42:44 -07:00
shenandshen 090dab1fc1 fix: preserve db-specific dungeon rows when installing item patches 2026-10-17 05:02:58 -07:00
shenandshen 108fe17127 fix: import complete sash combine chains and sync isolated db prototypes 2026-10-17 04:55:26 -07:00
shenandshen 790037729f tools(assets): audit original AVA2 FoxFS archives for missing hydra motions 2026-10-16 23:24:59 -07:00
shenandshen 8653edf4c5 feat(quests): add AVA2 travel menu and staged sash compatibility deployment 2026-10-16 23:15:04 -07:00
shenandshen fce6a5e06b fix(assets): include known race model files and audit motion references 2026-10-16 23:14:48 -07:00
shenandshen ae0fc25a81 perf(autohunt): avoid discarded A-star searches for attack sight lines 2026-10-16 23:14:48 -07:00
shenandshen b9f5d737cb fix(client): drain flying objects before effect shutdown 2026-10-16 23:12:13 -07:00
shenleiandClaude Opus 5.5 569afb1378 Level 120: autohunt large targets, boss hit range, QUEST_INFO size
- QUEST_INFO: take the full packet size from the flags (server built it short)
- Bosses get the huge-race 500 centre hit test, like AVA2 IsBoss()
- Autohunt: defending reach as body size for large targets, walk straight
  at a body in reach when the planner finds no path, escalating skip for a
  target it keeps stalling on, new anchor after a teleport, immune skip only
  on an explicit 0-damage packet
- ava2-dungeons README: hydra range notes, snow key stack note

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 11:59:54 +09:00
shenleiandClaude Opus 5.5 a1e7da68a4 Level 120 (L1-L5): AVA2 maps, drops, dungeons, dungeon timer UI
- tools/server/level-120: sbtest install of the 120 exp table and the
  unsigned exp column.
- tools/server/ava2-maps: the 10 AVA2 maps (pack, map data, regen, designed
  drops) for sbtest; Ava2MapsScript.inc, gr2 texture and mob_proto tests.
- tools/server/ava2-dungeons: snow / ship defence / Meley quests ported from
  AVA2 (make_quests.py + install.sh).
- mt_dungeon_timer (DungeonTimerScript.inc): AVA2 dungeon timer in place of
  the minimap (RefreshDungeonTimer) and the hydra mast HP bar (gethydrahp).
- Autohunt skips a target that is hit but takes no damage for 4 s (blocked
  Meley statues) and keeps it skipped for 60 s; FindCloseTarget now honours
  the skip list.

Meley full run passed on sbtest with the Mac client. Not deployed live.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 08:13:32 +09:00
shenleiandClaude Opus 5.5 657e49e52a Switchbot: sbtest isolated test cluster scripts + live test results
tools/server/sbtest/{setup,restart,rollback}.sh build and manage the isolated
203 test cluster (db :15040, auth :11040, channel5 on *_sb schemas with the
unlocked AVA2 protos). Docs record the channel5/sbtest switchbot results:
weapon, ring, talisman, relog (cache + MySQL), same-core warp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 23:03:07 +09:00
shenleiandClaude Opus 5.5 99cf5514c3 Send the switchbot version mark on the EU version packet
Every locale.cfg build takes the EU branch of SendClientVersionPacket, so
"mt20261016" was never sent. The EU timestamp is now
"1215955205 mt20261016": the server's atoi version check still reads
1215955205.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 20:35:08 +09:00
shenleiandClaude Opus 5.5 fc98e6e2b4 Port the AVA2 switchbot window and switchbot module
PythonSwitchbot + PythonNetworkStreamPhaseGameSwitchbot from AVA2 (CG/GC 171,
SWITCHBOT window 7, SLOT_TYPE_SWITCHBOT), uiswitchbot.py verbatim in
SwitchbotScript.inc plus its ENABLE_SWITCHBOT glue (tooltip, mouse/inventory
drag-back, interface/game hooks, zh strings, server switchbot_* messages).
Entry is the minimap 洗练 button; F9 stays with auto-hunt. The client version
timestamp is now "mt20261016" so the server enables the switchbot.
50348/50349 no longer open the window. Adds docs/AVA2-PARITY-PLAN.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 20:26:06 +09:00
shenleiandClaude Opus 5.5 e70a6abf7a Merge main into feature/ava2-unlock
Conflicts resolved by keeping both sides: AVA2 attribute lock materials
(50348/50349) and battle pass tickets from main alongside the unlock
branch's costume enchants, talismans and new rings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 18:14:39 +09:00
shenandshen 507e687867 feat: add MeshPort overlay networking, item actions window, and AVA2 client enhancements
- add MeshPort peer-to-peer overlay networking SDK, C++ integration, and Python bindings
- add item actions quick use/split/delete/lock overlay window (mt_item_actions)
- add shop name range and NPC name visibility settings to system display options
- support battlepass ticket activation and month validation in mt_battlepass
- support boss tracking teleport destination button in mt_bosses
- support asynchronous account registration cancellation and pending login cancellation
- update AVA2 item conversion for attr lock scrolls and battlepass tickets
- update .gitignore for local build outputs and caches
2026-10-16 01:29:57 -07:00
shenleiandClaude Opus 5.5 8d01a7a754 AVA2 unlock P8: new rings client (mt_rings, ring slots, item import)
ITEM_TYPE_RINGS / c_Equipment_Rings1/2, mt_rings adds the two slots beside
the shoes, the accessory tooltip and the drill / jewel / switcher / adder drop
targets; make_items imports the four +0..+9 ring chains.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 14:40:40 +09:00
shenleiandClaude Opus 5.5 b9af78ef64 AVA2 unlock P7: talismans (护符) and their attribute items
- ARMOR_PENDANT / APPLY_ENCHANT_* 123-128 / c_Equipment_Pendant (server WEAR_PENDANT 27) constants
- mt_pendant: equipment slot under the earring, drop targets for 71302/53996 (reroll) and 71301/53997
  (add, max 5), MTPENDANT messages; enchant apply texts in mt_applies
- switchbot ignores talismans and talisman rerolls
- make_items keeps the six +0..+200 chains (1206 items) and the four attribute items
- tools/server/pendant: refine sets 440-499 (AVA2 rows) + install.sh

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 14:26:12 +09:00
shenleiandClaude Opus 5.5 a1b63c0afb AVA2 unlock P6: costume enchants (client)
Keep 54001-54078 (body/hair) and 54124-54174 (mount skin) enchants as
USE_CHANGE_ATTRIBUTE; mt_costume_attr marks matching costumes as drop
targets, shows the attribute in the tooltip and renders MTCATTR; the
switchbot no longer lists enchants as scrolls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 14:07:07 +09:00
shenleiandClaude Opus 5.5 1412806ee9 AVA2 unlock P5: mount costume / skin (COSTUME_MOUNT 2, COSTUME_MOUNT_SKIN 4, slots 25/26, mt_mount, npc_mount races)
Keeps 71502/71505/71508/71511 and skins 71234/71254 as costumes, stages the
npc_mount models of races 32012/32028, writes mobs-server.tsv and lets
install_items.py install mob rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 13:58:16 +09:00
shenleiandClaude Opus 5.5 4d7306792e AVA2 unlock P4: sash (mt_sash windows/slot/tooltips, sash module, CHR_EQUIPPART_SASH, item_scale)
Client side of metin2-server FEATURE-AVA2-UNLOCK P4: HEADER_CG_SASH 211 /
HEADER_GC_SASH 215, a fifth awPart WORD in the character packets (old
servers break), the sash part attached by scale per job/sex, the combine
and absorb windows in script mt_sash, and quest tools/server/sash on 20016.
The ava2items pack keeps the four grade-4 sashes plus their effects,
acce window images and item_scale.txt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 13:45:02 +09:00
shenleiandClaude Opus 5.5 0d2a9ebe36 AVA2 unlock P3: dragon armor 21210-21279 (+0..+9) with armor shape 32
Keep ARMOR_BODY rows, import the whole refine chain, ship AVA2's <race>_7_1
models and register shape 32 after each race msm load (mt_shapes): the race
msm are read by bare name from the root pack and cannot be overridden.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 11:13:41 +09:00
shenleiandClaude Opus 5.5 178fcf48fe AVA2 unlock P1/P2: treasure boxes/keys and stone/Boss stones usable
Keep ITEM_TREASURE_BOX/KEY and METIN_NORMAL rows; APPLY_ATTBONUS_STONE 139 /
APPLY_ATTBONUS_BOSS 140 in ItemData.h, item module and tooltip (mt_applies).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 11:05:20 +09:00
shenlei f266072f67 Merge feature/ava2-items 2026-10-16 10:10:50 +09:00
shenleiandClaude Opus 5.5 90f213c4cc Import the AVA2 drop items the server lacks as ordinary 40250 items
tools/server/ava2-items stages the 478 items referenced by the AVA2 drop
tables that 203 does not have: server item_proto/item_names rows, a client
item_proto/item_list/itemdesc patch over the biolog tables, and the AVA2
icons, ground models (BitKnit gr2 via sdk/gr2) and their textures, packed
as ava2items ahead of biolog. Materials, quest items, chests, the guardian
weapons and shoes keep their meaning; items of AVA2-only systems (pets,
pendants, new rings, mounts, sashes, costume enchants, talisman items, new
skill books) become plain ITEM_NONE items until those systems are ported.
Names are translated in names_zh.tsv.

item_proto_patch is the full-record successor of biolog_proto_patch, with
--dump for checking conversions against the shipped table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:10:47 +09:00
shenleiandClaude Opus 5.5 d11d46c469 Fix the zh locale build after the item shapes overlay
A stray comma turned the proto patch argument list into a tuple, so the
build failed with "bad operand type for unary +" since 5dcac9cb. The AVA2
biology step also accepts the reference unpacked under AVA2/TEST instead of
only the FILES+SRC.tgz archive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 09:31:52 +09:00
shenleiandClaude Opus 5.5 8164c02709 Add the battle pass window (mt_battlepass)
战令 window opened by the 战令 button under the minimap or F6: season and
time left, missions with progress and per-mission claim, final reward,
done notices in chat. Talks to the server over /mt_bp 1 / MTBP1 lines and
reports an unsupported server after 3 s without an answer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 09:11:43 +09:00
shenleiandClaude Opus 5.5 84404cf1f1 Model preview: AVA2 render-target window on a Vulkan colour target
Port of AVA2's CRenderTarget / GrpRenderTargetTexture / renderTarget module.
The host gains an RGBA8 offscreen colour pass for D3D colour render targets;
mt_preview shows wearable items on every allowed race and monsters with
motions, reached by X+click in the inventory and shop and from the wiki.
Player races are created as TYPE_PC so their parts exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 04:48:07 +09:00
shenleiandClaude Opus 5.5 32372c2a73 vip-card: back up the proto rows as REPLACE statements only
A plain mysqldump --where also writes DROP/CREATE TABLE, so restoring the
backup would have emptied item_proto down to the two cards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 03:40:50 +09:00
shenleiandClaude Opus 5.5 5dcac9cbd4 Add VIP cards and the VIP panel (mt_vip)
Cards 38001 (7 days) and 38002 (30 days) extend all seven original premium
services of the account; the server side is metin2-server port_premium.h
(docs/FEATURE-VIP.md).

- mt_vip: /mt_vip 1 status, VIP button by the minimap, remaining time per
  service, chat line on card use.
- tools/server/vip-card: 40250 ships both cards with size 0 (two share a
  cell, neither moves); give them one cell, stacking, a log and no NPC sale,
  and name them on the server.
- locale_proto_patch: optional item shape table (size, flags, anti flags)
  so the client proto matches; data/zh_40250/item_shapes_server.tsv.
- Item mall (9010): 7 days 5,000,000, 30 days 18,000,000 gold.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 02:13:15 +09:00
shenleiandClaude Opus 5.5 b14fb2ffe9 Record the batch chest production deploy
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 23:47:50 +09:00
shenleiandClaude Opus 5.5 b8363693f1 Add batch gift box opening window (mt_chest)
Ctrl + right click on an ITEM_GIFTBOX opens a count window (1/10/50/all,
max 200) that sends /mt_chest and sums the MTCH1 gains into chat. Without
Ctrl or against a server without the command the original use runs.
Exports item.ITEM_TYPE_GIFTBOX. Verified live on the 203 channel5 core.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 23:31:03 +09:00
shenleiandClaude Opus 5.5 10f8c9760e Record the attribute lock production deploy
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 23:11:31 +09:00
shenleiandClaude Opus 5.5 a22c064587 Add attribute lock buttons to the switchbot window
Five per-slot toggles next to start/stop, shown only when the server
sends the MTSB1 lock line; locked attributes are marked in the current
attribute line. Server side: metin2-server docs/FEATURE-ATTR-LOCK.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 23:06:00 +09:00
829 changed files with 244785 additions and 3012 deletions
+14
View File
@@ -44,3 +44,17 @@ __pycache__/
/android/app/build/
/android/build/
/android/local.properties
/Client/autohunt.cfg
# MeshPort private network identity; SDK build output normally lives under /build.
/config/meshport.private.toml
/third_party/meshport/target/
# Local build outputs, caches and legacy restructure leftovers
/build_*/
/.codex/
/android-native/
/extension/
/script/
/test/
+1
View File
@@ -30,6 +30,7 @@ endif()
add_subdirectory(third_party)
add_subdirectory(src/codepage)
if(MT_BUILD_PORT OR MT_BUILD_NATIVE_RENDER)
add_subdirectory(src/meshport)
add_subdirectory(src/port)
endif()
+2
View File
@@ -1,5 +1,7 @@
PACK
*
patch_ava2_ui
*
patch1
*
season3_eu
Binary file not shown.
Binary file not shown.
+4 -1
View File
@@ -4,9 +4,10 @@
## macOS
需要 CMake、SDL3、Vulkan loader、MoltenVK、glslc(第三方库均已随仓库提供源码,无需子模块):
需要 Rust 1.95+、protoc、CMake、SDL3、Vulkan loader、MoltenVK、glslc(第三方库均已随仓库提供源码,无需子模块):
```sh
./scripts/build_meshport.sh macos
cmake -S . -B build/release -DCMAKE_BUILD_TYPE=Release \
-DMT_BUILD_NATIVE_RENDER=ON -DCMAKE_PREFIX_PATH=/opt/homebrew
cmake --build build/release --target mt_native_render -j8
@@ -14,6 +15,8 @@ cmake --build build/release --target mt_native_render -j8
--live-client "/path/to/40250/Client" --login-screen --width 1024 --height 768
```
MeshPort SDK 源码在 `third_party/meshport`,无需单独检出 MeshPort 项目。频道查询、登录、注册、地图/公会连接及 UDP 都在公共网络层判断:同网段直连,跨网段组网,使用 DHCP 动态 IP;远端连接验证成功后提示“组网成功”。私有配置与构建说明见 [docs/MESHPORT.md](docs/MESHPORT.md)。
详见 [src/host/README.md](src/host/README.md)。
## Android
+4
View File
@@ -74,11 +74,15 @@ if [ ! -f "$OUT/sdl3/lib/libSDL3.so" ] || [ ! -f "$OUT/sdl3/.page16k" ]; then
touch "$OUT/sdl3/.page16k"
fi
# --- Embedded application-only networking SDK (source lives in this repository) ---
"$REPO/scripts/build_meshport.sh" android
# --- libmain.so (src/host + port_platform + embedded Python) and its assets ---
cmake -S . -B "$OUT/app-build" -G "Unix Makefiles" -Wno-deprecated \
-DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM="android-$API" "$PAGE_SIZES" \
-DCMAKE_BUILD_TYPE="$CONFIG" -DMT_BUILD_TOOLS=OFF -DBUILD_TESTING=OFF \
-DMT_BUILD_NATIVE_RENDER=ON -DSDL3_DIR="$OUT/sdl3/lib/cmake/SDL3" \
-DMT_MESHPORT_LIBRARY="${MT_MESHPORT_LIBRARY:-$REPO/build/meshport-runtime/aarch64-linux-android/release/libmetin2_meshport.a}" \
-DCMAKE_FIND_ROOT_PATH="$OUT/sdl3" -DGLSLC="$GLSLC" >/dev/null
cmake --build "$OUT/app-build" --target main mt_native_android_assets -j "$JOBS"
@@ -0,0 +1,17 @@
# UI texture addressing, 2026-10-18
Scope: CGraphicExpandedImageInstance::OnRender / SetRenderingRect and the native sampler path. This does not establish full HUD or Windows visual parity.
The full reference ExpandedImageInstance unit was read alongside its platform counterpart. The geometry and UV arithmetic remain unchanged. Reference EterLib/StateManager.cpp SetDefaultState sets stage U/V to D3DTADDRESS_WRAP; the runtime ui.py Board.SetSize expands the texture coordinates to repeat a background. The former native UI descriptor unconditionally used CLAMP_TO_EDGE, producing stretched final-row/column stripes.
UIRenderAddImageNamed now carries stage-0 U/V from CStateManager. Vulkan reuses its D3D sampler cache for non-clamp addressing, preserving independent wrap/mirror/clamp, mip-zero UI filtering and point/linear choice. Direct platform commands retain their previous clamp defaults; the second-stage mask retains clamp. Capture version 11 serializes U/V; version 1–10 remains readable with the old UI clamp behavior.
Validation:
- port_grp_resource_test: repeated UV extent, independent wrap/mirror state and explicit clamp.
- host_ui_sampler_capture_test: version 11 roundtrip and version 10 backward compatibility.
- host.ui_quality regression unchanged.
- `ctest --test-dir build/native -R '^(host.ui_sampler_capture|port.grp_resource|host.ui_quality)$' --output-on-failure`: 3 passed.
- Native macOS sbtest client: the same AVA2 pickup panel lost its stretched stripes and renders the repeated stone texture. Evidence: build/parity-acceptance-20261018/before-ui-address.png and after-ui-address.png, captured through CUA. The icon for persisted affect 705 also renders.
No Android visual acceptance or Windows pixel comparison was performed in this round. Aggregate UI contracts remain PARTIAL.
@@ -0,0 +1,15 @@
# Window lifecycle investigation during AVA2 QA
The scripted reconnect from a QARunner.OnUpdate callback crashed in UI::CWindow::Update on macOS (DiagnosticReports/mt_native_render-2026-10-18-105610.ips). No C++ lifecycle changes have been made in this investigation.
Read and compared CWindow::Update, Clear, DeleteChild and reserve-child removal, plus CWindowManager::DestroyWindow, NotifyDestroyWindow, reserve-deletion drain and Update against the 40250 source. Their update/deletion ordering is unchanged. The test driver invokes login-board focus/order/phase changes inside the window traversal; normal user input is dispatched outside that traversal. This is evidence of an unsafe test/reconnect path, not evidence of a differing port algorithm or a fix.
The acceptance driver now performs a process cold start to validate persisted locks. That cold start and server/db restart read back mask 8, material selection 4 and the preserved fourth attribute. In-process scripted reconnect remains unverified and the crash is retained as an open finding; no global parity status is upgraded.
## Follow-up: frame-boundary commands and endpoint restoration
The live host now optionally consumes `--py-command-file` between script frames while the fiber is parked. This replaces commands executed from QARunner.OnUpdate; it changes no CWindow/CWindowManager algorithm. Commands are size-bounded and consumed before execution so an error cannot repeat the same mutation every frame. Producers publish using atomic rename.
A separate reconnect stall was captured with macOS sample: the host was blocked in gethostbyname, called from LoginWindow.Connect after the original LoginWindow.Open replaced the launch endpoint with the packed login configuration. `mt_live_endpoint` now preserves the explicitly selected/last successful endpoint while that original window opens. Manual server selection and the existing explicit channel-switch flow retain ownership of their targets; account credentials are not copied by the module.
With the new host command boundary and endpoint restoration, the same macOS process completed three logout/login/character-enter cycles against sbtest without a crash or per-cycle address injection. Evidence: build/parity-acceptance-20261018/reconnect-host-pass.json and client-live-endpoint.log. This verifies this scripted reconnect path, not every physical input or arbitrary mutation during CWindow.Update. No 40250 lifecycle parity status is upgraded and no C++ window changes were made.
+11
View File
@@ -0,0 +1,11 @@
{
"active_original_products": 49,
"source_products": 217,
"qa_coins": 0,
"qa_orders": 0,
"qa_awards": 0,
"test_stack": 0,
"test_triggers": 0,
"game_sha256": "56975b48aa2fd40389c57eab84d017b0a2518cf6e1b573d967bf239f4ae04aba",
"db_sha256": "dc940401fe6ccc3410c8d90ce98d2a5bad2e2c023279665bcd664c008d011699"
}
+18
View File
@@ -0,0 +1,18 @@
[
{
"case": "wallet lock timeout",
"status": 6,
"elapsed_seconds": 2.17,
"unchanged": true
},
{
"case": "SQL connection lost before commit",
"status": 6,
"unchanged": true
},
{
"case": "SQL reconnect and persistent order replay",
"status": 0,
"unchanged": true
}
]
@@ -0,0 +1 @@
{"catalogue": 49, "pending": null, "quantity_before": 1, "scroll_before": 0.0, "balance": 0, "scroll_after": 0.06876790830945559, "quantity_after": 2, "widget_bound_confirmation": true, "all_icons": true}
@@ -0,0 +1 @@
{"quote": [900001, 1, 29, 71084], "confirmation": ["\u8d2d\u4e70 \u7269\u54c1\u5c5e\u6027\u8f6c\u6362\u79d8\u7c4d\uff1f", "\u4ef7\u683c\uff1a29 \u9f99\u5e01"], "display": ["\u539f\u4ef7 58\uff08\u4f18\u60e0 50%\uff09", " 29 \u9f99\u5e01"], "confirm_button": "\u786e\u8ba4"}
+27
View File
@@ -0,0 +1,27 @@
{
"at": 145.56300354003906,
"balance": 9749,
"dropped": [
{
"status": 0,
"token": "25f1ade2e0549b0e3f9e899b8dd84b1e",
"balance": 9749,
"time": 123.39399719238281
}
],
"pending": null,
"replies": [
[
"25f1ade2e0549b0e3f9e899b8dd84b1e",
0,
9749
]
],
"assertions": {
"one_additional_order": true,
"one_additional_unit": true,
"deducted_exactly": 29,
"same_token_replayed": true,
"pending_cleared": true
}
}
@@ -0,0 +1 @@
{"labels": ["[F5] \u526f\u672c\u4fe1\u606f", "[F6] \u6218\u6597\u901a\u884c\u8bc1", "[F7] \u751f\u7269\u5b66\u5bb6", "[F8] \u70b9\u51fb\u6362\u7ebf"], "passed": true, "encoding": "native locale bridge"}
+10
View File
@@ -0,0 +1,10 @@
{
"original_product": 170,
"vnum": 70002,
"quantity": 2,
"paid": 198,
"wallet_after": 0,
"award_rows": 2,
"each_award_count": 1,
"prototype_lookup_correct_after_sort": true
}
@@ -0,0 +1 @@
{"count": 49, "all_prototypes_and_icons": true, "offers": [{"price": 99, "vnum": 70002, "id": 170, "icon": "icon\\item\\70002.tga"}, {"price": 99, "vnum": 71234, "id": 172, "icon": "icon\\item\\71234.tga"}, {"price": 99, "vnum": 71254, "id": 177, "icon": "icon\\item\\71254.tga"}, {"price": 349, "vnum": 71502, "id": 3, "icon": "icon\\item\\71502.tga"}, {"price": 349, "vnum": 71505, "id": 6, "icon": "icon\\item\\71505.tga"}, {"price": 349, "vnum": 71508, "id": 9, "icon": "icon\\item\\71508.tga"}, {"price": 349, "vnum": 71511, "id": 12, "icon": "icon\\item\\71511.tga"}, {"price": 60, "vnum": 54003, "id": 78, "icon": "icon\\item\\54003.tga"}, {"price": 60, "vnum": 54006, "id": 79, "icon": "icon\\item\\54003.tga"}, {"price": 60, "vnum": 54009, "id": 80, "icon": "icon\\item\\54003.tga"}, {"price": 60, "vnum": 54012, "id": 81, "icon": "icon\\item\\54003.tga"}, {"price": 60, "vnum": 54015, "id": 82, "icon": "icon\\item\\54003.tga"}, {"price": 60, "vnum": 54018, "id": 83, "icon": "icon\\item\\54003.tga"}, {"price": 60, "vnum": 54021, "id": 84, "icon": "icon\\item\\54003.tga"}, {"price": 60, "vnum": 54024, "id": 85, "icon": "icon\\item\\54003.tga"}, {"price": 60, "vnum": 54027, "id": 86, "icon": "icon\\item\\54003.tga"}, {"price": 60, "vnum": 54030, "id": 87, "icon": "icon\\item\\54006.tga"}, {"price": 60, "vnum": 54033, "id": 88, "icon": "icon\\item\\54006.tga"}, {"price": 60, "vnum": 54036, "id": 89, "icon": "icon\\item\\54006.tga"}, {"price": 60, "vnum": 54039, "id": 90, "icon": "icon\\item\\54006.tga"}, {"price": 60, "vnum": 54042, "id": 91, "icon": "icon\\item\\54006.tga"}, {"price": 60, "vnum": 54045, "id": 92, "icon": "icon\\item\\54006.tga"}, {"price": 60, "vnum": 54048, "id": 93, "icon": "icon\\item\\54006.tga"}, {"price": 60, "vnum": 54051, "id": 94, "icon": "icon\\item\\54006.tga"}, {"price": 60, "vnum": 54054, "id": 95, "icon": "icon\\item\\54006.tga"}, {"price": 60, "vnum": 54057, "id": 96, "icon": "icon\\item\\54006.tga"}, {"price": 60, "vnum": 54060, "id": 97, "icon": "icon\\item\\54006.tga"}, {"price": 60, "vnum": 54063, "id": 98, "icon": "icon\\item\\54006.tga"}, {"price": 60, "vnum": 54066, "id": 99, "icon": "icon\\item\\54006.tga"}, {"price": 60, "vnum": 54069, "id": 100, "icon": "icon\\item\\54006.tga"}, {"price": 60, "vnum": 54072, "id": 101, "icon": "icon\\item\\54006.tga"}, {"price": 60, "vnum": 54075, "id": 102, "icon": "icon\\item\\54006.tga"}, {"price": 60, "vnum": 54078, "id": 103, "icon": "icon\\item\\54006.tga"}, {"price": 60, "vnum": 54126, "id": 183, "icon": "icon\\item\\54126.tga"}, {"price": 60, "vnum": 54129, "id": 184, "icon": "icon\\item\\54126.tga"}, {"price": 60, "vnum": 54132, "id": 185, "icon": "icon\\item\\54126.tga"}, {"price": 60, "vnum": 54135, "id": 186, "icon": "icon\\item\\54126.tga"}, {"price": 60, "vnum": 54138, "id": 187, "icon": "icon\\item\\54126.tga"}, {"price": 60, "vnum": 54141, "id": 188, "icon": "icon\\item\\54126.tga"}, {"price": 60, "vnum": 54144, "id": 189, "icon": "icon\\item\\54126.tga"}, {"price": 60, "vnum": 54147, "id": 190, "icon": "icon\\item\\54126.tga"}, {"price": 60, "vnum": 54150, "id": 191, "icon": "icon\\item\\54126.tga"}, {"price": 60, "vnum": 54153, "id": 192, "icon": "icon\\item\\54126.tga"}, {"price": 60, "vnum": 54156, "id": 193, "icon": "icon\\item\\54126.tga"}, {"price": 60, "vnum": 54159, "id": 194, "icon": "icon\\item\\54126.tga"}, {"price": 60, "vnum": 54162, "id": 195, "icon": "icon\\item\\54126.tga"}, {"price": 60, "vnum": 54168, "id": 197, "icon": "icon\\item\\54126.tga"}, {"price": 60, "vnum": 54171, "id": 198, "icon": "icon\\item\\54126.tga"}, {"price": 60, "vnum": 54174, "id": 199, "icon": "icon\\item\\54126.tga"}], "categories": [1, 2, 3, 5]}
+126
View File
@@ -0,0 +1,126 @@
[
{
"script": "test_applies.py",
"passed": true
},
{
"script": "test_attr_lock.py",
"passed": true
},
{
"script": "test_attr_lock_snapshots.py",
"passed": true
},
{
"script": "test_attr_lock_use.py",
"passed": true
},
{
"script": "test_attr_lock_views.py",
"passed": true
},
{
"script": "test_ava2_channel_registry.py",
"passed": true
},
{
"script": "test_ava2_chest.py",
"passed": true
},
{
"script": "test_ava2_dungeon_track.py",
"passed": true
},
{
"script": "test_ava2_pickup.py",
"passed": true
},
{
"script": "test_ava2_ticket_shop.py",
"passed": true
},
{
"script": "test_ava2_track.py",
"passed": true
},
{
"script": "test_battlepass.py",
"passed": true
},
{
"script": "test_bosses.py",
"passed": true
},
{
"script": "test_calendar.py",
"passed": true
},
{
"script": "test_chest.py",
"passed": true
},
{
"script": "test_cmd_prefix.py",
"passed": true
},
{
"script": "test_costume_attr.py",
"passed": true
},
{
"script": "test_drops.py",
"passed": true
},
{
"script": "test_itemshop.py",
"passed": true
},
{
"script": "test_mount.py",
"passed": true
},
{
"script": "test_native_queries.py",
"passed": true
},
{
"script": "test_pendant.py",
"passed": true
},
{
"script": "test_pickup.py",
"passed": true
},
{
"script": "test_queries.py",
"passed": true
},
{
"script": "test_rings.py",
"passed": true
},
{
"script": "test_sash.py",
"passed": true
},
{
"script": "test_stone_socket.py",
"passed": true
},
{
"script": "test_switchbot.py",
"passed": true
},
{
"script": "test_switchbot_matching.py",
"passed": true
},
{
"script": "test_travel.py",
"passed": true
},
{
"script": "test_vip.py",
"passed": true
}
]
+57
View File
@@ -0,0 +1,57 @@
[
{
"case": "same token replays original purchase",
"status": 0,
"unchanged": true
},
{
"case": "same token changed quantity refused",
"status": 7,
"unchanged": true
},
{
"case": "insufficient coins",
"status": 1,
"unchanged": true
},
{
"case": "weekly quantity limit",
"status": 2,
"unchanged": true
},
{
"case": "monthly quantity limit",
"status": 3,
"unchanged": true
},
{
"case": "stock remaining less than quantity",
"status": 4,
"unchanged": true
},
{
"case": "expired offer",
"status": 5,
"unchanged": true
},
{
"case": "disabled product",
"status": 6,
"unchanged": true
},
{
"case": "missing prototype",
"status": 6,
"unchanged": true
},
{
"case": "price changed after confirmation",
"status": 9,
"unchanged": true
},
{
"case": "award insert failure rolls back wallet stock order",
"status": 6,
"unchanged": true
}
]
+1
View File
@@ -0,0 +1 @@
{"search_matches": 1, "balance": 9852, "subcategories": [[0, 0], [0, 1], [0, 2], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [3, 0], [3, 1], [3, 2], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5]], "catalogue_count": 1}
@@ -0,0 +1 @@
{"after": 2, "confirmed_count": 2, "id": 84, "before": 1}
+16
View File
@@ -0,0 +1,16 @@
{
"device": "Mi 8 Lite",
"android": "15",
"server": "in-process offline fixture; production untouched",
"distance_before": 1550.002197265625,
"distance_spread": 774.980712890625,
"distance_closed": 1549.99169921875,
"position_unchanged": true,
"drawer_touch_opened": true,
"final_skill_layout": "original arc restored per user feedback",
"secondary_menu_visual_scale": 0.72,
"minimum_hit_target_dp": 48,
"native_touch_and_camera_test": "MT_TEST_MOBILE=1 MT_TEST_PINCH=1 MT_TEST_WIKI=1 port_login_flow_test",
"layout_test": "tests/host/touch_layout_test.cpp",
"note": "Pinch and drawer tested with injected Android MotionEvents; final visual layout checked separately on device."
}
+11
View File
@@ -651,3 +651,14 @@
{"date": "2026-09-30", "action": "user-authorized-render-diagnostics", "units": ["UserInterface/PythonApplication.cpp", "GameLib/MapOutdoorRenderHTP.cpp", "GameLib/MapOutdoorRenderSTP.cpp"], "evidence": "7 same-scene MI 8 Lite runs, 42 two-second sample windows. Baseline 4.88 FPS/205.3ms, no terrain 15.45FPS/64.7ms, no scene 30.03FPS/17.7ms; repeated baseline 4.83 FPS. Normal rendering defaults unchanged. See docs/XIAOMI8LITE-RENDER-ISOLATION-20260930.md."}
{"date": "2026-09-30", "unit": "Client/root/uiaffectshower.py", "result": "RUN_AS_IS unchanged; authorized PORT extension for server rates", "evidence": ["src/platform/ScriptLib/ServerBonusScript.inc", "tools/server/autohunt-pull-range/server_bonuses.h", "build/autohunt-fix-test.log", "build/autohunt-fix-mobile-test.log", "build/autohunt-bonuses-android.png"], "finding": "40250 global privileges emit login notices rather than character AFFECT packets; added distinct status channel, packed scripts unchanged."}
{"date": "2026-10-01", "unit": "UserInterface/PythonPlayerAutoHunt.cpp", "action": "user-authorized-extension", "evidence": ["docs/AUTO-HUNT-ENHANCEMENTS.md", "build/autohunt-enhance-test.log", "build/autohunt-enhance-mobile-test.log", "build/autohunt-enhance-mac-build.log", "build/autohunt-enhance-android-build.log", "build/qa/autohunt-enhance-ui/settings.png"], "finding": "Added bounded terrain/scene-collision A* and reachability for combat/loot/return; independent learned skill-ID selection with legacy config migration; optional server restart_here and 5-second/70%-HP recovery; acknowledged dismount/cast/remount batching. Original manual movement and packed Python scripts unchanged. Desktop/mobile fake-server integration and macOS/Android builds pass; real-server soak not claimed."}
{"date": "2026-10-16", "unit": "UserInterface/PythonApplication.cpp:Destroy / PythonBoot::Stop", "action": "fix-host-teardown-order", "finding": "40250 drains flying instances before effects/characters; host previously reset effects before CFlyingManager destruction. Explicit flying and character cleanup fixes live-projectile shutdown; overall Destroy remains DIVERGENT for unrelated omissions.", "evidence": ["tests/port/port_app_loop_test.cpp", "build/followup-shutdown-before.log", "build/followup-shutdown-after.log"]}
{"date": "2026-10-17", "unit": "UserInterface/PythonPlayerAutoHunt.cpp::__AutoHunt_BuildPath", "action": "user-authorized-extension", "finding": "Live snow floor 1 knockback left the player at (18730.742,22544.762), inside blocked attribute row 225. Exact-start-only exemption rejected every path/attack sample, including monsters 90 units away. Permit only the occupied loaded blocked terrain cell, retaining adjacent blocked cells, scene collision and unloaded-data rejection. AutoHunt is an authorized extension, not a newly claimed 40250 counterpart.", "evidence": ["tests/host/autohunt_navigation_test.cpp", "docs/AVA2-FOLLOWUP-20261016.md"], "remaining": "Live dungeon soak pending; no parity status upgraded. Port-map helper script absent on this branch."}
{"time": "2026-10-18T10:49:04.284335+00:00", "event": "platform_fix", "unit": "EterLib/GrpExpandedImageInstance.cpp", "result": "ADAPTED", "reason": "Preserve stage-0 U/V in UI command/sampler path instead of unconditional clamp; repeated Board backgrounds validated on macOS. Aggregate UI remains PARTIAL.", "evidence": ["audit/evidence/2026-10-18-ui-addressing.md", "tests/port/port_grp_resource_test.cpp", "tests/host/ui_sampler_capture_test.cpp"]}
{"time": "2026-10-18T17:58:20.857552+00:00", "event": "lifecycle_investigation", "units": ["EterPythonLib/PythonWindow.cpp", "EterPythonLib/PythonWindowManager.cpp"], "finding": "Scripted reconnect during OnUpdate crashed; relevant window lifecycle group matches 40250. No code changes or status upgrades; use cold-start QA and retain reconnect finding.", "evidence": ["audit/evidence/2026-10-18-window-lifecycle-qa.md"]}
{"time": "2026-10-18T23:43:15.072652+00:00", "event": "platform_endpoint_fix", "unit": "host/live_client + ScriptLib/LiveEndpointScript", "finding": "Preserve explicitly selected live endpoint across login reopen; execute optional local QA commands between parked script frames rather than from window traversal. No original CWindow/CWindowManager code changed.", "evidence": ["tests/wiki/test_live_endpoint.py", "tests/wiki/test_python_command_file.py", "audit/evidence/2026-10-18-window-lifecycle-qa.md", "docs/AVA2-SWITCHBOT.md"], "result": "Three same-process relogins and two cross-core map transfers verified on macOS/sbtest; native cross-channel switching remains pending; no global parity status upgraded."}
{"time": "2026-10-19T00:04:44.204859+00:00", "event": "authorized_ava2_extension", "unit": "ScriptLib/NativeChannelScript", "finding": "AVA2 MoveChannelDialog uses native server warp; map ownership/ports announced by trusted P2P peers. No original CWindow lifecycle algorithm or classic Warp packet changed.", "evidence": ["docs/AVA2-NATIVE-CHANNEL.md", "docs/AVA2-SWITCHBOT.md", "tests/wiki/test_native_channel.py"], "result": "macOS/sbtest CH5-CH6-CH5 active switchbot handover, locked attribute/targets, endpoint retention and disconnected target verified; Android offline build only; no global parity status upgrade."}
{"time": "2026-10-19T04:37:42.044205+00:00", "event": "authorized_ava2_extension", "unit": "ScriptLib/AttrLockViewsScript", "finding": "AVA2 lock-line styling extended to existing exchange, shop/builder, safebox/mall and GM equipment tooltip setters using bounded read-only contextual queries. Base item packets and CWindow algorithms unchanged.", "evidence": ["docs/AVA2-ATTR-LOCK-VIEWS.md", "tests/wiki/test_attr_lock_ui.py", "tests/wiki/test_attr_lock_views.py"], "result": "macOS/sbtest two-player trade/shop/storage and real GM equipment lock highlights verified; ordinary equipment queries and closed contexts denied. 126 client tests and native macOS/Android builds passed; fixtures and temporary test GM removed. Active switchbot/hyperlink lock metadata remains pending; no aggregate parity upgrade."}
{"time": "2026-10-19T05:08:12.881941+00:00", "event": "authorized_ava2_extension", "unit": "ScriptLib/AttrLockSnapshotsScript", "finding": "Owner metadata follows existing item packets; bounded post-entry synchronization bridges loading-phase command loss. Versioned seven-slot chat snapshots and active switchbot lock lines preserve the classic wire layouts and original CWindow algorithms. Chinese active descriptions use measured text width.", "evidence": ["docs/AVA2-ATTR-LOCK-SNAPSHOTS.md", "tests/wiki/test_attr_lock_snapshots.py", "docs/AVA2-PARITY-PLAN.md"], "result": "132 client tests and macOS/Android offline builds passed. macOS/sbtest first-entry sync, immutable link/relay, active roll/stop, slot moves and same-process relogin passed. Final layout measured 348 versus longest text 308; test weapon/902 switchers and original unlocked state restored. Production unchanged; no aggregate parity upgrade."}
{"time": "2026-10-19T06:35:09.108370+00:00", "event": "authorized_ava2_extension", "unit": "ScriptLib/Ava2NativeSystems", "finding": "Vendor active AVA2 uiBattlePassEx, uiWiki/WikiUI, uiDropItem and uiEventCalendarNew; preserve classic SHOP_SIGN39 by moving event payload to GC214, configured-db battlepass persistence, real loaded drop data and original CWindow algorithms. Correct active-versus-legacy protocol mapping.", "evidence": ["docs/AVA2-NATIVE-SYSTEMS.md", "tests/wiki/test_native_systems.py", "tools/ava2-native/sources.json", "docs/AVA2-PARITY-PLAN.md"], "result": "146 client tests, 30 server feature scripts with updated version-marker retest, native macOS/Android offline builds; sbtest mission/final idempotency, persistent native views, drop data, scoped calendar/icon verified. Production game a8d606ea deployed; backup /root/backup-native-systems/20261019-083154. No aggregate parity upgrade; phone not tested."}
{"time": "2026-10-19T13:52:09.182541+00:00", "event": "authorized_ava2_extension", "unit": "ScriptLib/Ava2ItemShop", "finding": "Vendor active uiitemshopnew.py; native GC93 and authenticated GD/DG76, InnoDB wallet/catalogue/order/award transaction, durable token and confirmed quote, bounded atomic decoder, native UI locale/event/scroll/preview adapters. Correct db prototype pointer index after sort. Classic item layout and CWindow algorithms remain unchanged.", "evidence": ["docs/AVA2-ITEMSHOP.md", "tests/wiki/test_itemshop.py", "tools/ava2-native/sources.json", "audit/evidence/itemshop/"], "result": "157 client tests; 31 server feature scripts including native-layout, integer-total and real prototype-index body tests. macOS/sbtest purchase, redemption, refusal/rollback, restart replay, SQL loss/lock timeout, lost-result retry and real widget callbacks verified. 49 original offers with matching IDs/prices/icons enabled only on sbtest; other 168 and recharge/wheel remain closed. Android offline build only; no production deployment or aggregate parity upgrade."}
{"time": "2026-10-19T14:13:41.385041+00:00", "event": "authorized_mobile_ui_fix", "unit": "ScriptLib/MobileHUD and host/TouchController", "finding": "Fix UTF-8 minimap tooltip boundaries. Retain original skill arc per user feedback; smaller secondary menu artwork with 48dp hit targets, compact menus with drawer and native shop entry. Proportional two-finger camera zoom, stationary-stick fix and gesture cancellation.", "evidence": ["tests/wiki/test_minimap_buttons.py", "tests/port/port_login_flow_test.cpp", "audit/evidence/mobile-ui/acceptance.json", "audit/evidence/itemshop/minimap-tooltips.json", "docs/ANDROID-TESTING.md"], "result": "158 Python tests; focused real TouchController/camera offline flow; Mi 8 Lite Android multi-pointer and menu checks. No production deployment or aggregate parity upgrade."}
+2 -1
View File
@@ -4270,7 +4270,8 @@
"2026-09-30: native UI HiDPI font refresh and sampling checks PASS; previous font runtime fails 9 new assertions. Full native CTest: 29 pass, codepage and live login skipped. Actual mac app HD archive/launch/screenshot checks recorded in audit/evidence/2026-09-30-mac-ui-clarity.md. Aggregate HUD parity remains PARTIAL."
],
"notes": [
"2026-10-02: SCREEN waypoint atlas must retain original black RGB under alpha=0; HD minimap.dds colour bleed reproduced, native five-frame waypoint smoke renders clean rings after original-atlas fallback. build/minimap-fix-smoke.png. Full Windows visual parity remains unverified."
"2026-10-02: SCREEN waypoint atlas must retain original black RGB under alpha=0; HD minimap.dds colour bleed reproduced, native five-frame waypoint smoke renders clean rings after original-atlas fallback. build/minimap-fix-smoke.png. Full Windows visual parity remains unverified.",
"2026-10-18: native UI stage-0 wrap/mirror/clamp now follows CStateManager, fixing repeated Board backgrounds. Three focused CTests and real macOS before/after screenshots pass; audit/evidence/2026-10-18-ui-addressing.md. Aggregate remains PARTIAL; Android/Windows comparison outstanding."
]
},
"remaining": [
@@ -46,9 +46,10 @@
"src/platform/EterLib/GrpExpandedImageInstance.cpp:CGraphicExpandedImageInstance::OnRender"
],
"test": [
"tests/port/port_grp_resource_test.cpp"
"tests/port/port_grp_resource_test.cpp",
"tests/host/ui_sampler_capture_test.cpp"
],
"note": "40250: CULLMODE CCW for a mirrored scale, Save/RestoreRenderState SRCBLEND/DESTBLEND per RENDERING_MODE, PDT-stream fill-rect draw. Port: the verbatim vertices plus m_iRenderingMode go to UIRenderAddImage; the Vulkan UI pipeline (cull none) maps SCREEN/COLOR_DODGE to INVDESTCOLOR+ONE and MODULATE to ZERO+SRCCOLOR (ui_batches.cpp). Invariant: same corners, UVs and blend factors."
"note": "40250: CULLMODE CCW for a mirrored scale, Save/RestoreRenderState SRCBLEND/DESTBLEND per RENDERING_MODE, PDT-stream fill-rect draw. Port: the verbatim vertices plus m_iRenderingMode go to UIRenderAddImage; the Vulkan UI pipeline (cull none) maps SCREEN/COLOR_DODGE to INVDESTCOLOR+ONE and MODULATE to ZERO+SRCCOLOR (ui_batches.cpp). Invariant: same corners, UVs and blend factors. 2026-10-18: stage-0 U/V addressing is carried into Vulkan UI descriptors; the prior unconditional clamp stretched Board.SetRenderingRect tiling into edge stripes. Native before/after screenshots and independent wrap/mirror/clamp tests are recorded in audit/evidence/2026-10-18-ui-addressing.md."
},
"CGraphicExpandedImageInstance::SetDepth": {
"status": "PORTED",
@@ -38,6 +38,9 @@
"status": "PORTED",
"impl": [
"src/port/EterPythonLib/PythonWindow.cpp:CWindow::Clear"
],
"evidence": [
"audit/evidence/2026-10-18-window-lifecycle-qa.md"
]
},
"CWindow::DestroyHandle": {
@@ -68,12 +71,18 @@
"status": "PORTED",
"impl": [
"src/port/EterPythonLib/PythonWindow.cpp:CWindow::__RemoveReserveChildren"
],
"evidence": [
"audit/evidence/2026-10-18-window-lifecycle-qa.md"
]
},
"CWindow::Update": {
"status": "PORTED",
"impl": [
"src/port/EterPythonLib/PythonWindow.cpp:CWindow::Update"
],
"evidence": [
"audit/evidence/2026-10-18-window-lifecycle-qa.md"
]
},
"CWindow::Render": {
@@ -176,6 +185,9 @@
"status": "PORTED",
"impl": [
"src/port/EterPythonLib/PythonWindow.cpp:CWindow::DeleteChild"
],
"evidence": [
"audit/evidence/2026-10-18-window-lifecycle-qa.md"
]
},
"CWindow::SetTop": {
@@ -146,12 +146,18 @@
"status": "PORTED",
"impl": [
"src/port/EterPythonLib/PythonWindowManager.cpp:CWindowManager::NotifyDestroyWindow"
],
"evidence": [
"audit/evidence/2026-10-18-window-lifecycle-qa.md"
]
},
"CWindowManager::DestroyWindow": {
"status": "PORTED",
"impl": [
"src/port/EterPythonLib/PythonWindowManager.cpp:CWindowManager::DestroyWindow"
],
"evidence": [
"audit/evidence/2026-10-18-window-lifecycle-qa.md"
]
},
"CWindowManager::IsDragging": {
@@ -296,12 +302,18 @@
"status": "PORTED",
"impl": [
"src/port/EterPythonLib/PythonWindowManager.cpp:CWindowManager::__ClearReserveDeleteWindowList"
],
"evidence": [
"audit/evidence/2026-10-18-window-lifecycle-qa.md"
]
},
"CWindowManager::Update": {
"status": "PORTED",
"impl": [
"src/port/EterPythonLib/PythonWindowManager.cpp:CWindowManager::Update"
],
"evidence": [
"audit/evidence/2026-10-18-window-lifecycle-qa.md"
]
},
"CWindowManager::Render": {
@@ -301,7 +301,8 @@
"impl": [
"src/platform/UserInterface/PythonApplication.cpp:CPythonApplication::Destroy"
],
"note": "Empty and never called: the host tears down through the singleton resets in PythonBoot::Stop, not 40250 Main's app->Destroy(). 40250's body (window manager, SaveConfig/SaveInterfaceStatus writing into the client dir, managers incl. m_LightManager.Destroy(), device) is not run; porting it needs Stop to call it with config writes redirected out of the 40250 client dir."
"note": "Empty and never called: the host tears down through the singleton resets in PythonBoot::Stop, not 40250 Main's app->Destroy(). 40250's body (window manager, SaveConfig/SaveInterfaceStatus writing into the client dir, managers incl. m_LightManager.Destroy(), device) is not run; porting it needs Stop to call it with config writes redirected out of the 40250 client dir. 2026-10-16: PythonBoot::Stop now explicitly drains CFlyingManager before character/effect destruction and destroys characters before their sibling text-tail/item managers. The active-projectile shutdown regression exits 139 before the fix and 0 afterward; remaining CPythonApplication::Destroy omissions retain DIVERGENT.",
"test": "tests/port/port_app_loop_test.cpp"
}
}
}
+7
View File
@@ -0,0 +1,7 @@
[CENTER_ALIGN;FONT_SIZE=20;COLOR=ffd700]龙魂石
[FONT_SIZE=14]打开角色背包中的龙魂石界面查看已有龙魂石。
[FONT_SIZE=14]龙魂石属性、穿戴条件与强化结果以服务器为准。
[FONT_SIZE=14]可通过物品悬浮提示核对等级及效果。
+11
View File
@@ -0,0 +1,11 @@
[CENTER_ALIGN;FONT_SIZE=20;COLOR=ffd700]游戏指南
[FONT_SIZE=14]在左侧选择职业与装备类别,查看强化材料和金币消耗。
[FONT_SIZE=14]搜索框支持物品、怪物的中文名称及编号。
[FONT_SIZE=14]点击物品图标可继续查询其来源,左右箭头可浏览历史。
[FONT_SIZE=14]怪物页展示当前模板属性、模型和服务器实际掉落。
[FONT_SIZE=14]百科右上方可以打开活动日历及掉落来源查询。
+9
View File
@@ -0,0 +1,9 @@
[CENTER_ALIGN;FONT_SIZE=20;COLOR=ffd700]生物学家
[FONT_SIZE=14]点击小地图旁的研究入口可以查看当前研究。
[FONT_SIZE=14]按阶段提交指定材料,冷却和奖励由服务器验证。
[FONT_SIZE=14]完成阶段后领取研究奖励,再进行下一阶段。
[FONT_SIZE=14]有关药水、奖励重选等操作,请查看研究窗口提示。
+9
View File
@@ -0,0 +1,9 @@
[CENTER_ALIGN;FONT_SIZE=20;COLOR=ffd700]第六与第七属性
[FONT_SIZE=14]装备悬浮提示显示该装备已有的全部属性。
[FONT_SIZE=14]自动洗练窗口可以选择目标属性与最低数值。
[FONT_SIZE=14]选择条件后请核对属性名称,再开始自动洗练。
[FONT_SIZE=14]锁定、消耗、洗练结果与停止条件均由服务器验证。
+9
View File
@@ -0,0 +1,9 @@
[CENTER_ALIGN;FONT_SIZE=20;COLOR=ffd700]时装与外观
[FONT_SIZE=14]在左侧时装分类中查询当前客户端支持的模板。
[FONT_SIZE=14]物品悬浮提示显示穿戴限制与属性。
[FONT_SIZE=14]已有模型的装备可在百科中进行预览。
[FONT_SIZE=14]实际可穿戴部位与效果以服务器判定为准。
+11
View File
@@ -0,0 +1,11 @@
[CENTER_ALIGN;FONT_SIZE=20;COLOR=ffd700]掉落查询
[FONT_SIZE=14]怪物详情展示服务器当前加载的掉落物品。
[FONT_SIZE=14]宝箱详情展示该宝箱当前加载的奖励内容。
[FONT_SIZE=14]物品详情可反查怪物及宝箱来源。
[FONT_SIZE=14]掉落查询窗口可搜索物品并预览掉落该物品的怪物。
[FONT_SIZE=14]条件掉落受等级、角色状态、活动等影响;列表不承诺每次掉落。
+15
View File
@@ -0,0 +1,15 @@
[CENTER_ALIGN;FONT_SIZE=20;COLOR=ffd700]活动与战令
[FONT_SIZE=14]活动日历显示服务器已经发布的排期。
[FONT_SIZE=14]点击同一天的活动图标可轮换查看该日活动。
[FONT_SIZE=14]活动时间使用服务器的 UTC 排期,频道与帝国限制显示在详情中。
[FONT_SIZE=14]没有排期时不会自动开启活动或发放奖励。
[FONT_SIZE=14]使用当月战令票可激活战令,任务进度由服务器记录。
[FONT_SIZE=14]任务完成后自动发放任务奖励,背包不足时可重新打开战令重试。
[FONT_SIZE=14]完成全部任务后,在战令奖励页领取最终奖励。
+7
View File
@@ -0,0 +1,7 @@
[CENTER_ALIGN;FONT_SIZE=20;COLOR=ffd700]游戏说明
[FONT_SIZE=14]本百科读取当前服务器导出的公开模板与实际掉落表。
[FONT_SIZE=14]未实现的系统不会提供虚构物品、奖励或活动排期。
[FONT_SIZE=14]玩法和账号规则以本服务器运营方发布的说明为准。
+7
View File
@@ -0,0 +1,7 @@
[CENTER_ALIGN;FONT_SIZE=20;COLOR=ffd700]宠物与坐骑
[FONT_SIZE=14]此分类列出当前模板中已经支持的宠物与坐骑。
[FONT_SIZE=14]空分类表示当前版本没有对应模板。
[FONT_SIZE=14]物品的使用方法、限制与属性请查看悬浮提示。
+1971 -50
View File
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -1,21 +1,21 @@
{
"schema": 1,
"catalogue_sha256": "7efea0e88002d717c5d29174cf264a4ba06b0594561d8d25bd6ab7c091da9159",
"catalogue_sha256": "638070c02e0ce213ff2616a733d241b3c7b32c9a483eaab4bdcde633fbaecc20",
"source_sha256": {
"item_proto.txt": "bf3d2c9d72719f1c222266042766cbe2f3fff8f0951666344181b6add0a31009",
"item_names.txt": "a6888dfdb0be64f8c8112445b4d54e399a0f8e6ca29799ba33b3bb4160adad2a",
"mob_proto.txt": "883a9f877f140e9baead30346b629f2f2c0d7c9c1f538febb2e17f28c9e446ce",
"mob_names.txt": "2c7a5275983268b668e21b9f4e39f6d58ee6fde04ada1cbb4a1fd8315bfad391",
"refine.tsv": "df6d14fb31b7e281434c927cf96413c6471f0c6b93da752d1b20e1bd082990db"
"item_proto.txt": "7d4f5c54983d5ccb5b1db59a734e0c60d7ab6480e807c48c881be39d5769cbd1",
"item_names.txt": "7a616550ec56206dcdc540f20f30ed3725fb6c9d6475dbd1a3b6eaddaa29a4d5",
"mob_proto.txt": "cfd5c9720192f53d230b1b367f20523833392d87bc323388542a5b141a7b3f6f",
"mob_names.txt": "e71e65ebd01a5705978ede20f680f84d7c531e46c18f4fe517da50898281e61b",
"refine.tsv": "2aacbea1021cd0c26ed23cb4af376973c748826a65fc7b9453c97f926affb9da"
},
"items": 5756,
"monsters": 763,
"refine_recipes": 407,
"items": 7510,
"monsters": 870,
"refine_recipes": 467,
"source": "203 public server tables; no player data",
"generator_sha256": "9c4e1b6069179c36c080a1136d65cbe52a8e44b3577fb8391e8404f5162ef40b",
"localization_sha256": {
"item_names_zh.txt": "5604985d7f11039f3d3e38d4e2c07995e80ca3e4f6deb01fe57cd772e9cd0f70",
"item_names_zh_overlay.txt": "5d8396f19e7184fafd691b7a255b328237bddc1cdfda8d3cf8a7b074eb528f83",
"item_names_zh_overlay.txt": "dcaee419bcc23e72e6dcce1c521a48501b3bbd6b1fd26fa925a213d53515df7e",
"mob_names_zh.txt": "fdbfe4b3f3367d5842c0e9bbe0b5e5ea2dbe99fb6e566ef5789f65d3794eab5c",
"mob_names_zh_overlay.txt": "7c44a5f6cff5c3c27c13cc4c7be91d619c20c67a8e091222e13ed392ea18d00b"
},
+23
View File
@@ -54,6 +54,13 @@
服务端 `item_proto.txt` 里改过的物品使用限制(每行 VNUM、限制类型 0、值 0、限制类型 1、值 1;0 = 无,1 = 等级),
由 `locale_proto_patch` 写进客户端 `item_proto`,提示框显示的等级要求与服务端一致。其余字段仍逐字节校验不变。
## 物品占格与标志(item_shapes_server.tsv)
服务端给了新用途、改过占格或标志的物品(每行 VNUM、size、flags、anti flags,数值),由 `locale_proto_patch`
写进客户端 `item_proto`,背包占格和堆叠与服务端一致;只允许这几条记录的这三个字段变化。目前是 VIP 会员卡
38001/38002(`tools/server/vip-card`):40250 原为 size 0,背包里不显示也不能移动。
该表跟在 `item_stones_server.tsv` 后面传入(位置参数),所以需要石头表也存在。
## 物品说明(itemdesc_translate_zh.tsv)
40250 `itemdesc.txt` 的说明列(第 3 列)和摘要列(第 4 列,“Potion production”“Research”)按英文原文整句翻译,
@@ -87,3 +94,19 @@ VNUM 匹配,不复制属性。它与 `server_extracted/database`、`40250_depl
## +6 镶嵌石配置修复(2026-10-02)
当前 203 的 28700~28713 原为 ITEM_NONE,与 server_extracted 备份不同。`item_stones_server.tsv` 恢复备份中的类型、佩戴位置、属性和六个 value 字段;`locale_proto_patch` 只允许这 14 条记录的对应字段变化,其余非名称字段继续逐字节校验。服务端同份配置在 `tools/server/npc-shops/item-mall/stones.tsv`,商店安装时恢复。已有背包内同编号石头也使用新配置。
## 2026-10-17 帮会设施与系统界面汉化补齐
1. **帮会建筑与设施(`guildbuildinglist_zh.tsv`)**:
- 补齐全部 66 项帮会建筑/设施中文译名(熔炉、锻造所、练兵场、力之祭坛、门墙、景观石与木材)。
- 40250 新增的 5 个熔炉(26992–26996)对应译为灵魂水晶熔炉、红玉熔炉、石榴石熔炉、祖母绿熔炉、蓝宝石熔炉。
2. **界面与系统提示词(`locale_game_zh_overlay.txt` & `locale_interface_zh_overlay.txt`)**:
- 补齐 `MAP_AG`/`MAP_BG`/`MAP_CG`(三大帝国帮会属地)。
- 补齐 `PVP_OPTION_PROTECT`(帮会模式)。
- 补齐 `SCREENSHOT_SAVE1`/`SCREENSHOT_SAVE2`(截图保存提示与路径说明)。
- 补齐 `LOGIN_FAILURE_WEB_BLOCK`(封禁提示)及 `MALL_CANNOT_INSERT`(商城道具栏放入限制)。
- 补齐 `TOOLTIP_MEMORIZED_POSITION_ERROR`(坐标记录错误提示)。
- 移除龙魂石标签页英文后缀(`locale_interface_zh_overlay.txt`)。
3. **物品表与描述**:
- 修正 40004(首领召唤戒指)与 38006(魔魔重抽券)中文名。
- `itemdesc.txt` 第 2 列道具名同步填充对应中文名称。
+67
View File
@@ -0,0 +1,67 @@
# VNUM NAME
14013 武器锻造所
14014 防御道具锻造所
14015 首饰锻造所
14033 练兵场
14043 钻石熔炉
14045 火木石熔炉
14046 铜熔炉
14047 银熔炉
14048 金熔炉
14049 玉石熔炉
14050 玛瑙熔炉
14051 珍珠熔炉
14052 白金熔炉
14053 水晶熔炉
14054 紫水晶熔炉
14055 天璨熔炉
26992 灵魂水晶熔炉
26993 红玉熔炉
26994 石榴石熔炉
26995 祖母绿熔炉
26996 蓝宝石熔炉
14061 力之祭坛
14062 力之祭坛
14063 力之祭坛
14100 房子(1)
14101 石墙(1-1)
14102 石墙(1-2)
14103 石墙(1-3)
14104 大门(1)
14105 围墙(1)
14110 房子(2)
14111 石墙(2-1)
14112 石墙(2-2)
14113 石墙(2-3)
14114 大门(2)
14115 围墙(2)
14120 房子(3)
14121 石墙(3-1)
14122 石墙(3-2)
14123 石墙(3-3)
14124 大门(3)
14125 围墙(3)
14200 帮会会标
14201 围墙大门
14202 围墙后壁
14203 围墙左壁
14204 围墙右壁
14300 石头1
14301 石头2
14302 石头3
14303 石头4
14304 石头5
14305 石头6
14306 石头7
14307 石头8
14308 石头9
14309 石头10
14400 木头1
14401 木头2
14402 木头3
14403 木头4
14404 木头5
14405 木头6
14406 木头7
14407 木头8
14408 木头9
1 # VNUM NAME
2 14013 武器锻造所
3 14014 防御道具锻造所
4 14015 首饰锻造所
5 14033 练兵场
6 14043 钻石熔炉
7 14045 火木石熔炉
8 14046 铜熔炉
9 14047 银熔炉
10 14048 金熔炉
11 14049 玉石熔炉
12 14050 玛瑙熔炉
13 14051 珍珠熔炉
14 14052 白金熔炉
15 14053 水晶熔炉
16 14054 紫水晶熔炉
17 14055 天璨熔炉
18 26992 灵魂水晶熔炉
19 26993 红玉熔炉
20 26994 石榴石熔炉
21 26995 祖母绿熔炉
22 26996 蓝宝石熔炉
23 14061 力之祭坛
24 14062 力之祭坛
25 14063 力之祭坛
26 14100 房子(1)
27 14101 石墙(1-1)
28 14102 石墙(1-2)
29 14103 石墙(1-3)
30 14104 大门(1)
31 14105 围墙(1)
32 14110 房子(2)
33 14111 石墙(2-1)
34 14112 石墙(2-2)
35 14113 石墙(2-3)
36 14114 大门(2)
37 14115 围墙(2)
38 14120 房子(3)
39 14121 石墙(3-1)
40 14122 石墙(3-2)
41 14123 石墙(3-3)
42 14124 大门(3)
43 14125 围墙(3)
44 14200 帮会会标
45 14201 围墙大门
46 14202 围墙后壁
47 14203 围墙左壁
48 14204 围墙右壁
49 14300 石头1
50 14301 石头2
51 14302 石头3
52 14303 石头4
53 14304 石头5
54 14305 石头6
55 14306 石头7
56 14307 石头8
57 14308 石头9
58 14309 石头10
59 14400 木头1
60 14401 木头2
61 14402 木头3
62 14403 木头4
63 14404 木头5
64 14405 木头6
65 14406 木头7
66 14407 木头8
67 14408 木头9
+143 -20
View File
@@ -447,30 +447,13 @@ VNUM LOCALE_NAME
27052 新手魔法瓶(小)
27053 新手速攻药剂(小)
27054 新手轻身药剂(小)
28000 屠杀石
28004 偏执石
28008 创伤石
28012 愚钝石
28100 屠杀石
28104 偏执石
28108 创伤石
28112 愚钝石
28200 屠杀石
28204 偏执石
28208 创伤石
28212 愚钝石
28300 屠杀石
28304 偏执石
28308 创伤石
28312 愚钝石
28400 屠杀石
28404 偏执石
28408 创伤石
28412 愚钝石
28500 屠杀石
28504 偏执石
28508 创伤石
28512 愚钝石
28600 鸡血石
28601 羊脂玉
28602 羚角石
@@ -685,12 +668,12 @@ VNUM LOCALE_NAME
31092 超冷怪的皮肤碎片
35000 药草+
35001 虎肝+
38001 VIP特权
38002 抽奖券(今日)
38001 VIP会员卡(7天)
38002 VIP会员卡(30天)
38003 抽奖券(明日)
38004 抽奖重抽券
38005 高级抽奖转盘券
38006 Momo重抽券
38006 魔魔重抽券
38010 金币包
38050 力量宝箱
38051 皇虎水晶
@@ -748,6 +731,7 @@ VNUM LOCALE_NAME
39041 蓝龙的祝福(中)
39042 蓝龙的祝福(大)
39043 超级记忆卷
40004 首领召唤戒指
41005 奥运击剑服(男)
41006 奥运击剑服(女)
41007 德国击剑服(男)
@@ -1898,3 +1882,142 @@ VNUM LOCALE_NAME
7167 七翎扇+7
7168 七翎扇+8
7169 七翎扇+9
# AVA2 spirit stones; preserve special-stone grades and keep non-stone quest items unchanged.
28000 屠杀石+0
28030 鸡血石+0
28031 羊脂玉+0
28032 羚角石+0
28033 虹河石+0
28034 青胆石+0
28035 精石+0
28036 鹰翼石+0
28037 木鱼石+0
28038 龙骨石+0
28039 青石+0
28040 彩芒石+0
28041 鹿影石+0
28042 东海石+0
28043 帝王石+0
28044 破碑之石+0
28045 克首领之石+0
28046 普攻强化石+0
28047 技能强化石+0
28048 普攻抵抗石+0
28049 技能抵抗石+0
28100 屠杀石+0
28104 偏执石+0
28108 创伤石+0
28112 愚钝石+1
28130 鸡血石+1
28131 羊脂玉+1
28132 羚角石+1
28133 虹河石+1
28134 青胆石+1
28135 精石+1
28136 鹰翼石+1
28137 木鱼石+1
28138 龙骨石+1
28139 青石+1
28140 彩芒石+1
28141 鹿影石+1
28142 东海石+1
28143 帝王石+1
28144 破碑之石+1
28145 克首领之石+1
28146 普攻强化石+1
28147 技能强化石+1
28148 普攻抵抗石+1
28149 技能抵抗石+1
28204 偏执石+2
28208 创伤石+2
28212 愚钝石+2
28230 鸡血石+2
28231 羊脂玉+2
28232 羚角石+2
28233 虹河石+2
28234 青胆石+2
28235 精石+2
28236 鹰翼石+2
28237 木鱼石+2
28238 龙骨石+2
28239 青石+2
28240 彩芒石+2
28241 鹿影石+2
28242 东海石+2
28243 帝王石+2
28244 破碑之石+2
28245 克首领之石+2
28246 普攻强化石+2
28247 技能强化石+2
28248 普攻抵抗石+2
28249 技能抵抗石+2
28304 偏执石+0
28308 创伤石+0
28312 愚钝石+3
28330 鸡血石+3
28331 羊脂玉+3
28332 羚角石+3
28333 虹河石+3
28334 青胆石+3
28335 精石+3
28336 鹰翼石+3
28337 木鱼石+3
28338 龙骨石+3
28339 青石+3
28340 彩芒石+3
28341 鹿影石+3
28342 东海石+3
28343 帝王石+3
28344 破碑之石+3
28345 克首领之石+3
28346 普攻强化石+3
28347 技能强化石+3
28348 普攻抵抗石+3
28349 技能抵抗石+3
28404 偏执石+0
28408 创伤石+0
28412 愚钝石+4
28430 鸡血石+4
28431 羊脂玉+4
28432 羚角石+4
28433 虹河石+4
28434 青胆石+4
28435 精石+4
28436 鹰翼石+4
28437 木鱼石+4
28438 龙骨石+4
28439 青石+4
28440 彩芒石+4
28441 鹿影石+4
28442 东海石+4
28443 帝王石+4
28444 破碑之石+4
28445 克首领之石+4
28446 普攻强化石+4
28447 技能强化石+4
28448 普攻抵抗石+4
28449 技能抵抗石+4
28504 偏执石+0
28508 创伤石+5
28512 愚钝石+5
28530 鸡血石+5
28531 羊脂玉+5
28532 羚角石+5
28533 虹河石+5
28534 青胆石+5
28535 精石+5
28536 鹰翼石+5
28537 木鱼石+5
28538 龙骨石+5
28539 青石+5
28540 彩芒石+5
28541 鹿影石+5
28542 东海石+5
28543 帝王石+5
28544 破碑之石+5
28545 克首领之石+5
28546 普攻强化石+5
28547 技能强化石+5
28548 普攻抵抗石+5
28549 技能抵抗石+5
28960 碎石片
+6
View File
@@ -0,0 +1,6 @@
# vnum size flags anti flags: item_proto.txt size/flags changed on our server (tools/server/*), mirrored into the
# client proto by locale_proto_patch so the item takes a cell and stacks like on the server.
# 38001/38002 VIP 会员卡 (tools/server/vip-card): 40250 ships them size 0, no flags; now size 1,
# ITEM_STACKABLE | ITEM_LOG (4 | 8192), ANTI_SELL (256).
38001 1 8196 256
38002 1 8196 256
1 # vnum size flags anti flags: item_proto.txt size/flags changed on our server (tools/server/*), mirrored into the
2 # client proto by locale_proto_patch so the item takes a cell and stacks like on the server.
3 # 38001/38002 VIP 会员卡 (tools/server/vip-card): 40250 ships them size 0, no flags; now size 1,
4 # ITEM_STACKABLE | ITEM_LOG (4 | 8192), ANTI_SELL (256).
5 38001 1 8196 256
6 38002 1 8196 256
+9
View File
@@ -44,3 +44,12 @@ TOOLTIP_SKILL_DURATION 持续时间 : %d秒
TOOLTIP_SP_REGEN 精力恢复量 : +%d%%
TOOLTIP_TIME_CHARGER_FIX 时间充能 %d秒
TOOLTIP_TIME_CHARGER_PER 时间充能 %d%%
LOGIN_FAILURE_WEB_BLOCK 该账号已被封禁,详情请查看官网。
MALL_CANNOT_INSERT 不能将物品放入商城道具栏。
MAP_AG 盛唐帮会属地
MAP_BG 秦皇帮会属地
MAP_CG 汉武帮会属地
PVP_OPTION_PROTECT 帮会模式
SCREENSHOT_SAVE1 已保存
SCREENSHOT_SAVE2 请在截图文件夹(screenshot)中查看。
TOOLTIP_MEMORIZED_POSITION_ERROR 坐标记录错误(%d, %d)
@@ -0,0 +1,7 @@
KEY VALUE
DRAGONSOUL_TAP_TITLE_1 白龙石
DRAGONSOUL_TAP_TITLE_2 火龙石
DRAGONSOUL_TAP_TITLE_3 风龙石
DRAGONSOUL_TAP_TITLE_4 铁龙石
DRAGONSOUL_TAP_TITLE_5 雷龙石
DRAGONSOUL_TAP_TITLE_6 黑龙石
+22
View File
@@ -48,3 +48,25 @@ ANDROID_SERIAL=<serial> python3 tools/perf/run_render_isolation.py build/qa/devi
```
每段排除首个加载后的采样窗口,记录 6 个 2 秒窗口;输出 CSV、截图、内存快照和汇总 JSON,结束后恢复正常登录启动。
## 手机操作与布局(2026-10-19)
根据本轮用户反馈,六个技能保留原先围绕右下攻击键的弧形排列,道具和自动狩猎位置随原技能布局保持一致。
菜单按钮图形缩小28%,同时保留至少48dp触摸区域;头像和战斗按钮不随次要菜单缩小。
角色、背包、好友、设置及商城/更多沿屏幕上缘排列在小地图左侧;较窄画面自动换行。任务、挂机设置、帮助、聊天在“更多”中展开。
左侧保留移动摇杆和主要视野,副本/战令/生物学家入口继续在小地图外环。
场景空白处双指张开拉近、收拢拉远;左右手先后落下均可,界面和战斗按钮优先接收各自手势。
已经推动的摇杆不会被新落下的右手抢作缩放。缩放直接按指距比例改变镜头距离,原镜头距离上限和地形碰撞仍有效。
系统取消触摸或应用失去焦点时清掉残留手势;摇杆停在中心时不再误发送移动。
可重复的离线手势检查(真实TouchController和镜头,未连接正式服):
```sh
cmake --build build/native --target port_login_flow_test -j4
MT_TEST_MOBILE=1 MT_TEST_PINCH=1 MT_TEST_WIKI=1 \
build/native/src/port/port_login_flow_test "$PWD/build/ava2-parity-20261018/Client" "$PWD/build/native/python27.zip"
```
`MT_TEST_PINCH`只运行加载及移动端镜头/折叠菜单验收,跳过无关的频道状态探测和后续经典交互测试。
布局边界和按钮不重叠由 `tests/host/touch_layout_test.cpp` 覆盖不同屏宽、刘海留白和最小触摸尺寸。
+26
View File
@@ -0,0 +1,26 @@
# 2026-10-17 顺序推进验收
## 戒指与中文界面
- 戒指十一分类在普通 QA1017 的真实客户端中显示并自动分页;通过菜单传送盛唐一村,服务端/客户端均确认地图 1,局部坐标 59700,68200(全局 469300,964200)。
- Lua 5.0 沙盒覆盖全部分类、深层坐标、等级限制、关闭、传送限制及打开菜单后状态变化。49 个目的地按 203 的 map/index、Setting.txt 和原地图目录校验;修正迷雾/黑沙互换、升龙谷与恶鬼塔重叠、地图边界落点。
- 帮会功能设施列表显示武器/防具/首饰锻造所及各类熔炉中文;仅打开本地预览窗口,没有发送建造命令。66 条设施名称已打包。
- 龙魂石界面显示“龙魂之石”“白龙石”和中文品质页签;本次只检查界面,不计作龙魂功能/资格任务验收。
- 语言包生成:locale_interface 326/326 键翻译、itemdesc 2182 个文本单元。百科目录已同步汉化变化,避免生成一致性回归失败。
- 截图在忽略目录 build/ordered-acceptance-20261017/{ring-eleven-categories,guild-functional,dragon-soul,switchbot-dark-background}.png。
## 代码和回归
戒指、语言数据及生成器、小地图按钮分开提交。tests/wiki 的 85 项测试全部通过;自动洗练测试现在可定位 AVA2 实际目录,原文对比也已运行。
macOS mt_native_render 构建通过,发布包包含完整资源及私有动态库,使用本地 ad-hoc 签名,不宣称公证。
本轮未做 Android 真机验收,也未将较早的 port.login_flow 既存失败报告为通过。
## 自动洗练与后续能力
详见 AVA2-SWITCHBOT.md 的本日记录:真实 CG/GC 171 放入、洗练材料扣除、停止、目标已满足时自动完成已通过。背景改深灰,真实截图确认白字可读。
正式服二进制哈希仍为 40335e41d466fd7379c805749978ad6df9c82f5673a3e5b8881b3bee8767663d;strings 确认 CSwitchbotManager / switchbot_end,SQL enum 有 SWITCHBOT。此次只对 sbtest 更新戒指及测试核心二进制,正式服未因本轮测试重启。
sbtest 聚怪修复核心:8b3789ef541cede99cd2d2f97af2a724de431b632cb38fdf660ee0e3b3b15673,源码 server b625ba5。尚不宣称完成新核心战斗补拉验收。
仍待:其余实服戒指落点、属性锁定界面和跨核心洗练;原生批量开箱(滑块/Ctrl+Z/1000)、CG235 拾取/70002 状态、uitrack 双标签页。
现有 /mt_chest、/mt_pickup 和两个自建追踪窗口保留,不能当成上述原生功能已经完成。
冰雪前轮日志停在第五层,未使用 GM 清怪,也未完成全程;其结果保留在 acceptance-20261017/snow-run.jsonl,不计为通关。
+33
View File
@@ -0,0 +1,33 @@
# AVA2 聊天链接与活动洗练槽的锁定提示
接续 `AVA2-ATTR-LOCK-VIEWS.md`。参考 AVA2 `root/uitooltip.py` 的锁定行样式、`HyperlinkItemToolTip` 和 `uiswitchbot.SwitchbotItemTab.OverInItem`。保持本服七属性、三孔的物品封包,锁定位仍存于 `player.mt_item_attr_lock`。
## 同步
服务端 `PortAttrLockSend` 在自有物品设置、删除、更新、成功改变锁定和 switchbot 物品更新后发送 `AttrLockItem window cell vnum mask`。与对应物品封包在同一连接中有序发送;客户端保存当时的完整属性/孔快照,只有快照仍一致时才使用掩码。装备窗口和背包窗口共用装备格数据,缓存键统一为 INVENTORY。
初次装载物品时,游戏界面的命令接收器可能尚未存在;`GameWindow.Open` 时发送聊天请求又会被当前的 Game 阶段保护丢弃。因此界面打开后由更新回调延迟一秒发送 `/attr_lock_sync`,只读同步自己的背包、装备和五个洗练槽;收到 `AttrLockSync` 回执即结束。丢失时每2.25秒重试,最多三次。服务端每角色两秒限频,跳过多格物品的占位格,不接收任意角色ID。
只有已支持 AVA2 扩展的客户端收到元数据。SQL读取失败发送mask=-1,客户端清除该缓存;物品删除和断线也清理。没有有效缓存时保持原提示和链接,不把未知状态标成锁定。
## 聊天链接
原生 `player.GetItemLink` 继续生成名称、颜色和头部。有锁定缓存时,链接保存完整七个属性槽(包括空洞与稀有属性),末尾附加 `mtlock1:mask`。点击后使用发送时的固定快照,按 AVA2 的黄色 `<<属性>>` 样式显示;不查询收件人的背包,也不随原物品后续洗练或移动改变。聊天窗口的链接转发同时保留该后缀。
旧格式链接仍调用原始解析器。扩展格式检查确切字段数、vnum/flags/孔的32位范围、属性类型/数值范围和mask0~31;非法扩展隐藏提示并拒绝转发。该链接与原有物品链接一样是展示数据,不用于交易或修改物品。额外字段需要本轮客户端才能显示。
## 活动洗练槽
保留 AVA2 原 `SetSwitchBotItem` 的物品名称和“正在自动洗练”说明,再追加当前锁定行;不把不断变化的普通属性当作实时结果。收到新缓存时刷新,物品快照变更时隐藏旧提示,停止后切回普通装备提示。中文长句按照原ToolTip的实际文字宽度加40像素扩宽并居中,避免欧洲区按空格分词时说明超出边框。对标签页使用弱引用,关闭窗口不会被提示缓存持有。
## 验证与范围
- 客户端 `tests/wiki/test_attr_lock_snapshots.py` 运行实际安装脚本:空属性位/稀有属性、旧链接、非法输入、转发、物品移动、缓存失效、活动提示/停止转换、限次同步和断线清理。
- 服务端 `tests/features/test_attr_lock_snapshots.py` 编译真实发送/同步函数:版本和窗口限制、删除、addon成组锁定、SQL失败、仅本人数据、多格去重和限频。
- 全部132项客户端回归、服务端两个锁定测试、macOS原生构建和Android离线原生构建通过。Android真机按用户要求暂停。
- 最终构建活动提示实测宽度348、最长文字308,边框余量40;`lock-snapshots-layout.json` 记录实际活动槽和mask=8。随后耗材耗尽正常停止,截图 `lock-snapshots-out-of-materials.png` 仅作耗材停止记录,不作为活动提示截图。
- macOS/sbtest 的证据在 `build/parity-acceptance-20261018/lock-snapshots-*.json` 和 `lock-snapshots-proof-accepted.log`;测试驱动及账号配置不进入发行包。
正式服尚未部署本轮代码,AVA2全量系统对齐也尚未完成。后续仍有原生战令、百科/掉落查询、活动日历等条目,见 `AVA2-PARITY-PLAN.md`。
验收后已离线恢复测试武器1900000191的原属性、背包159格、无锁状态和902个洗练道具;原装备1900000015仍在装备槽4。sbtest按原配置重启,现役game为 `8622d6bc…`,正式服仍为 `40335e41…`。备份与 `cleanup-result.json` 在服务器 `/root/deploy-features/20261018-ava2-parity/attr-snapshots`。
+36
View File
@@ -0,0 +1,36 @@
# AVA2 属性锁定提示:其他物品视图
AVA2 `uitooltip.py` 从属性槽7/8取锁定序号,普通属性用 SPECIAL_TITLE_COLOR 和 `<<文字>>` 显示;背包、交易、商店、仓库和装备查看共用这条渲染路径。本项目保持七属性基础封包和独立锁定表,通过只读桥接取得相同的显示信息。
`AttrLockViewsScript.inc` 调用原 tooltip setter 重画完整内容,保留商店价格、仓库 flags 等;只替换锁定属性行的样式。摆摊编辑仍查询自己的背包。使用弱引用保存 tooltip/他人装备窗口,避免 Python 2 含析构对象的引用环。
## 查询契约
保留原 `/attr_lock_info token window cell` 自有物品请求,视图扩展为 `/attr_lock_info token context cell vid`。
| context | 范围 | 服务端约束 |
| --- | --- | --- |
| 101 | 自己的交易栏 | 当前互相关联的交易,按显示格查找,物品仍属自己且处于交易中 |
| 102 | 对方的交易栏 | 同一交易的对手,只查已摆出的物品 |
| 103 | 当前玩家商店 | 查询者仍是访客,物品仍属于店主,ID/vnum与在售记录一致 |
| 104 | 自己的仓库 | 仓库已加载,格子在实际容量范围内 |
| 105 | 自己的商城仓库 | 商城仓库已加载,格子在实际容量范围内 |
| 106 | 他人装备查看 | 沿用当前服 do_view_equip 的GM权限,只能取装备槽;vid为已查看的角色 |
除106外,vid必须为0;不能用其他玩家ID查询背包、仓库或交易以外的物品。每个角色每秒至多一次查询,SQL首次加载失败返回-1,不能当作“没有锁定”。旧服务端忽略新上下文时,仍显示原始物品内容。
客户端收到回复时检查请求序号、视图、格子、vnum、属性/孔快照和容器代次。交易/商店刷新、关闭、仓库关闭以及装备查看内容变化会隐藏旧提示;迟到回复不能把已关闭视图重新染色。断线清理全部视图状态。
## 验证
- 服务端 `tests/features/test_attr_lock_views.py` 直接编译实际查询、显示格查找和访客物品函数,验证归属、访客关系、非连续显示格、关闭容器、GM权限、非法参数、限频和SQL失败。
- 客户端 `tests/wiki/test_attr_lock_views.py` 执行实际嵌入脚本,验证各视图高亮、价格保留、刷新/关闭后的迟到回复,以及弱引用释放。
- macOS 两个独立普通QA角色已完成双方交易、自有摆摊预览、查看在售物品、仓库管理员正常开仓和商城仓库提示;高亮值为第4条 `(4,6)`,mask=8。另验证关闭交易/商店后的请求没有返回物品信息,普通玩家无法查询他人装备锁定信息。
- 另在独立 `common_sb` 临时授权QA角色,真实 `/view_equip` 查看另一角色已装备武器,确认context106返回mask=8并显示锁定行。原摆摊预览和在售提示都保留12345价格。交易内容刷新使旧提示隐藏,商城/仓库关闭清理状态。
- 本机证据:`build/parity-acceptance-20261018/attr-view-*.json`、`peer/attr-view-*.json`、`attr-view-exchange-live.png`、`attr-views-warehouse-proof.log`。测试驱动不进入发行包。
客户端126项回归、macOS及Android离线编译通过。首个驱动曾用多格物品无效位置、基线禁用的交易删除接口及未经过NPC的仓库密码请求,均未据此修改业务逻辑;最终真实交易、摆摊和NPC仓库各自完成。GM查看证据为 `peer/attr-view-equipment.json`;驱动未处理原武器交换到159格的占位,最后归位断言未通过。测试后停止缓存并备份、核对两件物品ID及所有者,离线将原武器1900000015恢复装备槽4,测试武器1900000191恢复背包159格,该拖回断言不计为通过。
已移除本轮新增账号、角色、夹具和 `common_sb` 临时GM行,恢复测试武器原无锁状态。恢复操作有SQL备份;sbtest按原CONFIG重启,现役测试game为 `03a7b74a…`,正式服仍 `40335e41…`。清理核对见 `attr-views-cleanup-result.json`;远端备份、日志和结果在 `/root/deploy-features/20261018-ava2-parity/attr-views`。没有修改正式库或正式服二进制。
后续扩展:聊天链接和活动洗练槽的独立锁定元数据接入见 [锁定快照](AVA2-ATTR-LOCK-SNAPSHOTS.md)。手机真机验收按用户要求暂停,正式服尚未部署本轮变更。
+6
View File
@@ -52,3 +52,9 @@
- 副本等地图没有做客户端限制:退出后重新登录由服务端按原规则决定角色位置。
- macOS 桌面客户端没有中文字体,窗口文字显示为 `?`。
- Android 真机测试未做。
## 2026-10-18 核实与后续
本地现已提取 AVA2 服务端源码,旧文“服务端源码不在本机”已过时。启用的路径是 do_cmd(SCMD_CHANGE_CHANNEL)→3秒事件→CHARACTER::MoveChannel;原生 uisystem.ChangeChannelWindow 发送 /move_channel。另一个 do_change_channel/ChannelSwitch 分支是注释掉的旧代码,不能照它实现。
当前 v1 仍是退出重登,故会停止自动洗练。跨核心地图传送已在双测试核心验证 P2P 续洗;跨频道续洗尚未实现。移植实际启用的路径时需适配203的端口布局,不能直接使用 AVA2 写死的100端口步长。
+46
View File
@@ -0,0 +1,46 @@
# AVA2 原生开箱与拾取接入
更新:2026-10-18。当前仅部署 sbtest;正式服没有替换二进制或原型。整体 AVA2 对齐任务尚未完成。
## 开箱
使用 AVA2 `root/uichestdropinfo.py` 与 `UIScript/ChestDropInfoWindow.py` 的窗口、奖励分页、数量滑块和 `/chest_drop <window> <cell> <count>`。Ctrl+右键预览;Ctrl+Z+右键直接请求当前堆。触屏道具操作菜单继续连接同一个窗口。服务端移植 `OpenChest`、`GiveItemFromSpecialItemGroupNew`、`AutoGiveItemChest`,新界面不再走 `/mt_chest`。
GC66 的原始布局是 1 字节包头、DWORD 总长度、宝箱 VNUM、奖励条数、VNUM/数量对。接收端先缓存完整帧,再验证条数与总长。掉落缓存随会话清空,迟到响应不会打开关闭的窗口或覆盖另一个宝箱。预览按原版 5×8 网格及物品高度分页。
当前基础包保留 BYTE 物品数量和 200 单堆上限。请求上限为 AVA2 的 1000,但实际只能开启当前格持有的数量,不能声称已支持单堆 1000。大于 200 的奖励拆成多堆;非堆叠奖励逐个创建,MAKECOUNT 的最小数量不会造成循环下溢。没有改动其他基础物品封包。全服扩大单堆数量仍是后续协议迁移项。
适配中的修复:滑块不会发 0;空格和替换道具拒绝;交易、锁定、已装备、死亡、观察、传送、商店/仓库/合成状态拒绝;保留基础服等级、竞技场和龙魂资格限制;已有和批次新建的堆均检查孔值;奖励提示走可本地化的服务端命令。原版特殊组的金币/经验/异常效果仍经过对应分支,不把旧版逐个 UseItem 冒充原生发奖。
## 拾取
原生 CG235:5 字节头(BYTE header + DWORD count),后接 count 个 DWORD 地面 VID 和常规序列字节。按 AVA2 的客户端收集范围、所有权筛选、500ms 发送间隔发包,服务端最终检查地面状态、距离、所有权、角色状态和分类。计数上限及乘法检查在读 VID 前完成。
原版 `game_option_0_1.py` 面板提供 18 个“忽略分类”;bit 0 开启,bit 1–18 分别为武器、铠甲、盾、戒指、头盔、手镯、项链、耳环、时装、宠物/坐骑、肩带、护符、书、灵石、金币、宝箱、鞋、腰带。修正 AVA2 服务端“宝箱分类使用 ITEM_METIN”的明显误写。设置通过 `/setpickupmode` 与 `PickUPMode` 回传,原有 `/mt_pickup` 只保留旧客户端兼容。
为了保留当前 DB 基础结构,mode/rarity 使用现有角色 quest 标记 `ava2_pickup.mode` / `.rarity` 持久化,而非扩大 TPlayerTable。客户端早期请求不返回未加载的默认值;QuestLoad 完成后主动同步,提前修改不能覆盖旧值。
70002 按 AVA2 恢复 ITEM_USE/USE_SPECIAL,使用消耗一个并添加 705 状态,持续 30 天;重复使用不消耗。倒计时及原版图标随普通 affect 持久化。AVA2 的此处实现仍由拾取键触发,不声称额外实现了无人操作定时拾取。
当前项目尚无 AVA2 稀有度物品系统,稀有度按钮明确禁用;宠物、未移植时装槽等分类会随相应系统补齐。不能把这部分算作全部能力完成。
## 公共 UI 与资源
`Ava2UICompatScript.inc` 补入原版 SetListText/text_x 分支,避免复选框标签盖住勾选框。原始窗口资源进入 ava2items。v1/v2 `.sub` 的图集依赖递归入口统一解析并复制到 `ui/ava2_native/`,不覆盖基础 UI 同名图集;缺依赖时打包失败,避免发布后窗口 Abort。经典窗口脚本未改。
底层背景拉花另见 `audit/evidence/2026-10-18-ui-addressing.md`:UI 采样现在保留 D3D8 U/V wrap/mirror/clamp。
## 验证与部署边界
- 客户端 Python UI/数据回归 92 项通过;物品导入与图集依赖 20 项通过;原始 138 条石头审计继续通过。
- 两个服务端测试直接编译执行生产路径:开箱覆盖堆叠、孔隔离、空背包/满背包、状态、等级、龙魂资格、450 个奖励拆堆、非堆叠和 MAKECOUNT;拾取覆盖截断、溢出、开关、距离、所有权及宝箱/灵石独立过滤。
- FreeBSD 隔离编译、macOS 原生构建及测试包签名通过。Android arm64 增量原生编译与 debug APK 打包通过,APK 内 libmain.so 哈希与本次编译产物一致;MeshPort 使用现有未修改的缓存静态库,完整脚本因本机无 cargo 不能从头重建 SDK。adb 无设备,未做 Android 真机验收。
- 普通 QA1017 / player_sb:GC66 预览返回 10 条实际奖励;滑块 5 个使宝箱 20→15;真实背包回调的 Ctrl 分支打开窗口,Ctrl+Z 分支使剩余 15→0。修饰键仅在同步测试回调中临时模拟,finally 恢复;不声称已完成物理键盘快捷键验收。
- 真正网络 CG235:忽略灵石时药水取回、灵石留地;取消过滤后灵石取回。第三只手激活、重复不消耗、冷重启测试 db/auth/core 后设置/余量/状态/图标恢复通过。初始化竞态正是在冷重启中发现并修复。
- 证据在忽略目录 `build/parity-acceptance-20261018/`;私有驱动和登录凭据不随资源包发布。
- 测试构建目录 `/root/deploy-features/20261018-ava2-parity/`。70002 两套原型备份 `backup-pickup-proto/`;测试物品与 QA 原始道具快照 `fixture.json` / `qa-items-before.json`。
- 回退只操作 sbtest:停止测试集群,恢复上述 conf/db 原型备份,channel5/first/game 指回 sbtest/game.ava2-stones,再启动测试集群。不得覆盖正式服 share/bin/game。
Android 测试 APK 在 android/app/build/outputs/apk/debug/app-debug.apk;配套资源为 build/ava2-parity-20261018/Client。连接设备后应显式用 `android/push-client.sh --locale zh build/ava2-parity-20261018/Client` 同步配套资源,再以 sbtest 端口启动;本轮没有安装到设备或改动其数据。
下一项是原版 uitrack 双页及其权威服务端数据;其他系统仍按 AVA2-PARITY-PLAN 逐项推进。
+45
View File
@@ -0,0 +1,45 @@
# AVA2 批量开箱适配进度(v1)
2026-10-15。修改了 metin2-client 和 metin2-server,AVA2 代码只作参考(`ENABLE_MULTI_CHEST`:`uiinventory.py` 的 Ctrl + 右键、`uichestdropinfo.py`、服务端 `do_chest_drop` / `CHARACTER::OpenChest`)。服务端规则和协议见 `metin2-server/docs/FEATURE-CHEST.md`。
## 与 AVA2 的差异
| 项目 | AVA2 | 本实现 |
| --- | --- | --- |
| 触发 | Ctrl + 右键打开带滑块的窗口;Ctrl + Z + 右键直接开整叠 | Ctrl + 右键打开数量窗口(1 / 10 / 50 / 全部),点“开启”;没有直接开整叠的组合键 |
| 命令 | `/chest_drop WINDOW CELL COUNT` | `/mt_chest 1 open CELL COUNT`,不新增包头 |
| 开箱过程 | 重写的 `GiveItemFromSpecialItemGroupNew` / `AutoGiveItemChest`,单次最多 1000 | 每个礼盒都调用原 `UseItem` 礼盒路径,检查、奖励组抽取、金币/经验、日志、扣除都不变;单次最多 200 |
| 范围 | 一叠 | 同一种礼盒,先开选中的格子,再开背包里其他格子(203 上多数礼盒不叠加) |
| 背包满 | 由 AutoGiveItemChest 处理 | 每开一个前要求至少 3 格空位,不足就停止,奖励不会掉在地上 |
| 不允许批量 | — | 奖励组含刷怪、怪物组、减速、中毒、吸血的礼盒,以及非 ITEM_GIFTBOX 的物品(例如带任务脚本的宝箱) |
## 客户端
- 模块 `mt_chest`(`src/platform/ScriptLib/ChestScript.inc`),在 `PythonBoot.cpp` 中安装。替换了 `uiInventory.InventoryWindow.UseItemSlot`:按住 Ctrl 右键 ITEM_GIFTBOX 时打开窗口,其他情况调用原方法。原方法本身不使用 Ctrl(联机时检查过它的 `co_names`)。
- `PythonItemModule.cpp` 新导出 `item.ITEM_TYPE_GIFTBOX`。
- 窗口显示礼盒名称、背包内总数、数量按钮(`【】` 表示已选;“全部”最多 200)、开启按钮和上次结果。选中格子里的礼盒被移走时,自动改用背包里同一种礼盒的其他格子。
- 等待回复时,以及两次发送间隔不足 0.5 秒时,“开启”按钮不可用。
- 结果:聊天框一行“开启 N 个,金币 +N(停止原因)”,之后每行最多 5 种获得的物品(名称 ×数量)。单个礼盒的提示由服务端暂存,不再逐条刷屏;被原路径拒绝时转发一次拒绝提示。
- 3 秒没有回复:在聊天框提示一次“服务器尚未启用批量开启”,之后 Ctrl + 右键也走原来的单个使用;再收到回复会自动恢复。
- 经验不在汇总里(服务端只汇报背包物品和金币变化)。
## 证据
- `tests/wiki/test_chest.py`(CTest:`port.chest`)共 6 项通过,覆盖:
- 发送一次、等待回复、获得行累积到 done、数量上限 200、负的金币差、发送间隔;
- error 解析,畸形行和其他前缀;
- 超时后标记不支持,迟到的回复会恢复;
- 聊天汇总行(停止原因、金币、每行 5 种);
- 钩子:不按 Ctrl 和非礼盒走原方法,Ctrl + 右键礼盒打开窗口,“全部”,选中格子消失后改用其他格子,命令拦截,超时后回退,窗口关闭;
- 与服务端 `port_chest.h` 的常量、错误码和停止原因一致。
- `tests/wiki` 全部 57 项通过(1 项跳过)。
- 2026-10-15 在 203 channel5 测试核心(13040,独立二进制)用 macOS 客户端以 [SA]Admin 联机验收,礼盒用 `/item` 生成:
- 50037(可叠加,30 个)开 10 个:`done 50037 10 10 done 0`,获得 6 种物品,背包差值与 `MTCH1 got` 完全一致;
- 50070(不叠加,4 个分在 4 格)开全部:`done 50070 4 4 done 100000`,跨格子全部开启,金币 +100000 与余额变化一致;
- 71036(奖励组刷怪):`error kind`,没有扣除;
- 连发两条命令:第二条 `error rate`;
- 50037 剩余 20 个开全部:`done 50037 20 20 done 0`,获得 11 种;
- 不按 Ctrl 右键:原单个使用,礼盒正常扣除;
- 日志库只有原路径写的 `SYSTEM`、`TREASURE_EXP`、`TREASURE_GOLD` 行;syserr 没有新错误(只有原有的 `new_quest_lv52` LUA_ERROR)。
- 2026-10-15 16:43 部署到 203 正式环境(服务端 bc32475),CH1(13000)用同一场景复验通过(50037 开 10 个 / 剩余 20 个、50070 跨 4 格、71036 拒绝、限速、普通右键不变)。
- 未做 Android 真机测试;触屏没有 Ctrl,暂无触屏入口。
+4 -1
View File
@@ -115,7 +115,7 @@
2026-10-15 后续批次:阶段 0 的只读能力协商、阶段 2/3 的掉落/来源/宝箱查询、阶段 4 属性面板已实现并在隔离环境测试;未部署 203,待联机与真机验收。范围和缺口见 AVA2-READONLY-FEATURES.md。
2026-10-15 再续:龙穴/周任务信息与提醒、共享真实掉落开关的活动日历已实现并在隔离环境验证。副本仅首批龙穴;活动仅月光宝箱/圣诞袜,生产未部署,无生产排期。自动洗练/锁定、战令、模型预览、批量开箱仍待实现。见 AVA2-DUNGEON-CALENDAR.md。
2026-10-15 再续:龙穴/周任务信息与提醒、共享真实掉落开关的活动日历已实现并在隔离环境验证。副本仅首批龙穴;活动仅月光宝箱/圣诞袜,生产未部署,无生产排期。自动洗练/锁定、战令、模型预览、批量开箱仍待实现(2026-10-16:模型预览已实现,见 FEATURE-MODEL-PREVIEW.md)。见 AVA2-DUNGEON-CALENDAR.md。
2026-10-15 自动洗练 v1(阶段 6,不含属性锁定):服务端 mt_switchbot 逐次调用原 UseItem 洗练路径,客户端 mt_switchbot 窗口;隔离环境编译与桩测试通过,macOS 客户端已在 203 测试核心联机验收;未部署 203 正式环境、未做 Android 真机测试。属性锁定仍待存储设计。见 AVA2-SWITCHBOT.md。
@@ -125,3 +125,6 @@
2026-10-15 换线(计划外追加,参考 AVA2 ENABLE_CHANNEL_CHANGE):仅客户端,按原流程 /logout → 登录目标频道(serverInfo 频道表 + 保存的账号)→ isAutoSelect 进入同一角色,不做服务端传送;macOS 客户端已在 203 正式频道 CH1↔CH2 联机验收,未做 Android 真机测试。见 AVA2-CHANNEL.md。
2026-10-15 世界 Boss 追踪(AVA2 uitrack 世界 Boss 页,只读,不含传送):服务端各核心用原 HEADER_GG_RELAY(名字 #mt_boss)共享定时 Boss 刷新点,旧核心忽略;客户端 mt_boss 窗口 + 刷新提醒,查询种类 bosses(能力位 256);已在 203 两个 channel5 测试核心上做跨核心联机验收,正式核心尚未部署。见 AVA2-BOSS.md。
2026-10-15 属性锁定(阶段 6 后半,参考 AVA2 ENABLE_LOCK_ATTR):服务端新表 mt_item_attr_lock(按物品 ID 存锁定掩码,各核心启动时自动建表;不改动物品结构、db 缓存和客户端封包),CItem::ChangeAttribute 保留锁定槽位,手动、自动、GM 洗练全部生效;精炼时锁定随属性复制;最多 2 组,加成武器的 0/1 槽算一组;锁定免费。客户端在自动洗练窗口里加 5 个锁定按钮。已在 203 channel5 测试核心联机验收(洗 10 次锁定的 2 条不变,重新登录后仍在);2026-10-15 16:08 部署到 203 正式环境(服务端 dc71593),CH1 复验通过;未做 Android 真机测试。见 AVA2-SWITCHBOT.md 和服务端 FEATURE-ATTR-LOCK.md。
2026-10-15 批量开箱(阶段 3 的交互子批,参考 AVA2 ENABLE_MULTI_CHEST /chest_drop):服务端 mt_chest 对同一种礼盒(ITEM_GIFTBOX)逐个调用原 UseItem 开箱路径,可跨格子(203 上多数礼盒不叠加),单次最多 200 个,背包少于 3 格空位即停止;奖励组含刷怪/减速/中毒/吸血的礼盒不允许批量。客户端 Ctrl + 右键礼盒打开数量窗口(1/10/50/全部),结果汇总到聊天框。已在 203 channel5 测试核心联机验收;2026-10-15 16:43 部署到 203 正式环境(服务端 bc32475),CH1 复验通过;未做 Android 真机测试和触屏入口。见 AVA2-CHEST.md 和服务端 FEATURE-CHEST.md。
+70
View File
@@ -0,0 +1,70 @@
# 2026-10-16 AVA2 上线后补全记录
基线:客户端 569afb13、服务端 e097b92,均为 feature/ava2-unlock;SDK main 62a5f5a。
## 退出崩溃
`PythonBoot::Stop` 先清空飞行物,再销毁角色及其他管理器,恢复原版 `CPythonApplication::Destroy` 的依赖顺序。飞行物清理附件时仍需访问效果管理器,原来的析构顺序造成已销毁单例访问;角色清理也需在 text-tail/item 管理器之前。
`port_app_loop_test` 在退出时保留一个真实飞行物,修复前退出 139,修复后退出 0;重复 Stop 通过。证据:`build/followup-shutdown-before.log`、`build/followup-shutdown-after.log`。该函数其他未移植行为仍为 DIVERGENT,未提升为完整原版一致。技能要求的 `scripts/port_map.py` 在当前分支不存在,未宣称通过该检查。
## 密集怪物自动狩猎
攻击/技能视线判断以前会对挡住的目标完整运行 A*,随后因不是单段路径而拒绝攻击。现在复用同一条直线与体积检查,挡住时直接返回;真正移动寻路仍完整运行 A*。聚怪检测先执行冷却、状态、HP 等廉价条件,再扫描怪物。
导航回归覆盖开放直线、薄墙、大目标和 240 个被遮挡目标。相同攻击可达性结果下,碰撞查询从 502128 次降为 6432 次(约减少 98.7%)。这是固定场景算法测试,不能代表冰雪副本通关耗时;200 多只怪物楼层仍需无 `/purge` 联机复测。
## 宝箱和动作资源
打包器原来见基础 npclist 已有 9018 就跳过整个模型目录。现在种入所有需要的 AVA2 模型文件,再由资源闭包跳过已存在文件;模型编号已知不再等同于资源齐全。
已实际生成 `build/followup-ava2maps/ava2maps.eix/.epk`(4243 文件),核对包含 hydra_chest 模型、msm、motlist、loop/break/attack/drop 动作及模型引用纹理。用隔离资源目录运行原生假服务器场景,9018 宝箱模型和贴图正常显示,90 帧后正常退出(退出码 0),截图 `build/followup-chest-smoke.png`。该场景不是正式服船防验收。
motlist 现在参与资源依赖检查,maps.json 的 missing_motions 明确列出缺失文件。本机原始 AVA2 目录仍缺少:
- defensewave_hydra_boss/drop.msa(以及原始 drop.gr2);
- defensewave_minihydra/special_attack1.msa(以及对应原始动作模型)。
完整扫描还报告 blue_dragon_red/water_dragon_2.gr2、reddragon_room_boss2/normal_attack.msa、zone/eastplain/gaint_build a_01_d.gr2,以及两个 hydra 地形纹理。未通过复制其他动作冒充原始文件。2026-10-16 已继续核查整个客户端包集合:完成 FoxFS 只读解析,46 个包、94,220 个条目均无这四个动作文件;XML 清单、展开源目录和 FILES+SRC.tgz 服务端备份也无对应文件。八个已有资源通过 XXH32 校验并与源文件逐字节一致,原包 motlist 仍包含缺失引用。详见 `docs/AVA2-RESOURCE-AUDIT-20261016.json` 和 `tools/foxfs/README.md`;不能将该分发包自身的缺失引用归为移植漏拷。VDI 未挂载,不声称已清点其文件系统。
## NPC / sash / 任务函数
实现、安装、回滚和 sbtest 验收边界见 `tools/server/ava2-followup/README.md`。十个地图目的地可通过现有传送 NPC 菜单进入,三个实例副本送到原入口 NPC;sash 沿用已有任务;只补缺失的 GFquestlib 函数。正式服尚未安装。
## 构建与剩余验收
macOS `mt_native_render` 与 Android Release 原生构建均通过,APK 在 `android/app/build/outputs/apk/debug/app-debug.apk`。退出回归、导航回归和 Lua 5.0 测试通过。生成资源包通过,原始缺失资源如实记录。
未完成的验收:补齐原始动作;真实客户端 NPC 与 sash 点击流程;冰雪密集层全程自动狩猎;正式服启用。不能将过去使用 GM 清怪的楼层计为自动狩猎通过。
## 2026-10-17 真实客户端验收进展
使用独立普通角色 QA1017(仅 account_sb/player_sb),未更改 Test 账号或正式服玩家。密码和验收驱动保存在忽略的 build/acceptance-20261017/private,不随客户端发布。
- 铁匠 20016 的说明、合成和属性吸收菜单可用,真实 CG/GC sash 窗口打开。
- 首次验收发现原型导入只选择四件四阶披风,缺少 12 件低阶材料。现在从 AVA2 原始 DumpProto 补齐四组完整合成链;保持 value0 的 1~4 阶与客户端/服务端一致。净化书不在本批开放范围(服务端尚未实现专用清除逻辑)。
- 真实合成:85001 + 85001 → 85002,socket0=5,第二件消耗,金币减少 100000。
- 真实吸收:85004(20%)吸收 19 号武器,武器消耗,socket1=19;该测试武器没有额外属性,尚不能据此认定非零随机属性复制已经验收。
- 退出后数据库确认上述披风结果保存。重登后客户端也确认 socket0=5、socket1=19 保持。
- 传送 NPC 20090 两页菜单显示正常,从「冰雪地下城入口」传送到地图 61,点击 20395、普通玩家单人进入地图 352 成功并扣除门票。
- 首轮冰雪自动狩猎:旧装备、20 组聚怪,第一层很快死亡,未通过。未使用 /purge。下一轮只在隔离 QA 角色使用有备份的战斗测试属性;结果用于功能/流程验收,不代表普通玩家平衡或真实清图速度。
sbtest 独立 db 目录保存原型副本,安装器现在同步并备份这些副本,避免 share/conf 已更新但 db 仍读取旧文件。此次补丁备份:/root/deploy-features/20261017-followup/acceptance/sash-stage/backup;战斗装备原值在同目录 combat-backup.json。
客户端完整资源生成通过(7537 件物品、1468 怪物、4243 地图资源文件),16 项物品回归通过。新增 --ava2-maps-root 支持原始资源的独立展开目录;物品和坐骑原型均支持从原始 FILES+SRC.tgz 读取,不依赖本机 AVA2/TEST 路径。
本批传送/披风任务和新增低阶原型仍只在 sbtest,尚未正式服推广。旧任务点击、冰雪无清怪通关、最终发布包还未完成。
第二轮已由客户端自动狩猎完成第一层,约 210 秒进入第二层,未执行 GM 清怪命令;使用 QA 专用测试装备(武器怪物伤害 +100%、攻击 +5000、暴击/穿透 100;铠甲 HP +30000、防御 +1000、冰抗/格挡/闪避 100),不能据此比较普通装备的效率。日志在忽略目录 snow-run.jsonl。
部署排查修正:整份 conf 覆盖 db 会丢掉原有 db 独有的 25170/30331–30333,第二轮因此无法掉落封印钥匙,已中断。已从最初备份恢复 db,再逐表合并 16 件披风;安装器回归现在明确验证 db 独有行保留。恢复后的磁盘原型已核对四件副本道具,下一次隔离重启加载。第二层及之后不能计为通过。本次事故未涉及正式服。
### 击退进入禁行格时的自动狩猎卡点
第三轮在第一层 (18730.742,22544.762) 卡住,日志持续输出目标距离约 90 却无路径。原始雪地图 attr.atr 确认角色站在禁行的第 225 行,相邻第 224 行可走。原来的“只放行精确起点”无法通过任何后续采样,导致目标选择和攻击视线均被拒绝。
新增 TerrainWalkable 允许离开当前占用的已加载禁行格;相邻禁行格、未加载数据、静态体积碰撞和原来薄墙/拐角检查保持。使用捕获坐标和原属性布局回归:旧回调无路,新回调能到相邻怪物;穿过更深禁区及未知区域仍拒绝。macOS 已重新构建;完整副本复测尚在进行。该模块是用户授权扩展,没有宣称与 40250 逐语句一致。
旧 52 级任务已真实点击“警备队长的信”(任务 144),数据库状态由 letterfromboss 推进到 askbeakgo(574123079),ghostsleft=4。随后地图 61 重登时该状态的 is_destination_village 分支无报错;主城返回 NPC 的正向分支仍需后续确认。
导航专项、聚怪安全检查通过;macOS/Android 原生构建及 APK 封装通过,APK 中 libmain.so 与本次构建逐字节一致。port.login_flow 较大回归失败 29 个检查;临时恢复本次修改前的两个导航源码后重建重跑,失败位置和数量完全一致(频道状态、商店、NPC、仓库),随后已恢复当前源码并重建。该测试不能报告通过,也未将现存失败归为本次导航回归。日志:build/acceptance-20261017/{nav-escape-tests,baseline-login-flow}.log。
+94
View File
@@ -0,0 +1,94 @@
# AVA2 原生商城移植
## 范围与入口
活动版本为 AVA2 `uiitemshopnew.py`,不是旧 `uiitemshop.py` / `uiitemshop_v2.py`。
原始 Python 源码由 `tools/ava2-native/import_sources.py` 转码后原样嵌入,SHA256 记录在
`tools/ava2-native/sources.json`。兼容、汉化及服务端接入位于 `Ava2ItemShopScript.inc`。
桌面入口:**F9**,以及与 AVA2 相同的任务栏圆形商城入口。经典商城仓库入口保留用于领货。
包含八个主分类、17 个子分类、名称搜索、热销、折扣、数量 1–20、购买确认、余额、库存、最近100笔购买记录、可支持道具的模型预览。
鼠标滚轮在商城列表中滚动,指针在商城窗口内时不改变游戏镜头。
充值按钮和幸运转盘保留“尚未开放”提示;不访问 AVA2 提供者的网站,不显示随机假奖励。
它们需要各自的支付服务/奖励池和玩法验收,不能由商城窗口本身代替。
## 协议与经济规则
- 客户端 GC93:5字节头(BYTE + DWORD 长度),总长 6–32768;完整收齐后再分发。
- 原生目录 `TIShopData` 49字节、记录 `TIShopLogData` 90字节。目录/记录整帧验证成功后才替换界面状态。
- game/db 使用空闲 GD/DG76。请求为固定103字节;响应封套包含 account、player、payload size。
- `/ishop data -1`、`/ishop log`,购买扩展为 `/ishop buy id count token quoted_total quoted_vnum`。
token为32位随机十六进制串,绑定一次确认;超时最多重发3次,保持同一token。
- 新客户端标识 `mt20261020`。game 仅接受这个版本及之后的商城请求,避免旧客户端收到未知GC93。
- game按账号/角色构建请求,db再次检查在线账号所属peer和角色归属;返回时校验账号、角色和game阶段。
- db按配置的SQL_ACCOUNT定位龙币,使用配置的SQL_PLAYER连接执行跨库InnoDB事务,禁止硬编码正式库名。
SQL_ACCOUNT/SQL_PLAYER必须指向同一MySQL主机和端口;否则商城拒绝购买。
- 同一事务锁定账号和商品,检查余额、有效期、数量、库存、周/月按件数限购及报价,再扣币、更新库存、写订单和商城发货记录。
- 订单唯一键 `(account_id,token)`。重放同一订单不会再次扣币;更换数量、商品或报价的重放被拒绝。
- 总价统一使用整数:`unit * count * (100-discount) / 100` 向下取整。
修复原版浮点误差(58龙币、五折应为29)以及折扣数量计算不一致。
- 确认框打开后若商品或售价变化,拒绝付款并刷新,不按新价格直接扣款。
- SQL连接在事务期间禁用自动重连,锁等待上限3秒。COMMIT结果不明确时保留原token重试。
- 周期边界采用数据库时区的周一零点/每月一日零点。
- 修复旧db在排序前建立道具指针索引的问题:排序完成后再建立映射,保证目录、堆叠属性和仓库发货使用正确模板。
- 发货插入现有 `item_award`、`mall=1`,沿用商城仓库领取链路;非堆叠物品逐件发放。
背包满、掉线和关闭窗口不删除已付款的发货记录。
未改变经典物品7条属性/3个socket及CWindow算法。当前AVA2对齐整体仍为PARTIAL。
## 商品数据
从 `AVA2/2. Backup SF+SRC and SQL/MYSQL56.tgz` 恢复出 **217条** `player.ishop_data`。
原价、分类、折扣、时间、销量、限购和限量字段保存在服务端
`data/ava2-itemshop/original-products.tsv`,来源散列另见该目录的 `source.json`。
当前服务端模板核对:**55条缺模板,55条对应ITEM_NONE占位物品,107条有实际类型但仍须逐项确认玩法和资源**。
这些数量不能理解为217条商品均可售卖。兼容清单见服务端 `compatibility.json`。
迁移默认将217条全设为停用。已依据现有坐骑、外观强化和拾取实现整理 `verified-products.json`:
**49件原版商品**已在sbtest启用,全部通过当前客户端模板、图标和目录接收验证,售价保持AVA2原价。
包括4件永久坐骑、2件坐骑外观、42件时装/发型/坐骑外观强化石、1件第三只手。
其余168条继续保持停用;实际类型存在不代表对应玩法和模型已经完整。
测试商品900001在验收后撤下。没有给正式玩家发币或上架未完成道具。
## 构建、测试与交付状态
候选客户端:`dist/itemshop/Metin2.app`。Android仅离线编译,按用户要求未测手机真机。
自动化测试覆盖原生布局、截断/重复/越界帧、整数折扣、冻结报价、双击保护、重试和节流。
真实sbtest验收结果及二进制散列见本文件的验收记录。
**正式服仍运行此前的原生战令/百科/日历版本;这次商城尚未部署到正式服。**
正式上线需要先备份账号和发货表,再执行服务端迁移并同步更新game/db;候选客户端不能单独让旧服务端具有商城能力。
## 数据库迁移
服务端运行:
```
python3 tools/ava2-itemshop/migrate.py --player player_sb --account account_sb --output /tmp/itemshop.sql
```
先审阅SQL和备份,再用MySQL执行。正式服使用实际配置的库名,不能照抄sbtest库名。
对已确认实现的49件商品,可另生成并审阅:
```
python3 tools/ava2-itemshop/enable_verified.py --player player_sb --output /tmp/itemshop-enable.sql
```
该脚本核对原商品ID、vnum和实际模板类型,只改开关,不改售价。
迁移将目录、订单、账号和发货表转为InnoDB,并在必要时添加龙币列;重复执行不重置余额、库存、订单或已有商品开关。
回滚二进制时保留订单和发货记录,避免抹掉玩家已付款的物品。不要把账号表改回MyISAM。
## 本轮验收记录(2026-10-19)
158项客户端Python测试和31个服务端功能脚本通过。sbtest确认49件原商品目录、原价、图标、原型一致;
购买、商城仓库领货、非堆叠逐件发货、重复请求、报价改变、余额/库存/限购/过期拒绝、SQL回滚、锁等待和断线恢复均已验证。
故意丢弃一次成功响应后,客户端用同一token重试,数据库只产生一笔扣币及发货。
测试币、订单、发货、道具及触发器已清理;sbtest game/db已重启,正式服二进制保持不变。
具体结果及最新sbtest game/db SHA256见 `audit/evidence/itemshop/`。
小地图F5/F6/F7/F8、扩展栏自动洗练/百科提示统一通过本地代码页桥接。
已在实际客户端确认F7“生物学家”正常显示,修复并非只改源文字。
候选Android包 `dist/itemshop/Metin2-Android.apk`;外置资源增量位于 `dist/itemshop/Client-patch/pack/`。
APK不内含全部游戏地图包,手机安装时另行同步完整的候选Client资源。
+20
View File
@@ -0,0 +1,20 @@
# AVA2 原生换线
客户端采用 AVA2 `root/uisystem.py::MoveChannelDialog` 和 `UIScript/MoveChannelDialog.py`。复用小地图原换线入口;收到服务端 `ChannelList` 后使用原生窗口,点击切换发送 `/move_channel N`。频道号按服务端列表绑定,支持不连续的测试频道5、6。资源由 `make_items.py` 放入 ava2items,包含原选择按钮及其 sub 引用纹理。
服务端按 AVA2 实际启用的 `do_cmd(SCMD_CHANGE_CHANNEL)` 执行3秒倒计时,重复命令取消。倒计时结束再次校验状态,然后 `MoveChannel` 使用现有 `WarpSet` 的保存、移除实体和 P2P 洗练状态转移。不会退出登录或清除洗练目标。服务端拒绝死亡、眩晕、交易/商店/强化等忙碌状态、运行中的任务、受限制地图、私人副本,以及未通告目标地图的频道。
原 AVA2 按100递增端口,不能直接用于203。适配通过同一DB集群的 P2P 核心通告真实游戏端口和 MAP_ALLOW,校验已连接对端的频道/P2P端口身份;5秒心跳、30秒过期,断开立即删除,同频道同地图出现重复归属时拒绝。没有修改经典 GC Warp 封包。
进入核心时服务端主动发送列表,覆盖首次登录和同地图换线。`UpdateServerInfo` 沿用原版命令更新当前频道和文字;扩展 `ChannelEndpoint` 保存目标游戏地址并保留原auth地址,避免换线后退出重登又回到之前频道。私人地图只列本频道;99频道保留只读窗口。没有原生列表的旧服务端继续用现有退出重登入口,该路径会停止洗练,不能视为原生续洗。
## 验证
- macOS/sbtest:CH5:13040→CH6:13050→CH5,洗练active保持1,两个备选目标与第4条锁定值不变,71084为1034→976→919;停止后退回物品并解锁。
- 同频道、未开放频道、重复命令取消、任务选择中的拒绝均已验证;换到6后退出重登仍在6,auth仍11040;关闭6后列表只剩5且拒绝旧目标。
- 客户端回归119项通过:`python3 -m unittest discover -s tests/wiki`,包括地址校验、auth保留、不连续频道、窗口替换、非法列表、99频道和原生按钮命令。
- 服务端路由:`python3 tests/features/test_ava2_channel_registry.py`,覆盖对端身份、地图归属、过期、断开、歧义和原子拒绝非法快照。
- macOS和Android原生编译;Android只离线编译,用户暂停手机验收。
- 截图和联机测试记录在本机 `build/parity-acceptance-20261018`,不会打入客户端包。
正式服部署与验收仍需单独完成。
+35
View File
@@ -0,0 +1,35 @@
# AVA2 原生战令、百科、掉落和日历
用户授权完成这三组界面、测试后更新203正式服;不进行手机真机测试。
## 实现
- 原版脚本:`uiBattlePassEx`、`WikiUI`、`uiWiki`、`uiDropItem`、`uiEventCalendarNew`。原始内容仅转编码/换行;`tools/ava2-native/sources.json` 记录原件哈希。平台和服务器适配另存,原 CWindow 算法未改。
- 战令实际采用 `/battle_pass info|activate|reward|close` 与 `BattlePass*`。230 是另一代旧窗口。当前九种服务端任务映射 AVA2 枚举;现有赛季、任务槽与进度/领取主键保留。原生客户端任务完成自动领奖,满包保留待领,重新打开重试;最终奖励需要点击,重复请求不再发奖。旧 `/mt_bp` 继续兼容。
- 25150~25161 票由真实月份/服务端校验,确认对话后消耗,沿用原激活规则。SQL 使用 PLAYER_SQL 配置的数据库,sbtest 为 player_sb,正式服为 player。
- 百科:当前203公开模板7510物品、870怪物、467强化配方,支持分类、中文/编号搜索、强化消耗、怪物属性、模型、正向掉落和反向来源。当前模板链决定基础编号,非连续石头编号不套用装备连续编号算法。
- 掉落:原生 CG215 固定6字节/GC220固定114字节。子类型6/7正查怪物/宝箱,8/9/10扩展反查宝箱/强化家族。读取实际加载掉落表,不改掉落随机数。条件概率无法用单一百分比表示,因此保持原窗口隐藏的概率栏。
- 查询串行、合并重复、缓存30秒、每请求4096行上限,超时等待终止包后再发下一个;扩展子类型6表示限流/超限错误,不缓存成空结果。断开清缓存和回调。
- 日历:AVA2新日历原GC39与经典摆摊SHOP_SIGN39冲突,使用空闲GC214,保留5字节头/81字节事件结构。只对版本标记mt20261019及以后客户端下发新包。`/event_manager info` 读取与真实掉落共用的UTC区间/频道/帝国规则,15秒刷新,支持原生日历及活动悬浮图标、轮播和倒计时。
- 正式服目前只有月光宝箱/圣诞袜接入真实活动门控。没有发布排期时使用有效空排期,不凭空启用其他活动。头像/时装/百科指南按当前可用内容显示。
- UI 补齐 ImageBox颜色/事件、占位文本、Bar3D、Grid、RenderTarget裁剪和释放;模型裁剪同时更新纹理坐标,避免滚动时拉伸。中文说明与标签随资源打包,原 AVA2 图片保留。
## 验证
- 客户端146项 unittest(包括原件哈希、查询超时/缓存/错误、原子日历解析);服务端30组功能脚本,其中洗练测试的客户端版本断言已更新到19,服务端洗练门槛仍16。
- 实际 C++ 处理器测试:6/114/5/81字节、掉落正反查、强化家族、限流/超限、旧版本拒绝、UTC活动及阵营限制。
- 原战令 C++ 测试扩展:自动任务奖励、旧领取记录不重复支付、满包重试、最终领奖幂等、数据库隔离。
- macOS候选包连sbtest:原生窗口、八任务生产配置、+5石头/护符/普通装备、怪物模型及76行掉落;30006反查4个来源;测试活动两个时段正确显示。2秒在线测试任务自动发奖,最终奖励只领一次,重登仍状态2。
- 测试前后备份并恢复QA1017的全部物品、任务旗标、战令进度/领取行和原赛季配置;测试奖励不进入正式服。
- macOS与Android离线构建;未安装/测试手机。运行日志和私有联机证据位于忽略目录 `build/native-systems-acceptance-20261018`。
## 部署
2026-10-19 08:31:54(203本地时间 CEST,UTC+02)已更新正式服。game SHA256 为 `a8d606ea88731cb5b7bffabbe8ddc78ef806205f6c8a352d78ba6d46a1c6b2f3`,备份 `/root/backup-native-systems/20261019-083154`。auth、13个游戏核心和原db均运行;首次旧核心退出受换页影响超过55秒,未替换程序;等待旧核心正常退出后完成部署。部署使用 `metin2-server/tools/native-systems/deploy.py`,仅切换game与auth,保留db运行,备份游戏程序/排期/战令进度与领取记录。回滚不回退已领取记录,避免重复发奖。
生产活动文件初始化为有效空排期,不复制任何sbtest活动。启动仍有原来的缺失motion accumulation警告,没有新增PORT_BP/查询/Lua错误。手机未测试;macOS正式入口已更新为 `dist/Metin2.app`,旧包保留在 `dist/backups/Metin2-before-native-systems-20261018.app`。Android与四个资源补丁文件位于 `dist/native-systems`。
回滚:`/usr/local/bin/python3.9 /root/deploy-features/20261018-ava2-parity/native-systems/deploy.py rollback --backup /root/backup-native-systems/20261019-083154`。
验收为实际窗口创建、界面截图与控件回调驱动的sbtest联机;未使用正式玩家账号进行登录领奖,生产验收采用所有核心存活/端口/候选hash/新增日志检查。
+171
View File
@@ -0,0 +1,171 @@
# AVA2 客户端对齐计划
日期:2026-10-16。用户要求把现有实现改成按 AVA2 客户端的方式实现。这改变了 `AVA2-FEATURE-MIGRATION-PLAN.md` 的原则:那份计划只把 AVA2 当参考,用聊天命令(`/mt_*`)和自建窗口适配当前服务器。
本文是差异清单和计划,不代表功能已实现或已授权部署。
## 2026-10-17 执行状态
传送戒指、汉化和小地图入口已分别提交;真实客户端检查了十一分类分页菜单、一次主城传送、帮会功能设施和龙魂石中文界面。
戒指共 49 个坐标通过服务端地图矩形及 Lua 5.0 导航检查;不等于 49 次实服落点验收。
自动洗练的新客户端在 sbtest 验证了放入、真实消耗洗练、停止和已有目标自动完成;已修正亮黄底色。
正式服 game 含新版洗练实现,数据库存在 SWITCHBOT 窗口枚举,旧版“未部署”结论已过时;正式服实际操作与跨核心仍待验证。
批量开箱、拾取和追踪面板仍按下方阶段 1 的顺序推进,不能将旧命令窗口算作原生 AVA2 界面完成。
石头首批已按 AVA2 原始 138 条记录移植:128 条非空属性、9 条因职业未移植或原始属性为空而锁定、1 条碎石片;sbtest 镶嵌、消耗、同族互斥、实际属性增量和重登保存已通过。尚未发布正式服,旧 +6 存量迁移、商城、掉落及强化配置仍待处理,详见 tools/server/ava2-stones/README.md。
正式服等级上限已调整为 120,以下不再把旧 105 级上限列作未解决差异。冰雪、船防和赤龙已通过副本及组队进入测试;这不等于原生副本信息界面、排名和全部活动已经对齐。
具体证据和本轮边界见 `AVA2-ACCEPTANCE-20261017.md`。
## 2026-10-18 执行状态
原生开箱窗口、GC66 预览和新发奖路径已接入 sbtest,CG235 和原版 18 分类拾取页、70002/705 状态已接入并做真实联机及冷重启保存验收。详见 [AVA2-CHEST-PICKUP.md](AVA2-CHEST-PICKUP.md)。
仍未完成的边界:基础单堆仍为 200(请求上限 1000),稀有度物品系统未移植,物理快捷键和 Android 真机尚未验收,正式服未部署。下方旧实现描述保留作为迁移前基线,不能据此忽略本段状态,也不能把两项计为全量 AVA2 对齐完成。uitrack 已进入下述联机验收,战令、百科、宠物等仍待推进。
原生 uitrack 双页窗口、五个世界首领刷新、地图 357 和原生门票兑换商店已接入 sbtest;已验证真实刷新/传送/实体、八项价格与实际道具兑换。旧副本增加真实冷却字段兼容,但八个副本的任务和入场条件尚未全部替换为 AVA2。提醒持久化冷启动已通过,Android 真机验收按用户要求暂停,详见 [AVA2-TRACK.md](AVA2-TRACK.md)。
属性锁定已在 sbtest 验证:选第4条、实际消耗、洗练保留锁定值、重复操作拒绝、全测试集群冷重启后读回,以及取消和解锁。实现与边界见 [属性锁定说明](../tools/server/ava2-attr-lock/README.md)。进程内脚本重连的测试命令已移到帧间执行,另修复重新打开登录界面时丢失目标端点,同一进程三次重登通过。交易双方、摆摊/商店、仓库/商城仓库和GM他人装备的锁定提示已接入并完成macOS/sbtest验证,见 [其他视图提示](AVA2-ATTR-LOCK-VIEWS.md);聊天链接和活动洗练槽已补独立锁定快照并完成macOS/sbtest验证,见 [锁定快照](AVA2-ATTR-LOCK-SNAPSHOTS.md)。Android真机按用户要求暂停。
原生换线已接入 sbtest:AVA2 MoveChannelDialog、3秒倒计时和服务端传送,按真实端口/地图归属选核心。macOS验证CH5→CH6→CH5续洗、目标与锁定值保留、实际耗材、重登保留频道和离线目标拒绝;正式服尚未部署,Android仅离线编译。见 [原生换线](AVA2-NATIVE-CHANNEL.md)。
## 1. 对齐的含义
对每个系统都使用 AVA2 自己的实现,参考源码如下:
| 层 | AVA2 来源 | 当前做法 | 对齐后 |
|---|---|---|---|
| 界面 | `pack_maker/uiscript/uiscript/*.py` + `pack_maker/root/ui*.py` | `ScriptLib/*Script.inc` 里自建窗口 | 原样载入 AVA2 uiscript 和 ui*.py,只补当前客户端缺的接口(沿用 m2 UI 窗口模板) |
| Python 模块 | `3. Source BIN/Client/UserInterface/Python*.cpp`(PythonSwitchbot、PythonBattlePass、PythonWiki、PythonDropItem、PythonDungeonInfo…) | 无,状态都在脚本里 | 移植对应 C++ 模块,模块名和接口与 AVA2 相同 |
| 协议 | AVA2 `Packet.h` 的功能包头 | `/mt_<system> 1 …` 聊天命令 | 改用 AVA2 功能包头和包结构;基础包仍是 40250 |
| 服务端 | `2. Backup SF+SRC and SQL/home/Ava2_src/Srcs/Server` | 自写 `port_*.h` | 按 AVA2 服务端源码移植逻辑 |
| 数据 | AVA2 配置与 SQL | 自定义 TSV/表 | 按 AVA2 的 SQL 读写还原表结构,编写迁移脚本 |
AVA2 功能包头号在当前服务端基本空闲,可以直接沿用:
- CG 侧规划时空闲:57、58、143、171、213、215、216、220、221、230、235;其中 171 已由新版自动洗练使用。
- GC 侧规划时空闲:66、171、214、216、217、220、224、230;其中 171 已由新版自动洗练使用。
- 已经占用且号码与 AVA2 相同:CG 211 / GC 215(肩带)、110(副本)、GC 121(频道)。
**不在范围内**(除非另外决定):AVA2 的底层结构,包括 8 个 socket、15 条属性、64 位金币、250 级、征服者等级、角色槽数,以及 40250 基础包号和加密方式。这些会改动物品、角色、DB 和每一个基础包,相当于换一套底座(见 `AVA2-40250-COMPARISON.md` §3–§5、§11)。
## 2. 差异清单
### 2.1 已上线 203 的系统
| 系统 | AVA2 | 当前实现 | 主要差异 |
|---|---|---|---|
| 自动洗练 | `uiswitchbot.py` + `switcher.py`,`PythonSwitchbot`,CG/GC 171,`new_switchbot.cpp`;独立 SWITCHBOT 窗口,5 个物品槽 + 1 个道具槽,0.1 秒/次,换线后通过 P2P 转移继续洗 | `/mt_switchbot`,物品留在背包,一次只洗 1 件,0.25 秒/次,每次调用原 `UseItem`;换线或下线即停止 | 窗口、物品存放(新增窗口类型 = 物品位置枚举和 DB)、协议、速度、换线续洗。**2026-10-16 已在 feature/ava2-unlock 按 AVA2 实现,联机测试通过(武器、戒指、护符、重新登录、同核心换地图;跨核心换线未测);2026-10-17 已确认正式服现役二进制包含实现,当前联机复测见上方执行状态**(`docs/AVA2-SWITCHBOT.md`、服务端 `FEATURE-SWITCHBOT.md`) |
| 属性锁定 | `ENABLE_LOCK_ATTR`:把 50348/50349 拖到装备上,选择属性;锁定信息存在属性数组第 7、8 位;物品提示里显示锁定 | 独立表 `mt_item_attr_lock`;旧洗练窗口按钮已移除 | sbtest已补材料选择及背包、交易、摆摊/商店、仓库/商城仓库、GM装备查看提示;聊天链接和活动洗练槽已补锁定快照并通过sbtest验证,基础七属性结构不变 |
| 批量开箱 | `/chest_drop`,Ctrl + 右键弹出滑块,Ctrl + Z + 右键开整叠;`AutoGiveItemChest`,单次最多 1000 | `/mt_chest`,固定 1/10/50/全部,单次最多 200,逐个调用原 `UseItem` | 窗口、按键、命令、单次上限、发奖路径 |
| 批量拾取 | CG 235 `ITEMS_PICKUP`;70002 自动拾取状态 | `/mt_pickup`,自建 8 类分类窗口,只在按 Z 时触发 | 包、自动拾取状态、分类方式 |
| 世界 Boss | `uitrack.py`(世界 Boss + 副本两页) | `mt_boss` 自建窗口;main 已加入传送 | 窗口改为 uitrack,补上副本页 |
| 战令 | `uiBattlePassEx` + `/battle_pass` / `BattlePass*` 命令,`battlepass.cpp` / `questlua_battlepass`,任务类型以 AVA2 为准;门票 25150–25161 | TSV 赛季 + 自建窗口;main 已加入门票激活 | 窗口、包、任务类型、表结构 |
| VIP 卡 | 待查 AVA2 是否有对应实现 | 自建 | 先确认 AVA2 有没有对应实现 |
| 生物学家 | — | 2026-10-14 已按 AVA2 实现 | 已对齐 |
### 2.2 已实现、未上线的系统(main)
| 系统 | AVA2 | 当前实现 | 主要差异 |
|---|---|---|---|
| 百科 | `uiWiki` + `PythonWiki`(本地资料) | `mt_wiki` 自建窗口 + 只读查询协议 | 窗口与模块整体替换 |
| 掉落查询 | `uitarget` InfoBoard、`PythonDropItem`、CG 215 / GC 220 | `/mt_features REQUEST mob…` | 包与目标栏入口 |
| 宝箱预览 | `uiChestDropInfo` + GC 66 | 查询协议 | 窗口与包 |
| 角色详细属性 | `uicharacterdetails.py` | 自建面板 + 查询 | 窗口 |
| 副本信息 | `uiDungeonInfo` + `uiDungeonTimer`、CG 213 / GC 217、`dungeon_info`,含排名和传送 | 已有冰雪、船防、赤龙等副本和计时;原生信息页未完整移植 | 原生窗口、排名、完整协议与副本覆盖 |
| 活动日历 | `uiEventCalendarNew` + `/event_manager info` / 原 GC39(本服移至 GC214),`char_event_calendar` | 只支持月光宝箱和圣诞袜两种活动 | 活动类型、窗口、GM 管理包 |
| 显示开关 | 包括摆摊、宠物、坐骑的显示范围 | 没有这三项 | 补齐 |
| 换线 | 服务端 MoveChannel 以 GC Warp 传送到目标频道 | sbtest已使用原生窗口和服务端传送,旧服仍回退退出重登 | macOS原生跨频道续洗及重登已通过;正式服部署和Android真机待做 |
| 模型预览 | `uiRenderTarget` | 已按 AVA2 实现(Vulkan) | 基本已对齐 |
### 2.3 `feature/ava2-unlock` P1–P8
| 系统 | 与 AVA2 的差异 |
|---|---|
| 肩带 | 窗口已用 AVA2 的 uisash 和 uiscript;入口放在 NPC 20016 的任务里,AVA2 是 NPC 60003 |
| 坐骑时装 / 外观 | 基本一致;缺坐骑显示范围 |
| 时装强化石 | 武器时装、肩带外观、特效槽三类强化石仍锁着,因为这三个系统还没移植 |
| 护符 | 53996/53997 改成了护符道具,AVA2 里是通用洗练/加持道具;没有元素目标包(目标血条上的元素图标);没有 `uielementchange` / `uielementspelladd`;加入了冰元素,AVA2 没有 |
| 新戒指 | 没有 `item_attr_rare_rings` |
| 龙甲、守护武器 | 正式服上限已升至 120,旧等级阻碍已解除;仍需逐项核对装备效果与获取途径 |
### 2.4 尚未开始
- P9 宠物(`uiPetSystemNew`、`New_PetSystem`)
- P10 技能书 50569–50575
- P11 第 6/7 条属性(`uiAttr67Add`、72319/72320)
- 其他 AVA2 系统,只列出不排期:离线商店、商店搜索、特殊背包/仓库、宝石、卡牌、任务、十二生肖、元素技能、帝国战争。
## 3. 计划
每一步都做到:两端各自提交,并附测试、macOS 联机记录和 Android 真机记录。部署 203 每次单独批准。
### 阶段 0:准备(先做)
1. 在 203 开发目录完整编译合并后的 `feature/ava2-unlock`(server `c6813cd`),并编译客户端(macOS + Android),确认合并没问题。
2. 为每个系统列出 AVA2 的追踪清单:入口、宏、uiscript/ui*.py、Python 模块方法、包结构、服务端处理、SQL。确认实际生效的那一版(old / ex / copia 等多版本并存)。
3. 建立通用加载方式:AVA2 uiscript 和 ui*.py 原样放进资源包,用 `interfacemodule` 的方式接入;当前客户端缺的 `app.ENABLE_*` 宏、常量和方法统一补在一个地方。
### 阶段 1:已上线系统改成 AVA2 实现
改动玩家正在用的系统,旧版和新版需要同时切换,并有回滚方案。
1. 自动洗练(原生实现已部署,纯释放速度自然完成已通过;跨核心换地图及sbtest原生跨频道续洗已通过;正式服换线部署和 Android 真机验收待做)+ 属性锁定(sbtest已补材料选择、自有物品、交易、商店、仓库和GM装备查看提示;聊天链接和活动槽锁定快照已在sbtest验证,正式服部署待做):SWITCHBOT 窗口类型、CG/GC 171、`new_switchbot` 和 `PythonSwitchbot`、`uiswitchbot`;存储继续用独立表。
2. 批量开箱:`/chest_drop`、滑块、Ctrl + Z、`AutoGiveItemChest`。
3. 批量拾取:CG 235、70002 自动拾取。
4. 世界 Boss / 副本追踪:uitrack。
5. 战令:`uiBattlePassEx`、`/battle_pass` / `BattlePass*`、AVA2 任务类型和表结构;需要迁移现有进度。
### 阶段 2:main 上未上线的系统
1. 百科、掉落查询、宝箱预览:`uiWiki` + `PythonWiki`,`PythonDropItem`(CG 215 / GC 220),`uiChestDropInfo`(GC 66)。原有 `/mt_features` 查询协议可以退役。
2. 角色详细属性:`uicharacterdetails`。
3. 副本信息和计时:`uiDungeonInfo` + `uiDungeonTimer`,CG 213 / GC 217;只列 203 实际存在的副本。
4. 活动日历:`uiEventCalendarNew`,`/event_manager info` / GC214(原 GC39 与 SHOP_SIGN 冲突),共享实际活动排期。
5. 换线改为服务端传送;显示开关补上摆摊、宠物、坐骑范围。
### 阶段 3:P1–P8 收尾
1. 肩带入口改到 NPC 60003(203 上没有这个 NPC,需要新增 NPC 和刷新点)。
2. 护符:53996/53997 按 AVA2 用途处理,元素目标包,`uielementchange` / `uielementspelladd`,去掉冰元素。
3. 戒指稀有属性 `item_attr_rare_rings`。
4. 武器时装、肩带外观、特效槽三个系统,以及对应的强化石。
5. MAX_LEVEL 已升至 120;继续核对高等级装备实际效果与获取途径。
### 阶段 4:P9–P11
宠物、技能书、第 6/7 条属性,直接按 AVA2 实现。
### 部署
- 阶段 1 每个系统都会改动线上协议,客户端和服务端必须一起更新。旧客户端连不上新服务端,需要准备客户端更新包和公告。
- 沿用 `20261016-ava2-drops/deploy.sh` 模板:先停服,再备份二进制、配置和数据,最后启动 db 并检查。
## 4. 协议约定(2026-10-16 已同意)
- **包头号**:沿用 AVA2 的号码(见 §1 的空闲号列表)。40250 基础包不动。注册方式照肩带:服务端 `packet.h` + `packet_info.cpp` 的 `Set(...)` + `input_main.cpp` 的 case;客户端 `PythonNetworkStream.cpp` 的 `Set(HEADER, TPacketType(size, STATIC/DYNAMIC_SIZE_PACKET))` + `PythonNetworkStreamPhaseGame.cpp` 分发。
- **包结构**:header、subheader、字段顺序照抄 AVA2。内嵌的物品数据按当前结构(3 个 socket、7 条属性、32 位金币),与 `TPacketGCItemSet` 一致。
- **类型宽度**:只用固定宽度类型,不用 `long`(服务端 i386 上 4 字节,客户端 arm64 上 8 字节);客户端沿用 `LONG`(32 位)加 “PORT: LONG, the 32-bit Win32 long” 注释。`#pragma pack(1)`,两端都写 sizeof 测试(参照 `test_sash.py` 和 `tests/port/classic/wire_classic.h`)。
- **变长包**:header + size + subheader,两端都注册为动态长度。
- **旧客户端**:未知包头会让任一端断开。做法(自动洗练起):客户端按欧洲区编译,所有语言都发 `CG_CLIENT_VERSION2`;新客户端的 timestamp 是 `1215955205 mt<日期>`(现为 `mt20261016`)。服务端只给日期够新的客户端发新包,旧客户端照常能玩、只是没有新功能。203 是欧洲区,进游戏时用 `atoi` 比对 timestamp 和服务端配置的 `1215955205`(`input_login.cpp` 的 VERSION CHECK,不相等就断开),所以前面的数字不能动。以后要强制更新,就同时改服务端版本号和客户端的这个数字。
- **聊天命令退役**:每个系统切到 AVA2 包后,删掉对应的 `/mt_*` 命令和客户端解析;全部切完后 `/mt_features` 能力协商也不再需要。
- **服务端逻辑**:按 AVA2 移植。是否保留 40250 原有检查和 ItemLog 见 §5 第 2 项。
## 5. 待决定
1. **底层结构**:8 个 socket、15 条属性、64 位金币、等级上限等是否也要对齐?建议不对齐,等级上限单独决定。
2. **经济规则**:自动洗练已按“AVA2 的流程和 0.1 秒速度 + 保留现有检查和 ItemLog”实现;批量开箱单次 1000 待定。
3. **顺序**:已定,先做阶段 1,从自动洗练开始。自动洗练代码已完成,下一个是批量开箱。
### 2026-10-18:原生战令、百科/掉落、活动日历
已替换为 AVA2 原生 `uiBattlePassEx`、`uiWiki` / `WikiUI`、`uiDropItem` 与 `uiEventCalendarNew`,包括活动悬浮图标。
注意此前规划混淆了两代实现:CG/GC230 属于旧 `uibattlepass`;214/216 的旧日历不是 `uiEventCalendarNew`。
当前实现保留经典 SHOP_SIGN39,将新日历变长包移到214;掉落为 CG215 / GC220。
战令沿用现有赛季与进度/领取主键;百科模板和掉落来自当前203数据,日历展示实际已接入的月光宝箱/圣诞袜排期。
其他活动的服务端玩法、宠物等不因迁移窗口自动完成,整体 AVA2 对齐仍为 PARTIAL。
详见 [AVA2-NATIVE-SYSTEMS.md](AVA2-NATIVE-SYSTEMS.md),生产部署证据在同文档中单列。
### 2026-10-19:原生商城
AVA2活动版本 `uiitemshopnew.py` 已接入原生GC93和GD/DG76,事务扣币、限购、库存、订单去重与商城仓库发货;
新增确认报价校验,修复原版折扣数量/浮点误差和失效的目录更新。
原217条商品配置已恢复,sbtest先开放49件已有玩法和资源的原版商品;其他168条依赖未闭合,充值/转盘未开放。
正式服本轮未更新。详见 [AVA2-ITEMSHOP.md](AVA2-ITEMSHOP.md)。
+279
View File
@@ -0,0 +1,279 @@
{
"targets": {
"d:/ymir work/monster2/defensewave_hydra_boss/drop.msa": {
"crc32": "69a15bfa",
"source": [],
"source_files": [],
"archives": [],
"server_backup": []
},
"d:/ymir work/monster2/defensewave_hydra_boss/drop.gr2": {
"crc32": "8f4fef23",
"source": [],
"source_files": [],
"archives": [],
"server_backup": []
},
"d:/ymir work/monster2/defensewave_minihydra/special_attack1.msa": {
"crc32": "53221dab",
"source": [],
"source_files": [],
"archives": [],
"server_backup": []
},
"d:/ymir work/monster2/defensewave_minihydra/special_attack1.gr2": {
"crc32": "b5cca972",
"source": [],
"source_files": [],
"archives": [],
"server_backup": []
}
},
"archives": [
{
"name": "BGM",
"entries": 35
},
{
"name": "Costumes",
"entries": 340
},
{
"name": "ETC",
"entries": 4588
},
{
"name": "Effect",
"entries": 2051
},
{
"name": "Map_Sands",
"entries": 1289
},
{
"name": "Maps",
"entries": 11780
},
{
"name": "Monster",
"entries": 3952
},
{
"name": "Monster2",
"entries": 9066
},
{
"name": "NPC",
"entries": 2147
},
{
"name": "NPC2",
"entries": 1111
},
{
"name": "NPC_MOUNT",
"entries": 680
},
{
"name": "NPC_PET",
"entries": 71
},
{
"name": "PC",
"entries": 4428
},
{
"name": "PC2",
"entries": 3125
},
{
"name": "Patch_dungeon_meley",
"entries": 466
},
{
"name": "Patch_wiki",
"entries": 43
},
{
"name": "Sound",
"entries": 5277
},
{
"name": "Terrain",
"entries": 891
},
{
"name": "Tree",
"entries": 393
},
{
"name": "Wheel",
"entries": 13
},
{
"name": "Zone",
"entries": 5902
},
{
"name": "icon",
"entries": 4363
},
{
"name": "item",
"entries": 3268
},
{
"name": "locale",
"entries": 999
},
{
"name": "metin2_patch_citys",
"entries": 463
},
{
"name": "metin2_patch_m_summer",
"entries": 985
},
{
"name": "metin2_patch_zodiac",
"entries": 2945
},
{
"name": "pack_2019",
"entries": 1075
},
{
"name": "pack_2020",
"entries": 904
},
{
"name": "patch_battlefied",
"entries": 277
},
{
"name": "patch_conqueror_of_yohara",
"entries": 5603
},
{
"name": "patch_design_wa",
"entries": 95
},
{
"name": "patch_drop_item",
"entries": 35
},
{
"name": "patch_dungeon_info",
"entries": 78
},
{
"name": "patch_dungeon_new",
"entries": 2607
},
{
"name": "patch_new_petsystem",
"entries": 846
},
{
"name": "patch_new_select_ui",
"entries": 10
},
{
"name": "patch_offline_shop",
"entries": 348
},
{
"name": "patch_ranking_guild",
"entries": 44
},
{
"name": "patch_search",
"entries": 38
},
{
"name": "patch_tournament",
"entries": 361
},
{
"name": "patch_yohara",
"entries": 441
},
{
"name": "property",
"entries": 9988
},
{
"name": "root",
"entries": 399
},
{
"name": "textureset",
"entries": 234
},
{
"name": "uiscript",
"entries": 166
}
],
"verified_controls": [
{
"path": "d:/ymir work/monster2/defensewave_hydra_boss/wait.msa",
"bytes": 199,
"sha256": "7f38863ceb4364c465d7715a60b8eab92389a3cc084f451d64938f9145364ab7"
},
{
"path": "d:/ymir work/monster2/defensewave_hydra_boss/wait.gr2",
"bytes": 63698,
"sha256": "877706e00ce21a74a34a334fc2e626b4cc4e4a1e21800b3fddd30bdef61552c0"
},
{
"path": "d:/ymir work/monster2/defensewave_hydra_boss/motlist.txt",
"bytes": 235,
"sha256": "69152cdb0d882ebdc9933d08372bcfadf5aed9cddb7478269ce127793d041bf7"
},
{
"path": "d:/ymir work/monster2/defensewave_hydra_boss/special_attack1.msa",
"bytes": 15851,
"sha256": "045180235a1687aeed6e2b81fd350ffe34b55905dffa1f1768c984ae2e7c8b09"
},
{
"path": "d:/ymir work/monster2/defensewave_hydra_boss/special_attack1.gr2",
"bytes": 39715,
"sha256": "c1829082ba48782cd6e77d5333fada943c0f727a79d87b5fb56e5dc8bc0f15cd"
},
{
"path": "d:/ymir work/monster2/defensewave_minihydra/wait.msa",
"bytes": 198,
"sha256": "cbd3315932e53b9088fb0b4adc18b6be4cf5357cd458d4e21974c967412f83e9"
},
{
"path": "d:/ymir work/monster2/defensewave_minihydra/normal_attack1.msa",
"bytes": 1248,
"sha256": "6ef976e034f385273c6340fdaaa8d6d1d611234e9da9e20f89453a67a64b50f3"
},
{
"path": "d:/ymir work/monster2/defensewave_minihydra/motlist.txt",
"bytes": 344,
"sha256": "89b447100e5e3dca68f4afb6efd09a59267f4ef309b5f5e4d91e089b41a13942"
}
],
"server_backup_candidates": [
"home/srv1/share/data/monster/defensewave_minihydra/defensewave_minihydra.msm",
"home/srv1/share/data/monster/defensewave_minihydra/front_damage.msa",
"home/srv1/share/data/monster/defensewave_minihydra/front_dead.msa",
"home/srv1/share/data/monster/defensewave_minihydra/motlist.txt",
"home/srv1/share/data/monster/defensewave_minihydra/normal_attack1.msa",
"home/srv1/share/data/monster/defensewave_minihydra/wait.msa",
"home/srv1/share/data/monster/defensewave_minihydra/wait1.msa",
"home/srv1/share/data/monster/defensewave_hydra_boss/defensewave_hydra_boss.msm",
"home/srv1/share/data/monster/defensewave_hydra_boss/front_dead.msa",
"home/srv1/share/data/monster/defensewave_hydra_boss/motlist.txt",
"home/srv1/share/data/monster/defensewave_hydra_boss/special_attack1.msa",
"home/srv1/share/data/monster/defensewave_hydra_boss/special_attack2.msa",
"home/srv1/share/data/monster/defensewave_hydra_boss/special_attack3.msa",
"home/srv1/share/data/monster/defensewave_hydra_boss/wait.msa"
],
"archive_count": 46,
"entry_count": 94220,
"note": "VDI guest filesystem not mounted; packed client, XML manifests and source controls audited."
}
+95 -45
View File
@@ -1,57 +1,107 @@
# AVA2 自动洗练适配进度(v1,不含属性锁定)
# AVA2 自动洗练(按 AVA2 移植)
2026-10-15。修改了 metin2-client 和 metin2-server,AVA2 代码只作参考。服务端规则和协议见 `metin2-server/docs/FEATURE-SWITCHBOT.md`。
2026-10-16 起替换 v1(`/mt_switchbot` / `MTSB1`)。服务端规则和协议见 `metin2-server/docs/FEATURE-SWITCHBOT.md`,计划见 `docs/AVA2-PARITY-PLAN.md` 阶段 1。
## 与 AVA2 的差异
## 和 AVA2 相同的部分
| 项目 | AVA2 | 本实现 |
| --- | --- | --- |
| 窗口 | 新增 SWITCHBOT 物品窗口,5 个物品槽加 1 个道具槽 | 不新增窗口类型,物品留在背包,按物品 ID 绑定;每个角色同一时间只洗 1 件 |
| 洗练执行 | 自己实现消耗和 ChangeAttribute,绕过手动检查和 ItemLog | 每次都调用原 `UseItem`,检查、概率、日志、扣道具都和手动洗练一样;71151/76023 仍只能洗等级上限 ≤40 的武器和衣服 |
| 速度 | 0.1 秒一次 | 0.25 秒一次(约 4 次/秒) |
| 物品被移动 | 拦截移动、交易、出售等路径 | 每次洗练前重新检查:物品不在背包、已装备、易主时停止(item_gone);交易、商店、仓库、合成界面打开时停止(busy) |
| 换线 / 下线 | 通过 P2P 转移,继续洗 | 直接停止,不离线洗练 |
- **C++**
- `PythonSwitchbot.{h,cpp}`:`switchbot` 模块,接口和 AVA2 相同。
- `PythonNetworkStreamPhaseGameSwitchbot.cpp`:收发代码照搬 AVA2。
- `Packet.h`:CG/GC 171,subheader 和字段顺序同 AVA2。物品按本服结构:3 个孔、7 条属性。
- `GameType.h`:`SWITCHBOT = 7` 窗口、`SLOT_TYPE_SWITCHBOT`。
- `PythonPlayer`:`aSwitchbotItem`。
- `RecvItemSetPacket`:收到 SWITCHBOT 窗口的物品时刷新洗练窗口。
- 结构体都是 `pack(1)`,两端都用 `static_assert` 固定大小:220 / 15 / 9 / 40 / 7。
- **脚本**:`mt_switchbot`(`src/platform/ScriptLib/SwitchbotScript.inc`)。
- 主体是 AVA2 `root/uiswitchbot.py` 原文:SwitchbotItemTab、SwitchbotAttribute、SwitchbotWindow、SearchListWindow、ConfigurationWindow。方案用 pickle 存在 `switchbot.inf`。
- 再补上 AVA2 放在别的文件里、用 `ENABLE_SWITCHBOT` 包起来的部分:
- `ui.ThinBoardCircle`、`ListBoxEx.GetItems`;
- `uitooltip.SetSwitchBotItem`;
- mouseModule / uiinventory 的 `SLOT_TYPE_SWITCHBOT`(拖回背包时发 `SendItemMovePacket(SWITCHBOT → INVENTORY)`);
- interfacemodule 的 Toggle / Refresh / HideAllWindows / `__HideWindows`;
- game.py 的 `RefreshSwitchbotWindow` / `RefreshSwitchbotItem`。
- **图片**:`d:/ymir work/ui/switchbot/` 和 `ui/pattern/thinboardcircle/`。`tools/server/ava2-items/make_items.py` 的 `SWITCHBOT_UI` 把它们打进 ava2items 包。
匹配规则和 AVA2 相同:最多 2 套方案,每套 1–5 条“属性 ≥ 阈值”;任意一套全部达标就停止,只看前 5 条普通属性。
## 和 AVA2 不同的地方
## 客户端
| 项目 | AVA2 | 本实现 | 原因 |
| --- | --- | --- | --- |
| 第 6 格(洗练道具格) | 显示,放 71084 | 隐藏(`attrTab.Hide()`) | 服务端从背包取道具,不用第 5 号格 |
| 入口 | 扩展任务栏按钮 + F9 | 小地图旁“洗练”按钮(y+148,原 v1 按钮的位置) | 40250 没有扩展任务栏;F9/F8 已给自动狩猎,触屏也要能点 |
| 结束 / 停止提示 | locale_string 864 / 865 | 服务端命令 `switchbot_end/stop/error`,脚本转成中文聊天提示 | 见服务端文档 |
| “Alternativen:” | 德文写死 | `localeInfo.SWITCHBOT_ALTERNATIVES`(备选方案:) | 原文没走 locale |
| 文字 | locale_game.txt | 脚本里补中文 `SWITCHBOT_*`(`player.AutoHuntLocalize` 转码) | 本服 locale 没有这些条目 |
| 版本 | — | `CG_CLIENT_VERSION2` 的 timestamp 由 `1215955205` 改为 `1215955205 mt20261016` | 服务端只给新客户端发 GC_SWITCHBOT;服务端(欧洲区)的版本检查用 `atoi`,仍读到 1215955205 |
- 模块 `mt_switchbot`(`src/platform/ScriptLib/SwitchbotScript.inc`),在 `PythonBoot.cpp` 中安装。入口是小地图旁“百科”按钮下方的“洗练”按钮。
- 物品:扫描背包里至少有一条属性的武器和防具,用 `<` `>` 切换。洗练道具:扫描子类型为 USE_CHANGE_ATTRIBUTE 的道具,显示数量。次数上限可选 10、50、100、200、500、1000。
- 可选属性和最大值由服务端 `attrs` 下发,客户端不自己推算。添加属性时分页点选;阈值用 -/+ 调整,步长为最大值的 1/5,默认取最大值。
- 运行时锁定所有设置,实时显示次数、剩余道具、停止原因和当前 5 条属性。停止时在聊天框提示;达标时如果窗口已关闭,会自动打开。
- 命令间隔至少 0.3 秒,同一时间只有一个请求在等待回复。4 秒没有回复就显示“服务器尚未启用自动洗练”。`attrs` 只接受完整、连续的回复,不完整的整批丢弃。
- 文字都用 GBK 可编码的字符(不用 ◀/▶/⚠)。
没有移植 AVA2 的 `uiswitch.DopadorMenu/DopadorManual`(另一套手动洗练菜单)。
2026-10-18:50348/50349 已在 sbtest 补齐选择属性序号的 quest 流程,材料 socket 0 记录1~5,再拖到装备;自有装备提示按 AVA2 用黄色 <<属性>> 显示。独立表存储保留,详见 [属性锁定说明](../tools/server/ava2-attr-lock/README.md)。他人装备(沿用GM权限)、商店、交易和仓库提示已在 sbtest 验证;见 [视图提示](AVA2-ATTR-LOCK-VIEWS.md) 和 [链接/活动槽快照](AVA2-ATTR-LOCK-SNAPSHOTS.md)。
## 证据
- `tests/wiki/test_switchbot.py`(CTest:`port.switchbot`)共 6 项通过,覆盖:
- 请求节流和合并;
- 不完整的 attrs 回复被拒绝;
- start 命令的拼装和校验;
- state/error 解析和超时;
- 和服务端的原因码、错误码、上限一致;
- 窗口流程:扫描 → 读取属性 → 选属性 → 开始 → 达标提示。
- 脚本能在 Python 2.7 下编译。`tests/wiki/test_service.py` 仍然通过。
- 2026-10-15 联机测试(203 额外开的测试核心 channel5/first,端口 13040,使用隔离编译的 game;macOS 原生客户端,账号 admin,物品为背包 33 格的剑 279,道具 71084):
- 上限 10 次:洗满 10 次后停止(limit),约 4 次/秒。
- 两套方案、阈值 1:第 18 次达标(matched)。
- 已经达标的物品:0 次就停止,不扣道具。
- 洗练中把物品从 33 格移到 90 格:继续洗,窗口跟到 90 格;点停止后显示 stopped。
- 洗练中退出客户端:服务端立即停止。
- log.log 中 CHANGE_ATTRIBUTE 共 72 行,和总次数一致。
- busy:洗练中摆摊(先给 50200 摊位包袱;没有它 `OpenMyShop` 会提前返回、摊位不会开,第一次测试就是这样误判的),摊位开出约 1 秒后停止(busy),共洗 6 次。
- no_scroll:用 76014(共 6 张)、上限 10,洗 6 次后停止(no_scroll),道具剩 0。
- rejected:对 90 级剑用 71151(原路径只允许等级 <= 40):0 次就停止(rejected),道具未扣。
- 截图里窗口布局正常。仓库自带的 `Client` 是英文 cp1252 locale,所以中文显示为 `????`;需要 zh locale 客户端才能看到中文。
- 联机测试发现并修复了两个窗口问题,`test_switchbot.py` 已加回归用例:
- 洗练中移动物品后,选中项会跳到别的物品:现在按服务端报告的格子跟随。
- 空闲时移动物品后选中项丢失:现在退而按相同 vnum 匹配。
- 服务端 `tests/features/test_switchbot.py` 和 `test_queries.py` 通过。203 的隔离目录 `/root/metin2-features-dev` 完整编译通过。
- `tests/wiki/test_switchbot.py`(CTest `port.switchbot`),5 项:
- 窗口代码和 AVA2 原文逐字相同(只有上表两处替换);
- ThinBoardCircle、文字、`USERDATA_DIRECTORY`、5 个标签页的宽度;
- 服务端命令提示,其他命令照常传下去;
- 从洗练窗口拖回背包;
- interface / game 钩子。
- `tests/wiki/test_item_actions.py` 已更新:50348/50349 走原来的使用流程。
- 脚本能在 Python 2.7 下编译。macOS 构建(`build/switchbot-check`,关闭 MeshPort)通过,ctest 52 项全过(7 项跳过,和之前一样)。
- 服务端 `tests/features/test_switchbot.py` 同时检查客户端 `Packet.h`、`PythonSwitchbot.h` 和版本字符串。
- 联机测试(2026-10-16,Mac 客户端 + 203 的 channel5,脚本驱动):
- 武器(channel5 连线上 db):放入、拖回、开始和停止、洗到目标自动结束、洗练中拖出被拒绝、放入无效物品被拒绝;约 12 次/秒,ItemLog 记录数和消耗数一致。
- 戒指和护符(`tools/server/sbtest` 隔离环境,解锁后的 proto):戒指用戒指属性池(20 条),消耗 71084;护符用护符属性池,只消耗 71302。两边都能洗到目标。
- 重新登录:物品和属性保留(从 db 缓存读和重启后从 MySQL 读都测过,`window=SWITCHBOT`);洗练停止,目标清空,和 AVA2 一样(下线时 `UnregisterItem`)。
- 同核心换地图(1 → 21 → 1):传送后接着洗,目标保留,只在传送时暂停一下,和 AVA2 一样。
## 未完成
- Android 真机测试。
- macOS 构建需要 `-DMT_40250_SOURCE=<含 EterPack/EterPack.cpp 的源码目录>` 来生成 pack 密钥,否则 system.py 读不出来(RunMain Error)。本机没有 40250 源码,这次用的是 AVA2 的 `TEST/3. Source BIN/Client`,两者密钥相同。
- 服务端还没有部署到 203 正式环境。
- 属性锁定(阶段 6 后半):需要单独的存储设计。
- 跨核心换地图续洗已通过;跨频道换线仍需从当前退出重登流程改为原生服务端传送。
- 正式服当前版本的实际开始/停止和跨核心续洗验收仍需补齐;2026-10-17 已确认现役 game 含 CSwitchbotManager / switchbot_end,player.item.window 也已有 SWITCHBOT,不能再写成正式服仅有 v1。
- Android 构建和真机测试。
- 属性锁定:他人装备、交易和商店提示同步;物理拖放与 Android 触控验收。
## 2026-10-17 当前客户端复测
真实 macOS 客户端连接 sbtest,普通 QA1017 把背包 32 格的 19 号武器移入 SWITCHBOT 第 0 格。
设置两套目标后开始,约 1.5 秒内消耗 2 个 71151 和 17 个 71084,收到属性更新;手动停止后 active=0。
将目标设为当前已有的 (13,5),再次开始后 finished=1、active=0,材料数量不变。验收后物品移回原背包格。
客户端状态记录在 build/ordered-acceptance-20261017/switchbot-{roll-live,live}.json。
修正所有 ThinBoardCircle 的明黄色底色:原 AVA2 配置向 0~1 颜色接口传入 255,当前渲染下产生溢出色;
按用户反馈改为归一化深灰 (0.08,0.08,0.08,0.96),保持白色文字和原状态色。
真实客户端截图已确认主面板、属性列表和输入框可读。原始 uiswitchbot 主体逐字对照测试仍通过;
颜色是明确的用户要求变更,不宣称该配置仍与 AVA2 原值相同。
### 同日验收脚本干扰说明
上述约 1.5 秒洗练是私有驱动主动发送 Stop,并非自然达到用户选择的释放速度。
该驱动最初设置两套 (14,8),随后又把两套改为武器已有的 (13,5) 来验证立即完成;这些编号分别是缓慢和眩晕概率,不是释放速度/攻击速度。
在同一可见客户端进行该操作会干扰人工观察,不能将其停止/完成提示解释成界面所选释放速度已命中。
驱动已结束,客户端已重新启动,当前没有该定时器。后续人工验收期间不再插入修改配置或定时停止。
新增回归直接编译执行服务端 CheckItem 函数,确认攻击速度 7 不能满足释放速度 9、数值门槛、同方案 AND 和备选方案 OR。
客户端回归通过真实选择回调确认释放速度编号 9 保持为 9,未错误发送成 7。
## 2026-10-18 纯释放速度自然完成
macOS 真实客户端连接 sbtest,普通 QA1017 的测试武器(19)起初无释放速度。所有备选方案均只设类型9(释放速度)≥1,未混入攻击速度7。开始后不发送手动 Stop:71084 总数2082→2069,约1.315秒后 active=0、finished=1,最终五条属性含 (9,10)。属性匹配、消耗和自然停止同时成立;不是“已有目标立即完成”测试。证据:build/parity-acceptance-20261018/switchbot-cast-natural.json。验收后物品移回背包,测试轮询窗口隐藏。
Android APK 已构建并保留数据安装,用户于本轮明确选择“暂时不测手机”,因此手机联机/触控保留未验收。
## 2026-10-18 跨核心传送续洗
临时将 sbtest 主核心限制为地图1/62,增加同频道的独立测试核心:13040/P2P14040 与13041/P2P14041,后者只载入地图61。正式服配置和二进制未变。QA1017 通过原生追踪传送从地图1→61→62,服务端日志确认两次跨核心连接。
开始配置为释放速度20、暴击10、穿透10、动物系20、不死系20,填入两个实际备选;武器第4条 (4,6) 已锁定。两个目标核心进入后 active 均为1,目标表一致,锁定值始终不变;71084总数2069→1811→1595,确认是持续真实洗练。最后主动停止、武器退回159格并解锁,测试集群重启后恢复原 MAP_ALLOW,临时核心关闭,QA位置恢复主城。证据:crosscore-{before,outbound,return,summary,cleanup}.json,以及远端 crosscore/primary-syslog、aux-syslog。
这验证的是跨核心换地图。该次测试时换线窗口仍使用退出重登,因此其证据只证明跨核心换地图;后续原生换线验收见下节。
## 2026-10-18 原生跨频道续洗
已按 AVA2 启用的 do_cmd→MoveChannel 和 MoveChannelDialog 接入,203端口布局通过P2P实际地图归属适配。sbtest仅临时加载地图1:频道5端口13040、频道6端口13050;详见 [原生换线](AVA2-NATIVE-CHANNEL.md)。
最终无需人工补发频道查询的自动验收完成5→6→5:active全程为1,两套目标表一致,锁定第4条 (4,6) 不变,71084总数1034→976→919。此轮特意使用持续不命中的目标检查交接,在往返完成后主动停止;不能将其称为自然完成测试。已退回武器到159格并解锁,数据库锁记录为0。
同频道、未开放频道、重复命令取消倒计时、真实任务选择窗口中的换线拒绝均通过。另一次5→6后正常退出重登仍在6,auth保持11040,再回5;关闭辅助核心后列表只剩5,旧目标6请求被拒绝。上述结果仅为macOS/sbtest;用户暂停Android真机验收,正式服未部署本轮换线改动。
证据:本机 build/parity-acceptance-20261018/native-channel-{before,outbound,return,cleanup,reconnect,unavailable}.json、native-channel-proof-final.log、native-channel-reconnect.log、native-channel-live-unavailable.png。首轮联机曾发现频道元数据不刷新,最终验收使用服务端EnterGame主动下发列表和原版UpdateServerInfo更新后的版本。
+37
View File
@@ -0,0 +1,37 @@
# AVA2 原生首领与副本追踪
更新:2026-10-18;分支 `feature/ava2-unlock`。本轮仅部署 sbtest(203:11040/13040),正式服未更新。
## 实现与来源
`NativeTrackScript.inc` 载入 AVA2 `pack_maker/root/uitrack.py` 的双页窗口、卡片、滚动、门票提示与提醒选项,使用原 `uiscript/track/{window_old,item_old}.py`、ymirdesign 图片及头像。原 `mt_boss` / `mt_dungeons` 入口转入原生窗口。兼容层补齐 MultiTextLineNew、ListBoxNew、按钮裁剪和事件参数接口;不改变 40250 原始打包脚本。
服务端移植 AVA2 `CNewMobTimer` 日历、刷新、死亡与追踪查询,使用 `/track_window load/teleport`、`TrackBossInfo`、`TrackDungeonInfo`。当前开放原始列表的五个生肖首领,地图 `metin2_12zi_stage`(357)及相关 85 条怪物/NPC 数据只导入 sbtest。地图载入不代表整个生肖副本玩法已经移植。
跨核心刷新状态通过现有变长 P2P relay 传播,并增加存活心跳和超时失效;显示真实所属频道。地图不可用、未知首领和未同步状态单独显示,客户端倒计时结束不自行声称首领已刷新。65535 存活标记与同值倒计时作区分。原日历 `days_range` 按星期取模,不能当作固定 48 小时。
副本保留 AVA2 八组冷却/重返标记及优先级,三份新任务恢复 `d.track_update`。旧地下墓穴、火焰副本和蜘蛛巢穴另外读取当前已部署任务的实际截止时间;旧蓝龙从 `dragon_lair_access.get_settings()` 读取房间冷却。任务正在运行或配置缺失时不执行该 Lua 查询,显示状态暂不可用。冷却结束只描述计时状态,入场仍由 NPC 校验钥匙、队伍、房间归属等条件。
提醒选项通过 `systemSetting` 保存到 `metin2.cfg`。经典解析器遇空行停止,因此新字段必须写在结尾空行之前。断线、换图、关闭商店会清除本次道具价格,避免污染后续商店。
## 原生门票商店
从 AVA2 原始 MyISAM `player.shop` / `shop_item` 核实 shop 12(NPC 20381),快照见 `tools/server/ava2-track/shop12.tsv`。八种门票售价依次为:圆木 10、圆木 15、夹板 15、夹板 15、地基石 20、地基石 20、地基石 30、地基石 30。
沿用原生 ShopDialog、确认框、物品图标和悬浮价格。服务端独立持有商店,不覆盖现有 NPC 商店 ID;只允许打开 shop 12,禁止卖出。检查任务状态、交易/仓库/死亡/传送状态及道具余额,原 CShop 发奖成功后才扣兑换物,不扣金币。追加的 GC_SHOP 子包为 2044 字节载荷(含 40 格道具价格),接收端完整验证后再更新状态。旧商店流程保持兼容。
## 验证证据
本地证据目录 `build/parity-acceptance-20261018/`(私有登录资料不纳入版本库)。
- macOS 真实客户端显示两页窗口、卡片滚动、门票图片与中文界面;临时短周期首领刷新后显示 CH5,实际传送到地图 357 并发现 9842 实体。验收后恢复原始刷新日历并将 QA 角色返回主城。
- 原生 shop 12 返回八项价格;通过原生确认回调购买第一张票:90011 数量 170→160、25163 数量 0→1,金币保持 1330870487;真实卖出封包被拒绝,余额不变。见 `ticket-*.json` / `ticket-shop.png`。
- 服务端实际日历/查询/商店控制器隔离测试通过;另测八副本标记、旧任务截止时间、蓝龙共享冷却、配置失效与整数边界。FreeBSD 独立目录完整编译通过。
- 配置回归测试编译真实 SaveConfig/LoadConfig,两项启用、关闭其中一项均能冷读;真实客户端冷启动读回 `[1,1]`,见 `track-preferences-cold-pass.json`。
- 客户端解包器覆盖有效、截断、超长和异常价格封包,并验证失败时无部分状态写入;原生窗口回调、旧商店回退和关闭路径通过自动测试。
## 尚未闭合
八个副本的任务、门票和等级条件尚未全部换成 AVA2 原版;列表中的 AVA2 门票不代表旧 NPC 已接受这些票。提醒选项冷启动验收通过(两项保持 1;验收后恢复此前的 0)。物理鼠标/快捷键和 Android 触控尚未验收;测试代码调用 UI 回调不能替代物理输入验证。Android APK 已增量构建并安装,手机解锁后才能开始联机验收。
资源生成报告仍有 40 项源文件缺口(含此前九头蛇动作和生肖装饰模型),不能声称全量资源无缺失。当前实现也不代表战令、百科、属性锁定和其他 AVA2 系统已完成。
+81
View File
@@ -0,0 +1,81 @@
# Model preview
Ported from AVA2's render-target window (`EterLib/CRenderTarget*`, `GrpRenderTargetTexture.*`, `UserInterface/CPythonRenderTargetModule.cpp`, `root/uirendertarget.py`). The preview shows:
- a wearable item on a character of every race that may wear it;
- a monster, with its motions.
It is client only; the server is not involved.
## Entry points
| Where | How |
|---|---|
| Inventory | hold X and left-click the item |
| NPC shop | hold X and left-click the item |
| Wiki detail | the "模型预览" line, on weapon / armor / costume rows that have a model, and on every monster |
Without X the original click path runs unchanged. The inventory wrapper chains onto `mt_mobile_inventory`'s, because `mt_preview` is installed after it. There is no touch entry other than the wiki.
## Window (`ScriptLib/ModelPreviewScript.inc`, module `mt_preview`)
### Item mode
- `ItemSpec(vnum)` accepts:
- a weapon other than an arrow → `SetWeapon`;
- a body armor or a body costume → `SetArmor`;
- a hair costume → `SetHair`, which reads value3.
- The races are those not excluded by `ITEM_ANTIFLAG_{MALE,FEMALE,WARRIOR,ASSASSIN,SURA,SHAMAN}`, ordered warrior, assassin, sura, shaman, with male first. The window starts on the player's own race if it is allowed.
- `<` / `>` step through the allowed races.
### Mob mode
- `SelectModel(vnum)`.
- Motion buttons: 待机 1, 攻击 13, 受击 5, 死亡 11, 技能1–4 33–36 (`InterceptOnceMotion`).
### Controls
- Dragging with the left button turns the camera: absolute yaw/pitch from the press point, pitch clamped to ±60°.
- 放大 / 缩小 change the zoom in 5 % steps, clamped to −8..+12. Windows have no wheel event.
- 自动旋转 spins the model.
- 复位 rebuilds the model, which also resets the camera.
### Lifetime
- Render target index 1 is created at 300×330 when the window opens.
- It is removed on close or Esc, and on every re-open before it is created again. `GameWindow.Close` also calls `renderTarget.Destroy()`.
- The host frees the GPU image 120 frames after its last use.
## Native side
- `renderTarget` Python module (`port/UserInterface/PythonRenderTargetModule.cpp`) → `CRenderTargetManager` → `CRenderTarget`, which owns a `CInstanceBase` and a `CGraphicRenderTargetTexture`.
- `CPythonApplication` calls `DeformModels` / `UpdateModels` / `RenderModels` around the character manager.
### Port differences from AVA2
- Player races (0..7) are created as `TYPE_PC`. 40250 reserves the armor/weapon/hair parts only for PCs, so AVA2's `TYPE_NPC` crashed on the first `ChangeArmor`.
- The model sits at the world origin, where culling hides it. Instead of AVA2's `SetAlwaysRender`, it is shown again before `Deform` and `Render`. Its text tail is detached.
- The background quad is drawn inside the render target, in `RenderModel`. `RenderBackgrounds` is a no-op.
- Wiki affects are not ported.
- The texture has 1 mip level.
### Host (Vulkan)
- A colour render target is `D3DFMT_X8R8G8B8` / `A8R8G8B8` with `D3DUSAGE_RENDERTARGET`, named `rt:<id>:<w>x<h>:c`.
- It gets its own RGBA8 offscreen pass (pipeline key bits 29–30: 0 none, 1 shadow, 2 colour) and is cleared to black.
- Shadow targets keep the previous path.
- Side effect: SnowEnvironment's blur targets now take the colour path. Snow blur is off by default.
## Verification
- `tests/wiki/test_model_preview.py` covers:
- `ItemSpec` races and slots;
- race stepping and fallback;
- motions and zoom clamps;
- drag;
- reset;
- the view drawing the target;
- no live target after close, Esc, or 5 re-opens;
- the inventory and shop wrappers;
- wiki links and module order.
- ctest 49/49.
- Live, channel5 13040, macOS client, 2026-10-16:
- armor 11299 on a warrior;
- sword 19 after a 90°/20° turn;
- wild dog 101 with the attack motion;
- boss 691 zoomed in with spin.
- The main scene was unchanged.
- 120 open/close cycles (30 paced, plus 60 in one frame) did not grow RSS: 668 MB before, 593 MB after.
+89
View File
@@ -0,0 +1,89 @@
# 客户端内置 MeshPort:同网段直连,跨网段统一组网
SDK 源码在 `third_party/meshport/`;客户端的后台运行时在 `src/meshport/runtime/`,TCP/UDP 平台适配在 `src/meshport/transport.cpp`。不依赖相邻的 MeshPort 工程或另行安装的 MeshPort 应用。
## 统一路径
组网按每一个目标 IPv4 地址决定,位于原生网络层,不依赖登录窗口或按钮。首次跨网段请求(包括登录前频道查询、先注册、先发送 UDP、命令行自动登录)都可触发后台启动。
| 请求 | 接入点 |
|---|---|
| 登录前频道状态查询 | `CServerStateChecker` → `CNetworkStream`;当前实现是 TCP |
| 账号认证、游戏连接 | `CAccountConnector`、`CPythonNetworkStream` → `CNetworkStream` |
| 换地图、换线、断线后的新连接 | 每次 `CNetworkStream::Connect` 重新判断目标地址 |
| 公会图标/标志上传和下载 | `CGuildMarkUploader`、`CGuildMarkDownloader` → `CNetworkStream` |
| 注册账号 HTTP | `PythonAccountRegister.cpp` 的工作线程使用相同 TCP 连接与 SOCKS 协商 |
| 通用 UDP | `CNetworkDatagram`、`CNetDatagramSender`、`CNetDatagramReceiver` → 统一 SOCKS5 UDP ASSOCIATE |
百科、洗练、拾取、战令等服务端命令复用游戏连接,自动跟随该连接的路径。域名沿用系统 IPv4 解析,解析后的地址进入相同判断;纯数字开头的域名不会再被误当成 IP。游戏现有封包、加密、原始数据内容保持不变。
## 路由与生命周期
- 使用本机已启用网卡的实际 IPv4 地址、子网掩码判断,不假定 `/24`。排除回环、点对点及 TUN/TAP 网卡;回环目标直接连接,便于本地测试。
- 同网段直接使用系统 TCP/UDP,不为了本地请求启动 MeshPort。一个客户端可以同时访问同网段与跨网段目标。
- 跨网段只使用 MeshPort;没有配置、引导连接失败、路由缺失或 SOCKS 被拒绝时返回失败,**不退回系统直连**。
- 首次需要时才后台启动 SDK。复用保存配置中的网络身份、密钥、引导节点及传输选项,强制应用模式、`dhcp=true`、清空固定 IPv4 和监听端口。
- 等待动态 IP 和 SDK 接受的公告子网就绪。引擎启动、发现节点或仅获取 IP 均不算连接成功;TCP 的远端 SOCKS 建连成功或收到有效 UDP 回包后才提示“组网成功”,约 6 秒。
- 同一 SDK 由全部请求共享,多个请求不会重复启动,也不会因另一次登录停止现有连接。运行期间刷新健康状态和子网,后续新目标、重连均重新检查路由。
- 地址/路由准备最多 60 秒,SOCKS 建连最多 10 秒;原生 TCP 给整个准备流程最多 75 秒。UDP 发送队列有数量、字节和时限上限,防止断网时无限积压。
- UDP 保留原始来源 IP/端口、数据报边界及 `MSG_PEEK`,直连和组网回包可由同一接收 API 读取。TCP 控制连接、UDP relay 与原始 socket 一起回收。
- 关闭注册窗口会取消路由等待和 HTTP I/O,已发送到服务器的请求无法撤回,不做自动重发。退出时先取消并等待注册线程,再停止 SDK;关闭普通连接会移除其待完成协商。登录窗口的取消/退出也只取消尚在准备的账号及游戏连接,不中断独立频道查询或已建立的连接。
- 网卡变化后,新连接和每次发送都重新判断;排队的 UDP 若变为同网段,则改走直连。已经建立的 TCP 会话不能迁移到另一条路径:断线后沿原客户端流程返回登录/建立新连接,新连接重新判断;没有新增自动登录或自动重放业务请求。
使用应用内桥接,不创建系统 VPN、不安装 OS 路由。MeshPort 自己的引导/打洞连接仍使用系统网络,避免组网递归。
## SDK 的 DHCP 子网修复
原 SDK 的公告子网过滤器捕获 `TomlConfig.get_ipv4()`。DHCP 启动时它为空,动态地址分配后也不会更新,造成“有 IP、有节点,但无法接受服务器网段”。本地修复从运行中的节点快照更新过滤器,再投影接受的子网;变更记录在 `third_party/meshport/UPSTREAM.md`。
## 私有配置
当前开发机默认读取 `~/Library/Application Support/MeshPort/network-profile.toml`。其他电脑可将同一网络的配置放入忽略规则覆盖的 `config/meshport.private.toml`,或设置 CMake 参数:
```sh
cmake -S . -B build/release -DMT_BUILD_NATIVE_RENDER=ON \
-DMT_MESHPORT_CONFIG="/path/to/network-profile.toml"
```
配置在构建时读入生成头文件;开发运行时可用环境变量 `MT_MESHPORT_CONFIG` 覆盖。私有配置不进入 Git;包含配置的 APK/可执行文件应按私有客户端分发。错误提示不输出密钥。
## 构建
需要 Rust 1.95+(`cargo` 在 PATH 内)和 protoc(在 PATH 内或通过 `PROTOC` 指定)。依赖固定在 Cargo.lock,首次构建需要下载注册表依赖。编译产物默认放在 `build/meshport-runtime`;运行时及其 SDK 作为一份静态库链接,不依赖动态 MeshPort 库。
```sh
./scripts/build_meshport.sh macos
cmake -S . -B build/release -DCMAKE_BUILD_TYPE=Release \
-DMT_BUILD_NATIVE_RENDER=ON -DCMAKE_PREFIX_PATH=/opt/homebrew
cmake --build build/release --target mt_native_render -j8
```
Android arm64:`./android/build.sh Release --no-deploy` 会先编译运行时和 SDK,再构建客户端和 APK。独立构建可执行 `./scripts/build_meshport.sh android`;最低 API 24,链接对齐 16 KB 页面。
`MT_MESHPORT_LIBRARY` 可覆盖静态库路径,`MT_MESHPORT_ROOT` 可覆盖 CMake 中 SDK 头文件路径。组网关闭的专项测试可设置 `-DMT_ENABLE_MESHPORT=OFF`。
## 验证
本地真实 SDK 网关将公告网段映射到回环 TCP/UDP 测试服务,测试安装零条 OS 路由,无需管理员权限。构建测试网关时使用与运行时相同的 Cargo target 目录:
```sh
CARGO_TARGET_DIR="$PWD/build/meshport-runtime" cargo build \
--manifest-path src/meshport/runtime/Cargo.toml \
--example gateway_fixture --release --locked
cmake -S . -B build/native -DBUILD_TESTING=ON
cmake --build build/native --target meshport_transport_test meshport_network_paths_test -j4
ctest --test-dir build/native -R '^meshport\.' --output-on-failure
python3 tests/meshport/test_network_paths.py \
build/native/src/meshport/meshport_network_paths_test --client
```
测试包括:实际子网掩码、同网段零组网启动、UDP 首次请求触发 DHCP、真实公告子网 TCP/UDP 转发、UDP 来源与 peek、并发账号/游戏类型连接、HTTP、缺失路由不直连、取消协商、SOCKS 分片/拒绝、失败提示与成功提示生命周期。`--client` 还启动真实 Python 2.7 原生客户端,调用实际注册接口验证取消后重新注册。
跨公网到正式服务器的完整游戏登录、Android 真机切换 Wi-Fi/移动网络需要相应网络与设备验收;本地回环网关测试不能代替这些现场验证。
本次本机验证记录(2026-10-16):
- macOS 原生客户端和 Android arm64 APK 构建成功。
- `meshport.transport`、`meshport.login`、`meshport.network_paths`、`meshport.dhcp`、`port.net` 共 5 组通过:`build/meshport-final-tests.log`。
- 真实 Python 2.7 客户端验证了登录前路由、取消待完成登录、实际 HTTP 注册、取消后重新注册:`build/meshport-path-client-tests.log`、`build/meshport-registration-runtime.log`。
- 完整 `port.login_flow` 的账号/加密登录及前段网络检查通过,后段 NPC 商店/任务/仓库点击检查仍有 27 项失败。用关闭组网模块的对照程序复验,失败数量和源码行号完全相同;此项不记为整体通过。日志:`build/meshport-regression-tests.log`、`build/meshport-baseline/test.log`。
+4
View File
@@ -271,3 +271,7 @@ Mac 和 Android 更新包在 dist/*AVA2Bio-20261014.zip,Android 包含 APK 与
新增当前服务端已加载分组的只读查询、来源反查、NORMAL/PCT 宝箱模式、角色有效属性快照,以及客户端能力协商/请求匹配/分页/降级。接入百科、怪物目标和触控背包提示;保持原开箱及经济行为。FreeBSD 独立构建、协议及触控回归通过;没有替换 203 运行程序。未完成副本、洗练、日历/战令与模型预览,边界及证据见 `AVA2-READONLY-FEATURES.md`。
2026-10-15 再续:龙穴/周任务信息与提醒、共享真实掉落开关的活动日历已实现并在隔离环境验证。副本仅首批龙穴;活动仅月光宝箱/圣诞袜,生产未部署,无生产排期。自动洗练/锁定、战令、模型预览、批量开箱仍待实现。见 AVA2-DUNGEON-CALENDAR.md。
### 2026-10-18:AVA2原生战令/百科/掉落/活动日历
按用户授权替换三个原生系统,使用原AVA2脚本和独立平台适配;146项客户端回归、30组服务端功能测试、macOS/sbtest联机及Android离线构建通过。203正式服已于本地时间2026-10-19 08:31更新game a8d606ea,auth/13个核心/原db正常。没有生产活动排期;测试角色和临时排期已恢复。详见 `AVA2-NATIVE-SYSTEMS.md`;整体40250/AVA2结论保持PARTIAL。
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# Build only MeshPort's application-mode SDK; no VPN or internet proxy engine.
set -euo pipefail
repo="$(cd "$(dirname "$0")/.." && pwd)"
mesh="${MT_MESHPORT_ROOT:-$repo/third_party/meshport}"
platform="${1:-macos}"
export CARGO_TARGET_DIR="${CARGO_TARGET_DIR:-$repo/build/meshport-runtime}"
if [ "$platform" = android ] && [ -f "$CARGO_TARGET_DIR/aarch64-linux-android/release/libmetin2_meshport.a" ] && ! command -v cargo >/dev/null; then
echo "Using prebuilt meshport: $CARGO_TARGET_DIR/aarch64-linux-android/release/libmetin2_meshport.a"
exit 0
fi
command -v cargo >/dev/null || { echo "Rust 1.95+ is required (cargo not found)" >&2; exit 1; }
cd "$mesh"
if [ "$platform" = android ]; then
sdk="${ANDROID_HOME:-${ANDROID_SDK_ROOT:-$HOME/Library/Android/sdk}}"
ndk="${ANDROID_NDK_ROOT:-${ANDROID_NDK_HOME:-}}"
if [ -z "$ndk" ]; then ndk="$sdk/ndk/$(ls "$sdk/ndk" | sort -V | tail -1)"; fi
tools="$ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin"
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="$tools/aarch64-linux-android24-clang"
export CC_aarch64_linux_android="$CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER"
export AR_aarch64_linux_android="$tools/llvm-ar"
export CARGO_TARGET_AARCH64_LINUX_ANDROID_RUSTFLAGS='-C link-arg=-Wl,-z,max-page-size=16384'
exec cargo build --manifest-path "$repo/src/meshport/runtime/Cargo.toml" --target aarch64-linux-android --release --locked
elif [ "$platform" = macos ]; then
exec cargo build --manifest-path "$repo/src/meshport/runtime/Cargo.toml" --release --locked
fi
printf 'usage: %s [macos|android]\n' "$0" >&2
exit 2
+120 -10
View File
@@ -23,7 +23,7 @@ REPO = Path(__file__).resolve().parents[1]
DEFAULT_EN = REPO.parent / "40250/Server Client TMP4/Client/Eternexus/locale_en/locale/en"
DEFAULT_ZH = REPO.parent / "server_extracted/client_locale/longju/locale/taiwan"
DEFAULT_OUTPUT = REPO / "build/zh-locale/Client"
BUILD_DIRS = ("build/release", "build/native")
BUILD_DIRS = ("build/release", "build/native", "build/switchbot-check")
LOCALE_CFG = "10002 936 zh\n"
DEFAULT_NAMES = REPO / "data/zh_40250"
FORMAT = re.compile(r"%(?:\([^)]*\))?[-+#0 ]*\d*(?:\.\d+)?[diouxXeEfFgGcrs%]")
@@ -125,7 +125,7 @@ def wrap_description(text: str) -> str:
return " |".join(lines)
def translate_itemdesc(path: Path, table: Path):
def translate_itemdesc(path: Path, table: Path, names: dict = None):
"""itemdesc.txt with its description and summary columns replaced from the English→Chinese table (UTF-8,
English<TAB>Chinese) and wrapped; untranslated cells keep the English text."""
chinese = {}
@@ -137,6 +137,9 @@ def translate_itemdesc(path: Path, table: Path):
for line in path.read_bytes().decode("cp1252").split("\n"):
parts = line.split("\t")
if parts[0].strip().isdigit():
vnum = parts[0].strip()
if names and vnum in names and names[vnum]:
parts[1] = names[vnum]
left = False
for column in ITEMDESC_COLUMNS:
text = parts[column].strip() if column < len(parts) else ""
@@ -154,6 +157,26 @@ def translate_itemdesc(path: Path, table: Path):
return {"translated_cells": translated, "english_rows": english_rows}
def translate_guildbuildinglist(path: Path, table: Path):
"""Replace column 3 (name) in guildbuildinglist.txt using a VNUM<TAB>NAME table (UTF-8)."""
names = {}
for line in table.read_text(encoding="utf-8").splitlines():
if line and not line.startswith("#"):
vnum, name = line.split("\t", 1)
names[vnum.strip()] = name.strip()
lines = path.read_bytes().decode("cp1252").splitlines()
out = []
translated = 0
for line in lines:
parts = line.split("\t")
if parts and parts[0] in names:
parts[3] = names[parts[0]]
translated += 1
out.append("\t".join(parts))
path.write_bytes(("\n".join(out) + "\n").encode("gbk"))
return {"translated_rows": translated}
def overlay_rows(path: Path, overlay: Path, wrap_columns=()):
"""Replace the rows of a vnum-keyed file by the overlay's (UTF-8, whole rows, no header); other rows keep
their bytes (the English files are cp1252). wrap_columns (0-based) are wrapped like translated text."""
@@ -320,7 +343,16 @@ def build(en: Path, zh: Path, output: Path, client_base: Path,
table = names_dir / "itemdesc_translate_zh.tsv" if names_dir else None
if table and table.is_file():
report["files"]["itemdesc.txt translation"] = translate_itemdesc(locale_dir / "itemdesc.txt", table)
item_names_map = name_rows(names_dir / "item_names_zh.txt") if names_dir else {}
if names_dir:
item_names_map.update(name_rows(names_dir / "item_names_zh_overlay.txt"))
report["files"]["itemdesc.txt translation"] = translate_itemdesc(
locale_dir / "itemdesc.txt", table, item_names_map)
building_table = names_dir / "guildbuildinglist_zh.tsv" if names_dir else None
if building_table and building_table.is_file() and (locale_dir / "guildbuildinglist.txt").is_file():
report["files"]["guildbuildinglist.txt"] = translate_guildbuildinglist(
locale_dir / "guildbuildinglist.txt", building_table)
for filename in ROW_FILES:
overlay = names_dir / (Path(filename).stem + "_zh_overlay.txt") if names_dir else None
@@ -350,11 +382,15 @@ def build(en: Path, zh: Path, output: Path, client_base: Path,
limits = names_dir / "item_limits_server.tsv"
if (names_dir / "item_stones_server.tsv").is_file() and not limits.is_file():
raise ValueError("stone overlay requires the item limits table argument")
if (names_dir / "item_shapes_server.tsv").is_file() and not (names_dir / "item_stones_server.tsv").is_file():
raise ValueError("item shapes require the stone overlay argument")
result = subprocess.run(
[str(proto_tool), str(en / "item_proto"), str(en / "mob_proto"),
str(item_names), str(mob_names), str(locale_dir / "item_proto"),
str(locale_dir / "mob_proto")] + ([str(limits)] if limits.is_file() else [])
+ ([str(names_dir / "item_stones_server.tsv")] if (names_dir / "item_stones_server.tsv").is_file() else []),
+ ([str(names_dir / "item_stones_server.tsv")] if (names_dir / "item_stones_server.tsv").is_file() else [])
# item_shapes_server.tsv follows the stone overlay (positional): size and flags of new-use items.
+ ([str(names_dir / "item_shapes_server.tsv")] if (names_dir / "item_shapes_server.tsv").is_file() else []),
check=True, capture_output=True, text=True,
)
report["proto"] = {
@@ -393,7 +429,10 @@ def build_biolog(output: Path, pack_tool: Path):
root = REPO / "tools/server/biolog"
ava = REPO.parent / "AVA2"
archive = ava / "2. Backup SF+SRC and SQL/FILES+SRC.tgz"
if not archive.is_file():
extracted = ava / "TEST/2. Backup SF+SRC and SQL/home/srv1/db/item_proto.txt"
if not archive.is_file() and extracted.is_file():
ava = ava / "TEST" # the reference unpacked under AVA2/TEST
elif not archive.is_file():
raise ValueError("AVA2 biology requires the local FILES+SRC.tgz reference")
proto_tool = tool("biolog_proto_patch")
if not proto_tool.is_file():
@@ -401,11 +440,14 @@ def build_biolog(output: Path, pack_tool: Path):
stage = output.parent / "biolog"
stage.mkdir(parents=True, exist_ok=True)
proto = stage / "ava2-item-proto.txt"
with tarfile.open(archive, "r:gz") as source:
member = source.extractfile("home/srv1/db/item_proto.txt")
if member is None:
raise ValueError("AVA2 item table missing")
proto.write_bytes(member.read())
if not archive.is_file():
shutil.copyfile(extracted, proto)
else:
with tarfile.open(archive, "r:gz") as source:
member = source.extractfile("home/srv1/db/item_proto.txt")
if member is None:
raise ValueError("AVA2 item table missing")
proto.write_bytes(member.read())
spec = importlib.util.spec_from_file_location("biolog_assets", root / "make_assets.py")
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
@@ -421,6 +463,70 @@ def build_biolog(output: Path, pack_tool: Path):
return {"stages": 13, "item_templates": 29, "pack": "biolog", "first_priority": True}
def build_ava2_items(output: Path, pack_tool: Path):
"""AVA2 drop items missing on the server, layered over the biolog item table (see tools/server/ava2-items)."""
import importlib.util
root = REPO / "tools/server/ava2-items"
ava = REPO.parent / "AVA2"
if not (ava / "1. Client DEV/pack_maker").is_dir():
ava = ava / "TEST"
reader = REPO.parent / "metin2-server/src/server/db/src/ProtoReader.cpp"
if not (ava / "1. Client DEV/pack_maker").is_dir() or not reader.is_file():
raise ValueError("AVA2 items need ../AVA2 (pack_maker + FILES+SRC.tgz or server db) and ../metin2-server")
proto_tool = tool("item_proto_patch")
if not proto_tool.is_file():
raise ValueError("build item_proto_patch before generating the Chinese client")
stage = output.parent / "ava2-items"
spec = importlib.util.spec_from_file_location("ava2_items", root / "make_items.py")
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
# biolog's pack carries the current locale/zh item tables; this pack must replace them, so it goes first.
report = module.prepare(ava, reader, output.parent / "biolog/assets/locale/zh", stage,
proto_tool.resolve(), pack_tool.resolve(), wrap_description)
for extension in ("eix", "epk"):
shutil.copy2(stage / ("ava2items." + extension), output / "pack" / ("ava2items." + extension))
index = output / "pack/Index"
lines = index.read_bytes().replace(b"\r\n", b"\n").splitlines()
if b"ava2items" in lines:
del lines[lines.index(b"ava2items") - 1:lines.index(b"ava2items") + 1]
at = lines.index(b"biolog") - 1
lines[at:at] = [b"*", b"ava2items"]
index.write_bytes(b"\r\n".join(lines) + b"\r\n")
return {"items": len(report["kept"]) + len(report["locked"]), "kept": len(report["kept"]),
"locked": len(report["locked"]), "assets": report["assets"], "pack": "ava2items"}
def build_ava2_maps(output: Path, pack_tool: Path, ava_root: Path = None):
"""AVA2 maps/dungeons + their monsters, layered over ava2items (see tools/server/ava2-maps)."""
import importlib.util
root = REPO / "tools/server/ava2-maps"
ava = ava_root or REPO.parent / "AVA2"
if ava_root is None and not (ava / "2. Backup SF+SRC and SQL/home/srv1").is_dir():
ava = ava / "TEST"
reader = REPO.parent / "metin2-server/src/server/db/src/ProtoReader.cpp"
if not (ava / "1. Client DEV/pack_maker").is_dir() or not reader.is_file():
raise ValueError("AVA2 maps need pack_maker + extracted server tree (use --ava2-maps-root) and ../metin2-server")
tools = [tool(name) for name in ("mob_proto_patch", "gr2_textures")]
if not all(path.is_file() for path in tools):
raise ValueError("build mob_proto_patch and gr2_textures before generating the Chinese client")
spec = importlib.util.spec_from_file_location("ava2_maps", root / "make_maps.py")
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
stage = output.parent / "ava2-maps"
# Reads the effective pack chain (ava2items' locale/zh/mob_proto included), so it must run after build_ava2_items.
report = module.prepare(ava, reader, output, stage, tools[0].resolve(), tools[1].resolve(), pack_tool.resolve())
for extension in ("eix", "epk"):
shutil.copy2(stage / ("ava2maps." + extension), output / "pack" / ("ava2maps." + extension))
index = output / "pack/Index"
lines = index.read_bytes().replace(b"\r\n", b"\n").splitlines()
if b"ava2maps" in lines:
del lines[lines.index(b"ava2maps") - 1:lines.index(b"ava2maps") + 1]
at = lines.index(b"ava2items") - 1
lines[at:at] = [b"*", b"ava2maps"]
index.write_bytes(b"\r\n".join(lines) + b"\r\n")
return {"mobs": report["mobs"], "races": report["races"], "files": report["files"],
"misses": len(report["misses"]), "pack": "ava2maps"}
def build_wiki(output: Path, pack_tool: Path):
"""A versioned public server catalogue; original script and proto packs stay intact."""
@@ -457,11 +563,15 @@ def main():
parser.add_argument("--proto-tool", type=Path, default=tool("locale_proto_patch"))
parser.add_argument("--pack-tool", type=Path, default=tool("eterpack_pack"))
parser.add_argument("--name-tables", type=Path, default=DEFAULT_NAMES)
parser.add_argument("--ava2-maps-root", type=Path,
help="AVA2 reference root containing pack_maker and the extracted server tree")
args = parser.parse_args()
report_path = build(args.english, args.chinese, args.output, args.client_base,
args.proto_tool, args.name_tables, args.pack_tool)
report = json.loads(report_path.read_text())
report["biolog"] = build_biolog(args.output, args.pack_tool)
report["ava2_items"] = build_ava2_items(args.output, args.pack_tool)
report["ava2_maps"] = build_ava2_maps(args.output, args.pack_tool, args.ava2_maps_root)
report["wiki"] = build_wiki(args.output, args.pack_tool)
report_path.write_text(json.dumps(report, ensure_ascii=False, indent=2)+"\n", encoding="utf-8")
print(f"Built {args.output / 'pack/locale_zh.eix'} (.epk), registered in pack/Index")
+6
View File
@@ -187,3 +187,9 @@ The cache includes every specialization value, while alpha reference, fog and te
`--generic-shaders` / `MT_GENERIC_SHADERS=1` disables specialization for rendering comparisons.
Android Adreno 512 starts in 30 FPS saver mode when no frame-rate preference exists; saved preferences and test overrides take priority.
See [Mi 8 Lite measurements](../../docs/XIAOMI8LITE-ADAPTATION-20260930.md).
### Local QA commands between frames
`--py-command-file /absolute/path/command.py` optionally consumes local Python commands between script frames, while the script fiber is parked. Publish a complete file with atomic rename. Commands are removed before execution, including on a Python error; files over 1 MiB are rejected. This is an explicit development hook like `--py-exec`, disabled when omitted. Do not execute login/focus/phase changes from a test window's `OnUpdate`: those callbacks run during the native window-list traversal.
When reopening login, the selected live endpoint is retained instead of the packed legacy login address. A later manual server selection or explicit channel change still selects its own target; the successful game entry becomes the saved endpoint. No credentials are stored by this adapter.
+6 -3
View File
@@ -19,6 +19,7 @@
// and 2D UIRenderCommand stream + memory textures ("MTRA").
// - Version 5: adds per-draw fog color, mode, range and distance/density state.
// - Version 6: adds texture address and filtering state for both stages.
// - Version 11: adds D3D8 UI stage-0 U/V addressing; older UI captures retain clamp.
// - Version 7: adds two fixed-function lights and material color sources.
// - Version 8: eight lights, back-buffer clear entries, viewport MinZ/MaxZ, border color,
// TEXCOORDINDEX / TEXTURETRANSFORMFLAGS / D3DTS_TEXTUREn per stage, emissive
@@ -28,7 +29,7 @@
namespace native_draw_capture {
struct Capture {
std::uint32_t version = 10;
std::uint32_t version = 11;
std::vector<Render3DDraw> draws;
std::unordered_map<std::string, std::vector<std::uint8_t>> textures;
std::uint32_t ui_width = 960;
@@ -114,7 +115,7 @@ inline void write(
std::ofstream file(path, std::ios::binary | std::ios::trunc);
if (!file) throw std::runtime_error("cannot create native draw capture: " + path);
const std::uint32_t magic = 0x4d544452; // MTDR
const std::uint32_t version = 10;
const std::uint32_t version = 11;
const auto count = static_cast<std::uint32_t>(draws.size());
write_scalar(file, magic); write_scalar(file, version); write_scalar(file, count);
for (const auto& draw : draws) {
@@ -233,6 +234,7 @@ inline void write(
write_string(file, cmd.mask);
file.write(reinterpret_cast<const char*>(cmd.mu), sizeof(cmd.mu));
file.write(reinterpret_cast<const char*>(cmd.mv), sizeof(cmd.mv));
write_scalar(file,cmd.address_u);write_scalar(file,cmd.address_v);
}
if (!file) throw std::runtime_error("failed to write native draw capture: " + path);
}
@@ -242,7 +244,7 @@ inline Capture read_capture(const std::string& path) {
if (!file) throw std::runtime_error("cannot open native draw capture: " + path);
std::uint32_t magic = 0, version = 0, count = 0;
read_scalar(file, magic); read_scalar(file, version); read_scalar(file, count);
if (magic != 0x4d544452 || (version < 1 || version > 10) || count > 10'000)
if (magic != 0x4d544452 || (version < 1 || version > 11) || count > 10'000)
throw std::runtime_error("unsupported native draw capture format");
Capture capture;
capture.version = version;
@@ -404,6 +406,7 @@ inline Capture read_capture(const std::string& path) {
read_string(file, cmd.mask);
file.read(reinterpret_cast<char*>(cmd.mu), sizeof(cmd.mu));
file.read(reinterpret_cast<char*>(cmd.mv), sizeof(cmd.mv));
if(version>=11) {read_scalar(file,cmd.address_u);read_scalar(file,cmd.address_v);}
if (!file) throw std::runtime_error("truncated native draw capture UI command");
}
}
+11 -2
View File
@@ -7,6 +7,7 @@
#include "host_util.h"
#include "native_audio.h"
#include "perf_log.h"
#include "python_command_file.h"
#include "texture_decode.h"
#include "ui_scale.h"
#include "ui_quality.h"
@@ -40,6 +41,7 @@ namespace mt_host {
// --py-exec: a test hook run once the auto-login run reaches the GameWindow (or, with --login-screen,
// once the LoginWindow is up).
std::string g_py_exec_after_login;
std::string g_py_command_file;
// --perf-log / MT_PERF_LOG=1: src/host/perf_log.h.
bool g_perf_log = false;
@@ -236,7 +238,7 @@ int run_live_client(
std::snprintf(
conn_cmd,
sizeof(conn_cmd),
"_stream.SetConnectInfo('%s', %d, '%s', %d)\n"
"__import__('mt_live_endpoint').Configure(_stream, '%s', %d, '%s', %d)\n"
"_w = _stream.curPhaseWindow\n"
"_w._LoginWindow__OpenServerBoard()",
server_host.c_str(),
@@ -257,7 +259,7 @@ int run_live_client(
std::snprintf(
login_cmd,
sizeof(login_cmd),
"_stream.SetConnectInfo('%s', %d, '%s', %d)\n"
"__import__('mt_live_endpoint').Configure(_stream, '%s', %d, '%s', %d)\n"
"_w = _stream.curPhaseWindow\n"
"_w._LoginWindow__OpenLoginBoard()\n"
"_w.idEditLine.SetText('%s')\n"
@@ -458,6 +460,13 @@ int run_live_client(
}
};
while ((frames == 0 || completed < frames) && renderer.poll(true) && PythonBoot::IsAppLooping()) {
// The script fiber is parked here. UI callbacks can change focus/order/phase safely before traversal.
if (!g_py_command_file.empty()) {
std::string command_error;
if (!consume_python_command_file(g_py_command_file,py_exec,command_error) && !command_error.empty())
std::cerr << command_error << '\n';
if (!PythonBoot::IsAppLooping()) break;
}
apply_policy();
save_ui_height_if_changed();
double pace_ms = 0.0;
+2
View File
@@ -10,6 +10,8 @@ class VulkanWindow;
// --py-exec: a test hook run once the auto-login run reaches the GameWindow (or, with --login-screen,
// once the LoginWindow is up).
extern std::string g_py_exec_after_login;
// --py-command-file: optional local QA commands executed while the script fiber is parked.
extern std::string g_py_command_file;
// --perf-log / MT_PERF_LOG=1: src/host/perf_log.h.
extern bool g_perf_log;
+1
View File
@@ -137,6 +137,7 @@ int main(int argc, char** argv) {
else if (arg == "--show-fps") show_fps = true;
#ifdef MT_NATIVE_HAS_LIVE_CLIENT
else if (arg == "--py-exec" && i+1 < argc) g_py_exec_after_login = argv[++i];
else if (arg == "--py-command-file" && i+1 < argc) g_py_command_file = argv[++i];
else if (arg == "--perf-log") g_perf_log = true;
else if (arg == "--fps-cap" && i+1 < argc) g_fps_cap = std::max(0, std::stoi(argv[++i]));
else if (arg == "--refresh-rate" && i+1 < argc) g_refresh_rate = std::max(0, std::stoi(argv[++i]));
+32
View File
@@ -0,0 +1,32 @@
#pragma once
// Optional local QA input, consumed between script frames, never from a window OnUpdate callback.
#include <filesystem>
#include <fstream>
#include <string>
namespace mt_host {
template<class Execute>
bool consume_python_command_file(const std::string& path, Execute execute, std::string& error) {
if (path.empty()) return true;
std::error_code ec;
const bool exists=std::filesystem::exists(path,ec);
if (ec) { error="cannot inspect Python command file";return false; }
if (!exists) return true;
const auto size=std::filesystem::file_size(path,ec);
if (ec) { error="cannot stat Python command file";return false; }
if (size>1024*1024) {
std::filesystem::remove(path,ec);
error="Python command file exceeds 1 MiB";return false;
}
std::ifstream in(path,std::ios::binary);
if (!in) { error="cannot read Python command file";return false; }
std::string code(static_cast<std::size_t>(size),'\0');
if (size && !in.read(&code[0],static_cast<std::streamsize>(size))) {
error="incomplete Python command file";return false;
}
in.close();
// A failed command must not execute again on the next frame. Producers publish with atomic rename.
if (!std::filesystem::remove(path,ec) || ec) { error="cannot consume Python command file";return false; }
return execute(code);
}
}
+5 -1
View File
@@ -261,7 +261,10 @@ bool VulkanWindow::poll(bool forward_to_live_client) {
} else if (event.type == SDL_EVENT_FINGER_MOTION) {
touch_controller.on_finger_motion(event.tfinger.fingerID, event.tfinger.x, event.tfinger.y);
continue;
} else if (event.type == SDL_EVENT_FINGER_UP || event.type == SDL_EVENT_FINGER_CANCELED) {
} else if (event.type == SDL_EVENT_FINGER_CANCELED) {
touch_controller.cancel_gestures();
continue;
} else if (event.type == SDL_EVENT_FINGER_UP) {
touch_controller.on_finger_up(event.tfinger.fingerID, event.tfinger.x, event.tfinger.y);
continue;
}
@@ -275,6 +278,7 @@ bool VulkanWindow::poll(bool forward_to_live_client) {
SDL_HideCursor();
os_cursor_hidden_ = true;
} else if (event.type == SDL_EVENT_WINDOW_FOCUS_LOST) {
touch_controller.cancel_gestures();
SDL_CaptureMouse(false);
PythonBoot::UIMouseButton(2, false, last_mx_, last_my_);
PythonBoot::UIMouseButton(3, false, last_mx_, last_my_);
+129 -52
View File
@@ -33,12 +33,24 @@ public:
}
void set_enabled(bool enabled) {
if (enabled_ && !enabled) cancel_gestures();
enabled_ = enabled;
#ifdef MT_NATIVE_HAS_LIVE_CLIENT
PythonBoot::SetTouchInput(enabled);
#endif
}
bool is_enabled() const { return enabled_; }
// OS cancellation/focus loss must discard gestures without synthesizing a world tap.
void cancel_gestures() {
release_gameplay_controls();
ui_touch_finger_id_ = -1;
ui_gesture_ = UiGesture::None;
tap_stage_ = 0;
keyboard_requested_ = false;
#ifdef MT_NATIVE_HAS_LIVE_CLIENT
PythonBoot::SetInventoryDrag(false);
#endif
}
void set_minimum_touch_target(float logicalSize) { minimum_touch_target_ = std::max(48.0f, logicalSize); }
// Short vibration when a long press fires (the host wires it to the platform).
void set_haptic(void (*haptic)()) { haptic_ = haptic; }
@@ -110,7 +122,8 @@ public:
controls_were_visible_ = true;
if (joystick_active_) {
#ifdef MT_NATIVE_HAS_LIVE_CLIENT
PythonBoot::SetMoveDirection(move_angle_, true);
PythonBoot::SetMoveDirection(move_angle_,
std::hypot(joystick_last_x_ - joystick_base_x_, joystick_last_y_ - joystick_base_y_) > 8.0f);
#endif
}
}
@@ -165,12 +178,38 @@ public:
}
#endif
// PORT: two scene fingers own a pinch before the second can become a joystick.
// A stationary new left thumb may join the pinch; an established moving stick stays movement.
if (controls_visible && pinch_finger_id_ >= 0)
return true; // Additional scene fingers cannot steal an ongoing pinch.
if (controls_visible) {
if (look_finger_id_ == finger_id) return true;
if (look_finger_id_ >= 0) {
begin_pinch(finger_id, px, py);
return true;
}
if (joystick_active_ && !joystick_moved_) {
look_finger_id_ = joystick_finger_id_;
look_last_x_ = joystick_last_x_;
look_last_y_ = joystick_last_y_;
look_can_rotate_ = true;
joystick_active_ = false;
joystick_finger_id_ = -1;
#ifdef MT_NATIVE_HAS_LIVE_CLIENT
PythonBoot::SetMoveDirection(0.0f, false);
#endif
begin_pinch(finger_id, px, py);
return true;
}
}
// Mobile-game layout: the left half moves (floating stick), the right half looks.
if (controls_visible && norm_x < kMoveZoneRight && norm_y > kMoveZoneTop && !joystick_active_) {
joystick_active_ = true;
joystick_finger_id_ = finger_id;
joystick_base_x_ = px;
joystick_base_y_ = py;
joystick_base_x_ = joystick_last_x_ = px;
joystick_base_y_ = joystick_last_y_ = py;
joystick_moved_ = false;
joystick_knob_x_ = px;
joystick_knob_y_ = py;
update_joystick_motion(px, py);
@@ -195,15 +234,6 @@ public:
#endif
return true;
}
if (pinch_finger_id_ < 0 && look_can_rotate_ && in_look_zone) {
pinch_finger_id_ = finger_id;
pinch_x_ = px;
pinch_y_ = py;
pinch_last_dist_ = std::hypot(px - look_last_x_, py - look_last_y_);
look_rotating_ = false;
look_moved_ = true; // a pinch never ends as a tap
return true;
}
return false;
}
@@ -234,6 +264,10 @@ public:
// 2. Virtual Joystick finger
if (joystick_active_ && finger_id == joystick_finger_id_) {
joystick_last_x_ = px;
joystick_last_y_ = py;
if (std::hypot(px - joystick_base_x_, py - joystick_base_y_) > kLookDeadZone)
joystick_moved_ = true;
update_joystick_motion(px, py);
return true;
}
@@ -253,7 +287,7 @@ public:
}
}
// 4. Two-finger pinch zoom (look finger + second right-half finger)
// 4. Two-finger scene pinch: scale camera distance, without wheel inertia or UI scrolling.
if (pinch_finger_id_ >= 0 && (finger_id == pinch_finger_id_ || finger_id == look_finger_id_)) {
if (finger_id == pinch_finger_id_) {
pinch_x_ = px;
@@ -263,13 +297,13 @@ public:
look_last_y_ = py;
}
const float cur_dist = std::hypot(pinch_x_ - look_last_x_, pinch_y_ - look_last_y_);
const float delta_d = cur_dist - pinch_last_dist_;
if (std::abs(delta_d) > 2.0f) {
// Rebase very close/crossed fingers instead of dividing by a near-zero span.
if (cur_dist >= 24.0f && pinch_last_dist_ >= 24.0f) {
#ifdef MT_NATIVE_HAS_LIVE_CLIENT
PythonBoot::UIMouseWheel(int(delta_d * 8.0f));
PythonBoot::CameraZoomBy(pinch_last_dist_ / cur_dist);
#endif
pinch_last_dist_ = cur_dist;
}
pinch_last_dist_ = cur_dist;
return true;
}
@@ -423,12 +457,12 @@ public:
const uint32_t icon_col = 0xFFFFFFFF;
const float r = btn.radius;
#ifdef MT_NATIVE_HAS_LIVE_CLIENT
if (btn.id == kAutoHuntButton) {
draw_auto_hunt_button(commands, btn);
continue;
}
#ifdef MT_NATIVE_HAS_LIVE_CLIENT
if (is_quick_slot_button(btn.id)) {
std::string skill_icon;
float uv[4];
@@ -615,6 +649,16 @@ public:
}
private:
void begin_pinch(int64_t finger_id, float px, float py) {
pinch_finger_id_ = finger_id;
pinch_x_ = px;
pinch_y_ = py;
pinch_last_dist_ = std::hypot(px - look_last_x_, py - look_last_y_);
look_rotating_ = false;
look_can_rotate_ = true;
look_moved_ = true; // Neither finger may turn into a tap after pinching.
}
bool gameplay_controls_visible() const {
#ifdef MT_NATIVE_HAS_LIVE_CLIENT
return PythonBoot::InGamePhase() && !PythonBoot::CurrentMapName().empty();
@@ -649,51 +693,82 @@ private:
static bool is_quick_slot_button(int id) { return (id >= 2 && id <= 7) || id == 9 || id == 10; }
static int quick_slot_index(int id) { return id >= 9 ? id - 3 : id - 2; }
// A circular arrow; green while the hunt runs.
// Clear "AUTO" vector button; green glow while the hunt runs.
static void draw_auto_hunt_button(std::vector<UIRenderCommand>& commands, const ButtonDef& btn) {
bool on = false;
#ifdef MT_NATIVE_HAS_LIVE_CLIENT
on = PythonBoot::AutoHuntIsEnabled();
#endif
const uint32_t disc = btn.pressed ? btn.color_pressed : (on ? 0xC040C040 : btn.color_idle);
draw_filled_disc(commands, btn.x, btn.y, btn.radius, disc);
const uint32_t col = on ? 0xFFB0FFB0 : 0xDDFFFFFF;
const float r = btn.radius * 0.45f;
const float kPi = 3.14159265f;
const int segments = 12;
const float a0 = -kPi * 0.35f, a1 = a0 + kPi * 1.6f;
for (int i = 0; i < segments; ++i) {
const float t0 = a0 + (a1 - a0) * float(i) / float(segments);
const float t1 = a0 + (a1 - a0) * float(i + 1) / float(segments);
draw_line(commands, btn.x + std::cos(t0) * r, btn.y + std::sin(t0) * r,
btn.x + std::cos(t1) * r, btn.y + std::sin(t1) * r, col);
}
// Arrowhead at the arc's end, pointing along the direction of travel.
const float ex = btn.x + std::cos(a1) * r, ey = btn.y + std::sin(a1) * r;
const float tx = -std::sin(a1), ty = std::cos(a1);
const float nx = std::cos(a1), ny = std::sin(a1);
const float h = r * 0.55f;
draw_line(commands, ex, ey, ex - tx * h + nx * h * 0.6f, ey - ty * h + ny * h * 0.6f, col);
draw_line(commands, ex, ey, ex - tx * h - nx * h * 0.6f, ey - ty * h - ny * h * 0.6f, col);
const uint32_t disc = btn.pressed ? (on ? 0xEB257D32 : 0xEB16110C) : (on ? 0xDD1B5E20 : 0x8A16110C);
draw_filled_disc(commands, btn.x, btn.y, btn.radius * 0.88f, disc);
const uint32_t ring_col = on ? 0xFF80FF90 : (btn.pressed ? 0xFFB89545 : 0x8A997847);
draw_circle(commands, btn.x, btn.y, btn.radius * 0.90f, ring_col, 32);
if (on) {
// A play dot in the middle while running.
draw_rect_bar(commands, btn.x - 2.0f, btn.y - 2.0f, btn.x + 2.0f, btn.y + 2.0f, col);
draw_circle(commands, btn.x, btn.y, btn.radius * 0.72f, 0x6680FF90, 32);
}
const uint32_t text_col = on ? 0xFFFFFFFF : (btn.pressed ? 0xFFFFFFFF : 0xFFD8C49A);
const float h = std::round(btn.radius * 0.44f);
const float w = std::round(h * 0.52f);
const float gap = std::max(1.5f, std::round(h * 0.18f));
const float total_w = 4.0f * w + 3.0f * gap;
const float top = btn.y - h * 0.5f;
const float bot = top + h;
const float mid = top + h * 0.5f;
float x = btn.x - total_w * 0.5f;
// 'A'
draw_line(commands, x, bot, x + w * 0.5f, top, text_col);
draw_line(commands, x + 0.6f, bot, x + w * 0.5f + 0.6f, top, text_col);
draw_line(commands, x + w * 0.5f, top, x + w, bot, text_col);
draw_line(commands, x + w * 0.5f - 0.6f, top, x + w - 0.6f, bot, text_col);
draw_rect_bar(commands, x + w * 0.22f, mid + 0.3f, x + w * 0.78f, mid + 1.5f, text_col);
x += w + gap;
// 'U'
draw_rect_bar(commands, x, top, x + 1.3f, bot - 1.0f, text_col);
draw_rect_bar(commands, x + w - 1.3f, top, x + w, bot - 1.0f, text_col);
draw_rect_bar(commands, x + 1.0f, bot - 1.3f, x + w - 1.0f, bot, text_col);
draw_line(commands, x, bot - 1.0f, x + 1.0f, bot, text_col);
draw_line(commands, x + w - 1.0f, bot, x + w, bot - 1.0f, text_col);
x += w + gap;
// 'T'
draw_rect_bar(commands, x, top, x + w, top + 1.3f, text_col);
const float t_stem = x + (w - 1.3f) * 0.5f;
draw_rect_bar(commands, t_stem, top + 1.0f, t_stem + 1.3f, bot, text_col);
x += w + gap;
// 'O'
draw_rect_bar(commands, x + 1.0f, top, x + w - 1.0f, top + 1.3f, text_col);
draw_rect_bar(commands, x + 1.0f, bot - 1.3f, x + w - 1.0f, bot, text_col);
draw_rect_bar(commands, x, top + 1.0f, x + 1.3f, bot - 1.0f, text_col);
draw_rect_bar(commands, x + w - 1.3f, top + 1.0f, x + w, bot - 1.0f, text_col);
draw_line(commands, x, top + 1.0f, x + 1.0f, top, text_col);
draw_line(commands, x + w - 1.0f, top, x + w, top + 1.0f, text_col);
draw_line(commands, x, bot - 1.0f, x + 1.0f, bot, text_col);
draw_line(commands, x + w - 1.0f, bot, x + w, bot - 1.0f, text_col);
}
void init_buttons() {
buttons_.clear();
// Lower-right combat controls. All menus and status UI remain the original 40250 UI.
buttons_.push_back({1, 0x39, 0, 0, 42.0f, "ATK", 0xC04C2818, 0xE0A77832});
buttons_.push_back({2, 0x02, 0, 0, 26.0f, "S1", 0x803060C0, 0xD05080FF});
buttons_.push_back({3, 0x03, 0, 0, 26.0f, "S2", 0x80903090, 0xD0D050D0});
buttons_.push_back({4, 0x04, 0, 0, 26.0f, "S3", 0x80309060, 0xD050D080});
buttons_.push_back({5, 0x05, 0, 0, 26.0f, "S4", 0x80906030, 0xD0D08050});
buttons_.push_back({6, 0x06, 0, 0, 26.0f, "S5", 0x80603090, 0xD08050D0});
buttons_.push_back({7, 0x07, 0, 0, 26.0f, "S6", 0x80308090, 0xD050C0D0});
buttons_.push_back({kAutoHuntButton, 0, 0, 0, 24.0f, "AUTO", 0x80707070, 0xD0FFFFFF});
buttons_.push_back({9, 0x08, 0, 0, 28.0f, "7", 0xB032211B, 0xE0664B2D});
buttons_.push_back({10, 0x09, 0, 0, 28.0f, "8", 0xB032211B, 0xE0664B2D});
buttons_.push_back({2, 0x02, 0, 0, 22.0f, "S1", 0x803060C0, 0xD05080FF});
buttons_.push_back({3, 0x03, 0, 0, 22.0f, "S2", 0x80903090, 0xD0D050D0});
buttons_.push_back({4, 0x04, 0, 0, 22.0f, "S3", 0x80309060, 0xD050D080});
buttons_.push_back({5, 0x05, 0, 0, 22.0f, "S4", 0x80906030, 0xD0D08050});
buttons_.push_back({6, 0x06, 0, 0, 22.0f, "S5", 0x80603090, 0xD08050D0});
buttons_.push_back({7, 0x07, 0, 0, 22.0f, "S6", 0x80308090, 0xD050C0D0});
buttons_.push_back({kAutoHuntButton, 0, 0, 0, 22.0f, "AUTO", 0x80707070, 0xD0FFFFFF});
buttons_.push_back({9, 0x08, 0, 0, 24.0f, "7", 0xB032211B, 0xE0664B2D});
buttons_.push_back({10, 0x09, 0, 0, 24.0f, "8", 0xB032211B, 0xE0664B2D});
for (auto& btn : buttons_) {
if (is_quick_slot_button(btn.id)) {
btn.color_idle = 0xA032211B;
@@ -717,7 +792,7 @@ private:
int find_button(float x, float y) {
int nearest = -1;
float best = 1.25f;
float best = 1.15f;
for (size_t i = 0; i < buttons_.size(); ++i) {
const auto& btn = buttons_[i];
const float distance = std::hypot(x - btn.x, y - btn.y) / btn.radius;
@@ -873,6 +948,8 @@ private:
float joystick_radius_ = 65.0f;
float joystick_knob_radius_ = 23.0f;
float move_angle_ = 0.0f;
float joystick_last_x_ = 0.0f, joystick_last_y_ = 0.0f;
bool joystick_moved_ = false;
// Zones are fractions of the screen; distances are logical UI pixels.
static constexpr float kMoveZoneRight = 0.5f;
+15 -14
View File
@@ -16,25 +16,26 @@ struct TouchLayout {
inline TouchLayout make_touch_layout(float width, float height, float safe_inset, float minimum_target) {
TouchLayout layout{};
layout.scale = std::max(minimum_target / 52.0f,
layout.scale = std::max(minimum_target / 44.0f,
std::clamp(std::min(height / 600.0f, (width - 2 * safe_inset) / 800.0f), 0.65f, 1.35f));
const float s = layout.scale;
const float ax = width - safe_inset - 78 * s;
// Leave the original status/menu strip clear below the lowest skill.
const float ay = height - 136 * s;
layout.buttons[0] = {ax, ay, 44 * s};
// PORT: D2R Mobile's main-button + single skill arc arrangement, extended to six slots.
// 24-degree spacing at radius 176 keeps even the expanded (1.25x) hit circles separate.
const float ax = width - safe_inset - 74 * s;
// Lowered attack button for thumb resting near the bottom edge.
const float ay = height - 88 * s;
layout.buttons[0] = {ax, ay, 42 * s};
// Compact single-layer skill arc in the upper-left of attack button:
// 20-degree spacing from 170 to 270 degrees at radius 140 keeps the skills tightly
// wrapped around the attack button without encroaching on the minimap or screen center.
for (int slot = 0; slot < 6; ++slot) {
const float angle = (160.0f + 24.0f * slot) * 3.14159265f / 180.0f;
layout.buttons[slot + 1] = {ax + std::cos(angle) * 176 * s,
ay + std::sin(angle) * 176 * s, 28 * s};
const float angle = (170.0f + 20.0f * slot) * 3.14159265f / 180.0f;
layout.buttons[slot + 1] = {ax + std::cos(angle) * 140 * s,
ay + std::sin(angle) * 140 * s, 22 * s};
}
// Keep the settings/toggle action outside the arc, away from repeated attack taps.
layout.buttons[7] = {ax - 246 * s, ay - 84 * s, 26 * s};
// Auto hunt button nestled compactly just outside the skill arc.
layout.buttons[7] = {ax - 195 * s, ay - 50 * s, 22 * s};
const float item_center = std::min(width / 2, layout.buttons[1].x - 114 * s);
layout.buttons[8] = {item_center - 36 * s, height - 38 * s, 28 * s};
layout.buttons[9] = {item_center + 36 * s, height - 38 * s, 28 * s};
layout.buttons[8] = {item_center - 36 * s, height - 38 * s, 24 * s};
layout.buttons[9] = {item_center + 36 * s, height - 38 * s, 24 * s};
return layout;
}
+1 -1
View File
@@ -154,7 +154,7 @@ void VulkanWindow::build_ui_batches(
? ((cmd.blend == 1 || cmd.blend == 2) ? 0x2A : (cmd.blend == 3 ? 0x31 : 1))
: 1;
const VkPipeline pipeline = get_pipeline(0, 0, blend_mode);
const VkDescriptorSet descriptor = get_ui_texture_descriptor(tex_name, mask_name, capture_textures, point);
const VkDescriptorSet descriptor = get_ui_texture_descriptor(tex_name, mask_name, capture_textures, point, cmd.address_u, cmd.address_v);
for (int k = 0; k < 4; ++k) {
Vertex& vert = vertices[v_count + k];
+10 -8
View File
@@ -173,7 +173,7 @@ void VulkanWindow::prepare_draws(const std::vector<Render3DDraw>& draws, const T
RenderTarget* target = nullptr;
if (draw.render_target) {
target = get_render_target(
Render3DRenderTargetName(draw.render_target, draw.target_width, draw.target_height));
Render3DRenderTargetName(draw.render_target, draw.target_width, draw.target_height, draw.target_color));
if (!target) continue;
}
if (draw.clear_flags && target) {
@@ -257,7 +257,8 @@ void VulkanWindow::prepare_draws(const std::vector<Render3DDraw>& draws, const T
}
}
const auto pipeline = get_pipeline(cull, depth, blend, draw.lines,
static_cast<std::uint8_t>(draw.z_func), target != nullptr, &draw);
static_cast<std::uint8_t>(draw.z_func),
std::uint8_t(target ? (target->color ? 2 : 1) : 0), &draw);
// D3DTOP_DISABLE (1) on stage 0 or 1 ends the cascade before stage 1 samples.
const bool bind_tex1 = !draw.texture1.empty() && draw.color_op[0] > 1 && draw.color_op[1] > 1;
const auto descriptor = get_texture_descriptor(
@@ -265,8 +266,9 @@ void VulkanWindow::prepare_draws(const std::vector<Render3DDraw>& draws, const T
auto constants = make_push_constants(draw, skin_offset_encoded);
if (draw.pretransformed) {
const float screen_width = float(logical_width());
const float screen_height = float(logical_height());
// PORT: a pretransformed draw into a render target is in the target's pixels.
const float screen_width = target ? float(target->width) : float(logical_width());
const float screen_height = target ? float(target->height) : float(logical_height());
// Screen pixels (y down) to D3D NDC (y up); the shader's Y flip then maps to Vulkan.
constants.mvp = {2.0f / screen_width, 0, 0, 0,
0, -2.0f / screen_height, 0, 0,
@@ -448,7 +450,7 @@ void VulkanWindow::record_passes(std::uint32_t image_index, const FrameDraws& fr
for (std::size_t i = 0; i < frame.offscreen_draws.size();) {
RenderTarget* target = frame.offscreen_draws[i].target;
VkRenderPassBeginInfo offscreen_begin{VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO};
offscreen_begin.renderPass = offscreen_pass_;
offscreen_begin.renderPass = target->color ? offscreen_color_pass_ : offscreen_pass_;
offscreen_begin.framebuffer = target->framebuffer;
offscreen_begin.renderArea.extent = {target->width, target->height};
vkCmdBeginRenderPass(f_->command, &offscreen_begin, VK_SUBPASS_CONTENTS_INLINE);
@@ -559,10 +561,10 @@ VulkanWindow::Readback VulkanWindow::record_readbacks(std::uint32_t image_index)
const char* dump_rt = std::getenv("MT_DUMP_RT");
if (readback.bmp && dump_rt && *dump_rt) {
readback.dump_rt = dump_rt;
const std::uint32_t texel = offscreen_format_ == VK_FORMAT_R5G6B5_UNORM_PACK16 ? 2 : 4;
for (auto& entry : render_targets_) {
RenderTarget& rt = entry.second;
Readback::RtDump dump{VK_NULL_HANDLE, VK_NULL_HANDLE, rt.width, rt.height};
const std::uint32_t texel = !rt.color && offscreen_format_ == VK_FORMAT_R5G6B5_UNORM_PACK16 ? 2 : 4;
Readback::RtDump dump{VK_NULL_HANDLE, VK_NULL_HANDLE, rt.width, rt.height, texel};
VkBufferCreateInfo info{VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO};
info.size = VkDeviceSize(rt.width) * rt.height * texel; info.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT;
check(vkCreateBuffer(device_, &info, nullptr, &dump.buffer), "vkCreateBuffer rt dump");
@@ -615,9 +617,9 @@ void VulkanWindow::finish_readbacks(Readback& readback) {
for (auto& sink : readback.sinks) sink(bgra.data(), w, h);
}
vkUnmapMemory(device_, readback.memory);
const std::uint32_t texel = offscreen_format_ == VK_FORMAT_R5G6B5_UNORM_PACK16 ? 2 : 4;
for (std::size_t n = 0; n < readback.rt_dumps.size(); ++n) {
const auto& dump = readback.rt_dumps[n];
const std::uint32_t texel = dump.texel;
void* data = nullptr;
check(vkMapMemory(device_, dump.memory, 0, VK_WHOLE_SIZE, 0, &data), "vkMapMemory rt dump");
const auto* bytes = static_cast<const std::uint8_t*>(data);
+12 -5
View File
@@ -104,8 +104,13 @@ void VulkanWindow::create_offscreen_pass() {
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
offscreen_format_ = (properties.optimalTilingFeatures & wanted) == wanted
? VK_FORMAT_R5G6B5_UNORM_PACK16 : VK_FORMAT_R8G8B8A8_UNORM;
offscreen_pass_ = make_offscreen_pass(offscreen_format_);
offscreen_color_pass_ = make_offscreen_pass(VK_FORMAT_R8G8B8A8_UNORM);
}
VkRenderPass VulkanWindow::make_offscreen_pass(VkFormat format) {
VkAttachmentDescription attachments[2]{};
attachments[0].format = offscreen_format_; attachments[0].samples = VK_SAMPLE_COUNT_1_BIT;
attachments[0].format = format; attachments[0].samples = VK_SAMPLE_COUNT_1_BIT;
attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD; attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
attachments[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
attachments[0].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
@@ -146,15 +151,17 @@ void VulkanWindow::create_offscreen_pass() {
pass_info.attachmentCount = 2; pass_info.pAttachments = attachments;
pass_info.subpassCount = 1; pass_info.pSubpasses = &subpass;
pass_info.dependencyCount = 2; pass_info.pDependencies = dependencies;
check(vkCreateRenderPass(device_, &pass_info, nullptr, &offscreen_pass_), "vkCreateRenderPass offscreen");
VkRenderPass pass = VK_NULL_HANDLE;
check(vkCreateRenderPass(device_, &pass_info, nullptr, &pass), "vkCreateRenderPass offscreen");
return pass;
}
VkPipeline VulkanWindow::get_pipeline(std::uint8_t cull, std::uint8_t depth, std::uint8_t blend,
bool lines, std::uint8_t z_func, bool offscreen, const Render3DDraw* draw) {
bool lines, std::uint8_t z_func, std::uint8_t offscreen, const Render3DDraw* draw) {
std::array<std::uint32_t, 17> key{};
key[0] = std::uint32_t(cull) | (std::uint32_t(depth) << 8) |
(std::uint32_t(blend) << 16) | (lines ? (1u << 24) : 0u) |
(std::uint32_t(z_func & 0xfu) << 25) | (offscreen ? (1u << 29) : 0u);
(std::uint32_t(z_func & 0xfu) << 25) | (std::uint32_t(offscreen & 3u) << 29);
static const bool specialize = std::getenv("MT_GENERIC_SHADERS") == nullptr;
key[1] = specialize ? 1u : 0u;
if (specialize && draw) {
@@ -296,7 +303,7 @@ VkPipeline VulkanWindow::get_pipeline(std::uint8_t cull, std::uint8_t depth, std
pipeline_info.pMultisampleState = &multisample; pipeline_info.pDepthStencilState = &depth_stencil;
pipeline_info.pColorBlendState = &blending;
pipeline_info.pDynamicState = &dynamic_info;
pipeline_info.layout = layout_; pipeline_info.renderPass = offscreen ? offscreen_pass_ : pass_;
pipeline_info.layout = layout_; pipeline_info.renderPass = offscreen == 2 ? offscreen_color_pass_ : offscreen ? offscreen_pass_ : pass_;
VkPipeline handle = VK_NULL_HANDLE;
check(vkCreateGraphicsPipelines(device_, VK_NULL_HANDLE, 1, &pipeline_info, nullptr, &handle), "vkCreateGraphicsPipelines");
pipelines_.emplace(key, handle);
+18 -7
View File
@@ -270,15 +270,23 @@ void VulkanWindow::ensure_ui_capacity(std::size_t command_count) {
}
VulkanWindow::RenderTarget* VulkanWindow::get_render_target(const std::string& name) {
if (auto it = render_targets_.find(name); it != render_targets_.end()) return &it->second;
if (auto it = render_targets_.find(name); it != render_targets_.end()) {
it->second.last_used_frame = frame_number_;
return &it->second;
}
unsigned id = 0, w = 0, h = 0;
if (std::sscanf(name.c_str(), "rt:%u:%ux%u", &id, &w, &h) != 3 || !w || !h || w > 4096 || h > 4096)
int end = 0;
if (std::sscanf(name.c_str(), "rt:%u:%ux%u%n", &id, &w, &h, &end) != 3 || !w || !h || w > 4096 || h > 4096)
return nullptr;
const bool color = name.compare(std::size_t(end), std::string::npos, ":c") == 0;
if (!color && name[std::size_t(end)] != '\0') return nullptr;
RenderTarget& target = render_targets_[name];
target.width = w;
target.height = h;
target.color = color;
target.last_used_frame = frame_number_;
auto make_image = [&](VkFormat format, VkImageUsageFlags usage, VkImageAspectFlags aspect,
VkImage& image, VkDeviceMemory& memory, VkImageView& view) {
VkImage& image, VkDeviceMemory& memory, VkImageView& view, bool opaque = false) {
VkImageCreateInfo info{VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO};
info.imageType = VK_IMAGE_TYPE_2D;
info.format = format;
@@ -299,18 +307,20 @@ VulkanWindow::RenderTarget* VulkanWindow::get_render_target(const std::string& n
VkImageViewCreateInfo view_info{VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO};
view_info.image = image; view_info.viewType = VK_IMAGE_VIEW_TYPE_2D; view_info.format = format;
view_info.subresourceRange = {aspect, 0, 1, 0, 1};
// A colour target is D3DFMT_X8R8G8B8: sampled alpha is always 1.
if (opaque) view_info.components.a = VK_COMPONENT_SWIZZLE_ONE;
check(vkCreateImageView(device_, &view_info, nullptr, &view), "vkCreateImageView render target");
};
make_image(offscreen_format_,
make_image(color ? VK_FORMAT_R8G8B8A8_UNORM : offscreen_format_,
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT |
VK_IMAGE_USAGE_TRANSFER_SRC_BIT,
VK_IMAGE_ASPECT_COLOR_BIT, target.texture.image, target.texture.memory, target.texture.view);
VK_IMAGE_ASPECT_COLOR_BIT, target.texture.image, target.texture.memory, target.texture.view, color);
make_image(VK_FORMAT_D32_SFLOAT,
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT,
VK_IMAGE_ASPECT_DEPTH_BIT, target.depth_image, target.depth_memory, target.depth_view);
const VkImageView views[2] = {target.texture.view, target.depth_view};
VkFramebufferCreateInfo fb{VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO};
fb.renderPass = offscreen_pass_;
fb.renderPass = color ? offscreen_color_pass_ : offscreen_pass_;
fb.attachmentCount = 2; fb.pAttachments = views;
fb.width = w; fb.height = h; fb.layers = 1;
check(vkCreateFramebuffer(device_, &fb, nullptr, &target.framebuffer), "vkCreateFramebuffer render target");
@@ -343,7 +353,8 @@ void VulkanWindow::initialize_render_target(RenderTarget& target) {
barriers[1].subresourceRange = {VK_IMAGE_ASPECT_DEPTH_BIT, 0, 1, 0, 1};
vkCmdPipelineBarrier(f_->command, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
0, 0, nullptr, 0, nullptr, 2, barriers);
const VkClearColorValue white{{1.0f, 1.0f, 1.0f, 1.0f}};
const float shade = target.color ? 0.0f : 1.0f;
const VkClearColorValue white{{shade, shade, shade, 1.0f}};
const VkClearDepthStencilValue far{1.0f, 0};
vkCmdClearColorImage(f_->command, target.texture.image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &white, 1,
&barriers[0].subresourceRange);
+1 -1
View File
@@ -181,7 +181,7 @@ VulkanWindow::PreparedDraw VulkanWindow::scene_composite_draw() {
for (int i = 0; i < 16; ++i) m[i] = i % 5 == 0 ? 1.0f : 0.0f;
PreparedDraw composite{};
composite.geometry = &scene_quad_;
composite.pipeline = get_pipeline(0, 0, 0, false, 4, false, &quad);
composite.pipeline = get_pipeline(0, 0, 0, false, 4, 0, &quad);
composite.descriptor = scene_texture_.descriptor;
composite.constants = make_push_constants(quad, 0.0f);
// Unit square (y down) to D3D NDC (y up), as the pretransformed draws map screen pixels.
+27 -1
View File
@@ -195,7 +195,20 @@ VkDescriptorSet VulkanWindow::get_texture_descriptor(
VkDescriptorSet VulkanWindow::get_ui_texture_descriptor(
const std::string& texture0_name,
const std::string& mask_name,
const std::unordered_map<std::string, std::vector<std::uint8_t>>& capture_textures, bool point) {
const std::unordered_map<std::string, std::vector<std::uint8_t>>& capture_textures, bool point,
std::uint32_t address_u,std::uint32_t address_v) {
if(address_u!=3 || address_v!=3) {
// 40250 ExpandedImage uses the current D3D8 addressing state. Board backgrounds tile;
// clamping them stretches the edge texels into stripes. Reuse the existing sampler cache.
Render3DDraw state{};
state.address_u[0]=address_u; state.address_v[0]=address_v;
state.address_u[1]=state.address_v[1]=3;
for(int i=0;i<2;++i) {
state.min_filter[i]=state.mag_filter[i]=point?1:2;
state.mip_filter[i]=0; // UI remains at mip zero, including the HD archive.
}
return get_texture_descriptor(texture0_name,mask_name,capture_textures,state);
}
auto& tex0 = get_gpu_texture(texture0_name, capture_textures);
if (point && mask_name.empty() && tex0.view) {
if (!tex0.ui_point_descriptor)
@@ -430,6 +443,19 @@ void VulkanWindow::prune_textures() {
it = textures_.erase(it);
} else ++it;
}
// PORT: render targets too (a closed model preview); a later use recreates and clears one.
for (auto it = render_targets_.begin(); it != render_targets_.end();) {
if (frame_number_ - it->second.last_used_frame > static_retention_frames) {
for (auto pair = paired_descriptors_.begin(); pair != paired_descriptors_.end();) {
if (pair->first.find("\n" + it->first + "\n") != std::string::npos) {
vkFreeDescriptorSets(device_, descriptor_pool_, 1, &pair->second.set);
pair = paired_descriptors_.erase(pair);
} else ++pair;
}
release_render_target(it->second);
it = render_targets_.erase(it);
} else ++it;
}
}
} // namespace mt_host
+1
View File
@@ -125,6 +125,7 @@ VulkanWindow::~VulkanWindow() {
for (auto& entry : textures_) release_texture(entry.second);
for (auto& entry : render_targets_) release_render_target(entry.second);
if (offscreen_pass_) vkDestroyRenderPass(device_, offscreen_pass_, nullptr);
if (offscreen_color_pass_) vkDestroyRenderPass(device_, offscreen_color_pass_, nullptr);
destroy_scene_target();
release_geometry(scene_quad_);
if (scene_pass_) vkDestroyRenderPass(device_, scene_pass_, nullptr);
+14 -7
View File
@@ -56,8 +56,9 @@ class VulkanWindow {
VkDescriptorSet set = VK_NULL_HANDLE;
std::uint64_t last_used_frame = 0;
};
// An offscreen D3D render-target texture (the 40250 character shadow map, "rt:<id>:<w>x<h>"):
// drawn by the frame's offscreen pass ahead of the back-buffer pass and sampled by that pass.
// An offscreen D3D render-target texture (the 40250 character shadow map, "rt:<id>:<w>x<h>", or a
// colour target such as the model preview, "rt:<id>:<w>x<h>:c"): drawn by the frame's offscreen pass
// ahead of the back-buffer pass and sampled by that pass.
// Between frames the colour image stays SHADER_READ_ONLY_OPTIMAL and the depth image
// DEPTH_STENCIL_ATTACHMENT_OPTIMAL; the render pass keeps (LOAD/STORE) both, like a D3D surface.
struct RenderTarget {
@@ -67,7 +68,9 @@ class VulkanWindow {
VkImageView depth_view = VK_NULL_HANDLE;
VkFramebuffer framebuffer = VK_NULL_HANDLE;
std::uint32_t width = 0, height = 0;
bool initialized = false; // cleared to white / depth 1 by the first frame that uses it
bool initialized = false; // cleared (shadow white, colour black) / depth 1 by the first frame that uses it
bool color = false; // RGBA8 drawn with offscreen_color_pass_; otherwise offscreen_format_
std::uint64_t last_used_frame = 0; // pruned with the textures once unused
};
struct PreparedDraw {
Geometry* geometry = nullptr;
@@ -223,7 +226,7 @@ private:
};
// Host copies of the swapchain image (--screenshot-out) and, with MT_DUMP_RT, of every render target.
struct Readback {
struct RtDump { VkBuffer buffer; VkDeviceMemory memory; std::uint32_t w, h; };
struct RtDump { VkBuffer buffer; VkDeviceMemory memory; std::uint32_t w, h, texel; };
bool screenshot = false; // the swapchain image is copied (a BMP or a frame sink wants it)
bool bmp = false; // --screenshot-out
std::vector<FrameSink> sinks;
@@ -297,7 +300,9 @@ private:
// The render pass of offscreen render-target textures: colour (R5G6B5 like the D3D surface when
// the device can render to it) + D32 depth, both loaded and stored, colour left shader-readable.
// PORT: plus offscreen_color_pass_, the same pass over RGBA8 for colour targets.
void create_offscreen_pass();
VkRenderPass make_offscreen_pass(VkFormat format);
// The reduced-resolution scene pass: pass_'s attachments (so pass_ pipelines draw in it) at
// scene_extent_, resolving into the sampled scene_texture_. Unsupported when the swapchain
@@ -322,9 +327,10 @@ private:
// the layouts offscreen_pass_ expects. Recorded outside any render pass.
void initialize_render_target(RenderTarget& target);
// offscreen: for offscreen_pass_ (single-sampled render-target texture) instead of pass_.
// offscreen: 1 for offscreen_pass_, 2 for offscreen_color_pass_ (single-sampled render-target
// texture) instead of pass_.
VkPipeline get_pipeline(std::uint8_t cull, std::uint8_t depth, std::uint8_t blend,
bool lines = false, std::uint8_t z_func = 4, bool offscreen = false,
bool lines = false, std::uint8_t z_func = 4, std::uint8_t offscreen = 0,
const Render3DDraw* draw = nullptr);
VkDescriptorSet allocate_texture_descriptor_set(VkImageView view0, VkImageView view1,
@@ -351,7 +357,7 @@ private:
const std::string& texture0_name,
const std::string& mask_name,
const std::unordered_map<std::string, std::vector<std::uint8_t>>& capture_textures,
bool point = false);
bool point = false, std::uint32_t address_u = 3, std::uint32_t address_v = 3);
void upload_texture(
std::uint32_t width,
@@ -478,6 +484,7 @@ private:
std::unordered_map<std::string, PairedDescriptor> paired_descriptors_;
std::unordered_map<std::string, RenderTarget> render_targets_;
VkRenderPass offscreen_pass_ = VK_NULL_HANDLE;
VkRenderPass offscreen_color_pass_ = VK_NULL_HANDLE;
float render_scale_ = 1.0f;
bool scene_supported_ = false;
VkRenderPass scene_pass_ = VK_NULL_HANDLE;
+65
View File
@@ -0,0 +1,65 @@
set(mt_mesh_default OFF)
if(APPLE OR ANDROID)
set(mt_mesh_default ON)
endif()
option(MT_ENABLE_MESHPORT "Embed MeshPort application networking" ${mt_mesh_default})
if(NOT MT_ENABLE_MESHPORT)
return()
endif()
set(MT_MESHPORT_ROOT "${PROJECT_SOURCE_DIR}/third_party/meshport" CACHE PATH "MeshPort source checkout")
if(ANDROID)
set(mt_mesh_library "${PROJECT_SOURCE_DIR}/build/meshport-runtime/aarch64-linux-android/release/libmetin2_meshport.a")
else()
set(mt_mesh_library "${PROJECT_SOURCE_DIR}/build/meshport-runtime/release/libmetin2_meshport.a")
endif()
set(MT_MESHPORT_LIBRARY "${mt_mesh_library}" CACHE FILEPATH "MeshPort static library for this target")
if(NOT EXISTS "${MT_MESHPORT_LIBRARY}")
message(FATAL_ERROR "Build MeshPort first: scripts/build_meshport.sh (or set MT_MESHPORT_LIBRARY)")
endif()
# A private build input, never copy network credentials into the source tree.
set(mt_mesh_config "${PROJECT_SOURCE_DIR}/config/meshport.private.toml")
if(EXISTS "$ENV{HOME}/Library/Application Support/MeshPort/network-profile.toml")
set(mt_mesh_config "$ENV{HOME}/Library/Application Support/MeshPort/network-profile.toml")
endif()
set(MT_MESHPORT_CONFIG "${mt_mesh_config}"
CACHE FILEPATH "Saved MeshPort network configuration to embed")
set(MT_MESHPORT_TOML "")
if(EXISTS "${MT_MESHPORT_CONFIG}")
file(READ "${MT_MESHPORT_CONFIG}" MT_MESHPORT_TOML)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${MT_MESHPORT_CONFIG}")
else()
message(WARNING "MeshPort network profile missing: LAN login works, remote login requires MT_MESHPORT_CONFIG")
endif()
configure_file(config.h.in "${CMAKE_CURRENT_BINARY_DIR}/MeshPortConfig.h" @ONLY)
add_library(mt_meshport STATIC transport.cpp)
target_include_directories(mt_meshport PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}"
PRIVATE "${MT_MESHPORT_ROOT}/crates/meshport-ffi/include")
target_compile_definitions(mt_meshport PUBLIC MT_HAS_MESHPORT=1)
target_link_libraries(mt_meshport PUBLIC "${MT_MESHPORT_LIBRARY}")
if(APPLE)
target_link_libraries(mt_meshport PUBLIC "-framework Security" "-framework SystemConfiguration"
"-framework CoreFoundation" resolv iconv)
elseif(ANDROID)
target_link_libraries(mt_meshport PUBLIC log android dl m)
endif()
if(BUILD_TESTING AND NOT ANDROID)
add_executable(meshport_transport_test "${PROJECT_SOURCE_DIR}/tests/meshport/transport_test.cpp")
target_link_libraries(meshport_transport_test PRIVATE mt_meshport)
add_test(NAME meshport.transport COMMAND meshport_transport_test)
add_executable(meshport_network_paths_test "${PROJECT_SOURCE_DIR}/tests/meshport/network_paths_test.cpp")
target_link_libraries(meshport_network_paths_test PRIVATE mt_meshport)
find_package(Python3 COMPONENTS Interpreter)
if(Python3_FOUND)
add_test(NAME meshport.login COMMAND "${Python3_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/tests/meshport/test_login.py")
if(EXISTS "${PROJECT_SOURCE_DIR}/build/meshport-runtime/release/examples/gateway_fixture")
add_test(NAME meshport.network_paths COMMAND "${Python3_EXECUTABLE}"
"${PROJECT_SOURCE_DIR}/tests/meshport/test_network_paths.py" "$<TARGET_FILE:meshport_network_paths_test>")
set_tests_properties(meshport.network_paths PROPERTIES TIMEOUT 120)
endif()
if(APPLE AND EXISTS "${PROJECT_SOURCE_DIR}/build/meshport-runtime/release/libmetin2_meshport.dylib")
add_test(NAME meshport.dhcp COMMAND "${Python3_EXECUTABLE}"
"${PROJECT_SOURCE_DIR}/tests/meshport/sdk_smoke.py")
set_tests_properties(meshport.dhcp PROPERTIES TIMEOUT 55)
endif()
endif()
endif()
+3
View File
@@ -0,0 +1,3 @@
#pragma once
// Generated private build input. Network credentials are intentionally not logged.
static const char* const kMeshPortConfig = R"MESHCONFIG(@MT_MESHPORT_TOML@)MESHCONFIG";
+4911
View File
File diff suppressed because it is too large Load Diff
+20
View File
@@ -0,0 +1,20 @@
[package]
name = "metin2-meshport"
version = "0.1.0"
edition = "2024"
rust-version = "1.95"
[workspace]
resolver = "2"
[lib]
crate-type = ["staticlib", "cdylib"]
[dependencies]
meshport-ffi = { path = "../../../third_party/meshport/crates/meshport-ffi" }
serde_json = "1"
[dev-dependencies]
easytier = { path = "../../../third_party/meshport/vendor/easytier/easytier", default-features = false, features = ["aes-gcm", "ffi-dataplane", "proxy-cidr-monitor", "dhcp-ipv4", "tcp-hole-punch", "proxy-packet"] }
easytier-core = { path = "../../../third_party/meshport/vendor/easytier/easytier-core", default-features = false, features = ["proxy-smoltcp-stack"] }
tokio = { version = "1", features = ["rt-multi-thread", "macros", "net", "io-util", "sync", "time"] }
@@ -0,0 +1,38 @@
//! Isolated test gateway. Maps a private advertised subnet to loopback; no OS routes/TUN.
use easytier::instance::factory::create_native_instance;
use easytier_core::config::toml::{ConfigLoader, TomlConfig};
use tokio::{net::{TcpListener,UdpSocket},io::{AsyncReadExt,AsyncWriteExt}};
#[tokio::main]
async fn main() {
let tcp=TcpListener::bind("127.0.0.1:0").await.unwrap();
let tcp_port=tcp.local_addr().unwrap().port();
let udp=UdpSocket::bind("127.0.0.1:0").await.unwrap();
let udp_port=udp.local_addr().unwrap().port();
let reserve=std::net::TcpListener::bind("127.0.0.1:0").unwrap();
let mesh_port=reserve.local_addr().unwrap().port();drop(reserve);
let name=format!("metin2-gateway-test-{}",std::process::id());
let config=format!("ipv4='10.253.85.1/24'\nlisteners=['tcp://127.0.0.1:{mesh_port}']\nstun_servers=[]\nstun_servers_v6=[]\n[[proxy_network]]\ncidr='127.0.0.0/24'\nmapped_cidr='10.253.79.0/24'\n[network_identity]\nnetwork_name='{name}'\nnetwork_secret='isolated-test-only'\n[flags]\nno_tun=true\nuse_smoltcp=true\nenable_encryption=true\n");
let parsed=TomlConfig::new_from_str(&config).unwrap();
eprintln!("fixture proxy networks: {:?}",parsed.get_proxy_cidrs());
let server=create_native_instance(parsed).unwrap();
server.start().await.unwrap();
println!("{{\"mesh_port\":{mesh_port},\"tcp_port\":{tcp_port},\"udp_port\":{udp_port},\"network_name\":\"{name}\"}}");
tokio::spawn(async move {
while let Ok((mut stream,_))=tcp.accept().await {
tokio::spawn(async move {
let mut data=[0u8;16384];
while let Ok(size)=stream.read(&mut data).await {
if size==0 {break}
if data[..size].starts_with(b"POST /register") {
let _=stream.write_all(b"HTTP/1.0 200 OK\r\nContent-Length: 3\r\n\r\nOK\n").await;break
}
if stream.write_all(&data[..size]).await.is_err(){break}
}
});
}
});
let mut data=[0u8;65536];
loop {
if let Ok((size,peer))=udp.recv_from(&mut data).await {let _=udp.send_to(&data[..size],peer).await;}
}
}
+158
View File
@@ -0,0 +1,158 @@
//! Metin2 host policy around the vendored MeshPort SDK. No sockets or OS routes are intercepted.
use serde_json::{json, Value};
use std::{collections::HashMap, ffi::{c_char, CStr, CString}, net::Ipv4Addr,
sync::{Arc, Condvar, Mutex, OnceLock}, thread::{self, JoinHandle}, time::{Duration, Instant}};
struct Target { since: Instant, touched: Instant }
#[derive(Default)]
struct State {
config: String, targets: HashMap<u32, Target>, routes: Vec<String>, port: u16,
stop: bool, failed: bool, retry: bool, event: i32, connected: bool,
}
#[derive(Default)]
struct Runtime { state: Arc<(Mutex<State>, Condvar)>, worker: Option<JoinHandle<()>> }
static RUNTIME: OnceLock<Mutex<Runtime>> = OnceLock::new();
fn runtime() -> &'static Mutex<Runtime> { RUNTIME.get_or_init(|| Mutex::new(Runtime::default())) }
fn matches(cidr: &str, address: u32) -> bool {
let Some((ip, bits)) = cidr.split_once('/') else { return false };
let (Ok(ip), Ok(bits)) = (ip.parse::<Ipv4Addr>(), bits.parse::<u32>()) else { return false };
if !(1..=32).contains(&bits) { return false }
let mask = u32::MAX << (32 - bits);
(u32::from(ip) & mask) == (address & mask)
}
fn call(context: u64, request: Value) -> Result<Value, ()> {
let text = CString::new(request.to_string()).map_err(|_| ())?;
let pointer = unsafe { meshport_ffi::meshport_call(context, text.as_ptr()) };
if pointer.is_null() { return Err(()) }
let decoded = unsafe { serde_json::from_slice::<Value>(CStr::from_ptr(pointer).to_bytes()) };
unsafe { meshport_ffi::meshport_string_free(pointer) };
let decoded = decoded.map_err(|_| ())?;
if decoded["ok"] != true {
if std::env::var_os("MT_MESHPORT_TRACE").is_some() { eprintln!("MeshPort SDK operation failed: {}",request["op"]); }
return Err(())
}
Ok(decoded["data"].clone())
}
fn start(context: u64, config: &str) -> Result<u16, ()> {
let info = call(context, json!({"op":"abi_info"}))?;
if info["abi"] != 1 || info["revision"].as_u64().unwrap_or(0) < 2 { return Err(()) }
let migrated = call(context, json!({"op":"migrate_config","toml":config}))?;
let mut profile = call(context, json!({"op":"validate","toml":migrated["toml"],"include_profile":true}))?["profile"].clone();
profile["runtime_mode"] = json!("application");
profile["dhcp"] = json!(true); profile["ipv4"] = json!("");
profile["hostname"] = json!("Metin2"); profile["listeners"] = json!([]);
let built = call(context, json!({"op":"build_config","profile":profile}))?;
let started = call(context, json!({"op":"start_bridged","toml":built["toml"],"check_local_overlap":true}))?;
let listen = started["listen"].as_str().ok_or(())?;
let port = listen.strip_prefix("127.0.0.1:").ok_or(())?.parse::<u16>().map_err(|_| ())?;
if port == 0 { return Err(()) }
Ok(port)
}
fn run(shared: Arc<(Mutex<State>, Condvar)>) {
let (lock, wake) = &*shared;
let mut context = 0;
let mut last_projection = String::new();
loop {
let mut state = lock.lock().unwrap();
if state.stop { break }
if state.failed && !state.retry || context == 0 && state.targets.is_empty() {
drop(wake.wait_timeout(state, Duration::from_secs(1)).unwrap());
continue
}
if state.retry {
state.retry = false; state.failed = false; state.routes.clear(); state.port = 0;
state.connected = false; state.event = 1;
drop(state);
if context != 0 { meshport_ffi::meshport_context_free(context); context = 0; }
continue
}
if context == 0 {
state.event = 1; state.connected = false;
let config = state.config.clone(); drop(state);
context = meshport_ffi::meshport_context_new();
let prepared = if context == 0 { Err(()) } else { start(context, &config) };
state = lock.lock().unwrap();
match prepared {
Ok(port) => state.port = port,
Err(_) => {
state.failed = true; state.event = 3; state.port = 0;
drop(state);
if context != 0 { meshport_ffi::meshport_context_free(context); context = 0; }
continue
}
}
}
drop(state);
let snapshot = call(context, json!({"op":"status"}));
state = lock.lock().unwrap();
match snapshot {
Ok(data) if data["health"]["engine_running"] == true && data["health"]["bridge_running"] == true => {
let ready = data["health"]["mesh_routable"] == true && data["platform_network"]["overlay"]["address"].as_str().is_some_and(|ip| ip != "0.0.0.0");
if std::env::var_os("MT_MESHPORT_TRACE").is_some() {
let projection = format!("ready={ready} overlay={} routes={}",data["platform_network"]["overlay"]["address"],data["platform_network"]["mesh_cidrs"]);
if projection != last_projection { eprintln!("MeshPort {projection}"); last_projection = projection; }
}
state.routes = if ready { data["platform_network"]["mesh_cidrs"].as_array()
.map(|items| items.iter().filter_map(|v|v.as_str().map(String::from)).collect()).unwrap_or_default() } else { vec![] };
}
_ => { state.routes.clear(); state.port = 0; state.failed = true; state.event = 3; }
}
state.targets.retain(|_,target| target.touched.elapsed() < Duration::from_secs(120));
let interval = if state.connected { 1000 } else { 250 };
drop(wake.wait_timeout(state, Duration::from_millis(interval)).unwrap());
}
if context != 0 { meshport_ffi::meshport_context_free(context); }
}
/// Store a private profile; no network starts until a remote socket asks for a route.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn mt_mesh_configure(config: *const c_char) {
if config.is_null() { return }
let Ok(config) = unsafe { CStr::from_ptr(config) }.to_str() else { return };
let rt = runtime().lock().unwrap();
rt.state.0.lock().unwrap().config = config.to_owned();
}
/// Host-order IPv4. Positive = healthy bridge port, zero = waiting, -1 = unavailable.
/// fresh=true only on a new operation; polling must not restart its timeout or retry.
#[unsafe(no_mangle)]
pub extern "C" fn mt_mesh_route(address: u32, fresh: bool) -> i32 {
let mut rt = runtime().lock().unwrap();
let mut state = rt.state.0.lock().unwrap();
if state.stop { return -1 }
let now = Instant::now();
if fresh && state.failed { state.retry = true; }
let target = state.targets.entry(address).or_insert(Target { since: now, touched: now });
if fresh { target.since = now; }
target.touched = now;
let expired = target.since.elapsed() > Duration::from_secs(60);
let answer = if state.failed && !state.retry || expired { -1 }
else if !state.retry && state.port != 0 && state.routes.iter().any(|cidr|matches(cidr,address)) { state.port as i32 }
else { 0 };
if expired && !state.connected { state.event = 3; }
drop(state);
if rt.worker.is_none() {
let shared = rt.state.clone(); rt.worker = Some(thread::spawn(move ||run(shared)));
}
if fresh { rt.state.1.notify_one(); }
answer
}
#[unsafe(no_mangle)]
pub extern "C" fn mt_mesh_connected() {
let rt = runtime().lock().unwrap(); let mut state = rt.state.0.lock().unwrap();
if !state.connected { state.connected = true; state.event = 2; }
}
#[unsafe(no_mangle)]
pub extern "C" fn mt_mesh_event() -> i32 {
let rt = runtime().lock().unwrap(); let mut state = rt.state.0.lock().unwrap();
let event = state.event; state.event = 0; event
}
#[unsafe(no_mangle)]
pub extern "C" fn mt_mesh_shutdown() {
let worker = {
let mut rt = runtime().lock().unwrap();
rt.state.0.lock().unwrap().stop = true; rt.state.1.notify_all(); rt.worker.take()
};
if let Some(worker) = worker { let _ = worker.join(); }
let mut rt = runtime().lock().unwrap(); rt.state = Arc::new((Mutex::new(State::default()), Condvar::new()));
}
+359
View File
@@ -0,0 +1,359 @@
#include "transport.h"
#include <arpa/inet.h>
#include <ifaddrs.h>
#include <net/if.h>
#include <sys/socket.h>
#include <unistd.h>
#include <atomic>
#include <cerrno>
#include <cstring>
#include <map>
#include <mutex>
#include <thread>
#include <stdexcept>
#include <chrono>
#include <deque>
#include <set>
#include <array>
#include <fcntl.h>
#include <algorithm>
extern "C" {
void mt_mesh_configure(const char*);
int mt_mesh_route(uint32_t, bool);
void mt_mesh_connected();
int mt_mesh_event();
void mt_mesh_shutdown();
}
namespace mt::meshport {
namespace {
using Clock = std::chrono::steady_clock;
struct Handshake {
sockaddr_in target{};
const void* owner = nullptr;
int stage = -1;
size_t offset = 0;
unsigned char bytes[10] = {5, 1, 0};
unsigned char command = 1;
Clock::time_point deadline = Clock::now() + std::chrono::seconds(75);
};
struct Packet { sockaddr_in target{}; std::vector<unsigned char> bytes; Clock::time_point deadline; };
struct Udp {
int control = -1, relay = -1;
uint16_t port = 0;
Handshake handshake;
bool ready = false;
std::deque<Packet> outgoing, incoming;
std::set<std::pair<uint32_t,uint16_t>> peers;
size_t queued_bytes = 0;
};
std::mutex transport_mutex;
std::map<int, Handshake> handshakes;
std::map<int, Udp> datagrams;
std::vector<std::string> routes;
sockaddr_in proxy{};
bool fixture = false;
std::atomic<int> transport_event{0};
bool ipv4(const std::string& text, uint32_t& result) {
in_addr ip{};
if (inet_pton(AF_INET, text.c_str(), &ip) != 1) return false;
result = ip.s_addr;
return true;
}
std::string address(uint32_t ip) {
char buf[INET_ADDRSTRLEN];
in_addr value{}; value.s_addr = ip;
return inet_ntop(AF_INET, &value, buf, sizeof(buf)) ? buf : "";
}
}
bool in_subnet(uint32_t ip, uint32_t local, uint32_t mask) {
return mask != 0 && (ip & mask) == (local & mask);
}
bool contains(const std::string& cidr, const std::string& ip) {
const auto slash = cidr.find('/');
if (slash == std::string::npos) return false;
uint32_t network, target;
if (!ipv4(cidr.substr(0, slash), network) || !ipv4(ip, target)) return false;
const auto suffix = cidr.substr(slash + 1);
if (suffix.empty() || suffix.find_first_not_of("0123456789") != std::string::npos) return false;
if (suffix.size() > 2) return false;
const int prefix = std::stoi(suffix);
if (prefix < 1 || prefix > 32) return false;
return in_subnet(target, network, htonl(0xffffffffu << (32 - prefix)));
}
bool same_subnet(const std::string& ip) {
uint32_t target;
if (!ipv4(ip, target)) return false;
if ((ntohl(target) >> 24) == 127) return true;
ifaddrs* interfaces = nullptr;
if (getifaddrs(&interfaces) != 0) return false;
bool local = false;
for (auto* i = interfaces; i; i = i->ifa_next) {
if (!i->ifa_addr || !i->ifa_netmask || i->ifa_addr->sa_family != AF_INET) continue;
if (!(i->ifa_flags & IFF_UP) || (i->ifa_flags & (IFF_LOOPBACK | IFF_POINTOPOINT))) continue;
const std::string name = i->ifa_name;
if (name.find("tun") == 0 || name.find("utun") == 0 || name.find("tap") == 0) continue;
const auto* a = reinterpret_cast<sockaddr_in*>(i->ifa_addr);
const auto* m = reinterpret_cast<sockaddr_in*>(i->ifa_netmask);
if (in_subnet(target, a->sin_addr.s_addr, m->sin_addr.s_addr)) { local = true; break; }
}
freeifaddrs(interfaces);
return local;
}
void set_routes(const std::string& listen, const std::vector<std::string>& cidrs) {
sockaddr_in next{};
if (!listen.empty()) {
const auto colon = listen.find(':');
if (colon == std::string::npos || listen.substr(0, colon) != "127.0.0.1")
throw std::runtime_error("MeshPort bridge must listen on loopback");
const auto port_text = listen.substr(colon + 1);
if (port_text.empty() || port_text.size() > 5 || port_text.find_first_not_of("0123456789") != std::string::npos)
throw std::runtime_error("Invalid MeshPort bridge port");
int port = std::stoi(port_text);
if (port < 1 || port > 65535) throw std::runtime_error("Invalid MeshPort bridge port");
next.sin_family = AF_INET;
next.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
next.sin_port = htons(port);
}
std::lock_guard<std::mutex> guard(transport_mutex);
proxy = next;
routes = cidrs;
fixture = !listen.empty();
}
void configure(const std::string& config) { mt_mesh_configure(config.c_str()); }
namespace {
int route(const sockaddr_in& target, bool fresh) {
if (fixture) {
for (const auto& cidr : routes)
if (contains(cidr, address(target.sin_addr.s_addr))) return ntohs(proxy.sin_port);
return -1; // Missing routes never fall back to the OS network.
}
return mt_mesh_route(ntohl(target.sin_addr.s_addr), fresh);
}
sockaddr_in loopback(int port) {
sockaddr_in value{}; value.sin_family = AF_INET;
value.sin_addr.s_addr = htonl(INADDR_LOOPBACK); value.sin_port = htons(port); return value;
}
int fail(int error) { errno = error; transport_event = 3; return -1; }
int advance(int fd, Handshake& h, sockaddr_in* bound = nullptr) {
if (Clock::now() > h.deadline) return fail(ETIMEDOUT);
if (h.stage == -1) {
int port = route(h.target, false);
if (port < 0) return fail(EHOSTUNREACH);
if (!port) return 0;
auto endpoint = loopback(port);
int status = ::connect(fd, reinterpret_cast<const sockaddr*>(&endpoint), sizeof(endpoint));
if (status < 0 && errno != EINPROGRESS && errno != EWOULDBLOCK) return fail(errno);
h.stage = 0;
h.deadline = Clock::now() + std::chrono::seconds(10);
}
if (h.stage == 0) {
int error = 0; socklen_t len = sizeof(error);
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) return fail(errno);
if (error) return fail(error);
sockaddr_in peer{}; len = sizeof(peer);
if (getpeername(fd, reinterpret_cast<sockaddr*>(&peer), &len) < 0) return 0;
h.stage = 1;
}
const bool sending = h.stage == 1 || h.stage == 3;
const size_t length = h.stage == 1 ? 3 : h.stage == 2 ? 2 : 10;
#ifdef MSG_NOSIGNAL
constexpr int send_flags = MSG_NOSIGNAL;
#else
constexpr int send_flags = 0;
#endif
const auto count = sending ? ::send(fd, h.bytes + h.offset, length - h.offset, send_flags)
: ::recv(fd, h.bytes + h.offset, length - h.offset, 0);
if (count < 0) return (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) ? 0 : fail(errno);
if (!count) return fail(ECONNRESET);
h.offset += static_cast<size_t>(count);
if (h.offset != length) return 0;
h.offset = 0;
if (h.stage == 2) {
if (h.bytes[0] != 5 || h.bytes[1] != 0) return fail(EPROTO);
h.bytes[0] = 5; h.bytes[1] = h.command; h.bytes[2] = 0; h.bytes[3] = 1;
if (h.command == 1) {
std::memcpy(h.bytes + 4, &h.target.sin_addr.s_addr, 4);
std::memcpy(h.bytes + 8, &h.target.sin_port, 2);
} else { std::memset(h.bytes + 4, 0, 6); }
} else if (h.stage == 4) {
if (h.bytes[0] != 5 || h.bytes[1] != 0 || h.bytes[2] != 0 || h.bytes[3] != 1) return fail(EPROTO);
if (bound) {
bound->sin_family = AF_INET;
std::memcpy(&bound->sin_addr.s_addr, h.bytes + 4, 4);
std::memcpy(&bound->sin_port, h.bytes + 8, 2);
}
return 1;
}
++h.stage; return 0;
}
void close_udp(Udp& udp) {
if (udp.control >= 0) ::close(udp.control);
if (udp.relay >= 0) ::close(udp.relay);
udp.control = udp.relay = -1; udp.ready = false; udp.port = 0;
}
void pump_udp(int fd, Udp& udp) {
const auto now = Clock::now();
while (!udp.outgoing.empty() && udp.outgoing.front().deadline < now) {
udp.queued_bytes -= udp.outgoing.front().bytes.size(); udp.outgoing.pop_front(); transport_event = 3;
}
// A queued request can become local while DHCP/peer discovery is pending.
while (!udp.outgoing.empty() && same_subnet(address(udp.outgoing.front().target.sin_addr.s_addr))) {
auto& packet = udp.outgoing.front();
auto count = ::sendto(fd,packet.bytes.data(),packet.bytes.size(),MSG_DONTWAIT,
reinterpret_cast<sockaddr*>(&packet.target),sizeof(packet.target));
if (count < 0 && (errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR)) break;
udp.queued_bytes -= packet.bytes.size(); udp.outgoing.pop_front();
}
if (udp.control >= 0 && udp.ready) {
char probe;
auto result = ::recv(udp.control, &probe, 1, MSG_PEEK | MSG_DONTWAIT);
if (result == 0 || (result < 0 && errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR)) close_udp(udp);
}
if (udp.control < 0 && !udp.outgoing.empty()) {
auto& packet = udp.outgoing.front();
const int port = route(packet.target, false);
if (port < 0) {
udp.queued_bytes -= packet.bytes.size(); udp.outgoing.pop_front(); transport_event = 3; return;
}
if (!port) return;
udp.control = ::socket(AF_INET, SOCK_STREAM, 0);
if (udp.control < 0) return;
fcntl(udp.control, F_SETFL, O_NONBLOCK);
#ifdef SO_NOSIGPIPE
int one=1;setsockopt(udp.control,SOL_SOCKET,SO_NOSIGPIPE,&one,sizeof(one));
#endif
udp.port = port; udp.handshake = Handshake{};
udp.handshake.target = packet.target; udp.handshake.command = 3;
}
if (udp.control < 0) return;
if (!udp.ready) {
sockaddr_in relay{};
int result = advance(udp.control, udp.handshake, &relay);
if (result < 0) { close_udp(udp); return; }
if (!result) return;
// The SDK bridge is IPv4 loopback-only. Do not accept a redirect to an external relay.
if (relay.sin_addr.s_addr != htonl(INADDR_LOOPBACK) || !relay.sin_port) { close_udp(udp); transport_event=3;return; }
udp.relay = ::socket(AF_INET, SOCK_DGRAM, 0);
if (udp.relay < 0) { close_udp(udp);return; }
fcntl(udp.relay,F_SETFL,O_NONBLOCK);
if (::connect(udp.relay,reinterpret_cast<sockaddr*>(&relay),sizeof(relay)) < 0) {close_udp(udp);return;}
udp.ready = true;
}
for (size_t sent=0; !udp.outgoing.empty() && sent<32; ++sent) {
auto& packet = udp.outgoing.front();
const int port = route(packet.target,false);
if (port == 0) break;
if (port < 0) {
udp.queued_bytes -= packet.bytes.size(); udp.outgoing.pop_front(); transport_event=3;continue;
}
if (port != udp.port) {close_udp(udp);return;}
std::vector<unsigned char> envelope(10+packet.bytes.size());
envelope[3]=1;
std::memcpy(envelope.data()+4,&packet.target.sin_addr.s_addr,4);
std::memcpy(envelope.data()+8,&packet.target.sin_port,2);
std::copy(packet.bytes.begin(),packet.bytes.end(),envelope.begin()+10);
auto count = ::send(udp.relay,envelope.data(),envelope.size(),0);
if (count < 0 && (errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR)) break;
if (count < 0) {close_udp(udp);return;}
if(udp.peers.size()<128)udp.peers.emplace(packet.target.sin_addr.s_addr,packet.target.sin_port);
udp.queued_bytes -= packet.bytes.size(); udp.outgoing.pop_front();
}
for (int i=0;i<32;++i) {
std::array<unsigned char,65536> envelope;
auto count = ::recv(udp.relay,envelope.data(),envelope.size(),0);
if (count < 0) break;
if (count<10 || envelope[0] || envelope[1] || envelope[2] || envelope[3]!=1) continue;
sockaddr_in source{};source.sin_family=AF_INET;
std::memcpy(&source.sin_addr.s_addr,envelope.data()+4,4);
std::memcpy(&source.sin_port,envelope.data()+8,2);
if (!udp.peers.count({source.sin_addr.s_addr,source.sin_port})) continue;
if (udp.incoming.size()>=64) continue;
udp.incoming.push_back({source,{envelope.begin()+10,envelope.begin()+count},now});
if (!fixture) mt_mesh_connected(); else transport_event=2;
}
}
}
int connect_socket(int fd, const sockaddr_in& target, const void* owner) {
if (same_subnet(address(target.sin_addr.s_addr)))
return ::connect(fd,reinterpret_cast<const sockaddr*>(&target),sizeof(target));
std::lock_guard<std::mutex> guard(transport_mutex);
if (route(target,true)<0) return fail(EHOSTUNREACH);
Handshake h; h.target=target; h.owner=owner; handshakes[fd]=h;
errno=EINPROGRESS;return -1;
}
bool pending_owner(const void* owner) {
if(!owner)return false;
std::lock_guard<std::mutex> guard(transport_mutex);
for(const auto& [fd,h]:handshakes)if(h.owner==owner)return true;
return false;
}
bool pending(int fd) { std::lock_guard<std::mutex> guard(transport_mutex);return handshakes.count(fd)!=0; }
int poll_socket(int fd) {
std::lock_guard<std::mutex> guard(transport_mutex);
auto it=handshakes.find(fd);if(it==handshakes.end()) return 1;
int result=advance(fd,it->second);
if (result==1) {
handshakes.erase(it);
if(!fixture) mt_mesh_connected();else transport_event=2;
}
return result;
}
void forget_socket(int fd) {
std::lock_guard<std::mutex> guard(transport_mutex);handshakes.erase(fd);
auto it=datagrams.find(fd);if(it!=datagrams.end()){close_udp(it->second);datagrams.erase(it);}
}
ssize_t send_datagram(int fd,const void* bytes,size_t size,int flags,const sockaddr_in& target) {
if (same_subnet(address(target.sin_addr.s_addr)))
return ::sendto(fd,bytes,size,flags,reinterpret_cast<const sockaddr*>(&target),sizeof(target));
if (size>65497) {errno=EMSGSIZE;return -1;}
std::lock_guard<std::mutex> guard(transport_mutex);
if (route(target,true)<0) return fail(EHOSTUNREACH);
if(fcntl(fd,F_GETFD)<0)return -1;
auto& udp=datagrams[fd];
if (udp.outgoing.size()>=64 || udp.queued_bytes+size>1024*1024) {errno=EWOULDBLOCK;return -1;}
const auto* begin=static_cast<const unsigned char*>(bytes);
udp.outgoing.push_back({target,{begin,begin+size},Clock::now()+std::chrono::seconds(60)});
udp.queued_bytes+=size;pump_udp(fd,udp);return static_cast<ssize_t>(size);
}
bool datagram_ready(int fd) {
std::lock_guard<std::mutex> guard(transport_mutex);
auto it=datagrams.find(fd);if(it==datagrams.end())return false;
pump_udp(fd,it->second);return !it->second.incoming.empty();
}
ssize_t recv_datagram(int fd,void* bytes,size_t size,int flags,sockaddr_in* source) {
std::lock_guard<std::mutex> guard(transport_mutex);
auto it=datagrams.find(fd);
if(it!=datagrams.end()) {
auto& udp=it->second;pump_udp(fd,udp);
if(!udp.incoming.empty()) {
auto& packet=udp.incoming.front();
const size_t count=std::min(size,packet.bytes.size());
std::memcpy(bytes,packet.bytes.data(),count);if(source)*source=packet.target;
const auto result=(flags&MSG_TRUNC)?packet.bytes.size():count;
if(!(flags&MSG_PEEK))udp.incoming.pop_front();
return result;
}
}
socklen_t length=sizeof(sockaddr_in);
return ::recvfrom(fd,bytes,size,flags,reinterpret_cast<sockaddr*>(source),source?&length:nullptr);
}
void pump() {
std::lock_guard<std::mutex> guard(transport_mutex);
for(auto& [fd,udp]:datagrams)pump_udp(fd,udp);
}
int take_event() { pump();int event=transport_event.exchange(0);int runtime=mt_mesh_event();return event?event:runtime; }
void shutdown() {
{
std::lock_guard<std::mutex> guard(transport_mutex);
for (auto& [fd, udp] : datagrams) {
if (udp.control >= 0) ::close(udp.control);
if (udp.relay >= 0) ::close(udp.relay);
}
datagrams.clear(); handshakes.clear(); routes.clear(); proxy = {}; fixture = false;
}
mt_mesh_shutdown(); transport_event = 0;
}
}
+26
View File
@@ -0,0 +1,26 @@
#pragma once
#include <cstdint>
#include <string>
#include <vector>
#include <netinet/in.h>
#include <sys/types.h>
namespace mt::meshport {
bool in_subnet(uint32_t address, uint32_t local, uint32_t mask);
bool same_subnet(const std::string& address);
bool contains(const std::string& cidr, const std::string& address);
void configure(const std::string& private_profile);
// Explicit fixture bridge. Production obtains its routes exclusively from the native runtime.
void set_routes(const std::string& listen, const std::vector<std::string>& cidrs);
int connect_socket(int fd, const sockaddr_in& target, const void* owner = nullptr);
bool pending_owner(const void* owner);
int poll_socket(int fd); // 0 waiting; 1 ready; -1 failed. Includes preparation and SOCKS handshake.
bool pending(int fd);
void forget_socket(int fd);
ssize_t send_datagram(int fd, const void* bytes, size_t size, int flags, const sockaddr_in& target);
ssize_t recv_datagram(int fd, void* bytes, size_t size, int flags, sockaddr_in* source);
bool datagram_ready(int fd);
void pump();
int take_event(); // 1 preparing; 2 remote transport verified; 3 failed.
void shutdown();
}
+4
View File
@@ -21,3 +21,7 @@ if(TARGET mtpython)
set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/ScriptLib/PythonBoot.cpp
PROPERTY COMPILE_DEFINITIONS ${MT_PORT_DEFINES_UserInterface})
endif()
if(TARGET mt_meshport)
target_include_directories(port_platform PRIVATE "${PROJECT_BINARY_DIR}/src/meshport")
endif()
+36 -4
View File
@@ -192,6 +192,13 @@ HRESULT CpuSurface::LockRect(D3DLOCKED_RECT* locked, const RECT* rect, DWORD fla
return S_OK;
}
// PORT: a 32-bit render-target texture (the AVA2 model preview's CGraphicRenderTargetTexture), drawn on the
// GPU with full state; the R5G6B5 ones are the character shadow map.
bool is_color_target(const D3DSURFACE_DESC& desc)
{
return (desc.Usage & D3DUSAGE_RENDERTARGET) && (desc.Format == D3DFMT_X8R8G8B8 || desc.Format == D3DFMT_A8R8G8B8);
}
D3DSURFACE_DESC surface_desc(UINT width, UINT height, D3DFORMAT format, DWORD usage, D3DPOOL pool)
{
D3DSURFACE_DESC desc = {};
@@ -454,7 +461,10 @@ public:
return S_OK;
}
auto* surface = static_cast<CpuSurface*>(m_renderTarget);
if (!surface->parent || surface->level != 0 || surface->desc.Format != D3DFMT_R5G6B5)
const bool colorTarget = surface->parent && surface->level == 0 && is_color_target(surface->desc);
if (colorTarget && !g_gpu_render_targets)
return S_OK;
if (!colorTarget && (!surface->parent || surface->level != 0 || surface->desc.Format != D3DFMT_R5G6B5))
return S_OK;
if (g_gpu_render_targets)
{
@@ -463,6 +473,7 @@ public:
clear.render_target = surface->parent->id;
clear.target_width = surface->desc.Width;
clear.target_height = surface->desc.Height;
clear.target_color = colorTarget;
clear.clear_flags = flags & (D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER);
clear.clear_color = color;
clear.clear_z = depth;
@@ -1140,11 +1151,30 @@ private:
if (m_renderTarget == m_backBuffer)
Render3DAdd(std::move(draw));
else if (g_gpu_render_targets)
record_shadow(std::move(draw));
{
auto* surface = static_cast<CpuSurface*>(m_renderTarget);
if (surface->parent && surface->level == 0 && is_color_target(surface->desc))
record_color(std::move(draw), *surface);
else
record_shadow(std::move(draw));
}
else
rasterize_shadow(draw);
}
// PORT: a draw into a colour render target keeps every state the back buffer would get.
void record_color(Render3DDraw draw, const CpuSurface& surface)
{
if (!draw.shared_geometry && draw.indices.size() < (draw.lines ? 2u : 3u))
return;
draw.render_target = surface.parent->id;
draw.target_width = surface.desc.Width;
draw.target_height = surface.desc.Height;
draw.target_color = true;
draw.ui_offset_x = 0;
Render3DAdd(std::move(draw));
}
// GPU counterpart of rasterize_shadow: the draw goes to the renderer's offscreen pass with the
// states rasterize_shadow implements -- a flat D3DRS_TEXTUREFACTOR fill, no culling, no texture,
// light, fog or blending, depth test LESSEQUAL with depth writes -- so both paths draw the same map.
@@ -1257,6 +1287,8 @@ std::string MtCpuTextureNameFromHandle(const IDirect3DBaseTexture8* handle)
const D3DSURFACE_DESC& desc = entry.second->levels[0].desc;
if (g_gpu_render_targets && (desc.Usage & D3DUSAGE_RENDERTARGET) && desc.Format == D3DFMT_R5G6B5)
return Render3DRenderTargetName(entry.first, desc.Width, desc.Height);
if (g_gpu_render_targets && is_color_target(desc))
return Render3DRenderTargetName(entry.first, desc.Width, desc.Height, true);
if (entry.second == handle && !entry.second->levels.empty())
return "mem:cpu_" + std::to_string(entry.first) + "@" + std::to_string(entry.second->revision);
}
@@ -1406,9 +1438,9 @@ bool IsNativeTerrainRenderEnabled()
void SetGpuRenderTargetsEnabled(bool enabled) { g_gpu_render_targets = enabled; }
bool IsGpuRenderTargetsEnabled() { return g_gpu_render_targets; }
std::string Render3DRenderTargetName(std::uint32_t id, std::uint32_t width, std::uint32_t height)
std::string Render3DRenderTargetName(std::uint32_t id, std::uint32_t width, std::uint32_t height, bool color)
{
return "rt:" + std::to_string(id) + ":" + std::to_string(width) + "x" + std::to_string(height);
return "rt:" + std::to_string(id) + ":" + std::to_string(width) + "x" + std::to_string(height) + (color ? ":c" : "");
}
void Render3DBeginFrame()
+5 -1
View File
@@ -38,6 +38,9 @@ struct Render3DDraw {
// viewport is then in the target's pixels. Only emitted while GPU render targets are enabled.
std::uint32_t render_target = 0;
std::uint32_t target_width = 0, target_height = 0;
// PORT: an X8R8G8B8 / A8R8G8B8 colour target (the AVA2 model preview, CRenderTarget) drawn with the
// draw's own states, named with Render3DRenderTargetName(..., true); otherwise the R5G6B5 shadow map.
bool target_color = false;
// Stage 0/1 textures, named like UIRenderTextureName: the pack path of a file texture or
// "mem:<id>@<revision>"; empty when the stage has no texture.
@@ -143,7 +146,8 @@ bool LookupGpuSkinSubrange(const void* vertex_buffer_base, std::uint32_t stride,
// default (the Godot consumer has no offscreen pass); the native Vulkan renderer turns it on.
void SetGpuRenderTargetsEnabled(bool enabled);
bool IsGpuRenderTargetsEnabled();
std::string Render3DRenderTargetName(std::uint32_t id, std::uint32_t width, std::uint32_t height);
// A colour target's name ends in ":c".
std::string Render3DRenderTargetName(std::uint32_t id, std::uint32_t width, std::uint32_t height, bool color = false);
void Render3DBeginFrame();
void Render3DAdd(Render3DDraw draw);
@@ -112,10 +112,13 @@ void UIRenderAddImageNamed(const std::string& texture_name, const float x[4], co
// 40250 draws the image quad through the device: the UI pass's world transform places it
// (identity except where a caller sets one, e.g. CPythonMiniMap::RenderAtlas's window offset) and a
// stage-0 MODULATE with D3DTA_TFACTOR tints it (the atlas's NPC/warp/waypoint marks).
DWORD address_u = D3DTADDRESS_WRAP, address_v = D3DTADDRESS_WRAP;
D3DXMATRIX world;
D3DXMatrixIdentity(&world);
if (CStateManager* state = CStateManager::InstancePtr()) {
state->GetTransform(D3DTS_WORLD, &world);
state->GetTextureStageState(0,D3DTSS_ADDRESSU,&address_u);
state->GetTextureStageState(0,D3DTSS_ADDRESSV,&address_v);
DWORD op = 0, arg1 = 0, arg2 = 0;
state->GetTextureStageState(0, D3DTSS_COLOROP, &op);
state->GetTextureStageState(0, D3DTSS_COLORARG1, &arg1);
@@ -148,5 +151,6 @@ void UIRenderAddImageNamed(const std::string& texture_name, const float x[4], co
command.quad = true;
command.su = su; command.sv = sv; command.eu = eu; command.ev = ev;
command.blend = blend;
command.address_u = address_u; command.address_v = address_v;
UIRenderAdd(std::move(command));
}
+2
View File
@@ -24,6 +24,8 @@ struct UIRenderCommand {
std::string mask;
float mu[4] = {}, mv[4] = {};
bool behind_3d = false;
// D3D8 texture stage 0 addressing. Direct platform commands retain their clamp default.
std::uint32_t address_u = 3, address_v = 3;
};
// D3DXCOLOR (0..1 floats) -> the 0xAARRGGBB the commands carry.
+28
View File
@@ -0,0 +1,28 @@
// PORT: item bonuses added after 40250 (AVA2 numbering, server common/length.h). The packed uitooltip.py
// only knows 40250's applies; add the new ones to its AFFECT_DICT so item and socket tooltips show them.
static const char c_szAppliesScript[] = R"PY(# -*- coding: utf-8 -*-
import item
import player
import uiToolTip
L = player.AutoHuntLocalize
TEXTS = (
("APPLY_ATTBONUS_STONE", "对陨石伤害 +%d%%"),
("APPLY_ATTBONUS_BOSS", "对 Boss 伤害 +%d%%"),
("APPLY_ENCHANT_ELEC", "对雷属性怪物伤害 +%d%%"),
("APPLY_ENCHANT_FIRE", "对火属性怪物伤害 +%d%%"),
("APPLY_ENCHANT_ICE", "对冰属性怪物伤害 +%d%%"),
("APPLY_ENCHANT_WIND", "对风属性怪物伤害 +%d%%"),
("APPLY_ENCHANT_EARTH", "对土属性怪物伤害 +%d%%"),
("APPLY_ENCHANT_DARK", "对暗属性怪物伤害 +%d%%"),
)
def Text(text):
return lambda value: L(text % value)
for name, text in TEXTS:
if hasattr(item, name):
uiToolTip.ItemToolTip.AFFECT_DICT[getattr(item, name)] = Text(text)
)PY";
@@ -0,0 +1,34 @@
// PORT: armor shapes added after 40250 (AVA2's dragon armor 21210+, item value3 = 32). The race .msm files are
// read by bare name, which CEterPackManager always serves from the root pack, so a patch pack cannot replace
// them; register the extra shapes after each LoadLocalRaceData instead, as the AVA2 msm groups would. Models
// ship in the ava2items pack (metin2-client tools/server/ava2-items, ARMOR_SHAPES / RACE_PATHS).
static const char c_szArmorShapesScript[] = R"PY(# -*- coding: utf-8 -*-
import chrmgr
SHAPES = {32: "%s_7_1"}
# ShapeData PathName of each race msm (male, female).
PATHS = {"warrior": ("pc", "pc2"), "assassin": ("pc2", "pc"), "sura": ("pc", "pc2"), "shaman": ("pc2", "pc")}
_load = chrmgr.LoadLocalRaceData
def Register(name):
stem = name.lower().split(".")[0]
race, _, sex = stem.partition("_")
if race not in PATHS or sex not in ("m", "w"):
return
path = "d:/ymir work/%s/%s/" % (PATHS[race][sex == "w"], race)
for shape, model in SHAPES.items():
model = path + model % race
chrmgr.SetShapeModel(shape, model + ".gr2")
chrmgr.AppendShapeSkin(shape, 0, model + ".dds", model + ".dds")
def LoadLocalRaceData(name):
result = _load(name)
Register(name)
return result
chrmgr.LoadLocalRaceData = LoadLocalRaceData
)PY";
+125
View File
@@ -0,0 +1,125 @@
// AVA2 lock material selection uses socket 0; lock highlights follow original uitooltip.py.
// The existing port stores masks outside the seven-attribute packet, so own-item tooltips query them read-only.
static const char c_szAttrLockScript[] = R"PY(# -*- coding: utf-8 -*-
import app,chat,game,net,player,uiToolTip,weakref,mt_switchbot
L=player.AutoHuntLocalize
Tip=uiToolTip.ItemToolTip
_clear=Tip.ClearToolTip
_inventory=Tip.SetInventoryItem
_append=Tip._ItemToolTip__AppendAttributeInformation
_add=Tip.AddItemData
_update=Tip.OnUpdate
_command=game.GameWindow.BINARY_ServerCommand_Run
_close=game.GameWindow.Close
_pending={}
_serial=0
_views={}
def Snapshot(window,cell,tip=None):
if window in _views:return _views[window][0](tip,cell) if tip else None
return (player.GetItemIndex(window,cell),
tuple(player.GetItemAttribute(window,cell,i) for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM)),
tuple(player.GetItemMetinSocket(window,cell,i) for i in xrange(player.METIN_SOCKET_MAX_NUM)))
def Clear(self):
if not getattr(self,'attrLockRendering',False):
self.attrLockContext=None;self.attrLockMask=0
_clear(self)
def Query(self):
global _serial
context=getattr(self,'attrLockContext',None)
if not context:return
window,cell,snapshot=context
if Snapshot(window,cell,self)!=snapshot:
self.attrLockContext=None;self.attrLockMask=0
self.HideToolTip()
return
_serial=(_serial%2147483646)+1
self.attrLockNext=app.GetTime()+1.25
# A tooltip can be rebuilt frequently during rolling; retain no old requests or windows.
_pending.clear();_pending[_serial]=(weakref.ref(self),context)
command='/attr_lock_info %d %d %d'%(_serial,window,cell)
if window in _views:command+=' %d'%getattr(self,'attrLockVid',0)
net.SendChatPacket(command)
def Inventory(self,cell,window_type=player.INVENTORY):
_inventory(self,cell,window_type)
snapshot=Snapshot(window_type,cell)
if not snapshot[0] or not any(a[0] for a in snapshot[1][:5]):return
self.attrLockContext=(window_type,cell,snapshot)
Query(self)
def Rebuild(self):
context=getattr(self,'attrLockContext',None)
if not context:return
window,cell,snapshot=context
if Snapshot(window,cell,self)!=snapshot:return
self.attrLockRendering=True
try:
if window in _views:_views[window][1](self,cell)
else:_inventory(self,cell,window)
finally:self.attrLockRendering=False
def Update(self):
_update(self)
if self.IsShow() and getattr(self,'attrLockContext',None) and app.GetTime()>=getattr(self,'attrLockNext',0):Query(self)
def AppendAttributes(self,attrs):
mask=getattr(self,'attrLockMask',0)
if not mask or getattr(self,'mtSash',None):return _append(self,attrs)
# Original AVA2: locked lines are enclosed in << >> and use SPECIAL_TITLE_COLOR.
for index,(kind,value) in enumerate(attrs):
if not value:continue
text=self._ItemToolTip__GetAffectString(kind,value)
if text:
if index<5 and mask&(1<<index):self.AppendTextLine('<<'+text+'>>',self.SPECIAL_TITLE_COLOR)
else:self.AppendTextLine(text,self._ItemToolTip__GetAttributeColor(index,value))
def AddItemData(self,vnum,metinSlot=0,attrSlot=0,*args,**kwargs):
_add(self,vnum,metinSlot,attrSlot,*args,**kwargs)
if vnum in (50348,50349):
index=int(metinSlot[0]) if metinSlot else 0
self.AppendSpace(5)
self.AppendTextLine(L('已选择第%d条普通属性'%index if 1<=index<=5 else '先使用此符选择属性序号'),self.SPECIAL_TITLE_COLOR)
self.ShowToolTip()
def Command(self,line):
words=line.split()
if words and words[0]=='AttrLockResult':
messages={'ok':'属性锁定状态已更新','item':'请使用未穿戴且未被交易或占用的装备','material':'请使用对应的锁定符或解锁符','slot':'请先使用此符选择有效的属性序号','five_attr':'装备需要五条普通属性','max':'最多可锁定两组普通属性','db':'保存失败,本次未消耗材料'}
if len(words)==2:chat.AppendChat(chat.CHAT_TYPE_INFO,L(messages.get(words[1],'属性锁定失败')))
return 1
if words and words[0]=='AttrLockInfo':
if len(words)!=6:return 1
try:token,window,cell,vnum,mask=map(int,words[1:])
except (ValueError,OverflowError):return 1
request=_pending.pop(token,None)
if request and -1<=mask<=31:
owner,context=request;tip=owner()
if tip and tip.IsShow() and getattr(tip,'attrLockContext',None)==context:
if (window,cell)==context[:2] and vnum==context[2][0] and Snapshot(window,cell,tip)==context[2]:
if mask>=0 and mask!=getattr(tip,'attrLockMask',0):
tip.attrLockMask=mask;Rebuild(tip)
return 1
return _command(self,line)
def Close(self):
_pending.clear()
return _close(self)
_switchOver=mt_switchbot.SwitchbotItemTab.OverInItem
def SwitchOver(self,slot):
if self.IsEmpty() or self.IsActive():return _switchOver(self,slot)
self.itemSlot.SetUsableItem(True)
if self.tooltipItem:self.tooltipItem.SetInventoryItem(self.slot_num,player.SWITCHBOT)
Tip.ClearToolTip=Clear
Tip.SetInventoryItem=Inventory
Tip._ItemToolTip__AppendAttributeInformation=AppendAttributes
Tip.AddItemData=AddItemData
Tip.OnUpdate=Update
mt_switchbot.SwitchbotItemTab.OverInItem=SwitchOver
game.GameWindow.BINARY_ServerCommand_Run=Command
game.GameWindow.Close=Close
)PY";
@@ -0,0 +1,148 @@
// AVA2 lock presentation with the port's separate mask; no classic packet layout changes.
static const char c_szAttrLockSnapshotsScript[] = R"PY(# -*- coding: utf-8 -*-
import app,player,chat,game,net,uiToolTip,mt_switchbot,mt_attr_lock as core,weakref
_cache={}
_link=player.GetItemLink
_relay=chat.GetLinkFromHyperlink
_hyper=uiToolTip.HyperlinkItemToolTip.SetHyperlinkItem
_command=game.GameWindow.BINARY_ServerCommand_Run
_close=game.GameWindow.Close
_open=game.GameWindow.Open
_gameUpdate=game.GameWindow.OnUpdate
_over=mt_switchbot.SwitchbotItemTab.OverInItem
_update=uiToolTip.ItemToolTip.OnUpdate
_clear=uiToolTip.ItemToolTip.ClearToolTip
def Key(window,cell):
return (player.INVENTORY if window==player.EQUIPMENT else window,cell)
def Cached(window,cell):
window,cell=Key(window,cell)
value=_cache.get((window,cell))
return value if value and value[0]==core.Snapshot(window,cell) else None
def Command(self,line):
words=line.split()
if words==['AttrLockSync']:
self.attrLockSynced=True
return 1
if words and words[0]=='AttrLockItem':
if len(words)!=5:return 1
try:window,cell,vnum,mask=map(int,words[1:])
except (ValueError,OverflowError):return 1
if window not in (player.INVENTORY,player.EQUIPMENT,player.SWITCHBOT) or not 0<=cell<65536 or not -1<=mask<=31:return 1
key=Key(window,cell);_cache.pop(key,None)
snapshot=core.Snapshot(*key)
if vnum and snapshot[0]==vnum and mask>=0:_cache[key]=(snapshot,mask)
return 1
return _command(self,line)
def GetItemLink(*args):
link=_link(*args)
if len(args)==1:window,cell=player.INVENTORY,args[0]
elif len(args)==2:window,cell=args
else:return link
cached=Cached(window,cell)
if not link or not cached or not cached[1]:return link
# Fixed seven slots preserve holes and therefore the lock's attribute index.
start=link.find('|H');end=link.find('|h',start+2)
if start<0 or end<0:return link
head=link[start+2:end].split(':')[:6]
if len(head)!=6 or head[0]!='item':return link
for kind,value in cached[0][1]:head.extend(('%x'%kind,str(value)))
head.extend(('mtlock1',str(cached[1])))
return link[:start+2]+':'.join(head)+link[end:]
def Decode(tokens):
if len(tokens)!=22 or tokens[0]!='item' or tokens[20]!='mtlock1':return None
try:
mask=int(tokens[21]);vnum=int(tokens[1],16);flags=int(tokens[2],16)
sockets=[int(v,16) for v in tokens[3:6]]
attrs=[(int(tokens[i],16),int(tokens[i+1])) for i in xrange(6,20,2)]
if not 0<=mask<=31 or not 0<vnum<=0xffffffff or not 0<=flags<=0xffffffff:return None
if any(not 0<=v<=0xffffffff for v in sockets):return None
if any(not 0<=k<=255 or not -32768<=v<=32767 for k,v in attrs):return None
return vnum,sockets,attrs,mask
except (ValueError,OverflowError):return None
def Hyperlink(self,tokens):
if 'mtlock1' not in tokens:return _hyper(self,tokens)
data=Decode(tokens)
self.ClearToolTip()
if not data:self.HideToolTip();return
vnum,sockets,attrs,mask=data
self.attrLockMask=mask
self.AddItemData(vnum,sockets,attrs)
self.ShowToolTip()
uiToolTip.ItemToolTip.OnUpdate(self)
# A chat link is an immutable sender snapshot, never a live item lookup.
def Relay(payload):
tokens=payload.split(':')
if 'mtlock1' not in tokens:return _relay(payload)
if Decode(tokens) is None:return ''
ordinary=_relay(':'.join(tokens[:20]))
start=ordinary.find('|H');end=ordinary.find('|h',start+2)
return ordinary[:start+2]+payload+ordinary[end:] if start>=0 and end>=0 else ''
def Clear(self):
self.attrLockActive=None
return _clear(self)
def Active(self,tab):
self.ClearToolTip()
cached=Cached(player.SWITCHBOT,tab.slot_num)
self.SetSwitchBotItem(player.GetItemIndex(player.SWITCHBOT,tab.slot_num))
if cached and cached[1]:
self.attrLockMask=cached[1]
self.AppendSpace(5)
core.AppendAttributes(self,[a if i<5 and cached[1]&(1<<i) else (0,0) for i,a in enumerate(cached[0][1])])
# The EU word wrapper cannot split Chinese words. Use ToolTip's measured-width
# convention (AutoAppendTextLine) so the localized active message fits its board.
width=max([self.toolTipWidth]+[line.GetTextSize()[0]+40 for line in self.childrenList if hasattr(line,'GetTextSize')])
if width>self.toolTipWidth:
self.toolTipWidth=width;self.AlignHorizonalCenter()
self.attrLockActive=(weakref.ref(tab),core.Snapshot(player.SWITCHBOT,tab.slot_num),cached)
self.ShowToolTip()
def Over(self,slot):
if self.IsEmpty() or not self.IsActive():return _over(self,slot)
self.itemSlot.SetUsableItem(True)
if self.tooltipItem:Active(self.tooltipItem,self)
def Update(self):
_update(self)
active=getattr(self,'attrLockActive',None)
if not self.IsShow() or not active:return
tab=active[0]()
if not tab or tab.IsEmpty() or core.Snapshot(player.SWITCHBOT,tab.slot_num)!=active[1]:
self.ClearToolTip();self.HideToolTip();return
if not tab.IsActive():self.SetInventoryItem(tab.slot_num,player.SWITCHBOT)
elif Cached(player.SWITCHBOT,tab.slot_num)!=active[2]:Active(self,tab)
def Close(self):
_cache.clear()
return _close(self)
def Open(self):
result=_open(self)
self.attrLockSynced=False;self.attrLockSyncTries=0;self.attrLockSyncNext=app.GetTime()+1
return result
def GameUpdate(self):
_gameUpdate(self)
if not getattr(self,'attrLockSynced',True) and self.attrLockSyncTries<3 and app.GetTime()>=self.attrLockSyncNext:
self.attrLockSyncTries+=1;self.attrLockSyncNext=app.GetTime()+2.25
net.SendChatPacket('/attr_lock_sync')
player.GetItemLink=GetItemLink
chat.GetLinkFromHyperlink=Relay
uiToolTip.HyperlinkItemToolTip.SetHyperlinkItem=Hyperlink
uiToolTip.ItemToolTip.ClearToolTip=Clear
uiToolTip.ItemToolTip.OnUpdate=Update
mt_switchbot.SwitchbotItemTab.OverInItem=Over
game.GameWindow.BINARY_ServerCommand_Run=Command
game.GameWindow.Close=Close
game.GameWindow.Open=Open
game.GameWindow.OnUpdate=GameUpdate
)PY";

Some files were not shown because too many files have changed in this diff Show More