| | |
| | | def __doKillAward(curPlayer, atkObj, killObjList):
|
| | | ## 计算击杀奖励
|
| | | if not killObjList:
|
| | | #GameWorld.DebugLog("没有击杀不需要处理主线奖励!")
|
| | | GameWorld.DebugLog("没有击杀不需要处理主线奖励!")
|
| | | return
|
| | | # 结算经验
|
| | | unXiantaoCntExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntExp)
|
| | |
| | | % (totalExp, unXiantaoCntExp, baseExp, mjEx, mjExPer, exRemain))
|
| | | finalAddExp = PlayerControl.PlayerControl(curPlayer).AddExp(totalExp, ShareDefine.Def_ViewExpType_KillNPC)
|
| | | if mjEx and finalAddExp:
|
| | | PlayerLLMJ.AddExpEx(curPlayer, mjEx)
|
| | | TurnAttack.GetMainFightMgr(curPlayer).mjExp += mjEx
|
| | |
|
| | | __doMainDrop(curPlayer, killObjList)
|
| | | return
|
| | |
| | | ## 主线掉落装备
|
| | | 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)
|
| | | return
|
| | |
| | | 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)
|
| | | # GameWorld.SendGameError("GameWarning", "CutTreeTotalRateError:%s!=%s,treeLV=%s" % (totalRate, maxRate, treeLV))
|
| | | 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
|
| | | |
| | | setAttrDict = None
|
| | | appointDropEquipCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AppointDropEquipCnt) + 1
|
| | | if appointDropEquipCnt in dropAppointEquipDict:
|
| | | appointInfo = dropAppointEquipDict[appointDropEquipCnt]
|
| | | randEquipID = appointInfo[0]
|
| | | equipLV = appointInfo[1] if len(appointInfo) > 1 else 0
|
| | | appointID = appointInfo[2] if len(appointInfo) > 2 else 0
|
| | | setAttrDict = {}
|
| | | if equipLV > 0:
|
| | | setAttrDict["%s" % ShareDefine.Def_IudetItemLV] = equipLV
|
| | | if appointID:
|
| | | setAttrDict[ShareDefine.Def_CItemKey_AppointID] = appointID
|
| | | GameWorld.DebugLog("定制掉落第%s次: equipID=%s,setAttrDict=%s" % (appointDropEquipCnt, randEquipID, setAttrDict))
|
| | | else:
|
| | | itemColor = GameWorld.GetResultByRandomList(colorRateList)
|
| | | if not itemColor:
|
| | | continue
|
| | | equipIDList = NPCCommon.__GetEquipIDList(0, color=itemColor, placeList=ChConfig.Def_MainEquipPlaces, findType="MainEquipDrop")
|
| | | if not equipIDList:
|
| | | continue
|
| | | randEquipID = random.choice(equipIDList)
|
| | | |
| | | curItem = ItemControler.GetOutPutItemObj(randEquipID, 1, False, curPlayer=curPlayer, setAttrDict=setAttrDict)
|
| | | if curItem == None:
|
| | | 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 appointDropEquipCnt in dropAppointEquipDict:
|
| | | appointInfo = dropAppointEquipDict[appointDropEquipCnt]
|
| | | randEquipID = appointInfo[0]
|
| | | equipLV = appointInfo[1] if len(appointInfo) > 1 else 0
|
| | | appointID = appointInfo[2] if len(appointInfo) > 2 else 0
|
| | | setAttrDict = {}
|
| | | if equipLV > 0:
|
| | | setAttrDict["%s" % ShareDefine.Def_IudetItemLV] = equipLV
|
| | | if appointID:
|
| | | setAttrDict[ShareDefine.Def_CItemKey_AppointID] = appointID
|
| | | GameWorld.DebugLog("定制掉落第%s次: equipID=%s,setAttrDict=%s" % (appointDropEquipCnt, randEquipID, setAttrDict))
|
| | | else:
|
| | | itemColor = GameWorld.GetResultByRandomList(colorRateList)
|
| | | if not itemColor:
|
| | | continue
|
| | | curItem.SetIsBind(1) # 为1时代表是掉落
|
| | | #GameWorld.DebugLog("掉落装备: randEquipID=%s,%s" % (randEquipID, curItem.GetGUID()), playerID)
|
| | | if not ItemControler.DoLogic_PutItemInPack(curPlayer, curItem, packIndexList=[IPY_GameWorld.rptIdentify]):
|
| | | equipIDList = NPCCommon.__GetEquipIDList(0, color=itemColor, placeList=ChConfig.Def_MainEquipPlaces, findType="MainEquipDrop")
|
| | | if not equipIDList:
|
| | | continue
|
| | | randEquipID = random.choice(equipIDList)
|
| | |
|
| | | dropEquipCnt -= 1
|
| | | |
| | | if appointDropEquipCnt <= appointDropCntMax:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AppointDropEquipCnt, appointDropEquipCnt)
|
| | | curItem = ItemControler.GetOutPutItemObj(randEquipID, 1, False, curPlayer=curPlayer, setAttrDict=setAttrDict)
|
| | | if curItem == None:
|
| | | continue
|
| | | curItem.SetIsBind(1) # 为1时代表是掉落
|
| | | #GameWorld.DebugLog("掉落装备: randEquipID=%s,%s" % (randEquipID, curItem.GetGUID()), playerID)
|
| | | if not ItemControler.DoLogic_PutItemInPack(curPlayer, curItem, packIndexList=[IPY_GameWorld.rptIdentify]):
|
| | | continue
|
| | | |
| | | 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)
|
| | | return
|
| | |
|
| | | def GMTestKill(curPlayer, useXiantao):
|
| | |
| | | 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)
|
| | |
| | | continue
|
| | | itemID = curItem.GetItemTypeID()
|
| | | item = curItem.GetItem()
|
| | | item.SetIsBind(0) # 拾取时重置,取源SingleItem修改不通知
|
| | | itemCount = ItemControler.GetItemCount(curItem)
|
| | | GameWorld.DebugLog("主线物品拾取: itemIndex=%s,itemID=%s,itemCount=%s" % (itemIndex, itemID, itemCount), playerID)
|
| | | if not itemControl.PutInItem(IPY_GameWorld.rptItem, item):
|