GCPlayerShopSaleShopInfo 是玩家商店收购店界面的整表数据包,会把店铺基础信息、20 个收购槽位和说明文本一次性发给客户端。
包信息
| 项目 |
内容 |
| 封包 ID |
392 |
| 包名 |
GCPlayerShopSaleShopInfo |
| 方向 |
Server -> Client |
| 对应请求 |
CGPlayerShopSaleShopOpt 等收购店管理链 |
| 包长 |
变长;483 + desc_len |
| 作用 |
刷新整张收购店界面数据 |
包体结构
| 偏移 |
长度 |
字段 |
类型 |
含义 |
0x00 |
0x0C |
shop_id |
PlayerShopGUID |
目标店铺 GUID |
0x0C |
0x04 |
shop_index |
int32 |
店铺索引 |
0x10 |
0x01 |
context_id_minus_1 |
uint8 |
界面上下文值 |
0x11 |
0x04 |
reserved_1 |
int32 |
当前 Lua 固定写 0 |
0x15 |
0x04 |
profit_money |
int32 |
当前盈利金 |
0x19 |
0x0C |
shop_name |
char[12] |
店铺名称 |
0x25 |
0x1E |
owner_name |
char[30] |
店主名字 |
0x43 |
0x04 |
owner_guid |
int32 |
店主 GUID |
0x47 |
0x04 |
slot_count |
int32 |
收购槽位数量,当前一般为 20 |
0x4B |
0x190 |
slots[20] |
struct[20] |
每条 20 字节,含物品索引、价格、需求量、显示键、暗化和待取回数量 |
0x1DB |
0x04 |
desc_len |
uint32 |
说明文本长度 |
0x1DF |
desc_len |
char[n] |
string |
收购说明文本 |
末尾 |
0x04 |
npc_server_id |
int32 |
当前交互 NPC ID |
当前实际行为
- 当前
scenecore.lua 在需要刷新收购店界面时,会统一调用 send_player_shop_sale_shop_info() 发送这条包。
- 20 个槽位每条都包含
item_index / price / need_to_recycle / display_flag / gloom / need_to_get 六类信息。
- 这条包是收购店界面的整表刷新包,很多操作成功后都会补发它。
服务端落点
- 协议定义:
/home/ubuntu/Game2/services/game/packet.lua
- 发送点:
/home/ubuntu/Game2/services/scene/scenecore.lua
- 关联请求文档:
/home/ubuntu/Game2/docs/07_登录_网络_封包/packet.CGPlayerShopSaleShopOpt.md
关键代码
local msg = packet_def.GCPlayerShopSaleShopInfo.new()
msg.shop_id = shop:get_guid()
msg.shop_index = playershopmanager:get_id_by_guid(shop:get_guid()) or 0
msg.context_minus_1 = math.floor(tonumber(context_minus_1) or 0)
msg.unknow_1 = 0
msg.profit_money = shop:get_profit_money()
msg.shop_name = shop:get_name()
msg.desc = shop:get_recycle_desc()
msg.owner_guid = shop:get_owner_guid()
msg.owner_name = shop:get_owner_name()
msg.slot_count = shop.RECYCLE_ITEM_COUNT
msg.slots = build_player_shop_sale_shop_slots(shop)
msg.npc_server_id = npc_server_id
scene:send2client(obj_me, msg)
结论
GCPlayerShopSaleShopInfo(392) 是玩家商店收购店的整表刷新包。
- 结构重点是店铺头信息、20 个固定槽位和尾部说明文本。
- 写这条包时,应把它理解成“整张收购店界面的完整快照”。
|