实现更多的任务条件
This commit is contained in:
1 parent
d20eb5deb4
commit
f1f8d2e00c
13 files changed
+376
-61
No files matched your search
+18
-1
@@ -108,7 +108,24 @@ type QuestData struct {
|
||||
|
||||
func (g *GameDataConfig) loadQuestData() {
|
||||
g.QuestDataMap = make(map[int32]*QuestData)
|
||||
fileNameList := []string{"QuestData.txt", "QuestData_Exported.txt"}
|
||||
fileNameList := []string{
|
||||
"QuestData.txt",
|
||||
"QuestData_Activity.txt",
|
||||
"QuestData_Coop.txt",
|
||||
"QuestData_Exported.txt",
|
||||
"QuestData_LiyueIQ.txt",
|
||||
"QuestData_LiyueIQ_2.txt",
|
||||
"QuestData_LiyueIQ_3.txt",
|
||||
"QuestData_LiyueLQ_Adult.txt",
|
||||
"QuestData_LiyueMQ.txt",
|
||||
"QuestData_LiyueWQ.txt",
|
||||
"QuestData_MengdeIQ.txt",
|
||||
"QuestData_MengdeIQ_2.txt",
|
||||
"QuestData_MengdeLQ_Adult.txt",
|
||||
"QuestData_MengdeLQ_Teen.txt",
|
||||
"QuestData_MengdeMQ.txt",
|
||||
"QuestData_NPC.txt",
|
||||
}
|
||||
for _, fileName := range fileNameList {
|
||||
questDataList := make([]*QuestData, 0)
|
||||
readTable[QuestData](g.txtPrefix+fileName, &questDataList)
|
||||
|
||||
+1
-1
@@ -277,7 +277,7 @@ func (g *Game) EndlessLoopCheck(checkType int) {
|
||||
}
|
||||
switch checkType {
|
||||
case EndlessLoopCheckTypeAcceptQuest:
|
||||
if checkCount > 100 {
|
||||
if checkCount > 1000 {
|
||||
EndlessLoopHandleFunc()
|
||||
}
|
||||
case EndlessLoopCheckTypeStartQuest:
|
||||
|
||||
@@ -460,6 +460,10 @@ func (g *GMCmd) GMClearQuest(userId uint32) {
|
||||
return
|
||||
}
|
||||
player.DbQuest = nil
|
||||
player.SceneId = 3
|
||||
player.Pos = &model.Vector{X: 2747, Y: 194, Z: -1719}
|
||||
player.Rot = &model.Vector{X: 0, Y: 307, Z: 0}
|
||||
GAME.AcceptQuest(player, false)
|
||||
GAME.LogoutPlayer(userId)
|
||||
}
|
||||
|
||||
@@ -497,6 +501,26 @@ func (g *GMCmd) GMUnlockAllOpenState(userId uint32) {
|
||||
GAME.LogoutPlayer(userId)
|
||||
}
|
||||
|
||||
// GMAddAllSceneTag 解锁全部场景标签
|
||||
func (g *GMCmd) GMAddAllSceneTag(userId uint32, sceneId uint32) {
|
||||
player := USER_MANAGER.GetOnlineUser(userId)
|
||||
if player == nil {
|
||||
logger.Error("player is nil, uid: %v", userId)
|
||||
return
|
||||
}
|
||||
dbWorld := player.GetDbWorld()
|
||||
dbScene := dbWorld.GetSceneById(sceneId)
|
||||
if dbScene == nil {
|
||||
logger.Error("db scene is nil, sceneId: %v, uid: %v", sceneId, userId)
|
||||
return
|
||||
}
|
||||
for _, sceneTagDataConfig := range gdconf.GetSceneTagDataMap() {
|
||||
if uint32(sceneTagDataConfig.SceneId) == sceneId {
|
||||
dbScene.AddSceneTag(uint32(sceneTagDataConfig.SceneTagId))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// GMFreeMode 自由探索模式
|
||||
func (g *GMCmd) GMFreeMode(userId uint32) {
|
||||
player := USER_MANAGER.GetOnlineUser(userId)
|
||||
|
||||
@@ -149,6 +149,7 @@ func (r *RouteManager) initRoute() {
|
||||
cmd.QuickUseWidgetReq: GAME.QuickUseWidgetReq,
|
||||
cmd.SceneAudioNotify: GAME.SceneAudioNotify,
|
||||
cmd.WidgetDoBagReq: GAME.WidgetDoBagReq,
|
||||
cmd.PersonalSceneJumpReq: GAME.PersonalSceneJumpReq,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -307,6 +307,7 @@ func (t *TickManager) onTickSecond(now int64) {
|
||||
// 场景时间增加
|
||||
if !world.GetOwner().Pause && world.GetOwner().PropMap[constant.PLAYER_PROP_IS_GAME_TIME_LOCKED] != 1 {
|
||||
world.ChangeGameTime(world.GetGameTime() + 1)
|
||||
GAME.TriggerQuest(world.GetOwner(), constant.QUEST_FINISH_COND_TYPE_GAME_TIME_TICK, "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,13 +211,14 @@ func (w *WorldManager) GetMultiplayerWorldNum() uint32 {
|
||||
|
||||
// EnterSceneContext 场景切换上下文数据结构
|
||||
type EnterSceneContext struct {
|
||||
OldSceneId uint32
|
||||
OldPos *model.Vector
|
||||
NewSceneId uint32
|
||||
NewPos *model.Vector
|
||||
NewRot *model.Vector
|
||||
OldDungeonPointId uint32
|
||||
Uid uint32
|
||||
OldSceneId uint32
|
||||
OldPos *model.Vector
|
||||
NewSceneId uint32
|
||||
NewPos *model.Vector
|
||||
NewRot *model.Vector
|
||||
DungeonId uint32
|
||||
DungeonPointId uint32
|
||||
Uid uint32
|
||||
}
|
||||
|
||||
// World 世界数据结构
|
||||
|
||||
@@ -363,8 +363,14 @@ func (g *Game) JoinOtherWorld(player *model.Player, hostPlayer *model.Player) {
|
||||
g.WorldAddPlayer(hostWorld, player)
|
||||
|
||||
enterSceneToken := hostWorld.AddEnterSceneContext(&EnterSceneContext{
|
||||
OldSceneId: 0,
|
||||
Uid: player.PlayerId,
|
||||
OldSceneId: 0,
|
||||
OldPos: nil,
|
||||
NewSceneId: hostPlayer.GetSceneId(),
|
||||
NewPos: hostPlayer.GetPos(),
|
||||
NewRot: hostPlayer.GetRot(),
|
||||
DungeonId: 0,
|
||||
DungeonPointId: 0,
|
||||
Uid: player.PlayerId,
|
||||
})
|
||||
|
||||
playerEnterSceneNotify := g.PacketPlayerEnterSceneNotifyMp(
|
||||
@@ -409,13 +415,14 @@ func (g *Game) HostEnterMpWorld(hostPlayer *model.Player) {
|
||||
currPos := g.GetPlayerPos(hostPlayer)
|
||||
|
||||
enterSceneToken := world.AddEnterSceneContext(&EnterSceneContext{
|
||||
OldSceneId: enterSceneId,
|
||||
OldPos: currPos,
|
||||
NewSceneId: enterSceneId,
|
||||
NewPos: enterPos,
|
||||
NewRot: enterRot,
|
||||
OldDungeonPointId: 0,
|
||||
Uid: hostPlayer.PlayerId,
|
||||
OldSceneId: enterSceneId,
|
||||
OldPos: currPos,
|
||||
NewSceneId: enterSceneId,
|
||||
NewPos: enterPos,
|
||||
NewRot: enterRot,
|
||||
DungeonId: 0,
|
||||
DungeonPointId: 0,
|
||||
Uid: hostPlayer.PlayerId,
|
||||
})
|
||||
|
||||
hostPlayerEnterSceneNotify := g.PacketPlayerEnterSceneNotifyMp(
|
||||
|
||||
+123
-15
@@ -149,10 +149,14 @@ func (g *Game) AcceptQuest(player *model.Player, notify bool) {
|
||||
}
|
||||
result = true
|
||||
default:
|
||||
break
|
||||
// logger.Error("not support quest accept cond type: %v, questId: %v, uid: %v", acceptCond.Type, questData.QuestId, player.PlayerId)
|
||||
continue
|
||||
}
|
||||
resultList = append(resultList, result)
|
||||
}
|
||||
if len(resultList) != len(questData.AcceptCondList) {
|
||||
continue
|
||||
}
|
||||
accept := false
|
||||
switch questData.AcceptCondCompose {
|
||||
case constant.QUEST_LOGIC_TYPE_NONE:
|
||||
@@ -173,6 +177,66 @@ func (g *Game) AcceptQuest(player *model.Player, notify bool) {
|
||||
break
|
||||
}
|
||||
}
|
||||
case constant.QUEST_LOGIC_TYPE_A_AND_ETCOR:
|
||||
if len(resultList) < 2 {
|
||||
accept = false
|
||||
break
|
||||
}
|
||||
acceptA := resultList[0]
|
||||
acceptEtc := false
|
||||
for _, result := range resultList[1:] {
|
||||
if result {
|
||||
acceptEtc = true
|
||||
break
|
||||
}
|
||||
}
|
||||
accept = acceptA && acceptEtc
|
||||
case constant.QUEST_LOGIC_TYPE_A_AND_B_AND_ETCOR:
|
||||
if len(resultList) < 3 {
|
||||
accept = false
|
||||
break
|
||||
}
|
||||
acceptA := resultList[0]
|
||||
acceptB := resultList[1]
|
||||
acceptEtc := false
|
||||
for _, result := range resultList[2:] {
|
||||
if result {
|
||||
acceptEtc = true
|
||||
break
|
||||
}
|
||||
}
|
||||
accept = acceptA && acceptB && acceptEtc
|
||||
case constant.QUEST_LOGIC_TYPE_A_OR_ETCAND:
|
||||
if len(resultList) < 2 {
|
||||
accept = false
|
||||
break
|
||||
}
|
||||
acceptA := resultList[0]
|
||||
acceptEtc := true
|
||||
for _, result := range resultList[1:] {
|
||||
if !result {
|
||||
acceptEtc = false
|
||||
break
|
||||
}
|
||||
}
|
||||
accept = acceptA || acceptEtc
|
||||
case constant.QUEST_LOGIC_TYPE_A_OR_B_OR_ETCAND:
|
||||
if len(resultList) < 3 {
|
||||
accept = false
|
||||
break
|
||||
}
|
||||
acceptA := resultList[0]
|
||||
acceptB := resultList[1]
|
||||
acceptEtc := true
|
||||
for _, result := range resultList[2:] {
|
||||
if !result {
|
||||
acceptEtc = false
|
||||
break
|
||||
}
|
||||
}
|
||||
accept = acceptA || acceptB || acceptEtc
|
||||
default:
|
||||
logger.Error("not support quest accept cond logic type: %v, questId: %v, uid: %v", questData.AcceptCondCompose, questData.QuestId, player.PlayerId)
|
||||
}
|
||||
if accept {
|
||||
if questData.QuestId == 35304 {
|
||||
@@ -182,19 +246,9 @@ func (g *Game) AcceptQuest(player *model.Player, notify bool) {
|
||||
g.AddPlayerAvatarEnergy(player.PlayerId, world.GetPlayerActiveAvatarId(player), 0.0, true)
|
||||
}
|
||||
}
|
||||
if questData.QuestId == 35721 {
|
||||
if questData.QuestId == 35722 {
|
||||
// TODO 由于风龙任务进入秘境客户端会无限重连相关原因暂时屏蔽
|
||||
// 直接福瑞
|
||||
if player.OpenStateMap[constant.OPEN_STATE_LIMIT_REGION_FRESHMEAT] == 0 {
|
||||
COMMAND_MANAGER.gmCmd.GMFreeMode(player.PlayerId)
|
||||
for _, openStateData := range gdconf.GetOpenStateDataMap() {
|
||||
player.OpenStateMap[uint32(openStateData.OpenStateId)] = 1
|
||||
}
|
||||
GAME.SendMsg(cmd.OpenStateChangeNotify, player.PlayerId, player.ClientSeq, &proto.OpenStateChangeNotify{
|
||||
OpenStateMap: player.OpenStateMap,
|
||||
})
|
||||
}
|
||||
continue
|
||||
g.SendPrivateChat(COMMAND_MANAGER.system, player.PlayerId, "quest finish 35722")
|
||||
}
|
||||
if questData.QuestId == 36301 {
|
||||
// TODO 懒得搞
|
||||
@@ -460,8 +514,15 @@ func (g *Game) TriggerQuest(player *model.Player, cond int32, complexParam strin
|
||||
continue
|
||||
}
|
||||
dbQuest.FailQuest(quest.QuestId)
|
||||
case constant.QUEST_FINISH_COND_TYPE_COMPLETE_TALK:
|
||||
// 与NPC对话 参数1:对话id
|
||||
ok := matchParamEqual(failCond.Param, param, 1)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
dbQuest.FailQuest(quest.QuestId)
|
||||
default:
|
||||
logger.Error("not support quest cond type: %v, questId: %v, uid: %v", cond, quest.QuestId, player.PlayerId)
|
||||
logger.Error("not support quest fail cond type: %v, questId: %v, uid: %v", cond, quest.QuestId, player.PlayerId)
|
||||
}
|
||||
updateQuestIdMap[quest.QuestId] = struct{}{}
|
||||
}
|
||||
@@ -538,8 +599,55 @@ func (g *Game) TriggerQuest(player *model.Player, cond int32, complexParam strin
|
||||
case constant.QUEST_FINISH_COND_TYPE_ADD_QUEST_PROGRESS:
|
||||
// TODO 这你妈到底是加父任务的进度还是子任务的进度
|
||||
continue
|
||||
case constant.QUEST_FINISH_COND_TYPE_ENTER_DUNGEON:
|
||||
// 进入地牢 参数1:地牢id 参数2:传送锚点id
|
||||
ok := matchParamEqual(finishCond.Param, param, 2)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
dbQuest.AddQuestFinishCount(quest.QuestId, index)
|
||||
case constant.QUEST_FINISH_COND_TYPE_ENTER_MY_WORLD:
|
||||
// 进入世界 参数1:场景id
|
||||
ok := matchParamEqual(finishCond.Param, param, 1)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
dbQuest.AddQuestFinishCount(quest.QuestId, index)
|
||||
case constant.QUEST_FINISH_COND_TYPE_ENTER_ROOM:
|
||||
// 进入房间 参数1:场景id
|
||||
ok := matchParamEqual(finishCond.Param, param, 1)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
dbQuest.AddQuestFinishCount(quest.QuestId, index)
|
||||
case constant.QUEST_FINISH_COND_TYPE_GAME_TIME_TICK:
|
||||
// 游戏时间
|
||||
split := strings.Split(finishCond.ComplexParam, ",")
|
||||
if len(split) != 2 {
|
||||
continue
|
||||
}
|
||||
split0, err := strconv.Atoi(split[0])
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
split1, err := strconv.Atoi(split[1])
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
startGameTimeHour := uint32(split0)
|
||||
endGameTimeHour := uint32(split1)
|
||||
world := WORLD_MANAGER.GetWorldById(player.WorldId)
|
||||
if world == nil {
|
||||
continue
|
||||
}
|
||||
gameTime := world.GetGameTime()
|
||||
gameTimeHour := gameTime / 60
|
||||
if gameTimeHour < startGameTimeHour || gameTimeHour > endGameTimeHour {
|
||||
continue
|
||||
}
|
||||
dbQuest.AddQuestFinishCount(quest.QuestId, index)
|
||||
default:
|
||||
logger.Error("not support quest cond type: %v, questId: %v, uid: %v", cond, quest.QuestId, player.PlayerId)
|
||||
logger.Error("not support quest finish cond type: %v, questId: %v, uid: %v", cond, quest.QuestId, player.PlayerId)
|
||||
}
|
||||
updateQuestIdMap[quest.QuestId] = struct{}{}
|
||||
}
|
||||
|
||||
+57
-19
@@ -30,6 +30,7 @@ const (
|
||||
// EnterSceneReadyReq 准备进入场景
|
||||
func (g *Game) EnterSceneReadyReq(player *model.Player, payloadMsg pb.Message) {
|
||||
req := payloadMsg.(*proto.EnterSceneReadyReq)
|
||||
|
||||
logger.Debug("player enter scene ready, uid: %v", player.PlayerId)
|
||||
world := WORLD_MANAGER.GetWorldById(player.WorldId)
|
||||
if world == nil {
|
||||
@@ -147,6 +148,7 @@ func (g *Game) EnterSceneReadyReq(player *model.Player, payloadMsg pb.Message) {
|
||||
// SceneInitFinishReq 场景初始化完成
|
||||
func (g *Game) SceneInitFinishReq(player *model.Player, payloadMsg pb.Message) {
|
||||
req := payloadMsg.(*proto.SceneInitFinishReq)
|
||||
|
||||
logger.Debug("player scene init finish, uid: %v", player.PlayerId)
|
||||
world := WORLD_MANAGER.GetWorldById(player.WorldId)
|
||||
if world == nil {
|
||||
@@ -199,7 +201,6 @@ func (g *Game) SceneInitFinishReq(player *model.Player, payloadMsg pb.Message) {
|
||||
worldDataNotify.WorldPropMap[2] = g.PacketPropValue(2, object.ConvBoolToInt64(world.IsMultiplayerWorld()))
|
||||
g.SendMsg(cmd.WorldDataNotify, player.PlayerId, player.ClientSeq, worldDataNotify)
|
||||
|
||||
// TODO 暂时先解锁全部场景和场景标签 看着喜庆
|
||||
playerWorldSceneInfoListNotify := &proto.PlayerWorldSceneInfoListNotify{
|
||||
InfoList: []*proto.PlayerWorldSceneInfo{
|
||||
{SceneId: 1, IsLocked: false, SceneTagIdList: []uint32{}},
|
||||
@@ -212,10 +213,14 @@ func (g *Game) SceneInitFinishReq(player *model.Player, payloadMsg pb.Message) {
|
||||
},
|
||||
}
|
||||
for _, info := range playerWorldSceneInfoListNotify.InfoList {
|
||||
for _, sceneTagDataConfig := range gdconf.GetSceneTagDataMap() {
|
||||
if uint32(sceneTagDataConfig.SceneId) == info.SceneId {
|
||||
info.SceneTagIdList = append(info.SceneTagIdList, uint32(sceneTagDataConfig.SceneTagId))
|
||||
}
|
||||
dbWorld := player.GetDbWorld()
|
||||
dbScene := dbWorld.GetSceneById(info.SceneId)
|
||||
if dbScene == nil {
|
||||
logger.Error("db scene is nil, sceneId: %v, uid: %v", info.SceneId, player.PlayerId)
|
||||
continue
|
||||
}
|
||||
for _, sceneTag := range dbScene.GetSceneTagList() {
|
||||
info.SceneTagIdList = append(info.SceneTagIdList, sceneTag)
|
||||
}
|
||||
}
|
||||
g.SendMsg(cmd.PlayerWorldSceneInfoListNotify, player.PlayerId, player.ClientSeq, playerWorldSceneInfoListNotify)
|
||||
@@ -298,8 +303,8 @@ func (g *Game) SceneInitFinishReq(player *model.Player, payloadMsg pb.Message) {
|
||||
logger.Error("get enter scene context is nil, uid: %v", player.PlayerId)
|
||||
return
|
||||
}
|
||||
// 进入的场景是地牢副本发送相关的包
|
||||
if ctx.OldDungeonPointId != 0 {
|
||||
if ctx.DungeonId != 0 {
|
||||
// 进入的场景是地牢副本
|
||||
g.GCGTavernInit(player) // GCG酒馆信息通知
|
||||
g.SendMsg(cmd.DungeonWayPointNotify, player.PlayerId, player.ClientSeq, &proto.DungeonWayPointNotify{})
|
||||
g.SendMsg(cmd.DungeonDataNotify, player.PlayerId, player.ClientSeq, &proto.DungeonDataNotify{})
|
||||
@@ -331,6 +336,7 @@ func (g *Game) SceneInitFinishReq(player *model.Player, payloadMsg pb.Message) {
|
||||
// EnterSceneDoneReq 进入场景完成
|
||||
func (g *Game) EnterSceneDoneReq(player *model.Player, payloadMsg pb.Message) {
|
||||
req := payloadMsg.(*proto.EnterSceneDoneReq)
|
||||
|
||||
logger.Debug("player enter scene done, uid: %v", player.PlayerId)
|
||||
world := WORLD_MANAGER.GetWorldById(player.WorldId)
|
||||
if world == nil {
|
||||
@@ -429,6 +435,7 @@ func (g *Game) EnterSceneDoneReq(player *model.Player, payloadMsg pb.Message) {
|
||||
// PostEnterSceneReq 进入场景后
|
||||
func (g *Game) PostEnterSceneReq(player *model.Player, payloadMsg pb.Message) {
|
||||
req := payloadMsg.(*proto.PostEnterSceneReq)
|
||||
|
||||
logger.Debug("player post enter scene, uid: %v", player.PlayerId)
|
||||
world := WORLD_MANAGER.GetWorldById(player.WorldId)
|
||||
if world == nil {
|
||||
@@ -446,6 +453,25 @@ func (g *Game) PostEnterSceneReq(player *model.Player, payloadMsg pb.Message) {
|
||||
|
||||
world.PlayerEnter(player.PlayerId)
|
||||
|
||||
ctx := world.GetEnterSceneContextByToken(req.EnterSceneToken)
|
||||
if ctx == nil {
|
||||
logger.Error("get enter scene context is nil, uid: %v", player.PlayerId)
|
||||
return
|
||||
}
|
||||
sceneDataConfig := gdconf.GetSceneDataById(int32(ctx.NewSceneId))
|
||||
if sceneDataConfig == nil {
|
||||
logger.Error("get scene data config is nil, sceneId: %v, uid: %v", ctx.NewSceneId, player.PlayerId)
|
||||
return
|
||||
}
|
||||
switch sceneDataConfig.SceneType {
|
||||
case constant.SCENE_TYPE_WORLD:
|
||||
g.TriggerQuest(player, constant.QUEST_FINISH_COND_TYPE_ENTER_MY_WORLD, "", int32(ctx.NewSceneId))
|
||||
case constant.SCENE_TYPE_DUNGEON:
|
||||
g.TriggerQuest(player, constant.QUEST_FINISH_COND_TYPE_ENTER_DUNGEON, "", int32(ctx.DungeonId), int32(ctx.DungeonPointId))
|
||||
case constant.SCENE_TYPE_ROOM:
|
||||
g.TriggerQuest(player, constant.QUEST_FINISH_COND_TYPE_ENTER_ROOM, "", int32(ctx.NewSceneId))
|
||||
}
|
||||
|
||||
rsp := &proto.PostEnterSceneRsp{
|
||||
EnterSceneToken: req.EnterSceneToken,
|
||||
}
|
||||
@@ -1714,8 +1740,14 @@ func (g *Game) PacketPlayerEnterSceneNotifyLogin(player *model.Player) *proto.Pl
|
||||
}
|
||||
scene := world.GetSceneById(player.GetSceneId())
|
||||
enterSceneToken := world.AddEnterSceneContext(&EnterSceneContext{
|
||||
OldSceneId: 0,
|
||||
Uid: player.PlayerId,
|
||||
OldSceneId: 0,
|
||||
OldPos: nil,
|
||||
NewSceneId: player.GetSceneId(),
|
||||
NewPos: player.GetPos(),
|
||||
NewRot: player.GetRot(),
|
||||
DungeonId: 0,
|
||||
DungeonPointId: 0,
|
||||
Uid: player.PlayerId,
|
||||
})
|
||||
pos := player.GetPos()
|
||||
playerEnterSceneNotify := &proto.PlayerEnterSceneNotify{
|
||||
@@ -1732,11 +1764,14 @@ func (g *Game) PacketPlayerEnterSceneNotifyLogin(player *model.Player) *proto.Pl
|
||||
SceneTagIdList: make([]uint32, 0),
|
||||
}
|
||||
playerEnterSceneNotify.SceneTransaction = strconv.Itoa(int(player.GetSceneId())) + "-" + g.NewTransaction(player.PlayerId)
|
||||
// TODO 暂时先解锁全部场景标签 看着喜庆
|
||||
for _, sceneTagDataConfig := range gdconf.GetSceneTagDataMap() {
|
||||
if uint32(sceneTagDataConfig.SceneId) == player.GetSceneId() {
|
||||
playerEnterSceneNotify.SceneTagIdList = append(playerEnterSceneNotify.SceneTagIdList, uint32(sceneTagDataConfig.SceneTagId))
|
||||
}
|
||||
dbWorld := player.GetDbWorld()
|
||||
dbScene := dbWorld.GetSceneById(player.GetSceneId())
|
||||
if dbScene == nil {
|
||||
logger.Error("db scene is nil, sceneId: %v, uid: %v", player.GetSceneId(), player.PlayerId)
|
||||
return new(proto.PlayerEnterSceneNotify)
|
||||
}
|
||||
for _, sceneTag := range dbScene.GetSceneTagList() {
|
||||
playerEnterSceneNotify.SceneTagIdList = append(playerEnterSceneNotify.SceneTagIdList, sceneTag)
|
||||
}
|
||||
return playerEnterSceneNotify
|
||||
}
|
||||
@@ -1794,11 +1829,14 @@ func (g *Game) PacketPlayerEnterSceneNotifyCore(
|
||||
SceneTagIdList: make([]uint32, 0),
|
||||
}
|
||||
playerEnterSceneNotify.SceneTransaction = strconv.Itoa(int(sceneId)) + "-" + g.NewTransaction(player.PlayerId)
|
||||
// TODO 暂时先解锁全部场景标签 看着喜庆
|
||||
for _, sceneTagDataConfig := range gdconf.GetSceneTagDataMap() {
|
||||
if uint32(sceneTagDataConfig.SceneId) == sceneId {
|
||||
playerEnterSceneNotify.SceneTagIdList = append(playerEnterSceneNotify.SceneTagIdList, uint32(sceneTagDataConfig.SceneTagId))
|
||||
}
|
||||
dbWorld := player.GetDbWorld()
|
||||
dbScene := dbWorld.GetSceneById(player.GetSceneId())
|
||||
if dbScene == nil {
|
||||
logger.Error("db scene is nil, sceneId: %v, uid: %v", player.GetSceneId(), player.PlayerId)
|
||||
return new(proto.PlayerEnterSceneNotify)
|
||||
}
|
||||
for _, sceneTag := range dbScene.GetSceneTagList() {
|
||||
playerEnterSceneNotify.SceneTagIdList = append(playerEnterSceneNotify.SceneTagIdList, sceneTag)
|
||||
}
|
||||
return playerEnterSceneNotify
|
||||
}
|
||||
|
||||
+38
-9
@@ -22,6 +22,7 @@ import (
|
||||
// SceneTransToPointReq 场景传送到传送点请求
|
||||
func (g *Game) SceneTransToPointReq(player *model.Player, payloadMsg pb.Message) {
|
||||
req := payloadMsg.(*proto.SceneTransToPointReq)
|
||||
|
||||
if player.SceneLoadState != model.SceneEnterDone {
|
||||
g.SendError(cmd.SceneTransToPointRsp, player, &proto.SceneTransToPointRsp{}, proto.Retcode_RET_IN_TRANSFER)
|
||||
return
|
||||
@@ -121,6 +122,7 @@ func (g *Game) GetScenePointReq(player *model.Player, payloadMsg pb.Message) {
|
||||
// MarkMapReq 地图标点请求
|
||||
func (g *Game) MarkMapReq(player *model.Player, payloadMsg pb.Message) {
|
||||
req := payloadMsg.(*proto.MarkMapReq)
|
||||
|
||||
world := WORLD_MANAGER.GetWorldById(player.WorldId)
|
||||
if world == nil {
|
||||
return
|
||||
@@ -270,6 +272,7 @@ func (g *Game) EnterWorldAreaReq(player *model.Player, payloadMsg pb.Message) {
|
||||
// ChangeGameTimeReq 修改游戏时间请求
|
||||
func (g *Game) ChangeGameTimeReq(player *model.Player, payloadMsg pb.Message) {
|
||||
req := payloadMsg.(*proto.ChangeGameTimeReq)
|
||||
|
||||
gameTime := req.GameTime
|
||||
world := WORLD_MANAGER.GetWorldById(player.WorldId)
|
||||
if world == nil {
|
||||
@@ -327,6 +330,7 @@ func (g *Game) DungeonEntryInfoReq(player *model.Player, payloadMsg pb.Message)
|
||||
// PlayerEnterDungeonReq 玩家进入秘境请求
|
||||
func (g *Game) PlayerEnterDungeonReq(player *model.Player, payloadMsg pb.Message) {
|
||||
req := payloadMsg.(*proto.PlayerEnterDungeonReq)
|
||||
|
||||
dungeonDataConfig := gdconf.GetDungeonDataById(int32(req.DungeonId))
|
||||
if dungeonDataConfig == nil {
|
||||
logger.Error("get dungeon data config is nil, dungeonId: %v, uid: %v", req.DungeonId, player.PlayerId)
|
||||
@@ -358,6 +362,7 @@ func (g *Game) PlayerEnterDungeonReq(player *model.Player, payloadMsg pb.Message
|
||||
// PlayerQuitDungeonReq 玩家离开秘境请求
|
||||
func (g *Game) PlayerQuitDungeonReq(player *model.Player, payloadMsg pb.Message) {
|
||||
req := payloadMsg.(*proto.PlayerQuitDungeonReq)
|
||||
|
||||
world := WORLD_MANAGER.GetWorldById(player.WorldId)
|
||||
if world == nil {
|
||||
logger.Error("get world is nil, worldId: %v, uid: %v", player.WorldId, player.PlayerId)
|
||||
@@ -367,7 +372,7 @@ func (g *Game) PlayerQuitDungeonReq(player *model.Player, payloadMsg pb.Message)
|
||||
if ctx == nil {
|
||||
return
|
||||
}
|
||||
pointDataConfig := gdconf.GetScenePointBySceneIdAndPointId(int32(ctx.OldSceneId), int32(ctx.OldDungeonPointId))
|
||||
pointDataConfig := gdconf.GetScenePointBySceneIdAndPointId(int32(ctx.OldSceneId), int32(ctx.DungeonPointId))
|
||||
if pointDataConfig == nil {
|
||||
return
|
||||
}
|
||||
@@ -556,7 +561,6 @@ func (g *Game) SetWidgetSlotReq(player *model.Player, payloadMsg pb.Message) {
|
||||
}
|
||||
}
|
||||
dbWorld := player.GetDbWorld()
|
||||
|
||||
for _, tag := range tagList {
|
||||
widget, exist := dbWorld.WidgetSlotMap[tag]
|
||||
if !exist {
|
||||
@@ -637,6 +641,30 @@ func (g *Game) WidgetDoBagReq(player *model.Player, payloadMsg pb.Message) {
|
||||
})
|
||||
}
|
||||
|
||||
func (g *Game) PersonalSceneJumpReq(player *model.Player, payloadMsg pb.Message) {
|
||||
req := payloadMsg.(*proto.PersonalSceneJumpReq)
|
||||
|
||||
pointDataConfig := gdconf.GetScenePointBySceneIdAndPointId(int32(player.GetSceneId()), int32(req.PointId))
|
||||
if pointDataConfig == nil {
|
||||
return
|
||||
}
|
||||
destSceneId := uint32(pointDataConfig.TranSceneId)
|
||||
g.TeleportPlayer(
|
||||
player,
|
||||
proto.EnterReason_ENTER_REASON_TRANS_POINT,
|
||||
destSceneId,
|
||||
&model.Vector{X: pointDataConfig.TranPos.X, Y: pointDataConfig.TranPos.Y, Z: pointDataConfig.TranPos.Z},
|
||||
&model.Vector{X: pointDataConfig.TranRot.X, Y: pointDataConfig.TranRot.Y, Z: pointDataConfig.TranRot.Z},
|
||||
0,
|
||||
0,
|
||||
)
|
||||
|
||||
g.SendMsg(cmd.PersonalSceneJumpRsp, player.PlayerId, player.ClientSeq, &proto.PersonalSceneJumpRsp{
|
||||
DestSceneId: destSceneId,
|
||||
DestPos: &proto.Vector{X: float32(pointDataConfig.TranPos.X), Y: float32(pointDataConfig.TranPos.Y), Z: float32(pointDataConfig.TranPos.Z)},
|
||||
})
|
||||
}
|
||||
|
||||
/************************************************** 游戏功能 **************************************************/
|
||||
|
||||
// UnlockPlayerScenePoint 解锁场景锚点
|
||||
@@ -916,13 +944,14 @@ func (g *Game) TeleportPlayer(
|
||||
player.SceneEnterReason = uint32(enterReason)
|
||||
|
||||
enterSceneToken := world.AddEnterSceneContext(&EnterSceneContext{
|
||||
OldSceneId: oldSceneId,
|
||||
OldPos: oldPos,
|
||||
NewSceneId: newSceneId,
|
||||
NewPos: newPos,
|
||||
NewRot: newRot,
|
||||
OldDungeonPointId: dungeonPointId,
|
||||
Uid: player.PlayerId,
|
||||
OldSceneId: oldSceneId,
|
||||
OldPos: oldPos,
|
||||
NewSceneId: newSceneId,
|
||||
NewPos: newPos,
|
||||
NewRot: newRot,
|
||||
DungeonId: dungeonId,
|
||||
DungeonPointId: dungeonPointId,
|
||||
Uid: player.PlayerId,
|
||||
})
|
||||
|
||||
playerEnterSceneNotify := g.PacketPlayerEnterSceneNotifyTp(player, enterType, newSceneId, newPos, dungeonId, enterSceneToken)
|
||||
|
||||
@@ -152,6 +152,66 @@ func (q *DbQuest) CheckQuestFinish(questId uint32) {
|
||||
break
|
||||
}
|
||||
}
|
||||
case constant.QUEST_LOGIC_TYPE_A_AND_ETCOR:
|
||||
if len(resultList) < 2 {
|
||||
finish = false
|
||||
break
|
||||
}
|
||||
finishA := resultList[0]
|
||||
finishEtc := false
|
||||
for _, result := range resultList[1:] {
|
||||
if result {
|
||||
finishEtc = true
|
||||
break
|
||||
}
|
||||
}
|
||||
finish = finishA && finishEtc
|
||||
case constant.QUEST_LOGIC_TYPE_A_AND_B_AND_ETCOR:
|
||||
if len(resultList) < 3 {
|
||||
finish = false
|
||||
break
|
||||
}
|
||||
finishA := resultList[0]
|
||||
finishB := resultList[1]
|
||||
finishEtc := false
|
||||
for _, result := range resultList[2:] {
|
||||
if result {
|
||||
finishEtc = true
|
||||
break
|
||||
}
|
||||
}
|
||||
finish = finishA && finishB && finishEtc
|
||||
case constant.QUEST_LOGIC_TYPE_A_OR_ETCAND:
|
||||
if len(resultList) < 2 {
|
||||
finish = false
|
||||
break
|
||||
}
|
||||
finishA := resultList[0]
|
||||
finishEtc := true
|
||||
for _, result := range resultList[1:] {
|
||||
if !result {
|
||||
finishEtc = false
|
||||
break
|
||||
}
|
||||
}
|
||||
finish = finishA || finishEtc
|
||||
case constant.QUEST_LOGIC_TYPE_A_OR_B_OR_ETCAND:
|
||||
if len(resultList) < 3 {
|
||||
finish = false
|
||||
break
|
||||
}
|
||||
finishA := resultList[0]
|
||||
finishB := resultList[1]
|
||||
finishEtc := true
|
||||
for _, result := range resultList[2:] {
|
||||
if !result {
|
||||
finishEtc = false
|
||||
break
|
||||
}
|
||||
}
|
||||
finish = finishA || finishB || finishEtc
|
||||
default:
|
||||
logger.Error("not support quest finish cond logic type: %v, questId: %v", questDataConfig.FinishCondCompose, questId)
|
||||
}
|
||||
if finish {
|
||||
quest.State = constant.QUEST_STATE_FINISHED
|
||||
|
||||
@@ -16,6 +16,7 @@ type DbScene struct {
|
||||
UnlockPointMap map[uint32]bool
|
||||
UnHidePointMap map[uint32]bool
|
||||
UnlockAreaMap map[uint32]bool
|
||||
SceneTagMap map[uint32]bool
|
||||
}
|
||||
|
||||
type MapMark struct {
|
||||
@@ -71,6 +72,9 @@ func (w *DbWorld) GetSceneById(sceneId uint32) *DbScene {
|
||||
if scene.UnlockAreaMap == nil {
|
||||
scene.UnlockAreaMap = make(map[uint32]bool)
|
||||
}
|
||||
if scene.SceneTagMap == nil {
|
||||
scene.SceneTagMap = make(map[uint32]bool)
|
||||
}
|
||||
return scene
|
||||
}
|
||||
|
||||
@@ -133,3 +137,26 @@ func (s *DbScene) CheckAreaUnlock(areaId uint32) bool {
|
||||
_, exist := s.UnlockAreaMap[areaId]
|
||||
return exist
|
||||
}
|
||||
|
||||
func (s *DbScene) GetSceneTagList() []uint32 {
|
||||
sceneTagList := make([]uint32, 0, len(s.SceneTagMap))
|
||||
for sceneTag := range s.SceneTagMap {
|
||||
sceneTagList = append(sceneTagList, sceneTag)
|
||||
}
|
||||
return sceneTagList
|
||||
}
|
||||
|
||||
func (s *DbScene) AddSceneTag(sceneTag uint32) {
|
||||
sceneTagDataConfig := gdconf.GetSceneTagDataById(int32(sceneTag))
|
||||
if sceneTagDataConfig == nil {
|
||||
return
|
||||
}
|
||||
if uint32(sceneTagDataConfig.SceneId) != s.SceneId {
|
||||
return
|
||||
}
|
||||
s.SceneTagMap[sceneTag] = true
|
||||
}
|
||||
|
||||
func (s *DbScene) DelSceneTag(sceneTag uint32) {
|
||||
delete(s.SceneTagMap, sceneTag)
|
||||
}
|
||||
@@ -178,6 +178,8 @@ func (c *CmdProtoMap) registerMessage() {
|
||||
c.regMsg(AllWidgetDataNotify, func() any { return new(proto.AllWidgetDataNotify) }) // 小道具槽位数据通知
|
||||
c.regMsg(WidgetDoBagReq, func() any { return new(proto.WidgetDoBagReq) }) // 小道具下包请求
|
||||
c.regMsg(WidgetDoBagRsp, func() any { return new(proto.WidgetDoBagRsp) }) // 小道具下包响应
|
||||
c.regMsg(PersonalSceneJumpReq, func() any { return new(proto.PersonalSceneJumpReq) }) // 场景跳转请求
|
||||
c.regMsg(PersonalSceneJumpRsp, func() any { return new(proto.PersonalSceneJumpRsp) }) // 场景跳转响应
|
||||
|
||||
// 战斗与同步
|
||||
c.regMsg(AvatarFightPropNotify, func() any { return new(proto.AvatarFightPropNotify) }) // 角色战斗属性通知
|
||||
|
||||
Reference in new issue
Block a user