Implement 40250 classic client port

This commit is contained in:
shenlei
2026-09-01 18:49:28 +09:00
parent 2277b1dd60
commit 8f61990a83
481 changed files with 169826 additions and 293 deletions
+41 -3
View File
@@ -12,6 +12,7 @@ class FakeClient extends Node:
signal party_changed()
signal party_invite_ask(leader_pid: int)
signal friends_changed()
signal friend_invite_ask(name: String)
signal shop_opened(vid: int)
signal shop_closed()
signal shop_error(kind: String)
@@ -33,8 +34,10 @@ class FakeClient extends Node:
var main_vid := 20
var distribute_mode := 0
var leadership := 40
func is_in_game() -> bool: return true
func get_main_vid() -> int: return main_vid
func get_skills() -> Array: return [{"id": 121, "level": leadership}]
func get_party() -> Array: return party
func get_party_distribute_mode() -> int: return distribute_mode
func party_answer(pid, accept) -> bool: calls.append(["party_answer", pid, accept]); return true
@@ -47,6 +50,7 @@ class FakeClient extends Node:
func get_friends() -> Array: return friends
func add_friend(nm) -> bool: calls.append(["add_friend", nm]); return true
func remove_friend(nm) -> bool: calls.append(["remove_friend", nm]); return true
func friend_answer(nm, accept) -> bool: calls.append(["friend_answer", nm, accept]); return true
func get_shop_items() -> Array: return shop
func get_shop() -> Dictionary:
var tabs := shop_tabs if not shop_tabs.is_empty() else [{"name": "", "coin_type": 0, "items": shop}]
@@ -117,7 +121,7 @@ func _run() -> void:
var me_strip: Control = pu._list.get_child(0)
var state_btn: Button = null
for b in me_strip.find_children("*", "Button", true, false):
if String(b.text) in ["", "", "", "", "", "", "", ""]:
if String(b.text) in ["", "", "", "", "", "", "", ""]:
state_btn = b
break
_ck(state_btn != null and not state_btn.disabled, "party: leader's StateButton enabled")
@@ -153,6 +157,26 @@ func _run() -> void:
name_btn.pressed.emit()
_ck(fc.calls.has(["set_target", 20]), "party: 点名字 -> set_target(vid)")
# 40250 CParty::Update 的 Leadership 门控:攻击至少 10,治疗至少 18。
fc.party[0]["leader"] = true
fc.leadership = 9
fc.party_changed.emit()
_ck(pu._heal_btn.disabled, "party: Leadership<18 disables heal")
var gated_state: Button = null
for b in pu._list.get_child(0).find_children("*", "Button", true, false):
if String(b.text) == "":
gated_state = b
break
if gated_state:
gated_state.pressed.emit()
var gated_attack: Button = null
for b in pu._role_popup.find_children("*", "Button", true, false):
if String(b.text).begins_with("攻击"):
gated_attack = b
break
_ck(gated_attack != null and gated_attack.disabled, "party: Leadership<10 disables attacker role")
pu._dismiss_role_popup()
# 非队长 -> StateButton disabled
fc.party[0]["leader"] = false
fc.party[0]["state"] = 0
@@ -169,9 +193,14 @@ func _run() -> void:
fu.setup(fc, canvas)
fu.toggle()
_ck(fu.is_open(), "friend window opens")
fc.friends = [{"name": "Alice", "online": true}, {"name": "Bob", "online": false}]
fc.friends = [{"name": "Alice", "online": true, "mobile": true}, {"name": "Bob", "online": false}]
fc.friends_changed.emit()
await process_frame
var alice_mobile := false
for l in fu._list.find_children("*", "Label", true, false):
if String(l.text) == "手机":
alice_mobile = true
_ck(alice_mobile, "friend: mobile state renders")
var wt := []
fu.whisper_to.connect(func(n): wt.append(n))
# 找 Alice 行的名字按钮
@@ -186,6 +215,15 @@ func _run() -> void:
fu._name_edit.text = "Carol"
fu._on_add()
_ck(fc.calls.has(["add_friend", "Carol"]), "friend: add via input")
fc.friend_invite_ask.emit("Dave")
await process_frame
_ck(fu._invite_dialog.visible and fu._invite_dialog.dialog_text.contains("Dave"),
"friend: incoming request opens confirmation")
fu._invite_dialog.confirmed.emit()
_ck(fc.calls.has(["friend_answer", "Dave", true]), "friend: accept incoming request")
fc.friend_invite_ask.emit("Eve")
fu._invite_dialog.canceled.emit()
_ck(fc.calls.has(["friend_answer", "Eve", false]), "friend: reject incoming request")
# --- 商店 ---
var su: Node = ShopUI.new()
@@ -256,7 +294,7 @@ func _run() -> void:
_ck(xu._self_box.get_child_count() == 1, "exchange: 1 self item row")
_ck(xu._root.get_node("PeerAccept").text == "对方: 已接受", "exchange: peer accept shown")
xu.offer(1, 7)
_ck(fc.calls.has(["ex_add_item", 1, 7, 0]), "exchange: offer item (display 0)")
_ck(fc.calls.has(["ex_add_item", 1, 7, 1]), "exchange: offer item uses first free display slot (1)")
xu._gold_input.text = "500"
xu._on_put_gold()
_ck(fc.calls.has(["ex_gold", 500]), "exchange: put gold")