From b8db02d69c95fa1f94e304ab6a7714c54517a9e0 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 09 八月 2019 03:39:18 +0800
Subject: [PATCH] 8197 【主干】【后端】莲台合成分解功能
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py | 10 +--
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py | 28 ++++++++-
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py | 1
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py | 139 +++++++++++++++++++++++++++++++++++++++++++---
ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py | 1
5 files changed, 160 insertions(+), 19 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
index dad96f2..54f26cf 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -1278,6 +1278,7 @@
Def_IudetWingMaterialItemCount = 29 # 翅膀精炼材料个数列表
Def_IudetDogzEquipPlus = 31 # 神兽装备强化信息列表 [强化等级, 累计总熟练度]
Def_IudetItemDecompound = 33 # 拆解返还物品列表 [装备ID,材料1ID,个数,是否绑定,材料2ID,个数,是否绑定,...]
+Def_IudetAddSkillItemID = 35 # 可添加的技能物品ID列表 [itemID, itemID, ...], 这里记物品ID防止物品ID对应技能修改后导致需要处理已经生成的物品问题
Def_IudetItemColor = 16 # 物品颜色,如果该值没有就取物品
Def_IudetItemCount = 18 # 物品个数,支持20亿,目前仅特殊转化物品会用到
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py
index b23d775..b71feb3 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py
@@ -136,16 +136,17 @@
itemExpireTime = 0
wingItemExpInfo = None #材料翅膀精炼信息
dogzEquipPlusExp = 0 #神兽装备强化熟练度
+ liantaiInfo = None #莲台相关信息
# 检查不固定消耗道具
if unfixedItemIDList:
unfixedItem = GameWorld.GetGameData().GetItemByTypeID(unfixedItemIDList[0])
if not unfixedItem:
return
- unfixedItemCostInfo = __CheckUnfixedItem(playerID, compoundID, makeItemData, itemPack, unfixedItemIndexList,
+ unfixedItemCostInfo = __CheckUnfixedItem(curPlayer, compoundID, makeItemData, itemPack, unfixedItemIndexList,
unfixedItemIDList, needUnfixedItemCount)
if not unfixedItemCostInfo:
return
- unfixedItemCostList, wingItemExpInfo, dogzEquipPlusExp, expireTime = unfixedItemCostInfo
+ unfixedItemCostList, wingItemExpInfo, dogzEquipPlusExp, expireTime, liantaiInfo = unfixedItemCostInfo
if expireTime:
itemExpireTime = expireTime if not itemExpireTime else min(itemExpireTime, expireTime)
@@ -184,6 +185,9 @@
{ChConfig.Def_Cost_Reason_SonKey:makeItemID, "CompoundCount":compoundCnt})
drDict = {"CompoundID":compoundID, "MakeItemID":makeItemID, "CompoundCount":compoundCnt, "itemExpireTime":itemExpireTime, "PackType":packType}
+ if liantaiInfo:
+ drDict["LiantaiInfo"] = liantaiInfo
+
makeItemBind = False
# 扣不固定消耗物品
@@ -255,6 +259,8 @@
canHappen = randValue <= totalSuccRate
GameWorld.DebugLog("canHappen=%s,randValue=%s,totalSuccRate=%s,maxRateValue=%s"
% (canHappen, randValue, totalSuccRate, maxRateValue), playerID)
+ if drDict:
+ DataRecordPack.SendEventPack("ItemCompound_Liantai", drDict, curPlayer)
# 不是百分百成功的记录合成流向
if successRate != maxRateValue:
drDict = {"PlayerID":curPlayer.GetPlayerID(), "AccID":curPlayer.GetAccID(), "ID":compoundID, "MakeItemID":makeItemID, "IsSuccess":canHappen,
@@ -265,7 +271,7 @@
if canHappen:
GameWorld.DebugLog("合成成功: makeItemID=%s,compoundCnt=%s,compoundBindCnt=%s,itemExpireTime=%s" % (makeItemID, compoundCnt, compoundBindCnt, itemExpireTime), playerID)
- userData = GiveNewCompoundItem(curPlayer, packType, makeItemID, compoundCnt, compoundBindCnt, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, itemExpireTime)
+ userData = GiveNewCompoundItem(curPlayer, packType, makeItemID, compoundCnt, compoundBindCnt, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, itemExpireTime, liantaiInfo)
msgMark = ipyData.GetSysMark()
paramType = ipyData.GetSysMarkParamType()
@@ -302,7 +308,7 @@
return
-def __CheckUnfixedItem(playerID, compoundID, makeItemData, itemPack, unfixedItemIndexList, unfixedItemIDList, needUnfixedItemCount):
+def __CheckUnfixedItem(curPlayer, compoundID, makeItemData, itemPack, unfixedItemIndexList, unfixedItemIDList, needUnfixedItemCount):
## 检查不固定消耗道具, 只要客户端提交的数据有不符合要求的,则直接返回 None
expireTime = 0
wingItemExpInfo = None
@@ -310,6 +316,11 @@
unfixedItemTotalCount = 0
unfixedItemCostList = [[], []] # [[绑定索引], [非绑定索引]]
maxPackCount = itemPack.GetCount()
+ playerID = curPlayer.GetPlayerID()
+ makeItemID = makeItemData.GetItemTypeID()
+ liantaiDecomposeIDCount, liantaiComposeMakeID, liantaiComposeAllItemIDList, liantaiLegendAttrList, liantaiComposeSkillIDList = 0, 0, [], [], []
+ liantaiDecomposeID = IpyGameDataPY.GetFuncCfg("ComposeLiantai", 1) # 合成莲台碎片ID
+ liantaiComposePreIDList = IpyGameDataPY.GetFuncEvalCfg("ComposeLiantai", 2) # 合并莲台预览ID
for index in unfixedItemIndexList:
if index >= maxPackCount:
GameWorld.Log("该物品格子索引不存在!无法合成!index=%s,maxPackCount=%s" % (index, maxPackCount), playerID)
@@ -346,13 +357,95 @@
dogzEquipPlusExp += (baseExp + plusExp)
GameWorld.DebugLog(" 神兽合成材料: index=%s,itemID=%s,baseExp=%s,plusExp=%s" % (index, itemID, baseExp, plusExp))
+ #合成莲台碎片
+ if makeItemID == liantaiDecomposeID:
+ liantaiDecomposeIDCount += __GetLiantaiDecomposeIDCount(curItem)
+ #合并莲台
+ elif makeItemID in liantaiComposePreIDList:
+ itemSkillIDList = ItemCommon.GetItemSkillIDList(curItem)
+ for skillID in itemSkillIDList:
+ if skillID in liantaiComposeSkillIDList:
+ GameWorld.Log("合成莲台技能ID重复,无法合成! skillID=%s" % (skillID), playerID)
+ PlayerControl.NotifyCode(curPlayer, "CompoundLiantaiSkillRep", [skillID])
+ return
+ liantaiComposeSkillIDList.append(skillID)
+
+ liantaiComposeMakeID, liantaiLegendAttrList = __GetLiantaiComposeInfo(liantaiComposeMakeID, liantaiComposeAllItemIDList, curItem)
+
if unfixedItemTotalCount < needUnfixedItemCount:
GameWorld.Log("不固定消耗道具不足,无法合成!ID=%s,unfixedItemIDList=%s,needUnfixedItemCount=%s > unfixedItemTotalCount=%s"
% (compoundID, unfixedItemIDList, needUnfixedItemCount, unfixedItemTotalCount), playerID)
return
- return unfixedItemCostList, wingItemExpInfo, dogzEquipPlusExp, expireTime
+ liantaiInfo = [liantaiDecomposeIDCount, liantaiComposeMakeID, liantaiComposeAllItemIDList, liantaiLegendAttrList, liantaiComposeSkillIDList]
+ return unfixedItemCostList, wingItemExpInfo, dogzEquipPlusExp, expireTime, liantaiInfo
+def __GetLiantaiDecomposeIDCount(curItem):
+ ## 获取合成莲台碎片个数
+ decCountTotal = 0
+ decItemIDList = [curItem.GetItemTypeID()]
+ for i in xrange(curItem.GetUserAttrCount(ShareDefine.Def_IudetAddSkillItemID)):
+ itemID = curItem.GetUserAttrByIndex(ShareDefine.Def_IudetAddSkillItemID, i)
+ if itemID not in decItemIDList:
+ decItemIDList.append(itemID)
+ liantaiDecomposeIDCountDict = IpyGameDataPY.GetFuncEvalCfg("ComposeLiantai", 3, {})
+ for itemID in decItemIDList:
+ for itemIDTuple, decCount in liantaiDecomposeIDCountDict.items():
+ if itemID in itemIDTuple:
+ decCountTotal += decCount
+ return decCountTotal
+
+def __GetLiantaiComposeInfo(liantaiComposeMakeID, liantaiComposeAllItemIDList, curItem):
+ ## 获取合成莲台的目标物品ID
+ curItemID = curItem.GetItemTypeID()
+ gameData = GameWorld.GetGameData()
+
+ # 所有合成的莲台ID
+ if curItemID not in liantaiComposeAllItemIDList:
+ liantaiComposeAllItemIDList.append(curItemID)
+ for i in xrange(curItem.GetUserAttrCount(ShareDefine.Def_IudetAddSkillItemID)):
+ itemID = curItem.GetUserAttrByIndex(ShareDefine.Def_IudetAddSkillItemID, i)
+ if itemID not in liantaiComposeAllItemIDList:
+ liantaiComposeAllItemIDList.append(itemID)
+
+ # 获取合成目标莲台ID
+ if not liantaiComposeMakeID:
+ liantaiComposeMakeID = curItemID
+ else:
+ makeLiantaiItemData = gameData.GetItemByTypeID(liantaiComposeMakeID)
+ if makeLiantaiItemData:
+ makeName = makeLiantaiItemData.GetName()
+ curName = curItem.GetName()
+ makeNameIndex, curNameIndex = 0, 0
+ namePriorityList = IpyGameDataPY.GetFuncEvalCfg("ComposeLiantai", 4)
+ for i, nameP in enumerate(namePriorityList):
+ if nameP in makeName:
+ makeNameIndex = i
+ if nameP in curName:
+ curNameIndex = i
+ if curNameIndex > makeNameIndex:
+ liantaiComposeMakeID = curItemID
+
+ # 额外莲台传奇属性
+ liantaiLegendAttrList = []
+ for itemID in liantaiComposeAllItemIDList:
+ if itemID == liantaiComposeMakeID:
+ # 目标莲台不加入额外传奇属性
+ continue
+ itemData = gameData.GetItemByTypeID(itemID)
+ if not itemData:
+ continue
+
+ for effIndex in xrange(itemData.GetEffectCount()):
+ curEff = itemData.GetEffectByIndex(effIndex)
+ effID = curEff.GetEffectID()
+ if effID == 0:
+ break
+ liantaiLegendAttrList.append([effID, curEff.GetEffectValue(0)])
+ # 支持多属性,按属性ID、数值排序
+ if liantaiLegendAttrList:
+ liantaiLegendAttrList.sort(reverse=True)
+ return liantaiComposeMakeID, liantaiLegendAttrList
def __CheckFixedItem(playerID, compoundID, itemPack, fixedItemIndexList, fixedItemIDList, fixedItemCountList, compoundCnt):
## 检查固定消耗道具, 只要客户端提交的数据有不符合要求的,则直接返回 None
@@ -606,20 +699,29 @@
# @param newItem: 新物品
# @param itemCount: 合成数量
# @return None
-def GiveNewCompoundItem(curPlayer, packType, newItemID, itemCount, compoundBindCnt, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, itemExpireTime):
+def GiveNewCompoundItem(curPlayer, packType, newItemID, itemCount, compoundBindCnt, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, itemExpireTime, liantaiInfo):
compoundUnBindCnt = itemCount - compoundBindCnt
if compoundBindCnt > 0:
- userData = __GivePlayerCompoundItem(curPlayer, packType, newItemID, compoundBindCnt, True, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, itemExpireTime)
+ userData = __GivePlayerCompoundItem(curPlayer, packType, newItemID, compoundBindCnt, True, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, itemExpireTime, liantaiInfo)
if compoundUnBindCnt > 0:
- userData = __GivePlayerCompoundItem(curPlayer, packType, newItemID, compoundUnBindCnt, False, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, itemExpireTime)
+ userData = __GivePlayerCompoundItem(curPlayer, packType, newItemID, compoundUnBindCnt, False, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, itemExpireTime, liantaiInfo)
if not userData:
return ""
return userData
-def __GivePlayerCompoundItem(curPlayer, packType, newItemID, itemCount, isBind, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, expireTime):
+def __GivePlayerCompoundItem(curPlayer, packType, newItemID, itemCount, isBind, wingItemExpInfo, dogzEquipPlusExp, decompoundItemInfo, expireTime, liantaiInfo):
playerID = curPlayer.GetPlayerID()
+ if liantaiInfo:
+ liantaiDecomposeIDCount, liantaiComposeMakeID, liantaiComposeAllItemIDList, liantaiLegendAttrList, liantaiComposeSkillIDList = liantaiInfo
+ if liantaiDecomposeIDCount:
+ itemCount = liantaiDecomposeIDCount
+ GameWorld.DebugLog("分解莲台碎片总个数: %s" % liantaiDecomposeIDCount, playerID)
+ if liantaiComposeMakeID:
+ newItemID = liantaiComposeMakeID
+ GameWorld.DebugLog("莲台合成目标莲台物品ID: %s, 所有莲台ID: %s, 额外传奇属性: %s, 所有技能ID: %s" \
+ % (liantaiComposeMakeID, liantaiComposeAllItemIDList, liantaiLegendAttrList, liantaiComposeSkillIDList), playerID)
curSingleItem = ItemControler.GetOutPutItemObj(newItemID, itemCount, False, expireTime, curPlayer=curPlayer)
if not curSingleItem:
GameWorld.ErrLog("创造物品失败, give item itemid:%s,count:%s" % (newItemID, itemCount), playerID)
@@ -657,12 +759,31 @@
curSingleItem.AddUserAttr(ShareDefine.Def_IudetItemDecompound, decompoundValue)
GameWorld.Log("保存可拆解装备拆解物品信息: %s" % decompoundItemInfo, playerID)
+ # 莲台属性
+ if liantaiInfo:
+ if liantaiComposeAllItemIDList:
+ curSingleItem.ClearUserAttr(ShareDefine.Def_IudetAddSkillItemID)
+ for liantaiItemID in liantaiComposeAllItemIDList:
+ curSingleItem.AddUserAttr(ShareDefine.Def_IudetAddSkillItemID, liantaiItemID)
+
+ if liantaiLegendAttrList:
+ curSingleItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrID)
+ curSingleItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValue)
+ for liantaiLegAttrID, liantaiLegAttrValue in liantaiLegendAttrList:
+ curSingleItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrID, liantaiLegAttrID)
+ curSingleItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValue, liantaiLegAttrValue)
+
+ ItemCommon.MakeEquipGS(curSingleItem)
+
userData = curSingleItem.GetUserData()
if not ItemControler.PlayerItemControler(curPlayer).PutInItem(packType, curSingleItem, event=[ChConfig.ItemGive_ItemCompound, False, {}]):
GameWorld.ErrLog("给合成物品失败, give item itemid:%s,count:%s" % (newItemID, itemCount), playerID)
curSingleItem.Clear()
return
+ if liantaiInfo and liantaiDecomposeIDCount:
+ PlayerControl.NotifyCode(curPlayer, "DecompoundLiantai", [liantaiDecomposeIDCount, newItemID])
+
return userData
def __SendDogzEquipRemainExpMail(playerID, remainExp, isSucc):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py
index e7341ce..d8bf528 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py
@@ -138,6 +138,28 @@
return addSkillList
+def GetItemSkillIDList(curItem):
+ ## 获取物品可添加的技能ID列表
+ addSkillIDList = []
+ gameData = GameWorld.GetGameData()
+ for i in xrange(curItem.GetUserAttrCount(ShareDefine.Def_IudetAddSkillItemID)):
+ itemID = curItem.GetUserAttrByIndex(ShareDefine.Def_IudetAddSkillItemID, i)
+ itemData = gameData.GetItemByTypeID(itemID)
+ if not itemData:
+ continue
+ for i in xrange(itemData.GetAddSkillCount()):
+ skillID = itemData.GetAddSkill(i)
+ if skillID == 0:
+ break
+ addSkillIDList.append(skillID)
+ if not addSkillIDList:
+ for i in xrange(curItem.GetAddSkillCount()):
+ skillID = curItem.GetAddSkill(i)
+ if skillID == 0:
+ break
+ addSkillIDList.append(skillID)
+ return addSkillIDList
+
#---------------------------------------------------------------------
## 物品xml参数
# @param curItem 物品
@@ -394,10 +416,8 @@
gsValueEx = 0
skillGSDict = IpyGameDataPY.GetFuncCfg("EquipGSFormula", 4)
- for i in xrange(curItem.GetAddSkillCount()):
- addSkillID = curItem.GetAddSkill(i)
- if not addSkillID:
- break
+ itemSkillIDList = GetItemSkillIDList(curItem)
+ for addSkillID in itemSkillIDList:
gsValueEx += skillGSDict.get(str(addSkillID), 0)
itemID = curItem.GetItemTypeID()
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index dad96f2..54f26cf 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -1278,6 +1278,7 @@
Def_IudetWingMaterialItemCount = 29 # 翅膀精炼材料个数列表
Def_IudetDogzEquipPlus = 31 # 神兽装备强化信息列表 [强化等级, 累计总熟练度]
Def_IudetItemDecompound = 33 # 拆解返还物品列表 [装备ID,材料1ID,个数,是否绑定,材料2ID,个数,是否绑定,...]
+Def_IudetAddSkillItemID = 35 # 可添加的技能物品ID列表 [itemID, itemID, ...], 这里记物品ID防止物品ID对应技能修改后导致需要处理已经生成的物品问题
Def_IudetItemColor = 16 # 物品颜色,如果该值没有就取物品
Def_IudetItemCount = 18 # 物品个数,支持20亿,目前仅特殊转化物品会用到
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py
index 11f418e..133c3e2 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py
@@ -40,6 +40,7 @@
import NPCCommon
import PetControl
import QuestCommon
+import ItemCommon
GameWorld.ImportAll("Script\\Skill\\", "PassiveBuff")
@@ -1683,12 +1684,9 @@
#无技能
continue
- for j in xrange(curEquip.GetAddSkillCount()):
- skillID = curEquip.GetAddSkill(j)
- if skillID == 0:
- break
-
- skillsDict[skillID] = skillsDict.get(skillID, 0) + 1
+ itemSkillIDList = ItemCommon.GetItemSkillIDList(curEquip)
+ for skillID in itemSkillIDList:
+ skillsDict[skillID] = skillsDict.get(skillID, 0) + 1
return skillsDict
--
Gitblit v1.8.0