From c06d47322d2892a440dc11b94f06950da762e5bd Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期五, 21 六月 2019 19:41:43 +0800
Subject: [PATCH] 7413 宗门试炼评级通知
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py | 375 ++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 272 insertions(+), 103 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 04f2f37..c9634b4 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py
@@ -19,24 +19,30 @@
import ChConfig
import ChPyNetSendPack
import NetPackCommon
+import PlayerBossReborn
import ShareDefine
import GameWorld
+import GameLogic_CrossGrassland
import PlayerControl
import IpyGameDataPY
import PlayerActivity
import ItemControler
+import ItemCommon
+import PyGameData
+import EventShell
+import FBCommon
+import NPCCommon
import copy
import random
-import FBCommon
#0-奇遇 1-宝藏 2-仙草 3-妖王 4-灵草
(
FDEventType0,
FDEventType1,
-FDEventType2,
+FDEventType_GrasslandXian,
FDEventType3,
-FDEventType4,
+FDEventType_GrasslandLing,
) = range(5)
(
@@ -46,10 +52,54 @@
FDEventState_Visited, #已拜访3
) = range(4)
+#1-等级奇遇 2-境界奇遇 3-战力奇遇 4-气运奇遇
+AdventuresTypeList = (
+AdventuresType1,
+AdventuresType2,
+AdventuresType3,
+AdventuresType4,
+) = range(1, 5)
+
+#事件副本类型
+(
+FDEventFBType_Client, #前端本0
+FDEventFBType_Server, #本服本1
+FDEventFBType_CrossServer, #跨服本2
+) = range(3)
def OnLogin(curPlayer):
NotifyVisitFairyDomainInfo(curPlayer)
NotifyFairyAdventuresInfo(curPlayer)
+ return
+
+
+def OnHour(curPlayer):
+ __ResetFairyDomainCntLimit(curPlayer, 1)
+ return
+
+
+def OnDay(curPlayer):
+ __ResetFairyDomainCntLimit(curPlayer, 2)
+ return
+
+
+def __ResetFairyDomainCntLimit(curPlayer, resetType):
+ ## 重置个人缥缈事件出现次数记录
+ ipyMgr = IpyGameDataPY.IPY_Data()
+ for i in xrange(ipyMgr.GetFairyDomainCount()):
+ ipyData = ipyMgr.GetFairyDomainByIndex(i)
+ eventID = ipyData.GetID()
+ appearCntInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventAppearCnt % eventID)
+ if not appearCntInfo:
+ continue
+ hourAppearCntPri, dayAppearCntPri = appearCntInfo % 1000, appearCntInfo / 1000
+ if resetType == 1:
+ updAppearCntInfo = dayAppearCntPri * 1000
+ elif resetType == 2:
+ updAppearCntInfo = hourAppearCntPri
+ else:
+ return
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventAppearCnt % eventID, updAppearCntInfo)
return
@@ -62,59 +112,56 @@
#};
def OnVisitFairyDomain(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
- dailyID = ShareDefine.DailyActionID_FairyDomain
- hasOpen = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % dailyID)
- if not hasOpen:
- GameWorld.DebugLog(" 寻访仙域活动未开启!")
- return
- otherCntRateList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 2)
- maxEventCnt = max([info[1] for info in otherCntRateList]) + 1 #最大可出现事件个数
+ otherCntRateList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 2)
+ maxEventCnt = GetMaxEventCnt() #最大可出现事件个数
+ fairyDomainState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainState) #是否寻访中 0未寻访 1寻访中 2任务标记可寻访
if clientData.Type == 1: #结束寻访
- if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainState):
+ if fairyDomainState != 1:
GameWorld.DebugLog(" 未开始寻访仙域, 无法结束")
return
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainState, 0)
-
- for i in xrange(maxEventCnt):
- fdEventID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventID % i)
- if fdEventID:
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventID % i, 0)
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventState % fdEventID, 0)
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyAdventuresData % fdEventID, 0)
-
+ EndFairyDomain(curPlayer)
+
NotifyVisitFairyDomainInfo(curPlayer)
return
+ dailyID = ShareDefine.DailyActionID_FairyDomain
+ hasOpen = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % dailyID)
+ if fairyDomainState != 2 and not hasOpen:
+ GameWorld.DebugLog(" 寻访仙域活动未开启!")
+ return
+
#是否寻访中
- if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainState):
+ if fairyDomainState == 1:
GameWorld.DebugLog(" 正在寻访仙域中!请先退出寻访")
return
-
- if 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
-
+
#随机事件 重置事件状态
visitCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainVisitCnt)
- specialVisitDict = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 5, {})
- maxSpecialCnt = max(specialVisitDict) if specialVisitDict else 0
- if visitCnt + 1 in specialVisitDict:
- fdEventIDList = specialVisitDict[visitCnt + 1]
+ appointIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog('FairyDomainAppoint', visitCnt + 1)
+ if appointIpyDataList:
+ fdEventIDList = []
+ for appointIpyData in appointIpyDataList:
+ fdEventIDList.append(appointIpyData.GetEventID())
else:
fdEventTypeDict = {}
- #先随机奇遇事件
- fortuitousEventRate = IpyGameDataPY.GetFuncCfg('ImmortalDomain')
- if GameWorld.CanHappen(fortuitousEventRate):
- fdEventTypeDict[FDEventType0] = 1
-
+ #先随机独立事件
+ 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):
@@ -127,36 +174,47 @@
for eventType, cnt in fdEventTypeDict.items():
randomList = __RandomFDEventByType(curPlayer, eventType, cnt)
if not randomList:
- continue
-
- if eventType == FDEventType0:
- #奇遇事件 随机档位数据
- openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
- for fdEventID in randomList:
- ipyData = IpyGameDataPY.InterpolationSearch('FairyAdventures', 'OpenServerDay', openServerDay, {'EventID':randomList[0]})
- if not ipyData:
- GameWorld.ErrLog('寻访仙域, 奇遇事件没有随机出对应档位 randomList=%s,openServerDay=%s' % (randomList, openServerDay))
- continue
- conditionList = ipyData.GetCondition()
- if not conditionList:
- continue
- condition = random.choice(conditionList)
- index = conditionList.index(condition)
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyAdventuresData % fdEventID, ipyData.GetID() * 100 + index)
- NotifyFairyAdventuresInfo(curPlayer)
+ continue
fdEventIDList += randomList
-
+ #更新个人出现次数
+ for fdEventID in fdEventIDList:
+ appearCntInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventAppearCnt % fdEventID)
+ hourAppearCntPri, dayAppearCntPri = appearCntInfo % 1000, appearCntInfo / 1000
+ updAppearCntInfo = (dayAppearCntPri + 1) * 1000 + (hourAppearCntPri + 1)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventAppearCnt % fdEventID, updAppearCntInfo)
+ #更新全服出现次数
+ msgStr = str(fdEventIDList)
+ GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'AddFairyDomainEvent', msgStr, len(msgStr))
if not fdEventIDList:
- GameWorld.Log('寻访仙域, 没有随机出事件!!')
- return
-
- if visitCnt < maxSpecialCnt:
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainVisitCnt, visitCnt + 1)
+ 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:
+ 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))
+ continue
+ conditionList = ipyData.GetCondition()
+ if not conditionList:
+ index = 0
+ else:
+ 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_FairyDomainVisitCnt, min(visitCnt + 1, ChConfig.Def_UpperLimit_DWord))
#设置事件
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)
#设置初始体力
@@ -165,6 +223,23 @@
GameWorld.DebugLog('寻访仙域 随机结果 fdEventIDList=%s, visitCnt=%s' % (fdEventIDList, visitCnt))
#通知
NotifyVisitFairyDomainInfo(curPlayer, fdEventIDList)
+ NotifyFairyAdventuresInfo(curPlayer)
+
+ PlayerBossReborn.AddBossRebornActionCnt(curPlayer, ChConfig.Def_BRAct_FairyDomain, 1)
+ return
+
+
+def EndFairyDomain(curPlayer):
+ GameWorld.DebugLog("EndFairyDomain", curPlayer.GetID())
+ ##结束寻访
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainState, 0)
+ maxEventCnt = GetMaxEventCnt() #最大可出现事件个数
+ for i in xrange(maxEventCnt):
+ fdEventID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventID % i)
+ if fdEventID:
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventID % i, 0)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventState % fdEventID, 0)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyAdventuresData % fdEventID, 0)
return
@@ -175,20 +250,58 @@
return []
randomRateList = []
rate = 0
+ curAlchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)
+ curLV = curPlayer.GetLV()
for ipyData in ipyDataList:
needAlchemyLV = ipyData.GetNeedAlchemyLV()
- curAlchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)
if curAlchemyLV < needAlchemyLV - 1:
#丹炉等级不足
+ continue
+ lvLimit = ipyData.GetNeedLV()
+ if lvLimit and not (lvLimit[0] <= curLV <= lvLimit[1]):
+ #等级范围不满足
+ continue
+ eventID = ipyData.GetID()
+ appearCntInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventAppearCnt % eventID)
+ hourAppearCntPri, dayAppearCntPri = appearCntInfo % 1000, appearCntInfo / 1000
+ hourCntPriLimit, dayCntPriLimit = ipyData.GetHourCntPriLimit(), ipyData.GetDayCntPriLimit()
+ if hourCntPriLimit and hourAppearCntPri >= hourCntPriLimit:
+ #超过本小时个人可出现次数上限
+ continue
+ if dayCntPriLimit and dayAppearCntPri >= dayCntPriLimit:
+ #超过今日个人可出现次数上限
+ continue
+ if eventID in PyGameData.g_fairyDomainLimit:
+ #超过全服可出现次数
continue
rate += ipyData.GetWeight()
randomRateList.append([rate, ipyData.GetID()])
if not randomRateList:
- GameWorld.DebugLog(' 缥缈仙域刷新池 随机库获取错误 !eventType=%s' % eventType, curPlayer.GetID())
+ GameWorld.DebugLog(' 缥缈仙域刷新池 该类型没有符合条件的事件!eventType=%s' % eventType, curPlayer.GetID())
return []
- randomResultList = GameWorld.GetResultByRandomListEx(randomRateList, cnt, [])
-
+ realCnt = min(len(randomRateList), cnt)
+ randomResultList = GameWorld.GetResultByRandomListEx(randomRateList, realCnt, [])
+ GameWorld.DebugLog('eventType=%s, cnt=%s,randomRateList=%s,randomResultList=%s' % (eventType, cnt, randomRateList, randomResultList))
return randomResultList
+
+
+def GetFairyDomainFBEventState(curPlayer, mapID, lineID):
+ ## 获取缥缈相关副本寻访状态
+ ipyData = IpyGameDataPY.GetIpyGameDataByCondition("FairyDomain", {"MapID":mapID, "LineID":lineID})
+ if not ipyData:
+ return FDEventState_No
+ fdeventID = ipyData.GetID()
+ curState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventState % fdeventID)
+ return curState
+
+
+def SetFairyDomainFBEventState(curPlayer, mapID, lineID, state):
+ ## 设置缥缈相关副本寻访状态
+ ipyData = IpyGameDataPY.GetIpyGameDataByCondition("FairyDomain", {"MapID":mapID, "LineID":lineID})
+ if not ipyData:
+ return False
+ fdeventID = ipyData.GetID()
+ return SetFairyDomainEventState(curPlayer, fdeventID, state)
def SetFairyDomainEventState(curPlayer, fdeventID, state):
@@ -197,43 +310,59 @@
GameWorld.Log('缥缈仙域事件状态设置错误,state=%s' % state)
return
curState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventState % fdeventID)
+ if not curState:
+ #没有该事件
+ return
+ if curState == state:
+ return True
+ ipyData = IpyGameDataPY.GetIpyGameData('FairyDomain', fdeventID)
+ if not ipyData:
+ return
if state == FDEventState_Visiting:
if curState != FDEventState_CanVisit:
- GameWorld.Log('缥缈仙域事件状态设置错误,fdeventID=%s, state=%s, curState=%s' % (fdeventID, state, curState))
+ GameWorld.DebugLog('缥缈仙域事件状态设置错误,fdeventID=%s, state=%s, curState=%s' % (fdeventID, state, curState))
return
- ipyData = IpyGameDataPY.GetIpyGameData('FairyDomain', fdeventID)
- if not ipyData:
- return
+
costEnergy = ipyData.GetCostEnergy()
curEnergy = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEnergy)
if curEnergy < costEnergy:
GameWorld.Log('缥缈仙域事件状态设置,体力不足!,fdeventID=%s, costEnergy=%s, curEnergy=%s' % (fdeventID, costEnergy, curEnergy))
return
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEnergy, curEnergy - costEnergy)
- elif state == FDEventState_Visited:
- if curState != FDEventState_Visiting:
- GameWorld.Log('缥缈仙域事件状态设置错误,fdeventID=%s, state=%s, curState=%s' % (fdeventID, state, curState))
- return
+ # 草园重置
+ 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, ipyData.GetEventType())
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventState % fdeventID, state)
- NotifyVisitFairyDomainInfo(curPlayer, [fdeventID])
+ NotifyVisitFairyDomainInfo(curPlayer, [fdeventID], 0)
return True
-def NotifyVisitFairyDomainInfo(curPlayer, fdEventList=[]):
+def NotifyVisitFairyDomainInfo(curPlayer, fdEventList=None, isAll=1):
if not fdEventList:
- otherCntRateList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 2)
- maxEventCnt = max([info[1] for info in otherCntRateList]) + 1 #最大可出现事件个数
+ syncFDEventList = []
+ maxEventCnt = GetMaxEventCnt() #最大可出现事件个数
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)
@@ -242,16 +371,24 @@
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):
##通知奇遇信息
+ visitCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainVisitCnt)
+
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:
+ continue
adventuresdata = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyAdventuresData % fdEventID)
if not adventuresdata:
continue
@@ -260,7 +397,10 @@
continue
conditionList = ipyData.GetCondition()
index = adventuresdata % 100
- condition = conditionList[index] if index < len(conditionList) else 0
+ if IpyGameDataPY.GetIpyGameDataByCondition('FairyDomainAppoint', {'Cnt':visitCnt, 'EventID':fdEventID}, False, False):
+ condition = 0 #定制的条件为0
+ else:
+ condition = conditionList[index] if index < len(conditionList) else 0
adventuresdata = ChPyNetSendPack.tagMCFairyAdventuresData()
adventuresdata.Gear = index + 1
adventuresdata.Condition = condition
@@ -291,28 +431,57 @@
if fdeventID != ipyData.GetEventID():
GameWorld.Log('奇遇领取奖励 事件ID错误!')
return
- #1-等级奇遇 2-境界奇遇 3-战力奇遇 4-气运奇遇
- if fdeventID == 1:
- curData = curPlayer.GetLV()
- elif fdeventID == 2:
- curData = curPlayer.GetOfficialRank()
- elif fdeventID == 3:
- curData = curPlayer.GetFightPower()
- elif fdeventID == 4:
- curData = curPlayer.GetLuckValue()
- else:
- return
- if curData >= condition:
- gearAwardList = ipyData.GetGearAward()
- if not gearAwardList:
+ giveItemList = GetFairyAppointAward(curPlayer, fdeventID)
+ if not giveItemList:
+ #1-等级奇遇 2-境界奇遇 3-战力奇遇 4-气运奇遇
+ if fdeventID == AdventuresType1:
+ curData = curPlayer.GetLV()
+ elif fdeventID == AdventuresType2:
+ curData = curPlayer.GetOfficialRank()
+ elif fdeventID == AdventuresType3:
+ curData = curPlayer.GetFightPower()
+ elif fdeventID == AdventuresType4:
+ curData = curPlayer.GetLuckValue()
+ else:
return
- itemRateList = gearAwardList[index] if index < len(gearAwardList) else gearAwardList[-1]
- itemInfo = GameWorld.GetResultByWeightList(itemRateList)
- else:
- itemInfo = ipyData.GetBasicAward()
-
- ItemControler.GivePlayerItemOrMail(curPlayer, [itemInfo])
- msgDict = {FBCommon.Over_itemInfo:FBCommon.GetJsonItemList([itemInfo])}
+ if curData >= condition:
+ gearAwardList = ipyData.GetGearAward()
+ if not gearAwardList:
+ return
+ 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()]
+ 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))
return
+
+
+def GetFairyAppointAward(curPlayer, fdEventID):
+ ##获取事件定制奖励, 没有的给正常奖励
+ visitCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainVisitCnt)
+ ipyData = IpyGameDataPY.GetIpyGameDataByCondition('FairyDomainAppoint', {'Cnt':visitCnt, 'EventID':fdEventID}, False, False)
+ if not ipyData:
+ return
+ job = curPlayer.GetJob()
+ itemList = []
+ for itemInfo in ipyData.GetAward():
+ if type(itemInfo[0]) == dict:
+ if job not in itemInfo[0]:
+ continue
+ itemList.append([itemInfo[0][job], itemInfo[1], itemInfo[2]])
+ else:
+ itemList.append(itemInfo)
+
+ for itemRateList in ipyData.GetRandomAward():
+ itemRateList = ItemCommon.GetWeightItemListByAlchemyDiffLV(curPlayer, itemRateList, 1)
+ giveItem = GameWorld.GetResultByWeightList(itemRateList)
+ if not giveItem:
+ continue
+ itemList.append(giveItem)
+ return itemList
--
Gitblit v1.8.0