8585 【主干】【BT2】【BT3】【后端】竞技场(Arena命令支持指定匹配玩家ID)
| | |
| | |
|
| | | # 匹配刷新
|
| | | if cmd == "MatchRefresh":
|
| | | __DoArenaMatchRefresh(curPlayer, cmdDict["isRefresh"], cmdDict["playerLV"], cmdDict["playerScore"])
|
| | | __DoArenaMatchRefresh(curPlayer, cmdDict["isRefresh"], cmdDict["playerLV"], cmdDict["playerScore"], cmdDict.get("gmMatchIDList"))
|
| | |
|
| | | # 对战结算
|
| | | elif cmd == "BattleResult":
|
| | |
| | |
|
| | | return msgList + [retDict]
|
| | |
|
| | | def __DoArenaMatchRefresh(curPlayer, isRefresh, playerLV, playerScore):
|
| | | def __DoArenaMatchRefresh(curPlayer, isRefresh, playerLV, playerScore, gmMatchIDList=None):
|
| | | ## 玩家刷新匹配对手
|
| | |
|
| | | playerID = curPlayer.GetPlayerID()
|
| | |
| | | % (higherLackCount, randOrderMin, randOrderMax, randOrder, matchOrderList), playerID)
|
| | |
|
| | | matchOrderList.sort()
|
| | | # GM指定匹配测试
|
| | | if gmMatchIDList != None and curPlayer.GetGMLevel():
|
| | | gmMatchOrderList = []
|
| | | for gmMatchID in gmMatchIDList:
|
| | | if gmMatchID == playerID:
|
| | | GameWorld.DebugAnswer(curPlayer, "目标ID不能是自己!无法匹配!%s" % gmMatchID)
|
| | | continue
|
| | | gmMatchOrder = billBoard.IndexOfByID(gmMatchID) + 1
|
| | | if gmMatchOrder <= 0:
|
| | | GameWorld.DebugAnswer(curPlayer, "目标ID不在榜单上!无法匹配!%s" % gmMatchID)
|
| | | continue
|
| | | if gmMatchOrder in matchOrderList:
|
| | | continue
|
| | | gmMatchOrderList.append(gmMatchOrder)
|
| | | GameWorld.DebugAnswer(curPlayer, "指定匹配ID(%s),order(%s)" % (gmMatchID, gmMatchOrder))
|
| | | |
| | | GameWorld.DebugLog("matchOrderList=%s,needMatchCount=%s" % (str(matchOrderList), needMatchCount))
|
| | | if matchOrderList:
|
| | | matchOrderList = matchOrderList[:needMatchCount - len(gmMatchOrderList)]
|
| | | matchOrderList += gmMatchOrderList
|
| | | matchOrderList.sort()
|
| | | GameWorld.DebugLog(" 最终匹配到的名次列表: matchOrderList=%s" % matchOrderList, playerID)
|
| | |
|
| | | # 随机机器人备用信息
|
| | |
| | | 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}
|
| | | "Value1":value1, "Value2":value2, "CmpValue":cmpValue, "CmpValue2":cmpValue2, "CmpValue3":cmpValue3, "autoSort":autoSort}
|
| | | '''
|
| | |
|
| | | bType = billInfoDict["Type"]
|
| | |
| | |
|
| | | gameWorld = GameWorld.GetGameWorld()
|
| | | lastSortTick = gameWorld.GetDictByKey(Def_Key_BillboardSortTick % bType)
|
| | | autoSort = (tick - lastSortTick) >= 60000 # 1分钟强制排序一次
|
| | | 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))
|
| | |
| | |
|
| | | if not msgList:
|
| | | GameWorld.DebugAnswer(curPlayer, "重置玩家竞技场: Arena 0")
|
| | | GameWorld.DebugAnswer(curPlayer, "设置玩家积分: Arena 积分")
|
| | | GameWorld.DebugAnswer(curPlayer, "设置玩家榜积分: Arena 积分")
|
| | | GameWorld.DebugAnswer(curPlayer, "直接匹配到目标: Arena 1 对手ID 对手ID ...")
|
| | | GameWorld.DebugAnswer(curPlayer, "重置赛季直接用 test_OnWeek (需开服7天后)")
|
| | | return
|
| | |
|
| | |
| | | GameWorld.DebugAnswer(curPlayer, "重置成功!")
|
| | | return
|
| | |
|
| | | else:
|
| | | elif len(msgList) == 1 and value1 > 0:
|
| | | GameWorld.DebugAnswer(curPlayer, "设置竞技场积分: %s" % value1)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaScore, value1)
|
| | | PlayerArena.Sync_ArenaInfo(curPlayer)
|
| | |
| | | cmpValue3 = 0
|
| | | value1 = curPlayer.GetOfficialRank()
|
| | | value2 = curPlayer.GetLV()
|
| | | PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_Arena, cmpValue, cmpValue2, cmpValue3, value1, value2)
|
| | | PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_Arena, cmpValue, cmpValue2, cmpValue3, value1, value2, autoSort=True)
|
| | | |
| | | elif len(msgList) >= 2 and value1 == 1:
|
| | | gmMatchIDList = msgList[1:]
|
| | | PlayerArena.GMArenaMatch(curPlayer, gmMatchIDList)
|
| | | |
| | | else:
|
| | | pass
|
| | | |
| | | return
|
| | |
|
| | |
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetID(), 0, 0, "Arena", msgInfo, len(msgInfo))
|
| | | return
|
| | |
|
| | | def GMArenaMatch(curPlayer, gmMatchIDList):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | playerLV = curPlayer.GetLV()
|
| | | playerScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaScore)
|
| | | msgInfo = str(["MatchRefresh", {"isRefresh":1, "playerLV":playerLV, "playerScore":playerScore, "gmMatchIDList":gmMatchIDList}])
|
| | | GameWorld.DebugLog("竞技场发送GameServer匹配: %s" % msgInfo, playerID)
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetID(), 0, 0, "Arena", msgInfo, len(msgInfo))
|
| | | return
|
| | |
|
| | | #// B2 10 竞技场挑战玩家 #tagCMArenaBattle
|
| | | #
|
| | | #struct tagCMArenaBattle
|
| | |
| | |
|
| | | return True
|
| | |
|
| | | def UpdatePlayerBillboard(curPlayer, bType, cmpValue, cmpValue2=0, cmpValue3=0, value1=0, value2=0, exInfo=[]):
|
| | | def UpdatePlayerBillboard(curPlayer, bType, cmpValue, cmpValue2=0, cmpValue3=0, value1=0, value2=0, exInfo=[], autoSort=False):
|
| | | ## 更新玩家排行榜
|
| | |
|
| | | #if not cmpValue and not cmpValue2 and not cmpValue3:
|
| | |
| | | if bType in ShareDefine.BTValue1_OfficialRankList:
|
| | | value1 = curPlayer.GetOfficialRank()
|
| | | GameServer_UpdateBillboard(bType, playerJob, playerID, playerName, playerOpInfo,
|
| | | value1, value2, cmpValue, cmpValue2, cmpValue3, 0, exInfo)
|
| | | value1, value2, cmpValue, cmpValue2, cmpValue3, 0, exInfo, autoSort)
|
| | | return
|
| | |
|
| | | def GameServer_UpdateBillboard(bType, bType2, bID, bName, bName2, value1, value2, cmpValue, cmpValue2=0, cmpValue3=0, bID2=0, exInfo=[]):
|
| | | def GameServer_UpdateBillboard(bType, bType2, bID, bName, bName2, value1, value2, cmpValue, cmpValue2=0, cmpValue3=0, bID2=0, exInfo=[], autoSort=False):
|
| | | sendMsg = "%s" % ({"Type":bType, "Type2":bType2, "ID":bID, "ID2":bID2, "Name1":bName, "Name2":bName2, "ExInfo":exInfo,
|
| | | "Value1":value1, "Value2":value2, "CmpValue":cmpValue, "CmpValue2":cmpValue2, "CmpValue3":cmpValue3}) |
| | | "Value1":value1, "Value2":value2, "CmpValue":cmpValue, "CmpValue2":cmpValue2, "CmpValue3":cmpValue3, "autoSort":autoSort}) |
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "UpdateBillboard", sendMsg, len(sendMsg))
|
| | | GameWorld.DebugLog("同步GameServer排行榜:bType=%s,cmpValue=%s, %s" % (bType, cmpValue, sendMsg), bID)
|
| | | return
|