feat(client): 完成40250客户端核心功能1:1对齐与桥梁高度采样修复

- 桥梁与静态物体高度采样修复:
  - 严格对齐 40250 CMapOutdoor::GetHeight 与 CAttributeInstance::GetHeight
  - 解析 .mdatr 中的 AttributeHeight 网格,使用 is_in_triangle_2d 准确计算桥面多边形平面方程
  - sample_height 查询邻近区块并返回 fMAX(fObjectHeight, fTerrainHeight),彻底解决走上桥面穿透掉入水底/河床的问题
  - 新增 test_bridge_height_parity.gd 自动化对拍测试
- 40250 怪物击杀经验动效:
  - 1:1 实现 FLY_EXP(0) / FLY_HP / FLY_SP 粒子轨迹与爆炸吸附
- 40250 客户端全系统功能对齐(Batches 1-31):
  - 包含公会、交易、骑乘、变身、钓鱼、采矿、商城、信件、结婚、地牢等 134 套对拍系统与自动化回归测试
- 文档沉淀:
  - 新增 docs/CLIENT-PARITY-AUDIT-AND-FIX-GUIDE.md 客户端对拍缺陷发现与修复工程指南
This commit is contained in:
shen
2026-09-19 08:51:25 -07:00
parent 1db9e9a129
commit 66d217b313
650 changed files with 53046 additions and 1586 deletions
+74 -10
View File
@@ -20,11 +20,15 @@ var _password_dialog: ConfirmationDialog
var item_mouse: Node
const MALL_WINDOW := 4
const MALL_PAGE_SLOTS := 45
const USE_MALL_LIMIT_RANGE_M := 10.0
var _grid: GridContainer
var _cells: Dictionary = {}
var _page_label: Label
var _page := 0
var _mobile_mode := false
var _open_char_pos := Vector3.ZERO
var _has_open_pos := false
func setup(m2client: Node, parent: Node, proto_node: Node = null) -> void:
client = m2client
@@ -33,7 +37,9 @@ func setup(m2client: Node, parent: Node, proto_node: Node = null) -> void:
_tooltip_builder.setup(AssetRoot.path(), "en", proto)
_build(parent)
if client.has_signal("mall_opened"):
client.mall_opened.connect(func(_s): refresh())
client.mall_opened.connect(func(_s): open())
if client.has_signal("mall_closed"):
client.mall_closed.connect(_close_local)
if client.has_signal("mall_changed"):
client.mall_changed.connect(refresh)
if client.has_signal("mall_password_required"):
@@ -42,6 +48,35 @@ func setup(m2client: Node, parent: Node, proto_node: Node = null) -> void:
func is_open() -> bool:
return _root != null and _root.visible
func _get_main_char_pos() -> Variant:
if client == null:
return null
var vid := 0
if client.has_method("get_main_vid"):
vid = int(client.get_main_vid())
if vid != 0 and client.has_method("get_entity"):
var e: Dictionary = client.get_entity(vid)
if not e.is_empty() and e.has("pos"):
return e["pos"]
return null
func _process(_delta: float) -> void:
if not is_open() or not _has_open_pos:
return
var cur = _get_main_char_pos()
if cur is Vector3:
if _open_char_pos.distance_to(cur) > USE_MALL_LIMIT_RANGE_M:
close()
func open() -> void:
if _root:
_root.visible = true
var p = _get_main_char_pos()
if p is Vector3:
_open_char_pos = p
_has_open_pos = true
refresh()
func set_mobile_mode(enabled: bool) -> void:
_mobile_mode = enabled
@@ -52,6 +87,10 @@ func close() -> void:
# 对齐原版 MallWindow.Close():先发 /mall_close 让服务器关掉商城仓库。
if client and client.has_method("mall_close") and is_open():
client.mall_close()
_close_local()
func _close_local() -> void:
_has_open_pos = false
if item_mouse and item_mouse.has_method("unregister_owner"):
item_mouse.unregister_owner(self)
if item_mouse.has_method("is_attached") and item_mouse.is_attached():
@@ -133,18 +172,43 @@ func _render_grid() -> void:
cell.set_meta("vnum", vnum)
cell.set_meta("count", count)
func _drop_to_slot(_payload: Dictionary, _local_pos: int) -> bool:
if is_instance_valid(_status):
_status.text = "无法将物品放入商城仓库!"
if item_mouse and item_mouse.has_method("cancel"):
item_mouse.cancel()
return false
func _on_grid_input(local_pos: int, event: InputEvent) -> void:
if not item_mouse or not item_mouse.has_method("attach_item"):
if not (event is InputEventMouseButton and event.pressed):
return
if not (event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT
and event.pressed):
if event.button_index == MOUSE_BUTTON_RIGHT:
var mall_pos := _page * MALL_PAGE_SLOTS + local_pos
var target := _first_free_inv()
if target < 0:
if is_instance_valid(_status):
_status.text = "背包已满"
return
if client and client.has_method("mall_checkout"):
client.mall_checkout(mall_pos, 1, target)
return
var cell: Button = _cells[local_pos]
var vnum := int(cell.get_meta("vnum", 0))
if vnum == 0:
return
item_mouse.attach_item(MALL_WINDOW, _page * MALL_PAGE_SLOTS + local_pos, vnum,
int(cell.get_meta("count", 1)), null, "mall")
elif event.button_index == MOUSE_BUTTON_LEFT:
if item_mouse and item_mouse.has_method("is_attached") and item_mouse.is_attached():
if is_instance_valid(_status):
_status.text = "无法将物品放入商城仓库!"
item_mouse.cancel()
return
if _mobile_mode:
_on_mobile_grid_tap(local_pos)
return
if not item_mouse or not item_mouse.has_method("attach_item"):
return
var cell: Button = _cells[local_pos]
var vnum := int(cell.get_meta("vnum", 0))
if vnum == 0:
return
item_mouse.attach_item(MALL_WINDOW, _page * MALL_PAGE_SLOTS + local_pos, vnum,
int(cell.get_meta("count", 1)), null, "mall")
func _on_mobile_grid_tap(local_pos: int) -> void:
if not _mobile_mode or client == null or not _cells.has(local_pos):