From ab2158916e07846e4be746673231dac6dfa27fc9 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期四, 18 四月 2019 14:21:24 +0800
Subject: [PATCH] 6528 【后端】【2.0】增加丹药属性
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAttrFruit.py | 82 +++++++++++++++++++++++++++++++++++------
1 files changed, 70 insertions(+), 12 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAttrFruit.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAttrFruit.py
index f92a2e0..5f9e96a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAttrFruit.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAttrFruit.py
@@ -98,7 +98,7 @@
if not ipyData:
continue
- maxEatCnt = ipyData.GetMaxUseCnt()
+ maxEatCnt = GetMaxEatCnt(curPlayer, itemID)
eatCntKey = ChConfig.Def_PDict_AttrFruitEatCnt % itemID
limitType = Def_LimitType_Cnt
if limitType == Def_LimitType_Attr:
@@ -216,7 +216,7 @@
funcIndex = ipyData.GetFuncID()
limitType = Def_LimitType_Cnt
- maxEatCnt = ipyData.GetMaxUseCnt()
+ maxEatCnt = GetMaxEatCnt(curPlayer, itemID)
if funcIndex not in ShareDefine.Def_AttrFruitFuncList:
GameWorld.ErrLog("该属性果实功能未开放!funcIndex=%s"%funcIndex)
@@ -297,7 +297,16 @@
limitType = Def_LimitType_Cnt #默认按个数
-
+
+ # 增加附加战力,仅按个数时有效
+ fightPowerExfigKey = ChConfig.Def_PlayerKey_FruitFightPowerEx % (funcIndex)
+ fightPowerEx = curPlayer.GetDictByKey(fightPowerExfigKey)
+ fruitIpyData = GetAttrFruitIpyData(fruitItemID)
+ addFightPowerEx = 0 if not fruitIpyData else fruitIpyData.GetFightPowerEx()
+ fightPowerEx = fightPowerEx + addFightPowerEx * addValue
+ curPlayer.SetDict(fightPowerExfigKey, fightPowerEx)
+ GameWorld.DebugLog(" Add funcIndex=%s,addFightPowerEx=%s,addValue=%s,fightPowerEx=%s" % (funcIndex, addFightPowerEx, addValue, fightPowerEx))
+
for i in range(itemData.GetEffectCount()):
curEffect = itemData.GetEffectByIndex(i)
effectID = curEffect.GetEffectID()
@@ -369,8 +378,9 @@
#GameWorld.DebugLog(" effectID=%s,addValue=%s" % (effectID, addValue))
PlayerControl.CalcAttrDict_Type(effectID, addValue, allAttrList)
- #GameWorld.DebugLog(" 有果实属性 allAttrList=%s" % str(allAttrList))
- return
+ fightPowerEx = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FruitFightPowerEx % (funcIndex))
+ #GameWorld.DebugLog(" 有果实属性funcIndex=%s,fightPowerEx=%s,allAttrList=%s" % (funcIndex, fightPowerEx, allAttrList))
+ return fightPowerEx
## 统计百分比属性对功能内层的属性增加
@@ -436,7 +446,7 @@
eatCntPack.Clear()
eatCntPack.ItemID = fruitItemID
eatCntPack.EatCnt = curPlayer.NomalDictGetProperty(eatCntKey)
- #eatCntPack.AddAttr = curPlayer.NomalDictGetProperty(addValueKey)
+ eatCntPack.AddItemCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AttrFruitAddItemCnt % fruitItemID)
eatPack.EatCntList.append(eatCntPack)
eatPack.count = len(eatPack.EatCntList)
@@ -470,11 +480,7 @@
def IsFruitEatFull(curPlayer, itemID):
#使用次数是否已满
- ipyData = GetAttrFruitIpyData(itemID)
- if not ipyData:
- return
-
- maxEatCnt = ipyData.GetMaxUseCnt()
+ maxEatCnt = GetMaxEatCnt(curPlayer, itemID)
eatCntKey = ChConfig.Def_PDict_AttrFruitEatCnt % itemID
limitType = Def_LimitType_Cnt
if limitType == Def_LimitType_Attr:
@@ -482,4 +488,56 @@
eatCnt = curPlayer.NomalDictGetProperty(eatCntKey) # 已吃次数/属性值
if eatCnt >= maxEatCnt:
return True
- return
\ No newline at end of file
+ return
+
+def GetMaxEatCnt(curPlayer, itemID):
+ ##获取果实最大可用个数
+ ipyData = GetAttrFruitIpyData(itemID)
+ if not ipyData:
+ return 0
+ maxEatCntDict = ipyData.GetMaxUseCnt()
+ realmLV = curPlayer.GetOfficialRank()
+ orderList = sorted(maxEatCntDict.keys(), reverse=True)
+ maxEatCnt = 0
+ for order in orderList:
+ if realmLV >= order:
+ maxEatCnt = maxEatCntDict[order]
+ break
+ addItemUseCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AttrFruitAddItemCnt % itemID)
+ if addItemUseCnt:
+ addItemInfo = ipyData.GetAddItemInfo()
+ if addItemInfo:
+ singleItemCnt, singleAddCnt = addItemInfo[1:]
+ maxEatCnt += (addItemUseCnt/singleItemCnt*singleAddCnt)
+ return maxEatCnt
+
+
+#// A3 17 增加果实使用上限 #tagCMAddFruitUseLimit
+#
+#struct tagCMAddFruitUseLimit
+#{
+# tagHead Head;
+# DWORD ItemID; //果实物品ID
+#};
+def OnAddFruitUseLimit(index, packData, tick):
+ curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+ itemID = packData.ItemID
+ ipyData = GetAttrFruitIpyData(itemID)
+ if not ipyData:
+ return
+ addItemInfo = ipyData.GetAddItemInfo()
+ if not addItemInfo:
+ return
+ addItemUseCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AttrFruitAddItemCnt % itemID)
+ needItemID, singleItemCnt, singleAddCnt = addItemInfo
+ if addItemUseCnt + singleItemCnt> ChConfig.Def_UpperLimit_DWord:
+ return
+ itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
+ enough, indexList, hasBind, lackCnt = ItemCommon.GetItem_FromPack_ByID_ExEx(needItemID, itemPack, singleItemCnt)
+ if not enough:
+ return
+ ItemCommon.ReduceItem(curPlayer, itemPack, indexList, singleItemCnt, False, "AddFruitUseLimit")
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AttrFruitAddItemCnt % itemID, addItemUseCnt+singleItemCnt)
+
+ Sync_AttrFruitEatCnt(curPlayer, [itemID])
+ return
--
Gitblit v1.8.0