| | |
| | | import PlayerControl
|
| | | import PyDataManager
|
| | | import NetPackCommon
|
| | | import GameXiangong
|
| | | import GameWorship
|
| | | import PyGameData
|
| | | import ChConfig
|
| | | import PlayerFB
|
| | |
| | | import datetime
|
| | | import random
|
| | | import time
|
| | | import json
|
| | |
|
| | | Def_CrossChampionshipPlayerMax = 64 # 最大玩家数
|
| | | Def_CrossChampionshipPlayerWFCount = 8 # 胜负排位所需玩家数
|
| | |
| | | value3:playerIDA 玩家IDA
|
| | | value4:playerIDB 玩家IDB
|
| | | value5:winPlayerID 获胜玩家ID
|
| | | strValue3:battleDict 镜像PK场次结果 {"玩家ID":[[第1场胜负,加积分,...], ...], ...}
|
| | | '''
|
| | |
|
| | | Def_RecType_CrossChampionshipGuess = ShareDefine.Def_UniversalGameRecType_CrossChampionshipGuess
|
| | |
| | | value3:guessPlayerID 竞猜玩家ID
|
| | | value4:tagPlayerID 目标玩家ID
|
| | | value5:moneyTotal 投注总货币值
|
| | | StrValue1:isClose 是否已结算
|
| | | '''
|
| | |
|
| | | Def_RecType_CrossChampionshipOfficial = ShareDefine.Def_UniversalGameRecType_CrossChampionshipOfficial
|
| | |
| | | 跨服排位争霸赛最终排名官职信息
|
| | | ShareDefine.Def_UniversalGameRecType_CrossChampionshipOfficial
|
| | | time:time 上一次辞退下级仙官时间
|
| | | value1:zoneID官职ID 官职ID*10 + 分区ID
|
| | | value1:官职ID 官职ID
|
| | | value2:playerID 玩家ID,可能为0
|
| | | value3:worshipValue 被膜拜次数*10 + 是否双倍
|
| | | value4:rank 排名
|
| | | value5:zoneID 分区ID
|
| | | StrValue3: [申请该官职玩家ID,...]
|
| | | '''
|
| | |
|
| | |
| | | '''
|
| | | 跨服排位争霸赛官职挑战信息
|
| | | ShareDefine.Def_UniversalGameRecType_CrossChampionshipOffChallenge
|
| | | value1:zoneID官职ID 官职ID*10 + 分区ID
|
| | | value1:官职ID 官职ID
|
| | | value2:zoneID 分区ID
|
| | | StrValue3: {挑战玩家信息key:value, ...}
|
| | | '''
|
| | |
|
| | |
| | | self.lv = 0
|
| | | self.fightPower = 0
|
| | | self.realmLV = 0
|
| | | self.face = 0
|
| | | self.facePic = 0
|
| | | return
|
| | |
|
| | | def GetString(self):
|
| | |
| | | playerShortInfo["LV"] = cacheDict.get("LV", 1)
|
| | | playerShortInfo["FightPower"] = cacheDict.get("FightPower", 0)
|
| | | playerShortInfo["RealmLV"] = cacheDict.get("RealmLV", 0)
|
| | | playerShortInfo["Face"] = cacheDict.get("Face", 0)
|
| | | playerShortInfo["FacePic"] = cacheDict.get("FacePic", 0)
|
| | | self.applyPlayerInfo[applyPlayerID] = playerShortInfo
|
| | | return {"zoneID":self.zoneID, "officialID":self.officialID, "lastDismissJuniorTime":self.lastDismissJuniorTime,
|
| | | "accID":self.accID, "playerID":self.playerID, "playerName":self.playerName,
|
| | | "accID":self.accID, "playerID":self.playerID, "playerName":self.playerName, "face":self.face, "facePic":self.facePic,
|
| | | "job":self.job, "lv":self.lv, "fightPower":self.fightPower, "realmLV":self.realmLV, "rank":self.rank,
|
| | | "worshipCount":self.worshipCount, "applyPlayerInfo":self.applyPlayerInfo, "challengeList":self.challengeList,
|
| | | "worshipDouble":self.worshipDouble
|
| | |
| | | self.tagPlayerID = 0 # 目标玩家ID
|
| | | self.moneyTotal = 0 # 投注总货币值
|
| | | self.guessRank = 0 # 竞猜名次,没有名次的竞猜默认0;1-代表第一名
|
| | | self.isClose = 0 # 是否已结算
|
| | | return
|
| | |
|
| | | def GetString(self):
|
| | |
| | | self.lv = 0
|
| | | self.fightPower = 0
|
| | | self.realmLV = 0
|
| | | self.face = 0
|
| | | self.facePic = 0
|
| | | return
|
| | |
|
| | | def GetString(self):
|
| | | return {"zoneID":self.zoneID, "accID":self.accID, "playerID":self.playerID, "playerName":self.playerName,
|
| | | "job":self.job, "lv":self.lv, "fightPower":self.fightPower, "realmLV":self.realmLV}
|
| | | "job":self.job, "lv":self.lv, "fightPower":self.fightPower, "realmLV":self.realmLV, "face":self.face, "facePic":self.facePic}
|
| | |
|
| | | def SetAttr(self, attrDict):
|
| | | for k, v in attrDict.items():
|
| | |
| | | self.playerIDA = 0
|
| | | self.playerIDB = 0
|
| | | self.winPlayerID = 0
|
| | | self.playerBatDict = {} # 镜像PK场次结果 {"玩家ID":[[第1场胜负,加积分,...], ...], ...}
|
| | |
|
| | | # 不存档
|
| | | self.roomID = 0
|
| | |
| | |
|
| | | def GetString(self):
|
| | | return {"overTime":self.overTime, "zoneID":self.zoneID, "groupMark":self.groupMark, "battleNum":self.battleNum,
|
| | | "playerIDA":self.playerIDA, "playerIDB":self.playerIDB, "winPlayerID":self.winPlayerID}
|
| | | "playerIDA":self.playerIDA, "playerIDB":self.playerIDB, "winPlayerID":self.winPlayerID, "playerBatDict":self.playerBatDict}
|
| | |
|
| | | def SetAttr(self, attrDict):
|
| | | for k, v in attrDict.items():
|
| | |
| | | GameWorld.Log("无该跨服排位争霸赛对战场次信息: groupMark=%s,battleNum=%s" % (groupMark, battleNum))
|
| | |
|
| | | # 不可能执行的代码,方便 . 出提示代码
|
| | | if False:
|
| | | if not battle and False:
|
| | | battle = ChampionshipBattle()
|
| | | return battle
|
| | | |
| | | def GetBattleByPlayerID(self, groupMark, playerID):
|
| | | battle = None
|
| | | if groupMark in self.battleInfo:
|
| | | battleDict = self.battleInfo[groupMark]
|
| | | for bat in battleDict.values():
|
| | | if playerID == bat.playerIDA or playerID == bat.playerIDB:
|
| | | battle = bat
|
| | | break
|
| | | |
| | | if not battle:
|
| | | GameWorld.Log("无该跨服排位争霸赛对战场次信息: groupMark=%s,playerID=%s" % (groupMark, playerID))
|
| | | |
| | | # 不可能执行的代码,方便 . 出提示代码
|
| | | if not battle and False:
|
| | | battle = ChampionshipBattle()
|
| | | return battle
|
| | |
|
| | |
| | | if not obj or not hasattr(obj, "playerName"):
|
| | | return
|
| | |
|
| | | packDataObj = PyDataManager.GetDBPlayerPackDataManager().GetPlayerPackObj(playerID)
|
| | | # 如果有打包数据,以打包数据为准
|
| | | if packDataObj:
|
| | | obj.accID = packDataObj.accID
|
| | | obj.playerName = packDataObj.playerName
|
| | | obj.job = packDataObj.job
|
| | | obj.lv = packDataObj.lv
|
| | | obj.fightPower = packDataObj.fightPower
|
| | | obj.realmLV = packDataObj.realmLV
|
| | | obj.face = packDataObj.face
|
| | | obj.facePic = packDataObj.facePic
|
| | | return
|
| | | |
| | | if playerID < 10000:
|
| | | if obj.playerName:
|
| | | return
|
| | |
| | | obj.lv = cacheDict.get("LV", obj.lv)
|
| | | obj.fightPower = cacheDict.get("FightPower", obj.fightPower)
|
| | | obj.realmLV = cacheDict.get("RealmLV", obj.realmLV)
|
| | | obj.face = cacheDict.get("Face", obj.face)
|
| | | obj.facePic = cacheDict.get("FacePic", obj.facePic)
|
| | |
|
| | | return
|
| | |
|
| | |
| | | return
|
| | |
|
| | | def GetChampPKZoneIDList(self): return self._pkZoneInfo.keys()
|
| | | def GetChampPKZoneMgr(self, zoneID):
|
| | | def GetChampPKZoneMgr(self, zoneID, addNew=False):
|
| | | pkZoneMgr = None
|
| | | if zoneID in self._pkZoneInfo:
|
| | | pkZoneMgr = self._pkZoneInfo[zoneID]
|
| | | else:
|
| | | elif addNew:
|
| | | pkZoneMgr = ChampionshipPKZoneMgr(zoneID)
|
| | | self._pkZoneInfo[zoneID] = pkZoneMgr
|
| | | if not pkZoneMgr:
|
| | | GameWorld.ErrLog("找不到跨服排位赛分区管理! zoneID=%s" % zoneID)
|
| | | return pkZoneMgr
|
| | |
|
| | | def GetPlayerPKZoneID(self, playerID):
|
| | |
| | | # @return: 如果在排位中则返回所在排位分区,否则返回当前服务器所在跨服匹配PK分区
|
| | | for zoneID in self._pkZoneInfo.keys():
|
| | | pkZoneMgr = self.GetChampPKZoneMgr(zoneID)
|
| | | if not pkZoneMgr:
|
| | | continue
|
| | | if playerID in pkZoneMgr.GetBatPlayerIDList():
|
| | | return zoneID
|
| | | return GameWorld.GetGameWorld().GetDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKZoneID)
|
| | |
| | | playerIDA = recData.GetValue3()
|
| | | playerIDB = recData.GetValue4()
|
| | | winPlayerID = recData.GetValue5()
|
| | | |
| | | strValue3 = recData.GetStrValue3()
|
| | | try:
|
| | | playerBatDict = eval(strValue3) if strValue3 else {}
|
| | | except:
|
| | | playerBatDict = {}
|
| | | #if not playerIDA and not playerIDB:
|
| | | # continue
|
| | |
|
| | | groupMark = groupInfo / 100
|
| | | battleNum = groupInfo % 100
|
| | |
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID, True)
|
| | |
|
| | | if groupMark in groupMarkList and battleNum:
|
| | | battle = ChampionshipBattle()
|
| | |
| | | battle.playerIDA = playerIDA
|
| | | battle.playerIDB = playerIDB
|
| | | battle.winPlayerID = winPlayerID
|
| | | battle.playerBatDict = playerBatDict
|
| | | pkZoneMgr.AddBattle(groupMark, battleNum, battle)
|
| | | GameWorld.Log("分组玩家: zoneID=%s,groupMark=%s,battleNum=%s,playerIDA=%s,playerIDB=%s,winPlayerID=%s"
|
| | | % (zoneID, groupMark, battleNum, playerIDA, playerIDB, winPlayerID))
|
| | |
| | | guessPlayerID = recData.GetValue3()
|
| | | tagPlayerID = recData.GetValue4()
|
| | | moneyTotal = recData.GetValue5()
|
| | | isClose = GameWorld.ToIntDef(recData.GetStrValue1(), 0)
|
| | |
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | if not pkZoneMgr:
|
| | | continue
|
| | | playerGuessList = pkZoneMgr.GetPlayerGuessList(guessPlayerID, guessType)
|
| | | guessObj = ChampionshipGuess()
|
| | | guessObj.zoneID = zoneID
|
| | |
| | | guessObj.guessPlayerID = guessPlayerID
|
| | | guessObj.tagPlayerID = tagPlayerID
|
| | | guessObj.moneyTotal = moneyTotal
|
| | | guessObj.isClose = isClose
|
| | | playerGuessList.append(guessObj)
|
| | |
|
| | | if guessType not in pkZoneMgr.supportCountInfo:
|
| | |
| | | for index in xrange(officialRecDataList.Count()):
|
| | | recData = officialRecDataList.At(index)
|
| | | lastDismissJuniorTime = recData.GetTime()
|
| | | value1 = recData.GetValue1()
|
| | | officialID = value1 / 10
|
| | | zoneID = value1 % 10
|
| | | officialID = recData.GetValue1()
|
| | | zoneID = recData.GetValue5()
|
| | | playerID = recData.GetValue2()
|
| | | worshipValue = recData.GetValue3()
|
| | | worshipCount = worshipValue / 10
|
| | |
| | | GameWorld.Log("加载跨服排位官职挑战记录信息! %s" % challengeRecDataList.Count())
|
| | | for index in xrange(challengeRecDataList.Count()):
|
| | | recData = challengeRecDataList.At(index)
|
| | | value1 = recData.GetValue1()
|
| | | officialID = value1 / 10
|
| | | zoneID = value1 % 10
|
| | | officialID = recData.GetValue1()
|
| | | zoneID = recData.GetValue2()
|
| | | strValue3 = recData.GetStrValue3()
|
| | | if not strValue3:
|
| | | continue
|
| | |
| | | return
|
| | |
|
| | | def OnServerClose():
|
| | | |
| | | SaveChampionshipData()
|
| | | return
|
| | |
|
| | | def SaveChampionshipData():
|
| | | if not GameWorld.IsCrossServer():
|
| | | return
|
| | |
|
| | |
| | | groupRecDataList = universalRecMgr.GetTypeList(Def_RecType_CrossChampionshipGroup)
|
| | | for zoneID in pkZoneIDList:
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | |
| | | if not pkZoneMgr:
|
| | | continue
|
| | | # 保存参赛玩家名单
|
| | | batPlayerIDList = pkZoneMgr.GetBatPlayerIDList()
|
| | | GameWorld.Log(" zoneID=%s,batPlayerIDCount=%s, %s" % (zoneID, len(batPlayerIDList), batPlayerIDList))
|
| | |
| | | recData.SetValue3(batObj.playerIDA)
|
| | | recData.SetValue4(batObj.playerIDB)
|
| | | recData.SetValue5(batObj.winPlayerID)
|
| | | strValue3 = "%s" % batObj.playerBatDict
|
| | | strValue3 = strValue3.replace(" ", "")
|
| | | recData.SetStrValue3(strValue3)
|
| | |
|
| | | GameWorld.Log("保存跨服排位玩家竞猜记录!")
|
| | | universalRecMgr.Delete(Def_RecType_CrossChampionshipGuess)
|
| | | guessRecDataList = universalRecMgr.GetTypeList(Def_RecType_CrossChampionshipGuess)
|
| | | for zoneID in pkZoneIDList:
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | if not pkZoneMgr:
|
| | | continue
|
| | | for guessType, playerGuessDict in pkZoneMgr.guessInfo.items():
|
| | | for guessPlayerID, guessObjList in playerGuessDict.items():
|
| | | #GameWorld.Log(" zoneID=%s,guessType=%s,guessPlayerID=%s,guessCount=%s" % (zoneID, guessType, guessPlayerID, len(guessObjList)))
|
| | |
| | | recData.SetValue3(guessPlayerID)
|
| | | recData.SetValue4(guessObj.tagPlayerID)
|
| | | recData.SetValue5(guessObj.moneyTotal)
|
| | | recData.SetStrValue1("%s" % guessObj.isClose)
|
| | |
|
| | | offZoneIDList = champMgr.GetChampOfficialZoneIDList()
|
| | | GameWorld.Log("保存跨服排位玩家官职信息! offZoneIDList=%s" % offZoneIDList)
|
| | |
| | | offObj = offZoneMgr.GetOfficialObj(officialID)
|
| | | if not offObj:
|
| | | continue
|
| | | value1 = offObj.officialID * 10 + zoneID
|
| | | recData = officialRecDataList.AddRec()
|
| | | recData.SetTime(offObj.lastDismissJuniorTime)
|
| | | recData.SetValue1(value1)
|
| | | recData.SetValue1(officialID)
|
| | | recData.SetValue2(offObj.playerID)
|
| | | recData.SetValue3(offObj.worshipCount * 10 + offObj.worshipDouble)
|
| | | recData.SetValue4(offObj.rank)
|
| | | recData.SetValue5(zoneID)
|
| | | strValue3 = "%s" % offObj.applyPlayerInfo.keys()
|
| | | strValue3 = strValue3.replace(" ", "")
|
| | | recData.SetStrValue3(strValue3)
|
| | |
|
| | | #GameWorld.Log(" zoneID=%s,officialID=%s,playerID=%s,rank=%s,challengeCount=%s" |
| | | # % (zoneID, officialID, offObj.playerID, offObj.rank, len(offObj.challengeList)))
|
| | | GameWorld.Log(" zoneID=%s,officialID=%s,playerID=%s,rank=%s,challengeCount=%s" |
| | | % (zoneID, officialID, offObj.playerID, offObj.rank, len(offObj.challengeList)))
|
| | | for challengeDict in offObj.challengeList:
|
| | | challRecData = challengeRecDataList.AddRec()
|
| | | challRecData.SetValue1(value1)
|
| | | challRecData.SetValue1(officialID)
|
| | | challRecData.SetValue2(zoneID)
|
| | | strValue3 = str(challengeDict)
|
| | | strValue3 = strValue3.replace(" ", "")
|
| | | challRecData.SetStrValue3(strValue3)
|
| | |
| | | champMgr = GetChampionshipMgr()
|
| | | for zoneID in champMgr.GetChampPKZoneIDList():
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | if not pkZoneMgr:
|
| | | continue
|
| | | if playerID in pkZoneMgr.GetBatPlayerIDList():
|
| | | # 是参赛玩家
|
| | | return True
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def DoChampionshipOpen(curPlayer):
|
| | | NotifyPlayerChampionshipInfo(curPlayer, GameWorld.GetGameWorld().GetTick())
|
| | | return
|
| | |
|
| | | def OnPlayerLogin(curPlayer, tick):
|
| | |
|
| | | if GameWorld.IsCrossServer():
|
| | | return
|
| | |
|
| | | if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
|
| | | return
|
| | | |
| | | NotifyPlayerChampionshipInfo(curPlayer, tick)
|
| | | return
|
| | |
|
| | | def NotifyPlayerChampionshipInfo(curPlayer, tick):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | champMgr = GetChampionshipMgr()
|
| | | pkZoneIDList = champMgr.GetChampPKZoneIDList()
|
| | |
| | | if pkZoneIDList:
|
| | | playerZoneID = champMgr.GetPlayerPKZoneID(playerID)
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(playerZoneID)
|
| | | if not pkZoneMgr:
|
| | | return
|
| | | if playerID not in pkZoneMgr.syncGuessPlayerIDInfo:
|
| | | sendMsg = {"zoneID":playerZoneID, "playerID":playerID, "exDataType":"ChampionshipGuessQuery"}
|
| | | CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_ChampionshipGuess, sendMsg)
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def OnMinuteProcess():
|
| | | def ChampionshipErrorDo():
|
| | | ## 状态异常后处理
|
| | | |
| | | stateError = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipStateError)
|
| | | if not stateError:
|
| | | return "state is not error."
|
| | | |
| | | if PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipErrorDo):
|
| | | return "already done."
|
| | | |
| | | champMgr = GetChampionshipMgr()
|
| | | |
| | | # 返还未结算的竞猜消耗
|
| | | moneyType, _ = IpyGameDataPY.GetFuncEvalCfg("CrossChamGuess", 1)
|
| | | moneyItemID = ChConfig.MoneyItemIDDict.get(moneyType)
|
| | | for zoneID in champMgr.GetChampPKZoneIDList():
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | if not pkZoneMgr:
|
| | | continue
|
| | | |
| | | backGuessTypeList = []
|
| | | playerGuessMoneyInfo = {}
|
| | | for guessType, playerGuessDict in pkZoneMgr.guessInfo.items():
|
| | | for guessPlayerID, guessObjList in playerGuessDict.items():
|
| | | for guessObj in guessObjList:
|
| | | if guessObj.isClose:
|
| | | # 已经结算的不处理
|
| | | continue
|
| | | guessObj.isClose = 1
|
| | | if guessType not in backGuessTypeList:
|
| | | backGuessTypeList.append(guessType)
|
| | | playerGuessMoneyInfo[guessPlayerID] = playerGuessMoneyInfo.get(guessPlayerID, 0) + guessObj.moneyTotal
|
| | | |
| | | GameWorld.Log("竞猜需要返还玩家信息: moneyItemID=%s,zoneID=%s,backGuessTypeList=%s, %s" % (moneyItemID, zoneID, backGuessTypeList, playerGuessMoneyInfo))
|
| | | if not moneyItemID or not playerGuessMoneyInfo:
|
| | | continue
|
| | | |
| | | for guessPlayerID, totalMoney in playerGuessMoneyInfo.items():
|
| | | paramList = []
|
| | | addItemList = [[moneyItemID, totalMoney, 0]]
|
| | | PlayerCompensation.SendMailByKey("CrossChampionshipGuessBack", [guessPlayerID], addItemList, paramList, crossMail=True)
|
| | | |
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipErrorDo, 1)
|
| | | return "OK"
|
| | |
|
| | | def OnMinuteProcess(curMinute=None):
|
| | | if not GameWorld.IsCrossServer():
|
| | | return
|
| | |
|
| | | Dispose_CrossChampionshipState()
|
| | | |
| | | # 每半小时存档一次
|
| | | if curMinute != None and curMinute % 30 == 0:
|
| | | SaveChampionshipData()
|
| | | return
|
| | |
|
| | | def __GetChampionshipStartDate():
|
| | |
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipID, crossChampionshipID)
|
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipState, updState)
|
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipStateError, 0)
|
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipErrorDo, 0)
|
| | |
|
| | | champMgr = GetChampionshipMgr()
|
| | | champMgr.ClearPKZone() # 仅清理PK分区信息,仙官信息不变
|
| | |
|
| | | # 生成参赛玩家名单: 取跨服PK所有分区 championshipSeason 赛季的数据
|
| | | if championshipSeason:
|
| | | crossPKBillboardMgr = PyDataManager.GetCrossPKBillboardManager()
|
| | | crossBillboardMgr = PyDataManager.GetCrossBillboardManager()
|
| | | for zoneID in hisZoneIDList:
|
| | | billboardList = crossPKBillboardMgr.GetCrossPKBillboardInfo(zoneID, championshipSeason)[0]
|
| | | GameWorld.Log("zoneID=%s,billboardListLen=%s" % (zoneID, len(billboardList)))
|
| | | if not billboardList:
|
| | | groupValue1, groupValue2 = zoneID, championshipSeason
|
| | | billboardObj = crossBillboardMgr.GetCrossBillboard(ShareDefine.Def_CBT_CrossRealmPK, groupValue1, groupValue2)
|
| | | billboardDataLen = billboardObj.GetCount()
|
| | | GameWorld.Log("zoneID=%s,championshipSeason=%s,billboardDataLen=%s" % (zoneID, championshipSeason, billboardDataLen))
|
| | | if not billboardDataLen:
|
| | | # 没有玩家上榜的不处理
|
| | | continue
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | battlePlayerList = billboardList[:Def_CrossChampionshipPlayerMax]
|
| | | for num, billboardData in enumerate(battlePlayerList, 1):
|
| | | playerID = billboardData.PlayerID
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID, True)
|
| | | for index in range(Def_CrossChampionshipPlayerMax):
|
| | | if index >= billboardDataLen:
|
| | | break
|
| | | billboardData = billboardObj.At(index)
|
| | | playerID = billboardData.ID
|
| | | |
| | | batPlayer = ChampionshipBatPlayer()
|
| | | batPlayer.zoneID = zoneID
|
| | | batPlayer.playerID = playerID
|
| | | batPlayer.playerName = billboardData.PlayerName
|
| | | batPlayer.job = billboardData.Job
|
| | | batPlayer.fightPower = billboardData.FightPower
|
| | | batPlayer.realmLV = billboardData.RealmLV
|
| | | pkZoneMgr.playerDict[playerID] = batPlayer
|
| | |
|
| | | getPlayer = pkZoneMgr.GetBatPlayer(playerID)
|
| | | dataDict = {"zoneID":zoneID, "playerID":playerID, "accID":getPlayer.accID, "fightPower":getPlayer.fightPower}
|
| | | DR_CrossChampionshipPK("StartPlayer", dataDict)
|
| | |
|
| | | GameWorld.Log(" AddBattlePlayer num=%s,playerID=%s,accID=%s,fightPower=%s" % (num, playerID, getPlayer.accID, getPlayer.fightPower))
|
| | | GameWorld.Log(" AddBattlePlayer index=%s,playerID=%s,accID=%s,fightPower=%s" % (index, playerID, getPlayer.accID, getPlayer.fightPower))
|
| | |
|
| | | GameWorld.Log("=============================================================")
|
| | | Send_CrossServerMsg_ChampionshipState(newAct=True)
|
| | |
| | | champMgr = GetChampionshipMgr()
|
| | | for zoneID in champMgr.GetChampPKZoneIDList():
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | if not pkZoneMgr:
|
| | | continue
|
| | | # 首轮取所有参赛玩家
|
| | | if preGroupMark == 0:
|
| | | batPlayerIDList = pkZoneMgr.GetBatPlayerIDList()
|
| | |
| | | champMgr = GetChampionshipMgr()
|
| | | for zoneID in champMgr.GetChampPKZoneIDList():
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | |
| | | if not pkZoneMgr:
|
| | | continue
|
| | | winPlayerIDList, losePlayerIDList = [], [] # 胜者组、败者组
|
| | | battleNumList = pkZoneMgr.battleInfo.get(preGroupMark, {}).keys()
|
| | | battleNumList.sort() # 对战编号按之前的分组顺序排序,确保分组顺序一致
|
| | |
| | | champMgr = GetChampionshipMgr()
|
| | | for zoneID in champMgr.GetChampPKZoneIDList():
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | |
| | | if not pkZoneMgr:
|
| | | continue
|
| | | battleNumList = pkZoneMgr.battleInfo.get(preGroupMark, {}).keys()
|
| | | battleNumList.sort() # 对战编号按之前的分组顺序排序,确保分组顺序一致
|
| | | for battleNum in battleNumList:
|
| | |
| | |
|
| | | # 处理8强竞猜发奖励
|
| | | guessType = 8
|
| | | moneyType, _ = IpyGameDataPY.GetFuncEvalCfg("CrossChamGuess", 1)
|
| | | moneyType = ShareDefine.TYPE_Price_GongdePoint
|
| | | multiPrice = IpyGameDataPY.GetFuncCfg("CrossChamGuess", 3) # 猜中奖励倍值
|
| | | moneyItemID = ChConfig.MoneyItemIDDict.get(moneyType)
|
| | | GameWorld.Log("竞猜返利货币类型: moneyType=%s,moneyItemID=%s,multiPrice=%s" % (moneyType, moneyItemID, multiPrice), zoneID)
|
| | |
| | | for guessObj in guessList:
|
| | | if guessObj.guessType != guessType or guessObj.guessPlayerID != guessPlayerID:
|
| | | continue
|
| | | guessObj.isClose = 1
|
| | | tagPlayerID = guessObj.tagPlayerID
|
| | | moneyTotal = guessObj.moneyTotal
|
| | | if not tagPlayerID or tagPlayerID not in top8PlayerIDList:
|
| | |
| | |
|
| | | def DoCrossChampionshipStartEnter(state):
|
| | | ## 开启进场处理逻辑
|
| | | if state not in ShareDefine.CrossChampionshipEnterStateInfo:
|
| | | return
|
| | | groupMark = ShareDefine.CrossChampionshipEnterStateInfo[state]
|
| | | mapIDList = IpyGameDataPY.GetFuncEvalCfg("CrossChamFB", 3)
|
| | | GameWorld.Log("跨服排位争霸赛开启进场副本: groupMark=%s,mapIDList=%s" % (groupMark, mapIDList))
|
| | | champMgr = GetChampionshipMgr()
|
| | | pkZoneIDList = champMgr.GetChampPKZoneIDList()
|
| | | for index, zoneID in enumerate(pkZoneIDList):
|
| | | if index >= len(mapIDList):
|
| | | GameWorld.ErrLog("该跨服排位争霸赛分区没有分配对战地图! zoneID=%s,index=%s" % (zoneID, index), zoneID)
|
| | | continue
|
| | | mapID = mapIDList[index]
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | if groupMark not in pkZoneMgr.battleInfo:
|
| | | GameWorld.Log("该跨服排位争霸赛分区没有对战组! zoneID=%s,groupMark=%s" % (zoneID, groupMark), zoneID)
|
| | | continue
|
| | | copyMapID = 0
|
| | | copyPropertyList = []
|
| | | battleDict = pkZoneMgr.battleInfo[groupMark]
|
| | | for battleNum in battleDict.keys():
|
| | | batObj = pkZoneMgr.GetBattle(groupMark, battleNum)
|
| | | if not batObj:
|
| | | continue
|
| | | roomID = GetChampionshipPKRoomID(zoneID, groupMark, battleNum)
|
| | | copyPropertyList.append([copyMapID, roomID])
|
| | | batObj.mapID = mapID
|
| | | batObj.roomID = roomID
|
| | | batObj.copyMapID = copyMapID
|
| | | |
| | | # 添加开启分线数据
|
| | | realMapID = mapID
|
| | | copyMapObj = PlayerFB.CrossCopyMapInfo(zoneID, 0)
|
| | | copyMapObj.realMapID = realMapID
|
| | | copyMapObj.copyMapID = copyMapID
|
| | | key = (realMapID, copyMapID)
|
| | | PyGameData.g_crossDynamicLineCopyMapInfo[key] = copyMapObj
|
| | | GameWorld.Log(" 对战房间! zoneID=%s,groupMark=%s,battleNum=%s,playerIDA=%s,playerIDB=%s,roomID=%s,mapID=%s,copyMapID=%s" |
| | | % (zoneID, groupMark, battleNum, batObj.playerIDA, batObj.playerIDB, roomID, mapID, copyMapID))
|
| | | copyMapID += 1
|
| | | |
| | | PlayerFB.SendMapOpenFBEx(mapID, copyPropertyList)
|
| | | |
| | | # 改为镜像战斗,废弃开地图房间
|
| | | return
|
| | |
|
| | | def Sync_CrossChampionshipDataToClientServer(serverGroupID=0):
|
| | |
| | | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_ChampionshipState, dataMsg, serverGroupIDList)
|
| | | return
|
| | |
|
| | | def Send_CrossServerMsg_ChampionshipPlayer(syncPlayerIDList=None, serverGroupID=0, isSync=False):
|
| | | def Send_CrossServerMsg_ChampionshipPlayer(syncPlayerIDList=None, serverGroupID=0, isSync=False, clearPlayer=False):
|
| | | # 通知参赛玩家
|
| | |
|
| | | zoneBatPlayerInfo = {}
|
| | |
| | | for zoneID in champMgr.GetChampPKZoneIDList():
|
| | | batPlayerList = []
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | if syncPlayerIDList == None:
|
| | | syncPlayerIDList = pkZoneMgr.GetBatPlayerIDList()
|
| | | for playerID in syncPlayerIDList:
|
| | | if not pkZoneMgr:
|
| | | continue
|
| | | playerIDList = pkZoneMgr.GetBatPlayerIDList() if syncPlayerIDList == None else syncPlayerIDList
|
| | | for playerID in playerIDList:
|
| | | batPlayer = pkZoneMgr.GetBatPlayer(playerID)
|
| | | if not batPlayer:
|
| | | continue
|
| | | batPlayerList.append(batPlayer.GetString())
|
| | | zoneBatPlayerInfo[zoneID] = batPlayerList
|
| | |
|
| | | dataMsg = {"isSync":isSync, "zoneBatPlayerInfo":zoneBatPlayerInfo}
|
| | | dataMsg = {"isSync":isSync, "zoneBatPlayerInfo":zoneBatPlayerInfo, "clearPlayer":clearPlayer}
|
| | | serverGroupIDList = [serverGroupID] if serverGroupID else []
|
| | | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_ChampionshipPlayer, dataMsg, serverGroupIDList)
|
| | | return
|
| | |
| | | champMgr = GetChampionshipMgr()
|
| | | for zoneID in champMgr.GetChampPKZoneIDList():
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | if not pkZoneMgr:
|
| | | continue
|
| | | for gMark in syncGroupMarkList:
|
| | | battleDict = pkZoneMgr.battleInfo.get(gMark, {})
|
| | | if not battleDict:
|
| | |
| | | guessList.append(guessObj.GetString())
|
| | | else:
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(syncZoneID)
|
| | | for playerGuessDict in pkZoneMgr.guessInfo.values():
|
| | | if playerID not in playerGuessDict:
|
| | | continue
|
| | | playerGuessList = playerGuessDict[playerID]
|
| | | for guess in playerGuessList:
|
| | | guessList.append(guess.GetString())
|
| | | if pkZoneMgr:
|
| | | for playerGuessDict in pkZoneMgr.guessInfo.values():
|
| | | if playerID not in playerGuessDict:
|
| | | continue
|
| | | playerGuessList = playerGuessDict[playerID]
|
| | | for guess in playerGuessList:
|
| | | guessList.append(guess.GetString())
|
| | |
|
| | | dataMsg = {"exData":exData if exData else {}, "guessList":guessList}
|
| | | if syncPub:
|
| | |
| | | syncZoneIDList = [syncZoneID] if syncZoneID else champMgr.GetChampPKZoneIDList()
|
| | | for zoneID in syncZoneIDList:
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | if not pkZoneMgr:
|
| | | continue
|
| | | zoneSupportCountInfo[zoneID] = pkZoneMgr.supportCountInfo
|
| | | dataMsg["pubInfo"] = {"zoneSupportCountInfo":zoneSupportCountInfo}
|
| | |
|
| | |
| | | GameWorld.Log("子服重置跨服排位争霸赛对战数据! dbID=%s,ID=%s,PKZoneIDList=%s,prePKZoneIDList=%s" % (dbID, ID, PKZoneIDList, prePKZoneIDList))
|
| | | for zoneID in PKZoneIDList:
|
| | | champMgr.GetChampPKZoneMgr(zoneID)
|
| | | |
| | | OnMapServerInitOK()
|
| | | return
|
| | |
|
| | | def OnMapServerInitOK():
|
| | | # 通知地图服务器状态
|
| | | |
| | | if GameWorld.IsCrossServer():
|
| | | return
|
| | | |
| | | State = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipState)
|
| | | StateError = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipStateError)
|
| | | |
| | | GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_CrossChampionshipState, State)
|
| | | GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_CrossChampionshipStateError, StateError)
|
| | | return
|
| | |
|
| | | def CrossServerMsg_ChampionshipPlayer(msgData):
|
| | | ## 收到跨服服务器同步的信息 - 参赛玩家信息
|
| | |
|
| | | isSync = msgData["isSync"]
|
| | | clearPlayer = msgData["clearPlayer"]
|
| | | zoneBatPlayerInfo = msgData["zoneBatPlayerInfo"]
|
| | |
|
| | | champMgr = GetChampionshipMgr()
|
| | | for zoneID, batPlayerList in zoneBatPlayerInfo.items():
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID, True)
|
| | |
|
| | | if not batPlayerList:
|
| | | pkZoneMgr.playerDict = {}
|
| | | if clearPlayer:
|
| | | pkZoneMgr.playerDict = {}
|
| | | else:
|
| | | for attrDict in batPlayerList:
|
| | | zoneID = attrDict["zoneID"]
|
| | |
| | | pkZoneMgr.playerDict[playerID] = batPlayer
|
| | | batPlayer.SetAttr(attrDict)
|
| | |
|
| | | if isSync:
|
| | | if isSync:
|
| | | for zoneID in zoneBatPlayerInfo.keys():
|
| | | Sync_ChampionshipPKZoneGroupInfo(zoneID)
|
| | |
|
| | | return
|
| | |
| | | groupMark = attrDict["groupMark"]
|
| | | battleNum = attrDict["battleNum"]
|
| | |
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID, True)
|
| | | battle = pkZoneMgr.GetBattle(groupMark, battleNum)
|
| | | if not battle:
|
| | | battle = ChampionshipBattle()
|
| | |
| | | # 非本服玩家
|
| | | continue
|
| | |
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID, True)
|
| | |
|
| | | guessObj = None
|
| | | playerGuessList = pkZoneMgr.GetPlayerGuessList(guessPlayerID, guessType)
|
| | |
| | | if pubInfo != None:
|
| | | zoneSupportCountInfo = pubInfo["zoneSupportCountInfo"]
|
| | | for zoneID, supportCountInfo in zoneSupportCountInfo.items():
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID, True)
|
| | | pkZoneMgr.supportCountInfo = supportCountInfo
|
| | | pubZoneIDList.append(zoneID)
|
| | |
|
| | |
| | | # 非本服玩家
|
| | | return
|
| | | zoneID = exData.get("zoneID", 0)
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID, True)
|
| | | pkZoneMgr.syncGuessPlayerIDInfo[playerID] = tick
|
| | | curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | if curPlayer == None:
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def OnRequestChampionshipVSRoom(playerID, serverGroupID):
|
| | | ## 请求进入排位对战房间
|
| | | |
| | | stateError = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipStateError)
|
| | | if stateError:
|
| | | GameWorld.ErrLog("跨服排位状态已经异常无法进入! stateError=%s" % stateError, playerID)
|
| | | return
|
| | | |
| | | state = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipState)
|
| | | if state not in ShareDefine.CrossChampionshipEnterStateInfo:
|
| | | GameWorld.ErrLog("当前状态非跨服排位战斗状态无法进入: state=%s" % state, playerID)
|
| | | return
|
| | | groupMark = ShareDefine.CrossChampionshipEnterStateInfo[state]
|
| | | |
| | | mapPosList = IpyGameDataPY.GetFuncEvalCfg("CrossChamFB", 2)
|
| | | if not mapPosList:
|
| | | GameWorld.ErrLog("没有配置跨服排位对战地图进入坐标! CrossChamFB 数值2")
|
| | | return
|
| | | |
| | | roomID = 0
|
| | | vsRoomDict = {}
|
| | | |
| | | champMgr = GetChampionshipMgr()
|
| | | for zoneID in champMgr.GetChampPKZoneIDList():
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | if groupMark not in pkZoneMgr.battleInfo:
|
| | | continue
|
| | | battleDict = pkZoneMgr.battleInfo[groupMark]
|
| | | for battleNum in battleDict.keys():
|
| | | batObj = pkZoneMgr.GetBattle(groupMark, battleNum)
|
| | | if not batObj:
|
| | | continue
|
| | | |
| | | if playerID == batObj.playerIDA:# or batObj.playerIDA == 496607:
|
| | | factionIndex = 0
|
| | | elif playerID == batObj.playerIDB:# or batObj.playerIDB == 489566:
|
| | | factionIndex = 1
|
| | | else:
|
| | | continue
|
| | | |
| | | if not batObj.mapID:
|
| | | GameWorld.ErrLog("该跨服排位对战没有分配对战地图,无法进入! groupMark=%s,battleNum=%s" % (groupMark, battleNum), playerID)
|
| | | return
|
| | | roomID = batObj.roomID
|
| | | realMapID = batObj.mapID
|
| | | copyMapID = batObj.copyMapID
|
| | | key = (realMapID, copyMapID)
|
| | | if key not in PyGameData.g_crossDynamicLineCopyMapInfo:
|
| | | GameWorld.ErrLog("该跨服排位对战没有分配对战地图线路,无法进入! groupMark=%s,battleNum=%s,realMapID=%s,copyMapID=%s" |
| | | % (groupMark, battleNum, realMapID, copyMapID), playerID)
|
| | | return
|
| | | copyMapObj = PyGameData.g_crossDynamicLineCopyMapInfo[key]
|
| | | if copyMapObj.openState != IPY_PlayerDefine.fbosOpen:
|
| | | GameWorld.Log("该跨服排位对战分配的地图线路非开启状态,无法进入! groupMark=%s,battleNum=%s,realMapID=%s,copyMapID=%s,openState=%s" |
| | | % (groupMark, battleNum, realMapID, copyMapID, copyMapObj.openState), playerID)
|
| | | return
|
| | | |
| | | posX, posY = mapPosList[factionIndex] if len(mapPosList) > factionIndex else mapPosList[0]
|
| | | |
| | | registerMap = ChConfig.Def_FBMapID_CrossChampionship
|
| | | dataMapID = realMapID
|
| | | |
| | | vsRoomDict = {roomID:{playerID:{"regMapInfo":[registerMap, realMapID, dataMapID, copyMapID, posX, posY]}}}
|
| | | GameWorld.Log("玩家请求跨服排位对战组: zoneID=%s,groupMark=%s,battleNum=%s,roomID=%s" |
| | | % (zoneID, groupMark, battleNum, roomID), playerID)
|
| | | break
|
| | | |
| | | if not roomID or not vsRoomDict:
|
| | | GameWorld.ErrLog("找不到玩家跨服排位对战组: state=%s,groupMark=%s" % (state, groupMark), playerID)
|
| | | return
|
| | | PlayerFB.Send_CrossServerMsg_EnterVSRoomRet(vsRoomDict, [serverGroupID])
|
| | | return
|
| | | #def OnRequestChampionshipVSRoom(playerID, serverGroupID):
|
| | | # ## 请求进入排位对战房间
|
| | | # |
| | | # stateError = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipStateError)
|
| | | # if stateError:
|
| | | # GameWorld.ErrLog("跨服排位状态已经异常无法进入! stateError=%s" % stateError, playerID)
|
| | | # return
|
| | | # |
| | | # state = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipState)
|
| | | # if state not in ShareDefine.CrossChampionshipEnterStateInfo:
|
| | | # GameWorld.ErrLog("当前状态非跨服排位战斗状态无法进入: state=%s" % state, playerID)
|
| | | # return
|
| | | # groupMark = ShareDefine.CrossChampionshipEnterStateInfo[state]
|
| | | # |
| | | # mapPosList = IpyGameDataPY.GetFuncEvalCfg("CrossChamFB", 2)
|
| | | # if not mapPosList:
|
| | | # GameWorld.ErrLog("没有配置跨服排位对战地图进入坐标! CrossChamFB 数值2")
|
| | | # return
|
| | | # |
| | | # roomID = 0
|
| | | # vsRoomDict = {}
|
| | | # |
| | | # champMgr = GetChampionshipMgr()
|
| | | # for zoneID in champMgr.GetChampPKZoneIDList():
|
| | | # pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | # if not pkZoneMgr:
|
| | | # continue
|
| | | # if groupMark not in pkZoneMgr.battleInfo:
|
| | | # continue
|
| | | # battleDict = pkZoneMgr.battleInfo[groupMark]
|
| | | # for battleNum in battleDict.keys():
|
| | | # batObj = pkZoneMgr.GetBattle(groupMark, battleNum)
|
| | | # if not batObj:
|
| | | # continue
|
| | | # |
| | | # if playerID == batObj.playerIDA:# or batObj.playerIDA == 496607:
|
| | | # factionIndex = 0
|
| | | # elif playerID == batObj.playerIDB:# or batObj.playerIDB == 489566:
|
| | | # factionIndex = 1
|
| | | # else:
|
| | | # continue
|
| | | # |
| | | # if not batObj.mapID:
|
| | | # GameWorld.ErrLog("该跨服排位对战没有分配对战地图,无法进入! groupMark=%s,battleNum=%s" % (groupMark, battleNum), playerID)
|
| | | # return
|
| | | # roomID = batObj.roomID
|
| | | # realMapID = batObj.mapID
|
| | | # copyMapID = batObj.copyMapID
|
| | | # key = (realMapID, copyMapID)
|
| | | # if key not in PyGameData.g_crossDynamicLineCopyMapInfo:
|
| | | # GameWorld.ErrLog("该跨服排位对战没有分配对战地图线路,无法进入! groupMark=%s,battleNum=%s,realMapID=%s,copyMapID=%s" |
| | | # % (groupMark, battleNum, realMapID, copyMapID), playerID)
|
| | | # return
|
| | | # copyMapObj = PyGameData.g_crossDynamicLineCopyMapInfo[key]
|
| | | # if copyMapObj.openState != IPY_PlayerDefine.fbosOpen:
|
| | | # GameWorld.Log("该跨服排位对战分配的地图线路非开启状态,无法进入! groupMark=%s,battleNum=%s,realMapID=%s,copyMapID=%s,openState=%s" |
| | | # % (groupMark, battleNum, realMapID, copyMapID, copyMapObj.openState), playerID)
|
| | | # return
|
| | | # |
| | | # posX, posY = mapPosList[factionIndex] if len(mapPosList) > factionIndex else mapPosList[0]
|
| | | # |
| | | # registerMap = ChConfig.Def_FBMapID_CrossChampionship
|
| | | # dataMapID = realMapID
|
| | | # |
| | | # vsRoomDict = {roomID:{playerID:{"regMapInfo":[registerMap, realMapID, dataMapID, copyMapID, posX, posY]}}}
|
| | | # GameWorld.Log("玩家请求跨服排位对战组: zoneID=%s,groupMark=%s,battleNum=%s,roomID=%s" |
| | | # % (zoneID, groupMark, battleNum, roomID), playerID)
|
| | | # break
|
| | | # |
| | | # if not roomID or not vsRoomDict:
|
| | | # GameWorld.ErrLog("找不到玩家跨服排位对战组: state=%s,groupMark=%s" % (state, groupMark), playerID)
|
| | | # return
|
| | | # PlayerFB.Send_CrossServerMsg_EnterVSRoomRet(vsRoomDict, [serverGroupID])
|
| | | # return
|
| | |
|
| | | def GetChampionshipPKRoomID(zoneID, groupMark, battleNum): return int("%d%03d%02d" % (zoneID, groupMark, battleNum))
|
| | | def MapServer_CrossChampionshipPKOver(infoList, tick):
|
| | | ## 收到MapServer副本跨服排位PK结果同步
|
| | | |
| | | roomID, winnerID, loserID, roundWinnerIDList, overType = infoList
|
| | | zoneID = roomID / 100000
|
| | | groupMark = roomID % 100000 / 100
|
| | | battleNum = roomID % 100
|
| | | GameWorld.Log("=== 收到MapServer_跨服排位PK战斗结果: zoneID=%s,groupMark=%s,battleNum=%s,roomID=%s,winnerID=%s,loserID=%s,roundWinnerIDList=%s,overType=%s" |
| | | % (zoneID, groupMark, battleNum, roomID, winnerID, loserID, roundWinnerIDList, overType), roomID)
|
| | | DoBattleOverLogic(zoneID, groupMark, battleNum, winnerID, loserID, roundWinnerIDList, overType)
|
| | | return
|
| | |
|
| | | def DoBattleOverLogic(zoneID, groupMark, battleNum, winnerID=0, loserID=0, roundWinnerIDList=None, overType=0):
|
| | | def DoBattleOverLogic(zoneID, groupMark, battleNum):
|
| | | ## 执行对战结算逻辑
|
| | |
|
| | | if not zoneID:
|
| | |
| | |
|
| | | champMgr = GetChampionshipMgr()
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | if not pkZoneMgr:
|
| | | return
|
| | | battleObj = pkZoneMgr.GetBattle(groupMark, battleNum)
|
| | | if not battleObj:
|
| | | return
|
| | |
|
| | | if roundWinnerIDList == None:
|
| | | roundWinnerIDList = []
|
| | | |
| | | roomID = battleObj.roomID
|
| | | roomID = GetChampionshipPKRoomID(zoneID, groupMark, battleNum) # 改版后roomID没用了,仅作为日志输出用
|
| | | if battleObj.overTime:
|
| | | GameWorld.ErrLog("跨服排位PK对战已经结算过了,不重复结算! zoneID=%s,groupMark=%s,battleNum=%s,winPlayerID=%s,overTime=%s"
|
| | | % (zoneID, groupMark, battleNum, battleObj.winPlayerID, GameWorld.ChangeTimeNumToStr(battleObj.overTime)), roomID)
|
| | |
| | | playerIDA = battleObj.playerIDA
|
| | | playerIDB = battleObj.playerIDB
|
| | | roomPlayerIDList = [playerIDA, playerIDB]
|
| | | GameWorld.Log("结算跨服排位PK战斗结果: zoneID=%s,groupMark=%s,battleNum=%s,playerIDA=%s,playerIDB=%s,roomPlayerIDList=%s" |
| | | GameWorld.Log("结算跨服排位PK胜负结果: zoneID=%s,groupMark=%s,battleNum=%s,playerIDA=%s,playerIDB=%s,roomPlayerIDList=%s" |
| | | % (zoneID, groupMark, battleNum, playerIDA, playerIDB, roomPlayerIDList), roomID)
|
| | |
|
| | | winnerID, loserID = 0, 0
|
| | | if playerIDA and playerIDB:
|
| | | if not winnerID and not loserID:
|
| | | totalScoreDict = {}
|
| | | for batPlayerID, batRetList in battleObj.playerBatDict.items():
|
| | | for retInfo in batRetList:
|
| | | if not retInfo or len(retInfo) < 2:
|
| | | continue
|
| | | addScore = retInfo[1]
|
| | | totalScoreDict[batPlayerID] = totalScoreDict.get(batPlayerID, 0) + addScore
|
| | | playerScoreA = totalScoreDict.get(playerIDA, 0)
|
| | | playerScoreB = totalScoreDict.get(playerIDB, 0)
|
| | | GameWorld.Log(" 总积分: %s, %s" % (totalScoreDict, battleObj.playerBatDict), roomID)
|
| | | if playerScoreA > playerScoreB:
|
| | | winnerID = playerIDA
|
| | | loserID = playerIDB
|
| | | GameWorld.Log(" 跨服排位赛玩家累计总分高者获胜! winner is playerIDA=%s,loserID=%s" % (playerIDA, loserID), roomID)
|
| | | elif playerScoreB > playerScoreA:
|
| | | winnerID = playerIDB
|
| | | loserID = playerIDA
|
| | | GameWorld.Log(" 跨服排位赛玩家累计总分高者获胜! winner is playerIDB=%s,loserID=%s" % (playerIDB, loserID), roomID)
|
| | | else: # 平分
|
| | | playerA = pkZoneMgr.GetBatPlayer(playerIDA)
|
| | | playerB = pkZoneMgr.GetBatPlayer(playerIDB)
|
| | | fightPowerA = playerA.fightPower if playerA else 0
|
| | |
| | | winnerID, loserID = roomPlayerIDList
|
| | | GameWorld.Log(" 跨服排位赛对战地图没有玩家参与或没有胜负玩家,战力相同随机玩家获胜! fightPowerA=%s(%s) = fightPowerB=%s(%s),winnerID=%s,loserID=%s"
|
| | | % (fightPowerA, playerIDA, fightPowerB, playerIDB, winnerID, loserID), roomID)
|
| | | elif not loserID:
|
| | | for roomPlayerID in roomPlayerIDList:
|
| | | if roomPlayerID != winnerID:
|
| | | loserID = roomPlayerID
|
| | | GameWorld.Log(" 跨服排位赛对战地图没有失败玩家,默认对方为失败玩家! loserID=%s" % loserID, roomID)
|
| | | break
|
| | |
|
| | | if not winnerID or winnerID not in roomPlayerIDList or loserID not in roomPlayerIDList:
|
| | | GameWorld.ErrLog("跨服排位赛PK房间胜负玩家异常,不结算! roomID=%s,winnerID=%s,loserID=%s,roomPlayerIDList=%s" |
| | | % (roomID, winnerID, loserID, roomPlayerIDList), roomID)
|
| | | return
|
| | | |
| | | elif playerIDA:
|
| | | winnerID = playerIDA
|
| | | loserID = playerIDB
|
| | |
| | | winner = pkZoneMgr.GetBatPlayer(winnerID)
|
| | | loser = pkZoneMgr.GetBatPlayer(loserID)
|
| | |
|
| | | winnerName = winner.playerName if winner else str(winnerID)
|
| | | loserName = loser.playerName if loser else str(loserID)
|
| | | |
| | | # 决赛可获取最终名次
|
| | | playerRankInfo = {}
|
| | | if groupMark == 2:
|
| | |
| | | wAwardItemList, fAwardItemList = [], []
|
| | | if wfAwardItemList and len(wfAwardItemList) == 2:
|
| | | wAwardItemList, fAwardItemList = wfAwardItemList
|
| | | |
| | | timeStr = GameWorld.GetCurrentDataTimeStr()
|
| | | |
| | | # 结算
|
| | | for playerID in [winnerID, loserID]:
|
| | | if not playerID:
|
| | |
| | | if playerID == winnerID:
|
| | | addItemList = wAwardItemList
|
| | | mailTypeKey = "CrossChampionshipPKWin%s" % groupMark
|
| | | tagPlayerID, tagPlayerName = loserID, loserName
|
| | | tagPlayerID = loserID
|
| | | else:
|
| | | addItemList = fAwardItemList
|
| | | mailTypeKey = "CrossChampionshipPKLose%s" % groupMark
|
| | | tagPlayerID, tagPlayerName = winnerID, winnerName
|
| | | tagPlayerID = winnerID
|
| | |
|
| | | rank = playerRankInfo.get(playerID, 0)
|
| | | GameWorld.Log(" 结算跨服排位赛玩家奖励: zoneID=%s,roomID=%s,groupMark=%s,battleNum=%s,rank=%s,tagPlayerID=%s" |
| | | % (zoneID, roomID, groupMark, battleNum, rank, tagPlayerID), playerID)
|
| | | GameWorld.Log(" 结算跨服排位赛玩家奖励: zoneID=%s,groupMark=%s,battleNum=%s,rank=%s,tagPlayerID=%s,addItemList=%s" |
| | | % (zoneID, groupMark, battleNum, rank, tagPlayerID, addItemList), playerID)
|
| | | if rank:
|
| | | paramList = [rank]
|
| | | else:
|
| | |
| | | playerIDList = [playerID]
|
| | | PlayerCompensation.SendMailByKey(mailTypeKey, playerIDList, addItemList, paramList, crossMail=True)
|
| | |
|
| | | player = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | if player:
|
| | | overPack = ChPyNetSendPack.tagGCCrossChampionshipPKOver()
|
| | | overPack.GroupMark = groupMark
|
| | | overPack.TimeStr = timeStr
|
| | | overPack.OverType = overType
|
| | | overPack.WinnerID = winnerID
|
| | | overPack.LoserID = loserID
|
| | | overPack.RoundWinnerID = roundWinnerIDList
|
| | | overPack.RoundCount = len(overPack.RoundWinnerID)
|
| | | overPack.TagName = tagPlayerName
|
| | | overPack.TagNameLen = len(overPack.TagName)
|
| | | overPack.Rank = rank
|
| | | NetPackCommon.SendFakePack(player, overPack)
|
| | | |
| | | # 同步子服
|
| | | Send_CrossServerMsg_ChampionshipGroup(battleObj=battleObj)
|
| | |
|
| | | # 记录流向
|
| | | winnerInfo = winner.GetString() if winner else {}
|
| | | loserInfo = loser.GetString() if loser else {}
|
| | | dataDict = {"roundWinnerIDList":roundWinnerIDList, "overType":overType, "winner":winnerInfo, "loser":loserInfo, |
| | | dataDict = {"winner":winnerInfo, "loser":loserInfo, |
| | | "battle":battleObj.GetString(), "playerRankInfo":playerRankInfo}
|
| | | DR_CrossChampionshipPK("PKRoomOver", dataDict)
|
| | | return True
|
| | |
|
| | | def ClientServerMsg_ChampionshipPKOver(serverGroupID, msgData):
|
| | | ## 收到子服同步的镜像PK结果
|
| | | playerID = msgData["playerID"]
|
| | | tagPlayerID = msgData["tagPlayerID"]
|
| | | funcLineID = msgData["funcLineID"]
|
| | | isWin = msgData["isWin"]
|
| | | addScore = msgData["addScore"]
|
| | | baseScore = msgData["baseScore"]
|
| | | hpScore = msgData["hpScore"]
|
| | | timeScore = msgData["timeScore"]
|
| | | pkCountMax = msgData["pkCountMax"]
|
| | | |
| | | zoneID = funcLineID / 100
|
| | | groupMark = funcLineID % 100
|
| | | |
| | | groupMarkList = ShareDefine.CrossChampionshipEnterStateInfo.values()
|
| | | if groupMark not in groupMarkList:
|
| | | GameWorld.ErrLog("跨服排位镜像PK结果分组异常! groupMark=%s" % groupMark, playerID)
|
| | | return
|
| | | |
| | | champMgr = GetChampionshipMgr()
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | if not pkZoneMgr:
|
| | | return
|
| | | battleObj = pkZoneMgr.GetBattleByPlayerID(groupMark, playerID)
|
| | | if not battleObj:
|
| | | GameWorld.ErrLog("跨服排位镜像PK结果玩家不在该排位分组中! zoneID=%s,groupMark=%s" % (zoneID, groupMark), playerID)
|
| | | return
|
| | | battleNum = battleObj.battleNum
|
| | | playerIDA = battleObj.playerIDA
|
| | | playerIDB = battleObj.playerIDB
|
| | | roomPlayerIDList = [playerIDA, playerIDB]
|
| | | # 有轮空的默认不用打
|
| | | if playerID not in roomPlayerIDList or tagPlayerID not in roomPlayerIDList or not tagPlayerID or not playerIDA or not playerIDB:
|
| | | GameWorld.ErrLog("跨服排位镜像PK结果玩家ID错误! zoneID=%s,groupMark=%s,playerID=%s,tagPlayerID=%s,roomPlayerIDList=%s" |
| | | % (zoneID, groupMark, playerID, tagPlayerID, roomPlayerIDList), playerID)
|
| | | return
|
| | | if playerID not in battleObj.playerBatDict:
|
| | | battleObj.playerBatDict[playerID] = []
|
| | | batRetList = battleObj.playerBatDict[playerID]
|
| | | if len(batRetList) >= pkCountMax or not pkCountMax:
|
| | | GameWorld.ErrLog("跨服排位镜像PK结果已达PK次数上限! zoneID=%s,groupMark=%s,playerID=%s,tagPlayerID=%s,batRetList=%s" |
| | | % (zoneID, groupMark, playerID, tagPlayerID, batRetList), playerID)
|
| | | return
|
| | | if battleObj.overTime:
|
| | | GameWorld.ErrLog("跨服排位镜像PK胜负已经结算过了,不再更新PK结果! zoneID=%s,groupMark=%s,battleNum=%s,winPlayerID=%s,overTime=%s" |
| | | % (zoneID, groupMark, battleNum, battleObj.winPlayerID, GameWorld.ChangeTimeNumToStr(battleObj.overTime)), playerID)
|
| | | return
|
| | | |
| | | isWin = 1 if isWin else 0
|
| | | batRetList.append([isWin, addScore, baseScore, hpScore, timeScore])
|
| | | GameWorld.Log("跨服排位镜像PK结果: zoneID=%s,groupMark=%s,battleNum=%s,playerIDA=%s,playerIDB=%s,batCount=%s,isWin=%s,addScore=%s,baseScore=%s,hpScore=%s,timeScore=%s" |
| | | % (zoneID, groupMark, battleNum, playerIDA, playerIDB, len(batRetList), isWin, addScore, baseScore, hpScore, timeScore), playerID)
|
| | | |
| | | # 是否都打完所有次数,是的话直接结算胜负
|
| | | isAllOver = True
|
| | | for roomPlayerID in roomPlayerIDList:
|
| | | batList = battleObj.playerBatDict.get(roomPlayerID, [])
|
| | | if len(batList) < pkCountMax:
|
| | | isAllOver = False
|
| | | break
|
| | | if isAllOver:
|
| | | if DoBattleOverLogic(zoneID, groupMark, battleNum):
|
| | | return
|
| | | |
| | | # 同步子服
|
| | | Send_CrossServerMsg_ChampionshipGroup(battleObj=battleObj)
|
| | | return
|
| | |
|
| | | def DoCrossChampionshipFinalOver():
|
| | |
| | | champMgr = GetChampionshipMgr()
|
| | | champMgr.ClearOfficialZone() # 最终结算重置仙官信息,替换最新仙官
|
| | |
|
| | | # 膜拜重置
|
| | | worshipType = ShareDefine.Def_WorshipType_CrossChampionship
|
| | | GameWorship.DelWorshipPlayer(worshipType)
|
| | | |
| | | pkZoneIDList = champMgr.GetChampPKZoneIDList()
|
| | | GameWorld.Log("pkZoneIDList=%s" % pkZoneIDList)
|
| | |
|
| | | syncNewWorshipList = []
|
| | | syncNewXiangongDict = {}
|
| | | crossZoneName = GameWorld.GetCrossZoneName()
|
| | | for zoneID in pkZoneIDList:
|
| | | GameWorld.Log("=== 结算排位分区: zoneID=%s ===" % zoneID, zoneID)
|
| | | zoneIpyData = IpyGameDataPY.GetIpyGameData("CrossZonePK", crossZoneName, zoneID)
|
| | | serverIDRangeList = zoneIpyData.GetServerGroupIDList() if zoneIpyData else []
|
| | | |
| | | finalPlayerIDList = []
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | if not pkZoneMgr:
|
| | | continue
|
| | | battleNumList = pkZoneMgr.battleInfo.get(finalGroupMark, {}).keys()
|
| | | for battleNum in battleNumList:
|
| | | batObj = pkZoneMgr.GetBattle(finalGroupMark, battleNum)
|
| | |
| | | rankIpyData = IpyGameDataPY.GetIpyGameData("ChampionshipRank", rank)
|
| | | officialID = rankIpyData.GetMainOfficialID() if rankIpyData else 0
|
| | | rankAwardItemList = rankIpyData.GetRankAwardItemList() if rankIpyData else []
|
| | | GameWorld.Log(" 最终排名: zoneID=%s,rank=%s,playerID=%s,officialID=%s,rankAwardItemList=%s,accID=%s,fightPower=%s" |
| | | % (zoneID, rank, playerID, officialID, rankAwardItemList, accID, fightPower), zoneID)
|
| | | xiangongID = rankIpyData.GetXiangongID() if rankIpyData else 0
|
| | | GameWorld.Log(" 最终排名: zoneID=%s,rank=%s,playerID=%s,officialID=%s,xiangongID=%s,rankAwardItemList=%s,accID=%s,fightPower=%s" |
| | | % (zoneID, rank, playerID, officialID, xiangongID, rankAwardItemList, accID, fightPower), zoneID)
|
| | |
|
| | | if officialID:
|
| | | offObj = ChampionshipOfficial()
|
| | |
| | |
|
| | | offZoneMgr.officialInfo[officialID] = offObj
|
| | |
|
| | | |
| | | # 名次奖励
|
| | | paramList = [rank]
|
| | | PlayerCompensation.SendMailByKey("CrossChampionshipPKRank", [playerID], rankAwardItemList, paramList, crossMail=True)
|
| | |
|
| | | GameXiangong.AddXiangongPlayer(xiangongID, playerID, serverIDRangeList, rank, syncNewXiangongDict)
|
| | | GameWorship.AddWorshipPlayer(worshipType, rank, playerID, serverIDRangeList, syncNewWorshipList)
|
| | | |
| | | # 处理4强竞猜发奖励
|
| | | guessType = 4
|
| | | moneyType, _ = IpyGameDataPY.GetFuncEvalCfg("CrossChamGuess", 1)
|
| | | moneyType = ShareDefine.TYPE_Price_GongdePoint
|
| | | multiPriceDict = IpyGameDataPY.GetFuncEvalCfg("CrossChamGuess", 4, {}) # 猜中奖励倍值字典
|
| | | moneyItemID = ChConfig.MoneyItemIDDict.get(moneyType)
|
| | | GameWorld.Log("竞猜返利货币类型: moneyType=%s,moneyItemID=%s,multiPriceDict=%s" % (moneyType, moneyItemID, multiPriceDict), zoneID)
|
| | |
| | | for guessObj in guessList:
|
| | | if guessObj.guessType != guessType or guessObj.guessPlayerID != guessPlayerID:
|
| | | continue
|
| | | guessObj.isClose = 1
|
| | | tagPlayerID = guessObj.tagPlayerID
|
| | | guessRank = guessObj.guessRank
|
| | | moneyTotal = guessObj.moneyTotal
|
| | |
| | |
|
| | | serverGroupIDList = [] # 全服统一逻辑
|
| | | PlayerControl.WorldNotifyCross(serverGroupIDList, 0, "ChampionshipOver")
|
| | | |
| | | # 通知新添加的膜拜
|
| | | GameWorship.SendNewWorshipPlayer(syncNewWorshipList)
|
| | | GameXiangong.SendNewXiangongPlayerToClientServer(syncNewXiangongDict)
|
| | | GameWorld.Log("===================================================================")
|
| | | return
|
| | |
|
| | |
| | |
|
| | | champMgr = GetChampionshipMgr()
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | if not pkZoneMgr:
|
| | | return {}
|
| | |
|
| | | # 决赛
|
| | | finalGroupMark = 2
|
| | |
| | | if syncZonID != None and zoneID != syncZonID:
|
| | | continue
|
| | | offZoneMgr = champMgr.GetChampOfficialZoneMgr(zoneID)
|
| | | if syncOfficialIDList == None:
|
| | | syncOfficialIDList = offZoneMgr.officialInfo.keys()
|
| | | for officialID in syncOfficialIDList:
|
| | | officialIDList = offZoneMgr.officialInfo.keys() if syncOfficialIDList == None else syncOfficialIDList
|
| | | for officialID in officialIDList:
|
| | | offObj = offZoneMgr.GetOfficialObj(officialID)
|
| | | if not offObj:
|
| | | continue
|
| | |
| | |
|
| | | champMgr = GetChampionshipMgr()
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | if not pkZoneMgr:
|
| | | return
|
| | | tagBatPlayer = pkZoneMgr.GetBatPlayer(tagPlayerID)
|
| | | if not tagBatPlayer:
|
| | | GameWorld.ErrLog("该分区不存在该参赛玩家,无法排位竞猜! zoneID=%s,tagPlayerID=%s" % (zoneID, tagPlayerID), playerID)
|
| | |
| | | playerID = msgData["playerID"]
|
| | | mainOfficialID = msgData["mainOfficialID"]
|
| | | officialID = msgData["officialID"]
|
| | | cancel = msgData["cancel"]
|
| | | PropData = msgData["PropData"]
|
| | | |
| | | if cancel:
|
| | | champMgr = GetChampionshipMgr()
|
| | | offZoneMgr = champMgr.GetChampOfficialZoneMgr(zoneID)
|
| | | officialObj = offZoneMgr.GetOfficialObj(officialID)
|
| | | if not officialObj:
|
| | | return
|
| | | if playerID not in officialObj.applyPlayerInfo:
|
| | | GameWorld.ErrLog("不在仙官申请列表里! zoneID=%s,mainOfficialID=%s,officialID=%s" % (zoneID, mainOfficialID, officialID), playerID)
|
| | | return
|
| | | officialObj.applyPlayerInfo.pop(playerID, None)
|
| | | Send_CrossServerMsg_ChampionshipOfficial(zoneID, [officialID])
|
| | | return
|
| | |
|
| | | mainIpyData = IpyGameDataPY.GetIpyGameData("ChampionshipOfficial", mainOfficialID)
|
| | | if not mainIpyData:
|
| | |
| | | GameWorld.Log("挑战目标仙官玩家ID结果! zoneID=%s,mainOfficialID=%s,officialID=%s,fightPower=%s,tagFightPower=%s,tagPlayerID=%s,Ret=%s"
|
| | | % (zoneID, mainOfficialID, officialID, fightPower, tagFightPower, tagPlayerID, Ret), playerID)
|
| | |
|
| | | syncOfficialIDList = [officialID]
|
| | | playerName = PropData.get("Name", str(playerID))
|
| | | # 暂时只记录挑战胜利的
|
| | | if Ret == 1:
|
| | |
| | | officialObj.ResetPlayer()
|
| | | officialObj.playerID = playerID
|
| | |
|
| | | # 移除该玩家的其他仙官申请
|
| | | for offID in offZoneMgr.officialInfo.keys():
|
| | | offObj = offZoneMgr.GetOfficialObj(offID)
|
| | | if not offObj:
|
| | | continue
|
| | | if playerID in offObj.applyPlayerInfo:
|
| | | offObj.applyPlayerInfo.pop(playerID)
|
| | | syncOfficialIDList.append(offID)
|
| | | |
| | | # 邮件通知对方,官职被挑战了
|
| | | if offPlayerID:
|
| | | PlayerCompensation.SendMailByKey("CrossChampionshipOfficialBeChallenge", [offPlayerID], [], [playerName, officialID], crossMail=True)
|
| | |
|
| | | exData = {"exDataType":"OfficialChallenge", "playerID":playerID, "tagPlayerName":officialObj.playerName,
|
| | | "mainOfficialID":mainOfficialID, "officialID":officialID, "Ret":Ret}
|
| | | Send_CrossServerMsg_ChampionshipOfficial(zoneID, [officialID], exData=exData)
|
| | | Send_CrossServerMsg_ChampionshipOfficial(zoneID, syncOfficialIDList, exData=exData)
|
| | | return
|
| | |
|
| | | #// C0 23 跨服排位仙官挑战记录查询 #tagCGChampionshipOfficialChallengeQuery
|
| | |
| | | def Sync_ChampionshipPKZoneGroupInfo(zoneID, groupMarkDict=None, curPlayer=None):
|
| | | ## 同步排位分区分组信息
|
| | | # @param groupMarkDict: {groupMark:[battleNum, ...], ...}
|
| | | |
| | | |
| | | champMgr = GetChampionshipMgr()
|
| | | if curPlayer:
|
| | | playerZoneID = champMgr.GetPlayerPKZoneID(curPlayer.GetPlayerID())
|
| | | if playerZoneID != zoneID:
|
| | | return
|
| | | if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
|
| | | return
|
| | |
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | if not pkZoneMgr:
|
| | | return
|
| | | |
| | | if groupMarkDict == None:
|
| | | groupMarkDict = {}
|
| | | for groupMark, groupDict in pkZoneMgr.battleInfo.items():
|
| | |
| | | battleObj = pkZoneMgr.GetBattle(groupMark, battleNum)
|
| | | if not battleObj:
|
| | | continue
|
| | | playerIDList.append(battleObj.playerIDA)
|
| | | playerIDList.append(battleObj.playerIDB)
|
| | | |
| | | if battleObj.playerIDA not in playerIDList:
|
| | | playerIDList.append(battleObj.playerIDA)
|
| | | if battleObj.playerIDB not in playerIDList:
|
| | | playerIDList.append(battleObj.playerIDB)
|
| | | |
| | | clientPack = ChPyNetSendPack.tagGCCrossChampionshipPKZoneGroupInfo()
|
| | | clientPack.ActID = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipID)
|
| | | clientPack.StateError = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipStateError)
|
| | |
| | | battleObj = pkZoneMgr.GetBattle(groupMark, battleNum)
|
| | | if not battleObj:
|
| | | continue
|
| | | battleRetDict = {str(k):v for k, v in battleObj.playerBatDict.items()}
|
| | | battlePack = ChPyNetSendPack.tagGCCrossChampionshipPKBattle()
|
| | | battlePack.BattleNum = battleNum
|
| | | battlePack.WinPlayerID = battleObj.winPlayerID
|
| | | battlePack.PlayerIDA = battleObj.playerIDA
|
| | | battlePack.PlayerIDB = battleObj.playerIDB
|
| | | battlePack.BattleRet = json.dumps(battleRetDict, ensure_ascii=False).replace(" ", "")
|
| | | battlePack.BattleRetLen = len(battlePack.BattleRet)
|
| | | groupPack.BattleList.append(battlePack)
|
| | | groupPack.BattleCount = len(groupPack.BattleList)
|
| | | clientPack.GroupList.append(groupPack)
|
| | |
| | | playerPack.FightPower = batPlayer.fightPower % ShareDefine.Def_PerPointValue
|
| | | playerPack.FightPowerEx = batPlayer.fightPower / ShareDefine.Def_PerPointValue
|
| | | playerPack.RealmLV = batPlayer.realmLV
|
| | | playerPack.Face = batPlayer.face
|
| | | playerPack.FacePic = batPlayer.facePic
|
| | | clientPack.PlayerList.append(playerPack)
|
| | | clientPack.PlayerCount = len(clientPack.PlayerList)
|
| | |
|
| | |
| | | playerZoneID = champMgr.GetPlayerPKZoneID(curPlayer.GetPlayerID())
|
| | | if playerZoneID != zoneID:
|
| | | continue
|
| | | if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
|
| | | continue
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | |
|
| | | return
|
| | |
| | | playerZoneID = champMgr.GetPlayerPKZoneID(playerID)
|
| | | if not playerZoneID:
|
| | | return
|
| | | if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
|
| | | return
|
| | |
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(playerZoneID)
|
| | | if not pkZoneMgr:
|
| | | return
|
| | |
|
| | | clientPack = ChPyNetSendPack.tagGCChampionshipGuessPriInfo()
|
| | | clientPack.ZoneID = playerZoneID
|
| | |
| | | playerZoneID = champMgr.GetPlayerPKZoneID(curPlayer.GetPlayerID())
|
| | | if playerZoneID != zoneID:
|
| | | return
|
| | | if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
|
| | | return
|
| | |
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | if not pkZoneMgr:
|
| | | return
|
| | |
|
| | | # 公共竞猜信息
|
| | | clientPack = ChPyNetSendPack.tagGCChampionshipGuessPubInfo()
|
| | |
| | | playerZoneID = champMgr.GetPlayerPKZoneID(curPlayer.GetPlayerID())
|
| | | if playerZoneID != zoneID:
|
| | | continue
|
| | | if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
|
| | | continue
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | |
| | | if curPlayer:
|
| | | playerZoneID = champMgr.GetPlayerOfficialZoneID(curPlayer.GetPlayerID())
|
| | | if playerZoneID != zoneID:
|
| | | return
|
| | | if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
|
| | | return
|
| | |
|
| | | clientPack = ChPyNetSendPack.tagGCChampionshipOfficialInfo()
|
| | |
| | | offPlayer.FightPower = offObj.fightPower % ShareDefine.Def_PerPointValue
|
| | | offPlayer.FightPowerEx = offObj.fightPower / ShareDefine.Def_PerPointValue
|
| | | offPlayer.RealmLV = offObj.realmLV
|
| | | offPlayer.Face = offObj.face
|
| | | offPlayer.FacePic = offObj.facePic
|
| | |
|
| | | offPack = ChPyNetSendPack.tagGCChampionshipOfficial()
|
| | | offPack.OfficialID = officialID
|
| | |
| | | applyPlayer.FightPower = fightPower % ShareDefine.Def_PerPointValue
|
| | | applyPlayer.FightPowerEx = fightPower / ShareDefine.Def_PerPointValue
|
| | | applyPlayer.RealmLV = playerInfo.get("RealmLV", 1)
|
| | | applyPlayer.Face = playerInfo.get("Face", 0)
|
| | | applyPlayer.FacePic = playerInfo.get("FacePic", 0)
|
| | |
|
| | | offPack.ApplyPlayerList.append(applyPlayer)
|
| | | offPack.ApplyPlayerCount = len(offPack.ApplyPlayerList)
|
| | |
| | | playerZoneID = champMgr.GetPlayerOfficialZoneID(curPlayer.GetPlayerID())
|
| | | if playerZoneID != zoneID:
|
| | | continue
|
| | | if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
|
| | | continue
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | |
|
| | | return
|