| | |
| | | import PlayerActivity
|
| | | import PlayerSuccess
|
| | | import BossHurtMng
|
| | | import GY_Query_BossFirstKill
|
| | | import GameLogic_FamilyInvade
|
| | | import GameLogic_GatherSoul
|
| | | import FormulaControl
|
| | |
| | | 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())
|
| | |
|
| | |
| | | dropNPCID=npcID, isOnlySelfSee=isOnlySelfSee)
|
| | | return
|
| | |
|
| | | def DoGiveItemByVirtualDrop(curPlayer, giveItemList, npcID, dropPosX=0, dropPosY=0, isDropDisperse=True, mailTypeKey="ItemNoPickUp"):
|
| | | def DoGiveItemByVirtualDrop(curPlayer, giveItemList, npcID, dropPosX=0, dropPosY=0, isDropDisperse=True, mailTypeKey="ItemNoPickUp", extraVirtualItemList=[]):
|
| | | ## 给物品并且做假掉落表现,直接先堆叠给物品,再拆开做虚假掉落表现
|
| | |
|
| | | mapID = PlayerControl.GetCustomMapID(curPlayer)
|
| | |
| | | virtualItemDropList.append([itemID, dropItemDataStr])
|
| | |
|
| | | # 先通知掉落,再给物品,因为前端表现弹框需要这个顺序需求
|
| | | if extraVirtualItemList: #只显示假掉落
|
| | | for itemInfo in extraVirtualItemList:
|
| | | itemID, itemCount, isAuctionItem = itemInfo
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer)
|
| | | if not curItem:
|
| | | continue
|
| | | dropItemDataStr = ChItem.GetMapDropItemDataStr(curItem)
|
| | | # 散开掉落
|
| | | if isDropDisperse:
|
| | | for _ in xrange(itemCount):
|
| | | virtualItemDropList.append([itemID, dropItemDataStr])
|
| | | else:
|
| | | virtualItemDropList.append([itemID, dropItemDataStr])
|
| | | curItem.Clear()
|
| | | |
| | | gameMap = GameWorld.GetMap()
|
| | | index = 0
|
| | | for posX, posY in ChConfig.Def_DropItemAreaMatrix:
|
| | |
| | | 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)
|
| | |
| | | dropEquipInfoList.append([classLV, color, dropCount])
|
| | | GameWorld.DebugLog(" 装备掉落结果: killCount=%s,[阶,颜色,件数]=%s" % (killCount, dropEquipInfoList), playerID)
|
| | |
|
| | | placeKeyListDict = IpyGameDataPY.GetFuncCfg("EquipDropPartSets", 1)
|
| | | colorSuitRateDict = ipyDrop.GetEquipColorSuitInfo() # 装备颜色对应套装概率 {颜色:套装概率, ...}
|
| | | colorSuitPlaceKeyInfoDict = ipyDrop.GetEquipPartKeyRateInfo() # 装备部位集合信息 {(颜色,是否套装):部位集合key, ...}
|
| | | dropEquipIDDict = {}
|
| | |
| | | GameWorld.ErrLog("未配置颜色是否套装对应部位集合key! npcID=%s,color=%s,isSuit=%s" % (npcID, color, isSuit))
|
| | | continue
|
| | | placeKey = colorSuitPlaceKeyInfoDict[colorSuitKey]
|
| | | if placeKey not in placeKeyListDict:
|
| | | placeList = GetEquipPlaceByPlaceKey(placeKey)
|
| | | if not placeList:
|
| | | GameWorld.ErrLog("部位集合key不存在!npcID=%s,placeKey=%s" % (npcID, placeKey))
|
| | | continue
|
| | | placeList = placeKeyListDict[placeKey]
|
| | | randEquipIDList = __GetEquipIDList(npcID, classLV, color, isSuit, placeList, itemJobList)
|
| | | if not randEquipIDList:
|
| | | continue
|
| | |
| | | doCnt *= killCount
|
| | |
|
| | | totalRate = dropRate * doCnt
|
| | | dropCount = totalRate / maxRate # 可掉落件数
|
| | | rateEx = totalRate % maxRate # 剩余概率
|
| | | dropCount = totalRate / Def_NPCMaxDropRate # 可掉落件数
|
| | | rateEx = totalRate % Def_NPCMaxDropRate # 剩余概率
|
| | | if GameWorld.CanHappen(rateEx, Def_NPCMaxDropRate):
|
| | | dropCount += 1
|
| | | dropIDList += [itemID] * dropCount
|
| | |
| | | gradeColorSuitRateDict = fbGradeColorSuitRateDict[npcID]
|
| | | curGrade = curGrade if curGrade else GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | |
|
| | | placeKeyListDict = IpyGameDataPY.GetFuncCfg("EquipDropPartSets", 1)
|
| | | colorDropCntDict = {} # 装备颜色已经掉落数 {颜色:数量, ...}
|
| | | 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 optPlace == None:
|
| | | allEquipPlaceList = GetAllEquipPlaceByPlaceKey(placeKey)
|
| | | #GameWorld.DebugLog(" 所有可优选部位: %s" % allEquipPlaceList)
|
| | | if allEquipPlaceList:
|
| | | optPlace = __GetOptimizationEquipPlace(dropPlayer, classLV, optColor, optIsSuit, allEquipPlaceList)
|
| | | 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 = GetEquipPlaceByPlaceKey(placeKey)
|
| | | if not placeList:
|
| | | GameWorld.ErrLog("部位集合key不存在!npcID=%s,placeKey=%s" % (npcID, placeKey))
|
| | | continue
|
| | | randEquipIDList = __GetEquipIDList(npcID, classLV, color, isSuit, placeList, jobList)
|
| | | if not randEquipIDList:
|
| | | continue
|
| | | if color in colorMaxDropCntDict:
|
| | | colorDropCntDict[color] = dropCount + 1
|
| | | randItemID = random.choice(randEquipIDList)
|
| | | if isSuit and len(jobList) > 1:
|
| | | randItemID = __GetRandDropSuitEquipID(dropPlayer, randEquipIDList)
|
| | | else:
|
| | | randItemID = random.choice(randEquipIDList)
|
| | | dropIDList.append(randItemID)
|
| | | GameWorld.DebugLog("掉落装备: npcID=%s,itemID=%s,classLV=%s,color=%s,isSuit=%s,placeKey=%s,jobList=%s,randEquipIDList=%s"
|
| | | % (npcID, randItemID, classLV, color, isSuit, placeKey, jobList, randEquipIDList), playerID)
|
| | |
| | | elif ChConfig.IsGameBoss(npcData):
|
| | | GameWorld.ErrLog("Boss没有掉落物品,NPCID=%s" % (npcID), dropPlayer.GetPlayerID())
|
| | | return dropIDList, auctionIDList, dropMoneyCnt, moneyValue
|
| | |
|
| | | def __GetRandDropSuitEquipID(curPlayer, randEquipIDList):
|
| | | ## 获取随机掉落的套装ID,为了玩家掉落体验, 当非本职业套装时可至多重新随机X次
|
| | | randItemID = 0
|
| | | suitRandCountEx = IpyGameDataPY.GetFuncCfg("EquipSuitDrop", 1) + 1
|
| | | for _ in xrange(suitRandCountEx):
|
| | | randItemID = random.choice(randEquipIDList)
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(randItemID)
|
| | | if not itemData:
|
| | | continue
|
| | | if ItemCommon.CheckJob(curPlayer, itemData):
|
| | | break
|
| | | return randItemID
|
| | |
|
| | | def GetAllEquipPlaceByPlaceKey(placeKey):
|
| | | placeKeyRateListDict = IpyGameDataPY.GetFuncEvalCfg("EquipDropPartSets", 2, {}) # {集合数字key1:[[概率1,部位1],...],...}
|
| | | if placeKey in placeKeyRateListDict:
|
| | | return [rateInfo[1] for rateInfo in placeKeyRateListDict[placeKey]]
|
| | | placeKeyListDict = IpyGameDataPY.GetFuncEvalCfg("EquipDropPartSets", 1, {}) # {集合数字key1:[部位1,部位2,...],...}
|
| | | if placeKey in placeKeyListDict:
|
| | | return placeKeyListDict[placeKey]
|
| | | return []
|
| | |
|
| | | def GetEquipPlaceByPlaceKey(placeKey):
|
| | | ## 获取装备位集合对应的部位信息,集合ID重复时,优先饼图
|
| | | placeList = []
|
| | | placeKeyRateListDict = IpyGameDataPY.GetFuncEvalCfg("EquipDropPartSets", 2, {}) # {集合数字key1:[[概率1,部位1],...],...}
|
| | | if placeKey in placeKeyRateListDict:
|
| | | placeRateList = placeKeyRateListDict[placeKey]
|
| | | place = GameWorld.GetResultByRandomList(placeRateList)
|
| | | if place:
|
| | | placeList = [place]
|
| | | #GameWorld.DebugLog(" 掉落部位概率集合: placeKey=%s,placeRateList=%s,place=%s,placeList=%s" % (placeKey, placeRateList, place, placeList))
|
| | | |
| | | if not placeList:
|
| | | placeKeyListDict = IpyGameDataPY.GetFuncEvalCfg("EquipDropPartSets", 1, {}) # {集合数字key1:[部位1,部位2,...],...}
|
| | | if placeKey in placeKeyListDict:
|
| | | placeList = placeKeyListDict[placeKey]
|
| | | #GameWorld.DebugLog(" 掉落部位均衡集合: placeKey=%s,placeList=%s" % (placeKey, placeList))
|
| | | |
| | | return placeList
|
| | |
|
| | | 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):
|
| | |
| | | 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)
|
| | |
| | | PlayerNewFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_WorldBoss, 1)
|
| | | PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_WorldBOSS, 1)
|
| | | PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_WorldBOSS, 1)
|
| | | |
| | |
|
| | | if mapID == ChConfig.Def_FBMapID_BossHome:
|
| | | #BOSS之家
|
| | | # BOSS之家BOSS击杀成就
|
| | |
| | | PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_BossHome, 1)
|
| | | PlayerNewFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_BossHome, 1)
|
| | | PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_BOSSHome, 1)
|
| | | |
| | | elif mapID == ChConfig.Def_FBMapID_CrossPenglai:
|
| | | #跨服蓬莱仙境
|
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_CrossPenglai)
|
| | | |
| | | # 个人首杀记录
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataNotLog("BOSSFirstKill", npcID)
|
| | | if ipyData:
|
| | | GY_Query_BossFirstKill.SetPlayerFirstKillBoss(curPlayer, npcID)
|
| | | |
| | | return
|
| | |
|
| | | #################################################
|
| | |
| | | # GameWorld.DebugLog("伤血玩家血量为0,清除该伤血!playerID=%s" % hurtID)
|
| | | # return True
|
| | |
|
| | | if hurtPlayer.GetInitOK() and not hurtPlayer.GetVisible():
|
| | | curNPC = self.__Instance
|
| | | if hurtPlayer.GetInitOK() and (not hurtPlayer.GetVisible() or hurtPlayer.GetSightLevel() != curNPC.GetSightLevel()):
|
| | | GameWorld.DebugLog("伤血玩家不可见,清除该伤血!playerID=%s" % hurtID)
|
| | | return True
|
| | |
|
| | |
| | | #GameWorld.DebugLog("队员不在本线路,不计!playerID=%s" % playerID)
|
| | | continue
|
| | |
|
| | | if curTeamPlayer.GetInitOK() and not curTeamPlayer.GetVisible():
|
| | | if curTeamPlayer.GetInitOK() and (not curTeamPlayer.GetVisible() or curTeamPlayer.GetSightLevel() != curNPC.GetSightLevel()):
|
| | | #GameWorld.DebugLog("队员不可见,不计!playerID=%s" % playerID)
|
| | | continue
|
| | |
|
| | |
| | | # @param HurtType 伤血类型
|
| | | # @param HurtID 伤血ID
|
| | | # @return 返回值无意义
|
| | | def __NPCDropItem(self, dropPlayer, hurtType, hurtID, ownerPlayerList=[]):
|
| | | def __NPCDropItem(self, dropPlayer, hurtType, hurtID, ownerPlayerList=[], isOnlySelfSee=False):
|
| | | if not dropPlayer:
|
| | | return
|
| | | curNPC = self.__Instance
|
| | |
| | | SendVirtualItemDrop(ownerPlayer, itemID, resultX, resultY, dropItemDataStr)
|
| | |
|
| | | else:
|
| | | self.__MapCreateItem(curItem, resultX, resultY, ownerType, ownerID)
|
| | | self.__MapCreateItem(curItem, resultX, resultY, ownerType, ownerID, isOnlySelfSee=isOnlySelfSee)
|
| | | return
|
| | | #---------------------------------------------------------------------
|
| | | ## NPC被杀死逻辑处理
|
| | |
| | | if maxPlayerLV < curPlayer.GetLV():
|
| | | maxPlayerLV = curPlayer.GetLV()
|
| | | dropPlayer = curPlayer
|
| | | |
| | | if isGameBoss and curPlayer.GetOfficialRank() < GetRealmLV(curNPC):
|
| | | GameWorld.Log("玩家境界不足,无法获得Boss归属奖励! playerRealmLV=%s,npcID=%s,npcRealmLV=%s" |
| | | % (curPlayer.GetOfficialRank(), npcID, GetRealmLV(curNPC)), curPlayer.GetPlayerID())
|
| | | continue
|
| | | |
| | | self.__KilledByPlayerSetPrize(curPlayer)
|
| | | ownerPlayerList.append(curPlayer)
|
| | | self.__ownerPlayerList = ownerPlayerList
|
| | |
|
| | | #调用物品掉落
|
| | | self.__NPCDropItem(dropPlayer, hurtType, hurtID, ownerPlayerList)
|
| | |
|
| | | #调用物品掉落,boss一人一份
|
| | | if isGameBoss and hurtType in [ChConfig.Def_NPCHurtTypePlayer, ChConfig.Def_NPCHurtTypeTeam, ChConfig.Def_NPCHurtTypeSpecial]:
|
| | | isOnlySelfSee = len(ownerPlayerList) > 1
|
| | | for curPlayer in ownerPlayerList:
|
| | | self.__NPCDropItem(curPlayer, ChConfig.Def_NPCHurtTypePlayer, curPlayer.GetPlayerID(), [curPlayer], isOnlySelfSee=isOnlySelfSee)
|
| | | elif dropPlayer:
|
| | | self.__NPCDropItem(dropPlayer, hurtType, hurtID, ownerPlayerList)
|
| | | |
| | | #被队伍杀死
|
| | | elif curTeam != None:
|
| | | self.__KilledByTeamSetPrize(curTeam, hurtType, hurtID)
|
| | |
| | |
|
| | | #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)
|
| | |
| | | teamMaxLV = 0
|
| | | dropPlayer = None
|
| | | ownerPlayerList = []
|
| | | npcID = curNPC.GetNPCID()
|
| | | isGameBoss = ChConfig.IsGameBoss(curNPC)
|
| | | #遍历队伍,半径为一屏半的距离内的所有队伍/团队成员,可以获得经验
|
| | | for curPlayer in playerlist:
|
| | | if isGameBoss and curPlayer.GetOfficialRank() < GetRealmLV(curNPC):
|
| | | GameWorld.Log("队员境界不足,无法获得Boss归属奖励! playerRealmLV=%s,npcID=%s,npcRealmLV=%s" |
| | | % (curPlayer.GetOfficialRank(), npcID, GetRealmLV(curNPC)), curPlayer.GetPlayerID())
|
| | | continue
|
| | | |
| | | curPlayerLV = curPlayer.GetLV()
|
| | | if teamMaxLV < curPlayerLV:
|
| | | teamMaxLV = curPlayerLV
|
| | |
| | | self.__DoNormalTeamExp(curPlayer)
|
| | | self.__KillNPCFuncEx(curPlayer, curNPC, maxHurtID, True)
|
| | | self.__ownerPlayerList = ownerPlayerList
|
| | | |
| | | #调用物品掉落
|
| | | self.__NPCDropItem(dropPlayer, hurtType, hurtID, ownerPlayerList)
|
| | | |
| | | #调用物品掉落,boss一人一份
|
| | | if isGameBoss and hurtType in [ChConfig.Def_NPCHurtTypePlayer, ChConfig.Def_NPCHurtTypeTeam, ChConfig.Def_NPCHurtTypeSpecial]:
|
| | | isOnlySelfSee = len(ownerPlayerList) > 1
|
| | | for curPlayer in ownerPlayerList:
|
| | | self.__NPCDropItem(curPlayer, ChConfig.Def_NPCHurtTypePlayer, curPlayer.GetPlayerID(), [curPlayer], isOnlySelfSee=isOnlySelfSee)
|
| | | elif dropPlayer:
|
| | | self.__NPCDropItem(dropPlayer, hurtType, hurtID, ownerPlayerList)
|
| | | #GameWorld.Log("队伍杀死怪物奖励,逻辑成功结束")
|
| | | return
|
| | |
|
| | |
| | | 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
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
| | | # @param dropType: 掉落类型
|
| | | # @param ownerID: 归属者
|
| | | # @return: None
|
| | | def __MapCreateItem(self, curItem, posX, posY, dropType, ownerID):
|
| | | def __MapCreateItem(self, curItem, posX, posY, dropType, ownerID, isOnlySelfSee=False):
|
| | | if not curItem:
|
| | | return
|
| | |
|
| | |
| | |
|
| | | # 在地上添加物品(统一接口)
|
| | | dropNPCID = 0 if not ChConfig.IsGameBoss(curNPC) else curNPCID
|
| | | specOwnerIDList = self.__AllKillerDict.keys() if (len(self.__AllKillerDict) > 1 or dropType == ChConfig.Def_NPCHurtTypeSpecial) else []
|
| | | curMapItem = ChItem.AddMapDropItem(posX, posY, curItem, ownerInfo=[dropType, ownerID, specOwnerIDList], dropNPCID=dropNPCID)
|
| | | specOwnerIDList = [player.GetPlayerID() for player in self.__ownerPlayerList] if dropType == ChConfig.Def_NPCHurtTypeSpecial else []
|
| | | curMapItem = ChItem.AddMapDropItem(posX, posY, curItem, ownerInfo=[dropType, ownerID, specOwnerIDList], dropNPCID=dropNPCID, isOnlySelfSee=isOnlySelfSee)
|
| | |
|
| | | #设置该物品生前拥有者(那个NPC掉落的)
|
| | | if curMapItem == None:
|
| | |
| | | GameWorld.ErrLog("自定义场景地图不允许采集! mapID=%s,lineID=%s,npcID=%s" % (mapID, lineID, npcID), playerID)
|
| | | return
|
| | |
|
| | | collectNPCIpyData = IpyGameDataPY.GetIpyGameData("CollectNPC", npcID)
|
| | | collectNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("CollectNPC", npcID)
|
| | | if collectNPCIpyData:
|
| | | DoGiveCollectNPCAward(curPlayer, npcID, collectNPCIpyData)
|
| | | return
|
| | |
| | | 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
|
| | |
| | | #};
|
| | | ## 购买BOSS可击杀次数
|
| | | def OnBuyKillBossCnt(index, clientData, tick):
|
| | | # curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | # killBossMark = clientData.KillBossMark
|
| | | # killBossCntLimitDict = ReadChConfig.GetEvalChConfig("KillBossCntLimit")
|
| | | # curBossLimitInfo = []
|
| | | # for limitInfo in killBossCntLimitDict.values():
|
| | | # if killBossMark == limitInfo[0]:
|
| | | # curBossLimitInfo = limitInfo
|
| | | # break
|
| | | # if not curBossLimitInfo:
|
| | | # return
|
| | | # |
| | | # killBossMark, limitCnt, canBuyCnt, buyCost, sysMark1, sysMark2= curBossLimitInfo
|
| | | # hasKillCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Boss_KillCnt%killBossMark, 0)
|
| | | # hasBuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Boss_KillCntBuyCnt%killBossMark, 0)
|
| | | # playerID = curPlayer.GetPlayerID()
|
| | | # if hasBuyCnt >= canBuyCnt:
|
| | | # GameWorld.Log('购买BOSS可击杀次数, 已达到今日最大可购买次数,hasBuyCnt=%s, canBuyCnt=%s'%(hasBuyCnt, canBuyCnt), playerID)
|
| | | # return
|
| | | # costGold = eval(buyCost)
|
| | | # infoDict = {"index":index, ChConfig.Def_Cost_Reason_SonKey:index}
|
| | | # isOK = PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, costGold, |
| | | # ChConfig.Def_Cost_BuyKillBossCnt, infoDict)
|
| | | # |
| | | # if not isOK:
|
| | | # return
|
| | | # # 增加购买次数
|
| | | # PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Boss_KillCntBuyCnt%killBossMark, hasBuyCnt + 1)
|
| | | # BossHurtMng.NotifyAttackBossCnt(curPlayer)
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | killBossMark = clientData.KillBossMark
|
| | | buyTimesVIPPriID = IpyGameDataPY.GetFuncEvalCfg("KillBossCntLimit1", 1, {}).get(killBossMark)
|
| | | if not buyTimesVIPPriID:
|
| | | return
|
| | | canBuyCnt = PlayerVip.GetPrivilegeValue(curPlayer, buyTimesVIPPriID)
|
| | | hasBuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Boss_KillCntBuyCnt%killBossMark, 0)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | if hasBuyCnt >= canBuyCnt:
|
| | | GameWorld.DebugLog('购买BOSS可击杀次数, 已达到今日最大可购买次数,hasBuyCnt=%s, canBuyCnt=%s'%(hasBuyCnt, canBuyCnt), playerID)
|
| | | return
|
| | | canKillCnt, dayTimesLimit = BossHurtMng.GetCanKillBossCnt(curPlayer, killBossMark)
|
| | | if canKillCnt >= dayTimesLimit:
|
| | | GameWorld.DebugLog('购买BOSS可击杀次数, 剩余次数已满!,canKillCnt=%s'%(canKillCnt), playerID)
|
| | | return
|
| | | |
| | | costGold = IpyGameDataPY.GetFuncEvalCfg("KillBossCntLimit1", 2, {}).get(killBossMark)
|
| | | if not costGold:
|
| | | return
|
| | | |
| | | infoDict = {"index":killBossMark, ChConfig.Def_Cost_Reason_SonKey:killBossMark}
|
| | | isOK = PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, costGold, |
| | | ChConfig.Def_Cost_BuyKillBossCnt, infoDict)
|
| | | |
| | | if not isOK:
|
| | | return
|
| | | # 增加购买次数
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Boss_KillCntBuyCnt%killBossMark, hasBuyCnt + 1)
|
| | | BossHurtMng.NotifyAttackBossCnt(curPlayer, killBossMark)
|
| | | return
|
| | |
|
| | | #// A2 23 NPC秀结束 #tagCMNPCShowEnd
|