From 3f5967eeefb1329d272e13e5823a7961ec0ea92c Mon Sep 17 00:00:00 2001 From: xdh <xiefantasy@qq.com> Date: 星期四, 11 四月 2019 21:24:45 +0800 Subject: [PATCH] 6457 【后端】【2.0】缥缈仙域开发单(定制) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py | 103 +++++++++++++++++++++++++++++++++------------------ 1 files changed, 66 insertions(+), 37 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 d0014c7..dcfd19e 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py @@ -25,6 +25,7 @@ import IpyGameDataPY import PlayerActivity import ItemControler +import EventShell import copy import random @@ -62,16 +63,12 @@ #}; 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 #最大可出现事件个数 - + 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) @@ -86,21 +83,28 @@ 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): + if fairyDomainState != 2 and not PlayerActivity.AddDailyActionFinishCnt(curPlayer, dailyID): GameWorld.DebugLog(" 寻访仙域次数不足!") 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 = {} #先随机奇遇事件 @@ -150,8 +154,7 @@ GameWorld.Log('寻访仙域, 没有随机出事件!!') return - if visitCnt < maxSpecialCnt: - PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainVisitCnt, visitCnt + 1) + 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 @@ -177,11 +180,17 @@ randomRateList = [] rate = 0 curAlchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV) + curLV = curPlayer.GetLV() for ipyData in ipyDataList: needAlchemyLV = ipyData.GetNeedAlchemyLV() if curAlchemyLV < needAlchemyLV - 1: #丹炉等级不足 continue + lvLimit = ipyData.GetNeedLV() + if lvLimit and not (lvLimit[0]<=curLV<=lvLimit[1]): + #等级范围不满足 + continue + rate += ipyData.GetWeight() randomRateList.append([rate, ipyData.GetID()]) if not randomRateList: @@ -221,14 +230,16 @@ 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]) return True def NotifyVisitFairyDomainInfo(curPlayer, fdEventList=[]): + isAll = 0 if not fdEventList: + isAll = 1 otherCntRateList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 2) maxEventCnt = max([info[1] for info in otherCntRateList]) + 1 #最大可出现事件个数 for i in xrange(maxEventCnt): @@ -237,8 +248,10 @@ fdEventList.append(fdEventID) 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: fdeventData = ChPyNetSendPack.tagMCFairyDomainEvent() @@ -253,6 +266,8 @@ ###=========================奇遇=============================== def NotifyFairyAdventuresInfo(curPlayer): ##通知奇遇信息 + visitCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainVisitCnt) + packData = ChPyNetSendPack.tagMCFairyAdventuresInfo() packData.InfoList = [] otherCntRateList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 2) @@ -267,7 +282,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 @@ -298,28 +316,39 @@ 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 == 1: + curData = curPlayer.GetLV() + elif fdeventID == 2: + curData = curPlayer.GetOfficialRank() + elif fdeventID == 3: + curData = curPlayer.GetFightPower() + elif fdeventID == 4: + curData = curPlayer.GetLuckValue() + else: return - itemRateList = gearAwardList[index] if index < len(gearAwardList) else gearAwardList[-1] - itemInfo = GameWorld.GetResultByWeightList(itemRateList) - else: - itemInfo = ipyData.GetBasicAward() + if curData >= condition: + gearAwardList = ipyData.GetGearAward() + if not gearAwardList: + return + itemRateList = gearAwardList[index] if index < len(gearAwardList) else gearAwardList[-1] + giveItemList = [GameWorld.GetResultByWeightList(itemRateList)] + else: + giveItemList = [ipyData.GetBasicAward()] - ItemControler.GivePlayerItemOrMail(curPlayer, [itemInfo]) - msgDict = {FBCommon.Over_itemInfo:FBCommon.GetJsonItemList([itemInfo])} + ItemControler.GivePlayerItemOrMail(curPlayer, giveItemList) + 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 + return ipyData.GetAward() \ No newline at end of file -- Gitblit v1.8.0