| | |
| | | NPCAttr_ParamDict, # 过程参数公式
|
| | | NPCAttr_AttrStrengthenList, # 等级成长属性公式
|
| | | NPCAttr_PlayerCntCoefficient, # 地图人数对应属性额外成长系数 {mapID:{"属性名":{组队进入人数:系数, ...}, ...}, ...}
|
| | | NPCAttr_NPCPlayerCntCoefficient, # NPC特殊成长人数对应属性额外成长系数 {npcID:{"属性名":{人数:系数, ...}, ...}, ...}, 优先级大于地图人数系数
|
| | | NPCAttr_DynNPCLVMap, # 动态等级的地图ID列表,默认已刷新出来的NPC等级不会再变更,下次刷出来的怪物等级变更 [地图ID, ...]
|
| | | NPCAttr_DynPCCoefficientMap, # 动态人数系数的地图ID {地图ID:是否马上刷新属性, ...}
|
| | | ) = range(5)
|
| | | ) = range(6)
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | ##NPC初始化->出生调用
|
| | |
| | | gameFB = GameWorld.GetGameFB()
|
| | |
|
| | | if strengthenIpyData.GetIsStrengthenByPlayerCount():
|
| | | strengthenPlayerCnt = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_NPCStrengthenPlayerCnt)
|
| | | if not strengthenPlayerCnt:
|
| | | GameWorld.ErrLog("NPC配置了按玩家人数成长类型,但是无法获取到对应的玩家人数!npcID=%s" % (npcID))
|
| | | return
|
| | | |
| | | if FamilyRobBoss.IsHorsePetRobBoss(npcID):
|
| | | strengthenPlayerCnt = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_HorsePetRobBossPlayerCount)
|
| | | else:
|
| | | strengthenPlayerCnt = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_NPCStrengthenPlayerCnt)
|
| | | if not strengthenPlayerCnt:
|
| | | GameWorld.ErrLog("NPC配置了按玩家人数成长类型,但是无法获取到对应的玩家人数!npcID=%s" % (npcID))
|
| | | return
|
| | | |
| | | lvStrengthenType = strengthenIpyData.GetLVStrengthenType()
|
| | | # 根据世界等级
|
| | | if lvStrengthenType == 3:
|
| | |
| | | elif lvStrengthenType == 1:
|
| | | strengthenLV = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_NPCStrengthenAverageLV)
|
| | |
|
| | | if strengthenIpyData.GetCmpNPCBaseLV():
|
| | | strengthenLV = max(strengthenLV, curNPC.GetLV())
|
| | | |
| | | if lvStrengthenType in [1, 2] and not strengthenLV:
|
| | | GameWorld.ErrLog("NPC配置了成长等级类型,但是无法获取到对应的成长等级值!npcID=%s,lvStrengthenType=%s" % (npcID, lvStrengthenType))
|
| | | return
|
| | |
| | | paramDict = attrStrengthenInfo[NPCAttr_ParamDict] # 过程参数公式字典
|
| | | attrStrengthenList = attrStrengthenInfo[NPCAttr_AttrStrengthenList] # 属性成长公式字典
|
| | | playerCntCoefficient = attrStrengthenInfo[NPCAttr_PlayerCntCoefficient] # 人数系数
|
| | | npcIDPlayerCntCoefficient = attrStrengthenInfo[NPCAttr_NPCPlayerCntCoefficient] # 特殊NPC人数系数
|
| | | baseMaxHP = npcData.GetHPEx() * ShareDefine.Def_PerPointValue + npcData.GetHP()
|
| | |
|
| | | if strengthenLV:
|
| | |
| | | playerCntAttrCoefficient = playerCntCoefficient.get(mapID, {})
|
| | | if not playerCntAttrCoefficient and dataMapID in playerCntCoefficient:
|
| | | playerCntAttrCoefficient = playerCntCoefficient[dataMapID]
|
| | | if npcID in npcIDPlayerCntCoefficient:
|
| | | playerCntAttrCoefficient = npcIDPlayerCntCoefficient[npcID]
|
| | | for attrKey, coefficientDict in playerCntAttrCoefficient.items():
|
| | | if attrKey in attrDict:
|
| | | attrValue = attrDict[attrKey]
|
| | |
| | | msgInfo = str([itemID, updKilledCnt])
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "GlobalDropRate", msgInfo, len(msgInfo))
|
| | |
|
| | | # 4. 指定全服击杀次数必掉,算额外掉落
|
| | | globalKillDropDict = IpyGameDataPY.GetFuncEvalCfg("GlobalDropCD", 2) # {NPCID:{击杀次数:[是否本职业, [物品ID, ...], [随机物品ID, ...]]}, ...}
|
| | | if npcID in globalKillDropDict:
|
| | | killCountDropDict = globalKillDropDict[npcID]
|
| | | updNPCKilledCount = min(gw.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_NPCKilledCount % npcID) + 1, ShareDefine.Def_UpperLimit_DWord)
|
| | | GameWorld.DebugLog("更新全服击杀次数: %s" % updNPCKilledCount)
|
| | | # 通知GameServer记录
|
| | | msgInfo = str([npcID, updNPCKilledCount])
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "GlobalKillCount", msgInfo, len(msgInfo))
|
| | | if updNPCKilledCount in killCountDropDict:
|
| | | isJobLimit, itemIDList, randItemIDList = killCountDropDict[updNPCKilledCount]
|
| | | for itemID in itemIDList:
|
| | | if isJobLimit:
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
|
| | | if not itemData:
|
| | | continue
|
| | | itemJob = itemData.GetJobLimit() / 100
|
| | | if itemJob and itemJob != curPlayer.GetJob():
|
| | | # 非本职业可用,不掉落
|
| | | GameWorld.DebugLog("全服击杀次数必掉,非本职业可用,不掉落! itemID=%s" % itemID)
|
| | | continue
|
| | | dropItemIDList.append(itemID)
|
| | | GameWorld.DebugLog("全服击杀次数必掉物品: itemID=%s" % itemID)
|
| | | if randItemIDList:
|
| | | if isJobLimit:
|
| | | randJobItemList = []
|
| | | for rItemID in randItemIDList:
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(rItemID)
|
| | | if not itemData:
|
| | | continue
|
| | | itemJob = itemData.GetJobLimit() / 100
|
| | | if itemJob and itemJob != curPlayer.GetJob():
|
| | | # 非本职业可用,不掉落
|
| | | GameWorld.DebugLog("全服击杀次数必掉随机,非本职业可用,不掉落! rItemID=%s" % rItemID)
|
| | | continue
|
| | | randJobItemList.append(rItemID)
|
| | | randItemID = random.choice(randJobItemList)
|
| | | else:
|
| | | randItemID = random.choice(randItemIDList)
|
| | | dropItemIDList.append(randItemID)
|
| | | GameWorld.DebugLog("全服击杀次数必掉随机物品: randItemID=%s" % randItemID)
|
| | | |
| | | return dropItemIDList
|
| | |
|
| | | def __GetEquipIDList(npcID, classLV, color, placeList, star, itemJobList, tagPlace=None):
|
| | |
| | |
|
| | | if GetDropOwnerType(curNPC) == ChConfig.DropOwnerType_Family:
|
| | | FamilyRobBoss.ClearFamilyOwnerBossHurt(curNPC)
|
| | | ChNPC.OnNPCSetDead(curNPC)
|
| | |
|
| | |
|
| | | # 清除队伍成员伤血列表
|
| | |
| | |
|
| | | def __GetTeamHurtNPCPlayerIDList(self, refreshPoint, teamID, tick):
|
| | |
|
| | | curNPC = self.__Instance
|
| | | teamHurtPlayerIDList = []
|
| | | # 如果没有在线队员在有效范围内,则进一步判断离线队员是否有伤血保护中的
|
| | | playerMgr = GameWorld.GetPlayerManager()
|
| | |
| | | continue
|
| | |
|
| | | #if curTeamPlayer.GetHP() > 0 and self.GetIsInRefreshPoint(curTeamPlayer.GetPosX(), curTeamPlayer.GetPosY(), refreshPoint):
|
| | | if self.GetIsInRefreshPoint(curTeamPlayer.GetPosX(), curTeamPlayer.GetPosY(), refreshPoint):
|
| | | if self.GetIsInRefreshPoint(curTeamPlayer.GetPosX(), curTeamPlayer.GetPosY(), refreshPoint) \
|
| | | and AttackCommon.CheckKillNPCByCnt(curTeamPlayer, curNPC, False):
|
| | | #GameWorld.DebugLog("有队员在boss范围内,保留队伍伤血!teamID=%s,playerID=%s" % (teamID, curTeamPlayer.GetPlayerID()))
|
| | | teamHurtPlayerIDList.append(playerID)
|
| | | else:
|
| | |
| | | curNPC = self.__Instance
|
| | | #清除状态
|
| | | self.__ClearNPCAllState(False)
|
| | | #初始化召唤兽
|
| | | self.__InitNPCSummon()
|
| | | #重置技能CD
|
| | | self.__NormalNPCInItCD()
|
| | | #只在重生或者满血的状态下才重置以下内容
|
| | | if isReborn or GameObj.GetHP(curNPC) >= GameObj.GetMaxHP(curNPC):
|
| | | #初始化召唤兽
|
| | | self.__InitNPCSummon()
|
| | | #重置技能CD
|
| | | self.__NormalNPCInItCD()
|
| | | |
| | | #重刷属性
|
| | | self.RefreshNPCState(isReborn=isReborn)
|
| | | #通知血量, 复活的情况不通知血量,由NPC出现包通知
|
| | |
| | |
|
| | | self.__AllKillerDict, curTeam, hurtType, hurtID = self.__FindNPCKillerInfo()
|
| | | self.__OwnerHurtType, self.__OwnerHurtID = hurtType, hurtID
|
| | | isGameBoss = ChConfig.IsGameBoss(curNPC)
|
| | |
|
| | | #最后一击处理
|
| | | self.__DoLastTimeHurtLogic()
|
| | |
| | | elif hurtType == ChConfig.Def_NPCHurtTypeFamily:
|
| | | self.__KilledByFamilySetPrize(hurtType, hurtID)
|
| | |
|
| | | else:
|
| | | elif isGameBoss:
|
| | | GameWorld.ErrLog("NPC归属异常:npcID=%s,hurtType=%s,hurtID=%s" % (npcID, hurtType, hurtID))
|
| | | |
| | | |
| | | if isGameBoss:
|
| | | dataDict = {"objID":curNPC.GetID(), "bossID":npcID, "mapID":GameWorld.GetMap().GetMapID(),
|
| | | "lineID":GameWorld.GetGameWorld().GetLineID(), "teamID":curTeam.GetTeamID() if curTeam else 0,
|
| | | "killerID":self.__AllKillerDict.keys(), "hurtType":hurtType,"hurtID":hurtID}
|
| | | DataRecordPack.SendEventPack("KillBossRecord", dataDict)
|
| | | |
| | | if OnNPCDie:
|
| | | OnNPCDie(curNPC, hurtType, hurtID)
|
| | |
|
| | |
| | | #掉落归属
|
| | | if mapFBType != IPY_GameWorld.fbtNull:
|
| | | FBLogic.DoFB_DropOwner(curPlayer , curNPC)
|
| | | |
| | | else:
|
| | | if curNPC.GetLV()>=curPlayer.GetLV() - IpyGameDataPY.GetFuncCfg('DailyQuestKillMonster'):
|
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_KillNPC)
|
| | | |
| | | killBossCntLimitDict = IpyGameDataPY.GetFuncCfg('KillBossCntLimit', 1)
|
| | | limitIndex = GameWorld.GetDictValueByKey(killBossCntLimitDict, npcID)
|
| | | if limitIndex != None:
|
| | |
| | | dataDict = {"objID":curNPC.GetID(), "bossID":npcID, "touchCnt":newCnt,
|
| | | "AccID":curPlayer.GetAccID(), "PlayerID":curPlayer.GetPlayerID()}
|
| | | DataRecordPack.SendEventPack("AddKillBossCnt", dataDict, curPlayer)
|
| | | |
| | | if limitIndex == 0:
|
| | | # 世界BOSS击杀成就
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_KillWorldBoss, 1)
|
| | |
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_BOSSHome)
|
| | | PlayerBossReborn.AddBossRebornActionCnt(curPlayer, ChConfig.Def_BRAct_BOSSHome, 1)
|
| | | PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_BossHome, 1)
|
| | | #击杀特定NPC成就
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_KillSpecificNPC, 1, [npcID])
|
| | | |
| | | |
| | | return
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
| | | #不是普通NPC
|
| | | elif npcObjType != IPY_GameWorld.gnotNormal:
|
| | | return
|
| | | |
| | | npcID = curNPC.GetNPCID()
|
| | | #GameWorld.DebugLog("__MissionOnKillNPC isFeel=%s" % (isFeel), curPlayer.GetPlayerID())
|
| | | killBossCntLimitDict = IpyGameDataPY.GetFuncCfg('KillBossCntLimit', 1)
|
| | | limitIndex = GameWorld.GetDictValueByKey(killBossCntLimitDict, curNPC.GetNPCID())
|
| | | limitIndex = GameWorld.GetDictValueByKey(killBossCntLimitDict, npcID)
|
| | | isWorldBoos = limitIndex == 0
|
| | | if isFeel:
|
| | | #击杀NPC触发摸怪任务事件
|
| | |
| | | EventShell.EventRespons_OnKillById(curPlayer, curNPC)
|
| | | if isWorldBoos:
|
| | | EventShell.EventRespons_KillWorldBoss(curPlayer)
|
| | | |
| | | #击杀特定NPC成就
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_KillSpecificNPC, 1, [npcID])
|
| | | return
|
| | |
|
| | | def __GetIsLog(self):
|
| | |
| | | return max(value / pow(10, nlen), 1)
|
| | |
|
| | |
|
| | | Def_CollNPCCfg_Len = 9
|
| | | Def_CollNPCCfg_Len = 10
|
| | | (
|
| | | Def_CollNPCCfg_CanTogether, # 是否允许同时采集
|
| | | Def_CollNPCCfg_SysMsgMark, # 不可同时采集提示
|
| | |
| | | Def_CollNPCCfg_ZhenQi, # 获得的真气/魔魂
|
| | | Def_CollNPCCfg_GiveItemModeID, # 获得的物品信息模板编号
|
| | | Def_CollNPCCfg_NotCostItemNotify, # 消耗品不足提示
|
| | | Def_CollNPCCfg_LimitSysMsgMark, #采集上限提示
|
| | | ) = range(Def_CollNPCCfg_Len)
|
| | |
|
| | |
|
| | |
| | | GameWorld.DebugLog(" maxTime=%s,todayTime=%s" % (limitMaxTime, todayCollTime))
|
| | |
|
| | | if limitMaxTime > 0 and todayCollTime >= limitMaxTime:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_liubo_807125")
|
| | | |
| | | PlayerControl.NotifyCode(curPlayer, collectNPCInfo[Def_CollNPCCfg_LimitSysMsgMark], [limitMaxTime])
|
| | | return True
|
| | |
|
| | | # 采集消耗
|
| | |
| | |
|
| | | PlayerControl.Sync_PrepareBegin(curPlayer, prepareTime, IPY_GameWorld.pstMissionCollecting, \
|
| | | prepareID=curNPC.GetID())
|
| | | |
| | | FBLogic.OnBeginCollect(curPlayer, curNPC)
|
| | | ##添加这个NPC的伤血列表,用于判断可否同时采集,改为字典判断
|
| | | AttackCommon.AddHurtValue(curNPC, curPlayer.GetPlayerID(), ChConfig.Def_NPCHurtTypePlayer, 1)
|
| | | return
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CollNpcIDCollTime % npcID, updCollTime)
|
| | | SyncCollNPCTime(curPlayer, npcIDList=[npcID])
|
| | | GameWorld.DebugLog(" 增加当日采集次数: todayCollTime=%s,updCollTime=%s" % (todayCollTime, updCollTime))
|
| | | |
| | | #采集成就
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_Collect, successCnt, [npcID])
|
| | | SyncCollectionItemInfo(curPlayer, addExp, addMoney, addZhenQi, giveItemInfoList, npcID)
|
| | | #DataRecordPack.DR_CollectNPCOK(curPlayer, npcID, addMoney, addExp, addZhenQi, giveItemInfoList)
|
| | | return True
|
| | |
| | | GameWorld.DebugLog(" 最终可得到物品giveItemInfoList=%s" % giveItemInfoList)
|
| | |
|
| | | syncItemInfoList = [] # 同步的采集到的物品信息列表
|
| | | for itemType, itemID, itemCnt, isBind in giveItemInfoList:
|
| | | for itemID, itemCnt, isBind in giveItemInfoList:
|
| | | if not ItemCommon.CheckPackHasSpace(curPlayer, IPY_GameWorld.rptItem):
|
| | | break
|
| | |
|
| | | isBind = setBind or isBind
|
| | | if itemType == 0:
|
| | | getItemObj = ItemControler.GetOutPutItemObj(itemID)
|
| | | elif itemType == 1:
|
| | | itemDictData = ItemControler.GetAppointItemDictData(itemID, isBind)
|
| | | getItemObj = ItemControler.GetItemByData(itemDictData)
|
| | | elif itemType == 2:
|
| | | quality = ItemCommon.GetRandEquipQualityByTable(itemID, "CollectEquipRandQuality")
|
| | | if quality == 0:
|
| | | isBroadcast = False
|
| | | getItemObj = ItemCommon.RandNormalEquip(curPlayer, itemID, isBind, "CollectNormalEquip")
|
| | | else:
|
| | | getItemObj, isBroadcast = ItemCommon.RandGreateEquip(curPlayer, itemID, isBind, "CollectGreateEquip", quality)
|
| | | if getItemObj == None:
|
| | | continue
|
| | | |
| | | itemID = getItemObj.GetItemTypeID()
|
| | | |
| | | getItemObj = ItemControler.GetOutPutItemObj(itemID)
|
| | | # elif itemType == 1:
|
| | | # itemDictData = ItemControler.GetAppointItemDictData(itemID, isBind)
|
| | | # getItemObj = ItemControler.GetItemByData(itemDictData)
|
| | | # elif itemType == 2:
|
| | | # quality = ItemCommon.GetRandEquipQualityByTable(itemID, "CollectEquipRandQuality")
|
| | | # if quality == 0:
|
| | | # isBroadcast = False
|
| | | # getItemObj = ItemCommon.RandNormalEquip(curPlayer, itemID, isBind, "CollectNormalEquip")
|
| | | # else:
|
| | | # getItemObj, isBroadcast = ItemCommon.RandGreateEquip(curPlayer, itemID, isBind, "CollectGreateEquip", quality)
|
| | | # if getItemObj == None:
|
| | | # continue
|
| | | # |
| | | # itemID = getItemObj.GetItemTypeID()
|
| | | userData = getItemObj.GetUserData()
|
| | | getItemObj.SetCount(itemCnt)
|
| | | getItemObj.SetIsBind(isBind)
|
| | | ItemCommon.NotifyItemDropByKill(curPlayer, getItemObj, npcID)
|
| | |
|
| | | SendGameServerGoodItemRecord(mapID, npcID, curPlayer.GetPlayerName(), curPlayer.GetPlayerID(), itemID)
|
| | | #SendGameServerGoodItemRecord(mapID, npcID, curPlayer.GetPlayerName(), curPlayer.GetPlayerID(), itemID)
|
| | | #可以放入背包
|
| | | if not ItemControler.DoLogic_PutItemInPack(curPlayer, getItemObj, True, True,
|
| | | event=["CollectNPC", False, {"npcID":npcID}]):
|
| | | break
|
| | | syncItemInfoList.append([itemType, itemID, itemCnt, isBind, userData])
|
| | | syncItemInfoList.append([itemID, itemCnt, isBind, userData])
|
| | | return syncItemInfoList
|
| | |
|
| | | ## 采集结果同步
|