CGFashionDepotOperation 是当前版本时装衣柜系统的现役请求包。背包、衣柜以及当前已装备时装位之间的移动和换位,都是通过这条包进入场景逻辑。
包信息
| 项目 |
内容 |
| 封包 ID |
1031 |
| 包名 |
CGFashionDepotOperation |
| 方向 |
CG 客户端 -> 游戏服 |
| 固定包长 |
9 |
| 专用回包 |
GCFashionDepotOperation(1030) |
| 当前 Lua 协议定义 |
/home/ubuntu/Game2/services/game/packet.lua |
| 当前请求入口 |
/home/ubuntu/Game2/services/msgagent.lua 的 request:CGFashionDepotOperation() |
| 当前场景落点 |
/home/ubuntu/Game2/services/scene/scenecore.lua 的 char_fashion_depot_operation() |
| 当前用途 |
提交时装衣柜移动、取出、换位和与已装备时装位联动的请求 |
当前 Game.exe 可直接确认:
GetPacketID() = 1031;
GetPacketSize() = 9;
Read() = read_u8(dest_container), read_u32(from_index), read_i32(dest_index);
Write() = 同结构写回;
Execute() = 2;
包体结构
| 偏移 |
长度 |
字段 |
类型 |
含义 |
0x00 |
0x01 |
dest_container |
uint8 |
当前 Lua 实际用它区分时装衣柜操作类型 |
0x01 |
0x04 |
from_index |
uint32 |
源槽位索引 |
0x05 |
0x04 |
dest_index |
int32 |
目标槽位索引;为 define.INVAILD_ID 时表示自动分配 |
当前实际行为
- 当前 Lua
request:CGFashionDepotOperation() 会直接把整包转发到场景层。
- 场景层
char_fashion_depot_operation() 目前已确认的分支如下:
dest_container == 1:背包 -> 衣柜
dest_container == 2:衣柜 -> 背包
dest_container == 3 或 4:衣柜内部移动,或与当前已装备时装位联动
- 当
dest_index == define.INVAILD_ID 时,当前 Lua 会尝试自动寻找空槽位。
- 当前衣柜操作的结果反馈全部通过
GCFashionDepotOperation、GCItemInfo、GCNotifyEquip 等包回推给客户端。
服务端落点
- 协议定义:
/home/ubuntu/Game2/services/game/packet.lua
- 请求入口:
/home/ubuntu/Game2/services/msgagent.lua
- 场景处理:
/home/ubuntu/Game2/services/scene/scenecore.lua
关键代码
当前 Lua 协议定义
packet.CGFashionDepotOperation = {
xy_id = packet.XYID_CG_FASHION_DEPOT_OPERATION,
bis = function(self, buffer)
local stream = bistream.new()
stream:attach(buffer)
self.dest_container = stream:readuchar()
self.from_index = stream:readuint()
self.dest_index = stream:readint()
end,
}
当前 Lua 请求入口
function request:CGFashionDepotOperation()
skynet.call(my_scene, "lua", "char_fashion_depot_operation", my_obj_id, self)
end
当前场景分支
if operation.dest_container == 1 then
-- 背包 -> 衣柜
elseif operation.dest_container == 2 then
-- 衣柜 -> 背包
elseif operation.dest_container == 3 or operation.dest_container == 4 then
-- 衣柜内部移动 / 与已装备时装位联动
end
结论
CGFashionDepotOperation 是当前时装衣柜系统的现役请求包。
- 包体固定
9 字节,结构稳定为 dest_container + from_index + dest_index。
- 当前 Lua 已明确接入并完整实现背包、衣柜和已装备时装位之间的联动处理。
- 结果回推主链是
GCFashionDepotOperation(1030)。
|