From 6ad924ae5602f3ebc89267ed6c824a2523c0f36e Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期六, 13 四月 2019 16:15:21 +0800
Subject: [PATCH] 6515 【测试】【主干】新增游戏警报邮件
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py | 198 ++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 171 insertions(+), 27 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..6a26e61 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,12 @@
import PlayerControl
import IpyGameDataPY
import PlayerActivity
+import ItemControler
+import EventShell
import copy
+import random
+import FBCommon
#0-奇遇 1-宝藏 2-仙草 3-妖王 4-灵草
(
@@ -37,15 +41,24 @@
) = 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)
+
+#1-等级奇遇 2-境界奇遇 3-战力奇遇 4-气运奇遇
+AdventuresTypeList = (
+AdventuresType1,
+AdventuresType2,
+AdventuresType3,
+AdventuresType4,
+) = range(1, 5)
def OnLogin(curPlayer):
NotifyVisitFairyDomainInfo(curPlayer)
+ NotifyFairyAdventuresInfo(curPlayer)
return
@@ -58,43 +71,48 @@
#};
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)
+
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
+ 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 = {}
#先随机奇遇事件
@@ -119,13 +137,33 @@
fdEventIDList = []
for eventType, cnt in fdEventTypeDict.items():
- fdEventIDList += __RandomFDEventByType(curPlayer, eventType, cnt)
+ randomList = __RandomFDEventByType(curPlayer, eventType, cnt)
+ if not randomList:
+ continue
+ fdEventIDList += randomList
+
+ #奇遇事件 随机档位数据
+ 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:
+ fdEventIDList.remove(fdEventID)
+ continue
+ 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('寻访仙域, 没有随机出事件!!')
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
@@ -139,6 +177,7 @@
GameWorld.DebugLog('寻访仙域 随机结果 fdEventIDList=%s, visitCnt=%s' % (fdEventIDList, visitCnt))
#通知
NotifyVisitFairyDomainInfo(curPlayer, fdEventIDList)
+ NotifyFairyAdventuresInfo(curPlayer)
return
@@ -149,12 +188,18 @@
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
+
rate += ipyData.GetWeight()
randomRateList.append([rate, ipyData.GetID()])
if not randomRateList:
@@ -171,9 +216,15 @@
GameWorld.Log('缥缈仙域事件状态设置错误,state=%s' % state)
return
curState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventState % fdeventID)
+ if not curState:
+ #没有该事件
+ return
+ if curState == state:
+ return True
+
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:
@@ -188,13 +239,13 @@
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=[]):
+def NotifyVisitFairyDomainInfo(curPlayer, fdEventList=[], isAll=1):
if not fdEventList:
otherCntRateList = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomain', 2)
maxEventCnt = max([info[1] for info in otherCntRateList]) + 1 #最大可出现事件个数
@@ -204,8 +255,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()
@@ -215,3 +268,94 @@
packData.Count = len(packData.InfoList)
NetPackCommon.SendFakePack(curPlayer, packData)
return
+
+
+###=========================奇遇===============================
+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 #最大可出现事件个数
+ 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
+ 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
+ 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
+ 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
+ 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, 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()
--
Gitblit v1.8.0