| | |
| | | import ShareDefine
|
| | | import GameFuncComm
|
| | | import FBHelpBattle
|
| | | import ItemControler
|
| | | import SkillShell
|
| | | import PyGameData
|
| | | import PetControl
|
| | | import NPCCommon
|
| | |
|
| | | import time
|
| | | import math
|
| | |
| | |
|
| | | 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)
|
| | |
|
| | | #默认回满血
|
| | | if curPlayer.GetHP() < curPlayer.GetMaxHP():
|
| | | curPlayer.SetHP(curPlayer.GetMaxHP())
|
| | | |
| | | #通知进入状态
|
| | | 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)
|
| | | 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)
|
| | | 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
|
| | |
|
| | | #// B1 08 刷新自定义副本奖励 #tagCMRefreshCustomFBPrize
|
| | | #
|
| | | #struct tagCMRefreshCustomFBPrize
|
| | | #{
|
| | | # tagHead Head;
|
| | | # DWORD MapID;
|
| | | # WORD FuncLineID;
|
| | | #};
|
| | | def OnRefreshCustomFBPrize(playerIndex, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(playerIndex)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | mapID = clientData.MapID
|
| | | funcLineID = clientData.FuncLineID
|
| | | prizeItemList = FBLogic.OnRefreshCustomFBPrize(curPlayer, mapID, funcLineID)
|
| | | PyGameData.g_customFBPrizeInfo[playerID] = prizeItemList
|
| | | prizePack = ChPyNetSendPack.tagMCCuntomFBPrizeInfo()
|
| | | prizePack.MapID = mapID
|
| | | prizePack.FuncLineID = funcLineID
|
| | | prizePack.PrizeItemIDList = [prizeItemInfo[0] for prizeItemInfo in prizeItemList]
|
| | | prizePack.PrizeItemCount = len(prizePack.PrizeItemIDList)
|
| | | NetPackCommon.SendFakePack(curPlayer, prizePack)
|
| | | return
|
| | |
|
| | |
|
| | | #// B1 09 结算自定义副本奖励 #tagCMGiveCustomFBPrize
|
| | | #
|
| | | #struct tagCMGiveCustomFBPrize
|
| | | #{
|
| | | # tagHead Head;
|
| | | # DWORD MapID;
|
| | | # WORD FuncLineID;
|
| | | #};
|
| | | def OnGiveCustomFBPrize(playerIndex, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(playerIndex)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | mapID = clientData.MapID
|
| | | lineID = clientData.FuncLineID
|
| | | prizeItemList = PyGameData.g_customFBPrizeInfo.pop(playerID, [])
|
| | | |
| | | mailItemList = []
|
| | | jsonItemList = []
|
| | | playerItemControl = ItemControler.PlayerItemControler(curPlayer)
|
| | | for itemID, itemCount, isAuctionItem in prizeItemList:
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer)
|
| | | if not curItem:
|
| | | continue
|
| | | jsonItem = ItemCommon.GetJsonItem(curItem)
|
| | | jsonItemList.append(jsonItem)
|
| | | #放入玩家背包
|
| | | if not playerItemControl.PutInItem(IPY_GameWorld.rptItem, curItem):
|
| | | mailItemList.append(jsonItem)
|
| | | |
| | | if mailItemList:
|
| | | PlayerControl.SendMailByKey("ItemNoPickUp", [playerID], mailItemList, [mapID])
|
| | | |
| | | overDict = FBLogic.OnGiveCustomFBPrizeOK(curPlayer, mapID, lineID)
|
| | | isPass = 1
|
| | | overDict.update({FBCommon.Over_itemInfo:jsonItemList})
|
| | | FBCommon.NotifyFBOver(curPlayer, mapID, lineID, isPass, overDict)
|
| | | return
|
| | |
|
| | |
|
| | | #// B1 0A 副本购买buff #tagCMFBBuyBuff
|
| | | #struct tagCMFBBuyBuff
|