包信息
| 项目 |
值 |
| PacketID |
165 |
| 方向 |
Server -> Client |
| 长度 |
15 |
| 作用 |
向客户端回传一次卸装结果,说明装备位、目标格位、道具模板 ID、道具 GUID 和结果码 |
包体结构
| 偏移 |
长度 |
字段 |
类型 |
含义 |
| 0x00 |
0x01 |
equip_slot |
uint8 |
卸装来源装备位 |
| 0x01 |
0x01 |
bag_slot |
uint8 |
目标格位。普通背包卸装时为实际背包格;当前 Lua 在时装衣柜和过期删除路径中会写 255 |
| 0x02 |
0x04 |
item_template_id |
int32 |
道具模板 ID |
| 0x06 |
0x01 |
item_guid.world |
uint8 |
道具 GUID 的 world 段 |
| 0x07 |
0x01 |
item_guid.server |
uint8 |
道具 GUID 的 server 段 |
| 0x08 |
0x02 |
item_guid.mask |
uint16 |
道具 GUID 的 mask 段 |
| 0x0A |
0x04 |
item_guid.series |
uint32 |
道具 GUID 的 series 段 |
| 0x0E |
0x01 |
result_code |
uint8 |
卸装结果码 |
当前实际行为 / 模式说明
- 当前场景服在处理
CGUnEquip 时,会构造 GCUnEquipResult 返回给客户端。
- 普通装备卸下时,服务端会把装备移动到背包空位,返回
result_code = 1,并把 bag_slot 写成实际背包格位。
- 时装位
HEQUIP_FASHION 卸下时,目标容器改为时装衣柜;当前 Lua 成功时仍返回 result_code = 1,但 bag_slot 固定写 255。
- 当前 Lua 主链里已观察到的失败码是
result_code = 3,出现在时装衣柜目标位置异常时。
- 如果目标背包空间不足、时装衣柜已满、装备位本来就没有装备,当前 Lua 会直接弹提示并提前返回,不会发送本包。
- 角色在线定时检查装备过期时,也会主动发送
GCUnEquipResult,用于通知客户端某个装备位的装备已被移除或清空。
- 当前
Game.exe 客户端处理函数对 result_code 预留了多分支:1 走成功卸装流程,2 对应背包页已满提示,3 对应目标位置已有物品,4~7 还有额外错误提示分支。
服务端落点
/home/ubuntu/Game2/services/game/packet.lua
/home/ubuntu/Game2/services/scene/scenecore.lua
/home/ubuntu/Game2/services/scene/obj/human.lua
关键代码
-- /home/ubuntu/Game2/services/game/packet.lua
self.equipPoint = stream:readuchar()
self.bagIndex = stream:readuchar()
self.item_index = stream:readuint()
self.item_guid = packet.ItemGUID.new()
self.item_guid:bis(stream)
self.result = stream:readuchar()
-- /home/ubuntu/Game2/services/scene/scenecore.lua
item_operator:exchange_item(equip_container, equipPoint, dest_container, empty_index)
ret.result = 1
ret.item_guid = equip.guid
ret.item_index = equip.item_index
ret.bagIndex = empty_index
self:send2client(obj_me, ret)
-- /home/ubuntu/Game2/services/scene/scenecore.lua
local cur_index = item_operator:move_item(equip_container, equipPoint, dest_container, empty_index)
ret.item_guid = equip.guid
ret.item_index = equip.item_index
ret.bagIndex = 255
if cur_index == empty_index then
ret.result = 1
else
ret.result = 3
end
-- /home/ubuntu/Game2/services/scene/obj/human.lua
ret = packet_def.GCUnEquipResult.new()
ret.result = 1
ret.bagIndex = 255
ret.equipPoint = pos
ret.item_guid = guid
ret.item_index = item_index
scene:send2client(self, ret)
// Game.exe
GetPacketID() = 165;
GetPacketSize() = 15;
Read() : read(a1 + 24, 1); read(a1 + 25, 1); read(a1 + 28, 4); read(a1 + 32, 8); read(a1 + 40, 1);
Write() : write(a1 + 24, 1); write(a1 + 25, 1); write(a1 + 28, 4); write(a1 + 32, 8); write(a1 + 40, 1);
Handler : 0x1403375B0
结论
GCUnEquipResult 是当前版本卸装结果回包,固定长度 15 字节,核心字段是装备位、目标格位、道具模板 ID、道具 GUID 和结果码。当前 Lua 实际主链稳定发送 result_code = 1 和 result_code = 3;客户端 Game.exe 还额外保留了 2/4/5/6/7 的错误提示分支。
|