From a3298b238480ffc7f8e4d5a95df10c2702ca8921 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 18 七月 2019 14:54:22 +0800
Subject: [PATCH] 1 累计充值活动奖励物品配置格式支持不配置是否拍品

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PetControl.py |   44 ++++++++++++++++++++++++++++++++------------
 1 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PetControl.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PetControl.py
index 023be02..6b72837 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PetControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PetControl.py
@@ -28,7 +28,6 @@
 import IPY_GameWorld
 import ChConfig
 import GameWorld
-import ReadChConfig
 import BuffSkill
 import SkillShell
 import PlayerPet
@@ -47,6 +46,7 @@
 import BaseAttack
 import PassiveBuffEffMng
 import ChNetSendPack
+import IpyGameDataPY
 #---------------------------------------------------------------------
 
 DefPetRebornHPRate = 100  # 宠物死亡复活血量百分比
@@ -240,7 +240,7 @@
 # @return 返回值无意义
 # @remarks 初始化宠物属性
 def InitRolePet(rolePet, canSyncClient=True):
-    #---初始化时钟,致命一击倍率---
+    #---初始化时钟---
     NPCCommon.InitNPC(rolePet)
     
     #---初始化仇恨列表---
@@ -461,7 +461,7 @@
 # @return BOOL 是否可出战
 # @remarks 检查当前指定宠物是否可出战
 def CheckPetCanFight(curPlayer, curPetObj):
-    if not GameWorld.GetMap().GetMapCanOutPet():
+    if not GetMapCanOutPet(curPlayer):
         #Pet_liubo_314885 此地图禁止宠物
         PlayerControl.NotifyCode(curPlayer, "Pet_liubo_314885")
         return False
@@ -517,13 +517,23 @@
 def DoLogic_PetInfo_OnLogin(curPlayer, tick):
    
     petMgr = curPlayer.GetPetMgr()
-
-    for index in range(0, petMgr.PetList_Cnt()):
-        rolePet = petMgr.PetList_At(index)
-        #刷新宠物信息并通知客户端
-        __RefreshAndSyncPetInfo(rolePet)
-        #自动出战宠物
-        __AutoSummonPet_OnLogin(curPlayer, rolePet)
+    if GameWorld.IsCrossServer():
+        ''' 0435宠物出现包同步的ID是根据宠物的列表位置来的,比如在第2位发的就是2,而地图的可能是1,会导致ID不一致
+                            所以跨服服务器登录时先清除出战宠物列表,确保登录地图成功后都是从1开始的即可
+        '''
+        petList = []
+        for index in range(0, petMgr.PetList_Cnt()):
+            rolePet = petMgr.PetList_At(index)
+            petList.append(rolePet)
+        for rolePet in petList:
+            petMgr.PetList_SetFree(rolePet.GetRolePet().PetID)
+    else:
+        for index in range(0, petMgr.PetList_Cnt()):
+            rolePet = petMgr.PetList_At(index)
+            #刷新宠物信息并通知客户端
+            __RefreshAndSyncPetInfo(rolePet)
+            #自动出战宠物
+            __AutoSummonPet_OnLogin(curPlayer, rolePet)
 
     return
 #---------------------------------------------------------------------
@@ -537,7 +547,7 @@
     if not rolePet.GetIsBattle():
         return
     
-    if not GameWorld.GetMap().GetMapCanOutPet():
+    if not GetMapCanOutPet(curPlayer):
         #此地图禁止宠物
         return
     #召唤宠物出战
@@ -569,7 +579,7 @@
 # @remarks 
 def DoLogic_PetLoadMapOK(curPlayer):
     
-    if GameWorld.GetMap().GetMapCanOutPet():
+    if GetMapCanOutPet(curPlayer):
         #此地图宠物可以上
         PlayerPet.AutoSummonPet(curPlayer)
         return
@@ -582,6 +592,16 @@
     PlayerControl.NotifyCode(curPlayer, "Pet_liubo_314885")
     return
 
+def GetMapCanOutPet(curPlayer):
+    ## 检查本地图可否出战宠物,支持前端自定义场景
+    customMapID = PlayerControl.GetCustomMapID(curPlayer)
+    if customMapID:
+        ipyMapData = IpyGameDataPY.GetIpyGameData("ChinMap", customMapID)
+        canOutPet = True if ipyMapData and ipyMapData.GetCanOutPet() else False
+    else:
+        canOutPet = GameWorld.GetMap().GetMapCanOutPet()
+    return canOutPet
+
 #---------------------------------------------------------------------
 ## 刷新宠物信息并通知客户端
 #  @param rolePet 宠物实例

--
Gitblit v1.8.0