From adbac922fdce017605381c4040d4bedbc24dcd1a Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 31 十二月 2025 19:50:37 +0800
Subject: [PATCH] 358 【内政】红颜系统-服务端(红颜效果支持多个相同效果叠加;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTravel.py |   77 ++++++++++++++++++++++----------------
 1 files changed, 45 insertions(+), 32 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTravel.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTravel.py
index b4ea635..3f83ad7 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTravel.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTravel.py
@@ -23,7 +23,6 @@
 import ItemControler
 import PlayerBeauty
 import GameWorld
-import ObjPool
 
 import random
 import time
@@ -119,7 +118,7 @@
     randRow = random.randint(1, randRowMax)
     randCol = random.randint(1, randColMax)
     sceneryValue = randRow * 100 + randCol * 10 + sceneryType
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TravelScenery, sceneryValue)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TravelSceneryState, sceneryValue)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TravelSceneryLVInfo, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TravelState, 0)
     GameWorld.DebugLog("    景观位置: randRow=%s,randCol=%s,sceneryValue=%s" % (randRow, randCol, sceneryValue))
@@ -134,15 +133,23 @@
     return sceneryType, randRow, randCol
 
 def __getSceneryInfo(curPlayer):
-    sceneryValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TravelScenery)
-    sRow = sceneryValue / 100
+    sceneryValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TravelSceneryState)
+    found = sceneryValue / 1000 # 是否已被找到
+    sRow = sceneryValue % 1000 / 100
     sCol = sceneryValue % 100 / 10
     sceneryType = sceneryValue % 10
-    return sceneryType, sRow, sCol
+    return sceneryType, sRow, sCol, found
+
+def SetSceneryFound(curPlayer):
+    sceneryValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TravelSceneryState)
+    sceneryValue = sceneryValue % 1000 + 1000
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TravelSceneryState, sceneryValue)
+    GameWorld.DebugLog("    设置景观被找到了: sceneryValue=%s" % sceneryValue)
+    return
 
 def __checkSceneryOpend(curPlayer):
     ## 检查景观相关格子是否已全部打开
-    sceneryType, sRow, sCol = __getSceneryInfo(curPlayer)
+    sceneryType, sRow, sCol, _ = __getSceneryInfo(curPlayer)
     if sceneryType not in SceneryTypeSet:
         return
     rowSet, colSet = SceneryTypeSet[sceneryType]
@@ -255,30 +262,23 @@
         
     return
 
-def __doClickUnOpendGrid(curPlayer, row, col):
+def __doClickUnOpendGrid(curPlayer, row, col, isBomb=False):
     ## 执行点击未开启的格子
     gridState = GetGridState(curPlayer, row, col)
-    if gridState == GridState_None:
-        crackRate = IpyGameDataPY.GetFuncCfg("TravelRate", 1)
-        if GameWorld.CanHappen(crackRate):
-            GameWorld.DebugLog("触发裂纹: row=%s,col=%s,crackRate=%s" % (row, col, crackRate))
-            SetGridState(curPlayer, row, col, GridState_Crack)
-        else:
-            __openGridRandEvent(curPlayer, row, col)
-            
-    # 再次点击裂纹
-    elif gridState == GridState_Crack:
-        __openGridRandEvent(curPlayer, row, col)
+    if gridState in [GridState_None, GridState_Crack]:
+        __openGridRandEvent(curPlayer, row, col, isBomb)
     else:
         return
     return True
 
-def __openGridRandEvent(curPlayer, row, col):
+def __openGridRandEvent(curPlayer, row, col, isBomb=False):
     ## 执行打开格子随机生成事件
-    SetGridState(curPlayer, row, col, GridState_Opend)
     eventID = GetGridEventID(curPlayer, row, col)
     if eventID:
+        SetGridState(curPlayer, row, col, GridState_Opend)
         GameWorld.DebugLog("该游历格子已经有事件ID了! row=%s,col=%s,eventID=%s" % (row, col, eventID))
+        if eventID < EventID_Portal:
+            SetSceneryFound(curPlayer)
         return
     
     # 生成事件ID
@@ -296,12 +296,20 @@
         eventID = EventID_Blank
     else:
         eventID = ipyData.GetEventID()
