From c67a2d59e881e3d1df1a4142983e76e8fb5db24a Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期五, 28 十二月 2018 21:26:28 +0800 Subject: [PATCH] 5424 【后端】【1.4】跨服竞技场开发(匹配规则优化,优先匹配同段位的,同段位不足两个人的支持按段位区间匹配) --- ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py | 51 ++++++++++++++++++++++++++++++--------------------- 1 files changed, 30 insertions(+), 21 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py index ac1538e..c1fae3c 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py @@ -38,7 +38,6 @@ import PlayerUniversalGameRec import PlayerCompensation import IpyGameDataPY -import MergePlayer import PyGameDataStruct import PyDataManager import PlayerControl @@ -306,6 +305,20 @@ # # return +#// A9 04 查询boss信息 #tagCGQueryBossInfo +# +# +#struct tagCGQueryBossInfo +#{ +# tagHead Head; +# BYTE Count; //数量 +# DWORD BossIDList[Count]; //boosid +#}; +def OnQueryBossInfo(index, clientData, tick): + curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) + bossIDList = clientData.BossIDList + Sync_BossInfo(curPlayer, bossIDList) + return ## 同步boss相关信息 @@ -467,6 +480,7 @@ state = gameWorld.GetDictByKey(ChConfig.Def_WorldKey_OperationActionState % ShareDefine.OperationActionName_BossReborn) if state: Sync_BossRebornPoint(curPlayer) + Sync_DogzNPCRefreshTime(curPlayer) return ## 地图启动ok通知 @@ -566,15 +580,6 @@ playerCntDict[bossid] = playerCntDict.get(bossid, 0) + 1 GameWorld.DebugLog(' boss等级信息对应本服在线人数 %s' % playerCntDict) - # 此处需要统计累加当前在跨服服务器的玩家 - mergeServerOnlinePlayerDict = MergePlayer.GetMergeServerOnlinePlayerInfo() - for playerInfo in mergeServerOnlinePlayerDict.values(): - findLV = playerInfo[MergePlayer.Def_MSOLPlayer_LV] - for bossid, lvLimit in bossRebornDict.items(): - if lvLimit[0] <= findLV <= lvLimit[1]: - playerCntDict[bossid] = playerCntDict.get(bossid, 0) + 1 - GameWorld.DebugLog(' boss等级信息对应本服及跨服在线人数 %s' % playerCntDict) - for bossid, curOnlineCnt in playerCntDict.items(): SetBossOnlineHeroCnt(bossid, curOnlineCnt) @@ -618,7 +623,8 @@ return onlineCnt = __GetBossOnlineHeroCnt(bossid)[0] LVLimit = ipyData.GetLVLimit() - if PyGameData.g_yesterdayPlayerLVDict: + openServerDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerDay) + if openServerDay != 0 and LVLimit and len(LVLimit) == 2: yesterdayCnt = len([1 for lv in PyGameData.g_yesterdayPlayerLVDict.values() if LVLimit[0]<=lv <= LVLimit[1]]) #参数昨日活跃人数 else: yesterdayCnt = IpyGameDataPY.GetFuncCfg('FirstDayActivePlayerCnt') @@ -948,8 +954,10 @@ refreshTime = 0 PyGameData.g_sortBOSSRefreshList[i] = [bossID, killedTime, refreshTime] bossIDList.append(bossID) + curTime = int(time.time()) + PyGameData.g_sortBOSSRefreshList.sort(key=lambda asd:max(0, asd[2] - (curTime - asd[1]))) GameWorld.Log(' boss复活活动 重生boss bossIDList=%s'%bossIDList) - g_lastBossRebornTime = int(time.time()) + g_lastBossRebornTime = curTime else: #广播 needNotifyPointPerList = IpyGameDataPY.GetFuncEvalCfg('BossRebornNotify') @@ -1035,23 +1043,24 @@ NetPackCommon.SendFakePack(curPlayer, packData) return -def Sync_DogzNPCRefreshTime(msgList): +def Sync_DogzNPCRefreshTime(curPlayer=None): #同步神兽副本NPC刷新时间 - playerID, refreshTimeDict = msgList - curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID) if playerID else None - if playerID and not curPlayer: - return + refreshTimeDict = PyGameData.g_dogzNPCRefreshTimeDict + if not refreshTimeDict: return + curTime = int(time.time()) packData = ChPyNetSendPack.tagGCDogzNPCRefreshTime() packData.InfoList=[] - for npcid, rTime in refreshTimeDict.items(): + for npcid, timeinfo in refreshTimeDict.items(): + lastRefreshTime, nextNeedTime = timeinfo + remainTime = max(0, nextNeedTime - curTime + lastRefreshTime) timeInfo = ChPyNetSendPack.tagDogzTimeInfoObj() timeInfo.NPCID = npcid - timeInfo.RefreshSecond = rTime + timeInfo.RefreshSecond = remainTime packData.InfoList.append(timeInfo) packData.Cnt = len(packData.InfoList) - if not playerID: + if not curPlayer: playerManager = GameWorld.GetPlayerManager() for i in xrange(playerManager.GetActivePlayerCount()): curPlayer = playerManager.GetActivePlayerAt(i) @@ -1212,6 +1221,6 @@ if curMember.GetFamilyLV() == IPY_GameServer.fmlMember: GameWorld.DebugLog("普通成员无法召集!", playerID) return - PlayerControl.FamilyNotify(curFamily.GetID(), "FairyGrabBossHelp", [npcID]) + PlayerControl.FamilyNotify(curFamily.GetID(), "FairyGrabBossHelp", [curPlayer.GetName(), npcID]) return -- Gitblit v1.8.0