From 1fb6bd99f2119db7dd05de12979635e4b648707b Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 06 七月 2022 16:23:04 +0800
Subject: [PATCH] 9652 【越南】【yn_ver1】【主干】【qkbt52】【x7bt5】【bt7】增加共享视野层(仙盟boss、骑宠boss支持共享视野层)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/KillScreenNPC.py                        |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_AllFamilyBoss.py |   21 +++++++++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py                                |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtMgr.py                                   |    4 +-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py                               |    4 +-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_HorsePetBoss.py  |   20 +++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py                  |   11 +++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                                         |    3 +
 8 files changed, 57 insertions(+), 10 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 5910d59..8c1e2dc 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
@@ -746,6 +746,15 @@
 
 #--------------------------------------------------------------------------
 
+def CheckSightLevel(attacker, defender):
+    ## 判断是否可视视野层级
+    # @return 是否在可视视野层
+    if not attacker.GetVisible() or not defender.GetVisible():
+        return False
+    if defender.GetSightLevel() == ChConfig.SightLevel_Public or attacker.GetSightLevel() == ChConfig.SightLevel_Public:
+        return True
+    return attacker.GetSightLevel() == defender.GetSightLevel()
+
 #--------攻击对象判断,给内层调用
 
 ## 攻击对象,通用判断 
@@ -763,7 +772,7 @@
         #GameWorld.Log("defender = %s->%s 这个对象不可攻击"%(defender.GetName(),defender.GetID()))
         return False
     
-    if attacker.GetSightLevel() != defender.GetSightLevel():
+    if not CheckSightLevel(attacker, defender):
         return False
     
     atkObjType = attacker.GetGameObjType()
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 1002ab8..094cfa9 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py
@@ -1103,7 +1103,7 @@
     if curObjType not in hurtTypeList:
         return None, None
     
-    if attacker.GetSightLevel() != curObj.GetSightLevel():
+    if not AttackCommon.CheckSightLevel(attacker, curObj):
         return None, None
     
     #攻击对象
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 2298bbf..63609dd 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -2407,6 +2407,9 @@
 Def_PlayerSight_Hack = 3    #外挂玩家视野
 
 Def_PlayerInSightObjCount_Default = 30
+
+#公共视野层级
+SightLevel_Public = 1
 #---------------------------------------------------------------------
 #NPC刷新时间间隔
 TYPE_NPC_Tick_ProcessAI = 0           #NPC逻辑调用间隔
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 29b96e0..9422613 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
@@ -86,7 +86,7 @@
         return
     if not curNPC.GetVisible():
         return
-    if curPlayer.GetSightLevel() != curNPC.GetSightLevel():
+    if not AttackCommon.CheckSightLevel(curPlayer, curNPC):
         return
     curHP = GameObj.GetHP(curNPC)
     AttackCommon.NPCAddObjInHurtList(curPlayer, curNPC, curHP, curHP)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_AllFamilyBoss.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_AllFamilyBoss.py
index b290819..e01ad7a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_AllFamilyBoss.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_AllFamilyBoss.py
@@ -42,6 +42,8 @@
 FBDict_EncourageCnt = 'FBDict_EncourageCnt'  #鼓舞过次数
 Map_FB_StartTick = 'Map_FB_StartTick' #活动开始时间
 
