装备校验链/快捷栏/公会/好友情侣/交易仓库五项差距修复(增量 129)
- 装备校验:can_equip 按 CanEquipNow→FindEquipCell→EquipItem 精确重排, 新增 find_equip_cell() 1:1 复刻(RING/UNIQUE 占用翻转、COSTUME/BELT/DS), 帝国 antiflag 降级为 tooltip 提示,LIMIT_PCBANG/REAL_TIME* 语义与倒计时文案 - 快捷栏:死亡全槽禁用+激活守卫、变身(affect 220)技能置灰、 物品槽失配置灰(服务器回收/换武器后刷新) - 公会:GUILD_AUTH_* 权限位门控踢人/公告/技能升级,/gskillup、 被宣战应答弹窗(/war·/nowar)、资金存取行(40250 服务端已禁用仍保留 1:1) - 好友/情侣:messenger 三固定组(好友/公会/情侣),lover_login/logout/ near/far/divorce 命令事件→在线/在身边状态与离婚隐藏 - 交易/仓库:ExchangeState.last_notice(ALREADY/LESS_GOLD)结束浮层提示; 仓库改密 /safebox_change_password 三段输入;关窗补 /safebox_close·/mall_close; 仓库金钱经核实 40250 无 wire 协议,UI 定界只读 - app_flow:重连时 guild_marks_ready 重复连接加 is_connected 守卫 - 相机 look_at 零向量守卫(首帧/传送落点) - 测试:equip/love/guild 断言更新,79 项中 78 绿(game_camera_test 为 HEAD 既有失败);真服冒烟 LIVE_SMOKE PASS(192.168.21.203 全链路) - docs/CLIENT-GAP.md 同步增量 129 Co-Authored-By: Claude Code <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018kUFvQGYusuY3dkfGitmAe
This commit is contained in:
+159
-4
@@ -34,6 +34,13 @@ var _create_dialog: ConfirmationDialog
|
||||
var _create_name_edit: LineEdit
|
||||
var _create_status: Label
|
||||
var _mobile_mode := false
|
||||
var _war_ask_dialog: ConfirmationDialog
|
||||
|
||||
# GUILD_AUTH_*(服务器 guild.h:94-97):等级权限位。会长(grade 0)恒全权。
|
||||
const AUTH_ADD_MEMBER := 1 << 0
|
||||
const AUTH_REMOVE_MEMBER := 1 << 1
|
||||
const AUTH_NOTICE := 1 << 2
|
||||
const AUTH_USE_SKILL := 1 << 3
|
||||
|
||||
const MOBILE_SIZE := Vector2(700, 340)
|
||||
|
||||
@@ -51,6 +58,10 @@ func setup(m2client: Node, parent: Node, table: Object = null) -> void:
|
||||
client.guild_marks_ready.connect(func(_n): refresh())
|
||||
if client.has_signal("guild_mark_uploaded"):
|
||||
client.guild_mark_uploaded.connect(_on_mark_uploaded)
|
||||
# GUILD_WAR_RECV_DECLARE(3) 时弹被宣战应答框(原版 AcceptGuildWarDialog:
|
||||
# 接受发 /war <name>,拒绝发 /nowar <name>,均走 chat 通道)。
|
||||
if client.has_signal("guild_war_event"):
|
||||
client.guild_war_event.connect(_on_guild_war_event)
|
||||
|
||||
func is_open() -> bool:
|
||||
return _root != null and _root.visible
|
||||
@@ -102,6 +113,70 @@ func refresh() -> void:
|
||||
2: _fill_war(int(g.get("id", 0)))
|
||||
3: _fill_comments()
|
||||
|
||||
# 我的等级权限位(会长 grade 0 恒 0xF;否则取 grades[grade-1].auth)。
|
||||
# 成员/等级数据未同步(成员表为空、找不到自己)时**返回全权**——权限只是 UI 预判,
|
||||
# 不可判定时不拦操作,由服务器权威兜底(与原版一致:原版也不在前端做这层门)。
|
||||
const AUTH_ALL := AUTH_ADD_MEMBER | AUTH_REMOVE_MEMBER | AUTH_NOTICE | AUTH_USE_SKILL
|
||||
|
||||
func _my_auth() -> int:
|
||||
if client == null or not client.has_method("get_guild_grades") \
|
||||
or not client.has_method("get_main_pid") \
|
||||
or not client.has_method("get_guild_members"):
|
||||
return AUTH_ALL
|
||||
var my_pid := int(client.get_main_pid())
|
||||
var my_grade := -1
|
||||
for m in client.get_guild_members():
|
||||
if int(m.get("pid", 0)) == my_pid:
|
||||
my_grade = int(m.get("grade", -1))
|
||||
break
|
||||
if my_grade == -1:
|
||||
return AUTH_ALL # 成员表里还没有自己(未同步)
|
||||
if my_grade == 0:
|
||||
return AUTH_ALL # GUILD_LEADER_GRADE
|
||||
var grades: Array = client.get_guild_grades()
|
||||
if my_grade >= 1 and my_grade <= grades.size():
|
||||
return int(grades[my_grade - 1].get("auth", 0))
|
||||
return AUTH_ALL
|
||||
|
||||
# 被宣战应答(对齐原版 __GuildWar_OpenAskDialog / OnAccept / OnDecline)。
|
||||
func _on_guild_war_event(state: int, opp_guild_id: int, opp_name: String) -> void:
|
||||
if state != 3 or opp_guild_id == 0: # GUILD_WAR_RECV_DECLARE
|
||||
return
|
||||
if is_instance_valid(_war_ask_dialog):
|
||||
_war_ask_dialog.queue_free()
|
||||
_war_ask_dialog = ConfirmationDialog.new()
|
||||
_war_ask_dialog.title = "公会战邀请"
|
||||
var shown := opp_name if opp_name != "" else "#%d" % opp_guild_id
|
||||
_war_ask_dialog.dialog_text = "公会 [%s] 向我方宣战,接受吗?" % shown
|
||||
_war_ask_dialog.ok_button_text = "接受"
|
||||
_war_ask_dialog.cancel_button_text = "拒绝"
|
||||
_war_ask_dialog.confirmed.connect(func() -> void:
|
||||
if client.has_method("declare_guild_war"):
|
||||
client.declare_guild_war(opp_name) # /war <name>
|
||||
_war_ask_dialog.queue_free()
|
||||
_war_ask_dialog = null)
|
||||
_war_ask_dialog.canceled.connect(func() -> void:
|
||||
if client.has_method("say") and opp_name != "":
|
||||
client.say(0, "/nowar " + opp_name) # 原版 __GuildWar_OnDecline
|
||||
_war_ask_dialog.queue_free()
|
||||
_war_ask_dialog = null)
|
||||
if _root and _root.get_parent():
|
||||
_root.get_parent().add_child(_war_ask_dialog)
|
||||
if _mobile_mode:
|
||||
_war_ask_dialog.set_meta("mobile_modal", true)
|
||||
_war_ask_dialog.set_meta("mobile_title", "公会战邀请")
|
||||
_war_ask_dialog.popup_centered()
|
||||
|
||||
func _my_grade_is_leader() -> bool:
|
||||
if client == null or not client.has_method("get_main_pid") \
|
||||
or not client.has_method("get_guild_members"):
|
||||
return false
|
||||
var my_pid := int(client.get_main_pid())
|
||||
for m in client.get_guild_members():
|
||||
if int(m.get("pid", 0)) == my_pid:
|
||||
return int(m.get("grade", -1)) == 0 # GUILD_LEADER_GRADE
|
||||
return false
|
||||
|
||||
func _fill_members() -> void:
|
||||
var page := _pages[0]
|
||||
for c in page.get_children():
|
||||
@@ -125,14 +200,58 @@ func _fill_members() -> void:
|
||||
|
||||
var grades: Array = client.get_guild_grades()
|
||||
var members: Array = client.get_guild_members()
|
||||
|
||||
# 公会资金存取(GUILD_CG_DEPOSIT/WITHDRAW_MONEY = 13/14)。40250 服务器把
|
||||
# 两个处理分支都禁用了(input_main.cpp 直接 return),但原版 uiguild.py 的
|
||||
# OnDeposit/OnWithdraw 仍照发——保持 1:1,结果以服务器回执为准。
|
||||
if client.has_method("guild_deposit_money"):
|
||||
var money := HBoxContainer.new()
|
||||
money.add_theme_constant_override("separation", 6)
|
||||
page.add_child(money)
|
||||
var ginfo: Dictionary = client.get_guild()
|
||||
var mlabel := Label.new()
|
||||
mlabel.add_theme_font_size_override("font_size", 14 if _mobile_mode else 12)
|
||||
mlabel.custom_minimum_size = Vector2(300, 40) if _mobile_mode else Vector2(160, 0)
|
||||
mlabel.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
||||
mlabel.text = "公会资金: %d" % int(ginfo.get("gold", 0))
|
||||
money.add_child(mlabel)
|
||||
var amount := LineEdit.new()
|
||||
amount.placeholder_text = "金额"
|
||||
amount.max_length = 9
|
||||
amount.custom_minimum_size = Vector2(160, 40) if _mobile_mode else Vector2(96, 26)
|
||||
money.add_child(amount)
|
||||
var dep := Button.new()
|
||||
dep.text = "存入"
|
||||
dep.tooltip_text = "40250 服务器已禁用公会存款"
|
||||
dep.custom_minimum_size = Vector2(92, 40) if _mobile_mode else Vector2(56, 26)
|
||||
dep.pressed.connect(func():
|
||||
var v := int(amount.text)
|
||||
if v > 0:
|
||||
client.guild_deposit_money(v))
|
||||
money.add_child(dep)
|
||||
var wdr := Button.new()
|
||||
wdr.text = "取出"
|
||||
wdr.tooltip_text = "40250 服务器已禁用公会取款"
|
||||
wdr.custom_minimum_size = Vector2(92, 40) if _mobile_mode else Vector2(56, 26)
|
||||
wdr.pressed.connect(func():
|
||||
var v := int(amount.text)
|
||||
if v > 0:
|
||||
client.guild_withdraw_money(v))
|
||||
money.add_child(wdr)
|
||||
|
||||
var can_kick := (_my_auth() & AUTH_REMOVE_MEMBER) != 0
|
||||
var my_pid := int(client.get_main_pid()) if client.has_method("get_main_pid") else 0
|
||||
members.sort_custom(func(a, b): return int(a.get("grade", 99)) < int(b.get("grade", 99)))
|
||||
for m in members:
|
||||
var gi := int(m.get("grade", 0))
|
||||
var gname := ""
|
||||
if gi >= 1 and gi <= grades.size():
|
||||
gname = String(grades[gi - 1].get("name", ""))
|
||||
var mrow := HBoxContainer.new()
|
||||
mrow.add_theme_constant_override("separation", 6)
|
||||
page.add_child(mrow)
|
||||
var row := Label.new()
|
||||
row.custom_minimum_size = Vector2(640, 34) if _mobile_mode else Vector2.ZERO
|
||||
row.custom_minimum_size = Vector2(560, 34) if _mobile_mode else Vector2.ZERO
|
||||
row.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
||||
row.add_theme_font_size_override("font_size", 14 if _mobile_mode else 12)
|
||||
row.text = "%s Lv.%d [%s] 贡献 %d%s" % [
|
||||
@@ -140,7 +259,17 @@ func _fill_members() -> void:
|
||||
gname if gname != "" else str(gi),
|
||||
int(m.get("offer", 0)),
|
||||
(" 在线" if m.get("online", false) else " 离线") + (" ★" if m.get("general", false) else "")]
|
||||
page.add_child(row)
|
||||
mrow.add_child(row)
|
||||
# 成员管理:REMOVE_MEMBER 权限位可见的踢出按钮(自己与会长不可踢,服务器兜底)。
|
||||
var pid := int(m.get("pid", 0))
|
||||
if can_kick and pid != 0 and pid != my_pid and gi != 0:
|
||||
var kick := Button.new()
|
||||
kick.text = "踢出"
|
||||
kick.custom_minimum_size = Vector2(72, 34) if _mobile_mode else Vector2(44, 24)
|
||||
kick.pressed.connect(func():
|
||||
if client.has_method("guild_remove_member"):
|
||||
client.guild_remove_member(pid))
|
||||
mrow.add_child(kick)
|
||||
|
||||
func _fill_comments() -> void:
|
||||
var page := _pages[3]
|
||||
@@ -154,6 +283,10 @@ func _fill_comments() -> void:
|
||||
var actions := HBoxContainer.new()
|
||||
actions.add_theme_constant_override("separation", 5)
|
||||
page.add_child(actions)
|
||||
var board_status := Label.new()
|
||||
board_status.add_theme_font_size_override("font_size", 11)
|
||||
board_status.add_theme_color_override("font_color", Color(1, 0.65, 0.55))
|
||||
page.add_child(board_status)
|
||||
var edit := LineEdit.new()
|
||||
edit.placeholder_text = "公告内容(最多 50 字)"
|
||||
edit.custom_minimum_size = Vector2(440, 40) if _mobile_mode else Vector2(245, 26)
|
||||
@@ -163,7 +296,14 @@ func _fill_comments() -> void:
|
||||
post.custom_minimum_size = Vector2(92, 40) if _mobile_mode else Vector2(52, 26)
|
||||
post.pressed.connect(func():
|
||||
var text := edit.text.strip_edges()
|
||||
if text != "" and client.has_method("guild_post_comment"):
|
||||
if text == "":
|
||||
return
|
||||
# 服务器 input_main.cpp:2819:'!' 前缀(公告)需要 GUILD_AUTH_NOTICE。
|
||||
if text.begins_with("!") and (_my_auth() & AUTH_NOTICE) == 0:
|
||||
board_status.text = "发布公告需要相应权限"
|
||||
return
|
||||
board_status.text = ""
|
||||
if client.has_method("guild_post_comment"):
|
||||
client.guild_post_comment(text))
|
||||
actions.add_child(post)
|
||||
var refresh_btn := Button.new()
|
||||
@@ -226,6 +366,11 @@ func _fill_skills() -> void:
|
||||
page.add_child(head)
|
||||
var levels: Array = sk.get("levels", [])
|
||||
var meta := _guild_skill_rows()
|
||||
var auth := _my_auth()
|
||||
var can_use_skill := (auth & AUTH_USE_SKILL) != 0
|
||||
# do_guildskillup 只认会长(GUILD_LEADER_GRADE);技能点 > 0 才显示升级按钮。
|
||||
var is_leader := auth == AUTH_ALL and _my_grade_is_leader()
|
||||
var has_point := int(sk.get("skill_point", 0)) > 0
|
||||
for i in levels.size():
|
||||
var lv := int(levels[i])
|
||||
var nm := "公会技能 %d" % i
|
||||
@@ -242,12 +387,22 @@ func _fill_skills() -> void:
|
||||
lbl.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
||||
lbl.text = "%s Lv %d" % [nm, lv]
|
||||
row.add_child(lbl)
|
||||
if sid >= 0 and lv > 0:
|
||||
# 施放:服务器 guild.cpp:1248 要求 GUILD_AUTH_USE_SKILL。
|
||||
if sid >= 0 and lv > 0 and can_use_skill:
|
||||
var btn := Button.new()
|
||||
btn.text = "施放"
|
||||
btn.custom_minimum_size = Vector2(92, 40) if _mobile_mode else Vector2(56, 24)
|
||||
btn.pressed.connect(func(): client.use_guild_skill(sid, 0))
|
||||
row.add_child(btn)
|
||||
# 升级:/gskillup <技能 vnum>(cmd_general.cpp do_guildskillup,仅会长)。
|
||||
if sid >= 0 and is_leader and has_point:
|
||||
var up := Button.new()
|
||||
up.text = "升级"
|
||||
up.custom_minimum_size = Vector2(92, 40) if _mobile_mode else Vector2(56, 24)
|
||||
up.pressed.connect(func():
|
||||
if client.has_method("say"):
|
||||
client.say(0, "/gskillup %d" % sid))
|
||||
row.add_child(up)
|
||||
|
||||
func _fill_war(my_guild_id: int) -> void:
|
||||
var page := _pages[2]
|
||||
|
||||
Reference in New Issue
Block a user