From 545986a8fdde345b28cf3004be84c6cfe79a3dc1 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 19 四月 2019 11:29:12 +0800
Subject: [PATCH] 6459 【后端】【2.0】缥缈仙域开发单(跨服分区逻辑优化,支持跨服妖王分区状态同步)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py |   59 +++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 39 insertions(+), 20 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 dcfd19e..67302b1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py
@@ -21,6 +21,7 @@
 import NetPackCommon
 import ShareDefine
 import GameWorld
+import GameLogic_CrossGrassland
 import PlayerControl
 import IpyGameDataPY
 import PlayerActivity
@@ -35,9 +36,9 @@
 (
 FDEventType0,
 FDEventType1,
-FDEventType2,
+FDEventType_GrasslandXian,
 FDEventType3,
-FDEventType4,
+FDEventType_GrasslandLing,
 ) = range(5)
 
 (
@@ -46,6 +47,14 @@
 FDEventState_Visiting,  #拜访中2
 FDEventState_Visited,  #已拜访3
 ) = range(4)
+
+#1-等级奇遇 2-境界奇遇 3-战力奇遇 4-气运奇遇
+AdventuresTypeList = (
+AdventuresType1,
+AdventuresType2,
+AdventuresType3,
+AdventuresType4,
+) = range(1, 5)
 
 
 def OnLogin(curPlayer):
@@ -66,7 +75,7 @@
     
     otherCntRateList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 2)
     maxEventCnt = max([info[1] for info in otherCntRateList]) + 1  #最大可出现事件个数
-    fairyDomainState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainState) #是否寻访中  0未寻访 1寻访中 2任务标记可寻访
+    fairyDomainState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainState)  #是否寻访中  0未寻访 1寻访中 2任务标记可寻访
     if clientData.Type == 1:  #结束寻访
         if fairyDomainState != 1:
             GameWorld.DebugLog("    未开始寻访仙域, 无法结束")
@@ -100,7 +109,7 @@
     
     #随机事件 重置事件状态
     visitCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainVisitCnt)
-    appointIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog('FairyDomainAppoint', visitCnt+1)
+    appointIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog('FairyDomainAppoint', visitCnt + 1)
     if appointIpyDataList:
         fdEventIDList = []
         for appointIpyData in appointIpyDataList:
@@ -137,6 +146,8 @@
     #奇遇事件 随机档位数据
     openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
     for fdEventID in fdEventIDList:
+        if fdEventID not in AdventuresTypeList:
+            continue
         ipyData = IpyGameDataPY.InterpolationSearch('FairyAdventures', 'OpenServerDay', openServerDay, {'EventID':fdEventID})
         if not ipyData:
             #GameWorld.ErrLog('寻访仙域, 奇遇事件没有随机出对应档位 randomList=%s,openServerDay=%s' % (randomList, openServerDay))
@@ -148,7 +159,6 @@
         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('寻访仙域, 没有随机出事件!!')
@@ -159,7 +169,8 @@
     for i in xrange(maxEventCnt):
         fdEventID = fdEventIDList[i] if i < len(fdEventIDList) else 0
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventID % i, fdEventID)
-        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventState % fdEventID, FDEventState_CanVisit)
+        if fdEventID:
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventState % fdEventID, FDEventState_CanVisit)
     #设置寻访中
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainState, 1)
     #设置初始体力
@@ -187,7 +198,7 @@
             #丹炉等级不足
             continue
         lvLimit = ipyData.GetNeedLV()
-        if lvLimit and not (lvLimit[0]<=curLV<=lvLimit[1]):
+        if lvLimit and not (lvLimit[0] <= curLV <= lvLimit[1]):
             #等级范围不满足
             continue
         
