无果的远征,多人世界放技能该卡还是得卡

This commit is contained in:
huangxiaolei
2022-12-05 18:17:44 +08:00
parent 447aeeb672
commit 07485328f7
14 changed files with 445 additions and 304 deletions

View File

@@ -49,6 +49,7 @@ func (r *RouteManager) doRoute(cmdId uint16, userId uint32, clientSeq uint32, pa
func (r *RouteManager) InitRoute() {
r.registerRouter(cmd.UnionCmdNotify, r.gameManager.UnionCmdNotify)
r.registerRouter(cmd.MassiveEntityElementOpBatchNotify, r.gameManager.MassiveEntityElementOpBatchNotify)
r.registerRouter(cmd.ToTheMoonEnterSceneReq, r.gameManager.ToTheMoonEnterSceneReq)
r.registerRouter(cmd.PlayerSetPauseReq, r.gameManager.PlayerSetPauseReq)
r.registerRouter(cmd.EnterSceneReadyReq, r.gameManager.EnterSceneReadyReq)
r.registerRouter(cmd.PathfindingEnterSceneReq, r.gameManager.PathfindingEnterSceneReq)

View File

@@ -117,6 +117,15 @@ func (t *TickManager) onTickMinute(now int64) {
func (t *TickManager) onTick10Second(now int64) {
for _, world := range t.gameManager.worldManager.worldMap {
for _, scene := range world.sceneMap {
for _, player := range scene.playerMap {
// PacketSceneTimeNotify
sceneTimeNotify := new(proto.SceneTimeNotify)
sceneTimeNotify.SceneId = player.SceneId
sceneTimeNotify.SceneTime = uint64(scene.GetSceneTime())
GAME.SendMsg(cmd.SceneTimeNotify, player.PlayerID, player.ClientSeq, sceneTimeNotify)
}
}
if !world.IsBigWorld() && (world.multiplayer || !world.owner.Pause) {
// 刷怪
scene := world.GetSceneById(3)

View File

@@ -13,7 +13,6 @@ func (g *GameManager) UnionCmdNotify(player *model.Player, payloadMsg pb.Message
//logger.LOG.Debug("user send union cmd, uid: %v", player.PlayerID)
req := payloadMsg.(*proto.UnionCmdNotify)
_ = req
world := g.worldManager.GetWorldByID(player.WorldId)
if world == nil {
return
@@ -84,34 +83,8 @@ func (g *GameManager) UnionCmdNotify(player *model.Player, payloadMsg pb.Message
g.SendMsg(cmd.AbilityInvocationsNotify, world.owner.PlayerID, player.ClientSeq, abilityInvocationsNotify)
}
// ClientAbilityInitFinishNotify转发
// PacketClientAbilityInitFinishNotify
if player.ClientAbilityInvokeHandler.AllLen() > 0 {
clientAbilityInitFinishNotify := new(proto.ClientAbilityInitFinishNotify)
clientAbilityInitFinishNotify.Invokes = player.ClientAbilityInvokeHandler.EntryListForwardAll
for _, v := range surrPlayerList {
g.SendMsg(cmd.ClientAbilityInitFinishNotify, v.PlayerID, player.ClientSeq, clientAbilityInitFinishNotify)
}
}
if player.ClientAbilityInvokeHandler.AllExceptCurLen() > 0 {
clientAbilityInitFinishNotify := new(proto.ClientAbilityInitFinishNotify)
clientAbilityInitFinishNotify.Invokes = player.ClientAbilityInvokeHandler.EntryListForwardAllExceptCur
for _, v := range surrPlayerList {
if player.PlayerID == v.PlayerID {
continue
}
g.SendMsg(cmd.ClientAbilityInitFinishNotify, v.PlayerID, player.ClientSeq, clientAbilityInitFinishNotify)
}
}
if player.ClientAbilityInvokeHandler.HostLen() > 0 {
clientAbilityInitFinishNotify := new(proto.ClientAbilityInitFinishNotify)
clientAbilityInitFinishNotify.Invokes = player.ClientAbilityInvokeHandler.EntryListForwardHost
g.SendMsg(cmd.ClientAbilityInitFinishNotify, world.owner.PlayerID, player.ClientSeq, clientAbilityInitFinishNotify)
}
player.CombatInvokeHandler.Clear()
player.AbilityInvokeHandler.Clear()
player.ClientAbilityInvokeHandler.Clear()
}
func (g *GameManager) MassiveEntityElementOpBatchNotify(player *model.Player, payloadMsg pb.Message) {
@@ -125,6 +98,7 @@ func (g *GameManager) MassiveEntityElementOpBatchNotify(player *model.Player, pa
scene := world.GetSceneById(player.SceneId)
ntf.OpIdx = scene.meeoIndex
scene.meeoIndex++
// 只给附近aoi区域的玩家广播消息
surrPlayerList := make([]*model.Player, 0)
entityIdList := world.aoiManager.GetEntityIdListByPos(float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))
@@ -146,6 +120,7 @@ func (g *GameManager) MassiveEntityElementOpBatchNotify(player *model.Player, pa
func (g *GameManager) CombatInvocationsNotify(player *model.Player, payloadMsg pb.Message) {
//logger.LOG.Debug("user combat invocations, uid: %v", player.PlayerID)
req := payloadMsg.(*proto.CombatInvocationsNotify)
world := g.worldManager.GetWorldByID(player.WorldId)
if world == nil {
return
@@ -160,6 +135,9 @@ func (g *GameManager) CombatInvocationsNotify(player *model.Player, payloadMsg p
// uid: player.PlayerID,
// })
case proto.CombatTypeArgument_COMBAT_TYPE_ARGUMENT_ENTITY_MOVE:
if player.SceneLoadState != model.SceneEnterDone {
continue
}
entityMoveInfo := new(proto.EntityMoveInfo)
err := pb.Unmarshal(entry.CombatData, entityMoveInfo)
if err != nil {
@@ -348,6 +326,7 @@ func (g *GameManager) CombatInvocationsNotify(player *model.Player, payloadMsg p
func (g *GameManager) AbilityInvocationsNotify(player *model.Player, payloadMsg pb.Message) {
//logger.LOG.Debug("user ability invocations, uid: %v", player.PlayerID)
req := payloadMsg.(*proto.AbilityInvocationsNotify)
for _, entry := range req.Invokes {
//logger.LOG.Debug("AT: %v, FT: %v, UID: %v", entry.ArgumentType, entry.ForwardType, player.PlayerID)
@@ -361,13 +340,141 @@ func (g *GameManager) AbilityInvocationsNotify(player *model.Player, payloadMsg
func (g *GameManager) ClientAbilityInitFinishNotify(player *model.Player, payloadMsg pb.Message) {
//logger.LOG.Debug("user client ability init finish, uid: %v", player.PlayerID)
req := payloadMsg.(*proto.ClientAbilityInitFinishNotify)
invokeHandler := model.NewInvokeHandler[proto.AbilityInvokeEntry]()
for _, entry := range req.Invokes {
//logger.LOG.Debug("AT: %v, FT: %v, UID: %v", entry.ArgumentType, entry.ForwardType, player.PlayerID)
// 处理能力调用
g.HandleAbilityInvoke(player, entry)
player.ClientAbilityInvokeHandler.AddEntry(entry.ForwardType, entry)
invokeHandler.AddEntry(entry.ForwardType, entry)
}
world := g.worldManager.GetWorldByID(player.WorldId)
if world == nil {
return
}
scene := world.GetSceneById(player.SceneId)
// 只给附近aoi区域的玩家广播消息
surrPlayerList := make([]*model.Player, 0)
entityIdList := world.aoiManager.GetEntityIdListByPos(float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))
for _, entityId := range entityIdList {
entity := scene.GetEntity(entityId)
if entity == nil {
continue
}
if entity.avatarEntity != nil {
otherPlayer := g.userManager.GetOnlineUser(entity.avatarEntity.uid)
surrPlayerList = append(surrPlayerList, otherPlayer)
}
}
// ClientAbilityInitFinishNotify转发
// PacketClientAbilityInitFinishNotify
if invokeHandler.AllLen() == 0 && invokeHandler.AllExceptCurLen() == 0 && invokeHandler.HostLen() == 0 {
for _, v := range surrPlayerList {
if player.PlayerID == v.PlayerID {
continue
}
clientAbilityInitFinishNotify := new(proto.ClientAbilityInitFinishNotify)
clientAbilityInitFinishNotify.EntityId = req.EntityId
g.SendMsg(cmd.ClientAbilityInitFinishNotify, v.PlayerID, player.ClientSeq, clientAbilityInitFinishNotify)
}
}
if invokeHandler.AllLen() > 0 {
clientAbilityInitFinishNotify := new(proto.ClientAbilityInitFinishNotify)
clientAbilityInitFinishNotify.EntityId = req.EntityId
clientAbilityInitFinishNotify.Invokes = invokeHandler.EntryListForwardAll
for _, v := range surrPlayerList {
g.SendMsg(cmd.ClientAbilityInitFinishNotify, v.PlayerID, player.ClientSeq, clientAbilityInitFinishNotify)
}
}
if invokeHandler.AllExceptCurLen() > 0 {
clientAbilityInitFinishNotify := new(proto.ClientAbilityInitFinishNotify)
clientAbilityInitFinishNotify.EntityId = req.EntityId
clientAbilityInitFinishNotify.Invokes = invokeHandler.EntryListForwardAllExceptCur
for _, v := range surrPlayerList {
if player.PlayerID == v.PlayerID {
continue
}
g.SendMsg(cmd.ClientAbilityInitFinishNotify, v.PlayerID, player.ClientSeq, clientAbilityInitFinishNotify)
}
}
if invokeHandler.HostLen() > 0 {
clientAbilityInitFinishNotify := new(proto.ClientAbilityInitFinishNotify)
clientAbilityInitFinishNotify.EntityId = req.EntityId
clientAbilityInitFinishNotify.Invokes = invokeHandler.EntryListForwardHost
g.SendMsg(cmd.ClientAbilityInitFinishNotify, world.owner.PlayerID, player.ClientSeq, clientAbilityInitFinishNotify)
}
}
func (g *GameManager) ClientAbilityChangeNotify(player *model.Player, payloadMsg pb.Message) {
//logger.LOG.Debug("user client ability change, uid: %v", player.PlayerID)
req := payloadMsg.(*proto.ClientAbilityChangeNotify)
invokeHandler := model.NewInvokeHandler[proto.AbilityInvokeEntry]()
for _, entry := range req.Invokes {
invokeHandler.AddEntry(entry.ForwardType, entry)
}
world := g.worldManager.GetWorldByID(player.WorldId)
if world == nil {
return
}
scene := world.GetSceneById(player.SceneId)
// 只给附近aoi区域的玩家广播消息
surrPlayerList := make([]*model.Player, 0)
entityIdList := world.aoiManager.GetEntityIdListByPos(float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))
for _, entityId := range entityIdList {
entity := scene.GetEntity(entityId)
if entity == nil {
continue
}
if entity.avatarEntity != nil {
otherPlayer := g.userManager.GetOnlineUser(entity.avatarEntity.uid)
surrPlayerList = append(surrPlayerList, otherPlayer)
}
}
// ClientAbilityChangeNotify转发
// PacketClientAbilityChangeNotify
if invokeHandler.AllLen() == 0 && invokeHandler.AllExceptCurLen() == 0 && invokeHandler.HostLen() == 0 {
clientAbilityChangeNotify := new(proto.ClientAbilityChangeNotify)
clientAbilityChangeNotify.EntityId = req.EntityId
clientAbilityChangeNotify.IsInitHash = req.IsInitHash
for _, v := range surrPlayerList {
if player.PlayerID == v.PlayerID {
continue
}
g.SendMsg(cmd.ClientAbilityChangeNotify, v.PlayerID, player.ClientSeq, clientAbilityChangeNotify)
}
}
if invokeHandler.AllLen() > 0 {
clientAbilityChangeNotify := new(proto.ClientAbilityChangeNotify)
clientAbilityChangeNotify.EntityId = req.EntityId
clientAbilityChangeNotify.IsInitHash = req.IsInitHash
clientAbilityChangeNotify.Invokes = invokeHandler.EntryListForwardAll
for _, v := range surrPlayerList {
g.SendMsg(cmd.ClientAbilityChangeNotify, v.PlayerID, player.ClientSeq, clientAbilityChangeNotify)
}
}
if invokeHandler.AllExceptCurLen() > 0 {
clientAbilityChangeNotify := new(proto.ClientAbilityChangeNotify)
clientAbilityChangeNotify.EntityId = req.EntityId
clientAbilityChangeNotify.IsInitHash = req.IsInitHash
clientAbilityChangeNotify.Invokes = invokeHandler.EntryListForwardAllExceptCur
for _, v := range surrPlayerList {
if player.PlayerID == v.PlayerID {
continue
}
g.SendMsg(cmd.ClientAbilityChangeNotify, v.PlayerID, player.ClientSeq, clientAbilityChangeNotify)
}
}
if invokeHandler.HostLen() > 0 {
clientAbilityChangeNotify := new(proto.ClientAbilityChangeNotify)
clientAbilityChangeNotify.EntityId = req.EntityId
clientAbilityChangeNotify.IsInitHash = req.IsInitHash
clientAbilityChangeNotify.Invokes = invokeHandler.EntryListForwardHost
g.SendMsg(cmd.ClientAbilityChangeNotify, world.owner.PlayerID, player.ClientSeq, clientAbilityChangeNotify)
}
}
@@ -379,9 +486,3 @@ func (g *GameManager) EvtDoSkillSuccNotify(player *model.Player, payloadMsg pb.M
// 处理技能开始时的耐力消耗
g.HandleSkillStartStamina(player, req.SkillId)
}
func (g *GameManager) ClientAbilityChangeNotify(player *model.Player, payloadMsg pb.Message) {
logger.LOG.Debug("user client ability change, uid: %v", player.PlayerID)
req := payloadMsg.(*proto.ClientAbilityChangeNotify)
logger.LOG.Debug("ClientAbilityChangeNotify: %v", req)
}

View File

@@ -100,3 +100,16 @@ func (g *GameManager) ServerAnnounceRevokeNotify(announceId uint32) {
g.SendMsg(cmd.ServerAnnounceRevokeNotify, onlinePlayer.PlayerID, 0, serverAnnounceRevokeNotify)
}
}
func (g *GameManager) ToTheMoonEnterSceneReq(player *model.Player, payloadMsg pb.Message) {
logger.LOG.Debug("user ttm enter scene, uid: %v", player.PlayerID)
req := payloadMsg.(*proto.ToTheMoonEnterSceneReq)
_ = req
g.SendMsg(cmd.ServerAnnounceRevokeNotify, player.PlayerID, player.ClientSeq, new(proto.ToTheMoonEnterSceneRsp))
}
func (g *GameManager) SetEntityClientDataNotify(player *model.Player, payloadMsg pb.Message) {
logger.LOG.Debug("user set entity client data, uid: %v", player.PlayerID)
ntf := payloadMsg.(*proto.SetEntityClientDataNotify)
g.SendMsg(cmd.SetEntityClientDataNotify, player.PlayerID, player.ClientSeq, ntf)
}

View File

@@ -40,7 +40,6 @@ func (g *GameManager) OnLoginOk(userId uint32, player *model.Player, clientSeq u
player.CombatInvokeHandler = model.NewInvokeHandler[proto.CombatInvokeEntry]()
player.AbilityInvokeHandler = model.NewInvokeHandler[proto.AbilityInvokeEntry]()
player.ClientAbilityInvokeHandler = model.NewInvokeHandler[proto.AbilityInvokeEntry]()
//// TODO 薄荷标记
//if world.IsBigWorld() {

View File

@@ -138,17 +138,21 @@ func (g *GameManager) GetScenePointReq(player *model.Player, payloadMsg pb.Messa
logger.LOG.Debug("user get scene point, uid: %v", player.PlayerID)
req := payloadMsg.(*proto.GetScenePointReq)
if req.SceneId != 3 {
getScenePointRsp := new(proto.GetScenePointRsp)
getScenePointRsp.SceneId = req.SceneId
g.SendMsg(cmd.GetScenePointRsp, player.PlayerID, player.ClientSeq, getScenePointRsp)
return
}
// PacketGetScenePointRsp
getScenePointRsp := new(proto.GetScenePointRsp)
getScenePointRsp.SceneId = req.SceneId
getScenePointRsp.UnlockedPointList = make([]uint32, 0)
for i := uint32(1); i < 1000; i++ {
getScenePointRsp.UnlockedPointList = append(getScenePointRsp.UnlockedPointList, i)
}
getScenePointRsp.UnlockAreaList = make([]uint32, 0)
for i := uint32(1); i < 9; i++ {
getScenePointRsp.UnlockAreaList = append(getScenePointRsp.UnlockAreaList, i)
}
getScenePointRsp.SceneId = 3
getScenePointRsp.UnlockAreaList = []uint32{12, 11, 19, 28, 5, 1, 24, 10, 21, 2, 7, 18, 3, 26, 6, 17, 22, 20, 9, 14, 16, 8, 13, 4, 27, 23}
getScenePointRsp.UnlockedPointList = []uint32{553, 155, 58, 257, 38, 135, 528, 329, 13, 212, 401, 3, 600, 545, 589, 180, 416, 7, 615, 206, 400, 599, 114, 12, 211, 104, 502, 93, 325, 540, 131, 320, 519, 121, 616, 218, 606, 197, 208, 703, 305, 499, 254, 652, 60, 458, 282, 691, 167, 366, 323, 32, 319, 222, 181, 380, 612, 234, 433, 391, 488, 79, 338, 139, 241, 42, 57, 256, 154, 353, 588, 491, 82, 209, 10, 500, 91, 301, 489, 4, 392, 536, 127, 337, 605, 8, 487, 78, 228, 626, 598, 1, 200, 137, 336, 535, 382, 310, 509, 100, 498, 14, 213, 625, 361, 471, 674, 475, 603, 6, 205, 485, 76, 77, 486, 359, 165, 364, 317, 271, 384, 72, 481, 253, 156, 350, 45, 244, 516, 107, 306, 296, 97, 162, 571, 495, 86, 44, 248, 646, 539, 221, 22, 318, 706, 308, 507, 103, 302, 258, 442, 33, 324, 393, 61, 255, 655, 246, 385, 73, 482, 551, 153, 363, 35, 444, 245, 439, 251, 445, 36, 235, 15, 424, 225, 214, 623, 327, 537, 128, 542, 133, 332, 322, 31, 20, 429, 432, 443, 34, 59, 468, 604, 405, 515, 316, 117, 321, 122, 249, 459, 50, 29, 438, 40, 330, 116, 326, 503, 304, 514, 105, 550, 351, 152, 586, 387, 250, 541, 328, 236, 435, 247, 48, 37, 446, 538, 339, 11, 210, 476, 379, 671, 477, 676, 242, 168, 577, 378, 383, 81, 490, 501, 92, 331, 543, 252, 87, 496, 463, 307, 484, 75, 505, 96, 534, 555, 146, 462, 365, 381, 182, 166, 575, 69, 478, 494, 85, 74, 483, 368, 465, 386, 95, 84, 493, 396, 587, 5, 602, 204, 99, 497, 298, 492, 702, 293}
getScenePointRsp.LockedPointList = []uint32{173, 398, 627, 223, 417, 419, 231, 278, 699, 408, 276, 229, 520, 512, 415, 113, 274, 565, 344, 436, 394, 403, 262, 430, 195, 412, 315, 233, 440, 52, 409, 334, 193, 240, 566, 469, 187, 704, 413, 346, 259, 447, 286, 102, 345, 580, 411, 129, 578, 202, 682, 294, 570, 414, 511, 622, 428, 449, 426, 238, 265, 273, 564, 467, 563, 175, 269, 457, 574, 89, 388, 291, 707, 125, 559, 268, 656, 183, 280, 267, 357, 260, 354, 451, 410, 119, 216}
getScenePointRsp.HidePointList = []uint32{458, 515, 459, 514}
getScenePointRsp.GroupUnlimitPointList = []uint32{221, 131, 107, 350, 50, 424, 359}
g.SendMsg(cmd.GetScenePointRsp, player.PlayerID, player.ClientSeq, getScenePointRsp)
}
@@ -156,13 +160,25 @@ func (g *GameManager) GetSceneAreaReq(player *model.Player, payloadMsg pb.Messag
logger.LOG.Debug("user get scene area, uid: %v", player.PlayerID)
req := payloadMsg.(*proto.GetSceneAreaReq)
if req.SceneId != 3 {
getSceneAreaRsp := new(proto.GetSceneAreaRsp)
getSceneAreaRsp.SceneId = req.SceneId
g.SendMsg(cmd.GetSceneAreaRsp, player.PlayerID, player.ClientSeq, getSceneAreaRsp)
return
}
// PacketGetSceneAreaRsp
getSceneAreaRsp := new(proto.GetSceneAreaRsp)
getSceneAreaRsp.SceneId = req.SceneId
getSceneAreaRsp.AreaIdList = []uint32{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, 18, 19, 20, 21, 22, 23, 24, 25, 100, 101, 102, 103, 200, 210, 300, 400, 401, 402, 403}
getSceneAreaRsp.SceneId = 3
getSceneAreaRsp.AreaIdList = []uint32{12, 11, 19, 28, 5, 1, 24, 10, 21, 2, 7, 18, 3, 26, 6, 17, 22, 20, 9, 14, 16, 8, 13, 4, 27, 23}
getSceneAreaRsp.CityInfoList = make([]*proto.CityInfo, 0)
getSceneAreaRsp.CityInfoList = append(getSceneAreaRsp.CityInfoList, &proto.CityInfo{CityId: 1, Level: 1})
getSceneAreaRsp.CityInfoList = append(getSceneAreaRsp.CityInfoList, &proto.CityInfo{CityId: 2, Level: 1})
getSceneAreaRsp.CityInfoList = append(getSceneAreaRsp.CityInfoList, &proto.CityInfo{CityId: 3, Level: 1})
getSceneAreaRsp.CityInfoList = append(getSceneAreaRsp.CityInfoList, &proto.CityInfo{CityId: 1, Level: 10})
getSceneAreaRsp.CityInfoList = append(getSceneAreaRsp.CityInfoList, &proto.CityInfo{CityId: 2, Level: 10})
getSceneAreaRsp.CityInfoList = append(getSceneAreaRsp.CityInfoList, &proto.CityInfo{CityId: 3, Level: 10})
getSceneAreaRsp.CityInfoList = append(getSceneAreaRsp.CityInfoList, &proto.CityInfo{CityId: 4, Level: 10})
getSceneAreaRsp.CityInfoList = append(getSceneAreaRsp.CityInfoList, &proto.CityInfo{CityId: 99, Level: 1})
getSceneAreaRsp.CityInfoList = append(getSceneAreaRsp.CityInfoList, &proto.CityInfo{CityId: 100, Level: 1})
getSceneAreaRsp.CityInfoList = append(getSceneAreaRsp.CityInfoList, &proto.CityInfo{CityId: 101, Level: 1})
getSceneAreaRsp.CityInfoList = append(getSceneAreaRsp.CityInfoList, &proto.CityInfo{CityId: 102, Level: 1})
g.SendMsg(cmd.GetSceneAreaRsp, player.PlayerID, player.ClientSeq, getSceneAreaRsp)
}

View File

@@ -194,8 +194,9 @@ func (g *GameManager) UserDealEnterWorld(hostPlayer *model.Player, otherUid uint
if hostWorld.multiplayer == false {
g.UserWorldRemovePlayer(hostWorld, hostPlayer)
hostPlayer.TeamConfig.CurrTeamIndex = 0
hostPlayer.TeamConfig.CurrAvatarIndex = 0
hostWorld = g.worldManager.CreateWorld(hostPlayer, true)
g.UserWorldAddPlayer(hostWorld, hostPlayer)
hostPlayer.SceneLoadState = model.SceneNone
// PacketPlayerEnterSceneNotify
hostPlayerEnterSceneNotify := g.PacketPlayerEnterSceneNotifyMp(
@@ -207,10 +208,6 @@ func (g *GameManager) UserDealEnterWorld(hostPlayer *model.Player, otherUid uint
hostPlayer.Pos,
)
g.SendMsg(cmd.PlayerEnterSceneNotify, hostPlayer.PlayerID, hostPlayer.ClientSeq, hostPlayerEnterSceneNotify)
hostWorld = g.worldManager.CreateWorld(hostPlayer, true)
g.UserWorldAddPlayer(hostWorld, hostPlayer)
hostPlayer.SceneLoadState = model.SceneNone
}
otherWorld := g.worldManager.GetWorldByID(otherPlayer.WorldId)
@@ -234,8 +231,9 @@ func (g *GameManager) UserDealEnterWorld(hostPlayer *model.Player, otherUid uint
Z: hostPlayer.Rot.Z,
}
otherPlayer.SceneId = hostPlayer.SceneId
otherPlayer.TeamConfig.CurrTeamIndex = 0
otherPlayer.TeamConfig.CurrAvatarIndex = 0
g.UserWorldAddPlayer(hostWorld, otherPlayer)
otherPlayer.SceneLoadState = model.SceneNone
// PacketPlayerEnterSceneNotify
playerEnterSceneNotify := g.PacketPlayerEnterSceneNotifyMp(
@@ -247,9 +245,6 @@ func (g *GameManager) UserDealEnterWorld(hostPlayer *model.Player, otherUid uint
otherPlayerOldPos,
)
g.SendMsg(cmd.PlayerEnterSceneNotify, otherPlayer.PlayerID, otherPlayer.ClientSeq, playerEnterSceneNotify)
g.UserWorldAddPlayer(hostWorld, otherPlayer)
otherPlayer.SceneLoadState = model.SceneNone
}
func (g *GameManager) UserLeaveWorld(player *model.Player) bool {

View File

@@ -81,22 +81,14 @@ func (g *GameManager) SceneInitFinishReq(player *model.Player, payloadMsg pb.Mes
// PacketPlayerWorldSceneInfoListNotify
playerWorldSceneInfoListNotify := new(proto.PlayerWorldSceneInfoListNotify)
playerWorldSceneInfoListNotify.InfoList = []*proto.PlayerWorldSceneInfo{
{SceneId: 1, IsLocked: false, SceneTagIdList: []uint32{}},
{SceneId: 3, IsLocked: false, SceneTagIdList: []uint32{102, 113, 117}},
{SceneId: 4, IsLocked: false, SceneTagIdList: []uint32{106, 109, 117}},
{SceneId: 5, IsLocked: false, SceneTagIdList: []uint32{}},
{SceneId: 6, IsLocked: false, SceneTagIdList: []uint32{}},
{SceneId: 7, IsLocked: false, SceneTagIdList: []uint32{}},
{SceneId: 1, IsLocked: true, SceneTagIdList: []uint32{}},
{SceneId: 3, IsLocked: false, SceneTagIdList: []uint32{102, 111, 112, 116, 118, 126, 135, 140, 142, 149, 1091, 1094, 1095, 1099, 1101, 1103, 1105, 1110, 1120, 1122, 1125, 1127, 1129, 1131, 1133, 1135, 1137, 1138, 1140, 1143, 1146, 1165, 1168}},
{SceneId: 4, IsLocked: true, SceneTagIdList: []uint32{}},
{SceneId: 5, IsLocked: false, SceneTagIdList: []uint32{121, 1031}},
{SceneId: 6, IsLocked: false, SceneTagIdList: []uint32{144, 146, 1062, 1063}},
{SceneId: 7, IsLocked: true, SceneTagIdList: []uint32{136, 137, 138, 148, 1034}},
{SceneId: 9, IsLocked: true, SceneTagIdList: []uint32{1012, 1016, 1021, 1022, 1060, 1077}},
}
xumi := &proto.PlayerWorldSceneInfo{
SceneId: 9,
IsLocked: false,
SceneTagIdList: []uint32{},
}
for i := 0; i < 3000; i++ {
xumi.SceneTagIdList = append(xumi.SceneTagIdList, uint32(i))
}
playerWorldSceneInfoListNotify.InfoList = append(playerWorldSceneInfoListNotify.InfoList, xumi)
g.SendMsg(cmd.PlayerWorldSceneInfoListNotify, player.PlayerID, player.ClientSeq, playerWorldSceneInfoListNotify)
// SceneForceUnlockNotify
@@ -291,11 +283,13 @@ func (g *GameManager) ChangeGameTimeReq(player *model.Player, payloadMsg pb.Mess
}
func (g *GameManager) PacketPlayerEnterSceneNotify(player *model.Player) *proto.PlayerEnterSceneNotify {
player.EnterSceneToken = uint32(random.GetRandomInt32(1000, 99999))
world := g.worldManager.GetWorldByID(player.WorldId)
scene := world.GetSceneById(player.SceneId)
player.EnterSceneToken = uint32(random.GetRandomInt32(5000, 50000))
playerEnterSceneNotify := new(proto.PlayerEnterSceneNotify)
playerEnterSceneNotify.SceneId = player.SceneId
playerEnterSceneNotify.Pos = &proto.Vector{X: float32(player.Pos.X), Y: float32(player.Pos.Y), Z: float32(player.Pos.Z)}
playerEnterSceneNotify.SceneBeginTime = uint64(time.Now().UnixMilli())
playerEnterSceneNotify.SceneBeginTime = uint64(scene.GetSceneCreateTime())
playerEnterSceneNotify.Type = proto.EnterType_ENTER_TYPE_SELF
playerEnterSceneNotify.TargetUid = player.PlayerID
playerEnterSceneNotify.EnterSceneToken = player.EnterSceneToken
@@ -307,7 +301,8 @@ func (g *GameManager) PacketPlayerEnterSceneNotify(player *model.Player) *proto.
playerEnterSceneNotify.SceneTransaction = strconv.Itoa(int(player.SceneId)) + "-" +
strconv.Itoa(int(player.PlayerID)) + "-" +
strconv.Itoa(int(time.Now().Unix())) + "-" +
"18402"
"296359"
playerEnterSceneNotify.SceneTagIdList = []uint32{102, 111, 112, 116, 118, 126, 135, 140, 142, 149, 1091, 1094, 1095, 1099, 1101, 1103, 1105, 1110, 1120, 1122, 1125, 1127, 1129, 1131, 1133, 1135, 1137, 1138, 1140, 1143, 1146, 1165, 1168}
return playerEnterSceneNotify
}
@@ -329,13 +324,15 @@ func (g *GameManager) PacketPlayerEnterSceneNotifyMp(
prevSceneId uint32,
prevPos *model.Vector,
) *proto.PlayerEnterSceneNotify {
player.EnterSceneToken = uint32(random.GetRandomInt32(1000, 99999))
world := g.worldManager.GetWorldByID(player.WorldId)
scene := world.GetSceneById(player.SceneId)
player.EnterSceneToken = uint32(random.GetRandomInt32(5000, 50000))
playerEnterSceneNotify := new(proto.PlayerEnterSceneNotify)
playerEnterSceneNotify.PrevSceneId = prevSceneId
playerEnterSceneNotify.PrevPos = &proto.Vector{X: float32(prevPos.X), Y: float32(prevPos.Y), Z: float32(prevPos.Z)}
playerEnterSceneNotify.SceneId = player.SceneId
playerEnterSceneNotify.Pos = &proto.Vector{X: float32(player.Pos.X), Y: float32(player.Pos.Y), Z: float32(player.Pos.Z)}
playerEnterSceneNotify.SceneBeginTime = uint64(time.Now().UnixMilli())
playerEnterSceneNotify.SceneBeginTime = uint64(scene.GetSceneCreateTime())
playerEnterSceneNotify.Type = enterType
playerEnterSceneNotify.TargetUid = targetPlayer.PlayerID
playerEnterSceneNotify.EnterSceneToken = player.EnterSceneToken
@@ -345,14 +342,8 @@ func (g *GameManager) PacketPlayerEnterSceneNotifyMp(
playerEnterSceneNotify.SceneTransaction = strconv.Itoa(int(player.SceneId)) + "-" +
strconv.Itoa(int(targetPlayer.PlayerID)) + "-" +
strconv.Itoa(int(time.Now().Unix())) + "-" +
"18402"
//playerEnterSceneNotify.SceneTagIdList = []uint32{102, 107, 109, 113, 117}
playerEnterSceneNotify.SceneTagIdList = make([]uint32, 0)
for sceneTagId := uint32(0); sceneTagId < 3000; sceneTagId++ {
playerEnterSceneNotify.SceneTagIdList = append(playerEnterSceneNotify.SceneTagIdList, sceneTagId)
}
"296359"
playerEnterSceneNotify.SceneTagIdList = []uint32{102, 111, 112, 116, 118, 126, 135, 140, 142, 149, 1091, 1094, 1095, 1099, 1101, 1103, 1105, 1110, 1120, 1122, 1125, 1127, 1129, 1131, 1133, 1135, 1137, 1138, 1140, 1143, 1146, 1165, 1168}
return playerEnterSceneNotify
}

View File

@@ -216,6 +216,10 @@ func (s *Scene) ChangeGameTime(time uint32) {
s.gameTime = time % 1440
}
func (s *Scene) GetSceneCreateTime() int64 {
return s.createTime
}
func (s *Scene) GetSceneTime() int64 {
now := time.Now().UnixMilli()
return now - s.createTime

View File

@@ -53,23 +53,22 @@ type Player struct {
ChatMsgMap map[uint32][]*ChatMsg `bson:"chatMsgMap"` // 聊天信息
IsGM uint8 `bson:"isGM"` // 管理员权限等级
// 在线数据
EnterSceneToken uint32 `bson:"-"` // 玩家的世界进入令牌
DbState int `bson:"-"` // 数据库存档状态
WorldId uint32 `bson:"-"` // 所在的世界id
PeerId uint32 `bson:"-"` // 多人世界的玩家编号
GameObjectGuidCounter uint64 `bson:"-"` // 游戏对象guid计数器
ClientTime uint32 `bson:"-"` // 玩家客户端的本地时钟
ClientRTT uint32 `bson:"-"` // 玩家客户端往返时延
GameObjectGuidMap map[uint64]GameObject `bson:"-"` // 游戏对象guid映射表
Online bool `bson:"-"` // 在线状态
Pause bool `bson:"-"` // 暂停状态
SceneLoadState int `bson:"-"` // 场景加载状态
CoopApplyMap map[uint32]int64 `bson:"-"` // 敲门申请的玩家uid及时间
StaminaInfo *StaminaInfo `bson:"-"` // 耐力临时数据
ClientSeq uint32 `bson:"-"` // 客户端发包请求的序号
CombatInvokeHandler *InvokeHandler[proto.CombatInvokeEntry]
AbilityInvokeHandler *InvokeHandler[proto.AbilityInvokeEntry]
ClientAbilityInvokeHandler *InvokeHandler[proto.AbilityInvokeEntry]
EnterSceneToken uint32 `bson:"-"` // 玩家的世界进入令牌
DbState int `bson:"-"` // 数据库存档状态
WorldId uint32 `bson:"-"` // 所在的世界id
PeerId uint32 `bson:"-"` // 多人世界的玩家编号
GameObjectGuidCounter uint64 `bson:"-"` // 游戏对象guid计数器
ClientTime uint32 `bson:"-"` // 玩家客户端的本地时钟
ClientRTT uint32 `bson:"-"` // 玩家客户端往返时延
GameObjectGuidMap map[uint64]GameObject `bson:"-"` // 游戏对象guid映射表
Online bool `bson:"-"` // 在线状态
Pause bool `bson:"-"` // 暂停状态
SceneLoadState int `bson:"-"` // 场景加载状态
CoopApplyMap map[uint32]int64 `bson:"-"` // 敲门申请的玩家uid及时间
StaminaInfo *StaminaInfo `bson:"-"` // 耐力临时数据
ClientSeq uint32 `bson:"-"` // 客户端发包请求的序号
CombatInvokeHandler *InvokeHandler[proto.CombatInvokeEntry]
AbilityInvokeHandler *InvokeHandler[proto.AbilityInvokeEntry]
}
func (p *Player) GetNextGameObjectGuid() uint64 {