| | |
| | | import NetPackCommon
|
| | | import IpyGameDataPY
|
| | | import PyGameData
|
| | | import ChConfig
|
| | |
|
| | | import random
|
| | | import time
|
| | |
| | | # 其他的获得保底奖励
|
| | | 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 OnTurnFightRequest(curPlayer, mapID, funcLineID, tagType, tagID, valueList):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | if not valueList or len(valueList) < 1:
|
| | | GameWorld.DebugLog("没有指定valueList!", playerID)
|
| | | return
|
| | | tagPlayerID = valueList[0]
|
| | | |
| | | isFindTag, tagLV, tagJob, tagScore = __findBattleTag(playerID, tagPlayerID)
|
| | | if not isFindTag:
|
| | | GameWorld.ErrLog("找不到对战对手,不在匹配列表或对战记录里!不能战斗!tagPlayerID=%s" % tagPlayerID, playerID)
|
| | | return
|
| | | |
| | | if tagPlayerID <= MaxRobotID:
|
| | | #验证NPCID是否正确
|
| | | if tagType != ChConfig.TurnBattle_TagType_NPC:
|
| | | GameWorld.ErrLog("竞技场请求回合战斗目标为机器人时tagType错误! tagType=%s != %s" |
| | | % (tagType, ChConfig.TurnBattle_TagType_NPC), playerID)
|
| | | return
|
| | | robotLVNPCIDDict = IpyGameDataPY.GetFuncEvalCfg("ArenaRobotLVNPC", 1, {})
|
| | | lvList = [int(lvStr) for lvStr in robotLVNPCIDDict.keys()]
|
| | | lvList.sort()
|
| | | tagLVStr = ""
|
| | | for lv in lvList:
|
| | | if tagLV <= lv:
|
| | | tagLVStr = str(lv)
|
| | | break
|
| | | if tagLVStr not in robotLVNPCIDDict:
|
| | | GameWorld.ErrLog("竞技场找不到该等级机器人对应的回合战斗NPCID! tagPlayerID=%s,tagLV=%s" % (tagPlayerID, tagLV), playerID)
|
| | | return
|
| | | npcID = robotLVNPCIDDict[tagLVStr]
|
| | | if npcID != tagID:
|
| | | GameWorld.ErrLog("竞技场请求回合战斗的机器人等级对应的NPCID不一致! tagPlayerID=%s,tagLV=%s,tagID=%s != npcID=%s" |
| | | % (tagPlayerID, tagLV, tagID, npcID), playerID)
|
| | | return
|
| | | |
| | | return True
|
| | |
|
| | | def MapServer_Arena(curPlayer, msgList):
|
| | | GameWorld.DebugLog("MapServer_Arena %s" % str(msgList), curPlayer.GetPlayerID())
|
| | |
| | | matchInfo.RealmLV = cacheDict["RealmLV"]
|
| | | matchInfo.FightPower = fightPower % ShareDefine.Def_PerPointValue
|
| | | matchInfo.FightPowerEx = fightPower / ShareDefine.Def_PerPointValue
|
| | | matchInfo.Face = cacheDict.get("Face", 0)
|
| | | else:
|
| | | # 此处机器人的暂忽略等级变化的同步,仅在刷新、更新积分时同步,此处省略查询机器人所属榜单排名
|
| | | pass
|
| | |
| | | clientPack.MatchCount = len(clientPack.MatchList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | | def __findBattleTag(playerID, tagPlayerID):
|
| | | ## 检查查找要战斗的对象是否合法
|
| | | |
| | | isFindTag = False
|
| | | tagLV, tagJob, tagScore = 0, 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
|
| | | GameWorld.DebugLog(" 对手在匹配列表中! tagLV=%s, tagJob=%s, tagScore=%s" % (tagLV, tagJob, tagScore), playerID)
|
| | | break
|
| | | |
| | | # 在找对战记录列表
|
| | | curBattleRecList = GetPlayerArenaBattleRecList(playerID)
|
| | | if not isFindTag:
|
| | | for battleRec in curBattleRecList:
|
| | | if battleRec.tagPlayerID == tagPlayerID:
|
| | | isFindTag = True
|
| | | tagLV, tagJob, tagScore = battleRec.tagLV, battleRec.tagJob, battleRec.tagScore
|
| | | GameWorld.DebugLog(" 对手在对战记录中! tagLV=%s, tagJob=%s, tagScore=%s" % (tagLV, tagJob, tagScore), playerID)
|
| | | break
|
| | | |
| | | return isFindTag, tagLV, tagJob, tagScore
|
| | |
|
| | | def __DoArenaBattleResult(curPlayer, cmdDict):
|
| | | ## 地图玩家同步战斗结果
|
| | |
| | | '''
|
| | |
|
| | | curScore = playerScore
|
| | | isFindTag = False
|
| | | tagLV, tagJob, tagScore = 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
|
| | | GameWorld.DebugLog(" 对手在匹配列表中! tagLV=%s, tagJob=%s, tagScore=%s" % (tagLV, tagJob, tagScore), playerID)
|
| | | break
|
| | | |
| | | # 在找对战记录列表
|
| | | curBattleRecList = GetPlayerArenaBattleRecList(playerID)
|
| | | if not isFindTag:
|
| | | for battleRec in curBattleRecList:
|
| | | if battleRec.tagPlayerID == tagPlayerID:
|
| | | isFindTag = True
|
| | | tagLV, tagJob, tagScore = battleRec.tagLV, battleRec.tagJob, battleRec.tagScore
|
| | | GameWorld.DebugLog(" 对手在对战记录中! tagLV=%s, tagJob=%s, tagScore=%s" % (tagLV, tagJob, tagScore), playerID)
|
| | | break
|
| | | |
| | | isFindTag, tagLV, tagJob, tagScore = __findBattleTag(playerID, tagPlayerID)
|
| | | if not isFindTag:
|
| | | GameWorld.ErrLog("找不到对战对手,不在匹配列表或对战记录里!不处理结算!tagPlayerID=%s" % tagPlayerID, playerID)
|
| | | return retDict
|
| | |
|
| | | curBattleRecList = GetPlayerArenaBattleRecList(playerID)
|
| | | billBoard = GameWorld.GetBillboard().FindBillboard(ShareDefine.Def_BT_Arena)
|
| | | if not billBoard:
|
| | | return retDict
|
| | |
| | | recInfo.RealmLV = cacheDict["RealmLV"]
|
| | | recInfo.FightPower = fightPower % ShareDefine.Def_PerPointValue
|
| | | recInfo.FightPowerEx = fightPower / ShareDefine.Def_PerPointValue
|
| | | recInfo.Face = cacheDict.get("Face", 0)
|
| | |
|
| | | clientPack.BattleRecordList.append(recInfo)
|
| | |
|
| | |
| | | clientPack.RealmLV = cacheDict["RealmLV"]
|
| | | clientPack.FightPower = fightPower % ShareDefine.Def_PerPointValue
|
| | | clientPack.FightPowerEx = fightPower / ShareDefine.Def_PerPointValue
|
| | | clientPack.Face = cacheDict.get("Face", 0)
|
| | |
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|