| | |
| | | import CrossRealmPlayer
|
| | | import PlayerCompensation
|
| | | import PlayerViewCache
|
| | | import PlayerFuncTeam
|
| | | import CrossBillboard
|
| | | import IpyGameDataPY
|
| | | import NetPackCommon
|
| | |
| | |
|
| | | billboardObj.ClearData()
|
| | |
|
| | | # 清空队伍
|
| | | PlayerFuncTeam.DelTeamByFunc(ChConfig.Def_FBMapID_CrossBattlefield)
|
| | | return
|
| | |
|
| | | def GetCrossBattlefieldState():
|
| | |
| | | def OnMapServerInitOK():
|
| | | # 通知地图服务器状态
|
| | | SyncMapServerCrossBattlefieldBuyInfo()
|
| | | SyncMapServerCrossBattlefieldSysCallBuyInfo()
|
| | | return
|
| | |
|
| | | def SyncMapServerCrossBattlefieldBuyInfo():
|
| | |
| | | buyInfo[playerID] = {"callPlayerIDList":buyRec.callPlayerIDList, "factionID":buyRec.factionID}
|
| | | syncMapBuyInfo[zoneID][hmNum] = buyInfo
|
| | | GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_CrossBattlefieldCallTeamInfo, syncMapBuyInfo)
|
| | | return
|
| | |
|
| | | def SyncMapServerCrossBattlefieldSysCallBuyInfo():
|
| | | syncMapBuyInfo = PyGameData.g_crossBattlefieldSysCallBuyList
|
| | | GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_CrossBattlefieldSysCallBuyInfo, syncMapBuyInfo)
|
| | | return
|
| | |
|
| | | def OnMinuteProcess():
|
| | |
| | | PyGameData.g_crossDynamicLineInfo.pop(ChConfig.Def_FBMapID_CrossBattlefield, None)
|
| | |
|
| | | PyGameData.g_overPlayerIDList = []
|
| | | |
| | | PyGameData.g_crossBattlefieldSysCallBuyList = []
|
| | | |
| | | hmNum = battlefieldState
|
| | | openHour, openMinute = GetHMByNum(hmNum)
|
| | | sysOpenHMList = IpyGameDataPY.GetFuncEvalCfg("CrossBattlefieldOpen", 1)
|
| | |
| | | PlayerFB.OpenCrossDynamicLineBySys(zoneID, ChConfig.Def_FBMapID_CrossBattlefield, funcLineIDList, True)
|
| | | else:
|
| | | GameWorld.Log(" 无召集的场次不开分区战场! zoneID=%s" % (zoneID))
|
| | | |
| | | |
| | | # 关闭
|
| | | #if not battlefieldState and beforeState != battlefieldState:
|
| | | # # 活动结束清空队伍
|
| | | # PlayerFuncTeam.DelTeamByFunc(ChConfig.Def_FBMapID_CrossBattlefield)
|
| | | |
| | | # 同步子服务器
|
| | | dataMsg = {"battlefieldState":battlefieldState}
|
| | | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_BattlefieldState, dataMsg)
|
| | |
| | | if passSeconds > closeSeconds:
|
| | | GameWorld.DebugLog("迟到了! passSeconds=%s > %s" % (passSeconds, closeSeconds), playerID)
|
| | | isBelate = True
|
| | | #去除新队员进入不受时间限制设定
|
| | | for _, copyMapObj in PyGameData.g_crossDynamicLineCopyMapInfo.items():
|
| | | if copyMapObj.IsMustCopyMapPlayer(playerID):
|
| | | if copyMapObj.IsMustCopyMapPlayer(playerID, False):
|
| | | isBelate = False
|
| | | GameWorld.DebugLog("已进入的重复进入不限制时间! playerID=%s" % playerID)
|
| | | break
|
| | |
| | | openMinute = msgData["openMinute"]
|
| | | faction = msgData["faction"]
|
| | | serverOnly = msgData.get("serverOnly", 0)
|
| | | face = msgData.get("face", 0)
|
| | | facePic = msgData.get("facePic", 0)
|
| | |
|
| | | hmNum = GetHMNum(openHour, openMinute)
|
| | | |
| | | # 更新缓存
|
| | | curCache = PlayerViewCache.FindViewCache(playerID, True)
|
| | | if curCache:
|
| | | cacheDict = PlayerViewCache.GetCachePropDataDict(curCache)
|
| | | cacheDict["Name"] = playerName
|
| | | cacheDict["Job"] = job
|
| | | cacheDict["LV"] = playerLV
|
| | | cacheDict["RealmLV"] = realmLV
|
| | | cacheDict["FightPower"] = fightPower |
| | | |
| | | sysOpenHMList = IpyGameDataPY.GetFuncEvalCfg("CrossBattlefieldOpen", 1)
|
| | | if [openHour, openMinute] in sysOpenHMList:
|
| | | if playerID in PyGameData.g_crossBattlefieldSysCallBuyList:
|
| | | GameWorld.Log("玩家已经购买过该系统场次! zoneID=%s,openHour=%s,openMinute=%s" % (zoneID, openHour, openMinute), playerID)
|
| | | return
|
| | | PyGameData.g_crossBattlefieldSysCallBuyList.append(playerID)
|
| | | |
| | | buyTime = int(time.time())
|
| | | GameWorld.DebugLog("玩家购买系统召集场次! zoneID=%s,openHour=%s,openMinute=%s" % (zoneID, openHour, openMinute), playerID)
|
| | | |
| | | # 上榜
|
| | | billboardCallCountLimit = IpyGameDataPY.GetFuncCfg("CrossBattlefieldBillboard", 1) # 周召集榜上榜至少次数
|
| | | groupValue1, dataID, name1, name2 = zoneID, playerID, playerName, ""
|
| | | type2, value1, value2 = job, realmLV, 0
|
| | | cmpValue = buyOpenCountWeek + 1
|
| | | if cmpValue >= billboardCallCountLimit:
|
| | | CrossBillboard.UpdCrossBillboard(ShareDefine.Def_CBT_BattlefieldWCall, groupValue1, dataID, name1, name2, type2, value1, value2, cmpValue, value3=face, value4=facePic) |
| | | |
| | | # 通知子服
|
| | | serverGroupIDList = [serverGroupID]
|
| | | msgData.update({"opType":"SysCallBuy", "buyTime":buyTime})
|
| | | sendMsg = {"zoneID":zoneID, "SysCallBuyPlayerID":playerID, "opData":msgData}
|
| | | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_BattlefieldBuy, sendMsg, serverGroupIDList)
|
| | | |
| | | SyncMapServerCrossBattlefieldSysCallBuyInfo()
|
| | | |
| | | buyPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | if buyPlayer:
|
| | | sendCMD = str(["SysCallBuy", PyGameData.g_crossBattlefieldSysCallBuyList])
|
| | | GameWorld.GetPlayerManager().MapServer_QueryPlayer(0, 0, buyPlayer.GetPlayerID(), buyPlayer.GetRealMapID(), |
| | | "CrossBattlefield", sendCMD, len(sendCMD), buyPlayer.GetRouteServerIndex())
|
| | | return
|
| | |
|
| | | if zoneID not in PyGameData.g_crossBattlefieldBuyInfo:
|
| | | PyGameData.g_crossBattlefieldBuyInfo[zoneID] = {}
|
| | |
| | |
|
| | | # ================ 可以购买,以下执行添加购买场次阵营逻辑 ================
|
| | |
|
| | | # 更新缓存
|
| | | curCache = PlayerViewCache.FindViewCache(playerID, True)
|
| | | if curCache:
|
| | | cacheDict = PlayerViewCache.GetCachePropDataDict(curCache)
|
| | | cacheDict["Name"] = playerName
|
| | | cacheDict["Job"] = job
|
| | | cacheDict["LV"] = playerLV
|
| | | cacheDict["RealmLV"] = realmLV
|
| | | cacheDict["FightPower"] = fightPower |
| | | |
| | | # 新增场次购买记录
|
| | | buyTime = int(time.time())
|
| | | buyRec = CrossBattlefieldBuy()
|
| | |
| | | type2, value1, value2 = job, realmLV, 0
|
| | | cmpValue = buyOpenCountWeek + 1
|
| | | if cmpValue >= billboardCallCountLimit:
|
| | | CrossBillboard.UpdCrossBillboard(ShareDefine.Def_CBT_BattlefieldWCall, groupValue1, dataID, name1, name2, type2, value1, value2, cmpValue)
|
| | | CrossBillboard.UpdCrossBillboard(ShareDefine.Def_CBT_BattlefieldWCall, groupValue1, dataID, name1, name2, type2, value1, value2, cmpValue, value3=face, value4=facePic)
|
| | |
|
| | | for otherBuyPlayerID, otherRec in buyPlayerInfo.items():
|
| | | if otherBuyPlayerID == playerID:
|
| | |
| | | syncPlayerDataInfo = {}
|
| | | winnerPlayerIDList, loserPlayerIDList = [], []
|
| | | for playerInfo in battlePlayerList:
|
| | | playerID, job, realmLV, name, \
|
| | | isWinner, faction, rank, score, highScoreToday, highScoreWeekTotal, enterCountWeek, \
|
| | | playerID, job, face, facePic, realmLV, name, \
|
| | | isWinner, faction, rank, score, highScoreToday, highScoreWeekTotal, enterCountWeek, teamID, \
|
| | | isCallOpen, isCalled, killCnt, ckillCntInfo, killBossCnt, killScoreKing, killGuardCnt, auraScore, superItemAwardCnt, \
|
| | | factionBuffCollCnt, personBuffCollCnt, crystalCollCnt, wallCollCnt \
|
| | | = playerInfo
|
| | |
| | | enterCountWeek += 1
|
| | | cmpValue = enterCountWeek
|
| | | if cmpValue >= billboardEnterCountLimit:
|
| | | CrossBillboard.UpdCrossBillboard(ShareDefine.Def_CBT_BattlefieldWJoin, groupValue1, dataID, name1, name2, type2, value1, value2, cmpValue)
|
| | | CrossBillboard.UpdCrossBillboard(ShareDefine.Def_CBT_BattlefieldWJoin, groupValue1, dataID, name1, name2, type2, value1, value2, cmpValue, value3=face, value4=facePic)
|
| | |
|
| | | # 更新周高分榜单
|
| | | if score > highScoreToday:
|
| | | highScoreWeekTotal += (score - highScoreToday)
|
| | | highScoreToday = score
|
| | | cmpValue = highScoreWeekTotal
|
| | | CrossBillboard.UpdCrossBillboard(ShareDefine.Def_CBT_BattlefieldWScore, groupValue1, dataID, name1, name2, type2, value1, value2, cmpValue)
|
| | | CrossBillboard.UpdCrossBillboard(ShareDefine.Def_CBT_BattlefieldWScore, groupValue1, dataID, name1, name2, type2, value1, value2, cmpValue, value3=face, value4=facePic)
|
| | |
|
| | | GameWorld.Log(" 战场阵营玩家: faction=%s,isWinner=%s,rank=%s,playerID=%s,score=%s,highScoreToday=%s,highScoreWeekTotal=%s,enterCountWeek=%s,isCallOpen=%s,isCalled=%s" |
| | | % (faction, isWinner, rank, playerID, score, highScoreToday, highScoreWeekTotal, enterCountWeek, isCallOpen, isCalled), fbPropertyID)
|
| | | GameWorld.Log(" 战场阵营玩家: faction=%s,isWinner=%s,rank=%s,playerID=%s,score=%s,highScoreToday=%s,highScoreWeekTotal=%s,enterCountWeek=%s,teamID=%s,isCallOpen=%s,isCalled=%s" |
| | | % (faction, isWinner, rank, playerID, score, highScoreToday, highScoreWeekTotal, enterCountWeek, teamID, isCallOpen, isCalled), fbPropertyID)
|
| | |
|
| | | syncPlayerDataInfo[playerID] = [isWinner, faction, rank, score, highScoreToday, highScoreWeekTotal, enterCountWeek,
|
| | | syncPlayerDataInfo[playerID] = [isWinner, faction, rank, score, highScoreToday, highScoreWeekTotal, enterCountWeek, teamID,
|
| | | isCallOpen, isCalled, killCnt, ckillCntInfo, killBossCnt, killScoreKing, killGuardCnt, auraScore, superItemAwardCnt,
|
| | | factionBuffCollCnt, personBuffCollCnt, crystalCollCnt, wallCollCnt]
|
| | |
|
| | |
| | | GameWorld.DebugLog("收到跨服服务器同步的战场购买信息: %s" % msgData)
|
| | |
|
| | | zoneID = msgData["zoneID"]
|
| | | syncBuyHMInfo = msgData["syncBuyHMInfo"]
|
| | | opData = msgData.get("opData", {})
|
| | |
|
| | | curZoneID = GetCrossBattlefieldZoneID(GameWorld.GetServerGroupID())
|
| | |
| | | GameWorld.ErrLog("非本服所属分区的跨服战场购买信息! curZoneID(%s) != zoneID(%s) %s" % (curZoneID, zoneID, str(msgData)))
|
| | | return
|
| | |
|
| | | if "SysCallBuyPlayerID" in msgData:
|
| | | playerID = msgData["SysCallBuyPlayerID"]
|
| | | if PlayerControl.GetDBPlayerAccIDByID(playerID):
|
| | | openHour = opData["openHour"]
|
| | | openMinute = opData["openMinute"]
|
| | | faction = opData["faction"]
|
| | | buyTime = opData["buyTime"]
|
| | | todayBuyOpenCount = opData["todayBuyOpenCount"]
|
| | | msgInfo = ["BattlefieldBuy", [openHour, openMinute, faction, todayBuyOpenCount, buyTime]]
|
| | | CrossRealmPlayer.MapServer_QueryCrossPlayerResult(playerID, "CrossBattlefield", msgInfo)
|
| | | return
|
| | | |
| | | syncBuyHMInfo = msgData["syncBuyHMInfo"]
|
| | | if not syncBuyHMInfo:
|
| | | PyGameData.g_crossBattlefieldBuyInfo.pop(zoneID, None)
|
| | |
|