From 93591a53c1cdabb4e595fa4d5c36eb89998a6e6f Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期六, 25 五月 2019 18:50:56 +0800
Subject: [PATCH] 6805 【后端】【2.0】副本前端化(召唤木桩由玩家召唤兽改为普通NPC)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/KillScreenNPC.py | 2 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py | 80 ++++++++++++++--------------------------
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py | 4 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py | 1
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py | 1
5 files changed, 35 insertions(+), 53 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index eca2218..795c1fc 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -2974,6 +2974,7 @@
Def_NPC_Dict_FromRefreshValue = 'FromRefreshValue'
#召唤地图NPC的玩家ID
Def_NPC_Dict_SummonMapNPCPlayerID = 'SummonMapNPCPlayerID'
+Def_NPC_Dict_PriWoodPilePlayerID = 'PriWoodPilePlayerID'
#NPC技能已使用次数
Def_NPC_Dict_SkillUseCnt = 'NPCSkillUseCnt_%s' # 参数skillTypeID
#不死的boss
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/KillScreenNPC.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/KillScreenNPC.py
index 9ddcc20..94a6d4a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/KillScreenNPC.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/KillScreenNPC.py
@@ -81,6 +81,8 @@
return
if not curNPC.GetVisible():
return
+ if curPlayer.GetSightLevel() != curNPC.GetSightLevel():
+ return
curHP = GameObj.GetHP(curNPC)
AttackCommon.NPCAddObjInHurtList(curPlayer, curNPC, curHP, curHP)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
index 0a1dac5..342bef8 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -2040,39 +2040,32 @@
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)
#将召唤兽召唤出来
#玩家周围随机出生点
@@ -2082,36 +2075,19 @@
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
@@ -2134,10 +2110,8 @@
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
@@ -2165,14 +2139,16 @@
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),
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
index 18abd92..9492c61 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -1243,6 +1243,7 @@
PyGameData.g_playerFuncAttrDict.pop(playerID, None)
PyGameData.g_playerEquipPartAttrDict.pop(playerID, None)
PyGameData.g_equipChangeClassLVInfo.pop(playerID, None)
+ NPCCommon.ClearPriWoodPile(curPlayer)
return
##更新保存玩家在线时间
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
index 78f9875..db2f13f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
@@ -105,4 +105,6 @@
g_crossPlayerServerGroupIDInfo = {} #跨服玩家服务器组ID缓存,副本线路关闭时才释放,所以支持离线跨服玩家 {copyMapID:{playerID:serverGroupID, ...}, ...}
g_fbBuyBuffTimeDict = {} # 副本购买buff时间缓存{playerID:{moneyCnt:time}}
g_fairyDomainLimit = [] #全服已限制的缥缈仙域事件
-g_elemntSkillDict = {} #{skillID:[attrID*100000+needValue,..]}
\ No newline at end of file
+g_elemntSkillDict = {} #{skillID:[attrID*100000+needValue,..]}
+
+g_playerPriWoodPileNPCDict = {} # {playerID:[npcObj, ...], ...}
--
Gitblit v1.8.0