```
feat(controller): 增强命令注册逻辑并修复试炼塔关卡限制 - 在命令注册时检查重复方法,如果存在则panic提示错误 - 移除CurrentFreshStage和CurrentStage的默认值设置逻辑 - 添加关卡等级验证,确保用户不能挑战超过最大关卡数的关卡 - 修复试炼之塔和勇者之塔的关卡计算逻辑 fix(item): 修复道具使用返回值类型转换问题 - 将ThreeTimes和TwoTimes字段从int32转为uint32返回 - 为能量吸收道具使用函数添加结果结构体初始化 refactor(fight): 清理战斗服务中的注释和字段定义 - 移除C2S_FRESH_CHOICE_FIGHT_LEVEL结构体中冗余的注释说明 - 统一FightOverInfo结构体的格式 fix(item): 修复宠物道具使用的条件判断 - 为道具300790添加DV值大于等于31时不能使用的限制 fix(player): 修复玩家经验加成次数的判断逻辑 - 将TwoTimes和ThreeTimes的判断从不等于0改为大于0 - 将EnergyTime的判断从不等于0改为大于0 - 统一所有次数字段的类型为int32以避免负数问题 chore(admin): 清理无用代码 - 移除未使用的context包导入 - 注释掉未完成的TimeMap接口实现 ```
This commit is contained in:
@@ -8,12 +8,13 @@
|
|||||||
## seer-project
|
## seer-project
|
||||||
|
|
||||||
项目结构:
|
项目结构:
|
||||||
go tool pprof -http :8081 "http://125.208.20.223:54612/debug/debug/pprof/profile"
|
|
||||||
go tool pprof -http :8081 "http://127.0.0.1:9909/debug/pprof/profile"
|
go tool pprof -http :8081 "http://127.0.0.1:9909/debug/pprof/profile"
|
||||||
|
|
||||||
go tool pprof -http :8081 "http://202.189.15.67:62672/debug/pprof/profile"
|
go tool pprof -http :8081 "http://202.189.15.67:62672/debug/pprof/profile"
|
||||||
go tool pprof -http :8081 "http://8.162.8.203:9909/debug/pprof//profile"
|
go tool pprof -http :8081 "http://8.162.8.203:9909/debug/pprof//profile"
|
||||||
go tool pprof -http :8081 "http://8.162.23.87:9910/debug/pprof//profile"
|
go tool pprof -http :8081 "http://8.162.23.87:9910/debug/pprof//profile"
|
||||||
|
go tool pprof -http :8081 "http://61.147.247.7:36855/debug/pprof/profile"
|
||||||
|
|
||||||
详情查看 [文档](./docs)
|
详情查看 [文档](./docs)
|
||||||
|
|
||||||
|
|||||||
@@ -281,10 +281,10 @@ func (s *Server) onevent(c gnet.Conn, v []byte) {
|
|||||||
} else {
|
} else {
|
||||||
header.Data = nil // 避免空切片分配
|
header.Data = nil // 避免空切片分配
|
||||||
}
|
}
|
||||||
t.OnEvent(header)
|
//t.OnEvent(header)
|
||||||
// s.workerPool.Submit(func() {
|
s.workerPool.Submit(func() {
|
||||||
// t.LF.Producer().Write(header)
|
t.LF.Producer().Write(header)
|
||||||
// })
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,6 +160,9 @@ func (f *FightC) initplayer(c common.PlayerI) (*input.Input, errorcode.ErrorCode
|
|||||||
case info.BattleMode.PET_MELEE:
|
case info.BattleMode.PET_MELEE:
|
||||||
in.AllPet = make([]*info.BattlePetEntity, 0)
|
in.AllPet = make([]*info.BattlePetEntity, 0)
|
||||||
var meetpet []config.PetBaseConfig
|
var meetpet []config.PetBaseConfig
|
||||||
|
if len(f.Melee) < 6 {
|
||||||
|
return nil, errorcode.ErrorCodes.ErrSystemError
|
||||||
|
}
|
||||||
if c.GetInfo().UserID == f.ownerID {
|
if c.GetInfo().UserID == f.ownerID {
|
||||||
meetpet = f.Melee[:3]
|
meetpet = f.Melee[:3]
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -2,44 +2,15 @@ package player
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"blazing/common/socket/errorcode"
|
"blazing/common/socket/errorcode"
|
||||||
"blazing/logic/service/fight/info"
|
|
||||||
"blazing/modules/player/model"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type AI_player struct {
|
type AI_player struct {
|
||||||
baseplayer
|
baseplayer
|
||||||
petinfo []model.PetInfo //精灵信息
|
|
||||||
CanCapture int
|
CanCapture int
|
||||||
Prop [6]int8
|
Prop [6]int8
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *AI_player) Getfightinfo() info.Fightinfo {
|
|
||||||
return info.Fightinfo{}
|
|
||||||
}
|
|
||||||
func (f *AI_player) SendPack(b []byte) error {
|
|
||||||
return nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *AI_player) MessWin(b bool) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *AI_player) SendPackCmd(_ uint32, _ any) {
|
|
||||||
|
|
||||||
//fmt.Println("战斗结束")
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *AI_player) GetPetInfo() []model.PetInfo {
|
|
||||||
|
|
||||||
return p.petinfo
|
|
||||||
}
|
|
||||||
|
|
||||||
func (lw *AI_player) SendLoadPercent(info.LoadPercentOutboundInfo) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *AI_player) CanFight() errorcode.ErrorCode {
|
func (p *AI_player) CanFight() errorcode.ErrorCode {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package player
|
package player
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"blazing/common/socket/errorcode"
|
||||||
"blazing/common/utils"
|
"blazing/common/utils"
|
||||||
"blazing/logic/service/common"
|
"blazing/logic/service/common"
|
||||||
"blazing/logic/service/fight/info"
|
"blazing/logic/service/fight/info"
|
||||||
@@ -63,15 +64,33 @@ func (f *baseplayer) FindPet(catchTime uint32) (int, *model.PetInfo, bool) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// PetDel 删除指定宠物
|
func (p *baseplayer) Getfightinfo() info.Fightinfo {
|
||||||
// catchTime: 宠物的捕捉时间戳
|
return info.Fightinfo{}
|
||||||
func (f *Player) PetDel(catchTime uint32) {
|
}
|
||||||
index, olpet, ok := f.FindPet(catchTime)
|
func (f *baseplayer) SendPack(b []byte) error {
|
||||||
if ok {
|
return nil
|
||||||
|
|
||||||
//先将背包更新
|
}
|
||||||
f.Service.Pet.UPdate(*olpet)
|
|
||||||
f.Service.Pet.Pet_del(catchTime)
|
func (f *baseplayer) MessWin(b bool) {
|
||||||
f.Info.PetList = append(f.Info.PetList[:index], f.Info.PetList[index+1:]...)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *baseplayer) SendPackCmd(_ uint32, _ any) {
|
||||||
|
|
||||||
|
//fmt.Println("战斗结束")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *baseplayer) GetPetInfo() []model.PetInfo {
|
||||||
|
|
||||||
|
return p.Info.PetList
|
||||||
|
}
|
||||||
|
|
||||||
|
func (lw *baseplayer) SendLoadPercent(info.LoadPercentOutboundInfo) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *baseplayer) CanFight() errorcode.ErrorCode {
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
@@ -14,6 +15,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
|
"github.com/bruceshao/lockfree"
|
||||||
"github.com/gobwas/ws"
|
"github.com/gobwas/ws"
|
||||||
"github.com/gobwas/ws/wsutil"
|
"github.com/gobwas/ws/wsutil"
|
||||||
"github.com/gogf/gf/v2/os/glog"
|
"github.com/gogf/gf/v2/os/glog"
|
||||||
@@ -210,7 +212,7 @@ type ClientData struct {
|
|||||||
ERROR_CONNUT int
|
ERROR_CONNUT int
|
||||||
Wsmsg *WsCodec
|
Wsmsg *WsCodec
|
||||||
Conn gnet.Conn
|
Conn gnet.Conn
|
||||||
//LF *lockfree.Lockfree[common.TomeeHeader]
|
LF *lockfree.Lockfree[common.TomeeHeader]
|
||||||
//SaveL sync.Once //保存锁
|
//SaveL sync.Once //保存锁
|
||||||
|
|
||||||
//SaveDone chan struct{}
|
//SaveDone chan struct{}
|
||||||
@@ -225,15 +227,15 @@ func NewClientData(c gnet.Conn) *ClientData {
|
|||||||
Conn: c,
|
Conn: c,
|
||||||
Wsmsg: &WsCodec{},
|
Wsmsg: &WsCodec{},
|
||||||
}
|
}
|
||||||
// cd.LF = lockfree.NewLockfree(
|
cd.LF = lockfree.NewLockfree(
|
||||||
// 8,
|
8,
|
||||||
// cd,
|
cd,
|
||||||
// lockfree.NewSleepBlockStrategy(time.Millisecond),
|
lockfree.NewSleepBlockStrategy(time.Millisecond),
|
||||||
// )
|
)
|
||||||
// // 启动Lockfree
|
// // 启动Lockfree
|
||||||
// if err := cd.LF.Start(); err != nil {
|
if err := cd.LF.Start(); err != nil {
|
||||||
// panic(err)
|
panic(err)
|
||||||
// }
|
}
|
||||||
// // // 启动Lockfree
|
// // // 启动Lockfree
|
||||||
// // if err := cd.LF.Start(); err != nil {
|
// // if err := cd.LF.Start(); err != nil {
|
||||||
// // panic(err)
|
// // panic(err)
|
||||||
|
|||||||
@@ -75,3 +75,16 @@ func (p *Player) AddPetExp(petInfo *model.PetInfo, addExp int64) {
|
|||||||
p.SendPack(header.Pack(updateOutbound)) //准备包由各自发,因为协议不一样
|
p.SendPack(header.Pack(updateOutbound)) //准备包由各自发,因为协议不一样
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PetDel 删除指定宠物
|
||||||
|
// catchTime: 宠物的捕捉时间戳
|
||||||
|
func (f *Player) PetDel(catchTime uint32) {
|
||||||
|
index, olpet, ok := f.FindPet(catchTime)
|
||||||
|
if ok {
|
||||||
|
|
||||||
|
//先将背包更新
|
||||||
|
f.Service.Pet.UPdate(*olpet)
|
||||||
|
f.Service.Pet.Pet_del(catchTime)
|
||||||
|
f.Info.PetList = append(f.Info.PetList[:index], f.Info.PetList[index+1:]...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
8
logic/service/player/rpc.go
Normal file
8
logic/service/player/rpc.go
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
package player
|
||||||
|
|
||||||
|
// rpc,跨服匹配的玩家,只做数据的传输
|
||||||
|
type RPC_player struct {
|
||||||
|
baseplayer
|
||||||
|
//
|
||||||
|
serviceid uint32 //玩家所在的ID
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user