From 11471969c8b6ecec34e8a39f9e19cedc320e8bb8 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期四, 16 五月 2019 17:54:50 +0800
Subject: [PATCH] 6820 【2.0】【后端】普通炼丹定制产出数量

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py         |   23 +++++++++++++++--------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerRefineStove.py |   33 ++++++++++++++++++++++++---------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                 |    2 +-
 3 files changed, 40 insertions(+), 18 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 9868f38..1dc3759 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3882,7 +3882,7 @@
 Def_PDict_AlchemyLearnState = "AlchemyLearnState%s" #丹方是否已学习 
 Def_PDict_AlchemyItemID = "AlchemyItemID_%s" #炼丹中的丹药ID  参数丹药类型
 Def_PDict_AlchemyStartTime = "AlchemyStartTime_%s" #炼丹开始时间    参数丹药ID
-
+Def_PDict_AlchemyCommonCnt = "AlchemyCommonCnt" #普通丹药炼丹次数
 
 Def_PDict_AlchemyPrayCnt = "AlchemyPrayCnt" #炼丹祈福次数
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerRefineStove.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerRefineStove.py
index 6d240f4..91de900 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerRefineStove.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerRefineStove.py
@@ -154,14 +154,21 @@
         if passTime < alchemyIpyData.GetNeedTime():
             GameWorld.DebugLog('开炉丹药,时间未到  passTime=%s' % passTime)
             return
+        alchemyCommonCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyCommonCnt)
         alchemyQuality = alchemyIpyData.GetAlchemyQuality()
         #成功率
         if alchemType == DefStoveType2:
             successRate = ShareDefine.Def_MaxRateValue  #仙丹必定成功
-        else:
+        elif alchemType == DefStoveType1:
             #灵丹成功率公式 参数 curLuckValue:慧根  alchemyLV:炼丹等级 alchemyQuality:丹药等级  qualityNeedLuck:要求慧根
-            qualityNeedLuck = IpyGameDataPY.GetFuncEvalCfg('alchemySuccess', 2, {}).get(str(alchemyQuality), 0)
-            successRate = eval(IpyGameDataPY.GetFuncCompileCfg('alchemySuccess'))
+            alchemyCustomizedDict = IpyGameDataPY.GetFuncEvalCfg('alchemyCustomized', 1, {})
+            if alchemyCommonCnt + 1 in alchemyCustomizedDict:
+                successRate = alchemyCustomizedDict[alchemyCommonCnt + 1][1]
+            else:
+                qualityNeedLuck = IpyGameDataPY.GetFuncEvalCfg('alchemySuccess', 2, {}).get(str(alchemyQuality), 0)
+                successRate = eval(IpyGameDataPY.GetFuncCompileCfg('alchemySuccess'))
+        else:
+            return
         isSuccess = GameWorld.CanHappen(successRate)
         resultCnt = 0  #丹药数量 0代表失败
         if isSuccess:
@@ -172,12 +179,15 @@
                 return
             if alchemType == DefStoveType2:
                 resultCnt = 1 #仙丹必定为1
-            else:
-                ipyData = IpyGameDataPY.InterpolationSearch('AlchemyResult', 'LuckValue', curLuckValue, {'AlchemyQuality':alchemyIpyData.GetAlchemyQuality()})
-                if not ipyData:
-                    GameWorld.ErrLog('AlchemyResult 配置错误 未找到该丹方数量 alchemyItemID=%s' % alchemyItemID, playerID)
-                    return
-                resultCnt = GameWorld.GetResultByRandomList(ipyData.GetCntRateList())
+            elif alchemType == DefStoveType1:
+                if alchemyCommonCnt + 1 in alchemyCustomizedDict:
+                    resultCnt = alchemyCustomizedDict[alchemyCommonCnt + 1][0]
+                else:
+                    ipyData = IpyGameDataPY.InterpolationSearch('AlchemyResult', 'LuckValue', curLuckValue, {'AlchemyQuality':alchemyIpyData.GetAlchemyQuality()})
+                    if not ipyData:
+                        GameWorld.ErrLog('AlchemyResult 配置错误 未找到该丹方数量 alchemyItemID=%s' % alchemyItemID, playerID)
+                        return
+                    resultCnt = GameWorld.GetResultByRandomList(ipyData.GetCntRateList())
             if not resultCnt:
                 GameWorld.ErrLog('AlchemyResult 配置错误 未随机出该丹方数量alchemyItemID=%s' % alchemyItemID, playerID)
                 return
@@ -201,6 +211,11 @@
         #加经验
         addExp = alchemyIpyData.GetAlchemyExp()
         AddRefineExp(curPlayer, addExp, alchemyLV)
