| | |
| | | import PlayerCompensation
|
| | | import PlayerDBGSEvent
|
| | | import ChPyNetSendPack
|
| | | import DataRecordPack
|
| | | import NetPackCommon
|
| | | import IpyGameDataPY
|
| | | import PyGameData
|
| | |
| | | self.tagLV = 0
|
| | | self.tagJob = 0
|
| | | self.tagScore = 0
|
| | | self.tagFace = 0
|
| | | self.tagFacePic = 0
|
| | | return
|
| | |
|
| | | class ArenaBattleRec():
|
| | |
| | | self.tagPlayerID = 0 # 小于10000的为机器人ID
|
| | | self.tagLV = 0
|
| | | self.tagJob = 0
|
| | | self.tagFace = 0
|
| | | self.tagFacePic = 0
|
| | | self.tagScore = 0
|
| | |
|
| | | self.addScore = 0
|
| | |
| | | value4 tagScore 目标积分,非实时积分,一般机器人时有用
|
| | | strValue1 resultInfo isWin,addScore
|
| | | strValue2 updInfo isDispose,updScore
|
| | | strValue3 faceInfo face,facePic
|
| | | '''
|
| | |
|
| | | ''' 榜单数据 '''
|
| | |
| | | def SetArenaBillRealmLV(billData, realmLV): return billData.SetValue1(realmLV)
|
| | | def GetArenaBillLV(billData): return billData.GetValue2()
|
| | | def SetArenaBillLV(billData, lv): billData.SetValue2(lv)
|
| | | def GetArenaBillFace(billData): return billData.GetValue3()
|
| | | def SetArenaBillFace(billData, face): billData.SetValue3(face)
|
| | | def GetArenaBillFacePic(billData): return billData.GetValue4()
|
| | | def SetArenaBillFacePic(billData, facePic): billData.SetValue4(facePic)
|
| | | def GetArenaBillScore(billData): return billData.GetCmpValue()
|
| | | def GetArenaBillFightPower(billData): return billData.GetCmpValue2()
|
| | | def SetArenaBillFightPower(billData, fightPower): billData.SetCmpValue2(fightPower)
|
| | | |
| | | def SetArenaBillScore(billData, score): return billData.SetCmpValue(score)
|
| | | def GetArenaBillFightPower(billData): return billData.GetCmpValue2() * ShareDefine.Def_PerPointValue + billData.GetCmpValue3()
|
| | | def SetArenaBillFightPower(billData, fightPower):
|
| | | billData.SetCmpValue2(fightPower / ShareDefine.Def_PerPointValue)
|
| | | billData.SetCmpValue3(fightPower % ShareDefine.Def_PerPointValue)
|
| | | return
|
| | |
|
| | | def OnServerStart():
|
| | | universalRecMgr = GameWorld.GetUniversalRecMgr()
|
| | | recDataList = universalRecMgr.GetTypeList(Def_RecType_ArenaBattleRecord)
|
| | |
| | | battleRec.isDispose = int(updInfo[0] if len(updInfo) > 0 else 0)
|
| | | battleRec.updScore = int(updInfo[1] if len(updInfo) > 1 else 0)
|
| | |
|
| | | strValue3 = recData.GetStrValue3()
|
| | | faceInfo = strValue3.split(",") if strValue3 else []
|
| | | battleRec.tagFace = int(faceInfo[0] if len(faceInfo) > 0 else 0)
|
| | | battleRec.tagFacePic = int(faceInfo[1] if len(faceInfo) > 1 else 0)
|
| | | |
| | | battleRecList = GetPlayerArenaBattleRecList(playerID)
|
| | | battleRecList.append(battleRec)
|
| | |
|
| | |
| | | if billBoard.GetCount() > 0:
|
| | | robotMaxCount = IpyGameDataPY.GetFuncCfg("ArenaRobot", 1)
|
| | | PlayerBillboard.UpdateBillboardMaxCount(ShareDefine.Def_BT_Arena, robotMaxCount)
|
| | | __RandRobotLVList(robotMaxCount)
|
| | | else:
|
| | | __ResetArenaRobotBillboard()
|
| | | |
| | | return
|
| | |
|
| | | def OnServerClose():
|
| | |
| | |
|
| | | recData.SetStrValue1("%s,%s" % (int(battleRec.isWin), battleRec.addScore))
|
| | | recData.SetStrValue2("%s,%s" % (int(battleRec.isDispose), battleRec.updScore))
|
| | | recData.SetStrValue3("%s,%s" % (battleRec.tagFace, battleRec.tagFacePic))
|
| | |
|
| | | return
|
| | |
|
| | |
| | | if updScore != None:
|
| | | __SyncPlayerBechallengedUpdScore(curPlayer, updScore)
|
| | |
|
| | | PlayerControl.DoOfflineUnprocessed(curPlayer, "BattleResult", __DoOfflineArenaBattleResult)
|
| | | return
|
| | |
|
| | | def OnDayEx():
|
| | |
| | | # 删除对战记录
|
| | | GameWorld.GetUniversalRecMgr().Delete(Def_RecType_ArenaBattleRecord)
|
| | | PyGameData.g_arenaPlayerBattleRecDict = {}
|
| | | PyGameData.g_arenaPlayerMatchDict = {}
|
| | | |
| | | # 删除未处理的
|
| | | PlayerControl.DelOfflineUnprocessed("BattleResult")
|
| | |
|
| | | # 更新新赛季信息
|
| | | if openServerDay <= customMaxServerDay and OSSeasonState == 0:
|
| | |
| | | robotMaxCount = IpyGameDataPY.GetFuncCfg("ArenaRobot", 1)
|
| | | GameWorld.Log(" 重置初始化竞技场机器人榜单! robotMaxCount=%s" % robotMaxCount)
|
| | | PlayerBillboard.UpdateBillboardMaxCount(ShareDefine.Def_BT_Arena, robotMaxCount)
|
| | | |
| | | PyGameData.g_arenaRobotLVList = []
|
| | | worldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
|
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ArenaWorldLV, worldLV)
|
| | | GameWorld.Log(" worldLV=%s" % worldLV)
|
| | |
|
| | | # 获取机器人随机等级、积分列表
|
| | | robotLVList = __RandRobotLVList(robotMaxCount)
|
| | |
| | | value1 = robotRealmLV
|
| | | value2 = robotLV
|
| | | cmpValue = robotScore
|
| | | cmpValue2 = robotFightPower
|
| | | PlayerBillboard.UpdatePlayerBillboard(robotID, robotName, opInfo, ShareDefine.Def_BT_Arena, type2, value1, value2, cmpValue, autoSort=False, cmpValue2=cmpValue2)
|
| | | cmpValue2 = robotFightPower / ShareDefine.Def_PerPointValue
|
| | | cmpValue3 = robotFightPower % ShareDefine.Def_PerPointValue
|
| | | PlayerBillboard.UpdatePlayerBillboard(robotID, robotName, opInfo, ShareDefine.Def_BT_Arena, type2, value1, value2, cmpValue, autoSort=False, cmpValue2=cmpValue2, cmpValue3=cmpValue3)
|
| | |
|
| | | billBoard.Sort()
|
| | | return
|
| | |
| | |
|
| | | lvList[0] = robotMinLV
|
| | | lvList[-1] = robotMaxLV
|
| | | PyGameData.g_arenaRobotLVList = sorted(lvList, reverse=True)
|
| | | return lvList
|
| | |
|
| | | def __GetRobotLVRange():
|
| | | ## 获取赛季机器人等级范围
|
| | | worldLV = max(1, PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv))
|
| | | worldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ArenaWorldLV)
|
| | | worldLV = max(1, worldLV)
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | maxCnt = ipyDataMgr.GetWorldLVCount()
|
| | | worldLVTime = 0
|
| | |
| | | # 其他的获得保底奖励
|
| | | orderPlayerIDList = orderPlayerIDDict.keys()
|
| | | floorPlayerIDList = []
|
| | | for playerID, batRecList in PyGameData.g_arenaPlayerBattleRecDict.items():
|
| | | if not batRecList:
|
| | | #GameWorld.DebugLog("没有对战记录,不发奖励")
|
| | | continue
|
| | | for playerID, battleRecList in PyGameData.g_arenaPlayerBattleRecDict.items():
|
| | | if playerID in orderPlayerIDList:
|
| | | continue
|
| | | if not battleRecList:
|
| | | #GameWorld.DebugLog("没有对战记录的不发! ", playerID)
|
| | | continue
|
| | | floorPlayerIDList.append(playerID)
|
| | | PlayerCompensation.SendMailByKey("ArenaFloorAward%s" % awardType, [playerID], floorAwardList)
|
| | |
| | | GameWorld.Log(" 奖励保底玩家信息: %s" % floorPlayerIDList)
|
| | | return
|
| | |
|
| | | def MapServer_Arena(curPlayer, msgList):
|
| | | GameWorld.DebugLog("MapServer_Arena %s" % str(msgList), curPlayer.GetPlayerID())
|
| | | def MapServer_Arena(playerID, msgList):
|
| | | GameWorld.DebugLog("MapServer_Arena %s" % str(msgList), playerID)
|
| | | if not msgList:
|
| | | return
|
| | |
|
| | | curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | cmd = msgList[0]
|
| | | cmdDict = msgList[1] if len(msgList) > 1 else {}
|
| | | retDict = {}
|
| | |
|
| | | # 匹配刷新
|
| | | if cmd == "MatchRefresh":
|
| | | if not curPlayer:
|
| | | return
|
| | | __DoArenaMatchRefresh(curPlayer, cmdDict["isRefresh"], cmdDict["playerLV"], cmdDict["playerScore"], cmdDict.get("gmMatchIDList"))
|
| | |
|
| | | # 对战结算
|
| | | elif cmd == "BattleResult":
|
| | | if not curPlayer:
|
| | | PlayerControl.AddOfflineUnprocessed(playerID, "BattleResult", cmdDict)
|
| | | return
|
| | | retDict = __DoArenaBattleResult(curPlayer, cmdDict)
|
| | |
|
| | | return msgList + [retDict]
|
| | |
| | | if gmMatchOrder in matchOrderList:
|
| | | continue
|
| | | gmMatchOrderList.append(gmMatchOrder)
|
| | | GameWorld.DebugAnswer(curPlayer, "指定匹配ID(%s),order(%s)" % (gmMatchID, gmMatchOrder), playerID)
|
| | | GameWorld.DebugAnswer(curPlayer, "指定匹配ID(%s),order(%s)" % (gmMatchID, gmMatchOrder))
|
| | |
|
| | | GameWorld.DebugLog("matchOrderList=%s,needMatchCount=%s" % (str(matchOrderList), needMatchCount))
|
| | | if matchOrderList:
|
| | |
| | | # 随机机器人备用信息
|
| | | openJobList = IpyGameDataPY.GetFuncEvalCfg("OpenJob", 1)
|
| | |
|
| | | randRobotLVScorePerInfo = IpyGameDataPY.GetFuncEvalCfg("ArenaMatch", 3)
|
| | | randRobotLVPerRange, randRobotScorePerRange = randRobotLVScorePerInfo
|
| | | minLV, maxLV = IpyGameDataPY.GetFuncEvalCfg("ArenaRobot", 2) # 机器人最小、最大等级
|
| | | randMinLV = min(minLV, int(playerLV * randRobotLVPerRange[0] / 100.0))
|
| | | randMaxLV = min(maxLV, int(playerLV * randRobotLVPerRange[1] / 100.0))
|
| | | minLV, _ = IpyGameDataPY.GetFuncEvalCfg("ArenaRobot", 2) # 机器人最小、最大等级
|
| | | randMinLV, randMaxLV = minLV - 10, minLV
|
| | | #randMinLV = min(minLV, int(playerLV * randRobotLVPerRange[0] / 100.0))
|
| | | #randMaxLV = min(maxLV, int(playerLV * randRobotLVPerRange[1] / 100.0))
|
| | |
|
| | | randRobotScorePerRange = IpyGameDataPY.GetFuncEvalCfg("ArenaMatch", 3)
|
| | | randMinScore = int(playerScore * randRobotScorePerRange[0] / 100.0)
|
| | | randMaxScore = int(playerScore * randRobotScorePerRange[1] / 100.0)
|
| | |
|
| | |
| | | SetArenaBillRealmLV(billData, cacheDict["RealmLV"])
|
| | | SetArenaBillLV(billData, cacheDict["LV"])
|
| | | SetArenaBillFightPower(billData, cacheDict["FightPower"])
|
| | | SetArenaBillFace(billData, cacheDict.get("Face", 0))
|
| | | SetArenaBillFacePic(billData, cacheDict.get("FacePic", 0))
|
| | | else:
|
| | | if matchIndex < len(PyGameData.g_arenaRobotLVList):
|
| | | robotLV = PyGameData.g_arenaRobotLVList[matchIndex] # 同步更新机器人榜单变化等级
|
| | | SetArenaBillLV(billData, robotLV)
|
| | |
|
| | | matchPlayer.tagLV = GetArenaBillLV(billData)
|
| | | matchPlayer.tagJob = GetArenaBillJob(billData)
|
| | | matchPlayer.tagScore = GetArenaBillScore(billData)
|
| | | matchPlayer.tagFace = GetArenaBillFace(billData)
|
| | | matchPlayer.tagFacePic = GetArenaBillFacePic(billData)
|
| | |
|
| | | GameWorld.DebugLog(" %s 匹配在榜单上的: tagPlayerID=%s,tagLV=%s,tagScore=%s,matchOrder=%s"
|
| | | % (i + 1, matchPlayer.tagPlayerID, matchPlayer.tagLV, matchPlayer.tagScore, matchOrder), playerID)
|
| | |
| | | matchInfo.Job = matchPlayer.tagJob
|
| | | matchInfo.LV = matchPlayer.tagLV
|
| | | matchInfo.Score = matchPlayer.tagScore
|
| | | matchInfo.Face = matchPlayer.tagFace
|
| | | matchInfo.FacePic = matchPlayer.tagFacePic
|
| | |
|
| | | # 玩家读取额外信息, 机器人其他信息不处理,这里直接读最新的查看缓存,防止刷新不及时(并不是实时数据,只是相对实时,前端可自行控制刷新频率)
|
| | | if matchInfo.PlayerID > MaxRobotID:
|
| | | curCache = PlayerViewCache.FindViewCache(matchInfo.PlayerID)
|
| | | if curCache:
|
| | | cacheDict = PlayerViewCache.GetCachePropDataDict(curCache)
|
| | | fightPower = cacheDict["FightPower"]
|
| | | matchInfo.LV = cacheDict["LV"]
|
| | | matchInfo.PlayerName = cacheDict["Name"]
|
| | | matchInfo.RealmLV = cacheDict["RealmLV"]
|
| | | matchInfo.FightPower = cacheDict["FightPower"]
|
| | | |
| | | matchInfo.FightPower = fightPower % ShareDefine.Def_PerPointValue
|
| | | matchInfo.FightPowerEx = fightPower / ShareDefine.Def_PerPointValue
|
| | | matchInfo.Face = cacheDict.get("Face", 0)
|
| | | matchInfo.FacePic = cacheDict.get("FacePic", 0)
|
| | | else:
|
| | | # 此处机器人的暂忽略等级变化的同步,仅在刷新、更新积分时同步,此处省略查询机器人所属榜单排名
|
| | | pass
|
| | | |
| | | clientPack.MatchList.append(matchInfo)
|
| | | clientPack.MatchCount = len(clientPack.MatchList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | | def __DoOfflineArenaBattleResult(curPlayer, recData, cmdName, cmdDict):
|
| | | ## 执行离线未处理的战斗结果
|
| | | recTime = recData.GetTime()
|
| | | msgList = [cmdName, cmdDict]
|
| | | retDict = __DoArenaBattleResult(curPlayer, cmdDict)
|
| | | retDict["offlineRecTime"] = recTime
|
| | | ret = msgList + [retDict]
|
| | | resultName = '%s' % ret |
| | | curPlayer.MapServer_QueryPlayerResult(0, 0, "Arena", resultName, len(resultName))
|
| | | return
|
| | |
|
| | | def __DoArenaBattleResult(curPlayer, cmdDict):
|
| | |
| | | retDict = {}
|
| | | retDict.update(cmdDict)
|
| | |
|
| | | accID = curPlayer.GetAccID()
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.DebugLog("竞技场玩家战斗结果: %s" % str(cmdDict), playerID)
|
| | |
|
| | |
| | |
|
| | | curScore = playerScore
|
| | | isFindTag = False
|
| | | tagLV, tagJob, tagScore = 0, 0, 0
|
| | | tagLV, tagJob, tagScore, tagFace, tagFacePic = 0, 0, 0, 0, 0
|
| | | tagRealmLV, tagFightPower, tagAccID = 0, 0, "" # 机器人无值
|
| | |
|
| | | # 先找匹配列表
|
| | | matchList = PyGameData.g_arenaPlayerMatchDict.get(playerID, [])
|
| | | for matchPlayer in matchList:
|
| | | if matchPlayer.tagPlayerID == tagPlayerID:
|
| | | isFindTag = True
|
| | | tagLV, tagJob, tagScore = matchPlayer.tagLV, matchPlayer.tagJob, matchPlayer.tagScore
|
| | | tagLV, tagJob, tagScore, tagFace, tagFacePic = matchPlayer.tagLV, matchPlayer.tagJob, matchPlayer.tagScore, matchPlayer.tagFace, matchPlayer.tagFacePic
|
| | | GameWorld.DebugLog(" 对手在匹配列表中! tagLV=%s, tagJob=%s, tagScore=%s" % (tagLV, tagJob, tagScore), playerID)
|
| | | break
|
| | |
|
| | |
| | | for battleRec in curBattleRecList:
|
| | | if battleRec.tagPlayerID == tagPlayerID:
|
| | | isFindTag = True
|
| | | tagLV, tagJob, tagScore = battleRec.tagLV, battleRec.tagJob, battleRec.tagScore
|
| | | tagLV, tagJob, tagScore, tagFace, tagFacePic = battleRec.tagLV, battleRec.tagJob, battleRec.tagScore, battleRec.tagFace, battleRec.tagFacePic
|
| | | GameWorld.DebugLog(" 对手在对战记录中! tagLV=%s, tagJob=%s, tagScore=%s" % (tagLV, tagJob, tagScore), playerID)
|
| | | break
|
| | |
|
| | |
| | |
|
| | | opInfo = ""
|
| | | # 结算自己
|
| | | addScore = __CalcBattleAddScore(curScore, tagScore, isWin)
|
| | | addScore = __CalcBattleAddScore(playerID, curScore, tagScore, isWin)
|
| | | updScore = max(0, playerScore + addScore)
|
| | | GameWorld.DebugLog(" 更新自身积分: addScore=%s,updScore=%s" % (addScore, updScore), playerID)
|
| | |
|
| | | curOrder = billBoard.IndexOfByID(playerID) + 1 # 更新前获取名次
|
| | | cmpValue2 = fightPower / ShareDefine.Def_PerPointValue
|
| | | cmpValue3 = fightPower % ShareDefine.Def_PerPointValue
|
| | | face = curPlayer.GetFace()
|
| | | facePic = curPlayer.GetFacePic()
|
| | | PlayerBillboard.UpdatePlayerBillboard(playerID, playerName, opInfo, ShareDefine.Def_BT_Arena, playerJob,
|
| | | realmLV, playerLV, updScore, autoSort=False, cmpValue2=fightPower)
|
| | | realmLV, playerLV, updScore, autoSort=False, cmpValue2=cmpValue2, cmpValue3=cmpValue3, value3=face, value4=facePic)
|
| | |
|
| | | awardItemList = []
|
| | | if isWin:
|
| | | randItemList = IpyGameDataPY.GetFuncEvalCfg("ArenaBattleAward", 3)
|
| | | awardItemInfo = GameWorld.GetResultByRandomList(randItemList)
|
| | | if awardItemInfo:
|
| | | awardItemList.append(awardItemInfo)
|
| | | |
| | | awardItemList.append(awardItemInfo[:3])
|
| | | isWorldNotify = awardItemInfo[3] if len(awardItemInfo) > 3 else 0
|
| | | if isWorldNotify:
|
| | | PlayerControl.WorldNotify(0, "ArenaWinerItem", [curPlayer.GetName(), awardItemInfo[0], "", awardItemInfo[1]])
|
| | | |
| | | tagAddScore = __CalcBattleAddScore(tagPlayerID, tagScore, curScore, not isWin)
|
| | | updTagScore = max(0, tagScore + tagAddScore)
|
| | | # 结算对手,仅玩家时结算,机器人不处理
|
| | | if tagPlayerID > MaxRobotID:
|
| | | tagAddScore = __CalcBattleAddScore(tagScore, curScore, not isWin)
|
| | | updTagScore = max(0, tagScore + tagAddScore)
|
| | | GameWorld.DebugLog(" 更新对手积分: tagAddScore=%s,updTagScore=%s" % (tagAddScore, updTagScore), playerID)
|
| | | tagCache = PlayerViewCache.FindViewCache(tagPlayerID)
|
| | | if tagCache:
|
| | | cacheDict = PlayerViewCache.GetCachePropDataDict(tagCache)
|
| | | tagOpInfo = ""
|
| | | tagLV = cacheDict["LV"]
|
| | | tagPlayerName = cacheDict["Name"]
|
| | | tagRealmLV = cacheDict["RealmLV"]
|
| | | tagFightPower = cacheDict["FightPower"]
|
| | | tagAccID = cacheDict["AccID"]
|
| | | tagCmpValue2 = tagFightPower / ShareDefine.Def_PerPointValue
|
| | | tagCmpValue3 = tagFightPower % ShareDefine.Def_PerPointValue
|
| | | tagFace = cacheDict.get("Face", 0)
|
| | | tagFacePic = cacheDict.get("FacePic", 0)
|
| | | PlayerBillboard.UpdatePlayerBillboard(tagPlayerID, tagPlayerName, tagOpInfo, ShareDefine.Def_BT_Arena, tagJob,
|
| | | tagRealmLV, tagLV, updTagScore, autoSort=False, cmpValue2=tagFightPower)
|
| | | tagRealmLV, tagLV, updTagScore, autoSort=False, cmpValue2=tagCmpValue2, cmpValue3=tagCmpValue3, value3=tagFace, value4=tagFacePic)
|
| | | else:
|
| | | updTagScore = tagScore
|
| | | GameWorld.DebugLog(" 机器人对手,积分不变!updTagScore=%s" % updTagScore, playerID)
|
| | | |
| | | robotBillboardData = billBoard.FindByID(tagPlayerID)
|
| | | if robotBillboardData:
|
| | | SetArenaBillScore(robotBillboardData, updTagScore)
|
| | | |
| | | # 都更新完后排序一次
|
| | | billBoard.Sort()
|
| | | updOrder = billBoard.IndexOfByID(playerID) + 1 # 取最新名次
|
| | | GameWorld.DebugLog(" 更新自身积分: addScore=%s,updScore=%s,curOrder=%s,updOrder=%s" % (addScore, updScore, curOrder, updOrder), playerID)
|
| | | GameWorld.DebugLog(" 更新对手积分: tagPlayerID=%s,tagAddScore=%s,updTagScore=%s" % (tagPlayerID, tagAddScore, updTagScore), playerID)
|
| | | retDict.update({"addScore":addScore, "updScore":updScore, "curOrder":curOrder, "updOrder":updOrder,
|
| | | "awardItemList":awardItemList, "isOK":True})
|
| | |
|
| | | if tagPlayerID <= MaxRobotID:
|
| | | tagUpdOrder = billBoard.IndexOfByID(tagPlayerID) + 1 # 取最新名次
|
| | | tagOrderIndex = tagUpdOrder - 1
|
| | | if tagUpdOrder >= 1 and tagOrderIndex < len(PyGameData.g_arenaRobotLVList) and tagOrderIndex < billBoard.GetCount():
|
| | | GameWorld.DebugLog(" PyGameData.g_arenaRobotLVList=%s" % PyGameData.g_arenaRobotLVList, playerID)
|
| | | updRobotLV = PyGameData.g_arenaRobotLVList[tagOrderIndex]
|
| | | robotBillboardData = billBoard.At(tagOrderIndex)
|
| | | SetArenaBillLV(robotBillboardData, updRobotLV)
|
| | | GameWorld.DebugLog(" 机器人在榜上,更新等级信息! tagPlayerID=%s,tagUpdOrder=%s,updRobotLV=%s" % (tagPlayerID, tagUpdOrder, updRobotLV), playerID)
|
| | | else:
|
| | | GameWorld.DebugLog(" 机器人不在榜上,不更新等级信息! tagPlayerID=%s" % tagPlayerID, playerID)
|
| | | |
| | | battleRecMaxCount = min(MaxBattleRecCount, IpyGameDataPY.GetFuncCfg("ArenaSet", 4))
|
| | |
|
| | | # 插入对战记录
|
| | |
| | | battleRec.addScore = addScore
|
| | | battleRec.isDispose = 1
|
| | | battleRec.updScore = updScore
|
| | | battleRec.tagFace = tagFace
|
| | | battleRec.tagFacePic = tagFacePic
|
| | | curBattleRecList.append(battleRec)
|
| | | if len(curBattleRecList) > battleRecMaxCount:
|
| | | curBattleRecList = curBattleRecList[len(curBattleRecList) - battleRecMaxCount:]
|
| | |
| | | tagBattleRec.addScore = tagAddScore
|
| | | tagBattleRec.isDispose = 1 if tagOnline else 0
|
| | | tagBattleRec.updScore = updTagScore
|
| | | tagBattleRec.tagFace = face
|
| | | tagBattleRec.tagFacePic = facePic
|
| | | tagBattleRecList.append(tagBattleRec)
|
| | | if len(tagBattleRecList) > battleRecMaxCount:
|
| | | tagBattleRecList = tagBattleRecList[len(tagBattleRecList) - battleRecMaxCount:]
|
| | |
| | |
|
| | | # 对战结束,最后免费刷新一次匹配列表
|
| | | __DoArenaMatchRefresh(curPlayer, True, playerLV, updScore)
|
| | | |
| | | drDict = {"AccID":accID, "PlayerID":playerID, "playerLV":playerLV, "realmLV":realmLV, "fightPower":fightPower, "curScore":[curScore, addScore, updScore], |
| | | "TagAccID":tagAccID, "TagPlayerID":tagPlayerID, "tagLV":tagLV, "tagRealmLV":tagRealmLV, "tagFightPower":tagFightPower, |
| | | "tagScore":[tagScore, tagAddScore, updTagScore], "isWin":isWin}
|
| | | DataRecordPack.SendEventPack("ArenaBattleResult", drDict)
|
| | | return retDict
|
| | |
|
| | | def __SyncPlayerBechallengedUpdScore(curPlayer, updScore):
|
| | |
| | | cmdStr, len(cmdStr), curPlayer.GetRouteServerIndex())
|
| | | return
|
| | |
|
| | | def __CalcBattleAddScore(curScore, tagScore, isWin):
|
| | | def __CalcBattleAddScore(playerID, curScore, tagScore, isWin):
|
| | | ## 计算对战增加积分
|
| | | diffScore = curScore - tagScore # 积分差,有正负
|
| | | calcScoreFormatDict = IpyGameDataPY.GetFuncEvalCfg("ArenaBattleAward", 1) if isWin else IpyGameDataPY.GetFuncEvalCfg("ArenaBattleAward", 2)
|
| | | scoreKeyList = calcScoreFormatDict.keys()
|
| | | scoreKeyList.sort()
|
| | | calcKey = ""
|
| | | calcKey = None
|
| | | for scoreKey in scoreKeyList:
|
| | | if diffScore <= scoreKey:
|
| | | calcKey = scoreKey
|
| | | break
|
| | |
|
| | | if not calcKey:
|
| | | if calcKey == None:
|
| | | GameWorld.ErrLog(" 计算得分公式: playerID=%s,diffScore=%s,scoreKeyList=%s,isWin=%s 找不到对应key公式" |
| | | % (playerID, diffScore, scoreKeyList, isWin))
|
| | | return 0
|
| | |
|
| | | compileKey = "ArenaBattleScore_%s_%s" % (int(isWin), str(calcKey))
|
| | | formatStr = calcScoreFormatDict[calcKey]
|
| | | addScore = eval(FormulaControl.GetCompileFormula(compileKey, formatStr))
|
| | | GameWorld.DebugLog(" 计算得分公式: diffScore=%s,isWin=%s,compileKey=%s,formatStr=%s,addScore=%s" |
| | | % (diffScore, isWin, compileKey, formatStr, addScore))
|
| | | GameWorld.DebugLog(" 计算得分公式: playerID=%s,diffScore=%s,scoreKeyList=%s,isWin=%s,compileKey=%s,formatStr=%s,addScore=%s" |
| | | % (playerID, diffScore, scoreKeyList, isWin, compileKey, formatStr, addScore))
|
| | | return addScore
|
| | |
|
| | | #// A9 A8 查看竞技场对战记录 #tagCGQueryArenaBattleRecord
|
| | |
| | | recInfo.PlayerID = battleRec.tagPlayerID
|
| | | recInfo.Job = battleRec.tagJob
|
| | | recInfo.LV = battleRec.tagLV
|
| | | recInfo.Score = battleRec.tagScore
|
| | | recInfo.AddScore = str(battleRec.addScore)
|
| | | recInfo.AddScoreLen = len(recInfo.AddScore)
|
| | | recInfo.IsWin = battleRec.isWin
|
| | | recInfo.Time = battleRec.battleTime
|
| | | recInfo.Face = battleRec.tagFace
|
| | | recInfo.FacePic = battleRec.tagFacePic
|
| | |
|
| | | if recInfo.PlayerID > MaxRobotID:
|
| | | curCache = PlayerViewCache.FindViewCache(recInfo.PlayerID)
|
| | | if curCache:
|
| | | cacheDict = PlayerViewCache.GetCachePropDataDict(curCache)
|
| | | fightPower = cacheDict["FightPower"]
|
| | | recInfo.LV = cacheDict["LV"]
|
| | | recInfo.PlayerName = cacheDict["Name"]
|
| | | recInfo.RealmLV = cacheDict["RealmLV"]
|
| | | recInfo.FightPower = cacheDict["FightPower"]
|
| | | recInfo.FightPower = fightPower % ShareDefine.Def_PerPointValue
|
| | | recInfo.FightPowerEx = fightPower / ShareDefine.Def_PerPointValue
|
| | |
|
| | | clientPack.BattleRecordList.append(recInfo)
|
| | |
|
| | |
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | #// A9 A5 查看竞技场对战玩家最新信息 #tagCGQueryArenaBattlePlayer
|
| | | #
|
| | | #struct tagCGQueryArenaBattlePlayer
|
| | | #{
|
| | | # tagHead Head;
|
| | | # DWORD PlayerID; //目标玩家ID,仅支持查真实玩家
|
| | | #};
|
| | | def OnQueryArenaBattlePlayer(index, clientData, tick):
|
| | | |
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | if not curPlayer:
|
| | | return
|
| | | |
| | | tagPlayerID = clientData.PlayerID
|
| | | tagBattleRecList = GetPlayerArenaBattleRecList(tagPlayerID)
|
| | | if not tagBattleRecList:
|
| | | GameWorld.ErrLog("竞技场玩家无对战记录,无法查询最新数据! tagPlayerID=%s" % tagPlayerID, curPlayer.GetPlayerID())
|
| | | return
|
| | | tagBattleRec = tagBattleRecList[-1] # 取最后一条为最新数据
|
| | | tagScore = tagBattleRec.updScore
|
| | | |
| | | clientPack = ChPyNetSendPack.tagGCArenaBattlePlayerInfo()
|
| | | clientPack.PlayerID = tagPlayerID
|
| | | clientPack.Score = tagScore
|
| | | |
| | | curCache = PlayerViewCache.FindViewCache(tagPlayerID)
|
| | | if curCache:
|
| | | cacheDict = PlayerViewCache.GetCachePropDataDict(curCache)
|
| | | fightPower = cacheDict["FightPower"]
|
| | | clientPack.LV = cacheDict["LV"]
|
| | | clientPack.Job = cacheDict["Job"]
|
| | | clientPack.PlayerName = cacheDict["Name"]
|
| | | clientPack.RealmLV = cacheDict["RealmLV"]
|
| | | clientPack.FightPower = fightPower % ShareDefine.Def_PerPointValue
|
| | | clientPack.FightPowerEx = fightPower / ShareDefine.Def_PerPointValue
|
| | | |
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|