From 80cec3121d7ea24123404d2b0dc95c603b780bcd Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期一, 20 五月 2019 21:40:52 +0800
Subject: [PATCH] 6603 【后端】【2.0】增加新版的sp和被动技能
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAttrFruit.py | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 102 insertions(+), 14 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 21f344f..222001d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAttrFruit.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAttrFruit.py
@@ -39,6 +39,7 @@
import PlayerPet
import PlayerRefineStove
import PlayerSuccess
+import SkillShell
(
Def_LimitType_Cnt, # 按个数限制
@@ -98,7 +99,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:
@@ -121,6 +122,7 @@
if totalMoney:
addDataDict = {"recycleItemList":recycleItemList}
PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_Danjing, totalMoney, ChConfig.Def_GiveMoney_UseItem, addDataDict)
+ curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitRecycleAttrFruit, 1)
return
@@ -194,11 +196,10 @@
Sync_AttrFruitEatCnt(curPlayer, [itemID])
# 增加属性
- __AddFruitAttr(curPlayer, itemID, funcIndex, addValue)
+ attrIDList = __AddFruitAttr(curPlayer, itemID, funcIndex, addValue)
# 刷新属性
__RefreshAttr(curPlayer, funcIndex)
-
return True, hasUseCnt
## 玩家使用属性果实
@@ -215,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)
@@ -262,7 +263,21 @@
if hasUseCnt <= 0:
return DefaultReturn
PlayerControl.NomalDictSetProperty(curPlayer, eatCntKey, eatCnt)
-
+ if funcIndex == ShareDefine.Def_AttrFruitFunc_Stove:
+ PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_UseStoveBylv, hasUseCnt, [item.GetLV()])
+
+ effect = item.GetEffectByIndex(0)
+ effID = effect.GetEffectID()
+ ## 特殊属性ID处理,此属性ID做一次性处理,不做属性计算
+ if effID == ShareDefine.Def_Effect_FreePoint:
+ effValue = effect.GetEffectValue(0)
+ addFreePoint = effValue * hasUseCnt
+ freePoint = curPlayer.GetFreePoint()
+ updFreePoint = freePoint + addFreePoint
+ curPlayer.SetFreePoint(updFreePoint)
+ GameWorld.DebugLog("丹药增加自由属性点: freePoint=%s,addFreePoint=%s(%s*%s),updFreePoint=%s"
+ % (freePoint, addFreePoint, effValue, hasUseCnt, updFreePoint))
+
ItemCommon.DelItem(curPlayer, item, hasUseCnt, True, ChConfig.ItemDel_AttrFruit)
return addValue, hasUseCnt
@@ -286,22 +301,31 @@
def __AddFruitAttr(curPlayer, fruitItemID, funcIndex, addValue):
if addValue < 1:
- return
+ return []
itemData = GameWorld.GetGameData().GetItemByTypeID(fruitItemID)
if not itemData:
- return
+ return []
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))
+ attrIDList = []
for i in range(itemData.GetEffectCount()):
curEffect = itemData.GetEffectByIndex(i)
effectID = curEffect.GetEffectID()
- if not effectID or effectID not in ChConfig.ItemEffect_AttrDict:
+ if not effectID or effectID not in ChConfig.ItemEffect_AttrDict or effectID == ShareDefine.Def_Effect_FreePoint:
continue
-
+ attrIDList.append(effectID)
attrKey = ChConfig.Def_PlayerKey_FruitAttr % (funcIndex, effectID)
curValue = curPlayer.GetDictByKey(attrKey)
effValueA = curEffect.GetEffectValue(0)
@@ -314,7 +338,7 @@
curPlayer.SetDict(attrKey, updValue)
GameWorld.DebugLog(" Add funcIndex=%s,effID=%s,curValue=%s,effA=%s,effB=%s,count=%s,updV=%s"
% (funcIndex, effectID, curValue, effValueA, effValueB, addValue, updValue))
- return
+ return attrIDList
## 加载果实增加的属性缓存,一般是登录或切地图后
# @param curPlayer
@@ -366,8 +390,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
## 统计百分比属性对功能内层的属性增加
@@ -433,7 +458,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)
@@ -465,3 +490,66 @@
return eatCntDict
+def IsFruitEatFull(curPlayer, itemID):
+ #使用次数是否已满
+ maxEatCnt = GetMaxEatCnt(curPlayer, itemID)
+ eatCntKey = ChConfig.Def_PDict_AttrFruitEatCnt % itemID
+ limitType = Def_LimitType_Cnt
+ if limitType == Def_LimitType_Attr:
+ eatCntKey = ChConfig.Def_PDict_AttrFruitAddValue % itemID
+ eatCnt = curPlayer.NomalDictGetProperty(eatCntKey) # 已吃次数/属性值
+ if eatCnt >= maxEatCnt:
+ return True
+ 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