mirror of
https://github.com/CPunch/gopenfusion.git
synced 2024-11-21 15:00:07 +00:00
send chat packets to *all* players
This commit is contained in:
parent
215e313c43
commit
f27e72d68d
@ -13,7 +13,7 @@ func (server *ShardServer) freeChat(peer *protocol.CNPeer, pkt protocol.Packet)
|
||||
}
|
||||
|
||||
// spread message
|
||||
return server.sendOthersPacket(plr, protocol.P_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC, protocol.SP_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC{
|
||||
return server.sendAllPacket(plr, protocol.P_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC, protocol.SP_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC{
|
||||
IPC_ID: int32(plr.PlayerID),
|
||||
SzFreeChat: chat.SzFreeChat,
|
||||
IEmoteCode: chat.IEmoteCode,
|
||||
@ -31,7 +31,7 @@ func (server *ShardServer) menuChat(peer *protocol.CNPeer, pkt protocol.Packet)
|
||||
}
|
||||
|
||||
// spread message
|
||||
return server.sendOthersPacket(plr, protocol.P_FE2CL_REP_SEND_MENUCHAT_MESSAGE_SUCC, protocol.SP_FE2CL_REP_SEND_MENUCHAT_MESSAGE_SUCC{
|
||||
return server.sendAllPacket(plr, protocol.P_FE2CL_REP_SEND_MENUCHAT_MESSAGE_SUCC, protocol.SP_FE2CL_REP_SEND_MENUCHAT_MESSAGE_SUCC{
|
||||
IPC_ID: int32(plr.PlayerID),
|
||||
SzFreeChat: chat.SzFreeChat,
|
||||
IEmoteCode: chat.IEmoteCode,
|
||||
@ -49,7 +49,7 @@ func (server *ShardServer) emoteChat(peer *protocol.CNPeer, pkt protocol.Packet)
|
||||
}
|
||||
|
||||
// spread message
|
||||
return server.sendOthersPacket(plr, protocol.P_FE2CL_REP_PC_AVATAR_EMOTES_CHAT, protocol.SP_FE2CL_REP_PC_AVATAR_EMOTES_CHAT{
|
||||
return server.sendAllPacket(plr, protocol.P_FE2CL_REP_PC_AVATAR_EMOTES_CHAT, protocol.SP_FE2CL_REP_PC_AVATAR_EMOTES_CHAT{
|
||||
IID_From: int32(plr.PlayerID),
|
||||
IEmoteCode: chat.IEmoteCode,
|
||||
})
|
||||
|
@ -46,6 +46,16 @@ func (server *ShardServer) sendOthersPacket(plr *entity.Player, typeID uint32, p
|
||||
return nil
|
||||
}
|
||||
|
||||
// sends a packet to all peers in the given chunks
|
||||
func (server *ShardServer) sendAllPacket(plr *entity.Player, typeID uint32, pkt ...interface{}) error {
|
||||
chunks := server.getViewableChunks(plr.Chunk)
|
||||
for _, chunk := range chunks {
|
||||
chunk.SendPacket(typeID, pkt...)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (server *ShardServer) removeEntityFromChunks(chunks []*entity.Chunk, this entity.Entity) {
|
||||
for _, chunk := range chunks {
|
||||
for e := range chunk.Entities {
|
||||
|
Loading…
Reference in New Issue
Block a user