GCAskFashionDepotData 是服务端向客户端下发的时装衣柜完整数据包。当前版本里,这条包用于把整套时装仓库的槽位内容一次性同步给客户端。
包信息
| 项目 |
内容 |
| 封包 ID |
1028 |
| 包名 |
GCAskFashionDepotData |
| 方向 |
GC 游戏服 -> 客户端 |
| 包长 |
变长,13 + 25 * slot_count |
| 当前 Lua 协议定义 |
/home/ubuntu/Game2/services/game/packet.lua |
| 当前主发送点 |
/home/ubuntu/Game2/services/scene/scenecore.lua 的 send_char_fashion_depot_data() |
| 当前触发入口 |
/home/ubuntu/Game2/services/scene/scenecore.lua 的 ask_fashion_depot_data() |
| 当前用途 |
一次性同步时装衣柜全部槽位数据 |
当前 Game.exe 可直接确认:
GetPacketID() = 1028;
GetPacketSize() = 25 * slot_count + 13;
Read() = read_u32(reserved_1) + read_u32(reserved_2) + read_u32(slot_count)
+ repeat(slot_count){ read_24_bytes(fashion_entry) + read_u8(slot_state); }
+ read_u8(end_flag);
Write() = 同结构写回;
Execute() = 2;
包体结构
| 偏移 |
长度 |
字段 |
类型 |
含义 |
0x00 |
0x04 |
reserved_1 |
uint32 |
当前 Lua 未使用,现役发送固定为 0 |
0x04 |
0x04 |
reserved_2 |
uint32 |
当前 Lua 未使用,现役发送固定为 0 |
0x08 |
0x04 |
slot_count |
uint32 |
时装衣柜槽位数量;当前 Lua 固定发送 100 |
0x0C |
0x19 * slot_count |
slot_list |
bytes[n] |
槽位列表,每个槽位固定 25 字节 |
0x0C + 0x19 * slot_count |
0x01 |
end_flag |
uint8 |
结尾标记;当前 Lua 固定写 0 |
单个 slot_list 条目按 25 字节展开如下:
| 偏移 |
长度 |
字段 |
类型 |
含义 |
0x00 |
0x04 |
item_index |
int32 |
时装物品 ID,空槽位时为 define.INVAILD_ID |
0x04 |
0x01 |
quality |
uint8 |
时装品质 |
0x05 |
0x02 |
visual |
uint16 |
时装外观 ID |
0x07 |
0x04 |
reserved_3 |
bytes[4] |
当前 Lua 固定写 0 |
0x0B |
0x01 |
gem_slot_count |
uint8 |
时装镶嵌槽数量 |
0x0C |
0x0C |
gem_item_index_list |
bytes[12] |
3 个宝石物品 ID,各占 4 字节 |
0x18 |
0x01 |
slot_state |
uint8 |
槽位状态;当前 Lua 现役发送固定为 0 |
当前实际行为
- 当前 Lua 收到
CGAskFashionDepotData 后,会直接调用 ask_fashion_depot_data(),随后回发整包 GCAskFashionDepotData。
- 当前
send_char_fashion_depot_data() 固定把 slot_count 设为 100。
- 发送逻辑会遍历角色时装衣柜:
- 有物品的槽位直接写入该物品的原始时装数据。
- 空槽位写入全零结构。
- 当前穿戴中的时装会被投影到
fashion_depot_index 对应槽位。
- 当前 Lua 未对
reserved_1、reserved_2、end_flag 做业务赋值,现役均为 0。
服务端落点
- 协议定义:
/home/ubuntu/Game2/services/game/packet.lua
- 请求触发:
/home/ubuntu/Game2/services/msgagent.lua
- 场景入口:
/home/ubuntu/Game2/services/scene/scenecore.lua 的 ask_fashion_depot_data()
- 主发送逻辑:
/home/ubuntu/Game2/services/scene/scenecore.lua 的 send_char_fashion_depot_data()
关键代码
当前 Lua 协议定义
packet.GCAskFashionDepotData = {
xy_id = packet.XYID_GC_ASK_FASHION_DEPOT_DATA,
ctor = function(self)
self.unknow_1 = 0
self.unknow_2 = 0
self.size = 0
self.unknow_3 = 0
self.list = {}
end,
bos = function(self)
local stream = bostream.new()
stream:writeuint(self.unknow_1)
stream:writeuint(self.unknow_2)
stream:writeuint(self.size)
for i = 1, self.size do
local fashion = self.list[i]
stream:writeint(fashion.item_index or define.INVAILD_ID)
stream:writeuchar(fashion.quality)
stream:writeushort(fashion.visual)
for j = 1, 4 do stream:writeuchar(0) end
stream:writeuchar(fashion.slot_count or 0)
local gems = fashion.list_2 or {}
for j = 1, 3 do stream:writeint(gems[j] or 0) end
stream:writeuchar(0)
end
stream:writeuchar(0)
return stream:get()
end
}
当前场景发送逻辑
function scenecore:send_char_fashion_depot_data(obj)
local my_fasion_list = obj:get_fasion_bag_list()
local fashion_depot_index = obj:get_fashion_depot_index()
local ret = packet_def.GCAskFashionDepotData.new()
ret.size = 100
ret.list = {}
for i = 1, ret.size do
local index = i - 1
local fasion = my_fasion_list[index]
if fasion then
table.insert(ret.list, fasion:copy_raw_data())
else
-- 省略空槽位构造
end
end
self:send2client(obj, ret)
end
当前 Game.exe 长度公式
__int64 GetPacketSize(Packet *pkt) {
return 25 * pkt->slot_count + 13;
}
结论
GCAskFashionDepotData 是时装衣柜的完整快照包。
- 当前长度公式可以稳定确认是
13 + 25 * slot_count。
- 当前 Lua 现役固定发送
100 个槽位条目。
- 每个槽位条目是
25 字节,包含时装基础数据、宝石列表和 1 字节槽位状态。
- 当前现役发送链只把这条包当作“整包快照”使用,不是单槽位增量更新包。
|