-        if ipyData.GetAwardItemID():
+        awardItemID = ipyData.GetAwardItemID()
+        # 炸弹不出裂纹
+        if not isBomb and awardItemID in IpyGameDataPY.GetFuncEvalCfg("TravelRate", 1) and GetGridState(curPlayer, row, col) == GridState_None:
+            GameWorld.DebugLog("必出现裂纹的奖励事件! eventID=%s,awardItemID=%s" % (eventID, awardItemID))
+            SetGridState(curPlayer, row, col, GridState_Crack)
+            
+        if awardItemID:
             multiRate = IpyGameDataPY.GetFuncCfg("TravelRate", 2)
             if GameWorld.CanHappen(multiRate):
                 multi = 2
     SetGridMulti(curPlayer, row, col, multi)
     SetGridEventID(curPlayer, row, col, eventID)
+    if GetGridState(curPlayer, row, col) == GridState_None:
+        SetGridState(curPlayer, row, col, GridState_Opend)
     GameWorld.DebugLog("随机格子事件: row=%s,col=%s,eventID=%s,multi=%s" % (row, col, eventID, multi))
     return
 
@@ -324,13 +332,15 @@
         rowMax, colMax = IpyGameDataPY.GetFuncEvalCfg("TravelSet", 3) # 行列
         # 同行
         for c in range(1, 1 + colMax):
-            if __doClickUnOpendGrid(curPlayer, row, c):
+            if __doClickUnOpendGrid(curPlayer, row, c, isBomb=True):
                 syncGridList.append([row, c])
         # 同列
         for r in range(1, 1 + rowMax):
-            if __doClickUnOpendGrid(curPlayer, r, col):
+            if __doClickUnOpendGrid(curPlayer, r, col, isBomb=True):
                 syncGridList.append([r, col])
-                
+        SetGridEventID(curPlayer, row, col, EventID_Blank) # 炸弹消失
+        syncGridList.append([row, col])
+        
     # 传送门
     elif eventID == EventID_Portal:
         GameWorld.DebugLog("点击传送门! row=%s,col=%s,eventID=%s" % (row, col, eventID))
@@ -366,6 +376,9 @@
         for col in range(1, 1 + colMax):
             eventID = GetGridEventID(curPlayer, row, col)
             if eventID in SpecEventIDList or eventID < EventID_Portal:
+                continue
+            if GetGridState(curPlayer, row, col) != GridState_Opend:
+                #GameWorld.DebugLog("    未开启的格子: row=%s,col=%s,eventID=%s" % (row, col, eventID))
                 continue
             ipyData = IpyGameDataPY.GetIpyGameDataNotLog("TravelEvent", eventID)
             if not ipyData:
@@ -404,7 +417,7 @@
     if not __checkSceneryOpend(curPlayer):
         return
     
-    sceneryType, sRow, sCol = __getSceneryInfo(curPlayer)
+    sceneryType, sRow, sCol, _ = __getSceneryInfo(curPlayer)
     ipyDataList = IpyGameDataPY.GetIpyGameDataList("TravelScenery", sceneryType)
     if not ipyDataList:
         return
@@ -480,22 +493,22 @@
                 
     gridList = []
     for row, col in syncGridList:
-        grid = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCTravelGrid)
+        grid = ChPyNetSendPack.tagSCTravelGrid()
         grid.Row = row
         grid.Col = col
         grid.State = GetGridState(curPlayer, row, col)
         grid.Multi = GetGridMulti(curPlayer, row, col)
-        grid.EventID = GetGridEventID(curPlayer, row, col)
+        grid.EventID = GetGridEventID(curPlayer, row, col) if grid.State == GridState_Opend else 0
         gridList.append(grid)
         
-    sceneryType, sRow, sCol = __getSceneryInfo(curPlayer)
-    clientPack = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCTravelInfo)
+    sceneryType, sRow, sCol, found = __getSceneryInfo(curPlayer)
+    clientPack = ChPyNetSendPack.tagSCTravelInfo()
     clientPack.Energy = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TravelEnergy)
     clientPack.EnergyTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TravelEnergyTime)
     clientPack.TravelCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TravelCnt)
-    clientPack.SceneryType = sceneryType
-    clientPack.SceneryRow = sRow
-    clientPack.SceneryCol = sCol
+    clientPack.SceneryType = sceneryType if found else 0
+    clientPack.SceneryRow = sRow if found else 0
+    clientPack.SceneryCol = sCol if found else 0
     clientPack.SceneryLVInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TravelSceneryLVInfo)
     clientPack.Result = result
     clientPack.GridList = gridList

--
Gitblit v1.8.0