| | |
| | | return attrDict
|
| | |
|
| | | def GiveKillNPCDropPrize(curPlayer, mapID, npcCountDict, exp_rate=None, mailTypeKey=None, isMail=False,
|
| | | extraItemList=[], prizeMultiple=1, dropItemMapInfo=[]):
|
| | | extraItemList=[], prizeMultiple=1, dropItemMapInfo=[], curGrade=0):
|
| | | '''给玩家击杀NPC掉落奖励
|
| | | @param mapID: 击杀的NPC所在地图ID,注意次地图并不一定是玩家当前地图
|
| | | @param npcCountDict: 执行单次时所击杀的npc数量字典 {npcID:count, ...}
|
| | |
| | | # 掉落有概率因素,需多次执行
|
| | | for dCount in xrange(1, totalCount + 1):
|
| | | isKillCountDropEquipEx = dCount == 1 # 同一只NPC一次处理中多次击杀的情况,只算一次附加装备处理
|
| | | dropInfo = GetNPCDropInfo(curPlayer, mapID, npcID, isKillCountDropEquipEx=isKillCountDropEquipEx)
|
| | | dropInfo = GetNPCDropInfo(curPlayer, mapID, npcID, isKillCountDropEquipEx=isKillCountDropEquipEx, curGrade=curGrade)
|
| | | if not dropInfo:
|
| | | continue
|
| | | dropIDList, dropIDBindDict, dropMoneyCnt, moneyValue = dropInfo
|
| | |
| | | % (npcID, killCount, dropIDCountDict, dropIDBindDict, dropMoney), playerID)
|
| | | return dropIDCountDict, dropIDBindDict, dropMoney
|
| | |
|
| | | def GetNPCDropInfo(dropPlayer, mapID, npcID, ownerPlayerList=[], ipyDrop=None, isSingle=True, isKillCountDropEquipEx=True):
|
| | | def GetNPCDropInfo(dropPlayer, mapID, npcID, ownerPlayerList=[], ipyDrop=None, isSingle=True, isKillCountDropEquipEx=True, curGrade=0):
|
| | | '''获取NPC掉落信息, 击杀及扫荡通用,调用该函数获得掉落信息,然后再看掉落地板上还是直接放入背包
|
| | | @param dropPlayer: 用于判断调用相关用的玩家示例,该玩家并不一定是击杀者,只是按一定规则设定的掉落判断依据的玩家
|
| | | 如队伍,取等级最大的玩家,该玩家并不一定是击杀者
|
| | |
| | | indepRateDoCnt = ipyDrop.GetIndepRateDoCnt()
|
| | | if indepRateDoCnt:
|
| | | indepRateDoCnt = __GetNPCDropDoCountChange(indepRateDoCnt, doCountRate + equipDropDoCountPlus, doCountAdd)
|
| | | dropEquipInfoList += __GetNPCIndepRateEquipDrop(ipyDrop, indepRateDoCnt, equipDropRatePlus)
|
| | | dropEquipInfoList += __GetNPCIndepRateEquipDrop(ipyDrop, indepRateDoCnt, equipDropRatePlus, curGrade)
|
| | |
|
| | | #GameWorld.DebugLog("阶,颜色,部位集合key,dropEquipInfoList=%s" % (dropEquipInfoList))
|
| | | placeDict = IpyGameDataPY.GetFuncCfg("EquipDropPartSets", 1)
|
| | |
| | | fbGradeColorStarRateDict = IpyGameDataPY.GetFuncEvalCfg("FBGradeEquipDropRate", 2) # 评级影响品质星级概率 {npcID:{(颜色,星级):[D级影响概率, ..., S级影响概率], ...}, ...}
|
| | | if npcID in fbGradeColorStarRateDict:
|
| | | gradeColorStarRateDict = fbGradeColorStarRateDict[npcID]
|
| | | curGrade = GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | | curGrade = curGrade if curGrade else GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | |
|
| | | colorDropCntDict = {} # 装备颜色已经掉落数 {颜色:数量, ...}
|
| | | colorMaxDropCntDict = ipyDrop.GetIndepRateMaxDropCount() # {颜色:上限数量,...}
|
| | |
| | | fbGradePriItemIDDropDict = IpyGameDataPY.GetFuncEvalCfg("FBGradeEquipDropRate", 3)
|
| | | if npcID in fbGradePriItemIDDropDict:
|
| | | gradePriItemIDDropDict = fbGradePriItemIDDropDict[npcID]
|
| | | curGrade = GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | | curGrade = curGrade if curGrade else GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | | priDropInfoList = gradePriItemIDDropDict.get(curGrade, [])
|
| | | priDropIDList = []
|
| | | for priItemID, priItemCount in priDropInfoList:
|
| | |
| | | #GameWorld.DebugLog("饼图装备掉落结果: doCnt=%s, %s" % (doCnt, dropEquipInfoList))
|
| | | return dropEquipInfoList
|
| | |
|
| | | def __GetNPCIndepRateEquipDrop(ipyDrop, doCnt, equipDropPlus):
|
| | | def __GetNPCIndepRateEquipDrop(ipyDrop, doCnt, equipDropPlus, curGrade=0):
|
| | | ## 获取NPC独立掉率装备掉落信息
|
| | | npcID = ipyDrop.GetNPCID()
|
| | | indepRateDict = ipyDrop.GetIndepRateDrop() # {(阶,颜色,部位集合key):概率,...}
|
| | |
| | | fbGradeColorRateDict = IpyGameDataPY.GetFuncEvalCfg("FBGradeEquipDropRate", 1) #{npcID:{颜色:[D级影响概率, ..., S级影响概率], ...}, ...}
|
| | | if npcID in fbGradeColorRateDict:
|
| | | gradeColorRateDict = fbGradeColorRateDict[npcID]
|
| | | curGrade = GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | | curGrade = curGrade if curGrade else GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | |
|
| | | #colorDropCntDict = {} # 装备颜色已经掉落数 {颜色:数量, ...}
|
| | | dropEquipInfoList = []
|
| | |
| | | # 设置npc死亡及自身处理
|
| | | SetDeadEx(summonNPC)
|
| | |
|
| | | if curNPC.GetGameObjType() == IPY_GameWorld.gotNPC and \
|
| | | curNPC.GetGameNPCObjType() == IPY_GameWorld.gnotSummon:
|
| | | FBLogic.DoFB_SummonNPCDead(curNPC)
|
| | | if curNPC.GetGameObjType() == IPY_GameWorld.gotNPC:
|
| | | FBLogic.DoFB_NPCDead(curNPC)
|
| | |
|
| | | summonPlayerID = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_SummonMapNPCPlayerID)
|
| | | if summonPlayerID > 0:
|
| | |
| | | # @remarks 刷新NPC属性
|
| | | def RefreshNPCAttrState(self, canSyncClient=True, isReborn=False):
|
| | | curNPC = self.__Instance
|
| | | if curNPC.GetType() == ChConfig.ntHelpBattleRobot:
|
| | | # 助战机器人不处理
|
| | | return
|
| | | #curNPCMaxHP_Before = GameObj.GetMaxHP(curNPC)
|
| | | #清空NPC战斗属性
|
| | | curNPC.ClearBattleEffect()
|
| | |
| | | fbFightPower = ipyData.GetFightPowerMin()
|
| | | baseHurt = ipyData.GetRobotBaseHurt()
|
| | | hpCoefficient = ipyData.GetRobotHPCoefficient()
|
| | | maxHP = int(baseHurt * fightPower / fbFightPower * hpCoefficient)
|
| | | maxHP = int(eval(IpyGameDataPY.GetFuncCompileCfg("HelpBattleRobot", 2)))
|
| | | GameWorld.DebugLog("设置助战机器人属性: objID=%s,fightPower=%s,maxHP=%s" % (curNPC.GetID(), fightPower, maxHP))
|
| | | GameObj.SetMaxHP(curNPC, maxHP)
|
| | | GameObj.SetHP(curNPC, maxHP)
|
| | |
| | | # @remarks 刷新NPC行为属性
|
| | | def RefreshNPCActionState(self):
|
| | | curNPC = self.__Instance
|
| | | if curNPC.GetType() == ChConfig.ntHelpBattleRobot:
|
| | | # 助战机器人不处理
|
| | | return
|
| | | OperControlManager.ClearObjActionState(curNPC)
|
| | |
|
| | | #根据BUFF 加上状态
|