From f5a2d72d60cf43cf28a44868d62deeda8d10482f Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 28 六月 2019 20:48:13 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/SnxxServerCode

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py |  115 +++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 87 insertions(+), 28 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
index 3d1fdd5..e76cf2a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
@@ -30,6 +30,7 @@
 import EventReport
 import PlayerFamily
 import PlayerActivity
+import ItemControler
 import PlayerSuccess
 import GameFuncComm
 import PyGameData
@@ -95,6 +96,8 @@
 Over_leaderID = 'leaderID' #渡劫玩家ID
 Over_xianyuanCoin = 'xianyuanCoin' #获得仙缘币信息 [获得仙缘币数, 没有获得的原因] 原因: 1-达到助战次数上限,2-达到每日获得仙缘币上限
 Over_helpPlayer = 'helpPlayer' #助战玩家信息 {"玩家ID":{玩家信息key:value, ...}, ...}
+Over_ownerID = 'ownerID' #归属玩家ID
+Over_ownerName = 'ownerName' #归属玩家名
 
 #副本行为
 (
@@ -162,6 +165,10 @@
 def CheckCanEnterFBComm(curPlayer, mapID, lineID, fbIpyData, fbLineIpyData, reqEnterCnt=1, isNotify=True, isTeamAsk=False):
     # 可否进入副本通用检查, 扫荡通用
     playerID = curPlayer.GetPlayerID()
+    
+    if not FBLogic.OnNeedCheckCanEnterFBComm(curPlayer, mapID, lineID):
+        return ShareDefine.EntFBAskRet_OK
+    
     # 总表通用检查
     if fbIpyData:
         #开服天开放检查
@@ -201,15 +208,6 @@
             if isNotify:
                 PlayerControl.NotifyCode(curPlayer, "FbLV", [mapID])
             return ShareDefine.EntFBAskRet_LVLimit
-        
-        #职业阶判断
-        jobRankLimit = fbLineIpyData.GetJobRankLimit()
-        if jobRankLimit and PlayerControl.GetJobRank(curPlayer) < jobRankLimit:
-            GameWorld.Log("玩家职业阶级不足, 无法进入副本!mapID=%s,lineID=%s,jobRank=%s < jobRankLimit=%s" 
-                          % (mapID, lineID, PlayerControl.GetJobRank(curPlayer), jobRankLimit), playerID)
-            if isNotify:
-                PlayerControl.NotifyCode(curPlayer, "SingleEnterJob", [mapID])
-            return ShareDefine.EntFBAskRet_JobRankLimit
         
         #门票判断
         if not GetFBEnterTicket(curPlayer, mapID, lineID, fbLineIpyData, reqEnterCnt, isTeamAsk)[0]:
@@ -448,18 +446,18 @@
 #  @return
 def SetFBPropertyMark(propertyMark, setPlayer=None):
     GameWorld.GetGameFB().SetGameFBDict(ChConfig.Map_FBDict_PropertyMark, propertyMark + 1) # 存储时+1才能判断是否存储过
-    if setPlayer != None:
-        PlayerControl.SetFBFuncLineID(setPlayer, propertyMark)
-        GameWorld.DebugLog("SetFBPropertyMark 设置玩家副本功能线路ID: %s" % propertyMark, setPlayer.GetPlayerID())
-        return
-    
-    playerManager = GameWorld.GetMapCopyPlayerManager()
-    for index in xrange(playerManager.GetPlayerCount()):
-        curPlayer = playerManager.GetPlayerByIndex(index)
-        if not curPlayer.GetPlayerID():
-            continue
-        PlayerControl.SetFBFuncLineID(curPlayer, propertyMark)
-        GameWorld.DebugLog("SetFBPropertyMark 广播玩家副本功能线路ID: %s" % propertyMark, curPlayer.GetPlayerID())
+#    if setPlayer != None:
+#        PlayerControl.SetFBFuncLineID(setPlayer, propertyMark)
+#        GameWorld.DebugLog("SetFBPropertyMark 设置玩家副本功能线路ID: %s" % propertyMark, setPlayer.GetPlayerID())
+#        return
+#    
+#    playerManager = GameWorld.GetMapCopyPlayerManager()
+#    for index in xrange(playerManager.GetPlayerCount()):
+#        curPlayer = playerManager.GetPlayerByIndex(index)
+#        if not curPlayer.GetPlayerID():
+#            continue
+#        PlayerControl.SetFBFuncLineID(curPlayer, propertyMark)
+#        GameWorld.DebugLog("SetFBPropertyMark 广播玩家副本功能线路ID: %s" % propertyMark, curPlayer.GetPlayerID())
     return
 
 ## 是否已经扣除入场券/进入次数等
@@ -473,6 +471,15 @@
 #  @return
 def SetHadDelTicket(curPlayer, delSign=1):
     GameWorld.GetGameFB().SetPlayerGameFBDict(curPlayer.GetID(), ChConfig.FBPlayerDict_IsDelTicket, delSign)
+    return
+
+## 自定义场景阶段
+def GetCustomMapStep(curPlayer, mapID, lineID):
+    return curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_CustomMapStep % (mapID, lineID))
+def SetCustomMapStep(curPlayer, mapID, lineID, step):
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_CustomMapStep % (mapID, lineID), step)
+    if step == ChConfig.CustomMapStep_Over:
+        PlayerControl.SetCustomMap(curPlayer, 0, 0)
     return
 
 def GetCurSingleFBPlayer():
@@ -601,7 +608,7 @@
                 continue
             itemDict['ItemID'] = itemInfo.GetItemTypeID()
             itemDict['Count'] = itemInfo.GetCount()
