From d661f7bb084dacb9b6cb048cbb586881bdfcea6f Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期三, 26 九月 2018 20:20:53 +0800
Subject: [PATCH] 1889 神兽副本npc刷新时间通知修改

---
 ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py                                                   |    4 +++-
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py                                           |    3 ++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py                         |    2 --
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py                                 |   18 ++++++++++--------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Dogz.py |   11 ++++++-----
 5 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py
index ac1538e..db89328 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py
@@ -467,6 +467,7 @@
     state = gameWorld.GetDictByKey(ChConfig.Def_WorldKey_OperationActionState % ShareDefine.OperationActionName_BossReborn)
     if state:
         Sync_BossRebornPoint(curPlayer)
+    Sync_DogzNPCRefreshTime(curPlayer)
     return
 
 ## 地图启动ok通知
@@ -1035,23 +1036,24 @@
         NetPackCommon.SendFakePack(curPlayer, packData)
     return
 
-def Sync_DogzNPCRefreshTime(msgList):
+def Sync_DogzNPCRefreshTime(curPlayer=None):
     #同步神兽副本NPC刷新时间
-    playerID, refreshTimeDict = msgList
-    curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID) if playerID else None
-    if playerID and not curPlayer:
-        return
+    refreshTimeDict = PyGameData.g_dogzNPCRefreshTimeDict
+
     if not refreshTimeDict:
         return
+    curTime = int(time.time())
     packData = ChPyNetSendPack.tagGCDogzNPCRefreshTime()
     packData.InfoList=[]
-    for npcid, rTime in refreshTimeDict.items():
+    for npcid, timeinfo in refreshTimeDict.items():
+        lastRefreshTime, nextNeedTime = timeinfo
+        remainTime = max(0, nextNeedTime - curTime + lastRefreshTime)
         timeInfo = ChPyNetSendPack.tagDogzTimeInfoObj()
         timeInfo.NPCID = npcid
-        timeInfo.RefreshSecond = rTime
+        timeInfo.RefreshSecond = remainTime
         packData.InfoList.append(timeInfo)
     packData.Cnt = len(packData.InfoList)
-    if not playerID:
+    if not curPlayer:
         playerManager = GameWorld.GetPlayerManager()
         for i in xrange(playerManager.GetActivePlayerCount()):
             curPlayer = playerManager.GetActivePlayerAt(i)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py
index 2ed843e..67c60a0 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py
@@ -767,7 +767,8 @@
         return
     #通知神兽副本NPC刷新时间
     if callName =="DogzNPCTime":
-        GameWorldBoss.Sync_DogzNPCRefreshTime(eval(resultName))
+        PyGameData.g_dogzNPCRefreshTimeDict = eval(resultName)
+        GameWorldBoss.Sync_DogzNPCRefreshTime()
         return
 #---return分割线-----------------------------------------------------------------
 
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py b/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py
index e1700d6..07ce69e 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py
@@ -74,4 +74,6 @@
 g_questionIDHistory = {}#出过的题记录 {familyid:[出过的题id,..]}
 g_familyAnswerDict = {} #仙盟答题数量 {familyid:[答题数量,tick],..}
 g_familyPartyTopInfo = [] #仙盟宴会答题王 [playerID,名字]
-g_partyheroAnswerDict = {} #仙盟宴会玩家答题数量 {playerid:答题数量,..}
\ No newline at end of file
+g_partyheroAnswerDict = {} #仙盟宴会玩家答题数量 {playerid:答题数量,..}
+
+g_dogzNPCRefreshTimeDict = {} # 神兽副本NPC刷新时间{npcid:剩余刷新时间}
\ No newline at end of file
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Dogz.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Dogz.py
index 683e603..3fd128b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Dogz.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Dogz.py
@@ -248,14 +248,15 @@
     nextNeedTime = gameWorldMgr.GetGameWorldDictByKey(Map_Dogzfb_NextNeedTime % npcID)
     return max(0, nextNeedTime - curTime + lastRefreshTime)
 
-def SyncNPCRefreshTime(playerid=0):
-    curTime = int(time.time())
+def SyncNPCRefreshTime():
     syncNPCIDList = IpyGameDataPY.GetFuncEvalCfg('DogzFBRefreshCfg', 3)
     syncDict = {}
     for npcID in syncNPCIDList:
-        refreshTime = GetDogzNPCRefreshTime(curTime, npcID)
-        syncDict[npcID] = refreshTime
-    msgStr = str([playerid, syncDict])
+        gameWorldMgr = GameWorld.GetGameWorld()
+        lastRefreshTime = gameWorldMgr.GetGameWorldDictByKey(Map_Dogzfb_LastRefreshTime % npcID)
+        nextNeedTime = gameWorldMgr.GetGameWorldDictByKey(Map_Dogzfb_NextNeedTime % npcID)
+        syncDict[npcID] = [lastRefreshTime, nextNeedTime]
+    msgStr = str(syncDict)
     GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'DogzNPCTime', msgStr, len(msgStr))
     return
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
index 1672af7..fc71c73 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -541,8 +541,6 @@
     GameFuncComm.DoFuncOpenLogic(curPlayer)
     # 神兽
     PlayerDogz.OnPlayerLogin(curPlayer)
-    # 神兽副本
-    GameLogic_Dogz.SyncNPCRefreshTime(curPlayer.GetID())
     # 骑宠
     FamilyRobBoss.OnPlayerLogin(curPlayer)
     

--
Gitblit v1.8.0