From 4293fe71a3fc946f229ec102f86b79fc43d0e279 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期二, 26 三月 2019 14:35:46 +0800
Subject: [PATCH] 6374 【后端】【2.0】删除无用功能代码、封包、配置(删全身强化表、洗炼套装属性表)

---
 ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py |  105 ++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 85 insertions(+), 20 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py
index 695f942..5438e00 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py
@@ -28,7 +28,6 @@
 import NetPackCommon
 import IpyGameDataPY
 import PyGameData
-
 # 获取玩家跨服服务器上的名字
 #===============================================================================
 # def GetCrossPlayerName(curPlayer):
@@ -46,7 +45,7 @@
 # 获取玩家跨服服务器上的名字
 def GetCrossPlayerName(curPlayer):
     # 通过游戏账号中的平台标志获取名称,目前为spid
-    playerName = curPlayer.GetPlayerName()
+    playerName = curPlayer.GetName()
     
     opName = ReadChConfig.GetPyMongoConfig("Merge", "OpName_%s_%s" % (GameWorld.GetPlayerPlatform(curPlayer), 
                                            GameWorld.GetPlayerServerSID(curPlayer)))
@@ -56,20 +55,19 @@
     
     return opName.decode('gbk').encode(GameWorld.GetCharacterEncoding()) + playerName
 
-def GetServerCrossZoneIpyData(mapID, serverGroupID=0):
-    ## 获取本服对应跨服玩法分区地图信息
-    if mapID not in ChConfig.Def_CrossZoneTableName:
+def GetCrossCommZoneIpyDataByZoneID(zoneID):
+    ## 获取跨服常规分区 
+    crossZoneName = GameWorld.GetCrossZoneName()
+    ipyData = IpyGameDataPY.GetIpyGameDataNotLog("CrossZoneComm", crossZoneName, zoneID)
+    return ipyData
+
+def GetCrossCommZoneIpyDataByServerGroupID(serverGroupID):
+    ## 获取跨服常规分区
+    crossZoneName = GameWorld.GetCrossZoneName()
+    ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition("CrossZoneComm", {"CrossZoneName":crossZoneName}, True)
+    if not ipyDataList:
         return
-    if not serverGroupID:
-        serverGroupID = GameWorld.GetServerGroupID()
-        
-    tableName = ChConfig.Def_CrossZoneTableName[mapID]
-    ipyDataMgr = IpyGameDataPY.IPY_Data()
-    if not hasattr(ipyDataMgr, "Get%sCount" % tableName):
-        return
-    
-    for i in xrange(getattr(ipyDataMgr, "Get%sCount" % tableName)()):
-        ipyData = getattr(ipyDataMgr, "Get%sByIndex" % tableName)(i)
+    for ipyData in ipyDataList:
         serverGroupIDList = ipyData.GetServerGroupIDList()
         for serverGroupIDInfo in serverGroupIDList:
             if (isinstance(serverGroupIDInfo, tuple) and serverGroupIDInfo[0] <= serverGroupID <= serverGroupIDInfo[1]) \
@@ -77,15 +75,47 @@
                 return ipyData
     return
 
+def GetCrossCommZoneIpyDataListByServerGroupID(serverGroupID):
+    ## 获取跨服常规分区列表
+    if serverGroupID:
+        ipyData = GetCrossCommZoneIpyDataByServerGroupID(serverGroupID)
+        if not ipyData:
+            return
+        ipyDataList = [ipyData]
+    else:
+        crossZoneName = GameWorld.GetCrossZoneName()
+        ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition("CrossZoneComm", {"CrossZoneName":crossZoneName}, True)
+    return ipyDataList
+
+def GetServerCrossZoneMapIpyData(mapID, serverGroupID=0):
+    ## 获取本服对应跨服玩法分区地图信息
+    if mapID not in ChConfig.Def_CrossZoneMapTableName:
+        return
+    tableName = ChConfig.Def_CrossZoneMapTableName[mapID]
+    if not serverGroupID:
+        if GameWorld.IsCrossServer():
+            return
+        serverGroupID = GameWorld.GetServerGroupID()
+    zoneIpyData = GetCrossCommZoneIpyDataByServerGroupID(serverGroupID)
+    if not zoneIpyData:
+        return
+    commZoneID = zoneIpyData.GetZoneID()
+    return IpyGameDataPY.GetIpyGameDataByCondition(tableName, {"ZoneID":commZoneID})
+
 def IsCrossServerOpen():
     ## 跨服服务器是否开放中
     return GameWorld.GetGameWorld().GetDictByKey(ShareDefine.Def_Notify_WorldKey_CrossServerOpen)
 
