#!/usr/bin/python # -*- coding: GBK -*- #------------------------------------------------------------------------------- # ##@package GM.Commands.Billboard # # @todo:°ñµ¥Êý¾Ý # @author hxp # @date 2025-05-16 # @version 1.0 # # ÏêϸÃèÊö: °ñµ¥Êý¾Ý # #------------------------------------------------------------------------------- #"""Version = 2025-05-16 12:00""" #------------------------------------------------------------------------------- import GameWorld import PlayerBillboard import ShareDefine import DBDataMgr def __Help(curPlayer, errInfo=""): GameWorld.DebugAnswer(curPlayer, "---------- %s" % GameWorld.GetCurrentDataTimeStr()) if errInfo: GameWorld.DebugAnswer(curPlayer, errInfo) GameWorld.DebugAnswer(curPlayer, "ÐÂÔö°ñµ¥¼ÙÊý¾Ý: Billboard ÀàÐÍ ·Ö×éÖµ1 ·Ö×éÖµ2 ÌõÊý ±È½ÏÖµ1¿ÉÑ¡²ÎÊý(±È½ÏÖµ2 ³£¹æÖµ1~5)") GameWorld.DebugAnswer(curPlayer, "ɾ³ý°ñµ¥¼ÙÊý¾Ý: Billboard ÀàÐÍ ·Ö×éÖµ1 ·Ö×éÖµ2") GameWorld.DebugAnswer(curPlayer, "°ñµ¥ÀàÐÍ:0-Õ½Á¦,1-Áú»ê,2-ÁéÑþ,4-µÈ¼¶,5-×øÆï,6-Áé³è,7-·ûÓ¡,8-ÍÑ»ú,9-¾³½ç,19-ÖúÕ½") GameWorld.DebugAnswer(curPlayer, "¿ª·þ»î¶¯°ñÀàÐÍ:11-Ç¿»¯,12-×øÆï,13-±¦Ê¯,14-³å¼¶,15-¾³½ç,16-Õ½Á¦,18-·ûÓ¡,20-Éñ±ø,21-³äÖµ,22-Áé³è,24-Áé¸ù,25-ÉýÐÇ,26-Ï´Á·") GameWorld.DebugAnswer(curPlayer, "ÔËÓª»î¶¯°ñÀàÐÍ:17-ÏɽçÊ¢µä,23-ÏɽçÊ¢µä2,33-bossƾ֤,36-bossƾ֤ÏÉÃË,38-ÏÉÏ»,39-¹Å±¦,40-Æï³è") GameWorld.DebugAnswer(curPlayer, "÷ÈÁ¦°ñµ¥ÀàÐÍ:30-×ܰñ,31-Öܰñ,32-ÈÕ°ñ") GameWorld.DebugAnswer(curPlayer, "ÔËÓª»î¶¯°ñÀàÐÍ:150-³äÖµ(·Ö×éÖµ1ÅäÖÃID)") GameWorld.DebugAnswer(curPlayer, "ÔËÓª»î¶¯°ñÀàÐÍ:158-bossƾ֤,160-ƾ֤ÏÉÃË,162-ÏÉÏ»,163-¹Å±¦,164-Æï³è") GameWorld.DebugAnswer(curPlayer, "¹ÅÉñÕ½³¡°ñÀàÐÍ:151-²ÎÓë°ñ,152-ÕÙ¼¯°ñ,153-»ý·Ö°ñ") GameWorld.DebugAnswer(curPlayer, "Öð¹Íò½ç°ñÀàÐÍ:156-µ¥³¡°ñ,157-Öܰñ") GameWorld.DebugAnswer(curPlayer, "¿ç·þ¾º¼¼³¡°ñµ¥:165,·Ö×éÖµ1-·ÖÇø,·Ö×éÖµ2-Èü¼¾,value2-¶Îλ") GameWorld.DebugAnswer(curPlayer, "×¢:Èç¹ûûÓÐÌØÊâ˵Ã÷£¬±¾·þ°ñµ¥·Ö×éÖµ¾ùΪ0£¬¿ç·þ°ñµ¥·Ö×éÖµ1Ϊ·ÖÇøID,·Ö×é2Ϊ0") return ## Ö´ÐÐÂß¼­ # @param curPlayer µ±Ç°Íæ¼Ò # @param gmList [] # @return None def OnExec(curPlayer, gmList): paramLen = len(gmList) if not paramLen: __Help(curPlayer) return value = gmList[0] if value == "p": __logFackData(curPlayer, gmList) return billboardIndex = value if billboardIndex >= ShareDefine.BillboardTypeAllList: __Help(curPlayer, "°ñµ¥ÀàÐͲ»´æÔÚ!") return if billboardIndex in ShareDefine.CrossBillboardTypeList: GameWorld.DebugAnswer(curPlayer, "¿ç·þ°ñµ¥Ôݲ»´¦Àí") return if len(gmList) <= 3: __delFackData(curPlayer, gmList) else: __addFackData(curPlayer, gmList) return def __addFackData(curPlayer, gmList): ## ÐÂÔö°ñµ¥¼ÙÊý¾Ý: Billboard ÀàÐÍ ·Ö×éÖµ1 ·Ö×éÖµ2 ÌõÊý ±È½ÏÖµ1¿ÉÑ¡²ÎÊý(±È½ÏÖµ2 ³£¹æÖµ1~5) billboardType = gmList[0] groupValue1 = gmList[1] if len(gmList) > 1 else 0 groupValue2 = gmList[2] if len(gmList) > 2 else 0 count = gmList[3] if len(gmList) > 3 else 0 cmpValue1 = gmList[4] if len(gmList) > 4 else 0 cmpValue2 = gmList[5] if len(gmList) > 5 else 0 value1 = gmList[6] if len(gmList) > 6 else 0 value2 = gmList[7] if len(gmList) > 7 else 0 value3 = gmList[8] if len(gmList) > 8 else 0 value4 = gmList[9] if len(gmList) > 9 else 0 value5 = gmList[10] if len(gmList) > 10 else 0 id2 = 0 type2 = 0 name2 = "" cmpValue3 = 0 billboardMgr = DBDataMgr.GetBillboardMgr() billboardObj = billboardMgr.GetBillboard(billboardType, groupValue1, groupValue2) curDataCount = billboardObj.GetCount() maxDataCount = billboardObj.GetMaxCount() count = min(count, maxDataCount - curDataCount) FakeName = GameWorld.GbkToCode("¼ÙÃû×Ö") for i in xrange(count): dataPlayerID = curDataCount + 1 + i dataPlayerName = "%s%s" % (FakeName, dataPlayerID) dataCmpValue1 = max(0, cmpValue1 - i) dataCmpValue2 = max(0, cmpValue2 - i) dataID = dataPlayerID name1 = dataPlayerName cmpValue = dataCmpValue1 cmpValue2 = dataCmpValue2 PlayerBillboard.UpdateBillboard(billboardType, groupValue1, dataID, name1, name2, type2, value1, value2, cmpValue, cmpValue2, cmpValue3, groupValue2, id2, False, value3=value3, value4=value4, value5=value5) billboardObj.SortData() billTypeSign = __GetBillTypeSign(billboardType, groupValue1, groupValue2) GameWorld.DebugAnswer(curPlayer, "²åÈë¼Ù°ñµ¥(%s): %s Ìõ" % (billTypeSign, count)) return def __delFackData(curPlayer, gmList): ## ɾ³ý°ñµ¥¼ÙÊý¾Ý billboardType = gmList[0] groupValue1 = gmList[1] if len(gmList) > 1 else 0 groupValue2 = gmList[2] if len(gmList) > 2 else 0 billboardMgr = DBDataMgr.GetBillboardMgr() billboardObj = billboardMgr.GetBillboard(billboardType, groupValue1, groupValue2) curDataCount = billboardObj.GetCount() maxDataCount = billboardObj.GetMaxCount() delCount = 0 for index in range(curDataCount)[::-1]: billData = billboardObj.At(index) if billData.GetID() <= maxDataCount: billboardObj.DeleteByIndex(index) delCount += 1 billTypeSign = __GetBillTypeSign(billboardType, groupValue1, groupValue2) GameWorld.DebugAnswer(curPlayer, "ɾ³ý¼Ù°ñµ¥(%s): %s Ìõ, Ê£: %s" % (billTypeSign, delCount, billboardObj.GetCount())) return def __GetBillTypeSign(billboardType, groupValue1, groupValue2): billTypeSign = "%s" % billboardType if groupValue1: billTypeSign = "%s-%s" % (billTypeSign, groupValue1) if groupValue2: billTypeSign = "%s-%s" % (billTypeSign, groupValue2) return billTypeSign def __logFackData(curPlayer, gmList): ## Êä³öÅÅÐаñÊý¾Ý: Billboard p ÀàÐÍ ·Ö×éÖµ1 ·Ö×éÖµ2 if len(gmList) <= 1: GameWorld.DebugAnswer(curPlayer, "°ñµ¥Êý¾ÝÌõÊý×ÜÀÀ") billboardMgr = DBDataMgr.GetBillboardMgr() for bType in ShareDefine.BillboardTypeAllList: groupList = billboardMgr.GetBillboardGroupList(bType) for bType, groupValue1, groupValue2 in groupList: billboardObj = billboardMgr.GetBillboard(bType, groupValue1, groupValue2) curDataCount = billboardObj.GetCount() maxDataCount = billboardObj.GetMaxCount() if not curDataCount: continue billTypeSign = __GetBillTypeSign(bType, groupValue1, groupValue2) GameWorld.DebugAnswer(curPlayer, "°ñµ¥Êý¾Ý(%s)ÌõÊý: %s/%s" % (billTypeSign, curDataCount, maxDataCount)) return billboardType = gmList[1] groupValue1 = gmList[2] if len(gmList) > 2 else 0 groupValue2 = gmList[3] if len(gmList) > 3 else 0 billboardMgr = DBDataMgr.GetBillboardMgr() billboardObj = billboardMgr.GetBillboard(billboardType, groupValue1, groupValue2) billboardObj.SortDelayDo() curDataCount = billboardObj.GetCount() maxDataCount = billboardObj.GetMaxCount() idOrderDict = billboardObj.GetIDOrderDict() billTypeSign = __GetBillTypeSign(billboardType, groupValue1, groupValue2) GameWorld.DebugAnswer(curPlayer, "°ñµ¥Êý¾Ý(%s)ÌõÊý: %s/%s Ïê¼ûÈÕÖ¾" % (billTypeSign, curDataCount, maxDataCount)) for index in range(curDataCount): bbData = billboardObj.At(index) dataID = bbData.GetID() rank = idOrderDict.get(dataID, 0) valueList = [getattr(bbData, "GetValue%s" % num)() for num in range(1, 9)] GameWorld.DebugLog("%s,rank=%s,ID=%s,CmpValue=%s,CmpValue2=%s,Value=%s" % (index, rank, dataID, bbData.GetCmpValue(), bbData.GetCmpValue2(), valueList), curPlayer.GetPlayerID()) return