From efb7e570e8aee945dedc80e2be76becca1ea7ba5 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期五, 21 六月 2019 16:43:36 +0800
Subject: [PATCH] 6374 封魔坛、雷罚进入限制

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py |   63 ++++++++++++++++---------------
 1 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py
index a181345..c9634b4 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py
@@ -114,7 +114,7 @@
     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
     
     otherCntRateList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 2)
-    maxEventCnt = max([info[1] for info in otherCntRateList]) + 1  #最大可出现事件个数
+    maxEventCnt = GetMaxEventCnt()  #最大可出现事件个数
     fairyDomainState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainState)  #是否寻访中  0未寻访 1寻访中 2任务标记可寻访
     if clientData.Type == 1:  #结束寻访
         if fairyDomainState != 1:
@@ -135,9 +135,9 @@
     if fairyDomainState == 1:
         GameWorld.DebugLog("    正在寻访仙域中!请先退出寻访")
         return
-    
-    if fairyDomainState != 2 and not PlayerActivity.AddDailyActionFinishCnt(curPlayer, dailyID):
-        GameWorld.DebugLog("    寻访仙域次数不足!")
+    costPoint = IpyGameDataPY.GetFuncCfg('ImmortalDomainActivePoint', 2)
+    if not PlayerActivity.CostActivityPoint(curPlayer, costPoint, True):
+        GameWorld.DebugLog("    寻访仙域需要活跃点不足!costPoint=%s"%costPoint)
         return
 
     #随机事件 重置事件状态
@@ -150,18 +150,18 @@
     else:
         fdEventTypeDict = {}
         #先随机独立事件
-        singleEventRateDict = IpyGameDataPY.GetFuncCfg('ImmortalDomain')
+        singleEventRateDict = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 1, {})
         for eventType, rate in singleEventRateDict.items():
             if GameWorld.CanHappen(rate):
                 fdEventTypeDict[eventType] = 1
-        
+
         otherCnt = GameWorld.GetResultByRandomList(otherCntRateList, 0)
         if otherCnt:
             otherEventRateList = copy.deepcopy(IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 3))
             unRepeatTypeList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 4)
             for _ in xrange(otherCnt):
-                otherEventType = GameWorld.GetResultByRandomList(otherEventRateList, 0)
-                if not otherEventType:
+                otherEventType = GameWorld.GetResultByRandomList(otherEventRateList)
+                if otherEventType is None:
                     continue
                 if otherEventType in unRepeatTypeList:
                     for index, info in enumerate(otherEventRateList):
@@ -185,6 +185,12 @@
         #更新全服出现次数
         msgStr = str(fdEventIDList)
         GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'AddFairyDomainEvent', msgStr, len(msgStr))
+    if not fdEventIDList:
+        fdEventIDList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 5)
+        GameWorld.Log('寻访仙域, 没有随机出事件,使用默认事件!! playerLV=%s,visitCnt=%s,默认fdEventIDList=%s'%(curPlayer.GetLV(), visitCnt, fdEventIDList), curPlayer.GetID())
+        if not fdEventIDList:
+            return
+    PlayerActivity.CostActivityPoint(curPlayer, costPoint)
     #奇遇事件 随机档位数据
     openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
     for fdEventID in fdEventIDList:
@@ -196,16 +202,12 @@
             continue
         conditionList = ipyData.GetCondition()
         if not conditionList:
-            fdEventIDList.remove(fdEventID)
-            continue
-        condition = random.choice(conditionList)
-        index = conditionList.index(condition)
+            index = 0
+        else:
+            condition = random.choice(conditionList)
+            index = conditionList.index(condition)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyAdventuresData % fdEventID, ipyData.GetID() * 100 + index)
-    
-    if not fdEventIDList:
-        GameWorld.Log('寻访仙域, 没有随机出事件!!')
-        return
-    
+
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainVisitCnt, min(visitCnt + 1, ChConfig.Def_UpperLimit_DWord))
     #设置事件
     for i in xrange(maxEventCnt):
@@ -231,8 +233,7 @@
     GameWorld.DebugLog("EndFairyDomain", curPlayer.GetID())
     ##结束寻访
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainState, 0)
-    otherCntRateList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 2)
-    maxEventCnt = max([info[1] for info in otherCntRateList]) + 1  #最大可出现事件个数
+    maxEventCnt = GetMaxEventCnt()  #最大可出现事件个数
     for i in xrange(maxEventCnt):
         fdEventID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventID % i)
         if fdEventID:
@@ -347,8 +348,7 @@
 def NotifyVisitFairyDomainInfo(curPlayer, fdEventList=None, isAll=1):
     if not fdEventList:
         syncFDEventList = []
-        otherCntRateList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 2)
-        maxEventCnt = max([info[1] for info in otherCntRateList]) + 1  #最大可出现事件个数
+        maxEventCnt = GetMaxEventCnt()  #最大可出现事件个数
         for i in xrange(maxEventCnt):
             fdEventID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventID % i)
             if fdEventID:
@@ -371,6 +371,11 @@
     NetPackCommon.SendFakePack(curPlayer, packData)
     return
 
+def GetMaxEventCnt():
+    # 最大可出现事件个数
+    otherCntRateList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 2)
+    maxEventCnt = max([info[1] for info in otherCntRateList]) + len(IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain'))
+    return maxEventCnt
 
 ###=========================奇遇===============================
 def NotifyFairyAdventuresInfo(curPlayer):
@@ -379,8 +384,7 @@
 
     packData = ChPyNetSendPack.tagMCFairyAdventuresInfo()
     packData.InfoList = []
-    otherCntRateList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 2)
-    maxEventCnt = max([info[1] for info in otherCntRateList]) + 1  #最大可出现事件个数
+    maxEventCnt = GetMaxEventCnt()  #最大可出现事件个数
     for i in xrange(maxEventCnt):
         fdEventID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventID % i)
         if fdEventID not in AdventuresTypeList:
@@ -444,15 +448,14 @@
                 gearAwardList = ipyData.GetGearAward()
                 if not gearAwardList:
                     return
-                itemRateList = gearAwardList[index] if index < len(gearAwardList) else gearAwardList[-1]
-                itemRateList = ItemCommon.GetWeightItemListByAlchemyDiffLV(curPlayer, itemRateList, 1)
-                giveItemList = [GameWorld.GetResultByWeightList(itemRateList)]
+                giveItemList = []
+                itemRandomList = gearAwardList[index] if index < len(gearAwardList) else gearAwardList[-1]
+                for itemRateList in itemRandomList:
+                    itemRateList = ItemCommon.GetWeightItemListByAlchemyDiffLV(curPlayer, itemRateList, 0)
+                    giveItemList.append(GameWorld.GetResultByWeightList(itemRateList))
             else:
                 giveItemList = [ipyData.GetBasicAward()]
-                
-        ItemControler.GivePlayerItemOrMail(curPlayer, giveItemList)
-        for itemInfo in giveItemList:
-            NPCCommon.SendVirtualItemDrop(curPlayer, itemInfo[0], 0, 0, '')
+        NPCCommon.DoGiveItemByVirtualDrop(curPlayer, giveItemList, 0)
         msgDict = {FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(giveItemList)}
         FBCommon.Notify_FB_Over(curPlayer, msgDict)
         GameWorld.DebugLog('缥缈奇遇领奖 msgDict=%s, fdeventID=%s' % (msgDict, fdeventID))

--
Gitblit v1.8.0