-def ClientServerMsg_ServerInitOK(serverGroupID):
-    ## 子服连接成功
+def Sync_CrossCommInitDataToClientServer(serverGroupID=0):
+    ''' 同步跨服常规通用数据到子服务器
+    @param serverGroupID: 为0时同步所有子服
+    '''
+    
     isOpen = GameWorld.GetGameWorld().GetDictByKey(ShareDefine.Def_Notify_WorldKey_CrossServerOpen)
-    GameWorld.Log("子服连接成功,通知当前跨服服务器状态: isOpen=%s" % isOpen)
-    CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_CrossServerState, {"isOpen":isOpen}, [serverGroupID])
+    crossZoneName = GameWorld.GetCrossZoneName()
+    GameWorld.Log("通知当前跨服服务器状态: isOpen=%s,crossZoneName=%s,syncServerGroupID=%s" % (isOpen, crossZoneName, serverGroupID))
+    serverGroupIDList = [serverGroupID] if serverGroupID else []
+    CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_CrossServerState, {"isOpen":isOpen, "crossZoneName":crossZoneName}, serverGroupIDList)
     return
 
 def DoChangeCrossServerState(isOpen):
@@ -110,6 +140,10 @@
 
 def CrossServerMsg_CrossServerState(msgData):
     ## 子服收到跨服服务器状态变更,子服不存DB,默认跨服维护中,连接跨服成功后由跨服同步状态直接更新到字典即可,没连上就默认维护中
+    if "crossZoneName" in msgData:
+        PyGameData.g_crossZoneName = msgData["crossZoneName"]
+        GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_CrossZoneName, PyGameData.g_crossZoneName)
+        
     isOpen = msgData["isOpen"]
     isOpen = 1 if isOpen else 0
     GameWorld.Log("收到跨服服务器状态变更: 是否正常开放中=%s" % isOpen)
@@ -123,6 +157,7 @@
                 continue
             PlayerControl.SetCrossMapID(curPlayer, 0)
             
+    GameWorld.GetGameWorld().SendCrossServerStateToLoginServer(isOpen)
     # 通知地图
     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_CrossServerOpen, isOpen)
     return
@@ -316,7 +351,6 @@
     sendPack.ItemDataSize = len(sendPack.ItemData)
     sendPack.PlusData = PlusData
     sendPack.PlusDataSize = len(sendPack.PlusData)
-    sendPack.CrossPlayer = 1
     NetPackCommon.SendFakePack(curPlayer, sendPack)
     return
 
@@ -352,5 +386,36 @@
     curPlayer.MapServer_QueryPlayerResult(0, 0, "CrossGiveMoney", msgInfo, len(msgInfo))
     return
 
+def SetCrossPlayerAttrValue(msgInfo, tick):
+    ## 设置跨服玩家属性值
+    playerID, setType, setDict, isDelay = msgInfo
+    if not PyGameData.g_crossSetPlayerAttr:
+        GameWorld.GetGameWorld().SetDict(ChConfig.Def_WorldKey_CrossSetPlayerAttrTick, tick)
+    playerSetInfoList = PyGameData.g_crossSetPlayerAttr.get(playerID, [])
+    playerSetInfoList.append([setType, setDict])
+    PyGameData.g_crossSetPlayerAttr[playerID] = playerSetInfoList
+    if not isDelay:
+        __SendCrossServerSetPlayerAttr(0)
+    return
+
+def OnCrossProcess(tick):
+    __SendCrossServerSetPlayerAttr(tick)
+    return
+
+def __SendCrossServerSetPlayerAttr(tick):
+    if not PyGameData.g_crossSetPlayerAttr:
+        return
+    
+    if tick:
+        # 延迟10秒一次性同步,主要是比如OnDay的时候当多个玩家同时跨服时,减少同步次数,延迟统一发送
+        if tick - GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_CrossSetPlayerAttrTick) < 10 * 1000:
+            return
+        GameWorld.GetGameWorld().SetDict(ChConfig.Def_WorldKey_CrossSetPlayerAttrTick, tick)
+        
+    CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_SetPlayerAttrValue, PyGameData.g_crossSetPlayerAttr)
+    PyGameData.g_crossSetPlayerAttr = {}
+    return
+
+
 
     
\ No newline at end of file

--
Gitblit v1.8.0