-            itemDict['IsAuctionItem'] = 0 if itemInfo.GetIsBind() else 1
+            itemDict['IsAuctionItem'] = ItemControler.GetIsAuctionItem(itemInfo)
             #itemDict['IsSuite'] = int(itemInfo.GetIsSuite())
             itemDict['UserData'] = itemInfo.GetUserData()
         jsonItemList.append(itemDict)
@@ -1020,6 +1027,35 @@
     #可以进入
     return True
 #---------------------------------------------------------------------
+def Sync_FBNPC(mapID=0, npcIDList=[], curPlayer=None):
+    ## 同步当前副本NPC给副本中的所有玩家
+    if not mapID:
+        mapID = GameWorld.GetMap().GetMapID()
+        mapID = GetRecordMapID(mapID)
+    npcCntDict = {}
+    gameNPCManager = GameWorld.GetNPCManager()
+    for index in xrange(gameNPCManager.GetNPCCount()):
+        curNPC = gameNPCManager.GetNPCByIndex(index)
+        npcID = curNPC.GetNPCID()
+        if not npcID:
+            continue
+        if curNPC.GetGameNPCObjType() == IPY_GameWorld.gnotPet:
+            continue
+        if npcIDList and npcID not in npcIDList:
+            continue
+        npcCntDict[npcID] = npcCntDict.get(npcID, 0) + 1
+        
+    if curPlayer:
+        NPCCommon.SyncNPCCntInfo(curPlayer, mapID, npcCntDict)
+    else:
+        playerManager = GameWorld.GetMapCopyPlayerManager()
+        for i in xrange(playerManager.GetPlayerCount()):
+            curPlayer = playerManager.GetPlayerByIndex(i)
+            if curPlayer.GetID() == 0:
+                continue
+            NPCCommon.SyncNPCCntInfo(curPlayer, mapID, npcCntDict)
+    return npcCntDict
+
 ##获得地图上的NPC列表
 # @param 无参数
 # @return 返回值, NPC实例列表[curNPC,curNPC,,,,,]
@@ -1538,24 +1574,39 @@
     maxCnt = GetEnterFBMaxCnt(curPlayer, mapID)
     maxCanAdd = max(0, maxDayTimes - (maxCnt-enterCnt))
     #GameWorld.DebugLog('封魔坛最大可恢复次数 %s'%maxCanAdd)
-    if not maxCanAdd:
-        return
+
     curTime = int(time.time())
-    recoverInterval = IpyGameDataPY.GetFuncCfg('FBCntRegainInterval')
     lastRegainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID)
+    if not lastRegainTime:
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, curTime)
+        return
+    recoverInterval = IpyGameDataPY.GetFuncCfg('FBCntRegainInterval')
     needTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainTotalTime % mapID)
     if not needTime:
         needTime = recoverInterval
     passTime = curTime - lastRegainTime
     if passTime < needTime:
         return
-    recoverCnt = min(maxCanAdd, 1 + (passTime-needTime) / recoverInterval) # 恢复次数
+    recoverCnt = 1 + (passTime-needTime) / recoverInterval # 恢复次数
+    if recoverCnt > maxCanAdd:
+        #记录超出的次数,用于资源找回
+        beyondTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainOverTime % mapID)
+        updBeyondTimes = recoverCnt - maxCanAdd + beyondTimes
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainOverTime % mapID, updBeyondTimes)
+        if not maxCanAdd:
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, curTime)
+        GameWorld.DebugLog('    封魔坛恢复次数 记录超出的次数addOverCnt=%s, updBeyondTimes=%s'%(recoverCnt-maxCanAdd, updBeyondTimes))
+    
+    if not maxCanAdd:
+        return
+    recoverCnt = min(maxCanAdd, recoverCnt)
+    
     enterCntKey = ChConfig.Def_Player_Dict_EnterFbCntDay % mapID
     newEnterCnt = max(0, enterCnt-recoverCnt)
     PlayerControl.NomalDictSetProperty(curPlayer, enterCntKey, newEnterCnt)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainTotalTime % mapID, 0)
     if recoverCnt == maxCanAdd:
-        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, 0)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, curTime)
     else:
         startTime = curTime- (passTime-needTime)%recoverInterval
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, startTime)
@@ -1693,6 +1744,7 @@
         if mapID in [ChConfig.Def_FBMapID_SealDemon]:
             newEnterCnt = max(0, dayTimes - (maxCnt - enterCnt))
             PlayerControl.NomalDictSetProperty(curPlayer, enterCntKey, newEnterCnt)
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainOverTime % mapID, 0)
             GameWorld.DebugLog("        特殊副本已进入次数更新: newEnterCnt=%s" % newEnterCnt)
         elif mapID == ChConfig.Def_FBMapID_ZhuXianBoss:
             if GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_ZhuXianBoss):
@@ -2000,7 +2052,7 @@
 def AddFbEncourageBuff(curPlayer, key, tick, ownerID=0):
     curPlayerID = curPlayer.GetID()
     GameWorld.Log("AddFbEncourageBuff() curPlayerID=%s" % curPlayerID)
-  
+    ownerID = ownerID or curPlayer.GetID()
     gameFB = GameWorld.GetGameFB()
     encourageLV = gameFB.GetPlayerGameFBDictByKey(ownerID, key)
     if not encourageLV:
@@ -2408,4 +2460,11 @@
         fbHelpFunc(curPlayer, tick)
     return
 
+def GetCrossDynamicLineMapZoneID():
+    ## 获取跨服动态线路地图本线路跨服分区
+    return GameWorld.GetGameWorld().GetPropertyID() / 10000
+
+def GetCrossDynamicLineMapFuncLineID():
+    ## 获取跨服动态线路地图本线路功能线路ID
+    return GameWorld.GetGameWorld().GetPropertyID() % 10000 / 10
 

--
Gitblit v1.8.0