From f87b69ad9c32c75d74d40689e0d0427f0a1a6e46 Mon Sep 17 00:00:00 2001 From: xdh <xiefantasy@qq.com> Date: 星期二, 09 四月 2019 11:41:44 +0800 Subject: [PATCH] 6457 【后端】【2.0】缥缈仙域开发单(奇遇) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 109 insertions(+), 8 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 3142c2f..04f2f37 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py @@ -24,8 +24,11 @@ import PlayerControl import IpyGameDataPY import PlayerActivity +import ItemControler import copy +import random +import FBCommon #0-奇遇 1-宝藏 2-仙草 3-妖王 4-灵草 ( @@ -37,15 +40,16 @@ ) = range(5) ( -FDEventState_No, #不可拜访0 -FDEventState_CanVisit, #可拜访1 -FDEventState_Visiting, #拜访中2 -FDEventState_Visited, #已拜访3 +FDEventState_No, #不可拜访0 +FDEventState_CanVisit, #可拜访1 +FDEventState_Visiting, #拜访中2 +FDEventState_Visited, #已拜访3 ) = range(4) def OnLogin(curPlayer): NotifyVisitFairyDomainInfo(curPlayer) + NotifyFairyAdventuresInfo(curPlayer) return @@ -71,11 +75,13 @@ 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_FairyDomainEventID % i, 0) + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventState % fdEventID, 0) + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyAdventuresData % fdEventID, 0) NotifyVisitFairyDomainInfo(curPlayer) return @@ -119,7 +125,27 @@ fdEventIDList = [] for eventType, cnt in fdEventTypeDict.items(): - fdEventIDList += __RandomFDEventByType(curPlayer, eventType, cnt) + 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) + fdEventIDList += randomList + if not fdEventIDList: GameWorld.Log('寻访仙域, 没有随机出事件!!') return @@ -190,7 +216,7 @@ return PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventState % fdeventID, state) - NotifyVisitFairyDomainInfo(curPlayer, fdeventID) + NotifyVisitFairyDomainInfo(curPlayer, [fdeventID]) return True @@ -215,3 +241,78 @@ packData.Count = len(packData.InfoList) NetPackCommon.SendFakePack(curPlayer, packData) return + + +###=========================奇遇=============================== +def NotifyFairyAdventuresInfo(curPlayer): + ##通知奇遇信息 + packData = ChPyNetSendPack.tagMCFairyAdventuresInfo() + packData.InfoList = [] + 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) + adventuresdata = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyAdventuresData % fdEventID) + if not adventuresdata: + continue + ipyData = IpyGameDataPY.GetIpyGameDataNotLog('FairyAdventures', adventuresdata / 100) + if not ipyData: + continue + conditionList = ipyData.GetCondition() + index = adventuresdata % 100 + condition = conditionList[index] if index < len(conditionList) else 0 + adventuresdata = ChPyNetSendPack.tagMCFairyAdventuresData() + adventuresdata.Gear = index + 1 + adventuresdata.Condition = condition + adventuresdata.EventID = fdEventID + packData.InfoList.append(adventuresdata) + if not packData.InfoList: + return + packData.Cnt = len(packData.InfoList) + NetPackCommon.SendFakePack(curPlayer, packData) + return + + +def GetFairyAdventuresAward(curPlayer, fdeventID, state): + ##奇遇领取奖励 + state = GameWorld.ToIntDef(state, 0) + if state == FDEventState_Visiting: + SetFairyDomainEventState(curPlayer, fdeventID, state) + elif state == FDEventState_Visited: + SetFairyDomainEventState(curPlayer, fdeventID, state) + #给奖励 + adventuresdata = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyAdventuresData % fdeventID) + ipyData = IpyGameDataPY.GetIpyGameDataNotLog('FairyAdventures', adventuresdata / 100) + if not ipyData: + return + conditionList = ipyData.GetCondition() + index = adventuresdata % 100 + condition = conditionList[index] if index < len(conditionList) else 0 + 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: + 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])} + FBCommon.Notify_FB_Over(curPlayer, msgDict) + GameWorld.DebugLog('缥缈奇遇领奖 msgDict=%s, fdeventID=%s' % (msgDict, fdeventID)) + return -- Gitblit v1.8.0