@@ -226,34 +237,40 @@
             GameWorld.Log('缥缈仙域事件状态设置,体力不足!,fdeventID=%s, costEnergy=%s, curEnergy=%s' % (fdeventID, costEnergy, curEnergy))
             return
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEnergy, curEnergy - costEnergy)
+        
+        # 草园重置
+        if ipyData.GetEventType() in [FDEventType_GrasslandXian, FDEventType_GrasslandLing]:
+            GameLogic_CrossGrassland.DoResetCrossGrassland(curPlayer, ipyData.GetEventType(), fdeventID)
+            
     elif state == FDEventState_Visited:
         if curState != FDEventState_Visiting:
             GameWorld.Log('缥缈仙域事件状态设置错误,fdeventID=%s, state=%s, curState=%s' % (fdeventID, state, curState))
             return
         EventShell.EventRespons_FairyDomain(curPlayer)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventState % fdeventID, state)
-    NotifyVisitFairyDomainInfo(curPlayer, [fdeventID])
+    NotifyVisitFairyDomainInfo(curPlayer, [fdeventID], 0)
     return True
 
 
-def NotifyVisitFairyDomainInfo(curPlayer, fdEventList=[]):
-    isAll = 0
+def NotifyVisitFairyDomainInfo(curPlayer, fdEventList=[], isAll=1):
     if not fdEventList:
-        isAll = 1
+        syncFDEventList = []
         otherCntRateList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 2)
         maxEventCnt = max([info[1] for info in otherCntRateList]) + 1  #最大可出现事件个数
         for i in xrange(maxEventCnt):
             fdEventID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventID % i)
             if fdEventID:
-                fdEventList.append(fdEventID)
-            
+                syncFDEventList.append(fdEventID)
+    else:
+        syncFDEventList = fdEventList
+
     packData = ChPyNetSendPack.tagMCFairyDomainInfo()
     packData.IsAll = isAll
     packData.State = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainState)
     packData.Energy = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEnergy)
     packData.VisitCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainVisitCnt)
     packData.InfoList = []
-    for fdeventID in fdEventList:
+    for fdeventID in syncFDEventList:
         fdeventData = ChPyNetSendPack.tagMCFairyDomainEvent()
         fdeventData.EventID = fdeventID
         fdeventData.EventState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventState % fdeventID)
@@ -274,6 +291,8 @@
     maxEventCnt = max([info[1] for info in otherCntRateList]) + 1  #最大可出现事件个数
     for i in xrange(maxEventCnt):
         fdEventID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventID % i)
+        if fdEventID not in AdventuresTypeList:
+            continue
         adventuresdata = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyAdventuresData % fdEventID)
         if not adventuresdata:
             continue
@@ -283,7 +302,7 @@
         conditionList = ipyData.GetCondition()
         index = adventuresdata % 100
         if IpyGameDataPY.GetIpyGameDataByCondition('FairyDomainAppoint', {'Cnt':visitCnt, 'EventID':fdEventID}, False, False):
-            condition = 0 #定制的条件为0
+            condition = 0  #定制的条件为0
         else:
             condition = conditionList[index] if index < len(conditionList) else 0
         adventuresdata = ChPyNetSendPack.tagMCFairyAdventuresData()
@@ -319,13 +338,13 @@
         giveItemList = GetFairyAppointAward(curPlayer, fdeventID)
         if not giveItemList:
             #1-等级奇遇 2-境界奇遇 3-战力奇遇 4-气运奇遇
-            if fdeventID == 1:
+            if fdeventID == AdventuresType1:
                 curData = curPlayer.GetLV()
-            elif fdeventID == 2:
+            elif fdeventID == AdventuresType2:
                 curData = curPlayer.GetOfficialRank()
-            elif fdeventID == 3:
+            elif fdeventID == AdventuresType3:
                 curData = curPlayer.GetFightPower()
-            elif fdeventID == 4:
+            elif fdeventID == AdventuresType4:
                 curData = curPlayer.GetLuckValue()
             else:
                 return
@@ -351,4 +370,4 @@
     ipyData = IpyGameDataPY.GetIpyGameDataByCondition('FairyDomainAppoint', {'Cnt':visitCnt, 'EventID':fdEventID}, False, False)
     if not ipyData:
         return
-    return ipyData.GetAward()
\ No newline at end of file
+    return ipyData.GetAward()

--
Gitblit v1.8.0