2025-09-20 00:17:29 +08:00
|
|
|
|
package controller
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"blazing/common/socket/errorcode"
|
2025-11-25 16:36:55 +08:00
|
|
|
|
"blazing/common/utils"
|
2025-10-24 00:31:38 +08:00
|
|
|
|
"blazing/cool"
|
2025-11-25 12:29:50 +08:00
|
|
|
|
"blazing/logic/service/item"
|
2025-09-20 00:17:29 +08:00
|
|
|
|
"blazing/logic/service/player"
|
|
|
|
|
|
"blazing/logic/service/user"
|
2025-11-25 12:29:50 +08:00
|
|
|
|
"blazing/modules/blazing/model"
|
2025-09-20 00:17:29 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
2025-12-24 19:03:11 +08:00
|
|
|
|
// PlayerAim 射击
|
|
|
|
|
|
func (h Controller) PlayerAim(data *user.AimatInboundInfo, c *player.Player) (result *user.AimatOutboundInfo, err errorcode.ErrorCode) {
|
2025-11-18 20:52:04 +00:00
|
|
|
|
result = &user.AimatOutboundInfo{
|
2025-10-20 01:39:07 +08:00
|
|
|
|
|
2025-11-18 20:52:04 +00:00
|
|
|
|
ItemId: data.ItemId,
|
|
|
|
|
|
Point: data.Point,
|
|
|
|
|
|
ShootType: data.ShootType,
|
|
|
|
|
|
UserId: c.Info.UserID,
|
|
|
|
|
|
}
|
|
|
|
|
|
c.GetSpace().Broadcast(c, data.Head.CMD, result)
|
2025-10-20 01:39:07 +08:00
|
|
|
|
|
2025-11-18 20:52:04 +00:00
|
|
|
|
return
|
2025-10-20 01:39:07 +08:00
|
|
|
|
}
|
2025-12-24 19:03:11 +08:00
|
|
|
|
func (h Controller) PlayerChat(data *user.ChatInboundInfo, c *player.Player) (result *user.ChatOutboundInfo, err errorcode.ErrorCode) {
|
2025-10-23 01:02:19 +08:00
|
|
|
|
|
2025-11-18 20:52:04 +00:00
|
|
|
|
result = &user.ChatOutboundInfo{
|
2025-10-24 00:31:38 +08:00
|
|
|
|
|
2025-11-25 16:36:55 +08:00
|
|
|
|
Message: utils.RemoveLast(data.Message),
|
2025-11-18 20:52:04 +00:00
|
|
|
|
SenderNickname: c.Info.Nick,
|
|
|
|
|
|
SenderId: c.Info.UserID,
|
|
|
|
|
|
}
|
|
|
|
|
|
result.Message = cool.Filter.Replace(result.Message, '*')
|
|
|
|
|
|
c.GetSpace().Broadcast(c, data.Head.CMD, result)
|
|
|
|
|
|
return
|
2025-10-24 00:31:38 +08:00
|
|
|
|
}
|
2025-12-23 10:46:17 +08:00
|
|
|
|
|
|
|
|
|
|
// ChangePlayerColor 修改玩家颜色,消耗50赛尔豆
|
2025-10-24 00:31:38 +08:00
|
|
|
|
func (h Controller) ChangePlayerColor(data *user.ChangeColorInboundInfo, c *player.Player) (result *user.ChangeColorOutboundInfo, err errorcode.ErrorCode) {
|
2025-12-23 10:46:17 +08:00
|
|
|
|
const changeColorCost = 50
|
2025-11-13 21:36:18 +08:00
|
|
|
|
|
2025-12-23 10:46:17 +08:00
|
|
|
|
if !c.UseCoins(changeColorCost) {
|
2025-12-16 02:50:10 +08:00
|
|
|
|
return nil, errorcode.ErrorCodes.ErrSunDouInsufficient10016
|
2025-11-13 21:36:18 +08:00
|
|
|
|
}
|
2025-12-23 10:46:17 +08:00
|
|
|
|
|
|
|
|
|
|
c.Info.Coins -= changeColorCost
|
2025-10-24 00:31:38 +08:00
|
|
|
|
c.Info.Color = data.Color
|
2025-11-13 21:36:18 +08:00
|
|
|
|
c.Info.Texture = 0
|
2025-12-23 10:46:17 +08:00
|
|
|
|
|
2025-11-18 20:52:04 +00:00
|
|
|
|
result = &user.ChangeColorOutboundInfo{
|
|
|
|
|
|
UserId: c.Info.UserID,
|
|
|
|
|
|
Color: data.Color,
|
|
|
|
|
|
Coins: c.Info.Coins,
|
|
|
|
|
|
Texture: c.Info.Texture,
|
|
|
|
|
|
}
|
|
|
|
|
|
c.GetSpace().Broadcast(c, data.Head.CMD, result)
|
2025-10-23 01:02:19 +08:00
|
|
|
|
|
2025-11-18 20:52:04 +00:00
|
|
|
|
return
|
2025-10-24 00:31:38 +08:00
|
|
|
|
}
|
2025-12-23 10:46:17 +08:00
|
|
|
|
|
|
|
|
|
|
// ChangePlayerDoodle 修改玩家涂鸦,消耗50赛尔豆
|
2025-10-24 00:31:38 +08:00
|
|
|
|
func (h Controller) ChangePlayerDoodle(data *user.ChangeDoodleInboundInfo, c *player.Player) (result *user.ChangeDoodleOutboundInfo, err errorcode.ErrorCode) {
|
2025-12-23 10:46:17 +08:00
|
|
|
|
const changeDoodleCost = 50
|
|
|
|
|
|
|
|
|
|
|
|
if !c.UseCoins(changeDoodleCost) {
|
2025-12-16 02:50:10 +08:00
|
|
|
|
return nil, errorcode.ErrorCodes.ErrSunDouInsufficient10016
|
2025-11-13 21:36:18 +08:00
|
|
|
|
}
|
2025-12-23 10:46:17 +08:00
|
|
|
|
|
|
|
|
|
|
c.Info.Coins -= changeDoodleCost
|
2025-10-24 00:31:38 +08:00
|
|
|
|
c.Info.Texture = data.Id
|
|
|
|
|
|
c.Info.Color = data.Color
|
2025-12-23 10:46:17 +08:00
|
|
|
|
|
2025-11-18 20:52:04 +00:00
|
|
|
|
result = &user.ChangeDoodleOutboundInfo{
|
|
|
|
|
|
UserId: c.Info.UserID,
|
|
|
|
|
|
Color: c.Info.Color,
|
|
|
|
|
|
Coins: c.Info.Coins,
|
|
|
|
|
|
Texture: c.Info.Texture,
|
|
|
|
|
|
}
|
|
|
|
|
|
c.GetSpace().Broadcast(c, data.Head.CMD, result)
|
|
|
|
|
|
|
|
|
|
|
|
return
|
2025-10-23 01:02:19 +08:00
|
|
|
|
}
|
2025-10-24 00:31:38 +08:00
|
|
|
|
func (h Controller) ChangeNONOColor(data *user.ChangeNONOColorInboundInfo, c *player.Player) (result *user.ChangeNONOColorOutboundInfo, err errorcode.ErrorCode) {
|
|
|
|
|
|
//c.Info.Coins -= 200
|
2025-11-20 15:19:13 +08:00
|
|
|
|
c.Info.NONO.NonoColor = data.Color
|
2025-10-24 00:31:38 +08:00
|
|
|
|
|
|
|
|
|
|
result = &user.ChangeNONOColorOutboundInfo{
|
|
|
|
|
|
Sataus: c.Info.UserID,
|
|
|
|
|
|
Color: c.Info.Color,
|
|
|
|
|
|
}
|
2025-11-20 05:57:29 +08:00
|
|
|
|
c.GetSpace().Broadcast(c, data.Head.CMD, result)
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2025-12-24 19:03:11 +08:00
|
|
|
|
func (h Controller) DanceAction(data *user.C2SDanceAction, c *player.Player) (result *user.S2CDanceAction, err errorcode.ErrorCode) {
|
2025-10-24 00:31:38 +08:00
|
|
|
|
|
2025-11-20 05:57:29 +08:00
|
|
|
|
result = &user.S2CDanceAction{
|
|
|
|
|
|
Type: data.Type,
|
|
|
|
|
|
UserID: c.Info.UserID,
|
|
|
|
|
|
}
|
|
|
|
|
|
c.GetSpace().Broadcast(c, data.Head.CMD, result)
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2025-12-24 19:03:11 +08:00
|
|
|
|
func (h Controller) PeopleTransform(data *user.C2SPEOPLE_TRANSFROM, c *player.Player) (result *user.S2CPEOPLE_TRANSFROM, err errorcode.ErrorCode) {
|
2025-11-20 05:57:29 +08:00
|
|
|
|
|
|
|
|
|
|
result = &user.S2CPEOPLE_TRANSFROM{
|
|
|
|
|
|
SuitID: data.SuitID,
|
|
|
|
|
|
UserID: c.Info.UserID,
|
|
|
|
|
|
}
|
|
|
|
|
|
c.GetSpace().Broadcast(c, data.Head.CMD, result)
|
|
|
|
|
|
return
|
2025-10-24 00:31:38 +08:00
|
|
|
|
}
|
2025-11-25 12:29:50 +08:00
|
|
|
|
func (h Controller) ChangePlayerCloth(data *item.ChangePlayerClothInboundInfo, c *player.Player) (result *item.ChangePlayerClothOutboundInfo, err errorcode.ErrorCode) {
|
|
|
|
|
|
|
|
|
|
|
|
result = &item.ChangePlayerClothOutboundInfo{
|
|
|
|
|
|
UserID: c.Info.UserID,
|
|
|
|
|
|
ClothList: make([]model.PeopleItemInfo, 0),
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-24 19:03:11 +08:00
|
|
|
|
for _, clothID := range data.ClothList {
|
|
|
|
|
|
result.ClothList = append(result.ClothList, model.PeopleItemInfo{ID: clothID, Level: 1})
|
2025-11-25 12:29:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
c.Info.Clothes = result.ClothList
|
|
|
|
|
|
|
|
|
|
|
|
c.GetSpace().Broadcast(c, data.Head.CMD, result)
|
|
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|