From 1b561794e12bed747e200d7a1df2639d2228edad Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期三, 28 九月 2022 16:39:04 +0800 Subject: [PATCH] 9701 【后端】【越南】【BT7】【主干】跨服竞技64位排位赛(GameServer支持功能开启判断;排位相关封包通知仅通知功能开启的玩家) --- ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerControl.py | 45 ++++++++++++++++++++++ ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py | 7 ++- ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossChampionship.py | 27 +++++++++++++ ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossChampionship.py | 4 ++ ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py | 1 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py | 7 +++ ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py | 1 PySysDB/PySysDBG.h | 1 8 files changed, 90 insertions(+), 3 deletions(-) diff --git a/PySysDB/PySysDBG.h b/PySysDB/PySysDBG.h index 2421f8a..b10e0d6 100644 --- a/PySysDB/PySysDBG.h +++ b/PySysDB/PySysDBG.h @@ -332,6 +332,7 @@ DWORD LimitLV; //开启等级 DWORD LimitMagicWeapon; //需要解锁法宝ID WORD LimiRealmLV; //需要境界等级 + BYTE LimitVIPLV; //需要VIP等级 }; //NPC表 diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossChampionship.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossChampionship.py index d105313..a0ffab3 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossChampionship.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossChampionship.py @@ -758,11 +758,22 @@ 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() @@ -2853,11 +2864,13 @@ 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) @@ -2932,6 +2945,8 @@ playerZoneID = champMgr.GetPlayerPKZoneID(curPlayer.GetPlayerID()) if playerZoneID != zoneID: continue + if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship): + continue NetPackCommon.SendFakePack(curPlayer, clientPack) return @@ -2944,6 +2959,8 @@ champMgr = GetChampionshipMgr() playerZoneID = champMgr.GetPlayerPKZoneID(playerID) if not playerZoneID: + return + if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship): return pkZoneMgr = champMgr.GetChampPKZoneMgr(playerZoneID) @@ -2990,6 +3007,8 @@ 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: @@ -3033,6 +3052,8 @@ playerZoneID = champMgr.GetPlayerPKZoneID(curPlayer.GetPlayerID()) if playerZoneID != zoneID: continue + if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship): + continue NetPackCommon.SendFakePack(curPlayer, clientPack) return @@ -3044,6 +3065,8 @@ if curPlayer: playerZoneID = champMgr.GetPlayerOfficialZoneID(curPlayer.GetPlayerID()) if playerZoneID != zoneID: + return + if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship): return clientPack = ChPyNetSendPack.tagGCChampionshipOfficialInfo() @@ -3104,6 +3127,8 @@ playerZoneID = champMgr.GetPlayerOfficialZoneID(curPlayer.GetPlayerID()) if playerZoneID != zoneID: continue + if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship): + continue NetPackCommon.SendFakePack(curPlayer, clientPack) return diff --git a/ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py b/ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py index 27cfd99..e0c39da 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py @@ -285,6 +285,7 @@ ("DWORD", "LimitLV", 0), ("DWORD", "LimitMagicWeapon", 0), ("WORD", "LimiRealmLV", 0), + ("BYTE", "LimitVIPLV", 0), ), "ChinNPC":( @@ -1379,13 +1380,15 @@ self.FuncId = 0 self.LimitLV = 0 self.LimitMagicWeapon = 0 - self.LimiRealmLV = 0 + self.LimiRealmLV = 0 + self.LimitVIPLV = 0 return def GetFuncId(self): return self.FuncId # 功能标识 def GetLimitLV(self): return self.LimitLV # 开启等级 def GetLimitMagicWeapon(self): return self.LimitMagicWeapon # 需要解锁法宝ID - def GetLimiRealmLV(self): return self.LimiRealmLV # 需要境界等级 + def GetLimiRealmLV(self): return self.LimiRealmLV # 需要境界等级 + def GetLimitVIPLV(self): return self.LimitVIPLV # 需要VIP等级 # NPC表 class IPY_ChinNPC(): diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerControl.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerControl.py index 47443a1..289f531 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerControl.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerControl.py @@ -30,6 +30,7 @@ import PlayerDBOper import IPY_GameServer import PlayerDBGSEvent +import CrossChampionship import IpyGameDataPY import CrossRealmMsg import ShareDefine @@ -405,3 +406,47 @@ return ipyData.GetLimitLV() +# 因为MapServer玩家属性变更通知GameServer与功能开启通知触发时机有先后顺序,可能导致判断功能开启不准确,所以暂时记录该信息,临时用 +g_playerOpenFuncInfo = {} # 玩家触发功能开启功能ID信息,{playerID:[funcID, ...], ...} +## 功能是否可用,该函数并不能确保百分百正确,只能大致判断,仅判断部分条件,如包含未判断的条件则不能确保百分百正确 +def GetFuncCanUse(curPlayer, funcID): + playerID = curPlayer.GetPlayerID() + if playerID in g_playerOpenFuncInfo: + if funcID in g_playerOpenFuncInfo[playerID]: + return True + + ipyData = IpyGameDataPY.GetIpyGameData("FuncOpenLV", funcID) + if not ipyData: + return False + + if ipyData.GetLimitLV() and ipyData.GetLimitLV() > curPlayer.GetLV(): + return False + + if ipyData.GetLimiRealmLV() and ipyData.GetLimiRealmLV() > curPlayer.GetOfficialRank(): + return False + + if ipyData.GetLimitVIPLV() and ipyData.GetLimitVIPLV() > curPlayer.GetVIPLv(): + return False + + return True + +def DoFuncOpenLogic(curPlayer, funcIDList): + global g_playerOpenFuncInfo + if GameWorld.IsCrossServer(): + return + playerID = curPlayer.GetPlayerID() + FuncOpenLogicDict = { + ShareDefine.GameFuncID_Championship:lambda curObj:CrossChampionship.DoChampionshipOpen(curObj), + } + for funcID in funcIDList: + if funcID in FuncOpenLogicDict: + if playerID not in g_playerOpenFuncInfo: + g_playerOpenFuncInfo[playerID] = [] + openFuncIDList = g_playerOpenFuncInfo[playerID] + if funcID not in openFuncIDList: + openFuncIDList.append(funcID) + GameWorld.DebugLog("触发功能开启逻辑! funcID=%s" % funcID, playerID) + FuncOpenLogicDict[funcID](curPlayer) + return + + diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py index 4d97414..1516745 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py @@ -581,6 +581,13 @@ PlayerExam.MapServer_ExitAction(srcPlayerID) return + if callName == 'FuncOpen': + curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(srcPlayerID) + if not curPlayer: + return + PlayerControl.DoFuncOpenLogic(curPlayer, eval(resultName)) + return + if callName == 'TeamNotify': #队伍通知 teamID = pack.GetQueryID() diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py index c1324ff..21e3601 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py @@ -1138,6 +1138,7 @@ GameFuncID_Arena = 195 # 竞技场 GameFuncID_FaQi = 199 # 法器 GameFuncID_LianTi = 207 # 炼体 +GameFuncID_Championship = 210 # 排位 # 以下为暂时无用的 GameFuncID_Truck = 33 # 运镖 GameFuncID_RunDaily = 34 # 日常跑环 diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossChampionship.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossChampionship.py index 0a075ac..8a6f33b 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossChampionship.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossChampionship.py @@ -28,6 +28,10 @@ import time +def DoChampionshipOpen(curPlayer): + DoPlayerLogin(curPlayer) + return + def DoPlayerLogin(curPlayer): if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Championship_WorshipCount): Sync_ChampionshipPlayerInfo(curPlayer) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py index c1324ff..21e3601 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py @@ -1138,6 +1138,7 @@ GameFuncID_Arena = 195 # 竞技场 GameFuncID_FaQi = 199 # 法器 GameFuncID_LianTi = 207 # 炼体 +GameFuncID_Championship = 210 # 排位 # 以下为暂时无用的 GameFuncID_Truck = 33 # 运镖 GameFuncID_RunDaily = 34 # 日常跑环 -- Gitblit v1.8.0