From 14661edf6156dbc38b2fe4bdf0a15cceacc52897 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 31 五月 2019 16:04:19 +0800
Subject: [PATCH] 6805 【后端】【2.0】副本前端化(去除木桩非自定义场景召唤限制,最大同时存在木桩数改为3个,设置玩家血量改为玩家掉血)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Player_Attack_NormalNPC.py    |    7 ++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py                               |    1 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SummonNPC.py                         |   20 ------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_PriWood.py                      |    6 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini                                           |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py                                   |   20 +++---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py                               |   23 ++++---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Player_Attack_SummonNPC.py    |    3 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py                                 |   12 +--
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py                                                        |   20 +++---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py               |    4 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/SummonNPC_Attack_SummonNPC.py |    3 
 12 files changed, 60 insertions(+), 61 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
index e56f530..1abe51e 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -14514,14 +14514,14 @@
 
 
 #------------------------------------------------------
-# B4 0E 设置玩家自身血量 #tagCMSetRoleHP
+# B4 0E 玩家掉血 #tagCMRoleLostHP
 
-class  tagCMSetRoleHP(Structure):
+class  tagCMRoleLostHP(Structure):
     _pack_ = 1
     _fields_ = [
                   ("Cmd", c_ubyte),
                   ("SubCmd", c_ubyte),
-                  ("HP", c_int),    
+                  ("LostHP", c_int),    
                   ]
 
     def __init__(self):
@@ -14538,31 +14538,31 @@
     def Clear(self):
         self.Cmd = 0xB4
         self.SubCmd = 0x0E
-        self.HP = 0
+        self.LostHP = 0
         return
 
     def GetLength(self):
-        return sizeof(tagCMSetRoleHP)
+        return sizeof(tagCMRoleLostHP)
 
     def GetBuffer(self):
         return string_at(addressof(self), self.GetLength())
 
     def OutputString(self):
-        DumpString = '''// B4 0E 设置玩家自身血量 //tagCMSetRoleHP:
+        DumpString = '''// B4 0E 玩家掉血 //tagCMRoleLostHP:
                                 Cmd:%s,
                                 SubCmd:%s,
