CGAuctionBoxList 是当前项目里用于刷新“我的元宝市场寄售盒”列表的一条上行触发包。现役 Lua 与 Game.exe 都表明它没有任何包体字段,客户端只要发出这条包,msgagent 就会立即向 .Ybexchange 拉取当前角色的寄售盒数据,并回 GCAuctionBoxList。
包信息
| 项目 |
内容 |
| 封包 ID |
85 |
| 包名 |
CGAuctionBoxList |
| 方向 |
CG 上行 |
| 直接响应 |
GCAuctionBoxList |
| 直接响应 ID |
816 |
| 作用 |
请求刷新当前角色在元宝市场中的寄售盒列表 |
包体结构
当前 Game.exe 与 Lua 协议定义都能确认,这条包固定为 0 字节,是标准空包。
| 偏移 |
长度 |
字段 |
类型 |
含义 |
0x00 |
0x00 |
无包体 |
- |
当前版本没有任何字段,仅通过封包 ID 触发寄售盒刷新 |
当前 Game.exe 的 GetPacketSize() 返回固定值:
0
当前实际行为
- 当前
Game.exe 中,CGAuctionBoxList::GetPacketID() 返回 85,GetPacketSize() 返回 0。
- 当前
Game.exe 的 Read() / Write() 都是空实现,直接返回成功,不读取也不写出任何字段。
- 当前
Game.exe 的 Execute() 对客户端侧是空处理,直接返回 2。
- 当前 Lua 请求入口
request:CGAuctionBoxList() 不经过场景服,而是直接调用 send_auction_box_list()。
send_auction_box_list() 会:
- 读取当前角色
guid
- 调用
.Ybexchange:get_box_list(guid) 拉取寄售盒数据
- 构造
GCAuctionBoxList
- 把结果同时写入本地缓存
auction_box_list
- 发送给客户端
- 因为请求本身无包体,当前版本没有字段解析、字段合法性检查,也没有场景对象校验。
- 当前
GCAuctionBoxList(816) 的发送数据来自 merchadise_list:
items[1..10] 对应道具寄售栏
pets[1..5] 对应珍兽寄售栏
msgagent.lua 内部后续的 CGAuctionGetYB、CGAuctionTakeBack、CGAuctionExpireBack 都依赖刚刷新的 auction_box_list 本地缓存;如果缓存不存在,这些请求会直接提示“寄售信息已失效,请刷新后重试”。
- 因此这条空包的真实作用,不是提交参数,而是强制同步一份“当前账号的寄售盒快照”到客户端与本地缓存。
服务端落点
- 协议定义:
/home/ubuntu/Game2/services/game/packet.lua
- 请求入口与主处理:
/home/ubuntu/Game2/services/msgagent.lua
- 上游数据源:
.Ybexchange 服务的 get_box_list
关键代码
当前 Lua 协议定义
packet.CGAuctionBoxList = {
xy_id = packet.XYID_CG_AUCTION_BOX_LIST,
new = function()
local o = {}
setmetatable(o, { __index = packet.CGAuctionBoxList })
o:ctor()
return o
end,
ctor = function(self)
end,
bis = function(self, buffer)
local stream = bistream.new()
stream:attach(buffer)
end
}
当前 Lua 请求入口与发送链
local function send_auction_box_list()
local my_guid = ma_func:get_guid()
local merchadise_list = skynet.call(".Ybexchange", "lua", "get_box_list", my_guid)
local msg = packet_def.GCAuctionBoxList.new()
msg.merchadise_list = merchadise_list
auction_box_list = merchadise_list
Net:send(msg)
end
function request:CGAuctionBoxList()
send_auction_box_list()
end
当前 Lua 对本地寄售盒缓存的使用
local function get_auction_box_merchadise(auction_type, index, offset)
if not auction_box_list then
return nil
end
local merchadise_list
local list_index
if auction_type == 1 then
merchadise_list = auction_box_list.pets
list_index = offset and (index + offset) or (index - 10)
else
merchadise_list = auction_box_list.items
list_index = offset and (index + offset) or index
end
if not merchadise_list or not list_index or list_index < 1 then
return nil, merchadise_list, list_index
end
return merchadise_list[list_index], merchadise_list, list_index
end
当前 Game.exe 的读写与执行结论
GetPacketID() = 85;
GetPacketSize() = 0;
Read(stream) {
return 1;
}
Write(stream) {
return 1;
}
Execute() {
return 2;
}
结论
CGAuctionBoxList(85) 是当前版本里的空包,请求长度固定为 0 字节。
- 这条包没有任何字段,客户端发包的唯一目的就是触发一次“寄售盒列表刷新”。
- 当前主链不经过场景服,而是由
msgagent 直接向 .Ybexchange 拉取当前角色的寄售盒数据。
- 它的直接回包是
GCAuctionBoxList(816),内容来自 items[1..10] + pets[1..5] 两组寄售栏数据。
- 这次刷新还会同步更新
msgagent 本地缓存 auction_box_list,后续领取元宝、取回、过期取回等请求都依赖这份缓存。
- 因为包体为空,当前版本不存在字段命名争议,也不存在参数校验问题。
|