From 10a2b69436a1ebb09fa49a339655e150bfda70a8 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期六, 13 四月 2019 17:16:54 +0800
Subject: [PATCH] 6457 新增GM命令 AddFairyEvent 事件ID 事件ID。。

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/AddFairyEvent.py |   73 ++++++++++++++++++++++++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py  |    5 ++
 2 files changed, 77 insertions(+), 1 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/AddFairyEvent.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/AddFairyEvent.py
new file mode 100644
index 0000000..106d354
--- /dev/null
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/AddFairyEvent.py
@@ -0,0 +1,73 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#-------------------------------------------------------------------------------
+#
+#-------------------------------------------------------------------------------
+#
+##@package GM.Commands.AddFairyEvent
+#
+# @todo:增加缥缈事件
+# @author xdh
+# @date 2019-4-13
+# @version 1.0
+#
+# 详细描述: 增加缥缈事件
+#
+#---------------------------------------------------------------------
+"""Version = 2019-4-13 16:00"""
+#---------------------------------------------------------------------
+
+import IpyGameDataPY
+import GameWorld
+import ChConfig
+import PlayerFairyDomain
+import PlayerControl
+import ShareDefine
+import random
+#---------------------------------------------------------------------
+#逻辑实现
+
+## GM命令执行入口
+#  @param curPlayer 当前玩家
+#  @param msgList 参数列表
+#  @return None
+#  @remarks 函数详细说明.
+def OnExec(curPlayer, msgList):
+    if not msgList:
+        GameWorld.DebugAnswer(curPlayer, "AddFairyEvent 事件ID")
+        return
+    fdEventIDList = msgList
+    openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
+    otherCntRateList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 2)
+    maxEventCnt = max([info[1] for info in otherCntRateList]) + 1  #最大可出现事件个数
+    for i in xrange(maxEventCnt):
+        prefdEventID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventID % i)
+        if prefdEventID:
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventState % prefdEventID, 0)
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyAdventuresData % prefdEventID, 0)
+            
+        fdEventID = fdEventIDList[i] if i < len(fdEventIDList) else 0
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventID % i, fdEventID)
+        if fdEventID:
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventState % fdEventID, PlayerFairyDomain.FDEventState_CanVisit)
+            if fdEventID in PlayerFairyDomain.AdventuresTypeList:
+                ipyData = IpyGameDataPY.InterpolationSearch('FairyAdventures', 'OpenServerDay', openServerDay, {'EventID':fdEventID})
+                if ipyData:
+                    conditionList = ipyData.GetCondition()
+                    condition = random.choice(conditionList)
+                    index = conditionList.index(condition)
+                    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyAdventuresData % fdEventID, ipyData.GetID() * 100 + index)
+        
+    #设置寻访中
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainState, 1)
+    
+    #设置初始体力
+    initEnergy = IpyGameDataPY.GetFuncCfg('ImmortalDomainStrength')
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEnergy, initEnergy)
+    
+    PlayerFairyDomain.NotifyVisitFairyDomainInfo(curPlayer, fdEventIDList)
+    PlayerFairyDomain.NotifyFairyAdventuresInfo(curPlayer)
+    GameWorld.DebugAnswer(curPlayer, "新增 事件 fdEventIDList=%s"%fdEventIDList)
+    return
+
+
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 6a26e61..f92ce14 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py
@@ -168,7 +168,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)
     #设置初始体力
@@ -281,6 +282,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

--
Gitblit v1.8.0