| | |
| | | randMaxLV = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_NPCStrengthenMaxLV)
|
| | | strengthenLV = random.randint(randMinLV, randMaxLV)
|
| | |
|
| | | # 木桩怪最大、平均成长等级处理,直接取归属玩家等级
|
| | | if lvStrengthenType in [1, 2] and curNPC.GetType() in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
|
| | | owner = None
|
| | | summonPlayerID = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_PriWoodPilePlayerID)
|
| | | if summonPlayerID:
|
| | | owner = GameWorld.GetObj(summonPlayerID, IPY_GameWorld.gotPlayer)
|
| | | if owner:
|
| | | strengthenLV = owner.GetLV()
|
| | | |
| | | if strengthenIpyData.GetCmpNPCBaseLV():
|
| | | strengthenLV = max(strengthenLV, curNPC.GetLV())
|
| | |
|
| | |
| | |
|
| | | if ItemCommon.GetIsEquip(itemData):
|
| | | for _ in xrange(itemCount):
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer)
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, 1, isAuctionItem, curPlayer=curPlayer)
|
| | | if curItem:
|
| | | needSpace += 1
|
| | | prizeItemList.append(curItem)
|
| | |
| | | itemID = itemObj.GetItemTypeID()
|
| | | mailItem = ItemCommon.GetMailItemDict(itemObj)
|
| | | equipInfo = [itemObj.GetEquipPlace(), ItemCommon.GetItemClassLV(itemObj), itemObj.GetItemColor(),
|
| | | itemObj.GetItemQuality(), itemObj.GetUserData()]
|
| | | itemObj.GetSuiteID(), itemObj.GetUserData()]
|
| | | packIndex = ChConfig.GetItemPackType(itemObj.GetType())
|
| | | if not itemControl.PutInItem(packIndex, itemObj, event=[ChConfig.ItemGive_Pickup, False, {"NPCID":npcID}]):
|
| | | mailItemList.append(mailItem)
|
| | |
| | | colorMaxDropCntDict = ipyDrop.GetEquipColorMaxDropCount() # {颜色:上限数量,...}
|
| | | colorSuitRateDict = ipyDrop.GetEquipColorSuitInfo() # 装备颜色对应套装概率 {颜色:套装概率, ...}
|
| | | colorSuitPlaceKeyInfoDict = ipyDrop.GetEquipPartKeyRateInfo() # 装备部位集合信息 {(颜色,是否套装):部位集合key, ...}
|
| | | colorSuitPartOptimization = ipyDrop.GetColorSuitPartOptimization() # 部位颜色套评分优选掉落,十位代表颜色,个位代表套装
|
| | | optColor, optIsSuit = colorSuitPartOptimization / 10, colorSuitPartOptimization % 10
|
| | | optPlace = None # 优选部位
|
| | | |
| | | for dropEquipInfo in dropEquipInfoList:
|
| | | classLV, color = dropEquipInfo[:2]
|
| | | if color in colorMaxDropCntDict:
|
| | |
| | | GameWorld.ErrLog("未配置颜色是否套装对应部位集合key! npcID=%s,color=%s,isSuit=%s" % (npcID, color, isSuit))
|
| | | continue
|
| | | placeKey = colorSuitPlaceKeyInfoDict[colorSuitKey]
|
| | | # 掉落优选部位处理
|
| | | if color == optColor and isSuit == optIsSuit and placeKey in placeKeyListDict and optPlace == None:
|
| | | optPlace = __GetOptimizationEquipPlace(dropPlayer, classLV, optColor, optIsSuit, placeKeyListDict[placeKey])
|
| | | jobList = itemJobList
|
| | | if placeKey not in placeKeyListDict:
|
| | | GameWorld.ErrLog("部位集合key不存在!npcID=%s,placeKey=%s" % (npcID, placeKey))
|
| | | continue
|
| | | placeList = placeKeyListDict[placeKey]
|
| | | if optPlace > 0:
|
| | | GameWorld.DebugLog(" 最终优选部位: %s" % optPlace)
|
| | | placeList = [optPlace]
|
| | | jobList = [dropPlayer.GetJob()]
|
| | | optPlace = 0 # 只有一次性的,置为0
|
| | | else:
|
| | | placeList = placeKeyListDict[placeKey]
|
| | | randEquipIDList = __GetEquipIDList(npcID, classLV, color, isSuit, placeList, jobList)
|
| | | if not randEquipIDList:
|
| | | continue
|
| | |
| | | elif ChConfig.IsGameBoss(npcData):
|
| | | GameWorld.ErrLog("Boss没有掉落物品,NPCID=%s" % (npcID), dropPlayer.GetPlayerID())
|
| | | return dropIDList, auctionIDList, dropMoneyCnt, moneyValue
|
| | |
|
| | | def __GetOptimizationEquipPlace(dropPlayer, classLV, optColor, optIsSuit, optPlaceList):
|
| | | ''' 获取掉落优选部位
|
| | | 几个默认规则
|
| | | 1. 颜色大于指定优选颜色的,无论是否套装都不计算在内
|
| | | 2. 颜色小于指定优选颜色的,无论是否套装都计算在内
|
| | | '''
|
| | | #GameWorld.DebugLog("处理优选部位掉落: classLV=%s,optColor=%s,optIsSuit=%s,optPlaceList=%s" % (classLV, optColor, optIsSuit, optPlaceList))
|
| | | minGSPlace = None
|
| | | minGS = None
|
| | | equipPack = dropPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | for optPlace in optPlaceList:
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, optPlace)
|
| | | if not ipyData:
|
| | | continue
|
| | | equipIndex = ipyData.GetGridIndex()
|
| | | curEquip = equipPack.GetAt(equipIndex)
|
| | | if not curEquip or curEquip.IsEmpty():
|
| | | #GameWorld.DebugLog(" 没穿装备,直接默认返回该部位: optPlace=%s" % optPlace)
|
| | | return optPlace
|
| | | curColor = curEquip.GetItemColor()
|
| | | curIsSuit = 1 if curEquip.GetSuiteID() else 0
|
| | | if curColor > optColor:
|
| | | # 超过优选指定颜色的不算,无论是否有套装
|
| | | #GameWorld.DebugLog(" 颜色超过优选颜色,不算该部位: optPlace=%s,curColor=%s,curIsSuit=%s" % (optPlace, curColor, curIsSuit))
|
| | | continue
|
| | | if curColor == optColor and curIsSuit >= optIsSuit:
|
| | | # 与优选指定颜色相同,且满足是否套装的不算
|
| | | #GameWorld.DebugLog(" 颜色套装满足优选,不算该部位: optPlace=%s,curColor=%s,curIsSuit=%s" % (optPlace, curColor, curIsSuit))
|
| | | continue
|
| | | curGS = ItemCommon.GetEquipGearScore(curEquip)
|
| | | if minGS == None or curGS < minGS:
|
| | | minGS = curGS
|
| | | minGSPlace = optPlace
|
| | | |
| | | return minGSPlace
|
| | |
|
| | | def __GetNPCDropDoCountChange(doCount, doCountRate, doCountAdd):
|
| | | ## 获取掉落执行次数变更结果,可能增加 或 减少
|
| | |
| | |
|
| | | return dropItemIDList
|
| | |
|
| | | def __GetEquipIDList(npcID, classLV, color, isSuit, placeList, itemJobList):
|
| | | def __GetEquipIDList(findID, classLV, color, isSuit, placeList, itemJobList, findType="NPC"):
|
| | | #存一个满足要求的所有的物品的列表 然后从当中随机选一个
|
| | | #注: 阶、颜色、套装ID、职业、部位,这5个条件可确认唯一一件装备
|
| | | key = "%s_%s" % (classLV, color)
|
| | |
| | | placeItemList = filterItemIDDict[itemPlace]
|
| | | placeItemList.append([itemJob, suiteID, itemID])
|
| | | PyGameData.g_filterEquipDict[key] = filterItemIDDict
|
| | | GameWorld.Log("缓存掉落装备ID: classLV_color=%s, %s, %s" % (key, filterItemIDDict, PyGameData.g_filterEquipDict))
|
| | | GameWorld.Log("缓存产出装备ID: classLV_color=%s, %s, %s" % (key, filterItemIDDict, PyGameData.g_filterEquipDict))
|
| | |
|
| | | itemIDList = []
|
| | | for itemPlace, placeItemList in filterItemIDDict.items():
|
| | |
| | | itemIDList.append(itemID)
|
| | |
|
| | | if not itemIDList:
|
| | | GameWorld.ErrLog("找不到可掉落的装备ID: npcID=%s,classLV=%s,color=%s,isSuit=%s,placeList=%s,itemJobList=%s" |
| | | % (npcID, classLV, color, isSuit, placeList, itemJobList))
|
| | | GameWorld.ErrLog("找不到可产出的装备ID: %sID=%s,classLV=%s,color=%s,isSuit=%s,placeList=%s,itemJobList=%s" |
| | | % (findType, findID, classLV, color, isSuit, placeList, itemJobList))
|
| | | return itemIDList
|
| | |
|
| | | def __GetNPCPieRateEquipDrop(ipyDrop, doCnt, equipDropPlus):
|
| | |
| | |
|
| | | return
|
| | |
|
| | | #// B4 0F 回收私有专属木桩怪 #tagCMRecyclePriWoodPile
|
| | | #
|
| | | #struct tagCMRecyclePriWoodPile
|
| | | #{
|
| | | # tagHead Head;
|
| | | # DWORD ObjID;
|
| | | #};
|
| | | def OnRecyclePriWoodPile(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | objID = clientData.ObjID
|
| | | curNPC = GameWorld.FindNPCByID(objID)
|
| | | if not curNPC:
|
| | | return
|
| | | if curNPC.GetType() not in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
|
| | | return
|
| | | summonPlayerID = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_PriWoodPilePlayerID)
|
| | | if curPlayer.GetPlayerID() != summonPlayerID:
|
| | | #GameWorld.DebugLog("非玩家私有木桩...")
|
| | | return
|
| | | SetDeadEx(curNPC)
|
| | | return
|
| | |
|
| | | #// B4 0C 召唤私有专属木桩怪 #tagCMSummonPriWoodPile
|
| | | #
|
| | | #struct tagCMSummonPriWoodPile
|
| | |
| | | ''' 召唤私有专属木桩怪
|
| | | '''
|
| | |
|
| | | if not curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
|
| | | GameWorld.DebugLog("玩家当前不是在自定义场景中,不允许招木桩!")
|
| | | return
|
| | | |
| | | mapID = PlayerControl.GetCustomMapID(curPlayer)
|
| | | lineID = PlayerControl.GetCustomLineID(curPlayer)
|
| | | if mapID:
|
| | |
| | | if playerID not in PyGameData.g_playerPriWoodPileNPCDict:
|
| | | PyGameData.g_playerPriWoodPileNPCDict[playerID] = []
|
| | | playerPriWoodNPCList = PyGameData.g_playerPriWoodPileNPCDict[playerID]
|
| | | maxCount = 10
|
| | | maxCount = 3
|
| | | nowCount = len(playerPriWoodNPCList)
|
| | | summonCount = min(count, maxCount - nowCount)
|
| | | #GameWorld.DebugLog("召唤: count=%s,maxCount=%s,nowCount=%s,summonCount=%s,hp=%s,hpEx=%s" |
| | | # % (count, maxCount, nowCount, summonCount, hp, hpEx))
|
| | | GameWorld.DebugLog("召唤木桩: npcID=%s,count=%s,maxCount=%s,nowCount=%s,summonCount=%s,hp=%s,hpEx=%s" |
| | | % (npcID, count, maxCount, nowCount, summonCount, hp, hpEx))
|
| | | if summonCount <= 0:
|
| | | return
|
| | |
|
| | |
| | | #技能召唤坐标 ChConfig.Def_SummonAppearDist
|
| | | summonPos = GameMap.GetEmptyPlaceInArea(curPlayer.GetPosX(), curPlayer.GetPosY(), 3)
|
| | | summonNPC.Reborn(summonPos.GetPosX(), summonPos.GetPosY(), False)
|
| | | NPCControl(summonNPC).ResetNPC_Init(isReborn=True)
|
| | | if hp or hpEx:
|
| | | summonNPC.SetHP(hp)
|
| | | summonNPC.SetHPEx(hpEx)
|
| | |
| | | def __NPCDropItem(self, dropPlayer, hurtType, hurtID, ownerPlayerList=[]):
|
| | | if not dropPlayer:
|
| | | return
|
| | | if dropPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
|
| | | GameWorld.DebugLog("前端自定义场景中,不掉落物品!")
|
| | | return
|
| | | curNPC = self.__Instance
|
| | | if curNPC.GetType() in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
|
| | | GameWorld.DebugLog("木桩怪,不掉落物品!")
|
| | | return
|
| | | npcID = curNPC.GetNPCID()
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | mapID = FBCommon.GetRecordMapID(mapID)
|
| | | isGameBoss = ChConfig.IsGameBoss(curNPC)
|
| | | if mapID in [ChConfig.Def_FBMapID_MunekadoTrial, ChConfig.Def_FBMapID_DemonKing]:
|
| | | if mapID in [ChConfig.Def_FBMapID_MunekadoTrial, ChConfig.Def_FBMapID_DemonKing, ChConfig.Def_FBMapID_SealDemon, ChConfig.Def_FBMapID_ZhuXianBoss]:
|
| | | GameWorld.DebugLog("该地图不走直接掉落物品逻辑!mapID=%s" % mapID) |
| | | return
|
| | | if isGameBoss:
|
| | | GameWorld.Log("NPC开始掉落: npcID=%s,dropPlayerID=%s" % (npcID, dropPlayer.GetPlayerID()), dropPlayer.GetPlayerID())
|
| | |
| | |
|
| | | #if self.__GetIsLog():
|
| | | # GameWorld.Log("玩家增加个人经验,npcID=%s,addExp=%s" % (curNPC.GetNPCID(), add_Exp), curPlayer.GetPlayerID())
|
| | | |
| | | addSkillID = 0
|
| | | if curNPC.GetDictByKey(ChConfig.Def_NPCDead_KillerID) == curPlayer.GetID():
|
| | | addSkillID = curNPC.GetDictByKey(ChConfig.Def_NPCDead_Reason)
|
| | |
|
| | | #设定人物获得经验
|
| | | playerControl = PlayerControl.PlayerControl(curPlayer)
|
| | | playerControl.AddExp(add_Exp, ShareDefine.Def_ViewExpType_KillNPC)
|
| | | playerControl.AddExp(add_Exp, ShareDefine.Def_ViewExpType_KillNPC, addSkillID=addSkillID)
|
| | |
|
| | |
|
| | | self.__KillNPCFuncEx(curPlayer, curNPC, curPlayer.GetPlayerID(), False)
|
| | |
| | | return
|
| | | #GameWorld.Log("普通队伍杀死怪物,队伍分享人数 = %s,个人经验增加 玩家 = %s, 增加 = %s"%(playerCount, curPlayer.GetPlayerID(), add_Exp))
|
| | | #设定人物获得经验
|
| | | addSkillID = 0
|
| | | if curNPC.GetDictByKey(ChConfig.Def_NPCDead_KillerID) == curPlayer.GetID():
|
| | | addSkillID = curNPC.GetDictByKey(ChConfig.Def_NPCDead_Reason)
|
| | | playerControl = PlayerControl.PlayerControl(curPlayer)
|
| | | playerControl.AddExp(add_Exp, ShareDefine.Def_ViewExpType_KillNPC)
|
| | | playerControl.AddExp(add_Exp, ShareDefine.Def_ViewExpType_KillNPC, addSkillID=addSkillID)
|
| | | return
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
| | | #};
|
| | | def OnGetCustomSceneCollectAward(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | npcID = clientData.NPCID
|
| | | if not curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
|
| | | GameWorld.DebugLog("非自定义场景中,无法获取定义采集奖励!")
|
| | | GameWorld.ErrLog("非自定义场景中,无法获取定义采集奖励!", playerID)
|
| | | return
|
| | | mapID = PlayerControl.GetCustomMapID(curPlayer)
|
| | | lineID = PlayerControl.GetCustomLineID(curPlayer)
|
| | | GameWorld.DebugLog("前端场景采集: mapID=%s,lineID=%s,npcID=%s" % (mapID, lineID, npcID))
|
| | | GameWorld.Log("前端场景采集: mapID=%s,lineID=%s,npcID=%s" % (mapID, lineID, npcID), playerID)
|
| | | if not mapID:
|
| | | GameWorld.ErrLog("无自定义场景地图ID,不允许采集!", playerID)
|
| | | return
|
| | |
|
| | | if mapID:
|
| | | #if FBCommon.GetCustomMapStep(curPlayer, mapID, lineID) != ChConfig.CustomMapStep_Fight:
|
| | | # return
|
| | | FBLogic.OnCustomSceneCollectOK(curPlayer, mapID, lineID, npcID)
|
| | | |
| | | if not FBLogic.OnCustomSceneCollectOK(curPlayer, mapID, lineID, npcID):
|
| | | GameWorld.ErrLog("自定义场景地图不允许采集! mapID=%s,lineID=%s,npcID=%s" % (mapID, lineID, npcID), playerID)
|
| | | return
|
| | | |
| | | collectNPCIpyData = IpyGameDataPY.GetIpyGameData("CollectNPC", npcID)
|
| | | if collectNPCIpyData:
|
| | | DoGiveCollectNPCAward(curPlayer, npcID, collectNPCIpyData)
|
| | |
| | | needRecord = True
|
| | | weightValue = recSpecialItemIDList.index(itemID) + 10000
|
| | | else:
|
| | | equipPlace, itemClassLV, itemColor, itemQuality, itemUserData = equipInfo
|
| | | weightValue = itemColor*1000+itemQuality*100+itemClassLV
|
| | | equipPlace, itemClassLV, itemColor, suiteID, itemUserData = equipInfo
|
| | | isSuit = 1 if suiteID else 0
|
| | | weightValue = itemColor*1000+isSuit*100+itemClassLV
|
| | |
|
| | | recordCondition = GameWorld.GetDictValueByKey(recDropEquipInfoDict, equipPlace)
|
| | | if recordCondition:
|
| | | needClassLV, needItemColor, needItemQuality = recordCondition
|
| | | if itemClassLV >= needClassLV and itemColor >= needItemColor and itemQuality >= needItemQuality:
|
| | | needClassLV, needItemColor, needItemSuite = recordCondition
|
| | | if itemClassLV >= needClassLV and itemColor >= needItemColor and isSuit >= needItemSuite:
|
| | | needRecord = True
|
| | | if not needRecord:
|
| | | return
|
| | |
| | |
|
| | | def UpdateNPCAttackCount(curPlayer, npcID, attackCount, maxCount=0):
|
| | | ## 更新玩家攻击NPC次数
|
| | | if not npcID:
|
| | | return
|
| | | GameWorld.DebugLog("更新玩家攻击NPC次数: npcID=%s,attackCount=%s,maxCount=%s" % (npcID, attackCount, maxCount))
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_NPCAttackCount % npcID, attackCount)
|
| | |
|