| | |
| | | import FBHelpBattle
|
| | | import SkillShell
|
| | | import PyGameData
|
| | | import PetControl
|
| | | import NPCCommon
|
| | |
|
| | | import time
|
| | |
| | |
|
| | | def DoEnterCustomScene(curPlayer, mapID, lineID, tick):
|
| | | ## 进入自定义场景状态
|
| | | |
| | | resultPack = ChPyNetSendPack.tagMCStartCustomSceneResult()
|
| | | resultPack.MapID = mapID
|
| | | resultPack.FuncLineID = lineID
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.Log("玩家请求进入自定义场景!mapID=%s,lineID=%s" % (mapID, lineID), playerID)
|
| | | if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
|
| | | curMapID = PlayerControl.GetCustomMapID(curPlayer)
|
| | | curLineID = PlayerControl.GetCustomLineID(curPlayer)
|
| | | if mapID == curMapID and lineID == curLineID:
|
| | | GameWorld.Log(" 玩家当前已经在自定义场景中!无需重新请求!", playerID)
|
| | | result = 1
|
| | | else:
|
| | | GameWorld.Log(" 玩家当前在不同的自定义场景中!不允许进入!curMapID=%s,curLineID=%s" |
| | | % (curMapID, curLineID), playerID)
|
| | | result = 0
|
| | | StartCustomSceneResult(curPlayer, mapID, lineID, result)
|
| | | return
|
| | |
|
| | | #进入副本通用检查
|
| | | if mapID:
|
| | | fbIpyData = FBCommon.GetFBIpyData(mapID)
|
| | | fbLineIpyData = FBCommon.GetFBLineIpyData(mapID, lineID)
|
| | | if PlayerControl.CheckMoveToFB(curPlayer, mapID, lineID, fbIpyData, fbLineIpyData, tick) != ShareDefine.EntFBAskRet_OK:
|
| | | resultPack.Result = 0
|
| | | NetPackCommon.SendFakePack(curPlayer, resultPack)
|
| | | StartCustomSceneResult(curPlayer, mapID, lineID, 0)
|
| | | return
|
| | |
|
| | | curPlayer.SetCanAttack(False)
|
| | | curPlayer.SetVisible(False)
|
| | | curPlayer.SetSight(0)
|
| | | curPet = curPlayer.GetPetMgr().GetFightPet()
|
| | | if curPet:
|
| | | curPet.SetVisible(False)
|
| | | PlayerControl.SetPlayerSightLevel(curPlayer, curPlayer.GetID())
|
| | |
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 1) # 由于前端不一定有发mapID,所以这里额外记录这个状态,不能直接用mapID判断
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomSceneMapID, mapID)
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomSceneLineID, lineID)
|
| | | GameWorld.Log("玩家开始自定义场景!mapID=%s,lineID=%s" % (mapID, lineID), curPlayer.GetPlayerID())
|
| | | PlayerControl.SetCustomMap(curPlayer, mapID, lineID)
|
| | | NPCCommon.ClearPriWoodPile(curPlayer)
|
| | | GameWorld.Log("玩家开始自定义场景!mapID=%s,lineID=%s" % (mapID, lineID), playerID)
|
| | | if mapID:
|
| | | PetControl.DoLogic_PetLoadMapOK(curPlayer)
|
| | | FBLogic.OnEnterCustomScene(curPlayer, mapID, lineID)
|
| | |
|
| | | #通知进入状态
|
| | | resultPack.Result = 1
|
| | | StartCustomSceneResult(curPlayer, mapID, lineID, 1)
|
| | | return
|
| | |
|
| | | def StartCustomSceneResult(curPlayer, mapID, lineID, result):
|
| | | if result != 1:
|
| | | DoExitCustomScene(curPlayer)
|
| | | resultPack = ChPyNetSendPack.tagMCStartCustomSceneResult()
|
| | | resultPack.MapID = mapID
|
| | | resultPack.FuncLineID = lineID
|
| | | resultPack.Result = result
|
| | | NetPackCommon.SendFakePack(curPlayer, resultPack)
|
| | | return
|
| | |
|
| | | def DoExitCustomScene(curPlayer):
|
| | | ## 退出自定义场景状态
|
| | | curPlayer.SetCanAttack(True)
|
| | | curPlayer.SetVisible(True)
|
| | | curPlayer.SetSight(0)
|
| | | curPlayer.RefreshView()
|
| | | curPlayer.SetSight(ChConfig.Def_PlayerSight_Default)
|
| | | curPlayer.RefreshView()
|
| | | curPet = curPlayer.GetPetMgr().GetFightPet()
|
| | | if curPet:
|
| | | curPet.SetVisible(True)
|
| | | mapID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneMapID)
|
| | | lineID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneLineID)
|
| | | PlayerControl.SetPlayerSightLevel(curPlayer, 0)
|
| | | mapID = PlayerControl.GetCustomMapID(curPlayer)
|
| | | lineID = PlayerControl.GetCustomLineID(curPlayer)
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 0)
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomSceneMapID, 0)
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomSceneLineID, 0)
|
| | | if mapID and curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_CustomSceneStartTime % (mapID, lineID)) == ChConfig.CustomSceneState_Over:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_CustomSceneStartTime % (mapID, lineID), ChConfig.CustomSceneState_None)
|
| | | PlayerControl.SetCustomMap(curPlayer, 0, 0)
|
| | | if mapID and FBCommon.GetCustomMapStep(curPlayer, mapID, lineID) != ChConfig.CustomMapStep_Over:
|
| | | FBCommon.SetCustomMapStep(curPlayer, mapID, lineID, ChConfig.CustomMapStep_Over)
|
| | | NPCCommon.ClearPriWoodPile(curPlayer)
|
| | | GameWorld.Log("玩家退出自定义场景!", curPlayer.GetPlayerID())
|
| | | return
|