-                                HP:%d
+                                LostHP:%d
                                 '''\
                                 %(
                                 self.Cmd,
                                 self.SubCmd,
-                                self.HP
+                                self.LostHP
                                 )
         return DumpString
 
 
-m_NAtagCMSetRoleHP=tagCMSetRoleHP()
-ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMSetRoleHP.Cmd,m_NAtagCMSetRoleHP.SubCmd))] = m_NAtagCMSetRoleHP
+m_NAtagCMRoleLostHP=tagCMRoleLostHP()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMRoleLostHP.Cmd,m_NAtagCMRoleLostHP.SubCmd))] = m_NAtagCMRoleLostHP
 
 
 #------------------------------------------------------
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
index f977ed1..32f0756 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
@@ -463,7 +463,7 @@
 
 PacketCMD_22=0xB4
 PacketSubCMD_22=0x0E
-PacketCallFunc_22=OnSetRoleHP
+PacketCallFunc_22=OnRoleLostHP
 
 ;购买相关的
 [BuySomething]
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
index 8a03c63..1fadb2b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
@@ -1036,8 +1036,8 @@
         #对象已经死亡
         return False
     
-    #添加(系统)隐身者不可攻击,证明家族战非隐身;自定义场景中是隐身的不做限制
-    if not attacker.GetVisible() and not attacker.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
+    #添加(系统)隐身者不可攻击,证明家族战非隐身
+    if not attacker.GetVisible():
         return False
     
     if not defender.GetVisible():
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Player_Attack_NormalNPC.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Player_Attack_NormalNPC.py
index 91ad9ee..8cabede 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Player_Attack_NormalNPC.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Player_Attack_NormalNPC.py
@@ -66,6 +66,13 @@
     if defenderCampType == ChConfig.CampType_Justice:
         return ChConfig.Type_Relation_Friend, ChConfig.Def_PASysMessage_None
     
+    #私有木桩只能自己打自己的
+    if curTagNormalNPC.GetType() in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
+        summonPlayerID = curTagNormalNPC.GetDictByKey(ChConfig.Def_NPC_Dict_PriWoodPilePlayerID)
+        if curPlayer.GetPlayerID() != summonPlayerID:
+            return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
+        return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
+    
     return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
 
 ## 攻击
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Player_Attack_SummonNPC.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Player_Attack_SummonNPC.py
index 3873af4..bda684b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Player_Attack_SummonNPC.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Player_Attack_SummonNPC.py
@@ -70,7 +70,8 @@
     
     #私有木桩只能自己打自己的
     if curTagSummonNPC.GetType() in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
-        if not GameWorld.IsSameObj(curPlayer, curTagPlayer):
+        summonPlayerID = curTagSummonNPC.GetDictByKey(ChConfig.Def_NPC_Dict_PriWoodPilePlayerID)
+        if curPlayer.GetPlayerID() != summonPlayerID:
             return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
         return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
     
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/SummonNPC_Attack_SummonNPC.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/SummonNPC_Attack_SummonNPC.py
index 1239646..6994f24 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/SummonNPC_Attack_SummonNPC.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/SummonNPC_Attack_SummonNPC.py
@@ -75,7 +75,8 @@
     if curPlayer != None and curTagPlayer != None :
         #私有木桩只能自己打自己的
         if curTagSummon.GetType() in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
-            if not GameWorld.IsSameObj(curPlayer, curTagPlayer):
+            summonPlayerID = curTagSummon.GetDictByKey(ChConfig.Def_NPC_Dict_PriWoodPilePlayerID)
+            if curPlayer.GetPlayerID() != summonPlayerID:
                 return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
             return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
         
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
index e56f530..1abe51e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -14514,14 +14514,14 @@
 
 
 #------------------------------------------------------
-# B4 0E 设置玩家自身血量 #tagCMSetRoleHP
+# B4 0E 玩家掉血 #tagCMRoleLostHP
 
-class  tagCMSetRoleHP(Structure):
+class  tagCMRoleLostHP(Structure):
     _pack_ = 1
     _fields_ = [
                   ("Cmd", c_ubyte),
                   ("SubCmd", c_ubyte),
-                  ("HP", c_int),    
+                  ("LostHP", c_int),    
                   ]
 
     def __init__(self):
@@ -14538,31 +14538,31 @@
     def Clear(self):
         self.Cmd = 0xB4
         self.SubCmd = 0x0E
-        self.HP = 0
+        self.LostHP = 0
         return
 
     def GetLength(self):
-        return sizeof(tagCMSetRoleHP)
+        return sizeof(tagCMRoleLostHP)
 
     def GetBuffer(self):
         return string_at(addressof(self), self.GetLength())
 
     def OutputString(self):
-        DumpString = '''// B4 0E 设置玩家自身血量 //tagCMSetRoleHP:
+        DumpString = '''// B4 0E 玩家掉血 //tagCMRoleLostHP:
                                 Cmd:%s,
                                 SubCmd:%s,
-                                HP:%d
+                                LostHP:%d
                                 '''\
                                 %(
                                 self.Cmd,
                                 self.SubCmd,
-                                self.HP
+                                self.LostHP
                                 )
         return DumpString
 
 
-m_NAtagCMSetRoleHP=tagCMSetRoleHP()
-ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMSetRoleHP.Cmd,m_NAtagCMSetRoleHP.SubCmd))] = m_NAtagCMSetRoleHP
+m_NAtagCMRoleLostHP=tagCMRoleLostHP()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMRoleLostHP.Cmd,m_NAtagCMRoleLostHP.SubCmd))] = m_NAtagCMRoleLostHP
 
 
 #------------------------------------------------------
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SummonNPC.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SummonNPC.py
index 1afdd2c..635c596 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SummonNPC.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SummonNPC.py
@@ -16,8 +16,6 @@
 import ChConfig
 import GameWorld
 import NPCCommon
-import PlayerFB
-import PlayerControl
 import ShareDefine
 
 #
@@ -31,7 +29,7 @@
     #输入命令格式错误
     if not paramList:
         GameWorld.DebugAnswer(curPlayer, "SummonNPC npcID 个数")
-        GameWorld.DebugAnswer(curPlayer, "SummonNPC npcID 个数 前端场景ID lineID 血量")
+        GameWorld.DebugAnswer(curPlayer, "SummonNPC npcID 个数  血量")
         return
     
     #NPC对象ID
@@ -44,21 +42,7 @@
     
     npcType = npcData.GetType()
     if npcType in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
-        mapID = paramList[2] if len(paramList) > 2 else 0
-        lineID = paramList[3] if len(paramList) > 3 else 0
-        setHP = paramList[4] if len(paramList) > 4 else 0
-        if not mapID:
-            GameWorld.DebugAnswer(curPlayer, "木桩怪必须指定地图ID才能召唤!")
-            return
-        
-        customMapID = PlayerControl.GetCustomMapID(curPlayer)
-        customLineID = PlayerControl.GetCustomLineID(curPlayer)
-        if mapID != customMapID or lineID != customLineID:
-            if customMapID:
-                PlayerFB.DoExitCustomScene(curPlayer)
-            tick = GameWorld.GetGameWorld().GetTick()
-            PlayerFB.DoEnterCustomScene(curPlayer, mapID, lineID, tick)
-            
+        setHP = paramList[2] if len(paramList) > 2 else 0
         hp = setHP % ShareDefine.Def_PerPointValue
         hpEx = setHP / ShareDefine.Def_PerPointValue
         NPCCommon.SummonPriWoodPile(curPlayer, npcID, npcCount, hp, hpEx)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_PriWood.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_PriWood.py
