From cad5322198881fb5cbf0ab12b05f06dc2642fb6d Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 23 一月 2019 14:57:04 +0800
Subject: [PATCH] 5931 【后端】【1.5.100】诛仙装备开发(诛仙装备传奇属性效果、套装属性效果; 增加GM命令 PrintZXEquipSkill 输出诛仙装备所影响的相关技能效果信息)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBossReborn.py |  126 ++++++++++++++++++++++++++++--------------
 1 files changed, 84 insertions(+), 42 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBossReborn.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBossReborn.py
index f90eea0..12184dd 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBossReborn.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBossReborn.py
@@ -38,7 +38,9 @@
         # 活动中同步活动信息
         if actCostRebateInfo.get(ShareDefine.ActKey_State):
             SyncBossRebornInfo(curPlayer)
+            SyncBossRebornPlayerInfo(curPlayer)
     return
+
 
 def RefreshOperationAction_BossReborn():
     playerManager = GameWorld.GetPlayerManager()
@@ -57,44 +59,54 @@
     actBossRebornInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_BossReborn, {})
     bossRebornID = actBossRebornInfo.get(ShareDefine.ActKey_ID, 0)
     state = actBossRebornInfo.get(ShareDefine.ActKey_State, 0)
+    cfgID = actBossRebornInfo.get(ShareDefine.ActKey_CfgID, 0)
     
-    playerBossRebornID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BossRebornID) # 玩家身上的活动ID
+    playerBossRebornID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BossRebornID)  # 玩家身上的活动ID
     
     # 活动ID 相同的话不处理
     if bossRebornID == playerBossRebornID:
         #GameWorld.DebugLog("BOSS复活活动ID不变,不处理!", curPlayer.GetPlayerID())
         return
-    BRWorldLV = actBossRebornInfo.get(ShareDefine.ActKey_WorldLV, 0)
-    playerBRWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BRActionWorldLV)
-    GameWorld.DebugLog("BOSS复活重置! costRebateID=%s,playerCostRebateID=%s,state=%s,BRWorldLV=%s,playerBRWorldLV=%s" 
-                       % (bossRebornID, playerBossRebornID, state, BRWorldLV, playerBRWorldLV), playerID)
+    
+    templateID = 0
+    if cfgID:
+        actBossIpyData = IpyGameDataPY.GetIpyGameData("ActBossReborn", cfgID)
+        templateID = 0 if not actBossIpyData else actBossIpyData.GetTemplateID()
+    playerTemplateID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BossRebornTemplateID)
+    
+    GameWorld.DebugLog("BOSS复活重置! costRebateID=%s,playerCostRebateID=%s,state=%s,templateID=%s,playerTemplateID=%s" 
+                       % (bossRebornID, playerBossRebornID, state, templateID, playerTemplateID), playerID)
     
     # 未领取的奖励邮件发放
-    __SendBossRebornMail(curPlayer, playerBRWorldLV)
+    __SendBossRebornMail(curPlayer, playerTemplateID)
     
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BossRebornID, bossRebornID)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BRActionWorldLV, BRWorldLV)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BossRebornTemplateID, templateID)
     for brid in ChConfig.BossRebornActIDList:
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BRActionCurTimes % brid, 0)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BRActionGotTimes % brid, 0)
-    
+        
     SyncBossRebornInfo(curPlayer)
+    SyncBossRebornPlayerInfo(curPlayer)
     return True
 
-def __SendBossRebornMail(curPlayer, playerBRWorldLV):
-    #未领取的奖励邮件发放
+
+def __SendBossRebornMail(curPlayer, playerTemplateID):
+    # 未领取的奖励邮件发放
+    ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition("BossReborn", {'TemplateID':playerTemplateID}, True)
+    if not ipyDataList:
+        return
+    
     totalItemDict = {}
-    for brid in ChConfig.BossRebornActIDList:
-        ipyData = IpyGameDataPY.GetIpyGameData('BossReborn', brid)
-        if not ipyData:
-            continue
+    for ipyData in ipyDataList:
+        brid = ipyData.GetID()
         singleTimes = ipyData.GetSingleTimes()
         curTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BRActionCurTimes % brid)
         gotTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BRActionGotTimes % brid)
         canGotCnt = (curTimes - gotTimes) / singleTimes
         if not canGotCnt:
             continue
-        itemDict = __GetAwardItem(curPlayer, playerBRWorldLV, ipyData, canGotCnt)
+        itemDict = __GetAwardItem(curPlayer, ipyData, canGotCnt)
         GameWorld.AddDictValue(totalItemDict, itemDict)
     
     #去掉复活点道具
@@ -105,6 +117,7 @@
     PlayerControl.SendMailByKey('BossFHUnGetMail', [curPlayer.GetID()], totalItemList)
     return
 
+
 def AddBossRebornActionCnt(curPlayer, actionID, addCnt=1):
     '''增加boss复活相关活动完成次数'''
     #判断活动是否开启
@@ -112,7 +125,8 @@
     state = actBossRebornInfo.get(ShareDefine.ActKey_State, 0)
     if not state:
         return
-    ipyData = IpyGameDataPY.GetIpyGameData('BossReborn', actionID)
+    playerTemplateID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BossRebornTemplateID)
+    ipyData = IpyGameDataPY.GetIpyGameData('BossReborn', playerTemplateID, actionID)
     if not ipyData:
         return
     totalTimes = ipyData.GetTotalTimes()
@@ -123,12 +137,14 @@
     
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BRActionCurTimes % actionID, curTimes + addCnt)
     
