gopenfusion/shard/chat.go

57 lines
1.5 KiB
Go
Raw Normal View History

2023-06-28 02:49:11 +00:00
package shard
import "github.com/CPunch/gopenfusion/core/protocol"
func (server *ShardServer) freeChat(peer *protocol.CNPeer, pkt protocol.Packet) error {
var chat protocol.SP_CL2FE_REQ_SEND_FREECHAT_MESSAGE
pkt.Decode(&chat)
// sanity check
plr, err := server.getPlayer(peer)
if err != nil {
return err
}
// spread message
2023-06-28 03:05:08 +00:00
return server.sendAllPacket(plr, protocol.P_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC, protocol.SP_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC{
2023-06-28 02:49:11 +00:00
IPC_ID: int32(plr.PlayerID),
SzFreeChat: chat.SzFreeChat,
IEmoteCode: chat.IEmoteCode,
})
}
func (server *ShardServer) menuChat(peer *protocol.CNPeer, pkt protocol.Packet) error {
var chat protocol.SP_CL2FE_REQ_SEND_MENUCHAT_MESSAGE
pkt.Decode(&chat)
// sanity check
plr, err := server.getPlayer(peer)
if err != nil {
return err
}
// spread message
2023-06-28 03:05:08 +00:00
return server.sendAllPacket(plr, protocol.P_FE2CL_REP_SEND_MENUCHAT_MESSAGE_SUCC, protocol.SP_FE2CL_REP_SEND_MENUCHAT_MESSAGE_SUCC{
2023-06-28 02:49:11 +00:00
IPC_ID: int32(plr.PlayerID),
SzFreeChat: chat.SzFreeChat,
IEmoteCode: chat.IEmoteCode,
})
}
func (server *ShardServer) emoteChat(peer *protocol.CNPeer, pkt protocol.Packet) error {
var chat protocol.SP_CL2FE_REQ_PC_AVATAR_EMOTES_CHAT
pkt.Decode(&chat)
// sanity check
plr, err := server.getPlayer(peer)
if err != nil {
return err
}
// spread message
2023-06-28 03:05:08 +00:00
return server.sendAllPacket(plr, protocol.P_FE2CL_REP_PC_AVATAR_EMOTES_CHAT, protocol.SP_FE2CL_REP_PC_AVATAR_EMOTES_CHAT{
2023-06-28 02:49:11 +00:00
IID_From: int32(plr.PlayerID),
IEmoteCode: chat.IEmoteCode,
})
}