| | |
| | | if count != 1:
|
| | | hp, hpEx = 0, 0 # 指定血量的暂仅适用于单只的
|
| | |
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | if playerID not in PyGameData.g_playerPriWoodPileNPCDict:
|
| | | PyGameData.g_playerPriWoodPileNPCDict[playerID] = []
|
| | | playerPriWoodNPCList = PyGameData.g_playerPriWoodPileNPCDict[playerID]
|
| | | maxCount = 10
|
| | | nowCount = 0
|
| | | # 只允许存在一个私有木桩
|
| | | indexList = range(curPlayer.GetSummonCount())
|
| | | for index in indexList[::-1]:
|
| | | summonNPC = curPlayer.GetSummonNPCAt(index)
|
| | | if not summonNPC:
|
| | | continue
|
| | | npcType = summonNPC.GetType()
|
| | | if npcType not in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
|
| | | continue
|
| | | if nowCount >= maxCount or summonNPC.GetNPCID() != npcID:
|
| | | SetDeadEx(summonNPC)
|
| | | else:
|
| | | nowCount += 1
|
| | | |
| | | 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))
|
| | | if summonCount <= 0:
|
| | | return
|
| | |
|
| | | npcManager = GameWorld.GetNPCManager()
|
| | | for _ in xrange(summonCount):
|
| | | summonNPC = curPlayer.SummonNewNPC()
|
| | | #summonNPC = curPlayer.SummonNewNPC()
|
| | | summonNPC = npcManager.AddPlayerSummonNPC()
|
| | |
|
| | | #设置召唤兽基础信息
|
| | | summonNPC.SetNPCTypeID(npcID)
|
| | | summonNPC.SetSightLevel(curPlayer.GetSightLevel())
|
| | | #初始化
|
| | | InitNPC(summonNPC)
|
| | |
|
| | | #玩家召唤兽列表添加召唤兽,召唤兽添加主人
|
| | | summonNPC.SetOwner(curPlayer)
|
| | | summonNPC.SetDict(ChConfig.Def_NPC_Dict_SummonMapNPCPlayerID, curPlayer.GetPlayerID())
|
| | | #summonNPC.SetOwner(curPlayer)
|
| | | summonNPC.SetDict(ChConfig.Def_NPC_Dict_PriWoodPilePlayerID, playerID)
|
| | |
|
| | | #将召唤兽召唤出来
|
| | | #玩家周围随机出生点
|
| | |
| | | if hp or hpEx:
|
| | | summonNPC.SetHP(hp)
|
| | | summonNPC.SetHPEx(hpEx)
|
| | | |
| | | #if not curPlayer.GetSight():
|
| | | summonNPCAppear = ChNetSendPack.tagPlayerSummonNPCAppear()
|
| | | summonNPCAppear.Clear()
|
| | | summonNPCAppear.PlayerID = curPlayer.GetPlayerID()
|
| | | summonNPCAppear.ObjID = summonNPC.GetID()
|
| | | summonNPCAppear.NPCID = summonNPC.GetNPCID()
|
| | | summonNPCAppear.PosX = summonNPC.GetPosX()
|
| | | summonNPCAppear.PosY = summonNPC.GetPosY()
|
| | | summonNPCAppear.HP = summonNPC.GetHP()
|
| | | summonNPCAppear.HPEx = summonNPC.GetHPEx()
|
| | | summonNPCAppear.MaxHP = summonNPC.GetMaxHP()
|
| | | summonNPCAppear.MaxHPEx = summonNPC.GetMaxHPEx()
|
| | | summonNPCAppear.Speed = summonNPC.GetSpeed()
|
| | | summonNPCAppear.LV = GetNPCLV(summonNPC)
|
| | | summonNPCAppear.OwnerName = curPlayer.GetPlayerName()
|
| | | summonNPCAppear.OwnerNameLen = len(summonNPCAppear.OwnerName)
|
| | | NetPackCommon.SendFakePack(curPlayer, summonNPCAppear)
|
| | | summonNPC.NotifyAppear() # 最终统一通知NPC出现
|
| | | playerPriWoodNPCList.append(summonNPC)
|
| | |
|
| | | return
|
| | |
|
| | | def ClearPriWoodPile(curPlayer):
|
| | | ## 清除私有木桩
|
| | | indexList = range(curPlayer.GetSummonCount())
|
| | | for index in indexList[::-1]:
|
| | | summonNPC = curPlayer.GetSummonNPCAt(index)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | if playerID not in PyGameData.g_playerPriWoodPileNPCDict:
|
| | | return
|
| | | playerPriWoodNPCList = PyGameData.g_playerPriWoodPileNPCDict.pop(playerID)
|
| | | for summonNPC in playerPriWoodNPCList:
|
| | | if not summonNPC:
|
| | | continue
|
| | | npcType = summonNPC.GetType()
|
| | | if npcType not in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
|
| | | continue
|
| | | SetDeadEx(summonNPC)
|
| | | return
|
| | |
| | | if curNPC.GetGameObjType() == IPY_GameWorld.gotNPC:
|
| | | FBLogic.DoFB_NPCDead(curNPC)
|
| | |
|
| | | ownerPlayer = None
|
| | | summonPlayerID = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_SummonMapNPCPlayerID)
|
| | | if summonPlayerID > 0:
|
| | | ownerPlayer = GameWorld.GetObj(summonPlayerID, IPY_GameWorld.gotPlayer)
|
| | | curNPC.SetDict(ChConfig.Def_NPC_Dict_SummonMapNPCPlayerID, 0)
|
| | |
|
| | | # 暗金boss
|
| | |
| | | lineRobotJobDict.pop(curNPC.GetID(), 0)
|
| | | PyGameData.g_fbRobotJobDict[lineID] = lineRobotJobDict
|
| | |
|
| | | if ownerPlayer and not ownerPlayer.GetSight():
|
| | | npcDie = ChNetSendPack.tagNPCDie()
|
| | | npcDie.ObjID = curNPC.GetID()
|
| | | npcDie.Reason = curNPC.GetDictByKey(ChConfig.Def_NPCDead_Reason)
|
| | | npcDie.KillerType = curNPC.GetDictByKey(ChConfig.Def_NPCDead_KillerType)
|
| | | npcDie.KillerID = curNPC.GetDictByKey(ChConfig.Def_NPCDead_KillerID)
|
| | | NetPackCommon.SendFakePack(ownerPlayer, npcDie)
|
| | | |
| | | priWoodPilePlayerID = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_PriWoodPilePlayerID)
|
| | | if priWoodPilePlayerID > 0 and priWoodPilePlayerID in PyGameData.g_playerPriWoodPileNPCDict:
|
| | | priWoodPileNPCList = PyGameData.g_playerPriWoodPileNPCDict[priWoodPilePlayerID]
|
| | | for priWoodNPC in priWoodPileNPCList:
|
| | | if priWoodNPC and priWoodNPC.GetID() == curNPC.GetID():
|
| | | priWoodPileNPCList.remove(priWoodNPC)
|
| | | if not priWoodPileNPCList:
|
| | | PyGameData.g_playerPriWoodPileNPCDict.pop(priWoodPilePlayerID)
|
| | | break
|
| | | |
| | | # C++设置npc死亡
|
| | | curNPC.SetDead(curNPC.GetDictByKey(ChConfig.Def_NPCDead_Reason),
|
| | | curNPC.GetDictByKey(ChConfig.Def_NPCDead_KillerType),
|