-    SyncBossRebornInfo(curPlayer, actionID)
+    SyncBossRebornPlayerInfo(curPlayer, actionID)
     return
+
 
 def GetBossRebornActionAward(curPlayer, actionID):
     '''领取boss复活活动奖励'''
-    ipyData = IpyGameDataPY.GetIpyGameData('BossReborn', actionID)
+    playerTemplateID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BossRebornTemplateID)
+    ipyData = IpyGameDataPY.GetIpyGameData('BossReborn', playerTemplateID, actionID)
     if not ipyData:
         return
     singleTimes = ipyData.GetSingleTimes()
@@ -138,8 +154,7 @@
         return
     
     #给奖励
-    curWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BRActionWorldLV)
-    awardDict = __GetAwardItem(curPlayer, curWorldLV, ipyData)
+    awardDict = __GetAwardItem(curPlayer, ipyData)
     # 检查背包
     needSpace = len(awardDict)
     packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
@@ -153,40 +168,25 @@
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BRActionGotTimes % actionID, newGotTimes)
     for itemID, itemCnt in awardDict.items():
         ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 1, [IPY_GameWorld.rptItem])
-    SyncBossRebornInfo(curPlayer, actionID)
+    SyncBossRebornPlayerInfo(curPlayer, actionID)
     return
 
-def __GetAwardItem(curPlayer, worldLV, ipyData, times=1):
-    worldLVList = ipyData.GetWorldLVList()
-    playerLV = curPlayer.GetLV()
-    
-    awardIndex = len(worldLVList) - 1
-    for i, lv in enumerate(worldLVList):
-        prelv = 0 if i ==0 else worldLVList[i-1]
-        if prelv<=playerLV < lv:
-            awardIndex = i
-            break
+
+def __GetAwardItem(curPlayer, ipyData, times=1):
     awardDict = {}
-    for i in xrange(3): #目前配置3个奖励
-        if not hasattr(ipyData, 'GetRewardItemID%s' % (i + 1)):
-            break
-        itemIDList = getattr(ipyData, 'GetRewardItemID%s' % (i + 1))()
-        itemCntList = getattr(ipyData, 'GetRewardItemCnt%s' % (i + 1))()
-        if awardIndex >= len(itemIDList) or awardIndex >= len(itemCntList):
-            GameWorld.ErrLog('BOSS复活表奖励配置错误!')
-            return awardDict
-        itemID, itemCnt = itemIDList[awardIndex], itemCntList[awardIndex]
+    for itemID, itemCnt, isbind in ipyData.GetReward():
         if not itemID or not itemCnt:
             continue
         awardDict[itemID] = awardDict.get(itemID, 0) + itemCnt * times
         
     return awardDict
 
-def SyncBossRebornInfo(curPlayer, actID= -1):
+
+def SyncBossRebornPlayerInfo(curPlayer, actID=-1):
     #通知当前次数、已领次数 
     packData = ChPyNetSendPack.tagMCBossRebornPlayerInfo()
     packData.DataList = []
-    if actID !=-1:
+    if actID != -1:
         syneActIDList = [actID]
     else:
         syneActIDList = []
@@ -207,3 +207,45 @@
     packData.Count = len(packData.DataList)
     NetPackCommon.SendFakePack(curPlayer, packData)
     return
+
+
+def SyncBossRebornInfo(curPlayer):
+    actBossRebornInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_BossReborn, {})
+    state = actBossRebornInfo.get(ShareDefine.ActKey_State, 0)
+    cfgID = actBossRebornInfo.get(ShareDefine.ActKey_CfgID, 0)
+    if not state or not cfgID:
+        return
+    actBossIpyData = IpyGameDataPY.GetIpyGameData("ActBossReborn", cfgID)
+    if not actBossIpyData:
+        return
+    templateID = actBossIpyData.GetTemplateID()
+    if not templateID:
+        return
+    ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition("BossReborn", {'TemplateID':templateID}, True)
+    if not ipyDataList:
+        return
+    openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
+    actInfo = ChPyNetSendPack.tagMCBossRebornInfo()
+    actInfo.Clear()
+    actInfo.StartDate = GameWorld.GetOperationActionDateStr(actBossIpyData.GetStartDate(), openServerDay)
+    actInfo.EndtDate = GameWorld.GetOperationActionDateStr(actBossIpyData.GetEndDate(), openServerDay)
+    actInfo.ResetType = actBossIpyData.GetResetType()
+    actInfo.LimitLV = actBossIpyData.GetLVLimit()
+    actInfo.TaskInfo = []
+    for ipyData in ipyDataList:
+        taskInfo = ChPyNetSendPack.tagMCBossRebornTaskInfo()
+        taskInfo.TaskID = ipyData.GetID()
+        taskInfo.TotalTimes = ipyData.GetTotalTimes()
+        taskInfo.SingleTimes = ipyData.GetSingleTimes()
+        taskInfo.AwardItem = []
+        for itemID, itemCnt, isBind in ipyData.GetReward():
+            awardItem = ChPyNetSendPack.tagMCBossRebornAwardItem()
+            awardItem.ItemID = itemID
+            awardItem.ItemCount = itemCnt
+            awardItem.IsBind = isBind
+            taskInfo.AwardItem.append(awardItem)
+        taskInfo.AwardItemCount = len(taskInfo.AwardItem)
+        actInfo.TaskInfo.append(taskInfo)
+    actInfo.TaskCnt = len(actInfo.TaskInfo)
+    NetPackCommon.SendFakePack(curPlayer, actInfo)
+    return

--
Gitblit v1.8.0