From d70324d5963b2c4832f3696e08825999b3848822 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期三, 07 十一月 2018 16:05:45 +0800
Subject: [PATCH] 2306 【1.2】【BUG】老号的封魔之魂次数满了无法领取

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py
index 8108289..3912890 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py
@@ -939,6 +939,9 @@
         multiple = 1 #倍数
         if singleValue:
             gotValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulGotValue % privilege)
+            maxValue = privilegeIpyData.GetMaxValue()
+            if maxValue:
+                gotValue = min(maxValue, gotValue)
             multiple = gotValue/singleValue
         for attid, attnum in attrInfo.items():
             addAttr[int(attid)] = attnum * multiple
@@ -970,14 +973,19 @@
         GameWorld.DebugLog('领取法宝之魂奖励,对应法宝之魂未激活,或未配置 privilege=%s'%privilege)
         return
     singleValue = ipyData.GetSingleValue()
+    maxValue = ipyData.GetMaxValue()
     if singleValue:
         #达到进度则可领取属性
         curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulCurValue % privilege)
         gotValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulGotValue % privilege)
+        if gotValue >= curValue:
+            return
         canGetCnt = (curValue - gotValue) / singleValue
+        if canGetCnt <= 0 and maxValue and curValue >= maxValue:
+            canGetCnt = 1 #已达到次数上限,最后一次不管是否满足都让领(一般是因为配置错误或者变更导致)
         if canGetCnt <= 0:
             return
-        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MWSoulGotValue % privilege, gotValue+canGetCnt*singleValue)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MWSoulGotValue % privilege, min(maxValue, gotValue+canGetCnt*singleValue))
         CalcMagicWeaponSoulAttr(curPlayer)
         PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
         

--
Gitblit v1.8.0