#!/usr/bin/python # -*- coding: GBK -*- #------------------------------------------------------------------------------- # #------------------------------------------------------------------------------- # ##@package GameWorldLogic.FBProcess.GameLogic_MunekadoTrial # # @todo:×ÚÃÅÊÔÁ¶ # @author xdh # @date 2017-11-29 11:00 # @version 1.0 # # # ÏêϸÃèÊö: ×ÚÃÅÊÔÁ¶ # #--------------------------------------------------------------------- #"""Version = 2017-11-29 11:00""" #--------------------------------------------------------------------- import FBCommon import IPY_GameWorld import GameWorldProcess import GameWorld import ShareDefine import NPCCustomRefresh import ItemControler import ChConfig import PlayerSuccess import IpyGameDataPY import PlayerControl import ItemCommon import EventReport import PyGameData import EventShell import NPCCommon import FBHelpBattle import PlayerActLogin import math ( Def_PrepareTime, # ×¼±¸Ê±¼ä, Ãë Def_FightTime, # ¸±±¾Ê±¼ä, Ãë Def_PickItemTime, # ʰȡʱ¼ä, Ãë Def_ExitTime, # Í˳öʱ¼ä, Ãë ) = range(4) # ¸±±¾×´Ì¬ ( FB_Step_CallHelp, # ÖúÕ½ÕÙ»½ FB_Step_Prepare, #×¼±¸ÖÐ FB_Step_Fight, # Õ½¶·ÖÐ FB_Step_PickItem, # ʰȡÎïÆ·ÖÐ FB_Step_Over, # ½áÊøµÈ´ý FB_Step_Close, # ¹Ø±ÕÖÐ ) = range(6) #ZMSL_GameStep = "ZMSL_GameStep" # µ±Ç°¹Ø¿¨ ZMSL_FBNextRefreshStep = 'ZMSL_FBNextRefreshStep' # Ë¢¹Ö½×¶ÎÊý ZMSL_FBNPCCnt = 'ZMSL_FBNPCCnt' # ¸±±¾Ê£Óà¹ÖÎïÊý ZMSL_FBNPCNeedRefreshCnt = 'ZMSL_FBNPCNeedRefreshCnt' # »¹ÐèˢеĹÖÎïÊý ZMSL_FBNPCRefreshCnt = 'ZMSL_FBNPCRefreshCnt' # µ±ÂÖˢеĹÖÎïÊý ZMSL_FBStepStartTick = 'ZMSL_FBStepStartTick' # ½×¶Î¿ªÊ¼µÄʱ¼ä ZMSL_FBStepStar = 'ZMSL_FBStepStar' # ¸±±¾½×¶Î½áÊøÊ±ÐǼ¶ ZMSL_CostTime = 'ZMSL_CostTime' # ¹ý¹ØºÄʱ ## OnDay´¦Àí # @param curPlayer # @return None def OnFBPlayerOnDay(curPlayer): curPlayerMapID = FBCommon.GetRecordMapID(curPlayer.GetMapID()) if curPlayerMapID == ChConfig.Def_FBMapID_MunekadoTrial: GameWorld.DebugLog("ZMSLOnDay curPlayerMapID=%s,SetDict IsInFBOnDay 1" % curPlayerMapID) curPlayer.SetDict(ChConfig.Def_PlayerKey_IsInFBOnDay, 1) return ##---»ñµÃ¸±±¾Ë¢¹ÖÅäÖÃ--- # @param None # @return ÅäÖÃÐÅÏ¢ def __GetZMSLnpcCfg(lineID, mapID=0): if not mapID: mapID = GameWorld.GetMap().GetMapID() return FBCommon.GetFBLineRefreshNPC(mapID, lineID) def GetMTFBLineStepTime(lineID=-1): mapID = GameWorld.GetMap().GetMapID() if lineID == -1: lineID=FBCommon.GetFBPropertyMark() return FBCommon.GetFBLineStepTime(mapID, lineID) ##¿ªÆô¸±±¾ # @param tick ʱ¼ä´Á # @return ·µ»ØÖµÎÞÒâÒå # @remarks ¿ªÆô¸±±¾ def OnOpenFB(tick): return ##¹Ø±Õ¸±±¾ # @param tick ʱ¼ä´Á # @return ÎÞÒâÒå # @remarks def OnCloseFB(tick): return ## ÊÇ·ñÄܹ»Í¨¹ý»î¶¯²éѯ½øÈë # @param curPlayer Íæ¼ÒʵÀý # @param mapID µØÍ¼ID # @param lineID Ïß·id # @param tick ʱ¼ä´Á # @return ²¼¶ûÖµ def OnEnterFBEvent(curPlayer, mapID, lineID, tick): if lineID != 0: historyStar = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID-1, False, [mapID]) needStar = IpyGameDataPY.GetFuncCfg('MunekadoLockLimit') if historyStar < needStar: GameWorld.DebugLog(' ÉÏÒ»²ãÆÀ¼¶Î´´ïµ½%s£¬ÎÞ·¨ÌôÕ½±¾²ã£¡' % needStar) return False return True ##¸±±¾Íæ¼Ò½øÈëµã # @param curPlayer Íæ¼ÒʵÀý # @param mapID µØÍ¼ID # @param lineId ·ÖÏßID # @param tick ʱ¼ä´Á # @return ×ø±êÁбí(X,Y) # @remarks ¸±±¾Íæ¼Ò½øÈëµã def OnGetFBEnterPos(curPlayer, mapID, lineId, ipyEnterPosInfo, tick): return ipyEnterPosInfo ##ÊÇ·ñ¿ÉÒÔ½øÈë # @param ask ÇëÇó½á¹¹Ìå # @param tick ʱ¼ä´Á # @return TChangeMapError # @remarks ÑéÖ¤¼Ò×åÊÇ·ñÔÚ½ñÌìµÄ¼Ò×åÕ½±í def OnChangeMapAsk(ask, tick): return IPY_GameWorld.cmeAccept ##Íæ¼Ò½øÈ븱±¾ # @param curPlayer Íæ¼ÒʵÀý # @param tick ʱ¼ä´Á # @return ÎÞÒâÒå # @remarks Íæ¼Ò½øÈ븱±¾ def DoEnterFB(curPlayer, tick): mapID = GameWorld.GetGameWorld().GetMapID() mapID = FBCommon.GetRecordMapID(mapID) gameFB = GameWorld.GetGameFB() # ÉèÖø±±¾¹«¹²ÊôÐԵĵ¥¶À´¦Àí£¬·ÀÖ¹¶ÓÔ±½øÈëºó±»ÐÞ¸Ä if not FBCommon.GetHadSetFBPropertyMark(): lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBFuncLine) FBCommon.SetFBPropertyMark(lineID) # if gameFB.GetFBStep() == FB_Step_Open: # FBCommon.SetFBStep(FB_Step_Prepare, tick) # gameFB.SetGameFBDict(ZMSL_FBNextRefreshStep, 0) # gameFB.SetGameFBDict(ZMSL_FBNPCCnt, 0) # gameFB.SetGameFBDict(ZMSL_FBNPCRefreshCnt, 0) lineID = FBCommon.GetFBPropertyMark() GameWorld.DebugLog("ZMSL DoEnterFB lineID=%s£¡" % lineID, curPlayer.GetID()) # ½øÈëÏûºÄ´¦Àí if not FBCommon.GetHadDelTicket(curPlayer): FBCommon.SetHadDelTicket(curPlayer) PyGameData.g_fbPickUpItemDict.pop(curPlayer.GetPlayerID(), 0) curPlayer.SetDict(ChConfig.Def_PlayerKey_IsInFBOnDay, 0) # isHelpFight = False # if FBCommon.SetIsHelpFight(curPlayer): # isHelpFight = True # GameWorld.DebugLog("ZMSL ÖúÕ½½øÈ븱±¾£¡", curPlayer.GetID()) # joinType = FBCommon.GetFBJoinType(curPlayer, isHelpFight) # EventReport.WriteEvent_FB(curPlayer, mapID, lineID, ChConfig.CME_Log_Start, joinType) if gameFB.GetFBStep() == FB_Step_CallHelp: FBHelpBattle.SendGameServer_RefreshHelpBattlePlayer(curPlayer, mapID, lineID) return ZMSLCfg = GetMTFBLineStepTime() fbStep = gameFB.GetFBStep() if fbStep <= FB_Step_Prepare: notify_tick = ZMSLCfg[Def_PrepareTime] * 1000 - (tick - GameWorld.GetGameFB().GetFBStepTick()) curPlayer.Sync_TimeTick(IPY_GameWorld.tttAddUpTime, 0, max(notify_tick, 0), True) curPlayer.Sync_TimeTick(IPY_GameWorld.tttWaitStart, 0, max(notify_tick, 0), True) elif fbStep == FB_Step_Fight: notify_tick = ZMSLCfg[Def_FightTime] * 1000 - (tick - GameWorld.GetGameFB().GetFBStepTick()) curPlayer.Sync_TimeTick(IPY_GameWorld.tttTowerTake, 0, max(notify_tick, 0), True) __UpdZMSLFBStar(tick, True, curPlayer) DoFBHelp(curPlayer, tick) return ## ÕÙ»½ÖúÕ½Íê³É def OnCallHelpBattleOK(curPlayer, tick): ZMSLCfg = GetMTFBLineStepTime() FBCommon.SetFBStep(FB_Step_Prepare, tick) notify_tick = ZMSLCfg[Def_PrepareTime] * 1000 - (tick - GameWorld.GetGameFB().GetFBStepTick()) curPlayer.Sync_TimeTick(IPY_GameWorld.tttWaitStart, 0, max(notify_tick, 0), True) lineID = FBCommon.GetFBPropertyMark() EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_MunekadoTrial, lineID, ChConfig.CME_Log_Start) return ## Ë¢¹Ö # @return: True-ÒÑͨ¹Ø def __RefreshZMSLNextNPC(tick): gameFB = GameWorld.GetGameFB() npcCnt = gameFB.GetGameFBDictByKey(ZMSL_FBNPCCnt) needRefreshCnt = gameFB.GetGameFBDictByKey(ZMSL_FBNPCNeedRefreshCnt) # »¹ÓÐ¹Ö or »¹Ã»Ë¢Í꣬²»Ö´ÐÐÏÂÒ»²¨Ë¢Ð if npcCnt > 0 or needRefreshCnt > 0: return refreshStep = gameFB.GetGameFBDictByKey(ZMSL_FBNextRefreshStep) lineID = FBCommon.GetFBPropertyMark() refreshNPCList, rMarkList = __GetZMSLnpcCfg(lineID) if refreshStep >= len(refreshNPCList) or refreshStep >= len(rMarkList): # ÒÑÊÇ×îºóÒ»²¨, ͨ¹Ø GameWorld.DebugLog("ÒÑÊÇ×îºóÒ»²¨, ͨ¹Ø") return True rMark = rMarkList[refreshStep] rNPCList = refreshNPCList[refreshStep] needRefreshCnt = 0 for rNPCInfo in rNPCList: needRefreshCnt += rNPCInfo[1] gameFB.SetGameFBDict(ZMSL_FBNPCRefreshCnt, needRefreshCnt) gameFB.SetGameFBDict(ZMSL_FBNPCNeedRefreshCnt, needRefreshCnt) NPCCustomRefresh.SetNPCRefresh(rMark, rNPCList, needRefreshCnt, needRefreshCnt) # ¸üÐÂÏÂÒ»²¨½×¶ÎÖµ gameFB.SetGameFBDict(ZMSL_FBNextRefreshStep, refreshStep + 1) gameFB.SetGameFBDict(ZMSL_FBStepStartTick, tick) gameFB.SetGameFBDict(ZMSL_FBStepStar, gameFB.GetGameFBDictByKey(ChConfig.Def_FB_Grade)) return ##Íæ¼ÒÍ˳ö¸±±¾. # @param curPlayer Íæ¼ÒʵÀý # @param tick ʱ¼ä´Á # @return ·µ»ØÖµÎÞÒâÒå def DoExitFB(curPlayer, tick): GameWorld.DebugLog("ZMSL DoExitFB...", curPlayer.GetPlayerID()) if GameWorld.GetMapCopyPlayerManager().GetPlayerCount() == 1: GameWorld.DebugLog("¸±±¾ÖÐֻʣÏÂÒ»¸öÈË£¬¹Ø±Õ¸±±¾!") gameFB = GameWorld.GetGameFB() gameFB.SetIsSafeClose(1) return ##Íæ¼ÒÖ÷¶¯À뿪¸±±¾. # @param curPlayer Íæ¼ÒʵÀý # @param tick ʱ¼ä´Á # @return ·µ»ØÖµÎÞÒâÒå def DoPlayerLeaveFB(curPlayer, tick): GameWorld.DebugLog("ZMSL DoPlayerLeaveFB...", curPlayer.GetPlayerID()) return ##Íæ¼Ò¸±±¾¸´»î # @param curPlayer Íæ¼ÒʵÀý # @param rebornType # @param tick ʱ¼ä´Á # @return ·µ»ØÖµÎÞÒâÒå def OnPlayerReborn(): return True ## »ñÈ¡È볡Я´øÐÅÏ¢ # @param curPlayer # @param lineId ·ÖÏß # @return ×Ö·ûÐÍ ½øÈëÐéÄâ·ÖÏßID def GetPlayerResetWorldPosFBMsg(curPlayer, lineId): return "" ##¸±±¾¶¨Ê±Æ÷ # @param tick ʱ¼ä´Á # @return ·µ»ØÖµÎÞÒâÒå # @remarks ¸±±¾¶¨Ê±Æ÷ def OnProcess(tick): fbStep = GameWorld.GetGameFB().GetFBStep() # ¸±±¾×¼±¸ if fbStep == FB_Step_Prepare: __DoLogic_FB_Prepare(tick) elif fbStep == FB_Step_Fight: __UpdZMSLFBStar(tick) __ProcessOverFight(tick) elif fbStep == FB_Step_PickItem: __DoLogic_FB_PickItem(tick) elif fbStep == FB_Step_Over: __ProcessCloseFB(tick) return ## ¸±±¾×¼±¸Âß¼­ # @param tick:ʱ¼ä´Á # @return ÎÞÒâÒå def __DoLogic_FB_Prepare(tick): #gameFB = GameWorld.GetGameFB() fbCfg = GetMTFBLineStepTime() # ¼ä¸ôδµ½ if tick - GameWorld.GetGameFB().GetFBStepTick() < fbCfg[Def_PrepareTime] * 1000: return __RefreshZMSLNextNPC(tick) playerManager = GameWorld.GetMapCopyPlayerManager() for i in range(playerManager.GetPlayerCount()): curPlayer = playerManager.GetPlayerByIndex(i) if not curPlayer: continue DoFBHelp(curPlayer, tick) FBCommon.SetFBStep(FB_Step_Fight, tick) FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttTowerTake, fbCfg[Def_FightTime] * 1000) return ## ɱ¹Ö½áÊø # @param tick # @return None def __ProcessOverFight(tick): FightTime = GetMTFBLineStepTime()[Def_FightTime] openTick = GameWorld.GetGameWorld().GetOpenFBTick() if max(0, FightTime * 1000 - (tick - openTick)) > 0: return __DoZMSLOver(False, tick) return ## ¸±±¾Ê°È¡ # @param tick:ʱ¼ä´Á # @return ÎÞÒâÒå def __DoLogic_FB_PickItem(tick): # ¼ä¸ôδµ½ if tick - GameWorld.GetGameFB().GetFBStepTick() < GetMTFBLineStepTime()[Def_PickItemTime] * 1000: return FBCommon.SetFBStep(FB_Step_Over, tick) return ## ¸±±¾¹Ø±Õ # @param tick # @return None def __ProcessCloseFB(tick): gameFB = GameWorld.GetGameFB() if tick - gameFB.GetFBStepTick() < GetMTFBLineStepTime()[Def_ExitTime] * 1000: return FBCommon.DoLogic_FBKickAllPlayer() GameWorldProcess.CloseFB(tick) FBCommon.SetFBStep(FB_Step_Close, tick) return def GetCanDropPlayerList(): dropPlayerList = [] playerManager = GameWorld.GetMapCopyPlayerManager() for index in xrange(playerManager.GetPlayerCount()): curPlayer = playerManager.GetPlayerByIndex(index) if not curPlayer: continue if FBCommon.GetIsHelpFight(curPlayer): continue dropPlayerList.append(curPlayer) return dropPlayerList def __DoZMSLOver(isPass, tick, killNPCID=0): # Õ½¶·³¬Ê± costTime = tick - GameWorld.GetGameFB().GetFBStepTick() gameFB = GameWorld.GetGameFB() gameFB.SetGameFBDict(ZMSL_CostTime, costTime) star = GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade) GameWorld.DebugLog("__DoZMSLOver isPass=%s,killNPCID=%s,star=%s" % (isPass, killNPCID, star)) #=============================================================================================== # canDropPlayerList = GetCanDropPlayerList() # if isPass and canDropPlayerList: # FBCommon.SetFBStep(FB_Step_PickItem, tick) # leaveTime = GetMTFBLineStepTime()[Def_PickItemTime] * 1000 # else: # FBCommon.SetFBStep(FB_Step_Over, tick) # leaveTime = GetMTFBLineStepTime()[Def_ExitTime] * 1000 #=============================================================================================== FBCommon.SetFBStep(FB_Step_Over, tick) leaveTime = GetMTFBLineStepTime()[Def_ExitTime] * 1000 mapID = GameWorld.GetMap().GetMapID() mapID = FBCommon.GetRecordMapID(mapID) lineID = FBCommon.GetFBPropertyMark() #awardDict = FBCommon.GetFBLineReward(mapID, lineID) #prizeItemList = awardDict.get(star, []) overDict = {FBCommon.Over_grade:star,FBCommon.Over_dataMapID:mapID,FBCommon.Over_isPass:int(isPass), FBCommon.Over_costTime:costTime} playerManager = GameWorld.GetMapCopyPlayerManager() playerCount = playerManager.GetPlayerCount() for index in xrange(playerCount): curPlayer = playerManager.GetPlayerByIndex(index) if not curPlayer: continue curPlayer.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, leaveTime, True) if not isPass: FBCommon.Notify_FB_Over(curPlayer, overDict) continue if lineID+1 > curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBHistoryMaxLine % mapID): PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FBHistoryMaxLine % mapID, lineID+1) needSyncFBData = False #¸üÐÂÀúÊ·ÆÀ¼¶ historyStar = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, False, [mapID]) if star > historyStar: GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, star, False, [mapID]) needSyncFBData = True isInFBOnDay = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_IsInFBOnDay) if star == 5: EventReport.WriteEvent_FB(curPlayer, mapID, lineID, ChConfig.CME_Log_End, 0, 1) EventShell.EventRespons_FBEvent(curPlayer, "zmsl_%s_%s" % (lineID, star)) PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_MunekadoTrial, 1, [playerCount, star, lineID+1]) EventShell.EventRespons_FBEvent(curPlayer, "passzmsl") # Èç¹ûÔÚ¸±±¾ÖйýÌ죬ÔòÖ»¸øÎïÆ·½±Àø£¬²»±ä¸ü¹ý¹ØÐÅÏ¢ if not isInFBOnDay: FBCommon.AddEnterFBCount(curPlayer, mapID, 1) needSyncFBData = False else: curPlayer.SetDict(ChConfig.Def_PlayerKey_IsInFBOnDay, 0) FBHelpBattle.DoFBHelpBattleFinish(curPlayer, mapID, lineID) PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_MunekadoTrialEx, 1) PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_MunekadoTrial, 1) #======================================================================================= # #¸ø½±Àø # needSpace = len(prizeItemList) # emptySpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace) # isSendMail = int(needSpace > emptySpace) # ÊÇ·ñ·¢ËÍÓʼþ # if isSendMail: # PlayerControl.SendMailByKey("", [curPlayer.GetPlayerID()], prizeItemList) # GameWorld.DebugLog("±³°ü¿Õ¼ä²»¹»£¬·¢ËÍÓʼþ: mailItemList=%s" % str(prizeItemList), curPlayer.GetPlayerID()) # else: # for itemID, itemCnt, isBind in prizeItemList: # ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem], event=["MunekadoTrial", False, {}]) #overDict[FBCommon.Over_itemInfo] = FBCommon.GetJsonItemList(prizeItemList) #======================================================================================= jsonItemList, totalExp, totalMoney = NPCCommon.GiveKillNPCDropPrize(curPlayer, ChConfig.Def_FBMapID_MunekadoTrial, {killNPCID:1}) # ֪ͨ½á¹û overDict[FBCommon.Over_itemInfo] = jsonItemList if needSyncFBData: FBCommon.Sync_FBPlayerFBInfoData(curPlayer, mapID) # if not canDropPlayerList: # FBCommon.Notify_FB_Over(curPlayer, overDict) GameWorld.DebugLog(' overDict=%s'%overDict, curPlayer.GetID()) FBCommon.Notify_FB_Over(curPlayer, overDict) return ## ¿É·ñɨµ´ def OnPlayerFBSweepAsk(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx): if mapID != ChConfig.Def_FBMapID_MunekadoTrial: return # ÔÝдËÀ£¬Ç°Á½²ã²»ÄÜɨ #if lineID < 2: # GameWorld.DebugLog("ǰÁ½²ã²»ÄÜɨµ´!") # return historyStar = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, False, [mapID]) if historyStar < 5: GameWorld.DebugLog("ûÓÐS¼¶²»ÄÜɨµ´!") return return True ## Öúսɨµ´½á¹û def OnPlayerFBHelpBattleSweepResult(curPlayer, mapID, lineID, helpBattlePlayerDict): #¿ÛÃÅÆ±ÒªÔÚ¹«¹²Âß¼­ÖÐÍê³É refreshNPCList = __GetZMSLnpcCfg(lineID, mapID)[0] if not refreshNPCList: return lastNPCList = refreshNPCList[-1] if not lastNPCList: return killNPCID = lastNPCList[0][0] # ĬÈÏ×îºóÒ»²¨µÄNPCIDΪͨ¹Øboss½±ÀøID GameWorld.DebugLog("ɨµ´×ÚÃÅÊÔÁ¶: killNPCID=%s,helpBattlePlayerDict=%s" % (killNPCID, helpBattlePlayerDict)) star = 5 EventReport.WriteEvent_FB(curPlayer, mapID, lineID, ChConfig.CME_Log_End, 0, 1) EventShell.EventRespons_FBEvent(curPlayer, "zmsl_%s_%s" % (lineID, star)) EventShell.EventRespons_FBEvent(curPlayer, "passzmsl") PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_MunekadoTrialEx, 1) PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_MunekadoTrial, 1, [1, star, lineID+1]) PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_MunekadoTrial, 1) jsonItemList, totalExp, totalMoney = NPCCommon.GiveKillNPCDropPrize(curPlayer, ChConfig.Def_FBMapID_MunekadoTrial, {killNPCID:1}, curGrade=star) # ֪ͨ½á¹û overDict = {FBCommon.Over_grade:star,FBCommon.Over_dataMapID:mapID,FBCommon.Over_isPass:1, FBCommon.Over_isSweep:1} overDict[FBCommon.Over_helpPlayer] = helpBattlePlayerDict overDict[FBCommon.Over_itemInfo] = jsonItemList GameWorld.DebugLog("×ÚÃÅɨµ´½á¹û: overDict=%s" % overDict) FBCommon.Notify_FB_Over(curPlayer, overDict) return True ## ¼ì²éÊÇ·ñ¿É¹¥»÷£¬ Ö÷Åж¨²»¿É¹¥»÷µÄÇé¿ö£¬ÆäËûÂß¼­ÓÉÍâ²ã¾ö¶¨ # @param attacker ¹¥»÷·½ # @param defender ·ÀÊØ·½ # @return bool def CheckCanAttackTagObjInFB(attacker, defender): gameFB = GameWorld.GetGameFB() if gameFB.GetFBStep() != FB_Step_Fight: return False return True ##¸±±¾ÓÐNPCÕÙ³ö # @param curNPC: # @param tick:tick # @return None def DoFBRebornNPC(curNPC, tick): if curNPC.GetNPCID() not in __GetAllNPCIDList(): return gameFB = GameWorld.GetGameFB() npcCnt = gameFB.GetGameFBDictByKey(ZMSL_FBNPCCnt) needRefreshCnt = gameFB.GetGameFBDictByKey(ZMSL_FBNPCNeedRefreshCnt) npcCnt += 1 needRefreshCnt -= 1 gameFB.SetGameFBDict(ZMSL_FBNPCCnt, npcCnt) gameFB.SetGameFBDict(ZMSL_FBNPCNeedRefreshCnt, needRefreshCnt) GameWorld.DebugLog("DoFBRebornNPC, npcID=%s,ZMSL_FBNPCCnt=%s,needRefreshCnt=%s" % (curNPC.GetNPCID(), npcCnt, needRefreshCnt)) if needRefreshCnt <= 0: GameWorld.DebugLog("±¾²¨¹ÖÎïË¢ÐÂÍê±Ï£¡npcCnt=%s" % npcCnt) return def __GetAllNPCIDList(): lineID = FBCommon.GetFBPropertyMark() refreshNPCList = __GetZMSLnpcCfg(lineID)[0] npcIDList = [] for rList in refreshNPCList: for npcid, npccnt in rList: npcIDList.append(npcid) return npcIDList def DoFB_Npc_KillNPC(attacker, curNPC, tick): __FBNPCOnKilled(curNPC, tick) return ##Íæ¼ÒɱËÀNPC # @param curPlayer:Íæ¼ÒʵÀý # @param curNPC:µ±Ç°±»É±ËÀµÄNPC # @param tick:ʱ¼ä´Á # @return ·µ»ØÖµÎÞÒâÒå # @remarks Íæ¼ÒÖ÷¶¯À뿪¸±±¾. def DoFB_Player_KillNPC(curPlayer, curNPC, tick): __FBNPCOnKilled(curNPC, tick) return def __FBNPCOnKilled(curNPC, tick): if curNPC.GetNPCID() not in __GetAllNPCIDList(): return gameFB = GameWorld.GetGameFB() npcCnt = gameFB.GetGameFBDictByKey(ZMSL_FBNPCCnt) needRefreshCnt = gameFB.GetGameFBDictByKey(ZMSL_FBNPCNeedRefreshCnt) npcCnt -= 1 gameFB.SetGameFBDict(ZMSL_FBNPCCnt, npcCnt) GameWorld.DebugLog("DoFB_Player_KillNPC, npcID=%s,ZMSL_FBNPCCnt=%s,needRefreshCnt=%s" % (curNPC.GetNPCID(), npcCnt, needRefreshCnt)) if npcCnt <= 0 and needRefreshCnt <= 0: GameWorld.DebugLog("±¾²¨ËùÓйÖÎïÒѱ»»÷ɱ£¡") isAllKilled = __RefreshZMSLNextNPC(tick) if isAllKilled: __DoZMSLOver(True, tick, curNPC.GetNPCID()) FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0) return def OnPickUpItem(curPlayer, curItem, tick): mapItemType = curItem.GetType() if mapItemType != ChConfig.Def_ItemType_Money: playerID = curPlayer.GetID() isEquip = ItemCommon.CheckItemIsEquip(curItem) jsonItem = ItemCommon.GetJsonItem(curItem) if playerID in PyGameData.g_fbPickUpItemDict: if isEquip: PyGameData.g_fbPickUpItemDict[playerID].append(jsonItem) else: isIn = False for itemInfo in PyGameData.g_fbPickUpItemDict[playerID]: if itemInfo["ItemID"] == jsonItem["ItemID"] and itemInfo.get("IsBind") == jsonItem.get("IsBind"): itemInfo["Count"] = itemInfo.get("Count", 1)+ jsonItem.get("Count", 1) isIn = True break if not isIn: PyGameData.g_fbPickUpItemDict[playerID].append(jsonItem) else: PyGameData.g_fbPickUpItemDict[playerID] = [jsonItem] isItemAllPickUp = (GameWorld.GetMapItemManager().GetMapItemCount() <= 1) if isItemAllPickUp and GameWorld.GetGameFB().GetFBStep() == FB_Step_PickItem: #__DoIceLodeOver(True) FBCommon.SetFBStep(FB_Step_Over, tick) leaveTime = GetMTFBLineStepTime()[Def_ExitTime] * 1000 mapID = GameWorld.GetMap().GetMapID() mapID = FBCommon.GetRecordMapID(mapID) gameFB = GameWorld.GetGameFB() star = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_Grade) costTime = gameFB.GetGameFBDictByKey(ZMSL_CostTime) playerManager = GameWorld.GetMapCopyPlayerManager() for index in xrange(playerManager.GetPlayerCount()): player = playerManager.GetPlayerByIndex(index) if not player: continue player.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, leaveTime, True) jsonItemList = PyGameData.g_fbPickUpItemDict.get(player.GetPlayerID(), []) overDict = {FBCommon.Over_grade:star,FBCommon.Over_dataMapID:mapID,FBCommon.Over_isPass:1, FBCommon.Over_costTime:costTime, FBCommon.Over_itemInfo:jsonItemList} GameWorld.DebugLog("PickItemOver: %s" % overDict, player.GetPlayerID()) FBCommon.Notify_FB_Over(player, overDict) return ## Íæ¼Ò¹¥»÷Íæ¼ÒÊÇ·ñÓгͷ£ # @param atkPlayer: ¹¥»÷·½ # @param defPlayer: ·ÀÊØ·½ # @return Íæ¼Ò¹¥»÷Íæ¼ÒÊÇ·ñÓгͷ£ def DoFBAttackHasPunish(atkPlayer, defPlayer): return True ## ¸üе±Ç°¸±±¾ÐǼ¶ def __UpdZMSLFBStar(tick, isEnter=False, curPlayer=None): lineID = FBCommon.GetFBPropertyMark() FBCommon.UpdateFBGrade(tick, FBCommon.GetFBLineGrade(GameWorld.GetGameWorld().GetMapID(), lineID), curPlayer) return #1-D 2-C 3-B 4-A 5-S # gameFB = GameWorld.GetGameFB() # curStar = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_Grade) # if curStar == 1: # return curStar # stepStartTick = gameFB.GetGameFBDictByKey(ZMSL_FBStepStartTick) # if not stepStartTick: # return curStar # useSecond = int(math.ceil((tick - stepStartTick) / 1000.0)) # lineID = FBCommon.GetFBPropertyMark() # starTimeList = IpyGameDataPY.GetFuncEvalCfg('MunekadoTrialStarTime').get(lineID,[]) # wheelNum = gameFB.GetGameFBDictByKey(ZMSL_FBNextRefreshStep) # if wheelNum > len(starTimeList): # GameWorld.DebugLog(" MunekadoTrialStarTime ÅäÖôíÎó Ó벨Êý²»µÈ") # return # stepStar = gameFB.GetGameFBDictByKey(ZMSL_FBStepStar) # starTimeInfo = starTimeList[wheelNum-1] # updStar = stepStar if stepStar else 5 # totalStarTime = 0 # for starTime in starTimeInfo: # if updStar == 1: # break # totalStarTime +=starTime # if useSecond >= totalStarTime: # updStar = max(1, updStar-1) # else: # break # # diffSecond =max(0, totalStarTime -useSecond) # # if curStar == updStar and not isEnter: # return curStar # # gameFB.SetGameFBDict(ChConfig.Def_FB_Grade, updStar) # # GameWorld.DebugLog("__UpdFBStar useSecond=%s,curStar=%s,updStar=%s, diffSecond=%s" # % (useSecond, curStar, updStar, diffSecond)) # # if curPlayer: # DoFBHelp(curPlayer, tick) # if updStar != 1: # curPlayer.Sync_TimeTick(IPY_GameWorld.tttFlagTake, 0, diffSecond * 1000, True) # else: # playerManager = GameWorld.GetMapCopyPlayerManager() # for index in xrange(playerManager.GetPlayerCount()): # curPlayer = playerManager.GetPlayerByIndex(index) # if not curPlayer: # continue # DoFBHelp(curPlayer, tick) # if updStar != 1: # curPlayer.Sync_TimeTick(IPY_GameWorld.tttFlagTake, 0, diffSecond * 1000, True) # # # return updStar ##¸±±¾°ïÖúÐÅÏ¢ # @param curPlayer Íæ¼ÒʵÀý # @param tick ʱ¼ä´Á # @return ÎÞÒâÒå # @remarks ÓÃÓÚ֪ͨÕóÓª±È·ÖÌõ def DoFBHelp(curPlayer, tick): gameFB = GameWorld.GetGameFB() star = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_Grade) wheelNum = gameFB.GetGameFBDictByKey(ZMSL_FBNextRefreshStep) needKillCnt = gameFB.GetGameFBDictByKey(ZMSL_FBNPCRefreshCnt) remainNPCCnt = gameFB.GetGameFBDictByKey(ZMSL_FBNPCCnt) KillNPCCnt = max(0, needKillCnt - remainNPCCnt) data = [KillNPCCnt, needKillCnt] lineID = FBCommon.GetFBPropertyMark() fbHelpDict = {FBCommon.Help_step:wheelNum, FBCommon.Help_grade:star, FBCommon.Help_npcTotal:KillNPCCnt, FBCommon.Help_lineID:lineID} FBCommon.Notify_FBHelp(curPlayer, fbHelpDict) return ## ¸±±¾ÐÐΪ # @param curPlayer Íæ¼Ò # @param actionType ÐÐΪÀàÐÍ # @param actionInfo ÐÐΪÐÅÏ¢ # @param tick µ±Ç°Ê±¼ä # @return None def DoFBAction(curPlayer, actionType, actionInfo, tick): return ## ÖØÖø±±¾¸´»îÍæ¼Ò×ø±êµã # @param None # @return ÎÞÒâÒå def OnResetFBRebornPlacePos(curPlayer, rebornPlace, tick): lineID = FBCommon.GetFBPropertyMark() ipyEnterPosInfo = FBCommon.GetFBLineEnterPosInfo(ChConfig.Def_FBMapID_MunekadoTrial, lineID) posX, posY = ipyEnterPosInfo[:2] curPlayer.ResetPos(posX, posY) return #// A3 2F ×ÚÃÅÊÔÁ¶¶Ò»» #tagCMTrialExchange # #struct tagCMTrialExchange #{ # tagHead Head; # DWORD ID; //¶Ò»»ID #}; def OnTrialExange(playerIndex, clientData, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(playerIndex) exchangeID = clientData.ID ipyData = IpyGameDataPY.GetIpyGameData("TrialExchange", exchangeID) if not ipyData: return playerID = curPlayer.GetPlayerID() exchangeItemIDList = ipyData.GetExchangeItemIDList() if not exchangeItemIDList: return if len(exchangeItemIDList) > 1: jobIndex = curPlayer.GetJob() - 1 if jobIndex < 0 or jobIndex >= len(exchangeItemIDList): return exchangeItemID = exchangeItemIDList[jobIndex] else: exchangeItemID = exchangeItemIDList[0] exchangeItemCount = ipyData.GetExchangeItemCount() exchangeItemIsBind = ipyData.GetExchangeItemIsBind() costItemID = ipyData.GetCostItemID() costItemCount = ipyData.GetCostItemCount() if not exchangeItemID or not exchangeItemCount or not costItemID or not costItemCount: return if not ItemCommon.CheckPackHasSpace(curPlayer, IPY_GameWorld.rptItem, True): return costItemDict = {costItemID:costItemCount} itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem) lackItemDict, delInfoDict = ItemCommon.GetCostItemIndexList(costItemDict, itemPack) if lackItemDict: GameWorld.DebugLog("¶Ò»»ÏûºÄÎïÆ·²»×㣡exchangeID=%s,costItemID=%s,costItemCount=%s,lackItemDict=%s" % (exchangeID, costItemID, costItemCount, lackItemDict), playerID) return #¿ÛÏûºÄ ItemCommon.DelCostItem(curPlayer, itemPack, delInfoDict) #¸øÎïÆ· ItemControler.GivePlayerItem(curPlayer, exchangeItemID, exchangeItemCount, 0, [IPY_GameWorld.rptItem], event=[ChConfig.ItemGive_TrialExchange, False, {}]) #ÈÎÎñ EventShell.EventRespons_TrialExchange(curPlayer, costItemID) GameWorld.DebugLog("×ÚÃŶһ»³É¹¦£¡exchangeID=%s,costItemID=%s,costItemCount=%s,delInfoDict=%s" % (exchangeID, costItemID, costItemCount, delInfoDict), playerID) return