From 2e3bfd7836c318ee39e4cdafd33ca2c50d6a7c1d Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期三, 19 十二月 2018 13:37:19 +0800
Subject: [PATCH] 5512 子 【开发】【1.4】跨服竞技场 / 【后端】【1.4】跨服竞技场开发 - 跨服接口和新增跨服竞技副本

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPet.py |   60 ++++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 42 insertions(+), 18 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPet.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPet.py
index e79aeea..5a25e67 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPet.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPet.py
@@ -35,6 +35,7 @@
 import IpyGameDataPY
 import PlayerAttrFruit
 import GameMap
+import OpenServerCampaign
 import PlayerMagicWeapon
 import PassiveBuffEffMng
 import CalcNoLineEffect
@@ -235,15 +236,16 @@
     
     # 当前状态处理
     if curState == ShareDefine.Def_PetState_Fight:
-        curPet = curPlayer.GetPetMgr().GetFightPet()
-        if curPet:
-            #已是出战状态, C++召唤坐标和人重叠
-            resultPos = GameMap.GetEmptyPlaceInArea(curPlayer.GetPosX(), curPlayer.GetPosY(), ChConfig.Def_SummonAppearDist)
-            curPet.ResetPos(resultPos.GetPosX(), resultPos.GetPosY())
-            PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPet)
-            PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveBuff(curPet)
-        return
-        #PetControl.ReCallFightPet(curPlayer)
+#        curPet = curPlayer.GetPetMgr().GetFightPet()
+#        if curPet:
+#            #已是出战状态, C++召唤坐标和人重叠
+#            resultPos = GameMap.GetEmptyPlaceInArea(curPlayer.GetPosX(), curPlayer.GetPosY(), ChConfig.Def_SummonAppearDist)
+#            curPet.ResetPos(resultPos.GetPosX(), resultPos.GetPosY())
+#            PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPet)
+#            PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveBuff(curPet)
+#        return
+        #18/10/15 因为某种未知原因宠物物品的状态是出战(实际场景中未出战),导致该宠物无法出战,故再次发包出战时,此处不拦!
+        PetControl.ReCallFightPet(curPlayer)
    
     else:
         pass
@@ -303,22 +305,22 @@
     PetControl.DoLogic_PlayerPetLearnSkillList(rolePet, learnSkillList)
     
     #---刷新属性(不通知)---
-    #GameWorld.DebugLog("刷前: petID=%s,playerID=%s,npcID=%s,BindType=%s,AIMode=%s,PetIndex=%s,petFinalHurtPer=%s,grade=%s,qualLV=%s," 
+    #GameWorld.DebugLog("刷前: petID=%s,playerID=%s,npcID=%s,BindType=%s,AIMode=%s,PetIndex=%s,grade=%s,qualLV=%s," 
     #                   % (petStruct.PetID, petStruct.PlayerID, petStruct.NPCID, petStruct.BindType, petStruct.AIMode, petStruct.PetIndex,
-    #                      rolePet.GetBattleValEx5(), rolePet.GetGrade(), rolePet.GetQualityLV()))
+    #                      rolePet.GetGrade(), rolePet.GetQualityLV()))
     petControl = NPCCommon.NPCControl(rolePet)
     petControl.RefreshNPCState(canSyncClient=False)
-    #GameWorld.DebugLog("刷后: petID=%s,playerID=%s,npcID=%s,BindType=%s,AIMode=%s,PetIndex=%s,petFinalHurtPer=%s,grade=%s,qualLV=%s," 
+    #GameWorld.DebugLog("刷后: petID=%s,playerID=%s,npcID=%s,BindType=%s,AIMode=%s,PetIndex=%s,grade=%s,qualLV=%s," 
     #                   % (petStruct.PetID, petStruct.PlayerID, petStruct.NPCID, petStruct.BindType, petStruct.AIMode, petStruct.PetIndex,
-    #                      rolePet.GetBattleValEx5(), rolePet.GetGrade(), rolePet.GetQualityLV()))
+    #                      rolePet.GetGrade(), rolePet.GetQualityLV()))
     
     #当前血量(不通知)
     PetControl.SetPetHP(rolePet, rolePet.GetMaxHP(), False)
     
     #---通知客户端---
-    rolePet.Sync_PetInfo()
+    #rolePet.Sync_PetInfo()
     #刷新技能栏
-    rolePet.Sync_SkillList()
+    #rolePet.Sync_SkillList()
     
     #---收到"宠物出战"请求---
     #检查是否可出战
@@ -469,6 +471,9 @@
             PetControl.DoLogic_PlayerPetLearnSkillList(rolePet, learnSkillList)
     RefreshPetItemAddAttr(curPlayer, True)
     SetPetSkillFightPower(curPlayer)    # 技能战力重算
+    
+    # 开服活动数据
+    OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_PetLV, GetTotalPetLV(curPlayer))
     return True
 
 
@@ -682,16 +687,34 @@
     
         SetPetSkillFightPower(curPlayer)    # 技能战力重算
         RefreshPetItemAddAttr(curPlayer, True)
-
+        
+        # 开服活动数据
+        OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_PetLV, GetTotalPetLV(curPlayer))
+        
     PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_PetClassLV, 1, [petNPCID, updClassLV + 1])
     extraInfoDict = {"petItemIndex":PetItemIndex, "petNPCID":petNPCID}
     extraInfoDict.update(eval(petDataItem.GetUserData()))
     DataRecordPack.DR_ClassUpSystem(curPlayer, "PetClassUp", updClassLV, extraInfoDict)
         
     #EventReport.WriteEvent_pet_class(curPlayer, petNpcData.GetName(), classLV, petClassExp, updClassLV, newClassExp)
+    
     return
 
-
+def GetTotalPetLV(curPlayer):
+    totalPetLV = 0
+    petPackIndex = ShareDefine.rptPet
+    petPack = curPlayer.GetItemManager().GetPack(petPackIndex)
+    for i in range(petPack.GetCount()):
+        petItem = petPack.GetAt(i)
+        if petItem.IsEmpty():
+            continue 
+        petItemNPCID = petItem.GetUserAttr(ShareDefine.Def_IudetPet_NPCID)
+        classLV = petItem.GetUserAttr(ShareDefine.Def_IudetPet_ClassLV) + 1
+        petIpyData = GetPetIpydata(petItemNPCID)
+        if not petIpyData:
+            continue
+        totalPetLV += classLV
+    return totalPetLV
 
 ## 刷新宠物数据物品增加的属性
 def RefreshPetItemAddAttr(curPlayer, isUpdBillboard):
@@ -756,7 +779,8 @@
     PlayerControl.CalcAttrDict_Type(ShareDefine.Def_Effect_PetMaxAtk, totalMaxAtk, allAttrListPet)
     totalSignNum = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TotalSignNum) # 总签到天数
     # 果实给人物加属性, 魂石果实算附加属性层,单独计算
-    PlayerAttrFruit.CalcAttrFruitAddAtrr(curPlayer, allAttrListPetSoul, ShareDefine.Def_AttrFruitFunc_Pet)
+    fightPowerEx = PlayerAttrFruit.CalcAttrFruitAddAtrr(curPlayer, allAttrListPetSoul, ShareDefine.Def_AttrFruitFunc_Pet)
+    curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPEx % ShareDefine.Def_MFPType_PetSoul, fightPowerEx)
     
     #灵兽技能给人物加的属性
     learnSkillList, passiveSkillList = GetPetLearnSkill(curPlayer)

--
Gitblit v1.8.0