+Map_SightLevelCounter = 'Map_SightLevelCounter' #视野层级人数计数器
+
 (
     Def_BossTime,  #BOSS时间
     Def_LeaveTime,  #离开时间
@@ -128,6 +130,7 @@
     if state:
         if not GameWorld.GetGameWorld().GetGameWorldDictByKey(Map_FB_StartTick):
             GameWorld.GetGameWorld().SetGameWorldDict(Map_FB_StartTick, tick)
+        GameWorld.GetGameWorld().SetGameWorldDict(Map_SightLevelCounter, 0)
     else:
         GameWorld.GetGameWorld().SetGameWorldDict(Map_FB_StartTick, 0)
         if not GameWorld.GetGameFB().GetGameFBDictByKey(FBDict_IsOver):
@@ -173,7 +176,14 @@
     if fbStep >= FB_Step_Over:
         PlayerControl.PlayerLeaveFB(curPlayer)
         return
-
+    
+    sightPlayerCount = IpyGameDataPY.GetFuncCfg("LeagueBOSSSight", 1)
+    counter = GameWorld.GetGameWorld().GetGameWorldDictByKey(Map_SightLevelCounter) + 1
+    GameWorld.GetGameWorld().SetGameWorldDict(Map_SightLevelCounter, counter)
+    sightLevel = (counter - 1) / sightPlayerCount + 10 # 自定义视野层级从10开始,1为公共视野层
+    PlayerControl.SetPlayerSightLevel(curPlayer, sightLevel)
+    GameWorld.DebugLog("counter=%s,SetPlayerSightLevel=%s" % (counter, sightLevel), playerID)
+    
     if familyID not in PyGameData.g_allfamilyBossDict:
         PyGameData.g_allfamilyBossDict[familyID] = [curPlayer.GetFamilyName(), 0, [playerID]]
     elif playerID not in PyGameData.g_allfamilyBossDict[familyID][2]:
@@ -508,7 +518,14 @@
     __DoLogicAllFamilyBossOver(1, tick, dropPosX, dropPosY)
     return
 
-
+def DoFBRebornNPC(curNPC, tick):
+    ##副本有NPC召出
+    lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
+    bossID = CurFBLineBOSSID(lineID)
+    if curNPC.GetNPCID() == bossID:
+        curNPC.SetSightLevel(ChConfig.SightLevel_Public) # 设置boss为公共视野层级
+        
+    return
 
 def GetBossRemainHPPer(copyMapID, tick):
     bossID = CurFBLineBOSSID()
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_HorsePetBoss.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_HorsePetBoss.py
index 2bec0fe..b98b449 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_HorsePetBoss.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_HorsePetBoss.py
@@ -36,6 +36,8 @@
 FBDict_IsOver = 'FBDict_IsOver' #是否已结算, 结算时的tick
 Map_FB_StartTick = 'Map_FB_StartTick' #活动开始时间
 
+Map_SightLevelCounter = 'Map_SightLevelCounter' #视野层级人数计数器
+
 (
 Def_BossTime,  #BOSS时间
 Def_LeaveTime,  #离开时间
@@ -105,6 +107,7 @@
     if state:
         if not GameWorld.GetGameWorld().GetGameWorldDictByKey(Map_FB_StartTick):
             GameWorld.GetGameWorld().SetGameWorldDict(Map_FB_StartTick, tick)
+        GameWorld.GetGameWorld().SetGameWorldDict(Map_SightLevelCounter, 0)
     else:
         GameWorld.GetGameWorld().SetGameWorldDict(Map_FB_StartTick, 0)
         if GameWorld.GetGameFB().GetFBStep() == FB_Step_Fighting:
@@ -148,7 +151,14 @@
         if fbStep == FB_Step_Open:
             FBCommon.SetFBStep(FB_Step_Fighting, tick)
     UpdateHurtInfo(curPlayer, 0, True)
-   
+    
+    sightPlayerCount = IpyGameDataPY.GetFuncCfg("HorsePetBOSSSight", 1)
+    counter = GameWorld.GetGameWorld().GetGameWorldDictByKey(Map_SightLevelCounter) + 1
+    GameWorld.GetGameWorld().SetGameWorldDict(Map_SightLevelCounter, counter)
+    sightLevel = (counter - 1) / sightPlayerCount + 10 # 自定义视野层级从10开始,1为公共视野层
+    PlayerControl.SetPlayerSightLevel(curPlayer, sightLevel)
+    GameWorld.DebugLog("counter=%s,SetPlayerSightLevel=%s" % (counter, sightLevel), playerID)
+    
     gameFB = GameWorld.GetGameFB()
     # 上鼓舞buff
     encourageLV = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_EncourageLV)
@@ -446,6 +456,14 @@
     GameWorld.GetGameFB().SetGameFBDict(FBDict_IsOver, tick)
     return
 
+def DoFBRebornNPC(curNPC, tick):
+    ##副本有NPC召出
+    lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
+    bossID = CurFBLineBOSSID(lineID)
+    if curNPC.GetNPCID() == bossID:
+        curNPC.SetSightLevel(ChConfig.SightLevel_Public) # 设置boss为公共视野层级
+        
+    return
 
 def GetBossRemainHPPer(copyMapID, funcLineID, tick):
     bossID = CurFBLineBOSSID(funcLineID)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py
index 29046dd..60b42ca 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py
@@ -543,7 +543,7 @@
                         GameWorld.Log("        非协助伤血玩家没有攻击boss次数,不计!playerID=%s" % playerID, self.npcID, self.lineID)
                     return False
                 
-            if player.GetInitOK() and (not player.GetVisible() or player.GetSightLevel() != self.curNPC.GetSightLevel()):
+            if player.GetInitOK() and (not player.GetVisible() or not AttackCommon.CheckSightLevel(player, self.curNPC)):
                 GameWorld.DebugLog("伤血玩家不可见,不计!playerID=%s" % playerID, self.npcID, self.lineID)
                 if self.logDetail:
                     GameWorld.Log("        伤血玩家不可见,不计!playerID=%s" % playerID, self.npcID, self.lineID)
@@ -691,7 +691,7 @@
                     playerDisableReason[playerID] = "dead"
                     continue
                 
-                if not player.GetVisible() or player.GetSightLevel() != curNPC.GetSightLevel():
+                if not player.GetVisible() or not AttackCommon.CheckSightLevel(player, curNPC):
                     playerDisableReason[playerID] = "no visible or sightLevel different"
                     continue
                 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtMgr.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtMgr.py
index 116f46a..ca14f08 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtMgr.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtMgr.py
@@ -239,7 +239,7 @@
         '''第一个可攻击的最大伤血对象
         @return: atkPlayer, hurtType, hurtID
         '''
-        
+        import AttackCommon
         atkPlayer, atkHurtType, atkHurtID = None, 0, 0
         curNPC = self.curNPC
         refreshPoint = curNPC.GetRefreshPosAt(curNPC.GetCurRefreshPointIndex())
@@ -262,7 +262,7 @@
                     playerDisableReason[playerID] = "dead"
                     continue
                 
-                if not player.GetVisible() or player.GetSightLevel() != curNPC.GetSightLevel():
+                if not player.GetVisible() or not AttackCommon.CheckSightLevel(player, curNPC):
                     playerDisableReason[playerID] = "no visible or sightLevel different"
                     continue
                 

--
Gitblit v1.8.0