| | |
| | | import PlayerFeastTravel
|
| | | import PlayerGoldInvest
|
| | | import PlayerWeekParty
|
| | | import NPCRealmRefresh
|
| | | import NPCHurtManager
|
| | | import PlayerActLogin
|
| | | import FamilyRobBoss
|
| | |
| | | randMinLV = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_NPCStrengthenMinLV)
|
| | | randMaxLV = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_NPCStrengthenMaxLV)
|
| | | strengthenLV = random.randint(randMinLV, randMaxLV)
|
| | | |
| | | # 根据境界难度
|
| | | elif lvStrengthenType == 5:
|
| | | realmLV = PlayerControl.GetDifficultyRealmLV(curNPC.GetSightLevel())
|
| | | realmNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("NPCRealmStrengthen", npcID, realmLV)
|
| | | if realmNPCIpyData:
|
| | | strengthenLV = realmNPCIpyData.GetLV()
|
| | | else:
|
| | | lvStrengthenType = 0
|
| | | |
| | | # 木桩怪最大、平均成长等级处理,直接取归属玩家等级
|
| | | if lvStrengthenType in [1, 2] and curNPC.GetType() in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
|
| | | owner = None
|
| | |
| | | index = 0
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | gameMap = GameWorld.GetMap()
|
| | | sightLevel = PlayerControl.GetMapRealmDifficulty(curPlayer)
|
| | | for posX, posY in ChConfig.Def_DropItemAreaMatrix:
|
| | | resultX = dropPosX + posX
|
| | | resultY = dropPosY + posY
|
| | |
| | | continue
|
| | |
|
| | | ChItem.AddMapDropItem(resultX, resultY, curItem, ownerInfo=[ChConfig.Def_NPCHurtTypePlayer, playerID],
|
| | | dropNPCID=npcID, isOnlySelfSee=isOnlySelfSee)
|
| | | dropNPCID=npcID, isOnlySelfSee=isOnlySelfSee, sightLevel=sightLevel)
|
| | | return
|
| | |
|
| | | def DoGiveItemByVirtualDrop(curPlayer, giveItemList, npcID, dropPosX=0, dropPosY=0, isDropDisperse=True, mailTypeKey="ItemNoPickUp", extraVirtualItemList=[]):
|
| | |
| | | if not ipyDrop:
|
| | | return
|
| | |
|
| | | realmNPCIpyData = None
|
| | | realmMapIDList = IpyGameDataPY.GetFuncEvalCfg("RealmDifficulty", 1)
|
| | | realmDifficulty = PlayerControl.GetRealmDifficulty(dropPlayer)
|
| | | if mapID in realmMapIDList and realmDifficulty:
|
| | | realmLV = PlayerControl.GetDifficultyRealmLV(realmDifficulty)
|
| | | realmNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("NPCRealmStrengthen", npcID, realmLV)
|
| | | #if realmNPCIpyData:
|
| | | # maxDropLV = realmNPCIpyData.GetMaxDrapLV()
|
| | | |
| | | #脱机暂不限制最大等级掉落
|
| | | #playerLV = dropPlayer.GetLV()
|
| | | #maxDropLV = ipyDrop.GetMaxDropLV()
|
| | |
| | | colorSuitPlaceKeyInfoDict = ipyDrop.GetEquipPartKeyRateInfo() # 装备部位集合信息 {(颜色,是否套装):部位集合key, ...}
|
| | | dropEquipIDDict = {}
|
| | | for classLV, color, dropCount in dropEquipInfoList:
|
| | | if realmNPCIpyData:
|
| | | classLV = realmNPCIpyData.GetEquipClassLV()
|
| | | GameWorld.DebugLog(" 脱机掉落对应难度境界装备: classLV=%s" % classLV, playerID)
|
| | | suitCountDict = {} # {套装:件数, ...}
|
| | | if color in colorSuitRateDict:
|
| | | suitRate = colorSuitRateDict[color]
|
| | |
| | | dropMoneyCnt += 1
|
| | | dropMoney = 0
|
| | | if dropMoneyCnt:
|
| | | dropMoney = __GetDropMoneyValue(dropPlayer, ipyDrop) * dropMoneyCnt
|
| | | dropMoney = __GetDropMoneyValue(dropPlayer, ipyDrop, realmNPCIpyData) * dropMoneyCnt
|
| | | GameWorld.DebugLog(" 金币掉率: dropMoneyRate=%s,moneyTotalRate=%s,dropMoneyCnt=%s,dropMoney=%s"
|
| | | % (dropMoneyRate, moneyTotalRate, dropMoneyCnt, dropMoney), playerID)
|
| | | dropIDCountDict = {}
|
| | |
| | | playerID = dropPlayer.GetPlayerID()
|
| | | playerLV = dropPlayer.GetLV()
|
| | | maxDropLV = ipyDrop.GetMaxDropLV()
|
| | | |
| | | realmNPCIpyData = None
|
| | | realmMapIDList = IpyGameDataPY.GetFuncEvalCfg("RealmDifficulty", 1)
|
| | | realmDifficulty = PlayerControl.GetRealmDifficulty(dropPlayer)
|
| | | if mapID in realmMapIDList and realmDifficulty:
|
| | | realmLV = PlayerControl.GetDifficultyRealmLV(realmDifficulty)
|
| | | realmNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("NPCRealmStrengthen", npcID, realmLV)
|
| | | if realmNPCIpyData:
|
| | | maxDropLV = realmNPCIpyData.GetMaxDrapLV()
|
| | | |
| | | if maxDropLV and playerLV > maxDropLV:
|
| | | GameWorld.DebugLog("超过最大可掉落等级,不掉落物品!npcID=%s,playerLV(%s) > maxDropLV(%s)" % (npcID, playerLV, maxDropLV))
|
| | | return
|
| | |
| | |
|
| | | for dropEquipInfo in dropEquipInfoList:
|
| | | classLV, color = dropEquipInfo[:2]
|
| | | if realmNPCIpyData:
|
| | | classLV = realmNPCIpyData.GetEquipClassLV()
|
| | | GameWorld.DebugLog("掉落对应难度境界装备: classLV=%s" % classLV, playerID)
|
| | | |
| | | if color in colorMaxDropCntDict:
|
| | | maxCount = colorMaxDropCntDict[color]
|
| | | dropCount = colorDropCntDict.get(color, 0)
|
| | |
| | |
|
| | | #GameWorld.DebugLog("NPCID=%s,金币掉率: %s, 执行次数=%s, 掉落金币数=%s" % (npcID, dropMoneyRate, dropMoneyDoCnt, dropMoneyCnt))
|
| | | if dropMoneyCnt:
|
| | | moneyValue = __GetDropMoneyValue(dropPlayer, ipyDrop)
|
| | | moneyValue = __GetDropMoneyValue(dropPlayer, ipyDrop, realmNPCIpyData)
|
| | | #GameWorld.DebugLog(" 掉落金币value=%s" % (moneyValue))
|
| | |
|
| | | if dropIDList:
|
| | |
| | | #GameWorld.DebugLog("独立概率装备掉落结果: doCnt=%s, %s" % (doCnt, dropEquipInfoList))
|
| | | return dropEquipInfoList
|
| | |
|
| | | def __GetDropMoneyValue(curPlayer, ipyDrop):
|
| | | def __GetDropMoneyValue(curPlayer, ipyDrop, realmNPCIpyData):
|
| | | baseMoney = FBLogic.OnGetNPCDropMoney(curPlayer)
|
| | | if baseMoney <= 0:
|
| | | # 获得掉落数量
|
| | | baseMoney = random.randint(ipyDrop.GetDropMoneyMin(), ipyDrop.GetDropMoneyMax())
|
| | | |
| | | if realmNPCIpyData:
|
| | | baseMoney = random.randint(realmNPCIpyData.GetDropMoneyMin(), realmNPCIpyData.GetDropMoneyMax())
|
| | | else:
|
| | | baseMoney = random.randint(ipyDrop.GetDropMoneyMin(), ipyDrop.GetDropMoneyMax())
|
| | | |
| | | if baseMoney <= 0:
|
| | | return 0
|
| | |
|
| | |
| | | # @param aiType: AI类型
|
| | | # @return 如果召唤失败返回None 否则返回召唤的NPC的实例
|
| | | # @remarks 在地图里召唤NPC 根据NPCID 出生点 AI类型 和TICK
|
| | | def SummonMapNpc(npcId, rebornX, rebornY, aiType=0, lastTime=0, playerID=0):
|
| | | def SummonMapNpc(npcId, rebornX, rebornY, aiType=0, lastTime=0, playerID=0, sightLevel=0, refreshID=0):
|
| | | curSummon = GameWorld.GetNPCManager().AddPlayerSummonNPC()
|
| | | if not curSummon:
|
| | | return
|
| | |
| | | if playerID > 0:
|
| | | curSummon.SetDict(ChConfig.Def_NPC_Dict_SummonMapNPCPlayerID, playerID)
|
| | |
|
| | | if sightLevel > 0:
|
| | | curSummon.SetSightLevel(sightLevel)
|
| | | |
| | | if refreshID > 0:
|
| | | curSummon.SetDict(ChConfig.Def_NPC_Dict_SummonRefreshID, refreshID)
|
| | | |
| | | if curSummon.GetType() == ChConfig.ntRobot:
|
| | | __OnFBRobotReborn(curSummon, curSummon.GetLV())
|
| | | curSummon.Reborn(rebornX, rebornY)
|
| | | |
| | | curSummon.Reborn(rebornX, rebornY, False)
|
| | | NPCControl(curSummon).DoNPCRebornCommLogic(tick)
|
| | |
|
| | | FBLogic.DoFBRebornSummonNPC(curSummon, tick)
|
| | | #__NotifyMapPlayerSummonMapNPC(npcId, rebornX, rebornY)
|
| | |
| | | summonPlayerID = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_SummonMapNPCPlayerID)
|
| | | if summonPlayerID > 0:
|
| | | curNPC.SetDict(ChConfig.Def_NPC_Dict_SummonMapNPCPlayerID, 0)
|
| | | |
| | | |
| | | refreshObj = NPCRealmRefresh.GetTagNPCRefresh(curNPC)
|
| | | if refreshObj:
|
| | | refreshObj.SetDead(GameWorld.GetGameWorld().GetTick())
|
| | | |
| | | # 暗金boss
|
| | | if ChConfig.IsGameBoss(curNPC):
|
| | | # 通知GameServer boss状态 封魔坛在副本里单独处理
|
| | |
| | | def __Func_GetRandPosInRefreshArea(self):
|
| | | curNPC = self.__Instance
|
| | | #得到地图刷新点
|
| | | posMap = curNPC.GetRefreshPosAt(curNPC.GetCurRefreshPointIndex())
|
| | | posMap = self.GetRefreshPoint()
|
| | | #范围校验
|
| | | if not posMap:
|
| | | GameWorld.ErrLog("__Func_GetRandPosInRefreshArea GetRefreshPosAt error: return None! npcID=%s" % curNPC.GetNPCID())
|
| | |
| | | return posX, poxY
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | def GetRefreshPoint(self):
|
| | | curNPC = self.__Instance
|
| | | refreshObj = NPCRealmRefresh.GetTagNPCRefresh(curNPC)
|
| | | if refreshObj:
|
| | | refreshPoint = refreshObj.GetRefreshPoint()
|
| | | else:
|
| | | refreshPoint = curNPC.GetRefreshPosAt(curNPC.GetCurRefreshPointIndex())
|
| | | return refreshPoint
|
| | | |
| | | ## 是否在移动范围内
|
| | | # @param self 类实例
|
| | | # @return 返回值真, 在移动范围内
|
| | |
| | | def IsInRefreshArea(self):
|
| | | #这个NPC是否在移动范围内
|
| | | curNPC = self.__Instance
|
| | | refreshPoint = curNPC.GetRefreshPosAt(curNPC.GetCurRefreshPointIndex())
|
| | | refreshPoint = self.GetRefreshPoint()
|
| | | #GameWorld.Log("posX = %d posY = %d, dist = %d"%(refreshPoint.GetPosX(), refreshPoint.GetPosY(), refreshPoint.GetMoveDist()))
|
| | | if self.GetIsInRefreshPoint(curNPC.GetPosX() , curNPC.GetPosY() , refreshPoint):
|
| | | return True
|
| | |
| | | npcID = curNPC.GetNPCID()
|
| | | specDropItemList = []
|
| | |
|
| | | playerLV = dropPlayer.GetLV()
|
| | | maxDropLV = ipyDrop.GetMaxDropLV()
|
| | | if maxDropLV and playerLV > maxDropLV:
|
| | | GameWorld.DebugLog("超过最大可掉落等级,不掉落物品,特殊掉落!npcID=%s,playerLV(%s) > maxDropLV(%s)" % (npcID, playerLV, maxDropLV))
|
| | | return specDropItemList
|
| | | #playerLV = dropPlayer.GetLV()
|
| | | #maxDropLV = ipyDrop.GetMaxDropLV()
|
| | | #if maxDropLV and playerLV > maxDropLV:
|
| | | # GameWorld.DebugLog("超过最大可掉落等级,不掉落物品,特殊掉落!npcID=%s,playerLV(%s) > maxDropLV(%s)" % (npcID, playerLV, maxDropLV))
|
| | | # return specDropItemList
|
| | |
|
| | | auctionItemCanSell = ipyDrop.GetAucionItemCanSell()
|
| | | # 击杀次数掉落算摸怪
|
| | |
| | | dropIDList += [moneyID] * dropMoneyCnt
|
| | |
|
| | | specItemSign = "SpecItem"
|
| | | playerSpecDropList = self.__NPCSpecialDropItem(dropPlayer, ownerPlayerList, ipyDrop) # 特殊掉落 [[ownerPlayer, itemID, isAuctionItem, isDropInItemPack], ...] 私有特殊掉落 + 击杀次数特殊掉落
|
| | | dropIDList += [specItemSign] * len(playerSpecDropList)
|
| | | playerSpecDropList = []
|
| | | if dropInfo:
|
| | | playerSpecDropList = self.__NPCSpecialDropItem(dropPlayer, ownerPlayerList, ipyDrop) # 特殊掉落 [[ownerPlayer, itemID, isAuctionItem, isDropInItemPack], ...] 私有特殊掉落 + 击杀次数特殊掉落
|
| | | dropIDList += [specItemSign] * len(playerSpecDropList)
|
| | |
|
| | | if len(dropIDList) > 5:
|
| | | #打乱物品顺序
|
| | |
| | | GameWorld.ErrLog("Boss没有掉落: dropPlayerLV=%s,ipyWorldLV=%s,maxDropLV=%s"
|
| | | % (dropPlayer.GetLV(), ipyDrop.GetMaxWorldLV(), ipyDrop.GetMaxDropLV()), dropPlayer.GetPlayerID())
|
| | |
|
| | | sightLevel = PlayerControl.GetMapRealmDifficulty(dropPlayer)
|
| | | gameMap = GameWorld.GetMap()
|
| | | dropPosX, dropPosY = curNPC.GetPosX(), curNPC.GetPosY() # 以NPC为中心点开始掉落
|
| | | index = 0
|
| | |
| | | SendVirtualItemDrop(ownerPlayer, itemID, resultX, resultY, dropItemDataStr)
|
| | |
|
| | | else:
|
| | | self.__MapCreateItem(curItem, resultX, resultY, ownerType, ownerID, isOnlySelfSee=isOnlySelfSee)
|
| | | self.__MapCreateItem(curItem, resultX, resultY, ownerType, ownerID, isOnlySelfSee=isOnlySelfSee, sightLevel=sightLevel)
|
| | | return
|
| | | #---------------------------------------------------------------------
|
| | | ## NPC被杀死逻辑处理
|
| | |
| | | curNPC = self.__Instance
|
| | |
|
| | | # VIP杀怪加攻
|
| | | PlayerVip.DoAddVIPKillLVExp(lastHurtPlayer, curNPC)
|
| | | PlayerVip.DoAddVIPKillLVExp(lastHurtPlayer, GetNPCLV(curNPC))
|
| | |
|
| | | # SPֵ
|
| | | PlayerControl.AddZhenQiByKillNPC(lastHurtPlayer, curNPC.GetSP())
|
| | |
| | | if baseExp > 0:
|
| | | return baseExp
|
| | |
|
| | | baseExp = curNPC.GetExp()
|
| | | npcID = curNPC.GetNPCID()
|
| | | realmLV = PlayerControl.GetDifficultyRealmLV(curNPC.GetSightLevel())
|
| | | realmNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("NPCRealmStrengthen", npcID, realmLV)
|
| | | if realmNPCIpyData:
|
| | | baseExp = realmNPCIpyData.GetExp()
|
| | | else:
|
| | | baseExp = curNPC.GetExp()
|
| | | |
| | | if baseExp == 0:
|
| | | #GameWorld.Log("杀怪经验异常,该NPC = %s,无经验"%(curNPC.GetID()))
|
| | | return 0
|
| | |
| | | # @param dropType: 掉落类型
|
| | | # @param ownerID: 归属者
|
| | | # @return: None
|
| | | def __MapCreateItem(self, curItem, posX, posY, dropType, ownerID, isOnlySelfSee=False):
|
| | | def __MapCreateItem(self, curItem, posX, posY, dropType, ownerID, isOnlySelfSee=False, sightLevel=0):
|
| | | if not curItem:
|
| | | return
|
| | |
|
| | |
| | | # 在地上添加物品(统一接口)
|
| | | dropNPCID = 0 if not ChConfig.IsGameBoss(curNPC) else curNPCID
|
| | | 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)
|
| | | curMapItem = ChItem.AddMapDropItem(posX, posY, curItem, ownerInfo=[dropType, ownerID, specOwnerIDList], dropNPCID=dropNPCID, isOnlySelfSee=isOnlySelfSee, sightLevel=sightLevel)
|
| | |
|
| | | #设置该物品生前拥有者(那个NPC掉落的)
|
| | | if curMapItem == None:
|
| | |
| | | npcData = GameWorld.GetGameData().FindNPCDataByID(npcID)
|
| | | if not npcData:
|
| | | return 0
|
| | | baseExp = npcData.GetExp()
|
| | | needRealmLV = PlayerControl.GetDifficultyRealmLV(PlayerControl.GetRealmDifficulty(curPlayer))
|
| | | realmNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("NPCRealmStrengthen", npcID, needRealmLV)
|
| | | if realmNPCIpyData:
|
| | | baseExp = realmNPCIpyData.GetExp()
|
| | | else:
|
| | | baseExp = npcData.GetExp()
|
| | | if not baseExp:
|
| | | return 0
|
| | | npcLV = npcData.GetLV()
|