| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package Commands.SetMergePKInfo  | 
| #  | 
| # @todo:ÉèÖÿç·þPK»ý·Ö  | 
| # @author hxp  | 
| # @date 2015-10-26  | 
| # @version 1.3  | 
| #  | 
| # @change: "2015-11-05 12:00" hxp Ôö¼Ó¿ÉÉèÖõ±Ç°Á¬Ê¤³¡Êý  | 
| # @change: "2015-11-19 20:00" hxp Èç¹ûûÔÚ¿ç·þÖܰñÉÏ£¬ÔòÌí¼ÓÒ»Ìõмͼ  | 
| # @change: "2016-12-20 17:30" hxp Âß¼ÐÞ¸Ä  | 
| # ÏêϸÃèÊö: ÉèÖÿç·þPK»ý·Ö; ²ÎÊý[»ý·Ö, pk´ÎÊý, Ê¤Àû´ÎÊý, µ±Ç°Á¬Ê¤, ×î´óÁ¬Ê¤]  | 
| #  | 
| #---------------------------------------------------------------------  | 
| #"""Version = 2016-12-20 17:30"""  | 
| #---------------------------------------------------------------------  | 
|   | 
| import GameWorld  | 
| import GameWorldMergePK  | 
| import PlayerBillboard  | 
| import ShareDefine  | 
|   | 
| # µ¼Èë  | 
| #------------------------------------------------------------------------------   | 
|   | 
| ## Ö´ÐÐÂß¼  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param cmdList ²ÎÊýÁÐ±í  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OnExec(curPlayer, cmdList):  | 
|     tick = GameWorld.GetGameWorld().GetTick()  | 
|     cmdList.extend(OnGetMergeParam(curPlayer))  | 
|     __DoSetMergePKScore(curPlayer, cmdList, tick)  | 
|     return  | 
|   | 
| ## ·¢Ë͵½¿ç·þ·þÎñÆ÷µÄÀ©Õ¹²ÎÊýÁÐ±í  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @return None  | 
| #  @remarks   | 
| def OnGetMergeParam(curPlayer):  | 
|     GameWorld.DebugAnswer(curPlayer, "SetMergePKInfo [°ñµ¥ÀàÐÍ, »ý·Ö, pk´ÎÊý, Ê¤Àû´ÎÊý, µ±Ç°Á¬Ê¤, ×î´óÁ¬Ê¤], ²ÎÊýÑ¡Ìî!")  | 
|     GameWorld.DebugAnswer(curPlayer, "°ñµ¥ÀàÐÍ: µ±ÈÕ-91, Èü¼¾-92")  | 
|     GameWorld.DebugAnswer(curPlayer, "SetMergePKInfo 0  ¿ÉÖØÖÃËùÓаñµ¥")  | 
|     return [curPlayer.GetPlayerID(), curPlayer.GetName(), curPlayer.GetJob(), curPlayer.GetFightPower()]  | 
|   | 
| ## ¿ç·þ·þÎñÆ÷Ö´ÐÐÂß¼  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param cmdList ²ÎÊý  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OnMergeServerExec(cmdList, tick):  | 
|     __DoSetMergePKScore(None, cmdList, tick)  | 
|     return  | 
|   | 
| def __DoSetMergePKScore(curPlayer, cmdList, tick):  | 
|     GameWorld.Log("GMÃüÁîÉèÖÿç·þPKÐÅÏ¢£º cmdList=%s" % str(cmdList))  | 
|     playerID, playerName, job, fightPower = cmdList[-4:]  | 
|     cmdList = cmdList[:-4]  | 
|       | 
|     if len(cmdList) > 0 and cmdList[0] == "0":  | 
|         PlayerBillboard.ClearBillboardByIndex(ShareDefine.Def_BT_MergePKDay)  | 
|         PlayerBillboard.ClearBillboardByIndex(ShareDefine.Def_BT_MergePKWeek)  | 
|         GameWorldMergePK.__SyncBillboardToClientServer(True, tick)  | 
|         return  | 
|       | 
|     #°ñµ¥ÀàÐÍ, »ý·Ö, pk´ÎÊý, Ê¤Àû´ÎÊý, µ±Ç°Á¬Ê¤, ×î´óÁ¬Ê¤  | 
|     if not cmdList:  | 
|         return  | 
|     bbType = GameWorld.ToIntDef(cmdList[0])  | 
|     if bbType not in [ShareDefine.Def_BT_MergePKDay, ShareDefine.Def_BT_MergePKWeek]:  | 
|         return  | 
|     cmdList = cmdList[1:]  | 
|     addScore = GameWorld.ToIntDef(cmdList[0]) if len(cmdList) > 0 else None  | 
|     pkCnt = GameWorld.ToIntDef(cmdList[1]) if len(cmdList) > 1 else None  | 
|     winCnt = GameWorld.ToIntDef(cmdList[2]) if len(cmdList) > 2 else None  | 
|     cWinCnt = GameWorld.ToIntDef(cmdList[3]) if len(cmdList) > 3 else None  | 
|     maxCWinCnt = GameWorld.ToIntDef(cmdList[4]) if len(cmdList) > 4 else None  | 
|       | 
|     billBoard, bbData = GameWorldMergePK.GetMatchPlayerBillboardData(bbType, playerID, True)  | 
|     if not billBoard or not bbData:  | 
|         return  | 
|       | 
|     GameWorldMergePK.SetBBPlayerID(bbData, playerID)  | 
|     GameWorldMergePK.SetBBPlayerName(bbData, playerName)  | 
|     GameWorldMergePK.SetBBPlayerJob(bbData, job)  | 
|     GameWorldMergePK.SetBBFightPower(bbData, fightPower)  | 
|     if addScore != None:  | 
|         GameWorldMergePK.SetBBMergePKScore(bbData, addScore)  | 
|     if pkCnt != None:  | 
|         GameWorldMergePK.SetBBMergePKCnt(bbData, pkCnt)  | 
|     if winCnt != None:  | 
|         GameWorldMergePK.SetBBMergePKWinCnt(bbData, winCnt)  | 
|     if cWinCnt != None:  | 
|         GameWorldMergePK.SetBBMergePKCWinCnt(bbData, cWinCnt)  | 
|     if maxCWinCnt != None:  | 
|         GameWorldMergePK.SetBBMergePKMaxCWinCnt(bbData, maxCWinCnt)  | 
|       | 
|     billBoard.Sort()  | 
|       | 
|     GameWorldMergePK.__SyncBillboardToClientServer(True, tick)  | 
|           | 
|     return  | 
|   | 
|   | 
|   |