Files
bl/logic/controller/CreatePlayer.go

34 lines
1015 B
Go
Raw Normal View History

package controller
import (
"blazing/common/socket/errorcode"
"blazing/cool"
"blazing/logic/service/player"
"blazing/logic/service/user"
blservice "blazing/modules/blazing/service"
"strings"
"github.com/panjf2000/gnet/v2"
)
// 处理命令: 1001
func (h *Controller) CreatePlayer(data *user.CreatePlayerInboundInfo, c gnet.Conn) (result *user.CreatePlayerOutInfo, err errorcode.ErrorCode) {
data.Nickname = strings.Trim(data.Nickname, "\x00")
2025-11-16 20:30:17 +00:00
blservice.NewUserService(data.Head.UserID).Info.Reg(cool.Filter.Replace(data.Nickname, '*'), data.Color)
return result, 0
}
func (h *Controller) ChangePlayerName(data *user.ChangePlayerNameInboundInfo, c *player.Player) (result *user.ChangePlayerNameOutboundInfo, err errorcode.ErrorCode) {
newnice := cool.Filter.Replace(strings.Trim(data.Nickname, "\x00"), '*')
c.Info.Nick = newnice
result = &user.ChangePlayerNameOutboundInfo{
Nickname: newnice,
UserID: c.Info.UserID,
}
2025-11-18 20:52:04 +00:00
c.GetSpace().Broadcast(c, data.Head.CMD, result)
2025-10-10 04:49:23 +00:00
return result, 0
}