index 62be145..d891106 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_PriWood.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_PriWood.py
@@ -19,6 +19,7 @@
 import NPCCommon
 import GameWorld
 import GameMap
+import ChConfig
 
 
 ##AI逻辑处理
@@ -36,7 +37,10 @@
     #刷新自己的Buff
     npcControl.RefreshBuffState(tick)
     
-    owner = NPCCommon.GetNpcObjOwnerDetail(curNPC)
+    summonPlayerID = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_PriWoodPilePlayerID)
+    if not summonPlayerID:
+        return
+    owner = GameWorld.GetObj(summonPlayerID, IPY_GameWorld.gotPlayer)
     if not owner:
         return
     
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 e6883cb..67f91e3 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -2026,10 +2026,6 @@
     ''' 召唤私有专属木桩怪
     '''
     
-    if not curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
-        GameWorld.DebugLog("玩家当前不是在自定义场景中,不允许招木桩!")
-        return
-    
     mapID = PlayerControl.GetCustomMapID(curPlayer)
     lineID = PlayerControl.GetCustomLineID(curPlayer)
     if mapID:
@@ -2044,7 +2040,7 @@
     if playerID not in PyGameData.g_playerPriWoodPileNPCDict:
         PyGameData.g_playerPriWoodPileNPCDict[playerID] = []
     playerPriWoodNPCList = PyGameData.g_playerPriWoodPileNPCDict[playerID]
-    maxCount = 10
+    maxCount = 3
     nowCount = len(playerPriWoodNPCList)
     summonCount = min(count, maxCount - nowCount)
     #GameWorld.DebugLog("召唤: count=%s,maxCount=%s,nowCount=%s,summonCount=%s,hp=%s,hpEx=%s" 
@@ -4255,10 +4251,10 @@
     def __NPCDropItem(self, dropPlayer, hurtType, hurtID, ownerPlayerList=[]):
         if not dropPlayer:
             return
-        if dropPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
-            GameWorld.DebugLog("前端自定义场景中,不掉落物品!")
-            return
         curNPC = self.__Instance
+        if curNPC.GetType() in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
+            GameWorld.DebugLog("木桩怪,不掉落物品!")
+            return
         npcID = curNPC.GetNPCID()
         mapID = GameWorld.GetMap().GetMapID()
         mapID = FBCommon.GetRecordMapID(mapID)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
index 20a96ea..18f1725 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -5821,18 +5821,23 @@
     NetPackCommon.SendFakePack(curPlayer, sendPack)
     return
 
-#// B4 0E 设置玩家自身血量 #tagCMSetRoleHP
+#// B4 0E 玩家掉血 #tagCMRoleLostHP
 #
-#struct    tagCMSetRoleHP
+#struct    tagCMRoleLostHP
 #{
 #    tagHead        Head;
-#    DWORD        HP;
+#    DWORD        LostHP;
 #};
-def OnSetRoleHP(index, clientData, tick):
+def OnRoleLostHP(index, clientData, tick):
     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
-    if not curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
-        GameWorld.DebugLog("玩家当前不是在自定义场景中,不允许设置自身血量!")
-        return
-    setHP = max(1, min(clientData.HP, curPlayer.GetMaxHP()))
-    curPlayer.SetHP(setHP)
+    lostHP = clientData.LostHP
+    curHP = curPlayer.GetHP()
+    updHP = curHP - lostHP
+    if updHP <= 0:
+        #玩家已经死亡
+        playerControl = PlayerControl.PlayerControl(curPlayer)
+        playerControl.SetDead()
+    else:
+        curPlayer.SetHP(updHP)
+        
     return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py
index 172104d..db95c3c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py
@@ -509,6 +509,7 @@
         
     curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 1) # 由于前端不一定有发mapID,所以这里额外记录这个状态,不能直接用mapID判断
     PlayerControl.SetCustomMap(curPlayer, mapID, lineID)
+    NPCCommon.ClearPriWoodPile(curPlayer)
     GameWorld.Log("玩家开始自定义场景!mapID=%s,lineID=%s" % (mapID, lineID), playerID)
     if mapID:
         PetControl.DoLogic_PetLoadMapOK(curPlayer)

--
Gitblit v1.8.0