| | |
| | | def __doKillAward(curPlayer, atkObj, killObjList):
|
| | | ## 计算击杀奖励
|
| | | if not killObjList:
|
| | | #GameWorld.DebugLog("没有击杀不需要处理主线奖励!")
|
| | | GameWorld.DebugLog("没有击杀不需要处理主线奖励!")
|
| | | return
|
| | | # 结算经验
|
| | | unXiantaoCntExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntExp)
|
| | |
| | | ## 主线掉落装备
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | unXiantaoCntEquip = PlayerControl.GetUnXiantaoCntEquip(curPlayer)
|
| | | bossTypeDropInfo = IpyGameDataPY.GetFuncCfg("MainEquipDrop", 1) # 每消耗X个战锤掉落一件装备
|
| | | fightPoint = max(curPlayer.GetFightPoint(), 1) # 消耗倍率也是掉落倍率
|
| | | dropEquipCnt = 0
|
| | | objDropCntDict = {}
|
| | | for tagObj in killObjList:
|
| | | tagID = tagObj.GetID()
|
| | | npcID = tagObj.GetNPCID()
|
| | | if not npcID:
|
| | | continue
|
| | | npcData = NPCCommon.GetNPCDataPy(npcID)
|
| | | if not npcData:
|
| | | continue
|
| | | bossType = npcData.GetBossType()
|
| | | if bossType not in bossTypeDropInfo:
|
| | | continue
|
| | | dropCnt = GameWorld.GetResultByRandomList(bossTypeDropInfo[bossType])
|
| | | if not dropCnt:
|
| | | continue
|
| | | dropCnt *= fightPoint # 多倍掉落
|
| | | objDropCntDict[tagID] = [tagObj, dropCnt, bossType]
|
| | | dropEquipCnt += dropCnt
|
| | | dropOneNeed = IpyGameDataPY.GetFuncCfg("MainEquipDrop", 1) # 每消耗X个战锤掉落一件装备
|
| | | dropEquipCnt = unXiantaoCntEquip / dropOneNeed
|
| | |
|
| | | if dropEquipCnt <= 0:
|
| | | GameWorld.DebugLog("主线暂不能掉落! unXiantaoCntEquip=%s,dropEquipCnt=%s" % (unXiantaoCntEquip, dropEquipCnt), playerID)
|
| | |
| | | ipyData = IpyGameDataPY.GetIpyGameData("TreeLV", treeLV)
|
| | | if not ipyData:
|
| | | return
|
| | | GameWorld.DebugLog("主线掉落装备: unXiantaoCntEquip=%s,dropEquipCnt=%s,treeLV=%s,objDropCntDict=%s" |
| | | % (unXiantaoCntEquip, dropEquipCnt, treeLV, objDropCntDict), playerID)
|
| | | dropAppointEquipDict = IpyGameDataPY.GetFuncEvalCfg("MainDropAppoint", 1, {})
|
| | | appointDropCntMax = max(dropAppointEquipDict) if dropAppointEquipDict else 0
|
| | |
|
| | | for tagID, dropInfo in objDropCntDict.items():
|
| | | tagObj, dropCnt, bossType = dropInfo
|
| | | bossTypeList = []
|
| | | bossTypeDropRateDict = {}
|
| | | for tagObj in killObjList:
|
| | | npcID = tagObj.GetNPCID()
|
| | | if not npcID:
|
| | | continue
|
| | | npcData = NPCCommon.GetNPCDataPy(npcID)
|
| | | if not npcData:
|
| | | continue
|
| | | bossType = npcData.GetBossType()
|
| | | bossTypeList.append(bossType)
|
| | | |
| | | if bossType in bossTypeDropRateDict:
|
| | | continue
|
| | | |
| | | if hasattr(ipyData, "GetEquipColorRateList%s" % bossType):
|
| | | equipColorRateList = getattr(ipyData, "GetEquipColorRateList%s" % bossType)()
|
| | | else:
|
| | | equipColorRateList = ipyData.GetEquipColorRateList()
|
| | | |
| | | GameWorld.DebugLog("tagID=%s,bossType=%s,dropCnt=%s,treeLV=%s,equipColorRateList=%s" |
| | | % (tagID, bossType, dropCnt, treeLV, equipColorRateList), playerID)
|
| | | if not equipColorRateList:
|
| | | continue
|
| | | |
| | | totalRate = 0
|
| | | colorRateList = []
|
| | | for equipColor, colorRate in enumerate(equipColorRateList, 1):
|
| | |
| | | continue
|
| | | totalRate += colorRate
|
| | | colorRateList.append([totalRate, equipColor])
|
| | | |
| | | #maxRate = 10000
|
| | | #if totalRate != maxRate:
|
| | | # GameWorld.SendGameError("GameWarning", "CutTreeTotalRateError:%s!=%s,treeLV=%s" % (totalRate, maxRate, treeLV))
|
| | | if not colorRateList:
|
| | | return
|
| | | GameWorld.DebugLog(" colorRateList=%s,totalRate=%s" % (colorRateList, totalRate), playerID)
|
| | | bossTypeDropRateDict[bossType] = colorRateList
|
| | | GameWorld.DebugLog("bossType=%s,treeLV=%s,totalRate=%s,equipColorRateList=%s,colorRateList=%s," |
| | | % (bossType, treeLV, totalRate, equipColorRateList, colorRateList), playerID)
|
| | |
|
| | | for _ in range(dropCnt):
|
| | | if dropEquipCnt <= 0:
|
| | | break
|
| | | bossTypeList.sort(reverse=True) # 按bossType优先掉落
|
| | | GameWorld.DebugLog("主线掉落装备: unXiantaoCntEquip=%s,dropEquipCnt=%s,treeLV=%s,bossTypeList=%s" |
| | | % (unXiantaoCntEquip, dropEquipCnt, treeLV, bossTypeList), playerID)
|
| | | dropAppointEquipDict = IpyGameDataPY.GetFuncEvalCfg("MainDropAppoint", 1, {})
|
| | | appointDropCntMax = max(dropAppointEquipDict) if dropAppointEquipDict else 0
|
| | | |
| | | for index in range(dropEquipCnt):
|
| | | bossType = bossTypeList[index % len(bossTypeList)]
|
| | | if bossType not in bossTypeDropRateDict:
|
| | | continue
|
| | | colorRateList = bossTypeDropRateDict.get(bossType, [])
|
| | | GameWorld.DebugLog("bossType=%s,colorRateList=%s,totalRate=%s" % (bossType, colorRateList, totalRate), playerID)
|
| | |
|
| | | setAttrDict = None
|
| | | appointDropEquipCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AppointDropEquipCnt) + 1
|
| | |
| | | if not ItemControler.DoLogic_PutItemInPack(curPlayer, curItem, packIndexList=[IPY_GameWorld.rptIdentify]):
|
| | | continue
|
| | |
|
| | | dropEquipCnt -= 1
|
| | | unXiantaoCntEquip -= dropOneNeed
|
| | | PlayerControl.SetUnXiantaoCntEquip(curPlayer, unXiantaoCntEquip)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnXiantaoCntEquip, unXiantaoCntEquip)
|
| | |
|
| | | if appointDropEquipCnt <= appointDropCntMax:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AppointDropEquipCnt, appointDropEquipCnt)
|
| | |
| | | if not moneyType or not moneyBase:
|
| | | return
|
| | |
|
| | | equipDict = {}
|
| | | IdentifyPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptIdentify)
|
| | | for index in range(IdentifyPack.GetCount()):
|
| | | curEquip = IdentifyPack.GetAt(index)
|
| | | if not ItemCommon.CheckItemCanUse(curEquip):
|
| | | #GameWorld.DebugLog("物品为空或不可用: index=%s" % index, playerID)
|
| | | continue
|
| | | if not ItemCommon.GetIsMainEquip(curEquip):
|
| | | #GameWorld.DebugLog("非主线装备: index=%s" % index, playerID)
|
| | | continue
|
| | | equipDict[index] = curEquip
|
| | | |
| | | if not equipDict:
|
| | | return
|
| | | |
| | | equipCnt = len(equipDict)
|
| | | unXiantaoCntEquip = PlayerControl.GetUnXiantaoCntEquip(curPlayer)
|
| | | perEquipXiantao = unXiantaoCntEquip / float(equipCnt) if equipCnt > 1 else unXiantaoCntEquip # 均分支持小数
|
| | | decomposeMoney = max(1, moneyBase * perEquipXiantao) # 至少1个
|
| | | decomposeMoney = moneyBase
|
| | | mjExPer, exRemain = PlayerLLMJ.GetAddDecomposePer(curPlayer)
|
| | | mjEx = int(decomposeMoney * mjExPer / 100.0)
|
| | | GameWorld.DebugLog("unXiantaoCntEquip=%s,equipCnt=%s,perEquipXiantao=%s,equipIndexList=%s" |
| | | % (unXiantaoCntEquip, equipCnt, perEquipXiantao, equipDict.keys()), playerID)
|
| | | GameWorld.DebugLog("moneyBase=%s,decomposeMoney=%s,mjExPer=%s,exRemain=%s,mjEx=%s" % (moneyBase, decomposeMoney, mjExPer, exRemain, mjEx), playerID)
|
| | | GameWorld.DebugLog("moneyType=%s,moneyBase=%s,mjExPer=%s,exRemain=%s,mjEx=%s" % (moneyType, moneyBase, mjExPer, exRemain, mjEx), playerID)
|
| | |
|
| | | moneyTotal = 0
|
| | | mjExTotal = 0
|
| | | decomposeCnt = 0
|
| | | decomposeIndexList = []
|
| | | |
| | | IdentifyPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptIdentify)
|
| | | for itemIndex in itemIndexList:
|
| | | if itemIndex not in equipDict:
|
| | | if itemIndex < 0 or itemIndex >= IdentifyPack.GetCount():
|
| | | continue
|
| | | curEquip = equipDict[itemIndex]
|
| | | curEquip = IdentifyPack.GetAt(itemIndex)
|
| | | if not ItemCommon.CheckItemCanUse(curEquip):
|
| | | GameWorld.DebugLog("物品为空或不可用: itemIndex=%s" % itemIndex, playerID)
|
| | | continue
|
| | | |
| | | if not ItemCommon.GetIsMainEquip(curEquip):
|
| | | GameWorld.DebugLog("非主线装备: itemIndex=%s" % itemIndex, playerID)
|
| | | continue
|
| | |
|
| | | moneyTotal += decomposeMoney
|
| | | if mjEx > 0:
|
| | |
| | | exRemain -= mjEx
|
| | | moneyTotal += mjEx
|
| | | mjExTotal += mjEx
|
| | | GameWorld.DebugLog(" itemIndex=%s,moneyBase=%s,perEquipXiantao=%s,decomposeMoney=%s,mjEx=%s,exRemain=%s,总:%s" |
| | | % (itemIndex, moneyBase, perEquipXiantao, decomposeMoney, mjEx, exRemain, moneyTotal), playerID)
|
| | | GameWorld.DebugLog(" itemIndex=%s,decomposeMoney=%s,mjEx=%s,exRemain=%s,总:%s" |
| | | % (itemIndex, decomposeMoney, mjEx, exRemain, moneyTotal), playerID)
|
| | |
|
| | | ItemCommon.DelItem(curPlayer, curEquip, curEquip.GetCount(), True, ChConfig.ItemDel_EquipDecompose)
|
| | | decomposeIndexList.append(itemIndex)
|
| | | decomposeCnt += 1
|
| | | unXiantaoCntEquip -= perEquipXiantao
|
| | |
|
| | | if not moneyTotal:
|
| | | return
|
| | |
|
| | | moneyTotal = int(round(moneyTotal)) # 四舍五入取整
|
| | | unXiantaoCntEquip = PlayerControl.SetUnXiantaoCntEquip(curPlayer, unXiantaoCntEquip)
|
| | | GameWorld.DebugLog("moneyTotal=%s,mjExTotal=%s,unXiantaoCntEquip=%s" % (moneyTotal, mjExTotal, unXiantaoCntEquip), playerID)
|
| | | GameWorld.DebugLog("moneyTotal=%s,mjExTotal=%s" % (moneyTotal, mjExTotal), playerID)
|
| | |
|
| | | PlayerControl.GiveMoney(curPlayer, moneyType, moneyTotal, "DecomposeMainEquip", isSysHint=False)
|
| | | PlayerLLMJ.AddExpDecompose(curPlayer, mjExTotal)
|