From 8a0a844c31126b274f268fe5333c19aef50dd0f8 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 11 十二月 2024 14:55:42 +0800
Subject: [PATCH] 10297 【越南】【英语】【砍树】【tqxbqy】轮回殿-服务端(轮回殿活动时间表增加配置轮回类型对应的CTGID跟商店类型)
---
ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py | 125 +++++++----------------------------------
1 files changed, 23 insertions(+), 102 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py
index d25d85e..9a0007d 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py
@@ -21,7 +21,6 @@
import ReadChConfig
import ChConfig
import PlayerControl
-import PlayerViewCache
import PlayerCompensation
import ChPyNetSendPack
import PlayerDBGSEvent
@@ -91,6 +90,21 @@
zoneTypeName = ChConfig.Def_CrossZoneTypeName.get(mapID, "CrossZoneComm")
ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition(zoneTypeName, {"CrossZoneName":crossZoneName}, True)
return ipyDataList
+
+def GetServerCommCrossZoneID(serverGroupID):
+ ## 获取跨服常规分区
+ zoneTypeName = "CrossZoneComm"
+ crossZoneName = GameWorld.GetCrossZoneName()
+ ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition(zoneTypeName, {"CrossZoneName":crossZoneName}, True)
+ if not ipyDataList:
+ return 0
+ for ipyData in ipyDataList:
+ serverGroupIDList = ipyData.GetServerGroupIDList()
+ for serverGroupIDInfo in serverGroupIDList:
+ if (isinstance(serverGroupIDInfo, tuple) and serverGroupIDInfo[0] <= serverGroupID <= serverGroupIDInfo[1]) \
+ or (isinstance(serverGroupIDInfo, int) and serverGroupIDInfo == serverGroupID):
+ return ipyData.GetZoneID()
+ return 0
def GetServerCrossZoneMapIpyData(zoneID, mapID):
## 获取本服对应跨服玩法分区地图信息 - 仅适用于固定地图及虚拟分线的跨服玩法
@@ -270,104 +284,6 @@
PlayerControl.SetCrossMapID(curPlayer, 0)
return
-#// C0 02 查看跨服玩家信息 #tagCGViewCrossPlayerInfo
-#
-#struct tagCGViewCrossPlayerInfo
-#{
-# tagHead Head;
-# DWORD PlayerID; // 跨服玩家ID
-# BYTE EquipClassLV; //大于0为查看指定境界阶装备信息, 0为查看默认信息
-#};
-def OnViewCrossPlayerInfo(index, clientData, tick):
- if GameWorld.IsCrossServer():
- return
-
- curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
- playerID = curPlayer.GetPlayerID()
- tagPlayerID = clientData.PlayerID
- equipClassLV = clientData.EquipClassLV
- curCache = PlayerViewCache.FindViewCache(tagPlayerID)
- ## 本服有,直接回客户端
- if curCache:
- GameWorld.DebugLog("查看跨服玩家,是本服玩家,直接回复!tagPlayerID=%s" % (tagPlayerID), playerID)
- PlayerViewCache.Sync_PlayerCache(curPlayer, curCache, equipClassLV)
- return
-
- if tagPlayerID in PyGameData.g_crossPlayerViewCache:
- validChaheTime = 10 * 60 * 1000
- cacheInfo, updTick = PyGameData.g_crossPlayerViewCache[tagPlayerID]
- if tick - updTick <= validChaheTime:
- GameWorld.DebugLog("查看跨服玩家数据同步CD中,直接用缓存数据回复!tagPlayerID=%s" % (tagPlayerID), playerID)
- SyncPlayerViewCrossPlayerInfo(curPlayer, tagPlayerID, equipClassLV, cacheInfo)
- return
-
- for crossPlayerID, cacheInfoList in PyGameData.g_crossPlayerViewCache.items():
- if tick - cacheInfoList[1] > validChaheTime:
- PyGameData.g_crossPlayerViewCache.pop(crossPlayerID)
-
- # 发送跨服服务器查询
- dataMsg = {"tagPlayerID":tagPlayerID, "playerID":playerID, "equipClassLV":equipClassLV}
- CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_ViewPlayerCache, dataMsg)
- return
-
-def ClientServerMsg_ViewPlayerCache(serverGroupID, msgData):
- tagPlayerID = msgData["tagPlayerID"]
- playerID = msgData["playerID"]
- equipClassLV = msgData["equipClassLV"]
-
- GameWorld.Log("收到子服查看跨服玩家信息: serverGroupID=%s,playerID=%s,tagPlayerID=%s" % (serverGroupID, playerID, tagPlayerID))
-
- cacheInfo = {}
- curCache = PlayerViewCache.FindViewCache(tagPlayerID)
- if curCache:
- cacheInfo = {"PropData":curCache.PropData, "PlusData":curCache.PlusData}
- for classLV in xrange(1, 15 + 1):
- attrName = "ItemData%s" % classLV
- if hasattr(curCache, attrName):
- cacheInfo[attrName] = getattr(curCache, attrName)
-
- viewPlayerCacheRet = [playerID, tagPlayerID, equipClassLV, cacheInfo]
- CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_ViewPlayerCacheRet, viewPlayerCacheRet, [serverGroupID])
- return
-
-def CrossServerMsg_ViewPlayerCacheRet(msgData, tick):
-
- playerID, tagPlayerID, equipClassLV, cacheInfo = msgData
- GameWorld.Log("收到跨服服务器回复的查看玩家信息: playerID=%s,tagPlayerID=%s" % (playerID, tagPlayerID))
-
- PyGameData.g_crossPlayerViewCache[tagPlayerID] = [cacheInfo, tick] # 更新信息
-
- curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
- if curPlayer:
- SyncPlayerViewCrossPlayerInfo(curPlayer, tagPlayerID, equipClassLV, cacheInfo)
-
- return
-
-def SyncPlayerViewCrossPlayerInfo(curPlayer, tagPlayerID, equipClassLV, cacheInfo):
- if not cacheInfo:
- PlayerControl.NotifyCode(curPlayer, "ViewPlayer_OffLine")
- return
-
- if equipClassLV:
- itemData = cacheInfo.get("ItemData%s" % equipClassLV, "")
- sendPack = ChPyNetSendPack.tagSCPlayerEquipCacheResult()
- sendPack.PlayerID = tagPlayerID
- sendPack.EquipClassLV = equipClassLV
- sendPack.ItemData = itemData
- sendPack.ItemDataSize = len(sendPack.ItemData)
- NetPackCommon.SendFakePack(curPlayer, sendPack)
- return
-
- #回包客户端
- sendPack = ChPyNetSendPack.tagSCQueryPlayerCacheResult()
- sendPack.PlayerID = tagPlayerID
- sendPack.PropData = cacheInfo.get("PropData", "")
- sendPack.PropDataSize = len(sendPack.PropData)
- sendPack.PlusData = cacheInfo.get("PlusData", "")
- sendPack.PlusDataSize = len(sendPack.PlusData)
- NetPackCommon.SendFakePack(curPlayer, sendPack)
- return
-
def CrossServerMsg_PutInItem(itemInfo):
## 跨服获得物品
@@ -434,6 +350,7 @@
if not IsCrossServerOpen():
return
+ Sync_CrossZoneInfo(curPlayer)
LoginDoUnNotifyCrossMsg(curPlayer)
return
@@ -441,9 +358,10 @@
## 同步地图跨服玩家处理信息,玩家可能不在线,缓存后等玩家上线处理,暂不考虑存档问题,服务器维护后未处理的命令将失效
curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
- if curPlayer:
+ if curPlayer and curPlayer.GetInitOK():
msgInfo = str(msgInfo)
curPlayer.MapServer_QueryPlayerResult(0, 0, callName, msgInfo, len(msgInfo))
+ return curPlayer
else:
# 缓存起来,等上线后处理
if playerID not in PyGameData.g_unNotifyPlayerCrossMsgDict:
@@ -466,5 +384,8 @@
curPlayer.MapServer_QueryPlayerResult(0, 0, callName, msgInfo, len(msgInfo))
return
-
-
\ No newline at end of file
+def Sync_CrossZoneInfo(curPlayer):
+ clientPack = ChPyNetSendPack.tagGCCrossZoneInfo()
+ clientPack.CommZoneID = GetServerCommCrossZoneID(GameWorld.GetServerGroupID())
+ NetPackCommon.SendFakePack(curPlayer, clientPack)
+ return
--
Gitblit v1.8.0