| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package PlayerBillboard  | 
| #  | 
| # @todo:ÅÅÐаñ  | 
| # @author hxp  | 
| # @date 2018-03-06  | 
| # @version 1.0  | 
| #  | 
| # ÏêϸÃèÊö: ÅÅÐаñ  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #"""Version = 2018-03-06 11:00"""  | 
| #-------------------------------------------------------------------------------  | 
|   | 
|   | 
| import IPY_GameServer  | 
| import GameWorld  | 
| import ChConfig  | 
| import ShareDefine  | 
| import PlayerControl  | 
| import ChPyNetSendPack  | 
| import PlayerDBGSEvent  | 
| import NetPackCommon  | 
| import DataRecordPack  | 
| import PlayerFamily  | 
| import PyDataManager  | 
| import PlayerViewCache  | 
| import IpyGameDataPY  | 
| import PyGameData  | 
|   | 
| import time  | 
| import random  | 
|   | 
| Def_Key_BillboardSortTick = "BillboardSortTick_%s" # ÅÅÐаñÊÇ·ñÅÅÐòtick£¬²ÎÊý£¨ÅÅÐаñÀàÐÍ£©  | 
| Def_Key_BillboardNeedSort = "BillboardNeedSort_%s" # ÅÅÐаñÊÇ·ñÐèÒªÅÅÐò£¬²ÎÊý£¨ÅÅÐаñÀàÐÍ£©  | 
|   | 
| #ÐèҪÿÌ쿽±´×òÈÕ°ñµ¥µÄÅÅÐаñÀàÐÍ×Öµä  | 
| Def_NeedCopyYesterday_Dict = {  | 
|     #×òÈÕ°ñ£¨¿½±´£©                                    #½ñÈÕ°ñ£¨Ô´Êý¾Ý£©  | 
|                          }  | 
|   | 
| class BillboardObj(object):  | 
|     ''' °ñµ¥¶îÍâÊý¾Ý¹ÜÀí  | 
|     '''  | 
|       | 
|     def __init__(self, billboardType):  | 
|         self.__billboardType = billboardType  | 
|         self.__idOrderDict = {} # {id:Ãû´Î, ...}  | 
|         self.__orderRuleList = None  | 
|         return  | 
|       | 
|     def OnBillboardChange(self):  | 
|         ## °ñµ¥Êý¾Ý±ä¸ü  | 
|         self.__idOrderDict = {}  | 
|         return  | 
|       | 
|     def GetIDOrderDict(self):  | 
|         ## »ñÈ¡ID¶ÔÓ¦Ãû´Î×ֵ䣬±¾·þ°ñ½ö´¦ÀíÓÐÌØÊâÅÅÃû¹æÔòµÄ  | 
|         # @return: {ID:Ãû´Î, ...}  Ãû´Î´Ó1¿ªÊ¼£¬Èç¹û·µ»Ø¿Õ×ֵ䣬ÔòʹÓÃĬÈÏÃû´ÎÂß¼£¬¼´ index + 1  | 
|         if not self.__orderRuleList:  | 
|             return {}  | 
|           | 
|         if not self.__idOrderDict:  | 
|             billBoard = GameWorld.GetBillboard().FindBillboard(self.__billboardType)  | 
|             if not billBoard:  | 
|                 return {}  | 
|             billboardDataCount = billBoard.GetCount()  | 
|             rankPre = 0  | 
|             billboardIndex = 0  | 
|             for rank, needCmpValue in self.__orderRuleList:  | 
|                 orderCountTotal = rank - rankPre # ½±ÀøÃû´ÎÊýÁ¿  | 
|                 rankPre = rank  | 
|                 for index in xrange(billboardIndex, billboardDataCount):  | 
|                     if orderCountTotal <= 0:  | 
|                         break  | 
|                     billboardData = billBoard.At(index)  | 
|                     if billboardData.GetCmpValue() < needCmpValue:  | 
|                         break  | 
|                     orderReal = rank - orderCountTotal + 1  | 
|                     self.__idOrderDict[billboardData.GetID()] = orderReal  | 
|                     orderCountTotal -= 1  | 
|                     billboardIndex += 1  | 
|         return self.__idOrderDict  | 
|       | 
|     def SetOrderRuleList(self, orderRuleList):  | 
|         ## ÅÅÃûËùÐèÖµ¹æÔòÁÐ±í  | 
|         # @param orderRuleList: ÅÅÃûËùÐèÖµ¹æÔòÁбí [[order, needCmpValue], ...]  | 
|         self.__orderRuleList = orderRuleList  | 
|         self.__idOrderDict = {} # ÉèÖúóÐèÖØÖ㬿ÉÄÜÅäÖùæÔò±ä»¯Á˵¼ÖÂʵ¼ÊÅÅÃû¿ÉÄܱ仯  | 
|         GameWorld.Log("ÉèÖÃÅÅÃûËùÐèÖµ¹æÔòÁбí: billboardType=%s, %s" % (self.__billboardType, orderRuleList))  | 
|         return  | 
|       | 
| class BillboardMgr(object):  | 
|     ''' °ñµ¥¶îÍâ¹ÜÀí  | 
|     '''  | 
|       | 
|     def __init__(self):  | 
|         self.__billboardDict = {} # {°ñµ¥ÀàÐÍ:Billboard, ...}  | 
|         return  | 
|       | 
|     def GetBillboardObj(self, billboardType):  | 
|         if billboardType in self.__billboardDict:  | 
|             billboard = self.__billboardDict[billboardType]  | 
|         else:  | 
|             billboard = BillboardObj(billboardType)  | 
|             self.__billboardDict[billboardType] = billboard  | 
|         return billboard  | 
|       | 
| def GetBillboardMgr():  | 
|     if PyGameData.g_billboardMgrMgr:  | 
|         billMgr = PyGameData.g_billboardMgrMgr  | 
|     else:  | 
|         billMgr = BillboardMgr()  | 
|         PyGameData.g_billboardMgrMgr = billMgr  | 
|     return billMgr  | 
|   | 
| def NoteOssBillboardInfoByDay():  | 
|     ## Ã¿Ìì¼Ç¼ÅÅÐаñÐÅÏ¢µ½ossÖÐ  | 
|     if GameWorld.IsCrossServer():  | 
|         return  | 
|     Def_NoteOssBillboardTypeList = IpyGameDataPY.GetFuncEvalCfg("BillboardSet", 1)  | 
|     for billboardType in Def_NoteOssBillboardTypeList:  | 
|         DataRecordPack.DR_BillboardData(billboardType, "OnDay")  | 
|     return  | 
|   | 
| def CopyBillboardOnDay():  | 
|     ## Ã¿Ì쿽±´Ð¾ÉÅÅÐаñÊý¾Ý  | 
|       | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|     for billboardType in ShareDefine.BillboardTypeList:  | 
|         if not gameWorld.GetDictByKey(Def_Key_BillboardNeedSort % billboardType):  | 
|             continue  | 
|         gameWorld.SetDict(Def_Key_BillboardNeedSort % billboardType, 0)  | 
|         GameWorld.Log("OnDay SortBillboardByIndex %s" % billboardType)  | 
|         SortBillboardByIndex(billboardType)  | 
|           | 
|     for billboardTypeYesterday, billboardType  in Def_NeedCopyYesterday_Dict.items():  | 
|         CopyBillboard(billboardTypeYesterday, billboardType)  | 
|     return  | 
|   | 
| def InitServerBillboard():  | 
|     ##³õʼ»¯ËùÓÐÅÅÐаñ  | 
|     billboardMgr = GameWorld.GetBillboard()  | 
|       | 
|     for index in xrange(ShareDefine.Def_BT_Max):  | 
|         billBoard = billboardMgr.AddBillboard(index)  | 
|         #ÉèÖÃ×î´óÊýÁ¿  | 
|         billBoard.SetMaxCount(ChConfig.Def_BT_Cnt.get(index, 10))  | 
|         #ÉèÖñ£´æÀàÐÍ  | 
|         billBoard.SetSaveToDB(ChConfig.Def_BT_SaveType.get(index, ChConfig.Def_BT_SaveType_SaveDB))  | 
|           | 
|     return  | 
|   | 
| def SortServerBillboard():  | 
|     ##ÅÅÐòËùÓÐÅÅÐаñ  | 
|     billboardMgr = GameWorld.GetBillboard()  | 
|       | 
|     for index in range(0, billboardMgr.GetCount()):  | 
|         billBoard = billboardMgr.FindBillboard(index)  | 
|         #ÅÅÐòÒ»´ÎÅÅÐаñ  | 
|         billBoard.Sort()  | 
|           | 
|     return  | 
|   | 
| def CopyBillboard(newBillboardIndex, oldBillboardIndex):  | 
|     ## ÔÑù¿½±´ÅÅÐаñ  | 
|     #  @param newBillboardIndex: Ð°ñË÷Òý  | 
|     #  @param oldBillboardIndex: ¾É°ñË÷Òý  | 
|     #  @return: boolÖµ  | 
|     #¾É°ñÅÅÐÐ  | 
|     oldBillBoard = GameWorld.GetBillboard().FindBillboard(oldBillboardIndex)  | 
|     if not oldBillBoard:  | 
|         return False  | 
|       | 
|     #Çå¿ÕаñÊý¾Ý  | 
|     ClearBillboardByIndex(newBillboardIndex)  | 
|       | 
|     for index in range(0, oldBillBoard.GetCount()):  | 
|           | 
|         oldBillBoardData = oldBillBoard.At(index)  | 
|         if not oldBillBoardData:  | 
|             continue  | 
|           | 
|         id = oldBillBoardData.GetID()  | 
|         id2 = oldBillBoardData.GetID2()  | 
|         name1 = oldBillBoardData.GetName1()  | 
|         name2 = oldBillBoardData.GetName2()  | 
|         type2 = oldBillBoardData.GetType2()  | 
|         value1 = oldBillBoardData.GetValue1()  | 
|         value2 = oldBillBoardData.GetValue2()  | 
|         value3 = oldBillBoardData.GetValue3()  | 
|         value4 = oldBillBoardData.GetValue4()  | 
|         value5 = oldBillBoardData.GetValue5()  | 
|         value6 = oldBillBoardData.GetValue6()  | 
|         value7 = oldBillBoardData.GetValue7()  | 
|         value8 = oldBillBoardData.GetValue8()  | 
|         cmpValue = oldBillBoardData.GetCmpValue()  | 
|         cmpValue2 = oldBillBoardData.GetCmpValue2()  | 
|         cmpValue3 = oldBillBoardData.GetCmpValue3()  | 
|         userData = oldBillBoardData.GetUserData()  | 
|   | 
|         #---»ñÈ¡ÅÅÐаñÐÅÏ¢---  | 
|         billBoard, billBoardData = GetBillBoardData(newBillboardIndex, id, cmpValue)  | 
|         if billBoard == None or billBoardData == None:  | 
|             #ÎÞ·¨Éϰñ  | 
|             continue  | 
|       | 
|         #ÉèÖÃÅÅÐаñÊý¾Ý  | 
|         billBoardData.SetType(newBillboardIndex)  | 
|         billBoardData.SetID(id)  | 
|         billBoardData.SetID2(id2)  | 
|         billBoardData.SetName1(name1)  | 
|         billBoardData.SetName2(name2)  | 
|         billBoardData.SetType2(type2)  | 
|         billBoardData.SetValue1(value1)  | 
|         billBoardData.SetValue2(value2)  | 
|         billBoardData.SetValue3(value3)  | 
|         billBoardData.SetValue4(value4)  | 
|         billBoardData.SetValue5(value5)  | 
|         billBoardData.SetValue6(value6)  | 
|         billBoardData.SetValue7(value7)  | 
|         billBoardData.SetValue8(value8)  | 
|         billBoardData.SetCmpValue(cmpValue)  | 
|         billBoardData.SetCmpValue2(cmpValue2)  | 
|         billBoardData.SetCmpValue3(cmpValue3)  | 
|         billBoardData.SetUserData(userData)  | 
|         billBoardData.SetDataLen(len(userData))  | 
|           | 
|     GameWorld.Log("    CopyBillboard newBillboardIndex=%s, oldBillboardIndex=%s" % (newBillboardIndex, oldBillboardIndex))  | 
|   | 
|     return True  | 
|   | 
| def ClearBillboardByIndex(billboardIndex):  | 
|     ##Çå¿ÕÅÅÐаñ  | 
|     billBoard = GameWorld.GetBillboard().FindBillboard(billboardIndex)  | 
|       | 
|     if not billBoard:  | 
|         GameWorld.ErrLog('ClearBillboardByIndex FindBillboardErr, ÅÅÐаñ = %s ÎÞ·¨²éÕÒ'%(billboardIndex))  | 
|         return  | 
|       | 
|     billBoard.Clear()  | 
|       | 
|     GameWorld.Log('billboardIndex %s clear.'%billboardIndex)  | 
|     return  | 
|   | 
| def UpdateBillboardMaxCount(billboardIndex, updMaxCount, isDelExtra=True):  | 
|     ''' ±ä¸ü¾º¼¼³¡°ñµ¥×î´óÊý¾ÝÊý  | 
|     @param updMaxCount: ¸üеÄ×î´óÊý¾ÝÅÅÃû  | 
|     @param isDelExtra: ÊÇ·ñɾ³ýÔ°ñµ¥ÅÅÃûÊý¾Ý³¬¹ý¸üкóµÄ×î´óÅÅÃû£¬Ä¬ÈÏɾ³ý  | 
|     '''  | 
|     billBoard = GameWorld.GetBillboard().FindBillboard(billboardIndex)  | 
|     if not billBoard:  | 
|         return  | 
|     curCount = billBoard.GetCount()  | 
|     curMaxCount = billBoard.GetMaxCount()  | 
|     # ²»³¬¹ý³ÌÐòÄÚÖÃÅäÖõÄ×î´óÊýÁ¿  | 
|     if billboardIndex in ChConfig.Def_BT_Cnt:  | 
|         updMaxCount = min(updMaxCount, ChConfig.Def_BT_Cnt[billboardIndex])  | 
|     if curMaxCount == updMaxCount:  | 
|         return  | 
|     billBoard.SetMaxCount(updMaxCount)  | 
|     GameWorld.Log("    ±ä¸ü°ñµ¥×î´óÊý¾ÝÊý! billboardIndex=%s,curCount=%s,curMaxCount=%s,updMaxCount=%s"   | 
|                   % (billboardIndex, curCount, curMaxCount, updMaxCount))  | 
|       | 
|     # Çå³ý¶àÓà°ñµ¥Êý¾Ý  | 
|     if isDelExtra and curCount > updMaxCount:  | 
|         for delIndex in xrange(curCount - 1, updMaxCount - 1, -1):  | 
|             if delIndex >= 0:  | 
|                 GameWorld.Log("        DeleteByIndex: %s" % delIndex)  | 
|                 billBoard.DeleteByIndex(delIndex)  | 
|     return  | 
|   | 
| ####################################################################################################  | 
|   | 
| #class   IPY_GSetWatchBillboardState  | 
| #{  | 
| #public:  | 
| #  | 
| #    int      GetState();  | 
| #};  | 
| ## mapÇëÇóÍæ¼ÒÉèÖò鿴ÅÅÐаñ״̬  | 
| #  @param index Íæ¼ÒË÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def MapServer_PlayerSetWatchBillboardState(index, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     pack = IPY_GameServer.IPY_GSetWatchBillboardState()  | 
|     curPlayer.SetPlayerWatchBillboardState(pack.GetState())  | 
|     return  | 
|   | 
| #class   IPY_GWatchBillboard  | 
| #{  | 
| #public:  | 
| #  | 
| #    int      GetType();  | 
| #};  | 
| ## mapÇëÇóÍæ¼Ò²é¿´ÅÅÐаñ״̬  | 
| #  @param index Íæ¼ÒË÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def MapServer_PlayerWatchBillboard(index, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     pack = IPY_GameServer.IPY_GWatchBillboard()  | 
|     curPlayer.Sync_Billboard(pack.GetType())  | 
|     return  | 
|   | 
| #//////////////////////////////////////////////////////////////  | 
| #//10 01 ²é¿´ÅÅÐаñ#tagCWatchBillboard  | 
| #tagCWatchBillboard       *   GettagCWatchBillboard();  | 
| #  | 
| #class   IPY_CWatchBillboard  | 
| #{  | 
| #public:  | 
| #    //ÀàÐÍ TBillboardType  | 
| #    int      GetType();  | 
| #};  | 
| ## ²é¿´Íæ¼ÒÅÅÐаñ  | 
| #  @param index Íæ¼ÒË÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def WatchPlayerBillboard(index, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     pack = IPY_GameServer.IPY_CWatchBillboard()  | 
|     packType = pack.GetType()  | 
|       | 
|     if packType < 0 or packType >= ShareDefine.Def_BT_Max:  | 
|         return  | 
|   | 
|     if packType in ChConfig.Def_InterdictLook_BT_Type:  | 
|         #²»¿Éͨ¹ý´Ë·â°ü²é¿´  | 
|         return  | 
|     if ChConfig.Def_BT_Cnt.get(packType, 0) > 100:  | 
|         GameWorld.DebugLog("¸Ã°ñµ¥×î´óÃû´Î½Ï´ó£¬ÐèʹÓ÷ÖÒ³²éѯ! A9 A2 ²é¿´ÅÅÐаñ#tagCPYWatchBillboard")  | 
|         return  | 
|     if not __CheckWatchCD(curPlayer, packType, tick):  | 
|         return  | 
|       | 
|     if GameWorld.GetGameWorld().GetDictByKey(Def_Key_BillboardNeedSort % packType):  | 
|         GameWorld.GetGameWorld().SetDict(Def_Key_BillboardNeedSort % packType, 0)  | 
|         #GameWorld.DebugLog("Íæ¼Ò²é¿´ÅÅÐаñ£¬Ç¿ÖÆÅÅÐò£¡packType=%s" % (packType))  | 
|         SortBillboardByIndex(packType)  | 
|           | 
|     curPlayer.Sync_Billboard(packType)  | 
| #    GameWorld.Log('packType1111=%s'%packType)  | 
|     return  | 
|   | 
| def __CheckWatchCD(curPlayer, billboardType, tick):  | 
|     ##¼ì²é²é¿´ÅÅÐаñCD ¸ù¾ÝÅÅÐаñÀàÐͶÀÁ¢CD  | 
|     dictKey = "WatchRankTick_%s"%billboardType  | 
|     lastTick = curPlayer.GetDictByKey(dictKey)  | 
|       | 
|     #µÚÒ»´Î¼Ç¼  | 
|     if not lastTick:  | 
|         curPlayer.SetDict(dictKey, tick)  | 
|         return True  | 
|       | 
|     #¼ä¸ôδµ½  | 
|     if tick - lastTick < ChConfig.Def_PlayerBillboard_Tick:  | 
|         #ʱ¼äδµ½  | 
|         return False  | 
|       | 
|     curPlayer.SetDict(dictKey, tick)  | 
|     return True  | 
|   | 
| #---------------------------------------------------------------------  | 
| #===============================================================================  | 
| # //10 02 ½±Àø°ñÊý¾Ý#tagCWatchBillboardPrize  | 
| # tagCWatchBillboardPrize       *   GettagCWatchBillboardPrize();  | 
| #   | 
| # class   IPY_CWatchBillboardPrize  | 
| # {  | 
| # public:  | 
| #    //ÀàÐÍ TBillboardType  | 
| #    int      GetType();  | 
| # };  | 
| #===============================================================================  | 
| ## ½±Àø°ñÊý¾Ý  | 
| #  @param index Íæ¼ÒË÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def WatchBillboardPrize(index, tick):  | 
|     #´Ë½Ó¿Ú·ÏÆú  | 
|     return  | 
| #===============================================================================  | 
| #    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
| #    pack = IPY_GameServer.IPY_CWatchBillboardPrize()  | 
| #    packType = pack.GetType()  | 
| #      | 
| #    if packType < IPY_GameServer.btLV or packType >= IPY_GameServer.btMax:  | 
| #        return  | 
| #      | 
| #    gameWorld = GameWorld.GetGameWorld()  | 
| #      | 
| #    if tick - gameWorld.GetTickByType(ChConfig.TYPE_WatchBillboardPrize) < ChConfig.TYPE_Tick_Time[ChConfig.TYPE_WatchBillboardPrize]:  | 
| #        return  | 
| #      | 
| #    gameWorld.SetTickByType(ChConfig.TYPE_WatchBillboardPrize , tick)  | 
| #    #Í¨ÖªÍæ¼Ò½±Àø°ñÐÅÏ¢  | 
| #    curPlayer.Sync_BillboardPrize(packType)  | 
| #===============================================================================  | 
| #---------------------------------------------------------------------  | 
| ##ÅÅÐòÅÅÐаñ, Í¨¹ýÅÅÐаñË÷Òý  | 
| # @param billboardIndex ÅÅÐаñË÷Òý  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks   | 
| def SortBillboardByIndex(billboardIndex):  | 
|     billBoard = GameWorld.GetBillboard().FindBillboard(billboardIndex)  | 
|       | 
|     if not billBoard:  | 
|         GameWorld.ErrLog('SortBillboardByIndex, ÅÅÐаñ = %s ÎÞ·¨²éÕÒ'%(billboardIndex))  | 
|         return  | 
|       | 
|     billBoard.Sort()  | 
|     return  | 
|   | 
| #// A9 A2 ²é¿´ÅÅÐаñ#tagCPYWatchBillboard  | 
| #  | 
| #struct    tagCPYWatchBillboard  | 
| #{  | 
| #    tagHead        Head;  | 
| #    BYTE        Type;        //ÀàÐÍ TBillboardType  | 
| #    DWORD        StartIndex;    //²é¿´µÄÆðʼÃû´ÎË÷Òý£¬ Ä¬ÈÏ0  | 
| #    BYTE        WatchCnt;    //²é¿´ÌõÊý£¬Ä¬ÈÏ20£¬×î´ó²»³¬¹ý100  | 
| #    DWORD        WatchID;        //²é¿´Ö¸¶¨IDÃû´Îǰºó£¬ÈçÍæ¼ÒID¡¢¼Ò×åIDµÈ  | 
| #};  | 
| def Client_PYWatchBillboard(index, clientData, tick):  | 
|       | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     if not curPlayer:  | 
|         return  | 
|       | 
|     packType = clientData.Type  | 
|     startIndex = clientData.StartIndex  | 
|     watchCnt = clientData.WatchCnt  | 
|     watchID = clientData.WatchID  | 
|     #if not __CheckWatchCD(curPlayer, packType, tick):  | 
|     #    return  | 
|       | 
|     if GameWorld.GetGameWorld().GetDictByKey(Def_Key_BillboardNeedSort % packType):  | 
|         GameWorld.GetGameWorld().SetDict(Def_Key_BillboardNeedSort % packType, 0)  | 
|         #GameWorld.DebugLog("Íæ¼Ò²é¿´ÅÅÐаñ£¬Ç¿ÖÆÅÅÐò£¡packType=%s" % (packType))  | 
|         SortBillboardByIndex(packType)  | 
|           | 
|     Sync_BillboardEx(curPlayer, packType, watchID, startIndex, watchCnt)  | 
|     return  | 
|   | 
| def Sync_BillboardEx(curPlayer, bbType, watchID=0, startIndex=0, watchCnt=20):  | 
|     if bbType < 0 or bbType >= ShareDefine.Def_BT_Max:  | 
|         return  | 
|       | 
|     billBoard = GameWorld.GetBillboard().FindBillboard(bbType)  | 
|     if not billBoard:  | 
|         GameWorld.ErrLog("ÕÒ²»µ½ÅÅÐаñÊý¾Ý£¡bbType=%s" % (bbType))  | 
|         return  | 
|       | 
|     #playerID = curPlayer.GetPlayerID()  | 
|     count = billBoard.GetCount()  | 
|     endIndex = 0  | 
|     # ²é¿´×Ô¼ºÇ°ºóÃû´Î  | 
|     if watchID:  | 
|         playerIndex = billBoard.IndexOfByID(watchID)  | 
|         if playerIndex != -1:  | 
|             # Ç°5ºó4£¬Ê×β²¹×ã10Ìõ¼Ç¼  | 
|             endIndex = min(playerIndex + 5, count)  | 
|             startIndex = max(0, endIndex - 10)  | 
|             endIndex = min(endIndex + (10 - (endIndex - startIndex)), count)  | 
|         else:  | 
|             startIndex = 0  | 
|               | 
|     # Ö¸¶¨Ë÷Òý·ÖÒ³²é¿´  | 
|     else:  | 
|         startIndex = max(startIndex, 0)  | 
|         startIndex = min(startIndex, count)  | 
|         watchCnt = 20 if not watchCnt else min(watchCnt, 100) # Ä¬ÈÏ20£¬×î¶à100  | 
|         endIndex = min(startIndex + watchCnt, count)  | 
|           | 
|     billboardMgr = GetBillboardMgr()  | 
|     billboardObj = billboardMgr.GetBillboardObj(bbType)  | 
|     idOrderDict = billboardObj.GetIDOrderDict()  | 
|       | 
|     billBoardData = ChPyNetSendPack.tagPYBillboardData()  | 
|     billBoardData.Clear()  | 
|     billBoardData.WatchID = watchID  | 
|     billBoardData.Type = bbType  | 
|     billBoardData.Billboard = []      | 
|     for index in xrange(startIndex, endIndex):  | 
|           | 
|         if startIndex < 0 or index >= count:  | 
|             break  | 
|           | 
|         bbData = billBoard.At(index)  | 
|           | 
|         bbInfo = ChPyNetSendPack.tagPYBillboardInfo()  | 
|         bbInfo.Clear()  | 
|         bbInfo.OrderIndex = idOrderDict.get(bbData.GetID(), index + 1) - 1  | 
|         bbInfo.ID = bbData.GetID()  | 
|         bbInfo.ID2 = bbData.GetID2()  | 
|         bbInfo.Name1 = bbData.GetName1()  | 
|         bbInfo.Name2 = bbData.GetName2()  | 
|         bbInfo.Type2 = bbData.GetType2()  | 
|         bbInfo.Value1 = bbData.GetValue1()  | 
|         bbInfo.Value2 = bbData.GetValue2()  | 
|         bbInfo.Value3 = bbData.GetValue3()  | 
|         bbInfo.Value4 = bbData.GetValue4()  | 
|         bbInfo.Value5 = bbData.GetValue5()  | 
|         bbInfo.Value6 = bbData.GetValue6()  | 
|         bbInfo.Value7 = bbData.GetValue7()  | 
|         bbInfo.Value8 = bbData.GetValue8()  | 
|         bbInfo.CmpValue = bbData.GetCmpValue()  | 
|         bbInfo.CmpValue2 = bbData.GetCmpValue2()  | 
|         bbInfo.CmpValue3 = bbData.GetCmpValue3()  | 
|         bbInfo.UserData = bbData.GetUserData()  | 
|         bbInfo.DataLen = len(bbInfo.UserData)  | 
|           | 
|         billBoardData.Billboard.append(bbInfo)  | 
|           | 
|     billBoardData.BillboardCount = len(billBoardData.Billboard)  | 
|     NetPackCommon.SendFakePack(curPlayer, billBoardData)  | 
|     return  | 
|   | 
| #===============================================================================  | 
| def MapServer_UpdateBillboard(billInfoDict, tick):  | 
|     '''µØÍ¼¸üÐÂÅÅÐаñ, Í¨Óà  | 
|     {"Type":bType, "Type2":bType2, "ID":bID, "ID2":bID2, "Name1":bName, "Name2":bName2, "ExInfo":exInfo,  | 
|     "Value1":value1, "Value2":value2, "CmpValue":cmpValue, "CmpValue2":cmpValue2, "CmpValue3":cmpValue3, "autoSort":autoSort}  | 
|     '''  | 
|       | 
|     bType = billInfoDict["Type"]  | 
|     bType2 = billInfoDict["Type2"]  | 
|     bID = billInfoDict["ID"]  | 
|     #bID2 = billInfoDict["ID2"]  | 
|     bName = billInfoDict["Name1"]  | 
|     bName2 = billInfoDict["Name2"]  | 
|     value1 = billInfoDict["Value1"]  | 
|     value2 = billInfoDict["Value2"]  | 
|     value3 = billInfoDict.get("Value3", 0)  | 
|     value4 = billInfoDict.get("Value4", 0)  | 
|     value5 = billInfoDict.get("Value5", 0)  | 
|     value6 = billInfoDict.get("Value6", 0)  | 
|     value7 = billInfoDict.get("Value7", 0)  | 
|     value8 = billInfoDict.get("Value8", 0)  | 
|     cmpValue = billInfoDict["CmpValue"]  | 
|     cmpValue2 = billInfoDict["CmpValue2"]  | 
|     cmpValue3 = billInfoDict["CmpValue3"]  | 
|     userData = billInfoDict.get("UserData", "")  | 
|     if bType not in ShareDefine.BillboardTypeList:  | 
|         return  | 
|     #if not cmpValue and not cmpValue2 and not cmpValue3:  | 
|     #    return  | 
|     kwargs = {"value3":value3, "value4":value4, "value5":value5, "value6":value6, "value7":value7, "value8":value8, "userData":userData}  | 
|       | 
|     #ɾ³ý¸ÃÊý¾Ý  | 
|     if cmpValue == -1:  | 
|         billboardMgr = GameWorld.GetBillboard()  | 
|         playerBillBoard = billboardMgr.FindBillboard(bType)  | 
|         if not playerBillBoard:  | 
|             return  | 
|         if playerBillBoard.FindByID(bID):  | 
|             playerBillBoard.DeleteByID(bID)  | 
|             playerBillBoard.Sort()  | 
|             GameWorld.DebugLog("ɾ³ýÅÅÐаñijÌõÊý¾Ý: bType=%s,bID=%s" % (bType, bID))  | 
|         return  | 
|       | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|     lastSortTick = gameWorld.GetDictByKey(Def_Key_BillboardSortTick % bType)  | 
|     autoSort = (tick - lastSortTick) >= 60000 or billInfoDict.get("autoSort") == True # 1·ÖÖÓÇ¿ÖÆÅÅÐòÒ»´Î  | 
|     if autoSort:  | 
|         gameWorld.SetDict(Def_Key_BillboardSortTick % bType, tick)  | 
|     #GameWorld.DebugLog("¸üÐÂÅÅÐаñ£ºbType=%s,autoSort=%s,tick=%s,lastSortTick=%s,d=%s" % (bType, autoSort, tick, lastSortTick, tick - lastSortTick))  | 
|       | 
|     UpdatePlayerBillboard(bID, bName, bName2, bType, bType2, value1, value2, cmpValue, autoSort, cmpValue2, cmpValue3, **kwargs)  | 
|       | 
|     exInfo = billInfoDict["ExInfo"]  | 
|     # ÒÔÏÂΪ°ñµ¥¸½¼ÓÌØÊâ´¦Àí  | 
|     if bType == ShareDefine.Def_BT_FightPower:  | 
|         playerID = bID  | 
|         fightPowerTotal = cmpValue * ChConfig.Def_PerPointValue + cmpValue2  | 
|         familyID = exInfo[0]  | 
|         playerJob = bType2  | 
|           | 
|         curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)  | 
|         if curPlayer:  | 
|             PlayerControl.SetFightPower(curPlayer, fightPowerTotal)  | 
|               | 
|         #¸üÐÂÕ½Ã˳ÉÔ±Õ½Á¦  | 
|         PlayerFamily.UpdFamilyMemberFightPower(familyID, playerID, fightPowerTotal)  | 
|           | 
|         #Ö°ÒµÕ½Á¦°ñ  | 
|         job = playerJob % 10  | 
|         if job in ShareDefine.JobFightPowerBillboardDict:  | 
|             jobBType = ShareDefine.JobFightPowerBillboardDict[job]  | 
|             UpdatePlayerBillboard(bID, bName, bName2, jobBType, bType2, value1, value2, cmpValue, autoSort, cmpValue2, **kwargs)  | 
|               | 
|     return  | 
|   | 
| def DelJobFightPowerBillboard(curPlayer, delJob):  | 
|     ## É¾³ýÍæ¼Ò¶ÔÓ¦Ö°ÒµÕ½Á¦°ñ  - Ò»°ãÊÇÍæ¼ÒÖ°Òµ¸Ä±äÁË£¬ÐèҪɾ³ý¾ÉÖ°ÒµµÄÖ°ÒµÕ½Á¦°ñµ¥  | 
|     if delJob not in ShareDefine.JobFightPowerBillboardDict:  | 
|         return  | 
|     jobBType = ShareDefine.JobFightPowerBillboardDict[delJob]  | 
|     playerID = curPlayer.GetPlayerID()  | 
|     billboardMgr = GameWorld.GetBillboard()  | 
|     playerBillBoard = billboardMgr.FindBillboard(jobBType)  | 
|     if not playerBillBoard:  | 
|         return  | 
|     if playerBillBoard.FindByID(playerID):  | 
|         playerBillBoard.DeleteByID(playerID)  | 
|         GameWorld.DebugLog("ɾ³ýÍæ¼ÒÖ°ÒµÕ½Á¦°ñµ¥: delJob=%s,jobBType=%s" % (delJob, jobBType), playerID)  | 
|     return  | 
|   | 
| def GetBillboardOperateInfo(curPlayer):  | 
|     # ÅÅÐаñÖÐËù±£´æµÄÔËÓªÉÌÏà¹ØÐÅÏ¢  | 
|     platform = curPlayer.GetAccID()  | 
|     if platform in ["tencent"]:  | 
|         return curPlayer.GetOperateInfo()  | 
|     return platform  | 
|   | 
| def UpdateFamilyBillboard(bType, familyBillInfo, cmpValue, cmpValue2=0):  | 
|     ## ¸üÐÂÏÉÃËÅÅÐаñ  | 
|     if "id" not in familyBillInfo:  | 
|         return  | 
|     familyID = familyBillInfo["id"]  | 
|     familyName = familyBillInfo["name"]  | 
|     id2 = familyBillInfo["id2"]  | 
|     name2 = familyBillInfo["name2"]  | 
|     value1 = familyBillInfo["value1"]  | 
|     value2 = familyBillInfo["value2"]  | 
|     value3 = familyBillInfo["value3"]  | 
|     value4 = familyBillInfo["value4"]  | 
|     value5 = familyBillInfo["value5"]  | 
|     type2 = 0  | 
|     autoSort = True  | 
|     UpdatePlayerBillboard(familyID, familyName, name2, bType, type2, value1, value2, cmpValue, autoSort, cmpValue2,   | 
|                           id2=id2, value3=value3, value4=value4, value5=value5)  | 
|     return  | 
|   | 
| def UpdatePlayerBillboardEx(curPlayer, playerID, bType, cmpValue, cmpValue2=0, cmpValue3=0, value1=0, value2=0, autoSort=False):  | 
|     ## ¸üÐÂÍæ¼ÒÅÅÐаñ  | 
|     # @param curPlayer: ¿ÉÄÜΪNone  | 
|       | 
|     playerOpInfo = ""  | 
|     playerJob = 0  | 
|     playerName = ""  | 
|     playerRealmLV = 0  | 
|     face = 0  | 
|     facePic = 0  | 
|       | 
|     if curPlayer:  | 
|         playerID = curPlayer.GetID()  | 
|         playerJob = curPlayer.GetJob()  | 
|         playerName = curPlayer.GetName()  | 
|         playerRealmLV = curPlayer.GetOfficialRank()  | 
|         playerOpInfo = GetBillboardOperateInfo(curPlayer)  | 
|         face = curPlayer.GetFace()  | 
|         facePic = curPlayer.GetFacePic()  | 
|     else:  | 
|         socialPlayer = PyDataManager.GetPersonalSocialManager().GetSocialPlayer(playerID)  | 
|         if socialPlayer:  | 
|             playerJob = socialPlayer.playerInfo.Job  | 
|             playerName = socialPlayer.playerInfo.PlayerName  | 
|             playerRealmLV = socialPlayer.playerInfo.RealmLV  | 
|             face = socialPlayer.playerInfo.Face  | 
|             facePic = socialPlayer.playerInfo.FacePic  | 
|         else:  | 
|             curCache = PlayerViewCache.FindViewCache(playerID)  | 
|             if curCache:  | 
|                 cacheDict = PlayerViewCache.GetCachePropDataDict(curCache)  | 
|                 playerJob = cacheDict["Job"]  | 
|                 playerName = cacheDict["Name"]  | 
|                 playerRealmLV = cacheDict["RealmLV"]  | 
|                 face = cacheDict.get("Face", 0)  | 
|                 facePic = cacheDict.get("FacePic", 0)  | 
|                   | 
|     if not playerName and playerID < 10000:  | 
|         playerJob = random.choice([1, 2])  | 
|         playerName = "testName%s" % playerID  | 
|         playerRealmLV = random.randint(1, 10)  | 
|           | 
|     if bType in ShareDefine.BTValue1_OfficialRankList:  | 
|         value1 = playerRealmLV  | 
|           | 
|     tick = GameWorld.GetGameWorld().GetTick()  | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|     lastSortTick = gameWorld.GetDictByKey(Def_Key_BillboardSortTick % bType)  | 
|     autoSort = ((tick - lastSortTick) >= 60000 or autoSort) # 1·ÖÖÓÇ¿ÖÆÅÅÐòÒ»´Î  | 
|     if autoSort:  | 
|         gameWorld.SetDict(Def_Key_BillboardSortTick % bType, tick)  | 
|           | 
|     UpdatePlayerBillboard(playerID, playerName, playerOpInfo, bType, playerJob, value1, value2, cmpValue, autoSort, cmpValue2, cmpValue3, value3=face, value4=facePic)  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| #===============================================================================  | 
| #    void        SetType(int inputType);    //_I_KEY_INDEX_ÅÅÐаñÀàÐÍ  | 
| #   | 
| #    void        SetID(int inputID);    //_KEY_ÅÅÐò¶ÔÏóID£¬Òª±£Ö¤ÊÇΨһµÄ  | 
| #   | 
| #    void        SetID2(int inputID2);    //²»Ò»¶¨ÄÜÓÃÉÏ£¬Ä¿Ç°Óû§¸½¼ÓID,±ÈÈçNPCID   | 
| #   | 
| #    void        SetName1(char * inputName1);    //Ãû×Ö1£¬ÓÃÀ´ÏÔʾÅÅÐò¶ÔÏóÃû×Ö   | 
| #   | 
| #    void        SetName2(char * inputName2);    //Ãû×Ö2£¬¸½¼ÓÃû×Ö£¬Ô¤Áô  | 
| #   | 
| #    void        SetType2(int inputType2);    //¸½¼ÓÀàÐÍ£¬ÓÃÀ´±íʾÅÅÐò¶ÔÏóµÄÀàÐÍ£¬±ÈÈç£¬Íæ¼ÒËùÊôÖ°ÒµÃÅÅÉ£¬³èÎïÀàÐÍµÈ  | 
| #   | 
| #    void        SetValue1(int inputValue1);    //ÅÅÐòÒÀÀµµÄÖµ£¬±ÈÈ磬µÈ¼¶  | 
| #   | 
| #    void        SetValue2(int inputValue2);    //ÅÅÐòÒÀÀµµÄÖµ£¬±ÈÈ磬ս¶·Á¦  | 
| #   | 
| #    void        SetCmpValue(int inputCmpValue);    // ±È½ÏȨֵ£¬ÓɾßÌåµÄ¼ÆË㹫ʽ£¨²ß»®¸ø£©Ëã³öÀ´  | 
| #===============================================================================  | 
| ##¸üнÇÉ«ÅÅÐаñ..  | 
| # @param curPlayerID Íæ¼ÒID  | 
| # @param curPlayerName Íæ¼ÒÃû×Ö  | 
| # @param curPlayerOpInfo Íæ¼Òƽ̨ÐÅÏ¢  | 
| # @param billboardIndex ÅÅÐаñË÷Òý  | 
| # @param billboardType ÅÅÐаñ¸½ÊôÀàÐÍ  | 
| # @param value1 ÅÅÐаñÖµ1  | 
| # @param value2 ÅÅÐаñÖµ2  | 
| # @param cmpValue ¼ÓȨֵ  | 
| # @param autoSort ÊÇ·ñ×Ô¶¯ÅÅÐò  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks ¸üнÇÉ«ÅÅÐаñ.  | 
| def UpdatePlayerBillboard(curPlayerID, name1, name2, billboardIndex, type2, value1, value2, cmpValue,   | 
|                           autoSort = True, cmpValue2 = 0, cmpValue3 = 0, **kwargs):  | 
|       | 
|     playerBillBoard, playerBillBoardData = GetBillBoardData(billboardIndex, curPlayerID, cmpValue, cmpValue2, cmpValue3)  | 
|       | 
|     if playerBillBoard == None or playerBillBoardData == None:  | 
|         #ÎÞ·¨Éϰñ  | 
|         return False  | 
|       | 
|     isNewData = playerBillBoardData.GetID2() == 0 # ÊÇ·ñÊÇÐÂÔöµÄÊý¾Ý  | 
|     cmpValueChange = isNewData or playerBillBoardData.GetCmpValue() != cmpValue or playerBillBoardData.GetCmpValue2() != cmpValue2 \  | 
|         or (cmpValue3 and playerBillBoardData.GetCmpValue3() != cmpValue3)  | 
|     if cmpValue3 == 0:  | 
|         if cmpValueChange:  | 
|             # Ê±¼äȨֵ½öÔڱȽÏÖµ±ä¸üµÄÇé¿öϲŸüÐÂ, ·ÀÖ¹ÆäËû¸½ÊôÖµ¸üÐÂʱµ¼Ö±ȽÏÖµÏàͬµÄÍæ¼ÒÃû´Î¼ä»á±ä¶¯µÄÎÊÌâ  | 
|             calcTime = GameWorld.ChangeTimeStrToNum("2080-01-01 00:00:00")  | 
|             cmpValue3 = max(0, calcTime - int(time.time())) # ±È½ÏÖµ3Èç¹ûûָ¶¨ÖµÔòĬÈϴ浱ǰ¸üеÄtime  | 
|         else:  | 
|             cmpValue3 = playerBillBoardData.GetCmpValue3()  | 
|               | 
|     #ÉèÖÃÅÅÐаñÊý¾Ý  | 
|     playerBillBoardData.SetType(billboardIndex)  | 
|     #¸½ÊôÀàÐÍ  | 
|     playerBillBoardData.SetType2(type2)  | 
|     playerBillBoardData.SetID(curPlayerID)  | 
|     playerBillBoardData.SetID2(kwargs.get("id2", curPlayerID))  | 
|     playerBillBoardData.SetName1(name1)  | 
|     playerBillBoardData.SetName2(str(name2))  | 
|     #SetValue1´æ´¢¿Õ¼äΪWord  | 
|     playerBillBoardData.SetValue1(value1)  | 
|     #SetValue2´æ´¢¿Õ¼äΪDWord  | 
|     playerBillBoardData.SetValue2(value2)  | 
|     playerBillBoardData.SetValue3(kwargs.get("value3", 0))  | 
|     playerBillBoardData.SetValue4(kwargs.get("value4", 0))  | 
|     playerBillBoardData.SetValue5(kwargs.get("value5", 0))  | 
|     playerBillBoardData.SetValue6(kwargs.get("value6", 0))  | 
|     playerBillBoardData.SetValue7(kwargs.get("value7", 0))  | 
|     playerBillBoardData.SetValue8(kwargs.get("value8", 0))  | 
|     playerBillBoardData.SetUserData(kwargs.get("userData", ""))  | 
|     playerBillBoardData.SetDataLen(len(playerBillBoardData.GetUserData()))  | 
|     playerBillBoardData.SetCmpValue(cmpValue)  | 
|     playerBillBoardData.SetCmpValue2(cmpValue2)  | 
|     if cmpValue3 > 0:  | 
|         playerBillBoardData.SetCmpValue3(cmpValue3)  | 
|           | 
|     GameWorld.DebugLog("¸üÐÂÅÅÐаñÖµ index=%s,type2=%s,value1=%s,value2=%s,cmpValue=%s,cmpValue2==%s,cmpValue3==%s,isNewData=%s,cmpValueChange=%s,%s"   | 
|                        % (billboardIndex, type2, value1, value2, cmpValue, cmpValue2, cmpValue3, isNewData, cmpValueChange, kwargs), curPlayerID)  | 
|     if not cmpValueChange:  | 
|         return True  | 
|       | 
|     billboardMgr = GetBillboardMgr()  | 
|     billboardObj = billboardMgr.GetBillboardObj(billboardIndex)  | 
|     billboardObj.OnBillboardChange()  | 
|       | 
|     if not autoSort:  | 
|         #²»×Ô¶¯ÅÅÐò  | 
|         GameWorld.GetGameWorld().SetDict(Def_Key_BillboardNeedSort % billboardIndex, 1) # ÉèÖÃÐèҪϴβ鿴ÐèÒªÏÈÅÅÐò  | 
|         return True  | 
|       | 
|     #ÖØÐÂÅÅÐòÅÅÐаñ  | 
|     playerBillBoard.Sort()  | 
|     return True  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##ÊÇ·ñ¿ÉÒÔ½øÈëÅÅÐаñ  | 
| # @param playerBillBoard ÅÅÐаñʵÀý  | 
| # @param billboardDataID ÅÅÐаñÊý¾ÝID  | 
| # @param cmpValue µ±Ç°¼ÓȨֵ  | 
| # @return ÅÅÐаñÊý¾Ý  | 
| # @remarks   | 
| def __GetAddBillBoardData(playerBillBoard, billboardDataID, cmpValue,  | 
|                           cmpValue2 = 0, cmpValue3 = 0):  | 
|     #»ñÈ¡ÅÅÐаñ×îºóÒ»Ãû  | 
|     if playerBillBoard.GetCount() <= 0:  | 
|         return  | 
|       | 
|     lastBillBoardIndex = playerBillBoard.GetCount() - 1  | 
|     lastBillBoardData = playerBillBoard.At(lastBillBoardIndex)  | 
|   | 
|     if cmpValue < lastBillBoardData.GetCmpValue():  | 
|         #ÎÞ·¨Éϰñ  | 
|         return  | 
|     elif cmpValue == lastBillBoardData.GetCmpValue():   | 
|         if cmpValue2 < lastBillBoardData.GetCmpValue2():  | 
|             return  | 
|         elif cmpValue2 == lastBillBoardData.GetCmpValue2():  | 
|       | 
|             if cmpValue3 <= lastBillBoardData.GetCmpValue3():  | 
|                 return  | 
|       | 
|     #¼·µô×îºóÒ»Ãû  | 
|     playerBillBoard.DeleteByIndex(lastBillBoardIndex)  | 
|     playerBillBoardData = playerBillBoard.AddToBillboard(billboardDataID)  | 
|       | 
|     if not playerBillBoardData:  | 
|         GameWorld.ErrLog('ÅÅÐаñ²åÈëʧ°Ü  curCnt = %s, maxCnt = %s'%(  | 
|                                 playerBillBoard.GetCount(), playerBillBoard.GetMaxCount()))  | 
|       | 
|     return playerBillBoardData  | 
|   | 
|   | 
| #---------------------------------------------------------------------  | 
| ##»ñµÃÖ¸¶¨ÅÅÐаñµÄÖ¸¶¨Êý¾Ý  | 
| # @param billboardIndex ÅÅÐаñË÷Òý  | 
| # @param billboardDataID ÅÅÐаñÊý¾ÝID  | 
| # @param cmpValue µ±Ç°²åÈëÅÅÐаñIDµÄ¼ÓȨֵ  | 
| # @return [ÅÅÐаñ, ÅÅÐаñÊý¾Ý]  | 
| # @remarks »ñµÃÖ¸¶¨ÅÅÐаñµÄÖ¸¶¨Êý¾Ý  | 
| def GetBillBoardData(billboardIndex, billboardDataID, cmpValue,   | 
|                      cmpValue2 = 0, cmpValue3 = 0):  | 
|     billboardMgr = GameWorld.GetBillboard()  | 
|     playerBillBoard = billboardMgr.FindBillboard(billboardIndex)  | 
|       | 
|     if not playerBillBoard:  | 
|         GameWorld.ErrLog('FindBillboardErr, ÅÅÐаñ = %s ÎÞ·¨²éÕÒ'%(billboardIndex))  | 
|         return [playerBillBoard, None]  | 
|       | 
|     playerBillBoardData = playerBillBoard.FindByID(billboardDataID)  | 
|       | 
|     if playerBillBoardData != None:  | 
|         #ÒÑÉϰñ, Ö»¸üÐÂÊý¾Ý  | 
|         return [playerBillBoard, playerBillBoardData]  | 
|       | 
|     if playerBillBoard.IsFull():  | 
|         #ÅÅÐаñÒÑÂú, ¶Ô±ÈÅÅÐаñ×îºóһλ, Èç¹û±È×îºóһλ¸ß, ¼·µô×îºóһλ  | 
|         playerBillBoardData = __GetAddBillBoardData(playerBillBoard, billboardDataID, cmpValue,  | 
|                                                     cmpValue2, cmpValue3)  | 
|         return [playerBillBoard, playerBillBoardData]  | 
|       | 
|     #²åÈëÒ»ÌõÊý¾Ý  | 
|     playerBillBoardData = playerBillBoard.AddToBillboard(billboardDataID)  | 
|       | 
|     return [playerBillBoard, playerBillBoardData]  | 
|   | 
| def MapServer_UpdateTotalRechargeBillboard(cmdList):  | 
|     ##×ܳäÖµµãÊýÅÅÐиüР | 
|     playerID, playerName, playerOpInfo, playerJob, playerLV, totalChangeCoinPoint = cmdList  | 
|     UpdatePlayerBillboard(playerID, playerName, playerOpInfo, ShareDefine.Def_BT_TotalRecharge,  | 
|                           playerJob, playerLV, totalChangeCoinPoint, totalChangeCoinPoint)  | 
|     return  | 
|   | 
| #===============================================================================  | 
| # //B0 20 ²é¿´ÅÅÐÐÖ¸¶¨·¶Î§Êý¾Ý #tagViewBillboardRangeByObjID  | 
| #   | 
| # struct    tagViewBillboardRangeByObjID  | 
| # {  | 
| #    tagHead        Head;  | 
| #    BYTE        BillboardType;    //ÅÅÐаñÀàÐÍ  | 
| #    WORD        ObjID;        //¶ÔÏóID  | 
| # };  | 
| #===============================================================================  | 
| ## ²é¿´ÅÅÐÐÖ¸¶¨·¶Î§Êý¾Ý(ÒÔij¸öÄ¿±êΪ»ù´¡)  | 
| #  @param index: Íæ¼ÒË÷Òý  | 
| #  @param clientData: ¿Í»§¶Ë·â°ü½á¹¹Ìå  | 
| #  @param tick: Ê±¼ä´Á  | 
| #  @return: None  | 
| def ViewBillboardRangeByObjID(index, clientData, tick):  | 
|     return  | 
|   | 
| ## ÅÅÐаñ¸üÐÂÊÇ·ñÊܵȼ¶ÏÞÖÆ  | 
| def IsBillboardLVLimit(playerLV, billboardType):  | 
|     # µÈ¼¶ÅжÏÒÑÓɵØÍ¼´¦Àíµô£¬ÕâÀï²»ÔÙ×öÅÐ¶Ï  | 
|     return True  | 
|   | 
| def RedressBillboard(curPlayer):  | 
|     ## ¾ÀÕýÅÅÐаñÖеÄÍæ¼ÒÃû×ּǼ  | 
|       | 
|     #²»´¦ÀíÅÅÐаñ  | 
|     notRedressBillboardList = [  | 
|                                ShareDefine.Def_BT_Max,  # ÅÅÐаñ×î´óÀàÐÍ  | 
|                                ]  | 
|       | 
|     curPlayerID = curPlayer.GetID()  | 
|     curPlayerName = curPlayer.GetName()  | 
|       | 
|     billboardMgr = GameWorld.GetBillboard()  | 
|     for billboardIndex in ShareDefine.BillboardTypeList:  | 
|         if billboardIndex in notRedressBillboardList:  | 
|             continue  | 
|           | 
|         billBoard = billboardMgr.FindBillboard(billboardIndex)  | 
|         if not billBoard:  | 
|             #ÕÒ²»µ½ÕâÀàÐÍÅÅÐаñ  | 
|             continue  | 
|           | 
|         playerBillBoardData = billBoard.FindByID(curPlayerID)  | 
|         if not playerBillBoardData:  | 
|             #¸ÃÍæ¼ÒûÓÐÔÚÅÅÐаñÉÏ  | 
|             continue  | 
|           | 
|         #¸üÐÂÍæ¼ÒÃû×Ö  | 
|         playerBillBoardData.SetName1(curPlayerName)  | 
|           | 
|     return  | 
|   | 
| def UpdateBillboardRealm(curPlayer):  | 
|     ## ¸üÐÂÅÅÐаñÖеÄÍæ¼Ò¾³½ç¼Ç¼  | 
|       | 
|     curPlayerID = curPlayer.GetID()  | 
|     curOfficialRank = curPlayer.GetOfficialRank()  | 
|       | 
|     billboardMgr = GameWorld.GetBillboard()  | 
|     for billboardIndex in ShareDefine.BTValue1_OfficialRankList:  | 
|         if billboardIndex not in ShareDefine.BillboardTypeList:  | 
|             continue  | 
|           | 
|         billBoard = billboardMgr.FindBillboard(billboardIndex)  | 
|         if not billBoard:  | 
|             #ÕÒ²»µ½ÕâÀàÐÍÅÅÐаñ  | 
|             continue  | 
|           | 
|         playerBillBoardData = billBoard.FindByID(curPlayerID)  | 
|         if not playerBillBoardData:  | 
|             #¸ÃÍæ¼ÒûÓÐÔÚÅÅÐаñÉÏ  | 
|             continue  | 
|           | 
|         #¸üÐÂÍæ¼Ò¾³½ç  | 
|         playerBillBoardData.SetValue1(curOfficialRank)  | 
|           | 
|     return  | 
|   | 
| def UpdateBillboardFace(curPlayer):  | 
|     ## ¸üÐÂÅÅÐаñÖеÄÍæ¼ÒÍ·Ïñ  | 
|       | 
|     curPlayerID = curPlayer.GetID()  | 
|     curFace = curPlayer.GetFace()  | 
|       | 
|     billboardMgr = GameWorld.GetBillboard()  | 
|     for billboardIndex in ShareDefine.BillboardTypeList:  | 
|         if billboardIndex in ShareDefine.FamilyBillboardList:  | 
|             continue  | 
|         billBoard = billboardMgr.FindBillboard(billboardIndex)  | 
|         if not billBoard:  | 
|             #ÕÒ²»µ½ÕâÀàÐÍÅÅÐаñ  | 
|             continue  | 
|           | 
|         playerBillBoardData = billBoard.FindByID(curPlayerID)  | 
|         if not playerBillBoardData:  | 
|             #¸ÃÍæ¼ÒûÓÐÔÚÅÅÐаñÉÏ  | 
|             continue  | 
|           | 
|         playerBillBoardData.SetValue3(curFace)  | 
|           | 
|     return  | 
|   | 
| def UpdateBillboardFacePic(curPlayer):  | 
|     ## ¸üÐÂÅÅÐаñÖеÄÍæ¼ÒÍ·Ïñ  | 
|       | 
|     curPlayerID = curPlayer.GetID()  | 
|     curFacePic = curPlayer.GetFacePic()  | 
|       | 
|     billboardMgr = GameWorld.GetBillboard()  | 
|     for billboardIndex in ShareDefine.BillboardTypeList:  | 
|         if billboardIndex in ShareDefine.FamilyBillboardList:  | 
|             continue  | 
|         billBoard = billboardMgr.FindBillboard(billboardIndex)  | 
|         if not billBoard:  | 
|             #ÕÒ²»µ½ÕâÀàÐÍÅÅÐаñ  | 
|             continue  | 
|           | 
|         playerBillBoardData = billBoard.FindByID(curPlayerID)  | 
|         if not playerBillBoardData:  | 
|             #¸ÃÍæ¼ÒûÓÐÔÚÅÅÐаñÉÏ  | 
|             continue  | 
|           | 
|         playerBillBoardData.SetValue4(curFacePic)  | 
|           | 
|     return  |