+        #加次数
+        if alchemType == DefStoveType1:
+            maxCnt = max(alchemyCustomizedDict)
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyCommonCnt, min(alchemyCommonCnt + 1, maxCnt))
+        
         GameWorld.DebugLog('炼丹结果 alchemyItemID=%s,successRate=%s,isSuccess=%s,resultCnt=%s' % (alchemyItemID, successRate, isSuccess, resultCnt), playerID)
     
         Sycn_AlchemyMsg(curPlayer, alchemyID, False, alchemyItemID, resultCnt)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
index 1b2f8a6..0fe4931 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
@@ -2108,7 +2108,7 @@
         
     if isChangeSkill:
         #更换专精
-        if not RefreshElementSkill(curPlayer, selectSkillID):
+        if not RefreshElementSkill(curPlayer, selectSkillID)[1]:
             GameWorld.DebugLog('更换专精 不成功 selectSkillID=%s'%selectSkillID)
             return
         
@@ -2131,9 +2131,10 @@
 
 def RefreshElementSkill(curPlayer, skillTypeID, isChangeLV=True):
     ##更新专精技能生效的等级
+    isNotify, hasChangeLV = False, False
     __InitElementSkillInfo()
     if skillTypeID not in PyGameData.g_elemntSkillDict:
-        return
+        return isNotify, hasChangeLV
     baseAttrDict = {
                             ShareDefine.Def_Effect_Metal:PlayerControl.GetMetal(curPlayer),
                             ShareDefine.Def_Effect_Wood:PlayerControl.GetWood(curPlayer),
@@ -2153,15 +2154,16 @@
             break
     if activeSkillLV > updSkillLV:
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SkillElementLV % skillTypeID, updSkillLV)
+        isNotify = True
     updSkillLV = min(updSkillLV, activeSkillLV) #不可超过激活的等级
     skillManager = curPlayer.GetSkillManager()
     curSkill = skillManager.FindSkillBySkillTypeID(skillTypeID)
     curSkillLV = curSkill.GetSkillLV() if curSkill else 0
     #GameWorld.DebugLog('更新专精技能生效的等级 skillTypeID=%s,curSkillLV=%s,activeSkillLV=%s,updSkillLV=%s'%(skillTypeID, curSkillLV, activeSkillLV, updSkillLV))
     if not isChangeLV:
-        return
+        return isNotify, hasChangeLV
     if updSkillLV == curSkillLV:
-        return
+        return isNotify, hasChangeLV
     elif updSkillLV < curSkillLV:
         skillManager.DeleteSkillBySkillTypeID(skillTypeID)
         for _ in xrange(updSkillLV):
@@ -2170,10 +2172,11 @@
             ipyData = IpyGameDataPY.GetIpyGameData('SkillElement', skillTypeID)
             mainSkillID = ipyData.GetMainSkillID()
             PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SkillElementID % mainSkillID, 0)
+            isNotify = True
     else:
         for _ in xrange(updSkillLV-curSkillLV):
             skillManager.LVUpSkillBySkillTypeID(skillTypeID)
-    return True
+    return isNotify, True
 
 def RefreshElementSkillByAttr(curPlayer, attrIDList):
     #加点、丹药、境界、洗点 会影响灵根点
@@ -2198,9 +2201,12 @@
             needRefreshSkillIDDict[curElementSkillID] = curSelectSkillID == curElementSkillID
     
     #GameWorld.DebugLog('属性点变更 刷新专精attrIDList=%s,needRefreshSkillIDList=%s'%(attrIDList,needRefreshSkillIDList))
-    isRefresh = False
+    needNotify, isRefresh = False, False
     for skillID, isChangeLV in needRefreshSkillIDDict.items():
-        if RefreshElementSkill(curPlayer, skillID, isChangeLV):
+        isNotify, hasChangeLV = RefreshElementSkill(curPlayer, skillID, isChangeLV)
+        if isNotify:
+            needNotify = True
+        if hasChangeLV:
             isRefresh = True
     if isRefresh:
         # 重刷被动技能
@@ -2209,7 +2215,8 @@
         curControl = PlayerControl.PlayerControl(curPlayer)
         curControl.RefreshAllSkill()
         curControl.RefreshPlayerAttrState()
-    NotifyElementSkillInfo(curPlayer)
+    if needNotify:
+        NotifyElementSkillInfo(curPlayer)
     return
 
 def GetElementSkillCnt(curPlayer, mainSkillIDList, activeLV, elementType=0):

--
Gitblit v1.8.0