From d3115b04ecd4b349327482b3a0be41fae1673cae Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期六, 25 五月 2019 16:40:08 +0800
Subject: [PATCH] 6942 【后端】视野层级设计

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py                               |    6 +++---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py                    |    4 ++--
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IPY_GameObj.py                                   |    2 ++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py                             |    3 +++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py                               |    2 +-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py               |    3 +++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/SummonNPC_Attack_SummonNPC.py |    7 +++++++
 7 files changed, 21 insertions(+), 6 deletions(-)

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 b90f427..0c84837 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
@@ -768,6 +768,9 @@
         #GameWorld.Log("defender = %s->%s 这个对象不可攻击"%(defender.GetName(),defender.GetID()))
         return False
     
+    if attacker.GetSightLevel() != defender.GetSightLevel():
+        return False
+    
     atkObjType = attacker.GetGameObjType()
     defObjType = defender.GetGameObjType()
     # 如果是玩家 打 NPC
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 976ae7a..1239646 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
@@ -73,10 +73,17 @@
         return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
     
     if curPlayer != None and curTagPlayer != None :
+        #私有木桩只能自己打自己的
+        if curTagSummon.GetType() in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
+            if not GameWorld.IsSameObj(curPlayer, curTagPlayer):
+                return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
+            return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
+        
         #同一玩家不互相攻击
         if GameWorld.IsSameObj(curPlayer, curTagPlayer):
             return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
         
+        
         #检查攻击模式
         if not AttackCommon.CheckPlayerAttackMode_Player(curPlayer, curTagPlayer):
             return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_AttackMode
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py
index 54e471b..1319532 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py
@@ -1097,6 +1097,9 @@
     if curObjType not in hurtTypeList:
         return None, None
     
+    if attacker.GetSightLevel() != curObj.GetSightLevel():
+        return None, None
+    
     #攻击对象
     if not curTag:
         curTag = GameWorld.GetObj(curObj.GetID(), curObjType)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py
index 87965e4..43cf85d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py
@@ -7294,10 +7294,10 @@
     visible = GameWorld.ToIntDef(curActionNode.GetAttribute("id"), 0)
     if visible:
         curPlayer.SetVisible(True)
-        curPlayer.SetSight(ChConfig.Def_PlayerSight_Default)
+        curPlayer.SetSightLevel(0)
     else:
         curPlayer.SetVisible(False)
-        curPlayer.SetSight(0)
+        curPlayer.SetSightLevel(curPlayer.GetID())
     return
 
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IPY_GameObj.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IPY_GameObj.py
index cb9d533..f7fa723 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IPY_GameObj.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IPY_GameObj.py
@@ -443,6 +443,8 @@
     def GetVisible(self): return _IPY_GameObj.IPY_GameObj_GetVisible(self)
     def SetIsBlind(self, *args): return _IPY_GameObj.IPY_GameObj_SetIsBlind(self, *args)
     def GetIsBlind(self): return _IPY_GameObj.IPY_GameObj_GetIsBlind(self)
+    def SetSightLevel(self, *args): return _IPY_GameObj.IPY_GameObj_SetSightLevel(self, *args)
+    def GetSightLevel(self): return _IPY_GameObj.IPY_GameObj_GetSightLevel(self)
     def CanSeeOther(self, *args): return _IPY_GameObj.IPY_GameObj_CanSeeOther(self, *args)
     def RefreshView(self): return _IPY_GameObj.IPY_GameObj_RefreshView(self)
     def UpdatePos(self): return _IPY_GameObj.IPY_GameObj_UpdatePos(self)
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 09c2ac0..0f7781f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -1035,7 +1035,7 @@
     #刷新玩家的视野
     if not GameWorld.IsCrossServer() and (PlayerControl.GetCrossMapID(curPlayer) or curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene)):
         GameWorld.DebugLog("===登录本服地图时,处于跨服或自定义场景状态,不刷新视野!", curPlayer.GetPlayerID())
-        curPlayer.SetSight(0)
+        curPlayer.SetSightLevel(curPlayer.GetID())
     elif curPlayer.GetLV() > 1:
         PlayerState.ChangePlayerSigh(curPlayer, tick)
     
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 a7c3f1d..e690f7a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py
@@ -498,7 +498,7 @@
     
     curPlayer.SetCanAttack(False)
     curPlayer.SetVisible(False)
-    curPlayer.SetSight(0)
+    curPlayer.SetSightLevel(curPlayer.GetID())
     curPet = curPlayer.GetPetMgr().GetFightPet()
     if curPet:
         curPet.SetVisible(False)
@@ -518,9 +518,9 @@
     ## 退出自定义场景状态
     curPlayer.SetCanAttack(True)
     curPlayer.SetVisible(True)
-    curPlayer.SetSight(0)
+    curPlayer.SetSightLevel(curPlayer.GetID())
     curPlayer.RefreshView()
-    curPlayer.SetSight(ChConfig.Def_PlayerSight_Default)
+    curPlayer.SetSightLevel(0)
     curPlayer.RefreshView()
     curPet = curPlayer.GetPetMgr().GetFightPet()
     if curPet:

--
Gitblit v1.8.0