From a15e3af5eb36a3c4eb6016e824faca23d6d6a9dc Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期一, 14 一月 2019 11:06:06 +0800
Subject: [PATCH] 5768 【后端】【1.5】新增8-14天活动功能(通知修改)
---
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py | 94 +++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 83 insertions(+), 11 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py
index deb04fc..72d7a71 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py
@@ -52,7 +52,6 @@
import PlayerFamilyBoss
import PlayerManorWar
import GameWorldBoss
-import MergeBroadcast
import GameWorldFamilyWar
#import PlayerFamilyTech
import PlayerFamilyRedPacket
@@ -73,6 +72,8 @@
import CrossRealmPlayer
import CrossRealmMsg
import CrossRealmPK
+import ChPyNetSendPack
+import NetPackCommon
import time
import datetime
@@ -259,7 +260,7 @@
return
# 查询地图NPC数量
elif queryType == ChConfig.queryType_NPCCnt:
- __QueryMapNPCCntInfo(curPlayer, queryCallName, sendCMD)
+ __QueryMapNPCCntInfo(curPlayer, queryCallName, sendCMD, tick)
return
else:
GameWorld.ErrLog('unKnow queryType = %s' % (queryType))
@@ -300,7 +301,7 @@
# @param queryCallName: 请求回调名
# @param sendCMD: 请求的命令 根据请求类型和请求命令来决定最终操作
# @return None
-def __QueryMapNPCCntInfo(curPlayer, queryCallName, sendCMD):
+def __QueryMapNPCCntInfo(curPlayer, queryCallName, sendCMD, tick):
playerManager = GameWorld.GetPlayerManager()
try:
mapInfo = eval(sendCMD)
@@ -312,9 +313,78 @@
return
tagMapID = mapInfo[0]
+ npcIDList = mapInfo[2]
+ # 本服查询跨服地图怪物数
+ if tagMapID in ChConfig.Def_CrossMapIDList and not GameWorld.IsCrossServer():
+ __QueryCrossServerMapNPCCntInfo(curPlayer, tagMapID, npcIDList, tick)
+ return
playerManager.MapServer_QueryPlayer(curPlayer.GetPlayerID(), ChConfig.queryType_NPCCnt, 0, tagMapID,
queryCallName, sendCMD, len(sendCMD), curPlayer.GetRouteServerIndex())
return
+
+def __QueryCrossServerMapNPCCntInfo(curPlayer, mapID, npcIDList, tick):
+ ## 查询跨服地图NPC个数信息
+ if mapID in PyGameData.g_crossMapNPCInfo:
+ infoTick, mapNPCInfoDict = PyGameData.g_crossMapNPCInfo[mapID]
+ if tick - infoTick < 60 * 1000:
+ #GameWorld.DebugLog("直接同步本服缓存的跨服地图NPC信息")
+ SyncPlayerCrossMapNPCInfo(curPlayer, mapID, npcIDList, mapNPCInfoDict)
+ return
+
+ # 本服缓存超时,发送跨服服务器查询
+ playerID = curPlayer.GetPlayerID()
+ CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_QueryNPCInfo, {"PlayerID":playerID, "MapID":mapID, "NPCIDList":npcIDList})
+ return
+
+def ClientServerMsg_QueryNPCInfo(serverGroupID, msgData):
+ ## 收到子服请求查看跨服地图NPC个数信息
+
+ mapID = msgData["MapID"]
+ zoneIpyData = CrossRealmPlayer.GetServerCrossZoneIpyData(mapID, serverGroupID)
+ if not zoneIpyData:
+ return
+ realMapID = zoneIpyData.GetMapID()
+ copyMapID = zoneIpyData.GetCopyMapID()
+
+ sendCMD = {"ServerGroupID":serverGroupID, "CopyMapID":copyMapID}
+ sendCMD.update(msgData)
+ sendCMD = str(sendCMD)
+ GameWorld.GetPlayerManager().MapServer_QueryPlayer(0, 0, 0, realMapID, "NPCCntCross", sendCMD, len(sendCMD))
+ return
+
+def CrossServerMsg_NPCInfoRet(msgData, tick):
+ ## 收到跨服服务器同步的地图NPC信息
+
+ mapID = msgData["MapID"]
+ playerID = msgData["PlayerID"]
+ npcIDList = msgData["NPCIDList"]
+ mapNPCInfoDict = msgData["Result"]
+ PyGameData.g_crossMapNPCInfo[mapID] = [tick, mapNPCInfoDict]
+ curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
+ if curPlayer:
+ SyncPlayerCrossMapNPCInfo(curPlayer, mapID, npcIDList, mapNPCInfoDict)
+
+ return
+
+def SyncPlayerCrossMapNPCInfo(curPlayer, mapID, npcIDList, mapNPCInfoDict):
+ ## 同步给玩家跨服地图NPC信息
+
+ npcInfoPack = ChPyNetSendPack.tagMCNPCCntList()
+ npcInfoPack.Clear()
+ npcInfoPack.MapID = mapID
+ npcInfoPack.NPCInfoList = []
+
+ for npcID in npcIDList:
+ npcInfo = ChPyNetSendPack.tagMCNPCCntInfo()
+ npcInfo.Clear()
+ npcInfo.NPCID = npcID
+ npcInfo.Cnt = mapNPCInfoDict.get(npcID, 0)
+ npcInfoPack.NPCInfoList.append(npcInfo)
+
+ npcInfoPack.NPCInfoCnt = len(npcInfoPack.NPCInfoList)
+ NetPackCommon.SendFakePack(curPlayer, npcInfoPack)
+ return
+
## 获得家族属性(等级,人数)获得自己所在家族的属性
# @param curPlayer 请求的玩家
@@ -528,20 +598,14 @@
GameDataRecord.ChangeCoinCnt(eval(resultName))
return
- #跨服广播子服
- if callName == 'SendBroadcastMergeClient':
- operType, mapID, dataDict, isRepeat = eval(resultName)
- MergeBroadcast.SendBroadcastMerge(operType, mapID, dataDict, isRepeat)
- return
-
#跨服匹配PK战斗结算
if callName == "CrossPKOver":
- CrossRealmPK.MapServer_CrossPKOver(eval(resultName))
+ CrossRealmPK.MapServer_CrossPKOver(eval(resultName), tick)
return
#跨服匹配房间开启
if callName == "CrossPKRoomOpen":
- CrossRealmPK.MapServer_CrossPKRoomOpen(eval(resultName))
+ CrossRealmPK.MapServer_CrossPKRoomOpen(eval(resultName), tick)
return
#跨服匹配PK取消匹配
@@ -573,6 +637,14 @@
PlayerTalk.ChatPYSpeaker(curPlayer, eval(resultName))
return
+ #刷新本服角色信息
+ if callName == 'RefreshMainServerRole':
+ curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(srcPlayerID)
+ if not curPlayer:
+ return
+ ChPlayer.DoRefreshMainServerRole(curPlayer)
+ return
+
# 战盟联赛
if callName =="FamilyWarOver":
GameWorldFamilyWar.MapServer_FamilyWarOver(eval(resultName))
--
Gitblit v1.8.0