gopenfusion/shard/chat.go

59 lines
1.7 KiB
Go
Raw Normal View History

2023-06-28 02:49:11 +00:00
package shard
import (
"fmt"
2023-06-28 02:49:11 +00:00
"github.com/CPunch/gopenfusion/internal/entity"
"github.com/CPunch/gopenfusion/internal/protocol"
)
func (server *ShardServer) freeChat(peer *protocol.CNPeer, _plr interface{}, pkt protocol.Packet) error {
2023-06-28 02:49:11 +00:00
var chat protocol.SP_CL2FE_REQ_SEND_FREECHAT_MESSAGE
pkt.Decode(&chat)
if _plr == nil {
return fmt.Errorf("freeChat: _plr is nil")
2023-06-28 02:49:11 +00:00
}
plr := _plr.(*entity.Player)
2023-06-28 02:49:11 +00:00
// 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, _plr interface{}, pkt protocol.Packet) error {
2023-06-28 02:49:11 +00:00
var chat protocol.SP_CL2FE_REQ_SEND_MENUCHAT_MESSAGE
pkt.Decode(&chat)
if _plr == nil {
return fmt.Errorf("menuChat: _plr is nil")
2023-06-28 02:49:11 +00:00
}
plr := _plr.(*entity.Player)
2023-06-28 02:49:11 +00:00
// 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, _plr interface{}, pkt protocol.Packet) error {
2023-06-28 02:49:11 +00:00
var chat protocol.SP_CL2FE_REQ_PC_AVATAR_EMOTES_CHAT
pkt.Decode(&chat)
if _plr == nil {
return fmt.Errorf("emoteChat: _plr is nil")
2023-06-28 02:49:11 +00:00
}
plr := _plr.(*entity.Player)
2023-06-28 02:49:11 +00:00
// 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,
})
}