#!/usr/bin/python # -*- coding: GBK -*- #------------------------------------------------------------------------------- # ##@package GameWorldLogic.FBProcess.GameLogic_MagicWeapon # # @todo:·¨±¦¸±±¾ # @author xdh # @date 2017-09-12 # @version 1.0 # # ÏêϸÃèÊö: ·¨±¦¸±±¾ # #------------------------------------------------------------------------------- #"""Version = 2017-09-12 21:00""" #------------------------------------------------------------------------------- import FBCommon import GameWorld import IpyGameDataPY import IPY_GameWorld import GameWorldProcess import EventShell import NPCCustomRefresh import ChConfig import ShareDefine import PlayerSuccess import PlayerControl import EventReport import PlayerGoldGift import PlayerMagicWeapon import ChPlayer import GameObj #---¸±±¾ÅäÖöÔÓ¦keyÖµ--- ( Def_IsPointType, #ÊÇ·ñ»ý·ÖÀั±¾ Def_PrepareTime, # ¸±±¾×¼±¸Ê±¼ä(Ãë) Def_FightTime, # ½øÐÐʱ¼ä(Ãë) Def_LeaveTime, # Í˳öʱ¼ä(Ãë) ) = range(4) ( DL_RefreshMark, # Ë¢¹Ö±êʶµã DL_NPCID, # NPCID DL_SingleNPCCnt, # µ¥´ÎË¢NPC¸öÊý DL_maxCnt, #µ±Ç°µã×î´ó¹ÖÎïÊý DL_TotalNPCCnt, # ÀÛ¼ÆË¢NPC×ܸöÊý DL_NeedKillCnt, # ÐèÒª»÷ɱÊýÁ¿ DL_RefreshCD, # ˢмä¸ô ) = range(7) #µ±Ç°¸±±¾µØÍ¼µÄ״̬ ( FB_Step_Open, # ¸±±¾¿ªÆô FB_Step_Prepare, # ¸±±¾µÈ´ý FB_Step_Fighting, # ¸±±¾½øÐÐÖÐ FB_Step_Over, # ¸±±¾½áÊø FB_Step_Close, # ¸±±¾¹Ø±Õ ) = range(5) FBPlayerDict_MissionID = 'FBPlayerDict_MissionID' #¸±±¾ÈÎÎñID FBPlayerDict_CostTime = 'FBPlayerDict_CostTime' #¸±±¾ºÄʱ FBPlayerDict_TotalPoint = 'FBPlayerDict_TotalPoint' # »ñµÃµÄ×Ü»ý·Ö FBPlayerDict_NPCRemainCnt = 'FBPlayerDict_NPCRemainCnt_%s' # NPCÊ£ÓàÊýÁ¿ FBPlayerDict_TotalExp = 'FBPlayerDict_TotalExp' # »ñµÃµÄ×ܾ­Ñé FBPlayerDict_TotalExpPoint = 'FBPlayerDict_TotalExpPoint' # »ñµÃµÄ×ܾ­Ñéµã FBPlayerDict_Level = 'FBPlayerDict_Level' #¹Ø¿¨ FBPlayerDict_MaxLevel = 'FBPlayerDict_MaxLevel' #×î´ó¹Ø¿¨ ##---»ñµÃ¸±±¾ÅäÖÃ--- # @param None # @return ÅäÖÃÐÅÏ¢ def GetClearDevilTimeCfg(lineID=None): if lineID == None: lineID = FBCommon.GetFBPropertyMark() mapID = GameWorld.GetMap().GetMapID() return FBCommon.GetFBLineStepTime(mapID, lineID) def GetClearDevilNPCCfg(lineID): level = GameWorld.GetGameFB().GetGameFBDictByKey(FBPlayerDict_Level) if level: ipyData = IpyGameDataPY.GetIpyGameDataByCondition('MagicWeaponFB', {'LineID':lineID, 'Level':level}) if not ipyData: return [] return ipyData.GetRefreshNPC() mapID = GameWorld.GetMap().GetMapID() return FBCommon.GetFBLineRefreshNPC(mapID, lineID) def GetPointByNPCID(npcid): '''ͨ¹ýNPCID»ñÈ¡¶ÔÓ¦µÄ»ý·Ö''' npcPointDict = IpyGameDataPY.GetFuncEvalCfg('ClearDevilPoint', 2) return npcPointDict.get(npcid, 0) def GetIsPointFBType(lineID): #ÊÇ·ñ»ý·ÖÀั±¾ FBLineStepTimeCfg = GetClearDevilTimeCfg(lineID) if not FBLineStepTimeCfg: return return FBLineStepTimeCfg[Def_IsPointType] ## ÊÇ·ñÄܹ»Í¨¹ý»î¶¯²éѯ½øÈë # @param curPlayer Íæ¼ÒʵÀý # @param mapID µØÍ¼ID # @param lineID Ïß·id # @param tick ʱ¼ä´Á # @return ²¼¶ûÖµ def OnEnterFBEvent(curPlayer, mapID, lineID, tick): return True ##¸±±¾Íæ¼Ò½øÈëµã # @param curPlayer Íæ¼ÒʵÀý # @param mapID µØÍ¼ID # @param lineId ·ÖÏßID # @param ipyEnterPosInfo ¹¦ÄÜÏß·IPYÅäÖÃ×ø±êÐÅÏ¢ # @param tick ʱ¼ä´Á # @return posX, posY, Ëæ»ú°ë¾¶(¿ÉÑ¡) def OnGetFBEnterPos(curPlayer, mapID, lineId, ipyEnterPosInfo, tick): return ipyEnterPosInfo ##²éѯÊÇ·ñ¿ÉÒÔ½øÈëµØÍ¼ # @param ask:ÇëÇó½á¹¹Ìå(IPY_BMChangeMapAsk) # @param tick:ʱ¼ä´Á # @return IPY_GameWorld.cme ö¾Ù def OnChangeMapAsk(ask, tick): return IPY_GameWorld.cmeAccept ## ½ø¸±±¾ # @param curPlayer # @param tick # @return None def DoEnterFB(curPlayer, tick): playerID = curPlayer.GetPlayerID() playerLV = curPlayer.GetLV() mapID = GameWorld.GetMap().GetMapID() mapID = FBCommon.GetRecordMapID(mapID) gameFB = GameWorld.GetGameFB() lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBFuncLine) level, maxLevel = 0, 0 ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('MagicWeaponFB', {'LineID':lineID}, True, False) if ipyDataList: mwID = ipyDataList[0].GetMWID() level = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWFBPassLevel % mwID) maxLevel = ipyDataList[-1].GetLevel() if level >= maxLevel: GameWorld.Log('DoEnterFB ÒÑͨ¹Ø¸ÃÏß·×î´ó¹Ø¿¨£¡£¡ lineID=%s, maxLevel=%s' % (lineID, maxLevel)) PlayerControl.PlayerLeaveFB(curPlayer) return level +=1 GameWorld.DebugLog("DoEnterFB...lineID=%s,playerLV=%s, level=%s" % (lineID, playerLV, level), playerID) hadDelTicket = FBCommon.GetHadDelTicket(curPlayer) if not hadDelTicket: gameFB.SetGameFBDict(FBPlayerDict_Level, level) gameFB.SetGameFBDict(FBPlayerDict_MaxLevel, maxLevel) FBCommon.SetHadDelTicket(curPlayer) FBCommon.SetFBPropertyMark(lineID) EventReport.WriteEvent_FB(curPlayer, mapID, 0, ChConfig.CME_Log_Start) # if mapID == ChConfig.Def_FBMapID_ClearDevil2: # # ÐÂÊÖ¾çÇ鸱±¾ÖØÖÃËùÓм¼ÄÜCD # skillManager = curPlayer.GetSkillManager() # for i in range(0, skillManager.GetSkillCount()): # curSkill = skillManager.GetSkillByIndex(i) # if curSkill.GetRemainTime() != 0: # curSkill.SetRemainTime(0) # curSkill.Sync_Skill() fbMissionID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBMissionID) if fbMissionID: gameFB.SetGameFBDict(FBPlayerDict_MissionID, fbMissionID) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_ReqFBMissionID, 0) if not hadDelTicket \ and IpyGameDataPY.GetIpyGameDataByCondition("NPCShow", {"MapID":mapID, "LineID":lineID}, isLogNone=False) and level == maxLevel: GameWorld.DebugLog("·¨±¦ÌôÕ½¸Õ½øÈëʱ²»Ö±½Ó¿ªÊ¼£¬ÐèµÈǰ¶Ë֪ͨ¿ªÊ¼²Å¿ªÊ¼!", playerID) # µôÏßÖØÉÏÇ¿ÖÆ¿ªÊ¼ return fbStep = gameFB.GetFBStep() if fbStep < FB_Step_Prepare: FBCommon.SetFBStep(FB_Step_Prepare, tick) if fbStep <= FB_Step_Prepare: notify_tick = GetClearDevilTimeCfg(lineID)[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_Fighting: notify_tick = GetClearDevilTimeCfg(lineID)[Def_FightTime] * 1000 - (tick - GameWorld.GetGameFB().GetFBStepTick()) curPlayer.Sync_TimeTick(IPY_GameWorld.tttTowerTake, 0, max(notify_tick, 0), True) else: PlayerControl.PlayerLeaveFB(curPlayer) return DoFBHelp(curPlayer, tick, not hadDelTicket) return ## ¿Í»§¶Ë·¢ËÍ¿ªÊ¼¸±±¾ def OnClientStartFB(curPlayer, tick): gameFB = GameWorld.GetGameFB() fbStep = gameFB.GetFBStep() if fbStep >= FB_Step_Prepare: GameWorld.ErrLog("ǰ¶ËÇëÇóÕýʽ¿ªÊ¼¸±±¾, µ«¸±±¾ÒѾ­¿ªÊ¼ÁË£¬²»¿ÉÖØ¸´¿ªÊ¼!", curPlayer.GetPlayerID()) return lineID = FBCommon.GetFBPropertyMark() GameWorld.DebugLog("ǰ¶Ë³¡¾°ÐãÒѲ¥·ÅÍê±Ï£¬ÇëÇóÕýʽ¿ªÊ¼¸±±¾!lineID=%s" % lineID, curPlayer.GetPlayerID()) FBCommon.SetFBStep(FB_Step_Prepare, tick) notify_tick = GetClearDevilTimeCfg(lineID)[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) DoFBHelp(curPlayer, tick, True) return ##Íæ¼ÒÍ˳ö¸±±¾ # @param curPlayer Íæ¼ÒʵÀý # @param tick ʱ¼ä´Á # @return ÎÞÒâÒå def DoExitFB(curPlayer, tick): # ÐÂÊÖ±¾Íæ¼ÒÍ˳öĬÈϹرո±±¾ # mapID = FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID()) # if mapID == ChConfig.Def_FBMapID_ClearDevil2: # GameWorldProcess.CloseFB(tick) GameWorldProcess.CloseFB(tick) return ##Íæ¼ÒÖ÷¶¯À뿪¸±±¾. # @param curPlayer Íæ¼ÒʵÀý # @param tick ʱ¼ä´Á # @return ·µ»ØÖµÎÞÒâÒå def DoPlayerLeaveFB(curPlayer, tick): return ## »ñµÃ¸±±¾°ïÖúÐÅÏ¢ # @param curPlayer µ±Ç°Íæ¼Ò£¨±»Í¨Öª¶ÔÏó£© # @param tick µ±Ç°Ê±¼ä # @return None def DoFBHelp(curPlayer, tick, isEnter=False): gameFB = GameWorld.GetGameFB() # »ñµÃ¸±±¾ÐÅÏ¢ lineID = FBCommon.GetFBPropertyMark() if GetIsPointFBType(lineID): totalPoint = gameFB.GetGameFBDictByKey(FBPlayerDict_TotalPoint) helpDict = {FBCommon.Help_score:totalPoint} else: npcCfg = GetClearDevilNPCCfg(lineID) if not npcCfg: GameWorld.Log("ûÓиÃÏß·ˢ¹ÖÅäÖà lineID=%s" % lineID) return npcDict = {} for info in npcCfg: npcID = info[DL_NPCID] remainCnt = gameFB.GetGameFBDictByKey(FBPlayerDict_NPCRemainCnt % npcID) if isEnter: killCnt = 0 else: killCnt = info[DL_NeedKillCnt] - remainCnt npcDict[npcID] = killCnt helpDict = {FBCommon.Help_npc:FBCommon.GetJsonNPCKillList(npcDict)} #¸±±¾°ïÖú helpDict[FBCommon.Help_lineID] = FBCommon.GetFBPropertyMark() fbMissionID = gameFB.GetGameFBDictByKey(FBPlayerDict_MissionID) helpDict["missionID"] = fbMissionID GameWorld.DebugLog("DoFBHelp %s" % str(helpDict)) FBCommon.Notify_FBHelp(curPlayer, helpDict) 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_Fighting: __DoLogic_FB_Fighting(tick) # ¸±±¾½áÊø elif fbStep == FB_Step_Over: pass __DoLogic_FB_Over(tick) return ## ¸±±¾×¼±¸Âß¼­ # @param tick:ʱ¼ä´Á # @return ÎÞÒâÒå def __DoLogic_FB_Prepare(tick): #gameFB = GameWorld.GetGameFB() fbCfg = GetClearDevilTimeCfg() # ¼ä¸ôδµ½ if tick - GameWorld.GetGameFB().GetFBStepTick() < fbCfg[Def_PrepareTime] * 1000: return # ÉèÖÿªÊ¼Ë¢¹Ö lineID = FBCommon.GetFBPropertyMark() npcCfg = GetClearDevilNPCCfg(lineID) if not npcCfg: GameWorld.Log("ûÓиÃÏß·ˢ¹ÖÅäÖà lineID=%s" % lineID) return gameFB = GameWorld.GetGameFB() for npcInfo in npcCfg: npcID = npcInfo[DL_NPCID] gameFB.SetGameFBDict(FBPlayerDict_NPCRemainCnt % npcID, npcInfo[DL_NeedKillCnt]) refreshCD = npcInfo[DL_RefreshCD] NPCCustomRefresh.SetNPCRefresh(npcInfo[DL_RefreshMark], [(npcID, npcInfo[DL_SingleNPCCnt])], npcInfo[DL_maxCnt], npcInfo[DL_TotalNPCCnt], refreshTick=refreshCD) NPCCustomRefresh.ProcessAllNPCRefresh(tick) # Á¢¼´³ö·¢Ò»´Î±êʶµãˢРplayerManager = GameWorld.GetMapCopyPlayerManager() if playerManager.GetPlayerCount() > 0: curPlayer = playerManager.GetPlayerByIndex(0) if GameObj.GetHP(curPlayer) <=0: ChPlayer.PlayerRebornByType(curPlayer, ChConfig.rebornType_System, tick) else: GameObj.SetHP(curPlayer, GameObj.GetMaxHP(curPlayer)) DoFBHelp(curPlayer, tick) FBCommon.SetFBStep(FB_Step_Fighting, tick) FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttTowerTake, fbCfg[Def_FightTime] * 1000) return ## ¸±±¾½øÐÐÖÐ # @param tick:ʱ¼ä´Á # @return ÎÞÒâÒå def __DoLogic_FB_Fighting(tick): fbCfg = GetClearDevilTimeCfg() # ¼ä¸ôδµ½ if tick - GameWorld.GetGameFB().GetFBStepTick() < fbCfg[Def_FightTime] * 1000: return __DoClearDevilOver(False) return ##¸±±¾¹Ø±ÕÖÐ # @param tick:ʱ¼ä´Á # @return ÎÞÒâÒå # @remarks ¸±±¾¹Ø±ÕÖÐ def __DoLogic_FB_Over(tick): #gameFB = GameWorld.GetGameFB() fbCfg = GetClearDevilTimeCfg() # ¼ä¸ôδµ½ if tick - GameWorld.GetGameFB().GetFBStepTick() < fbCfg[Def_LeaveTime] * 1000: return #¸±±¾¹Ø±Õ #GameWorldProcess.CloseFB(tick) #FBCommon.SetFBStep(FB_Step_Close, tick) return ## »ñµÃ¾­Ñé # @param curPlayer µ±Ç°Íæ¼Ò # @param addExp »ñµÃµÄ¾­Ñé # @param expViewType ¾­ÑéÀàÐÍ # @return True or False def OnGetExp(curPlayer, addExp, expViewType): if expViewType != ShareDefine.Def_ViewExpType_KillNPC: return playerID = curPlayer.GetID() gameFB = GameWorld.GetGameFB() exp = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_TotalExp) expPoint = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_TotalExpPoint) totalExp = expPoint * ChConfig.Def_PerPointValue + exp updTotalExp = totalExp + addExp updExp = updTotalExp % ChConfig.Def_PerPointValue updExpPoint = updTotalExp / ChConfig.Def_PerPointValue gameFB.SetPlayerGameFBDict(playerID, FBPlayerDict_TotalExp, updExp) gameFB.SetPlayerGameFBDict(playerID, FBPlayerDict_TotalExpPoint, updExpPoint) GameWorld.DebugLog("OnGetExp() totalExp=%s,addExp=%s,updTotalExp=%s" % (totalExp, addExp, updTotalExp), playerID) return ## Ö´Ðи±±¾É±¹ÖÂß¼­ # @param curPlayer ɱ¹ÖµÄÈË # @param curNPC ±»É±µÄ¹Ö # @param tick µ±Ç°Ê±¼ä # @return None def DoFB_Player_KillNPC(curPlayer, curNPC, tick): gameFB = GameWorld.GetGameFB() fbStep = gameFB.GetFBStep() if fbStep != FB_Step_Fighting: return npcid = curNPC.GetNPCID() lineID = FBCommon.GetFBPropertyMark() isFinish = False #ÊÇ·ñÍê³É if GetIsPointFBType(lineID): #»ý·ÖÀà addPoint = GetPointByNPCID(npcid) if not addPoint: return totalPoint = gameFB.GetGameFBDictByKey(FBPlayerDict_TotalPoint) maxPoint = IpyGameDataPY.GetFuncCfg('ClearDevilPoint') updPoint = min(totalPoint + addPoint, maxPoint) gameFB.SetGameFBDict(FBPlayerDict_TotalPoint, updPoint) if updPoint >= maxPoint: isFinish = True else: remainCnt = gameFB.GetGameFBDictByKey(FBPlayerDict_NPCRemainCnt % npcid) gameFB.SetGameFBDict(FBPlayerDict_NPCRemainCnt % npcid, max(0, remainCnt - 1)) npcCfg = GetClearDevilNPCCfg(lineID) if not npcCfg: GameWorld.Log("ûÓиÃÏß·ˢ¹ÖÅäÖà lineID=%s" % lineID) return isFinish = True for npcInfo in npcCfg: npcID = npcInfo[DL_NPCID] remainCnt = gameFB.GetGameFBDictByKey(FBPlayerDict_NPCRemainCnt % npcID) if remainCnt: isFinish = False break if isFinish: __DoClearDevilOver(True) # ÈÎÎñ fbMissionID = gameFB.GetGameFBDictByKey(FBPlayerDict_MissionID) if fbMissionID: EventShell.EventRespons_FBEvent(curPlayer, "cleardevil_pass_%s" % fbMissionID) #´¥·¢¼¤»î·¨±¦ level = gameFB.GetGameFBDictByKey(FBPlayerDict_Level) PlayerMagicWeapon.ActiveMagicWeaponByFB(curPlayer, ChConfig.Def_FBMapID_MagicWeapon, lineID, level) # # ³É¾Í # level = gameFB.GetGameFBDictByKey(FBPlayerDict_Level) # PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_PassWagicWeapon, 1, [lineID + 1, level]) # # ¸üйؿ¨ # if level: # ipyData = IpyGameDataPY.GetIpyGameDataByCondition('MagicWeaponFB', {'LineID':lineID, 'Level':level}) # if ipyData: # mwID = ipyData.GetMWID() # PlayerMagicWeapon.UptateMWFBPasslv(curPlayer, mwID, level) DoFBHelp(curPlayer, tick) return ## ÈÎÎñרÓÃ,´¥·¢Ê¼þ£¨¸±±¾ÄÚÍê³ÉijÈÎÎñ£© # @param curPlayer:Íæ¼ÒʵÀý # @param isAchieve:ÊÇ·ñÍê³ÉÈÎÎñ # @return None def DoFB_OnFinishRunAroundTask(curPlayer, curMissionID, addExp=0, moneyDict={}, itemList=[]): gameFB = GameWorld.GetGameFB() #playerID = curPlayer.GetPlayerID() #exp = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_TotalExp) #expPoint = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_TotalExpPoint) #totalExp = expPoint * ChConfig.Def_PerPointValue + exp exp = addExp % ChConfig.Def_PerPointValue expPoint = addExp / ChConfig.Def_PerPointValue fbMissionID = gameFB.GetGameFBDictByKey(FBPlayerDict_MissionID) GameWorld.DebugLog("ÈÎÎñרÓÃ,´¥·¢Ê¼þ£¨¸±±¾ÄÚÍê³ÉijÈÎÎñ£© curMissionID=%s, fbMissionID=%s, exp=%s,moneyDict=%s,itemList=%s" % (curMissionID, fbMissionID, exp, moneyDict, itemList)) if fbMissionID != curMissionID: return costTime = gameFB.GetGameFBDictByKey(FBPlayerDict_CostTime) awardDict = {} awardDict[FBCommon.Over_isPass] = 1 awardDict[FBCommon.Over_costTime] = costTime awardDict[FBCommon.Over_exp] = exp awardDict[FBCommon.Over_expPoint] = expPoint awardDict[FBCommon.Over_itemInfo] = FBCommon.GetJsonItemList(itemList) __SendOverInfo(curPlayer, awardDict) return ## ÊÇ·ñ¸±±¾¸´»î # @param None # @return ÊÇ·ñ¸±±¾¸´»î def OnPlayerReborn(): return True ##Íæ¼ÒËÀÍö. # @param curPlayer:ËÀÍöµÄÍæ¼Ò # @param tick ʱ¼ä´Á # @return ·µ»ØÖµÎÞÒâÒå # @remarks Íæ¼ÒÖ÷¶¯À뿪¸±±¾. def DoPlayerDead(curPlayer): __DoClearDevilOver(False) return ## ¼ì²éÊÇ·ñ¿É¹¥»÷£¬ Ö÷Åж¨²»¿É¹¥»÷µÄÇé¿ö£¬ÆäËûÂß¼­ÓÉÍâ²ã¾ö¶¨ # @param attacker ¹¥»÷·½ # @param defender ·ÀÊØ·½ # @return bool def CheckCanAttackTagObjInFB(attacker, defender): gameFB = GameWorld.GetGameFB() if gameFB.GetFBStep() != Def_FightTime: return False return True ## ¸±±¾ÐÐΪ # @param curPlayer Íæ¼Ò # @param actionType ÐÐΪÀàÐÍ # @param actionInfo ÐÐΪÐÅÏ¢ # @param tick µ±Ç°Ê±¼ä # @return None def DoFBAction(curPlayer, actionType, actionInfo, tick): gameFB = GameWorld.GetGameFB() fbStep = gameFB.GetFBStep() if fbStep != FB_Step_Over: return level = gameFB.GetGameFBDictByKey(FBPlayerDict_Level) maxLevel = gameFB.GetGameFBDictByKey(FBPlayerDict_MaxLevel) if level <= 0 or maxLevel <= 0: return if level >= maxLevel: return gameFB.SetGameFBDict(FBPlayerDict_Level, level+1) playerID = curPlayer.GetID() FBCommon.SetFBStep(FB_Step_Open, tick) lineID = FBCommon.GetFBPropertyMark() if level+1 == maxLevel and IpyGameDataPY.GetIpyGameDataByCondition("NPCShow", {"MapID":ChConfig.Def_FBMapID_MagicWeapon, "LineID":lineID}, isLogNone=False): GameWorld.DebugLog(" ¸±±¾ÐÐΪ ·¨±¦ÌôÕ½¸Õ½øÈëʱ²»Ö±½Ó¿ªÊ¼£¬ÐèµÈǰ¶Ë֪ͨ¿ªÊ¼²Å¿ªÊ¼!", playerID) # µôÏßÖØÉÏÇ¿ÖÆ¿ªÊ¼ return OnClientStartFB(curPlayer, tick) return ## ¸±±¾½áÊø´¦Àí def __DoClearDevilOver(isPass): gameFB = GameWorld.GetGameFB() if gameFB.GetFBStep() == FB_Step_Over: return tick = GameWorld.GetGameWorld().GetTick() curPlayer = None playerManager = GameWorld.GetMapCopyPlayerManager() if playerManager.GetPlayerCount() > 0: curPlayer = playerManager.GetPlayerByIndex(0) if not curPlayer: GameWorldProcess.CloseFB(tick) return fbCfg = GetClearDevilTimeCfg() gameFB = GameWorld.GetGameFB() playerID = curPlayer.GetPlayerID() exp = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_TotalExp) expPoint = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_TotalExpPoint) #totalExp = expPoint * ChConfig.Def_PerPointValue + exp costTime = tick - GameWorld.GetGameFB().GetFBStepTick() gameFB.SetGameFBDict(FBPlayerDict_CostTime, costTime) fbMissionID = gameFB.GetGameFBDictByKey(FBPlayerDict_MissionID) # ֪ͨ½á¹û ´Ë´¦Ö»Í¨ÖªÊ§°Ü£¬³É¹¦ÔÚÍê³ÉÈÎÎñʱ֪ͨ, ²»ÊÇͨ¹ýÈÎÎñ½øµÄ¸±±¾Ò²Í¨Öª if not isPass or not fbMissionID: # or mapID == ChConfig.Def_FBMapID_ClearDevil2: __SendOverInfo(curPlayer, {FBCommon.Over_isPass:int(isPass), FBCommon.Over_exp:exp, FBCommon.Over_expPoint:expPoint, FBCommon.Over_costTime:costTime}) # ½øÈëÀ뿪½×¶Î FBCommon.SetFBStep(FB_Step_Over, tick) FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttLeaveMap, fbCfg[Def_LeaveTime] * 1000) # ¹Ø±ÕË¢¹Ö lineID = FBCommon.GetFBPropertyMark() npcCfg = GetClearDevilNPCCfg(lineID) for npcInfo in npcCfg: NPCCustomRefresh.CloseNPCRefresh(npcInfo[DL_RefreshMark], tick) if isPass: EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_MagicWeapon, 0, ChConfig.CME_Log_End, 0, 1) # if lineID == IpyGameDataPY.GetFuncCfg('FirstGoldTryItem', 3): # if not isPass: # #¸±±¾Ö¸¶¨Ïß·ʧ°ÜÁË£¬½øÈëÊ׳äÊÔÓÃÒýµ¼ # if not curPlayer.GetChangeCoinPointTotal() and not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FirstGoldTry): # PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldTry, 1) # PlayerGoldGift.Sync_FirstGoldInfo(curPlayer) # else: # PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldTry, 0) return ## ·¢ËÍÌôÕ½½á¹ûÐÅÏ¢ def __SendOverInfo(curPlayer, overDict): overDict[FBCommon.Over_dataMapID] = FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID()) overDict[FBCommon.Over_lineID] = FBCommon.GetFBPropertyMark() overDict[FBCommon.Over_wheel] = GameWorld.GetGameFB().GetGameFBDictByKey(FBPlayerDict_Level) GameWorld.DebugLog("__SendOverInfo overDict=%s" % (str(overDict)), curPlayer.GetPlayerID()) FBCommon.Notify_FB_Over(curPlayer, overDict) return