#!/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 ReadChConfig import ChPyNetSendPack import NetPackCommon import PlayerDBGSEvent import DataRecordPack import PlayerFamily import time Def_Key_BillboardSortTick = "BillboardSortTick_%s" # ÅÅÐаñÊÇ·ñÅÅÐòtick£¬²ÎÊý£¨ÅÅÐаñÀàÐÍ£© Def_Key_BillboardNeedSort = "BillboardNeedSort_%s" # ÅÅÐаñÊÇ·ñÐèÒªÅÅÐò£¬²ÎÊý£¨ÅÅÐаñÀàÐÍ£© #ÐèҪÿÌì¼Ç¼µ½ossµÄÅÅÐаñÀàÐÍ Def_NoteOssBillboardTypeList = [ ShareDefine.Def_BT_LV , #¸öÈ˵ȼ¶ÈÕ°ñ ShareDefine.Def_BT_FightPower, #¸öÈËÕ½¶·Á¦ ] #ÐèҪÿÌ쿽±´×òÈÕ°ñµ¥µÄÅÅÐаñÀàÐÍ×Öµä Def_NeedCopyYesterday_Dict = { #×òÈÕ°ñ£¨¿½±´£© #½ñÈÕ°ñ£¨Ô´Êý¾Ý£© ShareDefine.Def_BT_HighLadder_Yester : ShareDefine.Def_BT_HighLadder, } def NoteOssBillboardInfoByDay(): ## ÿÌì¼Ç¼ÅÅÐаñÐÅÏ¢µ½ossÖÐ for billboardType in Def_NoteOssBillboardTypeList: DataRecordPack.DR_BillboardDataByDay(billboardType) 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() cmpValue = oldBillBoardData.GetCmpValue() cmpValue2 = oldBillBoardData.GetCmpValue2() cmpValue3 = oldBillBoardData.GetCmpValue3() #---»ñÈ¡ÅÅÐаñÐÅÏ¢--- 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.SetCmpValue(cmpValue) billBoardData.SetCmpValue2(cmpValue2) billBoardData.SetCmpValue3(cmpValue3) 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 #################################################################################################### #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 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 # BYTE IsWatchSelf; //ÊÇ·ñ²é¿´×Ô¼ºÃû´Îǰºó£¬Ä¬ÈÏ10ÌõÊý¾Ý #}; def Client_PYWatchBillboard(index, clientData, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) if not curPlayer: return packType = clientData.Type startIndex = clientData.StartIndex watchCnt = clientData.WatchCnt isWatchSelf = clientData.IsWatchSelf if not __CheckWatchCD(curPlayer, packType, tick): return Sync_BillboardEx(curPlayer, packType, isWatchSelf, startIndex, watchCnt) return def Sync_BillboardEx(curPlayer, bbType, isWatchSelf=False, 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 isWatchSelf: playerIndex = billBoard.IndexOfByID(playerID) 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) billBoardData = ChPyNetSendPack.tagPYBillboardData() billBoardData.Clear() billBoardData.IsWatchSelf = isWatchSelf 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 = index 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.CmpValue = bbData.GetCmpValue() bbInfo.CmpValue2 = bbData.GetCmpValue2() bbInfo.CmpValue3 = bbData.GetCmpValue3() 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} ''' bType = billInfoDict["Type"] bType2 = billInfoDict["Type2"] bID = billInfoDict["ID"] #bID2 = billInfoDict["ID2"] bName = billInfoDict["Name1"] bName2 = billInfoDict["Name2"] value1 = billInfoDict["Value1"] value2 = billInfoDict["Value2"] cmpValue = billInfoDict["CmpValue"] cmpValue2 = billInfoDict["CmpValue2"] cmpValue3 = billInfoDict["CmpValue3"] if bType not in ShareDefine.BillboardTypeList: return #if not cmpValue and not cmpValue2 and not cmpValue3: # return #ɾ³ý¸ÃÊý¾Ý 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 # 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) gameWorld.SetDict(Def_Key_BillboardNeedSort % bType, 1) #__UpdateBillboardSortState(gameWorld, bType, autoSort, isUpd) exInfo = billInfoDict["ExInfo"] # ÒÔÏÂΪ°ñµ¥¸½¼ÓÌØÊâ´¦Àí if bType == ShareDefine.Def_BT_FightPower: playerID = bID fightPowerTotal = cmpValue familyID = exInfo[0] playerJob = bType2 curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID) if curPlayer: curPlayer.SetFightPower(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) gameWorld.SetDict(Def_Key_BillboardNeedSort % jobBType, 1) #__UpdateBillboardSortState(gameWorld, jobBType, autoSort, isUpd) return def __UpdateBillboardSortState(gameWorld, bType, autoSort, isUpd): key = Def_Key_BillboardNeedSort % bType needSort = gameWorld.GetDictByKey(key) if not autoSort and isUpd and not needSort: gameWorld.SetDict(key, 1) elif autoSort and needSort: gameWorld.SetDict(key, 0) #GameWorld.DebugLog("__UpdateBillboardSortState£ºbType=%s,autoSort=%s,isUpd=%s,needSort=%s" % (bType, autoSort, isUpd, gameWorld.GetDictByKey(key))) 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, curPlayerName, curPlayerOpInfo, billboardIndex, billboardType, value1, value2, cmpValue, autoSort = True, cmpValue2 = 0, cmpValue3 = 0): playerBillBoard, playerBillBoardData = GetBillBoardData(billboardIndex, curPlayerID, cmpValue, cmpValue2, cmpValue3) if playerBillBoard == None or playerBillBoardData == None: #ÎÞ·¨Éϰñ return False isNewData = playerBillBoardData.GetID2() == 0 # ÊÇ·ñÊÇÐÂÔöµÄÊý¾Ý # ÖµÏàͬ²»¸üРif not isNewData and playerBillBoardData.GetValue1() == value1 and playerBillBoardData.GetValue2() == value2 \ and playerBillBoardData.GetCmpValue() == cmpValue and playerBillBoardData.GetCmpValue2() == cmpValue2: GameWorld.DebugLog("¸üÐÂÅÅÐаñÖµÏàͬ²»¸üÐÂ! index=%s,type2=%s,value1=%s,value2=%s,cmpValue=%s,cmpValue2==%s,cmpValue3==%s" % (billboardIndex, billboardType, value1, value2, cmpValue, cmpValue2, cmpValue3), curPlayerID) opInfo = playerBillBoardData.GetName2() if opInfo != str(curPlayerOpInfo): playerBillBoardData.SetName2(str(curPlayerOpInfo)) GameWorld.DebugLog(" ¸üÐÂoperatInfo=%s" % curPlayerOpInfo, curPlayerID) return False # ûÉèÖÃֵĬÈÏΪʱ¼ätime£¬ÏÈÉϰñµÄÅÅÇ°Ãæ if cmpValue3 == 0: # ʱ¼äȨֵ½öÔڱȽÏÖµ±ä¸üµÄÇé¿öϲŸüÐÂ, ·ÀÖ¹ÆäËû¸½ÊôÖµ¸üÐÂʱµ¼Ö±ȽÏÖµÏàͬµÄÍæ¼ÒÃû´Î¼ä»á±ä¶¯µÄÎÊÌâ if isNewData or playerBillBoardData.GetCmpValue() != cmpValue or playerBillBoardData.GetCmpValue2() != cmpValue2: calcTime = GameWorld.ChangeTimeStrToNum("2080-01-01 00:00:00") cmpValue3 = max(0, calcTime - int(time.time())) # ±È½ÏÖµ3Èç¹ûûָ¶¨ÖµÔòĬÈϴ浱ǰ¸üеÄtime #ÉèÖÃÅÅÐаñÊý¾Ý playerBillBoardData.SetType(billboardIndex) #¸½ÊôÀàÐÍ playerBillBoardData.SetType2(billboardType) playerBillBoardData.SetID(curPlayerID) playerBillBoardData.SetID2(curPlayerID) playerBillBoardData.SetName1(curPlayerName) playerBillBoardData.SetName2(str(curPlayerOpInfo)) #SetValue1´æ´¢¿Õ¼äΪWord playerBillBoardData.SetValue1(value1) #SetValue2´æ´¢¿Õ¼äΪDWord playerBillBoardData.SetValue2(value2) 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" % (billboardIndex, billboardType, value1, value2, cmpValue, cmpValue2, cmpValue3, isNewData), curPlayerID) if not autoSort: #²»×Ô¶¯ÅÅÐò 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 ## ¸üгäÖµÌØ»ÝÅÅÐаñ # @param cmdList # @return None def MapServer_UpdateRechargeRankBillboard(cmdList): playerID, playerName, playerOpInfo, playerJob, playerLV, familyName, actionID, actionNum, updateGold = cmdList # ÅÅÐаñÉϰñÏÞÖÆ RechargeRankInfoDict = ReadChConfig.GetEvalChConfig("TeHuiAction_RechargeRank") gameWorld = GameWorld.GetGameWorld() actionNumKey = ShareDefine.Def_Notify_WorldKey_DayAction_RechargeRank curActionNum = gameWorld.GetDictByKey(actionNumKey) curActionID = gameWorld.GetDictByKey(ShareDefine.Def_Notify_WorldKey_DayAction_ID % actionNumKey) GameWorld.DebugLog("MapServer_UpdateRechargeRankBillboard...") GameWorld.DebugLog(" actionID=%s,actionNum=%s,updateGold=%s,curActionID=%s,curActionNum=%s," % (actionID, actionNum, updateGold, curActionID, curActionNum), playerID) # ·Çµ±Ç°»î¶¯£¬²»¸üРif actionNum not in RechargeRankInfoDict or actionNum != curActionNum or actionID != curActionID: GameWorld.DebugLog(" ·Çµ±Ç°³äÖµÌØ»ÝÅÅÐаñ»î¶¯£¬²»¸üÐÂ...", playerID) return rechargeRankInfoList = RechargeRankInfoDict[actionNum] if len(rechargeRankInfoList) <= 0: return limitGold = rechargeRankInfoList[0] # ÏÞÖÆÉϰñ³äÖµÊý if updateGold < limitGold: GameWorld.DebugLog(" δ´ïµ½×îµÍÉϰñ³äÖµÊý=%s£¬²»¸üÐÂ..." % limitGold, playerID) return #ÅÅÐаñ cmpValue = updateGold isOk = UpdatePlayerBillboard(playerID, playerName, familyName, ShareDefine.Def_BT_RechargeTeHui, playerJob, playerLV, updateGold, cmpValue) GameWorld.DebugLog(" ¸üгäÖµÌØ»ÝÅÅÐаñ isOk=%s" % isOk, playerID) return ## ¸üÐÂÏû·ÑÌØ»ÝÅÅÐаñ # @param cmdList # @return None def MapServer_UpdateCostRankBillboard(cmdList): playerID, playerName, playerOpInfo, playerJob, playerLV, familyName, actionID, actionNum, updateGold = cmdList # ÅÅÐаñÉϰñÏÞÖÆ costRankInfoDict = ReadChConfig.GetEvalChConfig("TeHuiAction_CostRank") gameWorld = GameWorld.GetGameWorld() actionNumKey = ShareDefine.Def_Notify_WorldKey_DayAction_CostRank curActionNum = gameWorld.GetDictByKey(actionNumKey) curActionID = gameWorld.GetDictByKey(ShareDefine.Def_Notify_WorldKey_DayAction_ID % actionNumKey) GameWorld.DebugLog("MapServer_UpdateCostRankBillboard...") GameWorld.DebugLog(" actionID=%s,actionNum=%s,updateGold=%s,curActionID=%s,curActionNum=%s," % (actionID, actionNum, updateGold, curActionID, curActionNum), playerID) # ·Çµ±Ç°»î¶¯£¬²»¸üРif actionNum not in costRankInfoDict or actionNum != curActionNum or actionID != curActionID: GameWorld.DebugLog(" ·Çµ±Ç°Ïû·ÑÌØ»ÝÅÅÐаñ»î¶¯£¬²»¸üÐÂ...", playerID) return costRankInfoList = costRankInfoDict[actionNum] if len(costRankInfoList) <= 0: return limitGold = costRankInfoList[0] # ÏÞÖÆÉϰñÏû·ÑÊý if updateGold < limitGold: GameWorld.DebugLog(" δ´ïµ½×îµÍÉϰñÏû·ÑÊý=%s£¬²»¸üÐÂ..." % limitGold, playerID) return #ÅÅÐаñ cmpValue = updateGold isOk = UpdatePlayerBillboard(playerID, playerName, familyName, ShareDefine.Def_BT_CostTeHui, playerJob, playerLV, 0, cmpValue) GameWorld.DebugLog(" ¸üÐÂÏû·ÑÌØ»ÝÅÅÐаñ isOk=%s" % isOk, playerID) return ## ÅÅÐаñ¸üÐÂÊÇ·ñÊܵȼ¶ÏÞÖÆ def IsBillboardLVLimit(playerLV, billboardType): # µÈ¼¶ÅжÏÒÑÓɵØÍ¼´¦Àíµô£¬ÕâÀï²»ÔÙ×öÅÐ¶Ï return True # BillBoardLimitInfo = ReadChConfig.GetEvalChConfig("BillBoardLimit") # defaultMinLV, limitLVDict = BillBoardLimitInfo # lvBillBoardMinLV = limitLVDict.get(billboardType, defaultMinLV) # if playerLV < lvBillBoardMinLV: # return True # # return False 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