机器人移动

This commit is contained in:
flswld
2023-05-14 23:59:31 +08:00
parent eaa3193278
commit 3d6d57d199
2 changed files with 14 additions and 8 deletions

View File

@@ -24,4 +24,4 @@ dos_batch_num = 1 # 压力测试每批登录并发数量
dos_loop_login = false # 压力测试是否循环登录退出
client_move_enable = false # 是否开启客户端模拟移动
client_move_speed = 10 # 客户端模拟移动速度
client_move_range_ext = 1024 # 客户端模拟移动区域半径
client_move_range_ext = 100 # 客户端模拟移动区域半径

View File

@@ -155,13 +155,19 @@ func clientLogic(account string, session *net.Session) {
tickCounter++
if config.GetConfig().Hk4eRobot.ClientMoveEnable {
if enterSceneDone {
currPos.X -= float32(float64(config.GetConfig().Hk4eRobot.ClientMoveSpeed) * math.Sin(float64(moveRot)))
currPos.Z += float32(float64(config.GetConfig().Hk4eRobot.ClientMoveSpeed) * math.Cos(float64(moveRot)))
if currPos.X > bornPos.X+float32(config.GetConfig().Hk4eRobot.ClientMoveRangeExt) ||
currPos.Z > bornPos.Z+float32(config.GetConfig().Hk4eRobot.ClientMoveRangeExt) ||
currPos.X < bornPos.X-float32(config.GetConfig().Hk4eRobot.ClientMoveRangeExt) ||
currPos.Z < bornPos.Z-float32(config.GetConfig().Hk4eRobot.ClientMoveRangeExt) {
moveRot = random.GetRandomFloat32(0.0, 359.9)
for {
dx := float32(float64(config.GetConfig().Hk4eRobot.ClientMoveSpeed) * math.Cos(float64(moveRot/360.0*2*math.Pi)))
dz := float32(float64(config.GetConfig().Hk4eRobot.ClientMoveSpeed) * math.Sin(float64(moveRot/360.0*2*math.Pi)))
if currPos.X-dx > bornPos.X+float32(config.GetConfig().Hk4eRobot.ClientMoveRangeExt) ||
currPos.Z-dz > bornPos.Z+float32(config.GetConfig().Hk4eRobot.ClientMoveRangeExt) ||
currPos.X-dx < bornPos.X-float32(config.GetConfig().Hk4eRobot.ClientMoveRangeExt) ||
currPos.Z-dz < bornPos.Z-float32(config.GetConfig().Hk4eRobot.ClientMoveRangeExt) {
moveRot = random.GetRandomFloat32(0.0, 359.9)
continue
}
currPos.X -= dx
currPos.Z -= dz
break
}
moveReliableSeq += 100
entityMoveInfo := &proto.EntityMoveInfo{