| | |
| | | import FBLogic
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import PlayerSuccess
|
| | | import ItemCommon
|
| | | import IpyGameDataPY
|
| | | import ShareDefine
|
| | | import GameFuncComm
|
| | | import FBHelpBattle
|
| | | import ItemControler
|
| | | import SkillShell
|
| | | import PyGameData
|
| | |
|
| | | import time
|
| | | import math
|
| | | #---------------------------------------------------------------------
|
| | | def OnLogin(curPlayer):
|
| | | NotifyBuyFBBuffInfo(curPlayer)
|
| | | return
|
| | |
|
| | | ## 玩家副本行为封包 A5 08
|
| | | # @param playerIndex 玩家索引
|
| | |
| | | # BYTE Cnt; // 扫荡次数
|
| | | # BYTE IsFinish; // 是否立即完成; 0-否;1-花钱立即完成;2-客户端自行倒计时间到后发送2代表领取扫荡完成奖励
|
| | | # DWORD DataEx; //附带信息
|
| | | # BYTE IsLittleHelper; // 是否小助手扫荡
|
| | | #};
|
| | | ## 玩家副本扫荡
|
| | | # @param playerIndex 玩家索引 |
| | | # @param clientData 客户端封包 |
| | | # @param tick 时间
|
| | | # @return None
|
| | | def OnPlayerFBWipeOut(playerIndex, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(playerIndex)
|
| | |
|
| | |
| | | #isFinish = clientData.IsFinish
|
| | | isFinish = 1 # 暂时默认1,之后有需要扫荡等待的再说
|
| | | dataEx = clientData.DataEx
|
| | | isLittleHelper = clientData.IsLittleHelper
|
| | | if isLittleHelper:
|
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_LittleHelper):
|
| | | GameWorld.DebugLog("玩家没有小助手功能权限!", curPlayer.GetPlayerID())
|
| | | return
|
| | |
|
| | | if FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID()) == FBCommon.GetRecordMapID(mapID):
|
| | | GameWorld.DebugLog("玩家在扫荡目标地图中,无法扫荡!mapID=%s" % mapID)
|
| | | if cnt <= 0:
|
| | | return
|
| | |
|
| | | fbIpyData = FBCommon.GetFBIpyData(mapID)
|
| | | if FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID()) == FBCommon.GetRecordMapID(mapID):
|
| | | if fbIpyData and fbIpyData.GetDayTimes():#没有限制进入次数的不限制在目标地图扫荡
|
| | | GameWorld.DebugLog("玩家在扫荡目标地图中,无法扫荡!mapID=%s" % mapID)
|
| | | return
|
| | | |
| | | |
| | | fbLineIpyData = FBCommon.GetFBLineIpyData(mapID, lineID)
|
| | | if not fbLineIpyData:
|
| | | GameWorld.DebugLog("找不到该副本线路,无法扫荡!mapID=%s, lineID=%s" % (mapID, lineID))
|
| | | return
|
| | | |
| | | if FBCommon.CheckCanEnterFBComm(curPlayer, mapID, lineID, fbIpyData, fbLineIpyData, cnt) != ShareDefine.EntFBAskRet_OK:
|
| | | return
|
| | | costMoneyList = []
|
| | |
| | | % (mapID, lineID, curPlayer.GetLV(), sweepLVLimit), curPlayer.GetPlayerID())
|
| | | return
|
| | |
|
| | | #扫荡道具判断
|
| | | #扫荡道具判断,小助手不消耗扫荡道具
|
| | | sweepItemID = fbLineIpyData.GetSweepItemID()
|
| | | if sweepItemID:
|
| | | if sweepItemID and not isLittleHelper:
|
| | | sweepItemCnt = fbLineIpyData.GetSweepCostCnt()
|
| | | sweepCostCnt = sweepItemCnt * cnt
|
| | | #isEnough, sweepCostindexList = ItemCommon.GetItem_FromPack_ByID(sweepItemID, itemPack, sweepCostCnt)
|
| | |
| | | if not FBLogic.OnPlayerFBSweepAsk(curPlayer, mapID, lineID, cnt, isFinish, dataEx):
|
| | | return
|
| | |
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_FeastRedPack_FBSweep, 1, [mapID])
|
| | | |
| | | #扣除扫荡道具
|
| | | if sweepCostindexList and sweepCostCnt:
|
| | | ItemCommon.ReduceItem(curPlayer, itemPack, sweepCostindexList, sweepCostCnt, False, 'FBSweepCostItem')
|
| | |
| | | #增加副本进入次数
|
| | | if fbIpyData and fbIpyData.GetDayTimes():
|
| | | FBCommon.AddEnterFBCount(curPlayer, mapID, cnt)
|
| | | |
| | | |
| | | helpIpyData = IpyGameDataPY.GetIpyGameData("FBHelpBattle", mapID, lineID)
|
| | | if helpIpyData:
|
| | | FBHelpBattle.SendGameServer_SweepCallHelpBattlePlayer(curPlayer, mapID, lineID)
|
| | | return
|
| | | |
| | | #扫荡结果给奖励等
|
| | | FBLogic.OnPlayerFBSweepResult(curPlayer, mapID, lineID, cnt, isFinish, dataEx)
|
| | | return
|
| | |
| | | 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
|
| | | #{
|
| | | # tagHead Head;
|
| | | # DWORD MapID;
|
| | | # WORD MoneyCnt;
|
| | | #};
|
| | | def OnFBBuyBuff(playerIndex, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(playerIndex)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | mapID = clientData.MapID
|
| | | moneyCnt = clientData.MoneyCnt
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('FBBuyBuff', mapID, moneyCnt)
|
| | | if not ipyData:
|
| | | return
|
| | | addBuffID = ipyData.GetBuffID()
|
| | | curSkill = GameWorld.GetGameData().GetSkillBySkillID(addBuffID)
|
| | | if not curSkill:
|
| | | return
|
| | | crossMapID = PlayerControl.GetCrossMapID(curPlayer)
|
| | | if crossMapID and mapID !=crossMapID:
|
| | | return
|
| | | if not crossMapID and mapID != GameWorld.GetMap().GetMapID():
|
| | | return
|
| | | |
| | | curTime = int(time.time())
|
| | | #判断CD |
| | | timeKey = (mapID, moneyCnt)
|
| | | lastTime = PyGameData.g_fbBuyBuffTimeDict.get(playerID, {}).get(timeKey, 0)
|
| | | if lastTime and curTime - lastTime < ipyData.GetBuffCD():
|
| | | GameWorld.DebugLog('副本购买buff CD未到 ')
|
| | | return
|
| | |
|
| | | #扣钱
|
| | | infoDict = {"MapID":mapID, "addBuffID":addBuffID}
|
| | | if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, moneyCnt, ChConfig.Def_Cost_FBBuyBuff, infoDict):
|
| | | return
|
| | | if playerID not in PyGameData.g_fbBuyBuffTimeDict:
|
| | | PyGameData.g_fbBuyBuffTimeDict[playerID] = {}
|
| | | PyGameData.g_fbBuyBuffTimeDict[playerID][timeKey] = curTime
|
| | | NotifyBuyFBBuffInfo(curPlayer)
|
| | | if crossMapID:
|
| | | msgDict = {"PlayerID":curPlayer.GetPlayerID(), "buffID":addBuffID}
|
| | | GameWorld.SendMsgToCrossServer(ShareDefine.ClientServerMsg_AddBuff, msgDict)
|
| | | GameWorld.DebugLog("跨服中请求复活, crossMapID=%s,msgDict=%s" % (crossMapID, msgDict), playerID)
|
| | | return
|
| | |
|
| | | SkillShell.__DoLogic_AddBuff(curPlayer, curPlayer, curSkill, False, tick, 0, 0)
|
| | | #SkillCommon.AddBuffBySkillType(curPlayer, addBuffID, tick)
|
| | | return
|
| | |
|
| | | def NotifyBuyFBBuffInfo(curPlayer):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | buffTimeDict = PyGameData.g_fbBuyBuffTimeDict.get(playerID, {})
|
| | | if not buffTimeDict:
|
| | | return
|
| | | packData = ChPyNetSendPack.tagMCFBBuyBuffInfo()
|
| | | packData.InfoList = []
|
| | | for timeKey, buyTime in buffTimeDict.items():
|
| | | mapID, moneyCnt = timeKey
|
| | | timeInfo = ChPyNetSendPack.tagMCFBBuyBuffTime()
|
| | | timeInfo.MapID = mapID
|
| | | timeInfo.MoneyCnt = moneyCnt
|
| | | timeInfo.BuyTime = buyTime
|
| | | packData.InfoList.append(timeInfo)
|
| | | packData.Cnt = len(packData.InfoList)
|
| | | NetPackCommon.SendFakePack(curPlayer, packData)
|
| | | return
|