Metin2 game client (P0–P11) + mobile asset pipeline

Networked client on the existing Godot 4.7 + libgr2 renderer:
- net: m2dev wire protocol (libsodium KX + XChaCha20), auth/select/game
  phases, EntityStore world model, ~all GC/CG headers. char create/delete,
  private shop / mall / cube, SHOP_GC_START_EX, guild, party (+ CG_PARTY_SET_STATE),
  quests, dragon soul, refine, safebox, exchange.
- UI: in-game windows migrated 1:1 from the reference uiscript/root .py —
  char status (/stat), inventory+equipment, select-item ([SELECT_ITEM] quest
  token), system-option + game-option + ESC system menu, private-shop 39-grid,
  party info board, shop tabs, atlas, minimap, quickbar, chat, …
- EterGrnLib polish: GR2 material blend/two-sided, LOD crossfade, motion-event
  dispatch, contact shadow, ray-AABB picking, weapon grip pre-transform.

Portable asset IO (A1) — all extension/libgr2/formats/mtproto reads routed
through godot::FileAccess (res:// PCK works on iOS/Android); standalone-lib
*_path() kept for the non-Godot CTests. AssetResolver + PropertyRegistry
switched to a baked index (bake_asset_index.gd) instead of std::filesystem.

Mobile builds: build-{android,ios}.sh, export-android.sh, pack-assets.sh,
gen-debug-keystore.sh. Assets ship as a zip mounted at runtime by
project/asset_pack.gd (adb push now; HTTP download is a drop-in later).

ctest 10/10, 34 GDScript suites, macOS/iOS/Android all build.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013EJxkHiNKS4kybHS3XKyAJ
This commit is contained in:
shen
2026-08-31 20:02:12 +09:00
co-authored by Claude Sonnet 5
parent f4917a2b3b
commit 47baf6c0c6
414 changed files with 69568 additions and 385 deletions
+109
View File
@@ -0,0 +1,109 @@
# private_shop_ui_test —— 개인상점 개설창 headless 자체 검사(真 uiscript + 假 client)。
# godot --headless --path project --script private_shop_ui_test.gd
# 校验 privateshopbuilder.py 装载、itemStock 模型(拿起 / 落位 / 价格 / 排序 + display_pos /
# 撤下)、개설 → open_private_shop 封包字段。缺 uiscript 资产时优雅跳过。
extends SceneTree
const PrivateShopUI = preload("res://ui/private_shop_ui.gd")
class FakeClient extends Node:
signal inventory_changed(window: int, cell: int)
var inventory: Array = []
var calls: Array = []
func get_inventory() -> Array: return inventory
func open_private_shop(sign, items) -> bool:
calls.append(["open_shop", sign, items]); return true
func close_private_shop() -> bool:
calls.append(["close_shop"]); return true
class FakeProto extends Node:
func item(vnum: int) -> Dictionary:
return {"vnum": vnum, "name": "I%d" % vnum, "locale_name": "물품%d" % vnum, "type": 1}
var _fail := 0
func _ck(c: bool, m: String) -> void:
if not c:
_fail += 1
printerr("FAIL: " + m)
func _has_call(fc, name: String, pred: Callable) -> bool:
for c in fc.calls:
if c[0] == name and pred.call(c):
return true
return false
func _init() -> void:
_run()
if _fail == 0:
print("PASS: private_shop_ui_test (privateshopbuilder.py + itemStock model + CG_MYSHOP)")
quit(0)
else:
printerr("%d check(s) failed" % _fail)
quit(1)
func _run() -> void:
var assets := AssetRoot.path()
if not FileAccess.file_exists(assets.path_join("uiscript/uiscript/privateshopbuilder.py")):
print(" (skip: no privateshopbuilder.py — assets checkout missing)")
return
var UiManager = load("res://ui/ui_manager.gd")
var ui: CanvasLayer = UiManager.new()
get_root().add_child(ui)
ui._ready()
var fc := FakeClient.new()
var fp := FakeProto.new()
get_root().add_child(fc)
get_root().add_child(fp)
fc.inventory = [{"cell": 4, "vnum": 11901, "count": 1}, {"cell": 5, "vnum": 27993, "count": 3}]
var pu: Node = PrivateShopUI.new()
get_root().add_child(pu)
pu.setup(fc, ui, fp, assets)
pu.open()
_ck(pu.is_open(), "builder window opened")
if not pu.is_open():
return
_ck(pu._cells.size() == 40, "ItemSlot = 40-slot grid (5x8, shop.SHOP_SLOT_COUNT)")
_ck(is_instance_valid(pu._sign), "NameLine overlaid with a LineEdit")
_ck(pu._inv_list.get_child_count() == 2, "2 inventory candidates")
# 未上货 → 개설 무동작
pu._ok()
_ck(not _has_call(fc, "open_shop", func(_c): return true), "empty stock → no send")
# 拿起第 1 件(cell 4)→ 落到格 3,价 250000
(pu._inv_list.get_child(0) as Button).pressed.emit()
_ck(pu._picked != null and int(pu._picked["cell"]) == 4, "picked inv cell 4")
pu._on_slot_clicked(3)
_ck(is_instance_valid(pu._price_dialog), "price dialog opens on empty slot")
pu._place(3, 250000)
_ck(pu._stock.has(3) and int(pu._stock[3]["price"]) == 250000, "stock[3] placed")
_ck(pu._picked == null, "pick cleared after place")
_ck(pu._inv_list.get_child_count() == 1, "placed item leaves candidate list")
# 拿起第 2 件(cell 5)→ 落到格 0(更小格号 → 排前)
(pu._inv_list.get_child(0) as Button).pressed.emit()
pu._place(0, 99)
pu._sign.text = "Cheap swords"
pu._ok()
_ck(_has_call(fc, "open_shop", func(c):
if String(c[1]) != "Cheap swords": return false
var items: Array = c[2]
if items.size() != 2: return false
return int(items[0]["vnum"]) == 27993 and int(items[0]["display_pos"]) == 0 \
and int(items[1]["vnum"]) == 11901 and int(items[1]["price"]) == 250000 \
and int(items[1]["inv_cell"]) == 4 and int(items[1]["display_pos"]) == 3),
"개설 → open_private_shop(sign, stock 按格号排序 + display_pos)")
_ck(not pu.is_open(), "closes after 개설")
# 撤下:재개 → 점유 격 클릭 제거
pu.open()
(pu._inv_list.get_child(0) as Button).pressed.emit()
pu._place(7, 500)
_ck(pu._stock.has(7), "re-placed for remove test")
pu._on_slot_clicked(7)
_ck(not pu._stock.has(7), "click occupied slot removes it (DelPrivateShopItemStock)")
pu._close_shop()
_ck(_has_call(fc, "close_shop", func(_c): return true), "철수 → close_private_shop")
pu.close()