From 52e17999f97477f222094a0b6e7e32129e97c404 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 17 一月 2024 17:09:07 +0800
Subject: [PATCH] 10019 【砍树】回合战斗(根据地图处理默认视野)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Map/GameMap.py | 9 ++++++++-
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py | 7 +++++--
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py | 5 ++++-
PySysDB/PySysDBPY.h | 1 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py | 27 ++++++++++++++++++++++++++-
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py | 4 ++++
6 files changed, 48 insertions(+), 5 deletions(-)
diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index 8895cf0..e5b5974 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -831,6 +831,7 @@
DWORD _MapID; //地图ID
BYTE CanRide; //可否骑乘
BYTE CanOutPet; //可否召唤宠物
+ DWORD SightType; //视野类型
};
//副本总表
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 4c428aa..1209e91 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -2447,6 +2447,10 @@
#公共视野层级
SightLevel_Public = 1
+
+#视野类型
+SightType_Public = 0 # 公共
+SightType_Private = 1 # 私有
#---------------------------------------------------------------------
#NPC刷新时间间隔
TYPE_NPC_Tick_ProcessAI = 0 #NPC逻辑调用间隔
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index c3611bc..3e7e584 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -683,6 +683,7 @@
("DWORD", "MapID", 1),
("BYTE", "CanRide", 0),
("BYTE", "CanOutPet", 0),
+ ("DWORD", "SightType", 0),
),
"FBFunc":(
@@ -3623,12 +3624,14 @@
def __init__(self):
self.MapID = 0
self.CanRide = 0
- self.CanOutPet = 0
+ self.CanOutPet = 0
+ self.SightType = 0
return
def GetMapID(self): return self.MapID # 地图ID
def GetCanRide(self): return self.CanRide # 可否骑乘
- def GetCanOutPet(self): return self.CanOutPet # 可否召唤宠物
+ def GetCanOutPet(self): return self.CanOutPet # 可否召唤宠物
+ def GetSightType(self): return self.SightType # 视野类型
# 副本总表
class IPY_FBFunc():
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Map/GameMap.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Map/GameMap.py
index 1ff81a7..4c6a2c5 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Map/GameMap.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Map/GameMap.py
@@ -363,4 +363,11 @@
GameWorld.DebugLog(" attrName=%s,value=%s,setValue=%s,%s" % (attrName, value, setValue, attrOwner), playerID)
return
-
\ No newline at end of file
+
+def GetMapSightType():
+ ## 获取地图视野类型
+ mapID = GameWorld.GetMap().GetMapID()
+ ipyMapData = IpyGameDataPY.GetIpyGameData("ChinMap", mapID)
+ if not ipyMapData:
+ return ChConfig.SightType_Public
+ return ipyMapData.GetSightType()
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 58f8200..fc37240 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -1298,6 +1298,8 @@
if realmDifficulty:
GameWorld.DebugLog("===登录本服地图时,处于境界难度地图,自动设置难度! realmDifficulty=%s" % realmDifficulty, curPlayer.GetPlayerID())
PlayerControl.SetRealmDifficulty(curPlayer, realmDifficulty)
+ else:
+ PlayerControl.SetPlayerSightLevelByMap(curPlayer)
PlayerState.ChangePlayerSigh(curPlayer, tick)
@@ -1667,7 +1669,8 @@
if realmDifficulty:
GameWorld.DebugLog("===本服LoadMapOK时玩家处于境界难度地图,自动设置难度!realmDifficulty=%s" % realmDifficulty, curPlayer.GetPlayerID())
PlayerControl.SetRealmDifficulty(curPlayer, realmDifficulty)
-
+ else:
+ PlayerControl.SetPlayerSightLevelByMap(curPlayer)
curPlayer.RefreshView()
curPlayer.SetVisible(True)
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 88525f4..8252355 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -7468,6 +7468,10 @@
sightLevel = realmDifficulty
GameWorld.DebugLog("境界地图自动设置已选择的境界难度视野: sightLevel=%s" % sightLevel)
+ mapSightType = GameMap.GetMapSightType()
+ if mapSightType == ChConfig.SightType_Private:
+ sightLevel = curPlayer.GetPlayerID() # 强制为私有层级
+
curPlayer.SetSightLevel(sightLevel)
rolePet = curPlayer.GetPetMgr().GetFightPet()
#无出战宠物
@@ -7479,4 +7483,25 @@
if not curSummon:
continue
curSummon.SetSightLevel(sightLevel)
- return
\ No newline at end of file
+ return
+
+def SetPlayerSightLevelByMap(curPlayer):
+ playerID = curPlayer.GetPlayerID()
+ sightLevel = playerSightLevel = curPlayer.GetSightLevel()
+ mapSightType = GameMap.GetMapSightType()
+ if mapSightType == ChConfig.SightType_Private:
+ sightLevel = playerID
+ else:
+ # 默认公共视野 ChConfig.SightType_Public
+ if playerSightLevel == playerID:
+ sightLevel = 0 # 私人视野强制改为公共视野
+ else:
+ # 公共视野遵循其他自定义视野层级逻辑
+ return
+
+ if sightLevel == playerSightLevel:
+ return
+ GameWorld.DebugLog("地图切换玩家视野: mapSightType=%s,playerSightLevel=%s to sightLevel=%s"
+ % (mapSightType, playerSightLevel, sightLevel), playerID)
+ SetPlayerSightLevel(curPlayer, sightLevel)
+ return
--
Gitblit v1.8.0