| | |
| | | import IpyGameDataPY
|
| | | import FormulaControl
|
| | | import DataRecordPack
|
| | | import PlayerSuccess
|
| | |
|
| | | g_GatherSoulLVExpDict = {} #经验缓存
|
| | | g_gatherSoulLVAttrDict = {} #属性缓存
|
| | |
| | | exp = eval(IpyGameDataPY.GetFuncCompileCfg('GatherSoulLevelUp'))
|
| | | g_GatherSoulLVExpDict[lv] = exp
|
| | |
|
| | | qualityPerDict = IpyGameDataPY.GetFuncEvalCfg('GatherSoulLevelUp', 2, {})
|
| | | if itemColor in qualityPerDict:
|
| | | exp *= float(qualityPerDict[itemColor])
|
| | |
|
| | | soulGrade = ipyData.GetSoulGrade()
|
| | | exp *= float(IpyGameDataPY.GetFuncEvalCfg('GatherSoulLevelUp', 4, {}).get(soulGrade, 1))
|
| | | qualityPerDict = IpyGameDataPY.GetFuncEvalCfg('GatherSoulLevelUp', 2, {}).get(str(itemData.GetType()), {})
|
| | | if str(itemColor) in qualityPerDict:
|
| | | exp *= float(qualityPerDict[str(itemColor)])
|
| | |
|
| | | attrTypeCnt = len(ipyData.GetAttrType())
|
| | | specialPer = IpyGameDataPY.GetFuncEvalCfg('GatherSoulLevelUp', 3, {}).get(attrTypeCnt, 1)
|
| | | exp *= float(specialPer)
|
| | | return exp
|
| | | |
| | | soulGrade = ipyData.GetSoulGrade()
|
| | | exp *= float(IpyGameDataPY.GetFuncEvalCfg('GatherSoulLevelUp', 5, {}).get(soulGrade, 1))
|
| | | return int(exp)
|
| | |
|
| | |
|
| | | ## 获取聚魂属性数值
|
| | |
| | | RefreshGatherSoulAttr(curPlayer)
|
| | | PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
|
| | | Sync_GatherSoulHoleInfo(curPlayer)
|
| | | DoGatherSoulSuccessLogic(curPlayer)
|
| | | return True
|
| | |
|
| | |
|
| | |
| | | RefreshGatherSoulAttr(curPlayer)
|
| | | PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
|
| | | Sync_GatherSoulHoleInfo(curPlayer)
|
| | | |
| | | DoGatherSoulSuccessLogic(curPlayer)
|
| | | GameWorld.DebugLog("聚魂升级!placeType=%s,placeIndex=%s,GatherSoulData=%s,updGatherSoulData=%s"
|
| | | % (placeType, placeIndex, GatherSoulData, updGatherSoulData), playerID)
|
| | | return
|
| | |
| | | curEff = itemData.GetEffectByIndex(0)
|
| | | soulDust = curEff.GetEffectValue(0)
|
| | | else:
|
| | | |
| | | #先计算升级消耗的材料
|
| | | soulDust = 0
|
| | | for lv in xrange(GatherSoulItemPlusLV + 1):
|
| | | for lv in xrange(1, GatherSoulItemPlusLV + 1):
|
| | | soulDust += GetGatherSoulNeedExp(GatherSoulItemID, lv)
|
| | |
|
| | | #多属性的先拆解成单属性的聚魂
|
| | |
| | | for itemID in soulidList:
|
| | | giveMaterialDict[itemID] = giveMaterialDict.get(itemID, 0) + 1
|
| | | needPackSpace += 1
|
| | | |
| | | if not soulidList and not soulSplinters and not soulCore:
|
| | | #不能拆解的则要算0级的分解
|
| | | soulDust += GetGatherSoulNeedExp(GatherSoulItemID, 0)
|
| | | |
| | |
|
| | | totalSoulSplinters += soulSplinters
|
| | | totalSoulCore += soulCore
|
| | | totalSoulDust += soulDust
|
| | | delPlaceDict[place] = [GatherSoulData, soulidList, int(soulDust), soulSplinters, soulCore]
|
| | |
|
| | | if not delPlaceDict:
|
| | | return
|
| | | if delPlaceDict:
|
| | | ItemCommon.DelVPackItem(curPlayer, packIndex, delPlaceDict.keys(), ChConfig.ItemDel_GatherSoul)
|
| | | addDataDict = {"delPlaceDict":delPlaceDict, "isAuto":isAuto}
|
| | |
| | | PlayerControl.NotifyCode(curPlayer, 'hwj_20170807_1', [totalSoulCore, ShareDefine.TYPE_Price_SoulCore])
|
| | |
|
| | | if giveMaterialDict:
|
| | | emptySpace = ItemCommon.GetItemPackSpace(curPlayer, ShareDefine.rptGatherSoul, 1)
|
| | | emptySpace = ItemCommon.GetItemPackSpace(curPlayer, ShareDefine.rptGatherSoul, needPackSpace)
|
| | | if emptySpace < needPackSpace:
|
| | | giveMaterialList = [[itemID, itemCnt, 1] for itemID, itemCnt in giveMaterialDict.items()]
|
| | | giveMaterialList = [[itemID, itemCnt, 0] for itemID, itemCnt in giveMaterialDict.items()]
|
| | | PlayerControl.SendMailByKey('JHBagFull1', [curPlayer.GetID()], giveMaterialList)
|
| | | else:
|
| | | for itemID, itemCnt in giveMaterialDict.items:
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 1, [ShareDefine.rptGatherSoul])
|
| | | GameWorld.DebugLog("聚魂分解: isAuto=%s,PlaceIndexList=%s, delPlaceDict=%s" % (isAuto, placeList, delPlaceDict))
|
| | | for itemID, itemCnt in giveMaterialDict.items():
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [ShareDefine.rptGatherSoul])
|
| | | GameWorld.DebugLog("聚魂分解: isAuto=%s,PlaceIndexList=%s, delPlaceDict=%s, giveMaterialDict=%s" % (isAuto, placeList, delPlaceDict, giveMaterialDict))
|
| | | if not isAuto:
|
| | | curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitGatherSoulDecompose, 1)
|
| | | return
|
| | |
|
| | |
|
| | | def __GetGatherSoulSplitMaterial(gathersoulID, soulidList=[], soulSplinters=0, soulCore=0):
|
| | | def __GetGatherSoulSplitMaterial(gathersoulID):
|
| | | ##拆解多属性聚魂 返回单属性聚魂ID,材料
|
| | | soulidList, soulSplinters, soulCore= [], 0, 0
|
| | | compoundIpyData = IpyGameDataPY.GetIpyGameDataNotLog('GatherSoulCompound', gathersoulID)
|
| | | if compoundIpyData:
|
| | | materialList = compoundIpyData.GetNeedItem()
|
| | | soulSplinters += compoundIpyData.GetNeedSoulSplinters()
|
| | | soulCore += compoundIpyData.GetNeedSoulCore()
|
| | | for itemID in materialList:
|
| | | soulIpyData = GetGatherSoulIpyData(itemID)
|
| | | if soulIpyData and len(soulIpyData.GetAttrType()) > 1:
|
| | | __GetGatherSoulSplitMaterial(itemID, soulidList, soulSplinters, soulCore)
|
| | | else:
|
| | | soulidList.append(itemID)
|
| | | # soulIpyData = GetGatherSoulIpyData(itemID)
|
| | | # if soulIpyData and len(soulIpyData.GetAttrType()) > 1:
|
| | | # __GetGatherSoulSplitMaterial(itemID, soulidList, soulSplinters, soulCore)
|
| | | # else:
|
| | | soulidList.append(itemID)
|
| | | return soulidList, soulSplinters, soulCore
|
| | |
|
| | |
|
| | |
| | |
|
| | | materialsIDList = []
|
| | | materialsLVDict = {}
|
| | | indexList1 = [] #背包的聚魂索引
|
| | | indexList2 = [] #孔索引
|
| | | indexList1, dataList1 = [], [] #背包的聚魂索引
|
| | | indexList2, dataList2 = [], [] #孔索引
|
| | | for i, placeType in enumerate(packList):
|
| | | index = indexList[i]
|
| | | if placeType == 0:
|
| | | GatherSoulData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_VPackItem % (ShareDefine.rptGatherSoul, index)) # 聚魂背包中的值
|
| | | indexList1.append(index)
|
| | | dataList1.append(GatherSoulData)
|
| | | else:
|
| | | GatherSoulData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GatherSoulHoleData % (index), 0)
|
| | | indexList2.append(index)
|
| | | dataList2.append(GatherSoulData)
|
| | | if not GatherSoulData:
|
| | | continue
|
| | | GatherSoulItemID = ItemControler.GetGatherSoulItemID(GatherSoulData)
|
| | |
| | | GameWorld.DebugLog(' 聚魂合成 背包格子数量不足1个')
|
| | | return
|
| | |
|
| | | costMoneyDict = {ShareDefine.TYPE_Price_SoulSplinters:ipyData.GeNeedSoulSplinters(),
|
| | | ShareDefine.TYPE_Price_SoulCore:ipyData.GeNeedSoulSplinters(), }
|
| | | for moneyType, costMoney in costMoneyDict:
|
| | | costMoneyDict = {ShareDefine.TYPE_Price_SoulSplinters:ipyData.GetNeedSoulSplinters(),
|
| | | ShareDefine.TYPE_Price_SoulCore:ipyData.GetNeedSoulCore(), }
|
| | | for moneyType, costMoney in costMoneyDict.items():
|
| | | if not PlayerControl.HaveMoney(curPlayer, moneyType, costMoney):
|
| | | GameWorld.DebugLog('聚魂合成钱不够 moneyType=%s, costMoney=%s'%(moneyType, costMoney))
|
| | | return
|
| | |
|
| | | infoDict = {"TagItemID":tagItemID}
|
| | | for moneyType, costMoney in costMoneyDict:
|
| | | for moneyType, costMoney in costMoneyDict.items():
|
| | | PlayerControl.PayMoney(curPlayer, moneyType, costMoney, ChConfig.Def_Cost_ItemProduce, infoDict)
|
| | |
|
| | | totalPoint = 0
|
| | |
| | | RefreshGatherSoulAttr(curPlayer)
|
| | | PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
|
| | | #返还多余魂尘
|
| | | totalPoint = int(totalPoint)
|
| | | if totalPoint > 0:
|
| | | PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_SoulDust, totalPoint)
|
| | | #给新物品
|
| | | curItem = ItemControler.GetOutPutItemObj(tagItemID)
|
| | | curItem.SetUserAttr(ShareDefine.Def_IudetGatherSoulLV, tagItemLV)
|
| | | PlayerItemControler = ItemControler.PlayerItemControler(curPlayer)
|
| | | PlayerItemControler.PutInItem(ShareDefine.rptGatherSoul, curItem, event=[ChConfig.ItemGive_ItemCompound, False, {'indexList1':indexList1, 'indexList2':indexList2, 'soulDust':totalPoint}])
|
| | | |
| | | PlayerItemControler.PutInItem(ShareDefine.rptGatherSoul, curItem, event=[ChConfig.ItemGive_ItemCompound, False, {'indexList1':dataList1, 'indexList2':dataList2, 'soulDust':totalPoint}])
|
| | | GameWorld.DebugLog(' 聚魂合成 成功')
|
| | | curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitGatherSoulCompound, 1)
|
| | | return
|
| | |
|
| | |
|
| | | def DoGatherSoulSuccessLogic(curPlayer):
|
| | | #聚魂成就处理
|
| | | #清掉#镶嵌X枚X品质聚魂的成就信息
|
| | | PlayerSuccess.ResetSuccessByType(curPlayer, ShareDefine.SuccType_InlayGatherSoul)
|
| | | totalLV = 0
|
| | | GatherSoulUnlockDict = IpyGameDataPY.GetFuncEvalCfg("GatherSoulHole", 1, {})
|
| | | maxGatherSoulHole = len(GatherSoulUnlockDict)
|
| | | for holeNum in xrange(maxGatherSoulHole):
|
| | | GatherSoulData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GatherSoulHoleData % holeNum, 0)
|
| | | if not GatherSoulData:
|
| | | continue
|
| | | GatherSoulItemID = ItemControler.GetGatherSoulItemID(GatherSoulData)
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(GatherSoulItemID)
|
| | | if not itemData:
|
| | | continue
|
| | | # if itemData.GetType() == ChConfig.Def_ItemType_GatherSoulCore:
|
| | | # continue
|
| | | itemColor = itemData.GetItemColor()
|
| | | GatherSoulItemPlusLV = ItemControler.GetGatherSoulItemPlusLV(GatherSoulData) + 1 #客户端1开始
|
| | | totalLV += GatherSoulItemPlusLV
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_InlayGatherSoul, 1, [itemColor])
|
| | | PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_GatherSoulLvUp, totalLV)
|
| | | return
|
| | |
|
| | | def RefreshGatherSoulAttr(curPlayer):
|
| | | allAttrList = [{} for _ in range(4)]
|
| | | GatherSoulUnlockDict = IpyGameDataPY.GetFuncEvalCfg("GatherSoulHole", 1, {})
|