| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package GameWorldLogic.FBProcess.GameLogic_KirinHome.py  | 
| #  | 
| # @todo:÷è÷ëÖ®¸®  | 
| # @author sgj  | 
| # @date 2017-10-19  | 
| # @version 1.0  | 
| #  | 
| # ÏêϸÃèÊö: ÷è÷ëÖ®¸®  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #"""Version = 2017-10-19 15:30"""  | 
| #-------------------------------------------------------------------------------  | 
|   | 
| import FBCommon  | 
| import GameWorld  | 
| import IPY_GameWorld  | 
| import NPCCustomRefresh  | 
| import GameWorldProcess  | 
| import ChConfig  | 
| import NPCCommon  | 
| import ItemControler  | 
| import ShareDefine  | 
| import PlayerSuccess  | 
| import PlayerControl  | 
| import PlayerBossReborn  | 
| import EventShell  | 
| import EventReport  | 
|   | 
| import random  | 
|   | 
|   | 
| FBPlayerDict_CurStep = 'FBPlayerDict_CurStep'   # µ±Ç°½×¶Î  | 
| FBPlayerDict_CurWheel = 'FBPlayerDict_CurWheel'   # µ±Ç°¹ÖÎﲨÊý  | 
| FBPlayerDict_NPCKillCnt = 'FBPlayerDict_NPCKillCnt'   # NPCÒÑ»÷ɱÊýÁ¿  | 
| FBPlayerDict_TotalGetExp = 'FBPlayerDict_TotalGetExp' #»ñµÃµÄ×ܾÑé  | 
| FBPlayerDict_BossShowDelay = 'FBPlayerDict_BossShowDelay' # ÑÓ³ÙBOSSÐã  | 
| FBPlayerDict_NPCRefreshTime = 'FBPlayerDict_NPCRefreshTime' # Ë¢Ð¡¹Öʱ¼ä  | 
| KirinHome_FBNPCCnt = 'KirinHome_FBNPCCnt'   # ¸±±¾Ê£Óà¹ÖÎïÊý  | 
| KirinHome_NPCNeedRefreshCnt = 'KirinHome_NPCNeedRefreshCnt'   # »¹ÐèˢеĹÖÎïÊý  | 
|   | 
| #---¸±±¾ÅäÖöÔÓ¦keyÖµ---  | 
| (  | 
| FB_PrepareTime, # ¸±±¾×¼±¸Ê±¼ä(Ãë)  | 
| FB_FightTime, # ½øÐÐʱ¼ä(Ãë)  | 
| FB_LeaveTime, # Í˳öʱ¼ä(Ãë)  | 
| FB_WheelCnt, #¸±±¾Ë¢Ð¡¹Ö²¨Êý  | 
| FB_RefreshTick, #С¹Öˢмä¸ô  | 
| ) = range(5)  | 
|   | 
|   | 
| #---Ë¢¹ÖÐÅÏ¢¶ÔÓ¦µÄË÷Òý---  | 
| (  | 
| FB_NPCPoint, # Ë¢¹Ö±êʶµã  | 
| FB_NPCID, # NPCID  | 
| FB_RefreshCnt, # Ë¢NPC¸öÊý  | 
| ) = range(3)  | 
|   | 
|   | 
| #µ±Ç°¸±±¾µØÍ¼µÄ״̬  | 
| (  | 
| FB_Step_Open, # ¸±±¾¿ªÆô  | 
| FB_Step_Prepare, # ¸±±¾µÈ´ý  | 
| FB_Step_Fighting, # ¸±±¾½øÐÐÖÐ  | 
| FB_Step_Over, # ¸±±¾½áÊø  | 
| FB_Step_Close, # ¸±±¾¹Ø±Õ  | 
| ) = range(5)  | 
|   | 
|   | 
| #Boss½±Àø  | 
| (  | 
| Item_ID, #ÎïÆ·ID  | 
| Item_MinCnt, #×îСÊýÁ¿  | 
| Item_MaxCnt, #×î´óÊýÁ¿  | 
| ) = range(3)  | 
|   | 
|   | 
|   | 
| ##---»ñµÃ¸±±¾ÅäÖÃ---  | 
| def GetQLZFTimeCfg():return FBCommon.GetFBLineStepTime(ChConfig.Def_FBMapID_KirinHome)  | 
| def GetNPCList(fbStar, step):return FBCommon.GetFBLineRefreshNPC(ChConfig.Def_FBMapID_KirinHome, fbStar)[step]  | 
| def GiveBossAward(curPlayer, fbStar):  | 
|     awardList = FBCommon.GetFBLineReward(ChConfig.Def_FBMapID_KirinHome, fbStar)  | 
|     if not awardList:  | 
|         return []  | 
|     itemList = []  | 
|     for itemMsg in awardList:  | 
|         itemID = itemMsg[Item_ID]  | 
|         itemCnt = random.randint(itemMsg[Item_MinCnt], itemMsg[Item_MaxCnt])  | 
|         itemList.append([itemID, itemCnt, 1])  | 
|     return itemList  | 
|   | 
|   | 
| ## ÊÇ·ñÄܹ»Í¨¹ý»î¶¯²éѯ½øÈë  | 
| #  @param curPlayer Íæ¼ÒʵÀý  | 
| #  @param mapID µØÍ¼ID  | 
| #  @param lineID Ïß·id  | 
| #  @param tick Ê±¼ä´Á  | 
| #  @return ²¼¶ûÖµ  | 
| def OnEnterFBEvent(curPlayer, mapID, lineID, tick):  | 
|     return True  | 
|   | 
|   | 
| #¼ì²éɨµ´Ìõ¼þ  | 
| def __CheckFBSweep(curPlayer, moveToMapID, line):  | 
|     #ÅжϵØÍ¼Ìõ¼þ  | 
| #    if GameWorld.GetMap().GetMapFBType() != 0:  | 
| #        GameWorld.DebugLog("ÔÚÌØÊâµØÍ¼ÎÞ·¨É¨µ´")  | 
| #        return False  | 
|     curfbStar = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, line, False, [moveToMapID])  | 
|     if not curfbStar:  | 
|         GameWorld.Log("±ØÐëͨ¹Øµ±Ç°µÈÄѶȲÅÄÜɨµ´")  | 
|         return False  | 
|     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):  | 
|     PlayerControl.SetSight(curPlayer, ChConfig.Def_PlayerSight_Default * 2)  | 
|     gameFB = GameWorld.GetGameFB()  | 
|     hadDelTicket = FBCommon.GetHadDelTicket(curPlayer)  | 
|     lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBFuncLine)  | 
|     if not hadDelTicket:  | 
|         ItemControler.OpenPickupItemPutInTemp(curPlayer, True)  | 
|         mapID = GameWorld.GetMap().GetMapID()  | 
|         #¿ÛÃÅÆ±  | 
|         FBCommon.DelFBEnterTicket(curPlayer, mapID)  | 
|         FBCommon.SetHadDelTicket(curPlayer)  | 
|         FBCommon.SetFBStep(FB_Step_Prepare, tick)  | 
|         #³õʼ»¯ÐÅÏ¢  | 
|         FBCommon.SetFBPropertyMark(lineID)  | 
|         EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_KirinHome, 0, ChConfig.CME_Log_Start)  | 
|     else:  | 
|         ItemControler.ClosePickupItemPutInTemp(curPlayer)  | 
|         __DoFB_Finish(ispass=0)  | 
|         return  | 
|        | 
|     fbStep = gameFB.GetFBStep()  | 
|     fbCfg = GetQLZFTimeCfg()  | 
|     beginCurStrpTime = gameFB.GetFBStepTick()  | 
|     timePassTick = tick - beginCurStrpTime  | 
|     #֪ͨʱ¼ä  | 
|     if fbStep <= FB_Step_Prepare:  | 
|         prePareTime = fbCfg[FB_PrepareTime] * 1000  | 
|         timeTick = max(prePareTime - timePassTick, 0)  | 
|         FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttAddUpTime, timeTick)  | 
|         FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttWaitStart, timeTick)  | 
|     if fbStep == FB_Step_Fighting:  | 
|         fightTime = fbCfg[FB_FightTime] * 1000    | 
|         timeTick = max(fightTime - timePassTick, 0)  | 
|         FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttTowerTake, timeTick)  | 
|     DoFBHelp(curPlayer, tick)  | 
|     return  | 
|   | 
|   | 
| ##---¸±±¾×ÜÂß¼¼ÆÊ±Æ÷---  | 
| # @param tick:ʱ¼ä´Á  | 
| # @return ÎÞÒâÒå  | 
| # @remarks ¸±±¾×ÜÂß¼¼ÆÊ±Æ÷  | 
| def OnProcess(tick):  | 
|     fbStep = GameWorld.GetGameFB().GetFBStep()  | 
|   | 
|     if fbStep == FB_Step_Prepare:  | 
|         __DoFB_Prepare(tick)  | 
|     if fbStep == FB_Step_Fighting:  | 
|         __DoFB_Fight(tick)  | 
|     if fbStep == FB_Step_Over:  | 
|         __DoFB_Over(tick)  | 
|     return  | 
|   | 
| #×¼±¸½×¶ÎÂß¼  | 
| def __DoFB_Prepare(tick):  | 
|     gameFB = GameWorld.GetGameFB()  | 
|     beginCurStepTime = gameFB.GetFBStepTick()  | 
|     fbCfg = GetQLZFTimeCfg()  | 
|     timePassTick = tick - beginCurStepTime  | 
|     if timePassTick < fbCfg[FB_PrepareTime] * 1000:  | 
|         return  | 
|       | 
|     FBCommon.SetFBStep(FB_Step_Fighting, tick)  | 
|     FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttTowerTake, fbCfg[FB_FightTime] * 1000)  | 
|           | 
|   | 
| #¸±±¾Õ½¶·½×¶ÎÂß¼      | 
| def __DoFB_Fight(tick):  | 
|     gameFB = GameWorld.GetGameFB()  | 
|     beginCurStrpTime = gameFB.GetFBStepTick()  | 
|     fbCfg = GetQLZFTimeCfg()  | 
|       | 
|     __CheckNPCRefresh(tick, isForce=False)  | 
|   | 
|     timePassTick = tick - beginCurStrpTime  | 
|     if timePassTick < fbCfg[FB_FightTime] * 1000:  | 
|         return  | 
|     __DoFB_Finish(ispass=0)  | 
|   | 
|   | 
| def __CheckNPCRefresh(tick, isForce=False):  | 
|     gameFB = GameWorld.GetGameFB()  | 
|     curWheel = gameFB.GetGameFBDictByKey(FBPlayerDict_CurWheel)  | 
|     QLZFTimeCfg = GetQLZFTimeCfg()  | 
|       | 
|     curStep = gameFB.GetGameFBDictByKey(FBPlayerDict_CurStep)  | 
|     if curStep == 0:  | 
|         lastRefreshTime = gameFB.GetGameFBDictByKey(FBPlayerDict_NPCRefreshTime)  | 
|         if not isForce and lastRefreshTime and  tick - lastRefreshTime < QLZFTimeCfg[FB_RefreshTick] * 1000:  | 
|             return  | 
|         if curWheel >= QLZFTimeCfg[FB_WheelCnt]:  | 
|             #²¨ÊýÒÑË¢Âú  | 
|             return  | 
|         gameFB.SetGameFBDict(FBPlayerDict_NPCRefreshTime, tick)  | 
|         gameFB.SetGameFBDict(FBPlayerDict_CurWheel, curWheel + 1)  | 
|         curPlayer = FBCommon.GetCurSingleFBPlayer()  | 
|         if curPlayer:  | 
|             PlayerControl.NotifyCode(curPlayer, 'KirinHomeWheel', [curWheel + 1])  | 
|     else:  | 
|         bossShowDelayTick = gameFB.GetGameFBDictByKey(FBPlayerDict_BossShowDelay)  | 
|         if not bossShowDelayTick or tick - bossShowDelayTick <= 1000:  | 
|             return  | 
|         gameFB.SetGameFBDict(FBPlayerDict_BossShowDelay, 0)  | 
|         gameFB.SetGameFBDict(FBPlayerDict_CurWheel, 0)  | 
|           | 
|     npcCntDict = {} #±êʶµã¶ÔÓ¦ÊýÁ¿  | 
|       | 
|     gameNPC = GameWorld.GetNPCManager()  | 
|     for i in range(0, gameNPC.GetCustomNPCRefreshCount()):  | 
|         npcRefresh = gameNPC.GetCustomNPCRefreshAt(i)  | 
|         rmark = npcRefresh.GetRefreshMark()  | 
|         npcCntDict[rmark] = npcCntDict.get(rmark, npcRefresh.GetCount())  | 
|           | 
|       | 
|     fbHard = FBCommon.GetFBPropertyMark()     | 
|     refreshList = GetNPCList(fbHard, curStep)  | 
|     newNeedRefreshCnt = gameFB.GetGameFBDictByKey(KirinHome_NPCNeedRefreshCnt)  | 
|     for refreshMark, npcID, npcCnt in refreshList:  | 
|         newNeedRefreshCnt += npcCnt  | 
|     gameFB.SetGameFBDict(KirinHome_NPCNeedRefreshCnt, newNeedRefreshCnt)  | 
|       | 
|     for refreshMark, npcID, npcCnt in refreshList:  | 
|         curMaxCnt = npcCntDict.get(refreshMark, 0) + npcCnt  | 
|         NPCCustomRefresh.SetNPCRefresh(refreshMark, [npcID], curMaxCnt, npcCnt)  | 
|           | 
|     FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)  | 
|     return  | 
|   | 
|   | 
| #¸±±¾½áÊøÂß¼    | 
| def __DoFB_Over(tick):  | 
|     gameFB = GameWorld.GetGameFB()  | 
|     beginCurStrpTime = gameFB.GetFBStepTick()  | 
|     fbCfg = GetQLZFTimeCfg()  | 
|     timePassTick = tick - beginCurStrpTime  | 
|     if timePassTick < fbCfg[FB_LeaveTime] * 1000:  | 
|         return  | 
|     GameWorldProcess.CloseFB(tick)  | 
|     FBCommon.SetFBStep(FB_Step_Close, tick)  | 
|     return  | 
|                   | 
|   | 
| ##¸±±¾ÓÐNPCÕÙ³ö  | 
| # @param curNPC:  | 
| # @param tick:tick  | 
| # @return None  | 
| def DoFBRebornNPC(curNPC, tick):  | 
|     gameFB = GameWorld.GetGameFB()  | 
|     npcCnt = gameFB.GetGameFBDictByKey(KirinHome_FBNPCCnt)  | 
|     needRefreshCnt = gameFB.GetGameFBDictByKey(KirinHome_NPCNeedRefreshCnt)  | 
|       | 
|     npcCnt += 1  | 
|     needRefreshCnt -= 1  | 
|     gameFB.SetGameFBDict(KirinHome_FBNPCCnt, npcCnt)  | 
|     gameFB.SetGameFBDict(KirinHome_NPCNeedRefreshCnt, needRefreshCnt)  | 
|     GameWorld.DebugLog("DoFBRebornNPC, npcID=%s,KirinHome_FBNPCCnt=%s,needRefreshCnt=%s" % (curNPC.GetNPCID(), npcCnt, needRefreshCnt))  | 
|     if needRefreshCnt <= 0:  | 
|         GameWorld.DebugLog("±¾²¨¹ÖÎïË¢ÐÂÍê±Ï£¡npcCnt=%s" % npcCnt)  | 
|     return  | 
|    | 
| def DoFB_Player_KillNPC(curPlayer, curNPC, tick):  | 
|     if not curNPC.GetNPCID():  | 
|         #ÓпÉÄÜΪ0  | 
|         return  | 
|     gameFB = GameWorld.GetGameFB()  | 
|     curStep = gameFB.GetGameFBDictByKey(FBPlayerDict_CurStep)  | 
|      | 
|     npcCnt = gameFB.GetGameFBDictByKey(KirinHome_FBNPCCnt)  | 
|     needRefreshCnt = gameFB.GetGameFBDictByKey(KirinHome_NPCNeedRefreshCnt)  | 
|     npcCnt -= 1  | 
|     gameFB.SetGameFBDict(KirinHome_FBNPCCnt, npcCnt)  | 
|     curWheel = gameFB.GetGameFBDictByKey(FBPlayerDict_CurWheel)  | 
|     GameWorld.DebugLog("DoFB_Player_KillNPC, npcID=%s,KirinHome_FBNPCCnt=%s,needRefreshCnt=%s"   | 
|                        % (curNPC.GetNPCID(), npcCnt, needRefreshCnt))  | 
|     killCnt = gameFB.GetGameFBDictByKey(FBPlayerDict_NPCKillCnt)  | 
|     gameFB.SetGameFBDict(FBPlayerDict_NPCKillCnt, killCnt+1)  | 
|     QLZFTimeCfg = GetQLZFTimeCfg()  | 
|     if curStep == 0:  | 
|         if max(npcCnt, needRefreshCnt) <= 0:  | 
|             if curWheel >= QLZFTimeCfg[FB_WheelCnt]:  | 
|                 #²¨ÊýÒÑË¢Âú ²¢ÇÒɱ¹â  | 
|                 gameFB.SetGameFBDict(FBPlayerDict_BossShowDelay, tick)  | 
|                 gameFB.SetGameFBDict(FBPlayerDict_CurStep, 1)  | 
|                 gameFB.SetGameFBDict(FBPlayerDict_NPCKillCnt, 0)  | 
|             else:  | 
|                 __CheckNPCRefresh(tick, True)  | 
|               | 
|     elif max(npcCnt, needRefreshCnt) <= 0:  | 
|         __DoFB_Finish(ispass=1)  | 
|     DoFBHelp(curPlayer, tick)  | 
|     return  | 
|   | 
| ## ¼ì²éÊÇ·ñ¿É¹¥»÷£¬ Ö÷Åж¨²»¿É¹¥»÷µÄÇé¿ö£¬ÆäËûÂß¼ÓÉÍâ²ã¾ö¶¨  | 
| #  @param attacker ¹¥»÷·½  | 
| #  @param defender ·ÀÊØ·½  | 
| #  @return bool  | 
| def CheckCanAttackTagObjInFB(attacker, defender):  | 
|     gameFB = GameWorld.GetGameFB()  | 
|     if gameFB.GetFBStep() != FB_Step_Fighting:  | 
|         return False  | 
|     return True   | 
|   | 
| ## »ñµÃ¾Ñé  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param addExp »ñµÃµÄ¾Ñé  | 
| #  @param expViewType ¾ÑéÀàÐÍ  | 
| #  @return True or False  | 
| def OnGetExp(curPlayer, addExp, expViewType):  | 
|       | 
|     if expViewType != ShareDefine.Def_ViewExpType_KillNPC:  | 
|         return  | 
|     gameFB = GameWorld.GetGameFB()  | 
|     totalExp = gameFB.GetGameFBDictByKey(FBPlayerDict_TotalGetExp) + addExp  | 
|     gameFB.SetGameFBDict(FBPlayerDict_TotalGetExp, totalExp)  | 
|     return  | 
|   | 
| def __DoFB_Finish(ispass=0):  | 
|     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  | 
|     #ÅжÏFBÄÑ¶È  | 
|     lineID = FBCommon.GetFBPropertyMark()  | 
|     mapID = GameWorld.GetMap().GetMapID()  | 
|     mapID = FBCommon.GetRecordMapID(mapID)  | 
|     gameFB = GameWorld.GetGameFB()  | 
|     if ispass:  | 
|         gameFB.SetGameFBDict(FBPlayerDict_CurWheel, 1)  | 
|         FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)  | 
|       | 
|     #¸øÎïÆ·  | 
|     itemList = __GivePlayerAward(curPlayer, lineID, ispass)  | 
|     curfbStar = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, False, [mapID])  | 
|     if ispass and not curfbStar:  | 
|         GameWorld.DebugLog("Ê×´Îͨ¹ýÄѶÈΪ %s ÐÇ" % lineID)  | 
|         GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, 1, False, [mapID])  | 
|           | 
|     if ispass:  | 
|         FBCommon.AddEnterFBCount(curPlayer, mapID)  | 
|         PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_KirinHome, 1, [lineID+1])  | 
|         PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_KirinHomeEx, 1)  | 
|         PlayerBossReborn.AddBossRebornActionCnt(curPlayer, ChConfig.Def_BRAct_KirinHome, 1)  | 
|         EventShell.EventRespons_FBEvent(curPlayer, "kirinhome_%s" % (lineID+1))  | 
|         EventShell.EventRespons_FBEvent(curPlayer, "kirinhome_0")  | 
|           | 
|         if lineID+1 > curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBHistoryMaxLine % mapID):  | 
|             PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FBHistoryMaxLine % mapID, lineID+1)  | 
|     curStep = gameFB.GetGameFBDictByKey(FBPlayerDict_CurStep)  | 
|     npcMsg = GetNPCList(curfbStar, curStep)  | 
|     for npcInfo in npcMsg:  | 
|         NPCCustomRefresh.CloseNPCRefresh(npcInfo[FB_NPCPoint], tick)  | 
|   | 
|     #ÏûºÄʱ¼ä  | 
|     costTime = tick - gameFB.GetFBStepTick()  | 
|     totalExp = gameFB.GetGameFBDictByKey(FBPlayerDict_TotalGetExp)  | 
|     overDict = {FBCommon.Over_exp:totalExp, FBCommon.Over_isPass:ispass, FBCommon.Over_costTime:costTime, FBCommon.Over_dataMapID:mapID}  | 
|       | 
|     if len(itemList) > 0:  | 
|         overDict[FBCommon.Over_itemInfo] = FBCommon.GetJsonItemList(itemList)  | 
|     GameWorld.DebugLog('    overDict=%s' % overDict)  | 
|     FBCommon.Notify_FB_Over(curPlayer, overDict)  | 
|     FBCommon.SetFBStep(FB_Step_Over, tick)  | 
|     FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttLeaveMap, GetQLZFTimeCfg()[FB_LeaveTime] * 1000)  | 
|     return  | 
|        | 
|    | 
| def __GivePlayerAward(curPlayer, fbStar, ispass=0):  | 
|     if ispass:  | 
|         itemList = GiveBossAward(curPlayer, fbStar)  | 
|         ItemControler.DoGivePlayerTempPackItem(curPlayer, ["KirinHome", False, {}], 'KirinHomeMail', itemList)  | 
|           | 
|         return itemList  | 
|     else:  | 
|         return []  | 
|            | 
|   | 
|   | 
| ## »ñµÃ¸±±¾°ïÖúÐÅÏ¢  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò£¨±»Í¨Öª¶ÔÏó£©  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| def DoFBHelp(curPlayer, tick):  | 
|     gameFB = GameWorld.GetGameFB()  | 
|     fbHard = FBCommon.GetFBPropertyMark()  | 
|     #wheel = gameFB.GetGameFBDictByKey(FBPlayerDict_CurWheel)  | 
|     curStep = gameFB.GetGameFBDictByKey(FBPlayerDict_CurStep) + 1  | 
|     killCnt = gameFB.GetGameFBDictByKey(FBPlayerDict_NPCKillCnt)  | 
|     FBCommon.Notify_FBHelp(curPlayer, {FBCommon.Help_npcTotal:killCnt, FBCommon.Help_lineID:fbHard, FBCommon.Help_step:curStep})  | 
|     return  | 
|   | 
|   | 
| ## ÊÇ·ñ¸±±¾¸´»î  | 
| #  @param None  | 
| #  @return ÊÇ·ñ¸±±¾¸´»î  | 
| def OnPlayerReborn():  | 
|     return False  | 
|   | 
| def DoPlayerDead(curPlayer):  | 
|     ItemControler.ClosePickupItemPutInTemp(curPlayer)  | 
|     __DoFB_Finish(ispass=0)  | 
|   | 
| ## ¸±±¾ÐÐΪ  | 
| #  @param curPlayer Íæ¼Ò  | 
| #  @param actionType ÐÐΪÀàÐÍ  | 
| #  @param actionInfo ÐÐΪÐÅÏ¢  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| def DoFBAction(curPlayer, actionType, actionInfo, tick):  | 
|     return  | 
|   | 
| ## ¿É·ñɨµ´  | 
| def OnPlayerFBSweepAsk(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):  | 
|     if mapID != ChConfig.Def_FBMapID_KirinHome:  | 
|         GameWorld.DebugLog("ÉêÇëµØÍ¼´íÎó")  | 
|         return  | 
|     if not __CheckFBSweep(curPlayer, mapID, lineID):  | 
|         return  | 
|     return True  | 
|   | 
| ## É¨µ´½á¹û  | 
| def OnPlayerFBSweepResult(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):  | 
|     #¿ÛÃÅÆ±ÒªÔÚ¹«¹²Âß¼ÖÐÍê³É  | 
|     npcMsgDict = {}  | 
|     npcMsgList = GetNPCList(lineID, 0)  | 
|     npcRefreshNum = GetQLZFTimeCfg()[FB_WheelCnt]  | 
|     for npcMsg in npcMsgList:  | 
|         npcMsgDict[npcMsg[FB_NPCID]] = npcMsgDict.get(npcMsg[FB_NPCID], 0) + npcMsg[FB_RefreshCnt] * npcRefreshNum * sweepCnt  | 
|           | 
|     extraItemList = []  | 
|     for _ in xrange(sweepCnt):  | 
|         extraItemList += GiveBossAward(curPlayer, lineID)  | 
|           | 
|     exp_rate = PlayerControl.GetLimitExpRate(curPlayer, ChConfig.ExpRateLimitType_Sweep)  | 
|     jsonItemList, totalExp, totalMoney = NPCCommon.GiveKillNPCDropPrize(curPlayer, mapID, npcMsgDict, exp_rate,   | 
|                                                                         "KirinHomeMail", False, extraItemList)  | 
|       | 
|     overDict = {FBCommon.Over_exp:totalExp, FBCommon.Over_isSweep:1, FBCommon.Over_itemInfo:jsonItemList,   | 
|                 FBCommon.Over_dataMapID:mapID, FBCommon.Over_isPass:1, FBCommon.Over_lineID:lineID}  | 
|     FBCommon.Notify_FB_Over(curPlayer, overDict)  | 
|       | 
|     PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_KirinHome, sweepCnt, [lineID])  | 
|     PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_KirinHomeEx, 1)  | 
|     PlayerBossReborn.AddBossRebornActionCnt(curPlayer, ChConfig.Def_BRAct_KirinHome, sweepCnt)  | 
|     for _ in xrange(sweepCnt):  | 
|         EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_KirinHome, 0, ChConfig.CME_Log_Start)  | 
|     GameWorld.DebugLog("ɨµ´½±Àø: ´ÎÊý=%s,totalExp=%s,totalMoney=%s,jsonItemList=%s" % (sweepCnt, totalExp, totalMoney, jsonItemList))   | 
|     return True  | 
|   | 
|   | 
| ##Íæ¼ÒÍ˳ö¸±±¾  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ÎÞÒâÒå  | 
| def DoExitFB(curPlayer, tick):  | 
|     PlayerControl.SetSight(curPlayer, ChConfig.Def_PlayerSight_Default)  | 
|     ItemControler.ClosePickupItemPutInTemp(curPlayer)  | 
|     return  | 
|   | 
| ##Íæ¼ÒÖ÷¶¯À뿪¸±±¾.  | 
| # @param curPlayer Íæ¼Ò  ÊµÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| def DoPlayerLeaveFB(curPlayer, tick):  | 
|     PlayerControl.SetSight(curPlayer, ChConfig.Def_PlayerSight_Default)  | 
|     ItemControler.ClosePickupItemPutInTemp(curPlayer)  | 
|     return  | 
|   | 
|   | 
| def OnNPCRebornInFB(curNPC):  | 
|     curNPC.SetIsNeedProcess(True)  | 
|       | 
|     # Á¢¼´¼Ó³ðºÞ  | 
|     npcControl = NPCCommon.NPCControl(curNPC)  | 
|     tick = GameWorld.GetGameWorld().GetTick()  | 
|     npcControl.RefreshAngryList(tick, refreshInterval=0)  | 
|   | 
|     return  |