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 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

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
+
+

--
Gitblit v1.8.0