Add: 2772 【后端】神兽合成功能; 神兽装备传奇属性条数、数值、评分配置区别与角色装备;
| | |
| | | import ChConfig
|
| | | import PlayerSuccess
|
| | | import PlayerWing
|
| | | import PlayerDogz
|
| | |
|
| | | import random
|
| | | import math
|
| | |
| | |
|
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | wingItemExpInfo = None #材料翅膀精炼信息
|
| | | dogzEquipPlusExp = 0 #神兽装备强化熟练度
|
| | | # 检查不固定消耗道具
|
| | | if unfixedItemIDList:
|
| | | unfixedItemCostInfo = __CheckUnfixedItem(playerID, compoundID, makeItemData, itemPack, unfixedItemIndexList, |
| | | unfixedItem = GameWorld.GetGameData().GetItemByTypeID(unfixedItemIDList[0])
|
| | | if not unfixedItem:
|
| | | return
|
| | | if ItemCommon.GetIsDogzEquip(unfixedItem):
|
| | | unfixedItemPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptDogzItem)
|
| | | else:
|
| | | unfixedItemPack = itemPack
|
| | | unfixedItemCostInfo = __CheckUnfixedItem(playerID, compoundID, makeItemData, unfixedItemPack, unfixedItemIndexList, |
| | | unfixedItemIDList, needUnfixedItemCount)
|
| | | if not unfixedItemCostInfo:
|
| | | return
|
| | | unfixedItemCostList, wingItemExpInfo = unfixedItemCostInfo
|
| | | unfixedItemCostList, wingItemExpInfo, dogzEquipPlusExp = unfixedItemCostInfo
|
| | |
|
| | | # 检查固定消耗道具
|
| | | if fixedItemIDList:
|
| | |
| | | # 扣不固定消耗物品
|
| | | if unfixedItemIDList:
|
| | | bindUnfixedIndexList, unbindUnfixedIndexList = unfixedItemCostList
|
| | | hasBind = ItemCommon.ReduceItem(curPlayer, itemPack, bindUnfixedIndexList + unbindUnfixedIndexList, needUnfixedItemCount, |
| | | hasBind = ItemCommon.ReduceItem(curPlayer, unfixedItemPack, bindUnfixedIndexList + unbindUnfixedIndexList, needUnfixedItemCount, |
| | | False, ChConfig.ItemDel_ItemCompound, drDict)
|
| | | makeItemBind = True if hasBind else makeItemBind
|
| | |
|
| | |
| | | # 合成成功
|
| | | if GameWorld.CanHappen(totalSuccRate, ShareDefine.Def_MaxRateValue):
|
| | | GameWorld.DebugLog("合成成功: makeItemID=%s,compoundCnt=%s,compoundBindCnt=%s" % (makeItemID, compoundCnt, compoundBindCnt), playerID)
|
| | | GiveNewCompoundItem(curPlayer, makeItemID, compoundCnt, compoundBindCnt, wingItemExpInfo, msgMark)
|
| | | GiveNewCompoundItem(curPlayer, makeItemID, compoundCnt, compoundBindCnt, wingItemExpInfo, dogzEquipPlusExp, msgMark)
|
| | | #成功合成1个物品成就
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_CompoundItemEx, compoundCnt, [makeItemID])
|
| | | #合成X阶X颜色X星级以上装备
|
| | |
| | | # 合成失败
|
| | | else:
|
| | | GameWorld.DebugLog("合成失败!")
|
| | | __SendDogzEquipRemainExpMail(playerID, dogzEquipPlusExp, False)
|
| | | ItemCommon.SyncMakeItemAnswer(curPlayer, ShareDefine.Def_mitItemCompound, ChConfig.Def_ComposeState_Fail, 0)
|
| | | #curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitItemCompound, ChConfig.Def_ComposeState_Fail)
|
| | |
|
| | |
| | | def __CheckUnfixedItem(playerID, compoundID, makeItemData, itemPack, unfixedItemIndexList, unfixedItemIDList, needUnfixedItemCount):
|
| | | ## 检查不固定消耗道具, 只要客户端提交的数据有不符合要求的,则直接返回 None
|
| | | wingItemExpInfo = None
|
| | | dogzEquipPlusExp = 0
|
| | | unfixedItemTotalCount = 0
|
| | | unfixedItemCostList = [[], []] # [[绑定索引], [非绑定索引]]
|
| | | maxPackCount = itemPack.GetCount()
|
| | |
| | | #记录翅膀精炼值
|
| | | if curItem.GetType() == ChConfig.Def_ItemType_retWing:
|
| | | wingItemExpInfo = PlayerWing.GetWingItemChangeExp(curItem, ItemCommon.GetItemClassLV(makeItemData))
|
| | | |
| | | elif ItemCommon.GetIsDogzEquip(curItem):
|
| | | equipExpEff = ItemCommon.GetItemEffectByEffectID(curItem, ChConfig.Def_Effect_DogzEquipPlusExp)
|
| | | baseExp = 0 if not equipExpEff else equipExpEff.GetEffectValue(0)
|
| | | plusExp = curItem.GetUserAttrByIndex(ShareDefine.Def_IudetDogzEquipPlus, 1)
|
| | | dogzEquipPlusExp += (baseExp + plusExp)
|
| | | GameWorld.DebugLog(" 神兽合成材料: index=%s,itemID=%s,baseExp=%s,plusExp=%s" % (index, itemID, baseExp, plusExp))
|
| | | |
| | | if unfixedItemTotalCount < needUnfixedItemCount:
|
| | | GameWorld.Log("不固定消耗道具不足,无法合成!ID=%s,unfixedItemIDList=%s,needUnfixedItemCount=%s > unfixedItemTotalCount=%s"
|
| | | % (compoundID, unfixedItemIDList, needUnfixedItemCount, unfixedItemTotalCount), playerID)
|
| | | return
|
| | |
|
| | | return unfixedItemCostList, wingItemExpInfo
|
| | | return unfixedItemCostList, wingItemExpInfo, dogzEquipPlusExp
|
| | |
|
| | |
|
| | | def __CheckFixedItem(playerID, compoundID, itemPack, fixedItemIndexList, fixedItemIDList, fixedItemCountList, compoundCnt):
|
| | |
| | | # @param newItem: 新物品
|
| | | # @param itemCount: 合成数量
|
| | | # @return None
|
| | | def GiveNewCompoundItem(curPlayer, newItemID, itemCount, compoundBindCnt, wingItemExpInfo, msgMark):
|
| | | def GiveNewCompoundItem(curPlayer, newItemID, itemCount, compoundBindCnt, wingItemExpInfo, dogzEquipPlusExp, msgMark):
|
| | | compoundUnBindCnt = itemCount - compoundBindCnt
|
| | |
|
| | | if compoundBindCnt > 0:
|
| | | userData = __GivePlayerCompoundItem(curPlayer, newItemID, compoundBindCnt, True, wingItemExpInfo)
|
| | | userData = __GivePlayerCompoundItem(curPlayer, newItemID, compoundBindCnt, True, wingItemExpInfo, dogzEquipPlusExp)
|
| | | if compoundUnBindCnt > 0:
|
| | | userData = __GivePlayerCompoundItem(curPlayer, newItemID, compoundUnBindCnt, False, wingItemExpInfo)
|
| | | userData = __GivePlayerCompoundItem(curPlayer, newItemID, compoundUnBindCnt, False, wingItemExpInfo, dogzEquipPlusExp)
|
| | |
|
| | | if userData == None:
|
| | | return
|
| | |
| | | #curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitItemCompound, ChConfig.Def_ComposeState_Sucess)
|
| | | return True
|
| | |
|
| | | def __GivePlayerCompoundItem(curPlayer, newItemID, itemCount, isBind, wingItemExpInfo):
|
| | | def __GivePlayerCompoundItem(curPlayer, newItemID, itemCount, isBind, wingItemExpInfo, dogzEquipPlusExp):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | curSingleItem = ItemControler.GetOutPutItemObj(newItemID, itemCount, isBind)
|
| | | if not curSingleItem:
|
| | |
| | |
|
| | | if wingFinalExp:#继承翅膀精炼值
|
| | | PlayerWing.WingProgressUP(curSingleItem, wingFinalExp, materialItemDict)
|
| | | if dogzEquipPlusExp:#继承神兽装备熟练度
|
| | | dogzEquipLV, dogzEquipExp = PlayerDogz.GetDogzEquipPlusLVExpInfo(curSingleItem.GetItemColor(), curSingleItem.GetEquipPlace(), dogzEquipPlusExp)
|
| | | curSingleItem.AddUserAttr(ShareDefine.Def_IudetDogzEquipPlus, dogzEquipLV)
|
| | | curSingleItem.AddUserAttr(ShareDefine.Def_IudetDogzEquipPlus, dogzEquipExp)
|
| | | remainExp = max(0, dogzEquipPlusExp - dogzEquipExp)
|
| | | GameWorld.DebugLog("合成神兽装备成功, dogzEquipLV=%s,dogzEquipExp=%s,remainExp=%s,总EXP=%s" |
| | | % (dogzEquipLV, dogzEquipExp, remainExp, dogzEquipPlusExp), playerID)
|
| | | __SendDogzEquipRemainExpMail(playerID, remainExp, True)
|
| | | |
| | | userData = curSingleItem.GetUserData()
|
| | | if not ItemControler.PlayerItemControler(curPlayer).PutInItem(IPY_GameWorld.rptItem, curSingleItem,
|
| | | event=[ChConfig.ItemGive_ItemCompound, False, {}]):
|
| | |
| | |
|
| | | return userData
|
| | |
|
| | | def __SendDogzEquipRemainExpMail(playerID, remainExp, isSucc):
|
| | | if not remainExp:
|
| | | return
|
| | | |
| | | expItemID = IpyGameDataPY.GetFuncCfg("DogzAssist", 5)
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(expItemID)
|
| | | if not itemData:
|
| | | return
|
| | | |
| | | effect = ItemCommon.GetItemEffectByEffectID(itemData, ChConfig.Def_Effect_DogzEquipPlusExp)
|
| | | if not effect:
|
| | | GameWorld.ErrLog("神兽装备合成返回熟练度物品ID错误! expItemID=%s,remainExp=%s" % (expItemID, remainExp), playerID)
|
| | | return
|
| | | baseExp = effect.GetEffectValue(0)
|
| | | if not baseExp:
|
| | | GameWorld.ErrLog("神兽装备合成返回熟练度物品ID错误! expItemID=%s,baseExp=%s,remainExp=%s" |
| | | % (expItemID, baseExp, remainExp), playerID)
|
| | | return
|
| | | |
| | | giveItemCount = int(remainExp/baseExp)
|
| | | if giveItemCount <= 0:
|
| | | return
|
| | | |
| | | mailTypeKey = "DogzComposeSuc" if isSucc else "DogzComposeLose"
|
| | | GameWorld.DebugLog("合成神兽装备, 返还强化熟练度=%s,baseExp=%s,expItemID=%s,giveItemCount=%s" |
| | | % (remainExp, baseExp, expItemID, giveItemCount), playerID)
|
| | | |
| | | isBind = 1
|
| | | PlayerControl.SendMailByKey(mailTypeKey, [playerID], [[expItemID, giveItemCount, isBind]])
|
| | | return
|
| | |
|
| | |
| | | itemClassLV = ItemCommon.GetItemClassLV(curItem)
|
| | | itemQuality = curItem.GetItemQuality()
|
| | | key = (itemColor, itemQuality)
|
| | | isDogzEquip = ItemCommon.GetIsDogzEquip(curItem)
|
| | | # {(颜色,星级):[一般属性条数, 追求属性条数, 固定属性条数], ...}
|
| | | legAttrCntDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrCount")
|
| | | if isDogzEquip:
|
| | | #神兽装备条数不一样
|
| | | legAttrCntDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrCount", 2)
|
| | | else:
|
| | | legAttrCntDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrCount")
|
| | | if key not in legAttrCntDict:
|
| | | #GameWorld.DebugLog("该装备品质没有传奇属性: itemColor=%s,itemQuality=%s" % (itemColor, itemQuality))
|
| | | return
|
| | |
| | | curLegAttrIDList = []
|
| | | curLegAttrValueList = []
|
| | | # {属性ID:{颜色:数值, ...}, ...}
|
| | | legAttrValueColorDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByColor")
|
| | | if isDogzEquip:
|
| | | # 神兽装备数值不一样 |
| | | legAttrValueColorDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByColor2")
|
| | | else:
|
| | | legAttrValueColorDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByColor")
|
| | | legAttrValueClassLVDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByClassLV")
|
| | | for attrID in randAttrIDList:
|
| | | if attrID in legAttrValueColorDict:
|
| | |
| | | OnlyFinalHurt = attrDict.get(ShareDefine.Def_Effect_OnlyFinalHurt, 0)
|
| | | PVPAtkBackHP = attrDict.get(ShareDefine.Def_Effect_PVPAtkBackHP, 0)
|
| | |
|
| | | value = eval(FormulaControl.GetCompileFormula("EquipGSFormula", IpyGameDataPY.GetFuncCfg("EquipGSFormula")))
|
| | | if GetIsDogzEquip(curItem):
|
| | | # 神兽装备用不同公式
|
| | | value = eval(FormulaControl.GetCompileFormula("EquipGSFormula3", IpyGameDataPY.GetFuncCfg("EquipGSFormula", 3)))
|
| | | else:
|
| | | value = eval(FormulaControl.GetCompileFormula("EquipGSFormula", IpyGameDataPY.GetFuncCfg("EquipGSFormula")))
|
| | | return value
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
| | | % (equipIndex, curEquip.GetItemTypeID()), playerID)
|
| | | return
|
| | |
|
| | | equipColor = curEquip.GetItemColor()
|
| | | colorPlusMaxLVDict = IpyGameDataPY.GetFuncEvalCfg("DogzAssist", 4) # {颜色:等级上限, ...}
|
| | | if equipColor not in colorPlusMaxLVDict:
|
| | | return
|
| | | maxPlusLV = colorPlusMaxLVDict[equipColor]
|
| | | |
| | | equipPlace = curEquip.GetEquipPlace()
|
| | | curPlusLV = curEquip.GetUserAttrByIndex(ShareDefine.Def_IudetDogzEquipPlus, 0)
|
| | | curPlusExpTotal = curEquip.GetUserAttrByIndex(ShareDefine.Def_IudetDogzEquipPlus, 1)
|
| | | if curPlusLV >= maxPlusLV:
|
| | | GameWorld.Log("神兽装备已满级, 无法强化!equipColor=%s,curPlusLV=%s,maxPlusLV=%s" % (equipColor, curPlusLV, maxPlusLV), playerID)
|
| | | return
|
| | |
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("DogzEquipPlus", equipPlace, curPlusLV)
|
| | | if not ipyData:
|
| | | return
|
| | | curLVUPTotalExp = ipyData.GetPlusLVUPTotalExp()
|
| | | if not curLVUPTotalExp:
|
| | | lvUPTotalExp = ipyData.GetPlusLVUPTotalExp()
|
| | | if not lvUPTotalExp:
|
| | | GameWorld.Log("神兽装备升级所需总经验为0, 无法强化!equipPlace=%s,curPlusLV=%s" % (equipPlace, curPlusLV), playerID)
|
| | | return
|
| | | |
| | | nextLVIpyData = None
|
| | | if curPlusExpTotal >= curLVUPTotalExp:
|
| | | nextLVIpyData = IpyGameDataPY.GetIpyGameDataNotLog("DogzEquipPlus", equipPlace, curPlusLV + 1)
|
| | | if not nextLVIpyData:
|
| | | GameWorld.Log("神兽装备已满级, 无法强化!equipPlace=%s,curPlusLV=%s" % (equipPlace, curPlusLV), playerID)
|
| | | return
|
| | |
|
| | | costGoldTotal = 0
|
| | | addExpTotal = 0
|
| | |
| | | ItemCommon.DelItem(curPlayer, delItem, curItem.GetCount(), False, ChConfig.ItemDel_DogzEquipPlus, infoDict)
|
| | |
|
| | | updPlusLV = curPlusLV
|
| | | if updPlusExpTotal >= curLVUPTotalExp:
|
| | | doCount = 0
|
| | | while nextLVIpyData and updPlusExpTotal >= nextLVIpyData.GetPlusLVUPTotalExp() and doCount < 100:
|
| | | doCount += 1
|
| | | nextLV = updPlusLV + 1
|
| | | nextLVIpyData = IpyGameDataPY.GetIpyGameDataNotLog("DogzEquipPlus", equipPlace, nextLV)
|
| | | if not nextLVIpyData:
|
| | | break
|
| | | updPlusLV = nextLV
|
| | | |
| | | doCount, maxDoCount = 0, maxPlusLV * 2
|
| | | while updPlusExpTotal >= lvUPTotalExp and updPlusLV < maxPlusLV and doCount < maxDoCount:
|
| | | doCount += 1
|
| | | nextLV = updPlusLV + 1
|
| | | nextLVIpyData = IpyGameDataPY.GetIpyGameDataNotLog("DogzEquipPlus", equipPlace, nextLV)
|
| | | if not nextLVIpyData:
|
| | | GameWorld.DebugLog(" 没有下一级数据,不能升级!nextLV=%s" % (nextLV), playerID)
|
| | | break
|
| | | updPlusLV = nextLV
|
| | | lvUPTotalExp = nextLVIpyData.GetPlusLVUPTotalExp()
|
| | | GameWorld.DebugLog(" 升级: equipPlace=%s,maxPlusLV=%s,updPlusLV=%s,updPlusExpTotal=%s,lvUPTotalExp=%s" |
| | | % (equipPlace, maxPlusLV, updPlusLV, updPlusExpTotal, lvUPTotalExp), playerID)
|
| | | |
| | | isRefreshAtrr = False
|
| | | # 未强化过
|
| | | if not curPlusExpTotal:
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def GetDogzEquipPlusLVExpInfo(equipColor, equipPlace, totalExp):
|
| | | ## 获取当前神兽装备最高强化等级的强化熟练度
|
| | | retLV, retExp = 0, 0
|
| | | colorPlusMaxLVDict = IpyGameDataPY.GetFuncEvalCfg("DogzAssist", 4) # {颜色:等级上限, ...}
|
| | | if equipColor not in colorPlusMaxLVDict:
|
| | | return retLV, retExp
|
| | | maxPlusLV = colorPlusMaxLVDict[equipColor]
|
| | | for lv in xrange(maxPlusLV + 1):
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataNotLog("DogzEquipPlus", equipPlace, lv)
|
| | | if lv and not ipyData:
|
| | | break
|
| | | |
| | | lvUPTotalExp = ipyData.GetPlusLVUPTotalExp()
|
| | | if not lvUPTotalExp:
|
| | | break
|
| | | |
| | | if totalExp < lvUPTotalExp:
|
| | | return lv, totalExp
|
| | | retLV, retExp = lv, lvUPTotalExp
|
| | | |
| | | return retLV, retExp
|
| | |
|
| | | def RefreshDogzAttr(curPlayer):
|
| | | ## 刷新神兽属性
|
| | |
|