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-11-28 00:16:51 +08:00
|
|
|
// 射击
|
2025-10-20 01:39:07 +08:00
|
|
|
func (h Controller) Aimat(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-10-23 01:02:19 +08:00
|
|
|
func (h Controller) Chat(data *user.ChatInboundInfo, c *player.Player) (result *user.ChatOutboundInfo, err errorcode.ErrorCode) {
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
func (h Controller) ChangePlayerColor(data *user.ChangeColorInboundInfo, c *player.Player) (result *user.ChangeColorOutboundInfo, err errorcode.ErrorCode) {
|
2025-11-13 21:36:18 +08:00
|
|
|
|
|
|
|
|
if !c.UseCoins(200) { //如果花不了200,直接返回
|
|
|
|
|
return
|
|
|
|
|
}
|
2025-12-08 21:11:12 +08:00
|
|
|
c.Info.Coins -= 50
|
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-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
|
|
|
}
|
|
|
|
|
func (h Controller) ChangePlayerDoodle(data *user.ChangeDoodleInboundInfo, c *player.Player) (result *user.ChangeDoodleOutboundInfo, err errorcode.ErrorCode) {
|
2025-11-13 21:36:18 +08:00
|
|
|
if !c.UseCoins(200) { //如果花不了200,直接返回
|
|
|
|
|
return
|
|
|
|
|
}
|
2025-12-08 21:11:12 +08:00
|
|
|
c.Info.Coins -= 50
|
2025-10-24 00:31:38 +08:00
|
|
|
c.Info.Texture = data.Id
|
|
|
|
|
c.Info.Color = data.Color
|
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
|
|
|
|
|
}
|
|
|
|
|
func (h Controller) DANCE_ACTION(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
|
|
|
|
|
}
|
|
|
|
|
func (h Controller) PEOPLE_TRANSFROM(data *user.C2SPEOPLE_TRANSFROM, c *player.Player) (result *user.S2CPEOPLE_TRANSFROM, err errorcode.ErrorCode) {
|
|
|
|
|
|
|
|
|
|
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),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, v := range data.ClothList {
|
|
|
|
|
result.ClothList = append(result.ClothList, model.PeopleItemInfo{ID: v, Level: 1})
|
|
|
|
|
}
|
|
|
|
|
c.Info.Clothes = result.ClothList
|
|
|
|
|
|
|
|
|
|
c.GetSpace().Broadcast(c, data.Head.CMD, result)
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
}
|